check_funds_with_bank
Triggered by Batch job
driver condition
frequency
hourly (specified by configuration yml)
retries
yes. subject to a configurable limit specified by configuration yml
driving table
disbursement_envelope_batch_status
eligible envelopes
envelope.disbursement_schedule_date < today AND
envelope.cancellation_status = 'NOT_CANCELLED'
AND
envelope.number_of_disbursements = batch_status.number_of_disbursements_received
AND
envelope.total_disbursement_amount = batch_status.total_disbursement_amount_received
AND
( ( funds_available_status = "pending_check" AND funds_available_retries < retry_limit) OR ( funds_available_status = 'not_available" AND funds_available_retries < retry_limit) )
Business Logic
Pick up Eligible - disbursement_envelope
Pick up Bank Details from table - benefit_program
Get Bank Connector Instance - from Bank Connector Factory
Invoke - Check Funds API
If Success and Funds are available, update the following
disbursement_envelope_batch_status.funds_available_with_bank = funds_available
disbursement_envelope_batch_status.funds_available_latest_timestamp = now()
disbursement_envelope_batch_status.funds_available_latest_error_code = null
disbursement_envelope_batch_status.funds_available_retries = +1
If Success and Funds are Unavailable, update the following
disbursement_envelope_batch_status.funds_available_with_bank = funds_not_available
disbursement_envelope_batch_status.funds_available_latest_timestamp = now()
disbursement_envelope_batch_status.funds_available_latest_error_code = null
disbursement_envelope_batch_status.funds_available_retries = +1
If Failure, update the following
disbursement_envelope_batch_status.funds_available_with_bank = pending_check
disbursement_envelope_batch_status.funds_available_latest_timestamp = now()
disbursement_envelope_batch_status.funds_available_latest_error_code = error_code
disbursement_envelope_batch_status.funds_available_retries = +1
Last updated