Persist and retrieve SAIF-side integration records¶
This operation covers the BOF persistence classes that give the rest of the library (and its callers) a local, SAIF-side view of US Bank integration state: clsUSBankUser/clsUSBankUserCollection track which policy/business-online-user pairs have a US Bank profile, and clsUSBankNonpayNotice/clsUSBankNonpayNoticeCollection record nonpayment notices received from US Bank. Both business objects follow the standard SAIF BOF template — Create/BeforeRetrieve/AfterRetrieve/BeforeInsert/AfterInsert/BeforeUpdate/AfterUpdate/BeforeDelete/AfterDelete — with exact-row-count checks guarding every write.
| Field | Value |
|---|---|
| Operation ID | OP-EPAY-07 |
| Trigger | BOF factory calls (NewUSBankUser, GetUSBankUser, GetUSBankUsers) and subsequent Save()/collection Save() calls |
| Inputs | Policy number, business-online user ID, US Bank user sequence number (user path); policy number, US Bank user sequence number, online payment type code, banking network code, payment amount, notice date, event description (notice path) |
| Outputs | Populated single objects or collections; inserted, updated, or deleted rows; AddErrorMessage broken-rule entries on row-count mismatches |
| Primary components | clsUSBankUser (Create, BeforeRetrieve, AfterRetrieve, BeforeInsert, AfterInsert, BeforeUpdate, AfterUpdate, BeforeDelete, AfterDelete), clsUSBankUserCollection (BeforeRetrieve, AfterRetrieve, Save), clsUSBankNonpayNotice (same lifecycle methods), clsUSBankNonpayNoticeCollection |
| Entry point | Business\SAIF.Business.EPay.USBank\clsUSBankUser.vb |
Steps¶
- Create a new user.
clsUSBankUser.NewUSBankUser(dpi, policyNumber, businessOnlineUserId)builds a criteria and calls the data-access layer'sCreateObject, which invokesCreate(): allocate a new sequence value (SQL-002, DUAL) and seed the policy number and business-online user ID from the criteria. - Retrieve a user by sequence number or by policy + business-online user.
GetUSBankUserbuilds the appropriate criteria and callsRetrieveObject.BeforeRetrieveselects the retrieve SQL variant based on which constructor was used — byUS_BANK_USER_SEQ_NUM(SQL-007) or by policy number plus a case-insensitive comparison on business-online user (SQL-008) (BR-009) — against US_BANK_USER.AfterRetrievefills the object from the first result row, if any, and marks it old. - Retrieve a collection of users by policy.
clsUSBankUserCollection.GetUSBankUsers(dpi, policyNumber)runs the base retrieve SQL filtered by policy number (SQL-009, US_BANK_USER) and, for each returned row, loads aclsUSBankUserand adds it to the collection. - Insert a new user.
BeforeInsertbinds first name, last name, transfer-bank-accounts flag, policy number, business-online user, and the sequence number (SQL-004) (BR-001, BR-002). AfterInsert: if rows affected ≠ 1, addInsertError(BR-003); otherwise mark the object old.- Update an existing user.
BeforeUpdatebinds first name, last name, transfer-bank-accounts flag, and the sequence number as the key (SQL-011). AfterUpdate: if rows affected ≠ 1, addUpdateError/DB contention message (BR-004); otherwise mark the object old.- Delete a user.
BeforeDeletebinds the sequence number as the key (SQL-013). AfterDelete: if rows affected ≠ 1, addDeleteError/DB contention message (BR-005); otherwise mark the object new.- Create a new notice. The notice
Create()allocates a new sequence value (SQL-001, DUAL). - Retrieve a notice by sequence, or notices by policy. Single-notice retrieve binds the notice sequence number (SQL-005, US_BANK_NONPAY_NOTICE); the collection retrieve filters by policy number (SQL-006, US_BANK_NONPAY_NOTICE).
- Insert a new notice.
BeforeInsertbinds the notice sequence number, US Bank user sequence number, policy number, online payment type code, payment amount, notice date, event description, and banking network code (SQL-003). AfterInsert: if rows affected ≠ 1, addInsertError(BR-006); otherwise mark the object old.- Update an existing notice.
BeforeUpdatebinds the same fields as insert, keyed by the notice sequence number (SQL-010).AfterUpdate: if rows affected ≠ 1, addUpdateError/DB contention message (BR-007); otherwise mark the object old.
- Delete a notice.
BeforeDeletebinds the notice sequence number as the key (SQL-012).AfterDelete: if rows affected ≠ 1, addDeleteError/DB contention message (BR-008); otherwise mark the object new.
- Save a user collection.
clsUSBankUserCollection.Save()callsApplyEdit()and then the base collection save, which cascades insert/update/delete for each containedclsUSBankUseras described in steps 4–6.
Process flow¶
The following diagram visualizes the shared create/retrieve/save/delete pattern applied to both the user and notice business objects.
flowchart TD
Start{Which BOF action?}
Start -->|Create| Seq[Allocate sequence value<br>from DUAL]
Seq --> New([New in-memory object,<br>marked dirty/new])
Start -->|Retrieve single| RetSingle[Select by sequence number<br>or by policy + business-online user]
RetSingle --> Fill[Fill object; MarkOld]
Start -->|Retrieve collection| RetColl[Select rows by policy number]
RetColl --> Loop[Load one business object<br>per row; add to collection]
Start -->|Insert| Ins[Bind parameters; execute insert]
Ins --> InsRows{Rows affected = 1?}
InsRows -->|No| InsErr([Add InsertError])
InsRows -->|Yes| InsOk([MarkOld])
Start -->|Update| Upd[Bind parameters; execute update]
Upd --> UpdRows{Rows affected = 1?}
UpdRows -->|No| UpdErr([Add UpdateError /<br>DB contention])
UpdRows -->|Yes| UpdOk([MarkOld])
Start -->|Delete| Del[Bind key; execute delete]
Del --> DelRows{Rows affected = 1?}
DelRows -->|No| DelErr([Add DeleteError /<br>DB contention])
DelRows -->|Yes| DelOk([MarkNew])
Failure and edge-case behavior¶
- Every insert, update, and delete path checks the exact rows-affected count and adds a broken-rule error message rather than throwing, so callers must inspect the object's error/broken-rule state after
Save()to detect a contention or mismatch failure. - User lookup by policy and business-online user ID is case-insensitive on both sides of the comparison (BR-009), so two IDs differing only in case resolve to the same local row.
- The user criteria's
RetrieveMethodselection falls through to the sequence-number SQL variant for theRetrieveMethods.Nonecase textually in source, but the code path that setsRetrieveMethodtoNoneand still proceeds to build SQL throwsApplicationException("Invalid RetrieveMethod.")first, so the fallthrough return statement is effectively unreachable.* - The collection classes'
Create()methods are empty overrides — there is no supported "create a blank collection" factory; collections are always populated through a retrieve. clsUSBankUserCollection.Save()callsApplyEdit()before the base save, committing any pending edit on the currently-edited item before the cascade runs.*
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Related documentation¶
Sources¶
Business\SAIF.Business.EPay.USBank\clsUSBankUser.vbBusiness\SAIF.Business.EPay.USBank\clsUSBankUserCollection.vbBusiness\SAIF.Business.EPay.USBank\clsUSBankNonpayNotice.vb