block_funds_with_bank

Trigger

  • block_funds_with_bank API invoked by bank_block_funds_worker (Celery worker task)

  • Worker invoked by

    1. block_funds_with_bank_beat_producer (Celery beat producer)

block_funds_with_bank_beat_producer

Business logic

frequency

hourly (specified by configuration yml)

attempts

yes. subject to a configurable limit specified by configuration yml

driving table

disbursement_envelope_batch_status

eligible envelopes

disbursement_schedule_date <= today

AND

cancellation_status = 'NOT_CANCELLED'

AND

number_of_disbursements = number_of_disbursements_received AND

funds_available_status = 'FUNDS_AVAILABLE'

AND

( ( funds_block_status = "PENDING_CHECK" AND funds_block_retries < retry_limit) OR (funds_block_status = 'FUNDS_BLOCK_FAILURE" AND funds_block_retries < retry_limit) )

  1. Pick up Eligible - disbursement_envelope

  2. Delegate a task to bank_block_funds_worker

  3. Payload - disbursement_envelope_id

block_funds_with_bank_worker

  1. Payload - disbursement_envelope_id

  2. get the details of the disbursement_envelope - total funds needed for this envelope

  3. get details from benefit_program_configuration

  4. get the instance of BankConnector (implementing BankConnectorInterface) from BankConnectorFactory

  5. BankConnectorInterface - There will be a connector (implementation of the BankConnectorInterface) for every Sponsor Bank

  6. Invoke - Block Funds API

SUCCESS and FUNDS_BLOCKED, update the following

  1. disbursement_envelope_batch_status.funds_blocked_with_bank = FUNDS_BLOCK_SUCCESS

  2. disbursement_envelope_batch_status.funds_blocked_latest_timestamp = now()

  3. disbursement_envelope_batch_status.funds_blocked_latest_error_code = null

  4. disbursement_envelope_batch_status.funds_blocked_retries = +1

  5. disbursement_envelope_batch_status.funds_blocked_reference_number = block reference number from bank

SUCCESS and FUNDS_NOT_BLOCKED, update the following

  1. disbursement_envelope_batch_status.funds_blocked_with_bank = FUNDS_BLOCK_FAILURE

  2. disbursement_envelope_batch_status.funds_blocked_latest_timestamp = now()

  3. disbursement_envelope_batch_status.funds_blocked_latest_error_code = error code from bank

  4. disbursement_envelope_batch_status.funds_blocked_retries = +1

  5. disbursement_envelope_batch_status.funds_blocked_reference_number = blank

FAILURE

  1. disbursement_envelope_batch_status.funds_blocked_with_bank = FUNDS_BLOCK_FAILURE

  2. disbursement_envelope_batch_status.funds_blocked_latest_timestamp = now()

  3. disbursement_envelope_batch_status.funds_blocked_latest_error_code = error code from bank

  4. disbursement_envelope_batch_status.funds_blocked_retries = +1

  5. disbursement_envelope_batch_status.funds_blocked_reference_number = blank

Last updated

Logo

Copyright © 2024 OpenG2P. This work is licensed under Creative Commons Attribution International LicenseCC-BY-4.0 unless otherwise noted.