Payment request¶
Payment request manages the centralized bill payment request (CBP) queue: each request represents one payment to be processed for a payee, tracked through a process-code lifecycle (New, Selected, In process, Error, Posted, Complete). The collection supports retrieval filtered by process code and claim, and each request enforces the same rows-affected concurrency contract used across the rest of this library.
| Field | Value |
|---|---|
| Operation ID | OP-CB-04 |
| Trigger | Caller calls clsCBPBillPaymentRequest.NewCbpBillPaymentRequest(inDataportal) to create a request or GetCbpBillPaymentRequest(inDataportal, seqNum) to load one; collections are retrieved by process code and optional claim filter |
| Inputs | BillPaymentSeqNum (retrieve/create key); process code; claim ID (for claim-scoped retrieval); payee and payment fields; IDataPortalInfo |
| Outputs | New or populated clsCBPBillPaymentRequest; persisted CBP_BILL_PAYMENT_REQUEST row; filtered clsCBPBillPaymentRequestCollection; broken rules and DB-contention errors on failure |
| Primary components | clsCBPBillPaymentRequest.Create, clsCBPBillPaymentRequest.BeforeInsert/AfterInsert, clsCBPBillPaymentRequest.BeforeRetrieve/AfterRetrieve, clsCBPBillPaymentRequest.BeforeUpdate/AfterUpdate, clsCBPBillPaymentRequestCollection.BeforeRetrieve/AfterRetrieve, clsCBPBillPaymentRequestCollection.AddNew |
| Entry point | Business\SAIF.Business.Claim.Bill\clsCBPBillPaymentRequest.vb |
Steps¶
- Create a new payment request.
Create()allocates a new sequence number viaGetNextSeqNum("BILL_PAYMENT_SEQ"), sets the process code to"N"(New), and stamps the update user from the data-portal user. - Insert the request.
BeforeInsert()builds a non-query insert intoCBP_BILL_PAYMENT_REQUESTwith all request columns, usingSYSDATEforUPDATE_DATEand0for the initialUPDATE_NUM(SQL-002, CBP_BILL_PAYMENT_REQUEST). AfterInsert(): if rows affected is not exactly1, add"Insert Failed"under key"InsertError"(BR-004); otherwiseMarkOld().- Retrieve a single request.
BeforeRetrieve()selects fromCBP_BILL_PAYMENT_REQUESTwhereBILL_PAYMENT_SEQ_NUM = :BillPaymentSeqNum(SQL-021, CBP_BILL_PAYMENT_REQUEST).AfterRetrieve()reads the first row and callsFill(...), thenMarkOld(). - Update the request.
BeforeUpdate()updatesCBP_BILL_PAYMENT_REQUEST, incrementingUPDATE_NUMand settingUPDATE_DATE = SYSDATE(SQL-031, CBP_BILL_PAYMENT_REQUEST). AfterUpdate(): if rows affected is not exactly1, add an error under key"UpdateError"usingclsConstants.Messages.DBContentionError(BR-004); otherwiseMarkOld().- Delete the request. The criteria's delete SQL removes the row from
CBP_BILL_PAYMENT_REQUESTby sequence number (SQL-041, CBP_BILL_PAYMENT_REQUEST). - Map process codes.
clsCBPBillPaymentRequestCollection.GetProcessCodeMapmaps"N","S","I","E","P","C"toNew,Selected,InProcess,Error,Posted,Completerespectively. - Retrieve the request queue.
clsCBPBillPaymentRequestCollection.BeforeRetrieve()sets the collection retrieve SQL and bindsProcessCodeandRushClaimID. The retrieve SQL selects fromCBP_BILL_PAYMENT_REQUESTwherePROCESS_CODE = :ProcessCodeand(CLAIM_ID = :RushClaimID or :RushClaimID = 0), withpayee_type_code like decode(:RushClaimID, 0, '%', 'W'), ordered by MCO, provider, worker, and bill (SQL-022, CBP_BILL_PAYMENT_REQUEST). AfterRetrieve()loads each row into aclsCBPBillPaymentRequest.Load(...)item and adds it to the collection.- When
RushClaimIDis0, the claim filter is bypassed and the payee-type filter is relaxed to match all payee types; a non-zeroRushClaimIDnarrows the queue to worker-payee ('W') requests for that claim.* - Add a request to the collection (
AddNew). Creates a new child item through the factory, adds it to the collection, sets it as the current item, and returns its newly allocated sequence number. - List and locate requests. The collection exposes an integer indexer and a
BillPaymentSeqNumindexer, plusCurrentItem,Remove,Contains,ContainsDeleted,Where, andToListfor in-memory querying — no additional database access. - Save the collection.
Save()callsApplyEdit()thenMyBase.Save(), cascading insert/update/delete to each dirty child request per steps 2–5.
Process flow¶
The following diagram visualizes payment-request creation and the process-code driven retrieval queue.
flowchart TD
Start([Caller creates or retrieves<br>a payment request]) --> Which{Create or retrieve?}
Which -->|Create| Alloc[Allocate BILL_PAYMENT_SEQ;<br>set ProcessCode = N]
Alloc --> Insert[Insert CBP_BILL_PAYMENT_REQUEST]
Insert --> InsRows{RowsAffected = 1?}
InsRows -->|No| InsFail([Insert Failed])
InsRows -->|Yes| Ready([Request ready for processing])
Which -->|Retrieve single| Select[Select by BillPaymentSeqNum]
Select --> Fill[Fill fields; MarkOld]
Which -->|Retrieve queue| Queue[Select by ProcessCode<br>and optional RushClaimID]
Queue --> Load[Load each row into collection]
Fill --> Edit[Caller edits request<br>e.g. advances ProcessCode]
Load --> Edit
Edit --> Update[Update CBP_BILL_PAYMENT_REQUEST]
Update --> UpdRows{RowsAffected = 1?}
UpdRows -->|No| Contention([DB contention error])
UpdRows -->|Yes| Done([Save returns success])
Failure and edge-case behavior¶
- Insert and update failures use distinct error keys (
"InsertError"vs."UpdateError") but the same underlying concurrency contract (BR-004). - No object-level business rules are registered on
clsCBPBillPaymentRequest(AddBusinessRulesdefines none), so field-level validation for payment requests is not enforced by this class.* - A
RushClaimIDof0is a sentinel meaning "no claim filter," not a literal claim ID of zero; callers must pass0deliberately to retrieve the full unfiltered queue for a process code.* - The process-code map does not define a default/unknown mapping, so an unrecognized code value is not shown to resolve to a fallback enum member in the traced source.*
Related documentation¶
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
Business\SAIF.Business.Claim.Bill\clsCBPBillPaymentRequest.vbBusiness\SAIF.Business.Claim.Bill\clsCBPBillPaymentRequestCollection.vb