Skip to content

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

  1. Create a new payment request. Create() allocates a new sequence number via GetNextSeqNum("BILL_PAYMENT_SEQ"), sets the process code to "N" (New), and stamps the update user from the data-portal user.
  2. Insert the request. BeforeInsert() builds a non-query insert into CBP_BILL_PAYMENT_REQUEST with all request columns, using SYSDATE for UPDATE_DATE and 0 for the initial UPDATE_NUM (SQL-002, CBP_BILL_PAYMENT_REQUEST).
  3. AfterInsert(): if rows affected is not exactly 1, add "Insert Failed" under key "InsertError" (BR-004); otherwise MarkOld().
  4. Retrieve a single request. BeforeRetrieve() selects from CBP_BILL_PAYMENT_REQUEST where BILL_PAYMENT_SEQ_NUM = :BillPaymentSeqNum (SQL-021, CBP_BILL_PAYMENT_REQUEST). AfterRetrieve() reads the first row and calls Fill(...), then MarkOld().
  5. Update the request. BeforeUpdate() updates CBP_BILL_PAYMENT_REQUEST, incrementing UPDATE_NUM and setting UPDATE_DATE = SYSDATE (SQL-031, CBP_BILL_PAYMENT_REQUEST).
  6. AfterUpdate(): if rows affected is not exactly 1, add an error under key "UpdateError" using clsConstants.Messages.DBContentionError (BR-004); otherwise MarkOld().
  7. Delete the request. The criteria's delete SQL removes the row from CBP_BILL_PAYMENT_REQUEST by sequence number (SQL-041, CBP_BILL_PAYMENT_REQUEST).
  8. Map process codes. clsCBPBillPaymentRequestCollection.GetProcessCodeMap maps "N", "S", "I", "E", "P", "C" to New, Selected, InProcess, Error, Posted, Complete respectively.
  9. Retrieve the request queue. clsCBPBillPaymentRequestCollection.BeforeRetrieve() sets the collection retrieve SQL and binds ProcessCode and RushClaimID. The retrieve SQL selects from CBP_BILL_PAYMENT_REQUEST where PROCESS_CODE = :ProcessCode and (CLAIM_ID = :RushClaimID or :RushClaimID = 0), with payee_type_code like decode(:RushClaimID, 0, '%', 'W'), ordered by MCO, provider, worker, and bill (SQL-022, CBP_BILL_PAYMENT_REQUEST).
  10. AfterRetrieve() loads each row into a clsCBPBillPaymentRequest.Load(...) item and adds it to the collection.
  11. When RushClaimID is 0, the claim filter is bypassed and the payee-type filter is relaxed to match all payee types; a non-zero RushClaimID narrows the queue to worker-payee ('W') requests for that claim.*
  12. 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.
  13. List and locate requests. The collection exposes an integer indexer and a BillPaymentSeqNum indexer, plus CurrentItem, Remove, Contains, ContainsDeleted, Where, and ToList for in-memory querying — no additional database access.
  14. Save the collection. Save() calls ApplyEdit() then MyBase.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 (AddBusinessRules defines none), so field-level validation for payment requests is not enforced by this class.*
  • A RushClaimID of 0 is a sentinel meaning "no claim filter," not a literal claim ID of zero; callers must pass 0 deliberately 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.*

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.vb
  • Business\SAIF.Business.Claim.Bill\clsCBPBillPaymentRequestCollection.vb