Skip to main content

Set Collection Details

Overview​

SetCollectionDetailsCommand configures the direct debit collection settings for an approved loan and auto-generates the full repayment schedule. It can be called multiple times — each call replaces the previous schedule entirely.

Prerequisites: The loan must exist and its associated product must have interest rate and tenor configured. Call ValidateBankAccountNumberCommand beforehand to verify the debit account details.

ValidateBankAccountNumberCommand contract​

The account-validation command is used to verify the debit account before collection details are stored. The trigger is controlled by the request payload, not by a frontend-provided command name override.

Request payload​

{
"bankCode": "058",
"accountNumber": "0123456789",
"accountValidationSource": "NIBSS",
"preValidationRequired": true,
"postValidationRequired": false,
"validationTrackerId": "loan-quote-1001-validation"
}

Supported flags​

FieldTypeRequiredDescription
bankCodestringYesDestination bank code for the account being validated
accountNumberstringYesDestination account number
accountValidationSourcestringNoValidation source such as NIBSS; defaults to NIBSS
preValidationRequiredboolNoIf true and postValidationRequired is false, run the fixed validation chain before the normal account validation
postValidationRequiredboolNoIf true and preValidationRequired is false, run the fixed validation chain after the normal account validation
validationTrackerIdstringNoTracker ID sent alongside the validation context so the downstream validation chain can correlate the request

Behavior​

  • If both preValidationRequired and postValidationRequired are false, the command performs the standard account validation flow and does not trigger the extra validation chain.
  • If only preValidationRequired is true, the validation chain runs before account validation.
  • If only postValidationRequired is true, the validation chain runs after account validation.
  • validationStage is not required for this command. The boolean flags are the contract used by the application.

The fixed command chain used internally is:

cmdBankLingoValidateBankAccountNumber

Command Details​

  • Command: SetCollectionDetailsCommand
  • Type: Command (write operation)

API Endpoint​

POST /api/bpm/cmd

Request Structure​

FieldTypeRequiredDescription
loanRequestIdlongYesID of the loan quote (LoanQuote.Id)
repaymentDayInMonthintYesCalendar day (1–31) on which debit is attempted each month
repaymentCountintYesTotal number of installments (must be ≥ 1)
collectionStartDatestring (ISO 8601)YesDate of the first installment (e.g. "2025-09-01")
accountNumberstringYesBorrower's bank account number to debit
accountNamestringYesAccount holder's name
bankCodestringYesNIBSS bank code or internal bank code
collectionModeintYes0 = GSI, 1 = Direct Debit (see Collection Modes)
enableAutoDebitboolNoWhether automated debit should be enabled (default: false)
commentstringNoOptional officer comment

Collection Modes​

ValueNameDescription
0GSIGlobal Standing Instruction — NIBSS sweeps across all borrower accounts
1DirectDebitNIBSS direct debit mandate against the specified account

Try It Out​

POST/api/bpm/cmdSetCollectionDetailsCommand
Request Body

Response Structure​

{
"response": {
"isSuccessful": true,
"statusCode": "00",
"message": "Collection details set successfully and repayment schedule generated.",
"data": {
"loanQuoteId": 1001,
"accountNumber": "0123456789",
"accountName": "John Doe",
"bankCode": "000013",
"bankName": "GTBank",
"repaymentDayInMonth": 15,
"repaymentCount": 12,
"collectionStartDate": "2025-09-15T00:00:00Z",
"collectionMode": 1,
"enableAutoDebit": true,
"schedulePreview": [
{
"installmentNumber": 1,
"dueDate": "2025-09-15",
"principalAmount": 41666.67,
"interestAmount": 5000.00,
"totalDue": 46666.67,
"outstandingBalance": 458333.33
}
]
}
},
"responseCode": "00",
"responseDescription": "Success"
}

Validation Rules​

RuleError CodeMessage
Bank code does not exist08"The bank code does not exist"
repaymentDayInMonth outside 1–3109"The repayment day must be between 1 and 31"
repaymentCount < 109"The repayment count cannot be less than 1"
Loan not found04"Loan request not found"
Loan product has no disbursed amount09Disbursement amount validation error

Schedule Regeneration​

Each call to this command deletes and recreates the repayment schedule. This means:

  • Calling it a second time corrects any errors from the first call
  • Once the Hangfire background job has created mandates, regenerating the schedule does not automatically recreate or cancel those mandates — mandate management must be done separately