End of Day Processing and Cron Jobs
  • 24 Apr 2024
  • 13 Minutes To Read
  • Dark
    Light
  • PDF

End of Day Processing and Cron Jobs

  • Dark
    Light
  • PDF

Article Summary

By default, Mambu runs a daily series of automated tasks outside of business hours and an hourly series of additional processing tasks. These are grouped into a general category called End-of-Day processing (EOD processing):

  • End-of-Day processing (EOD processing): These tasks ensure that all account states, days in arrears, penalties, and fees are up to date and consistent with any transactions that have been posted.

These tasks are executed by cron jobs, or scheduled tasks. Accounting, reconciliation, and related tasks are carried out by daily and hourly cron jobs, depending on the task.

All EOD processing jobs run on both production and sandbox tenants.

There is no downtime while these scheduled tasks execute.

EOD processes may also be configured to run at a manually-scheduled time or triggered by API. For more information, see Manual end of day processing and Manual end of day processing via the API below.

Please Note
This element can also be configured using Configuration as Code (CasC). For more information, see Configuration as Code.

Sequence of scheduled tasks

  1. At midnight (00:00), as determined by your time zone settings, you pass the accounting cutoff, and all further transactions are logged to the next calendar day in the ledger. See Accounting Cutoff below for more information.
  2. Every hour, Mambu checks to see if we have run daily jobs on the data of the most recent accounting day.
    • If not, the daily jobs run:
      1. Account jobs (first execution)
      2. Early organization jobs
      3. Loan jobs, savings jobs
      4. Account jobs (second execution)
      5. Late organization jobs
    • If so, we skip to hourly jobs.
  3. Hourly jobs run.

Accounting Cutoff

The accounting cutoff specifies the end of the accounting day. Any transaction made before the cutoff of a given day and after the cutoff of the preceding day will be considered to have occured "during that day" only for accounting purposes.

If you have the Early Access Accounting Cutoff configuration feature enabled, then you can configure your accounting cutoff time.

Early Access Feature
If you would like to request early access to this feature, please get in touch with your Mambu Customer Success Manager to discuss your requirements. For more information, see Mambu Release Cycle - Feature Release Status.

By default, if no specific accounting cutoff is set (that is, if the field is empty), then the accounting cutoff is at midnight as determined by your organization's configured time zone. For more information about time zones, see Organization Contact Details and Time Zone.

To set the accounting cutoff time:

  1. On the main menu, go to Administration > Financial Setup > EOD processing.
  2. Select Automatic in the dropdown box labeled End Of Day Processing.
  3. Enter the time at which accounting should be cutoff in the Accounting Cut Off Time field. All transactions after this time will have the next day as their Journal Entry Date.

Scheduling Accounting Cutoff Time in Mambu UI

Daily jobs

Daily jobs are executed if they are not already in progress or completed. Daily jobs are executed sequentially in this order:

  1. Account jobs (first execution)
  2. Early organization jobs
  3. Loan jobs, savings jobs
  4. Account jobs (second execution)
  5. Late organization jobs

Note that that account jobs are executed twice.

Account jobs

Account jobs are executed twice as part of the daily jobs execution. This is necessary to support certain business scenarios, such as those involving backdated or adjusted transactions.

This may result in unexpected behaviour in rare cases. For example, when disbursing a loan where the first repayment date is in the past or on the current day, Mambu will collect the loan repayment with two transfer transactions rather than just one.

NameDescription
AUTOMATED_TRANSFERSAutomated transfers from deposit settlement accounts to loan accounts, as per loan account schedule.
UPDATE_SAVINGS_WITH_PRODUCT
_SETTINGS
Updates deposit accounts with any changes made to underlying Deposit Product Settings.
UPDATE_LOANS_WITH_PRODUCT
_SETTINGS
updates loan accounts with any changes made to underlying Loan Product Settings.

Appraisal per account

Mambu performs account appraisals on a per-account basis. In other words, we run through all the steps for a single account and then move on to the next account.

If EOD processing fails for a single account for any reason, Mambu still moves on to the next account. We then attempt to complete EOD processing for the failed accounts every hour in case the error has a temporary cause. However, if the account appraisal continues to fail, Mambu’s technical support will be alerted and will manually repair the account.

Early organization jobs

Early organization jobs focus on general ledger entries, making sure that they reflect all transactions, including any which may have been made on the current date, but backdated to have a booking date in the past.

NameDescription
RESET_GL_JOURNAL_ENTRY
_SUMMARIES_INFO
Resets all the information related to journal entry summary items in order to be able to recreate them from scratch.
GENERATE_GL_JOURNAL_ENTRY
_SUMMARIES
Generates the GL journal entries summary items for the accounting entries logged since the last EOD job was executed.
UPDATE_JOURNAL_ENTRIES_FOR
_EARLY_INTEREST_ACCRUAL
Updates the journal entries reflecting accrued interest before the accrual takes place.

Detailed description of steps

The accounting summaries include all general ledger entries since the initialization of your Mambu system is automatically regenerated daily.

First, all existing summaries are deleted by executing the RESET_GL_JOURNAL_ENTRY_SUMMARIES_INFO job. They are then recreated from scratch by executing the GENERATE_GL_JOURNAL_ENTRY_SUMMARIES process.

The summaries are generated by taking into consideration all the General Leder (GL) journal entries logged during the day, grouped in a number of buckets, as determined by:

  • The GL account for which the entries were logged,
  • The branch of the loan / savings account for which the financial,transactions triggering the journal entries were logged - this is helpful in order to be able to filter by branch
  • The type (debit / credit), and
  • The entry date of the financial transaction triggering the journal entries. This is helpful in order to have a timeline for our accounting reports (basically, seeing how the balance sheet was looking on a given day).

The balance of a summary is determined by the sum of the amounts logged along with the journal entries grouped using the aforementioned buckets. The formula used is Debit - Credit. If the result is positive or zero, the type of the summary will be debit, and if the result is negative, the type will be credit.

Loan accounts jobs

The next batch of jobs concern loan accounts. Some examples include:

  • Making sure that any changes to interest or tax rates have been applied,
  • Marking loans as in arrears if a payment was expected on the current day, or the grace period has expired, or
  • Managing the application of fees, penalties and accrued interest.
NameDescription
AUTO_CLOSE_PAID_OFF_LOANSAutomatic closure of loan accounts with zero balances, based on the Loan Product Dormancy settings.
AMOUNTS_AMORTIZATIONFee amortization in accounting.
INTEREST_RATE_UPDATEUpdates Interest Rate based on Index Interest Rate changes.
TAX_RATE_UPDATEUpdate tax rate based on Tax Rate changes.
PERIODIC_PAYMENT_UPDATEUpdates periodic payment.
CREATE_REVOLVING_CREDIT
_DUE_REPAYMENTS
Creates repayment schedule for Revolving Credit loan accounts.
LOCK_CAPPING_CHECKERChecks if capping constraints have been exceeded and pass the loan account into locked capping state if necessary.
LOAN_INTEREST_APPLYApplication of interest accrued.
LATE_LOAN_CHECKERSets the loan accounts to "In Arrears" state.
PAYMENT_DUE_FEES_APPLYApplication of due fees.
PENALTIES_APPLYApplication of any penalties.
AUTO_REDRAW_REPAYMENTAutomatically redraws due repayment.
AUTO_LOCK_ARREARS_LOANSLocks the loan accounts that have been in arrears for a specific period of time as defined in Loan Product setup.
DUE_AMOUNTS_UPDATEUpdates all amounts due based on any interest, penalties and fees applied for that day.

Saving accounts jobs

Savings accounts jobs run against deposit accounts. Similar to loan accounts jobs, these will manage application of accrued interest, fees, and penalties as well as mark accounts as dormant if the product is configured to automatically set accounts as dormant after a period of inactivity.

NameDescription
SAVINGS_ACCOUNT_APPRAISER
  • Accrue and apply interest (positive and overdraft interest)
  • For saving accounts with Tiered Interest → update Interest Rate and loan transaction if needed
  • Updates overdraft account state → update account state from Active to Active In Arrears and log activity when expiry date is met and account's balance is negative
  • Applies monthly fees on due date
AUTO_DORMANT_INACTIVE
_SAVINGS_ACCOUNTS
Sets deposit accounts as Dormant as defined in Deposit Product Settings.

Late organization jobs

The late organization jobs include jobs which are run to add notifications to queues. For example, if you have set up notifications to let customers know a repayment is due or about a scheduled disbursement, the notification message will be generated at this time and added to the queue to be sent at the opening of business. This set also includes some system-related jobs such as enforcing password rotation for Mambu users.

NameDescription
UPDATE_JOURNAL_ENTRIES
_FOR_LATE_INTEREST_ACCRUAL
Updates journal entries reflecting the accrued interest after the accrual takes place.
END_OF_DAY_CLOSUREPerforms end of day accounting closures, after which the Accounts Updated event is sent.
UPCOMING_REPAYMENTS_CHECKERSearches for all the repayments which are in Pending or Partially Paid state and trigger reminder Notifications using templates (check the due dates equal to today plus a configured number of days (how many days before that due date)  and create notifications).
ACCOUNT_IN_ARREARS_CHECKERTriggers notifications after a configured number of days since the account is passed into arrears state.
UPCOMING_DISBURSEMENT_CHECKERTriggers notifications for Approved accounts with a configured number of days before the expected disbursement date (loans and tranches).
ENFORCE_USER_PASSWORD_RESETResets user passwords if the period defined in "Internal Controls" is up.
ORGANIZATION_SNAPSHOTCreates a snapshot of all indicators for organization.
Please Note

For the current status of daily actions, please see Scheduled jobs summary. For the status of the latest job, make a GET request to /backgroundprocess/latest, specifying the type as CRON_JOBS. The endpoint will return the last-started job of CRON_JOBS type alongside additional information, such as state, start date, and end date - if it is available.

Hourly jobs

Hourly jobs are executed after daily jobs.

NameDescription
SEND_QUEUED_NOTIFICATIONSChecks for queued notifications and schedule them for sendout.
AUTHORIZATION_HOLDS_EXPIRATIONExpires any authorization hold requests on which a settlement action has not been taken before the expiration period has elapsed. For example, if 14 days is the expiration period set for authorization holds, then any authorization holds created or updated 14 days ago are candidates to expire. When an authorization hold expires, its status changes from PENDING to EXPIRED and the hold amount no longer affects a client's available balance. For more information, see Card Transactions and Configuring authorization holds settings.
Please Note

SMS notifications are not sent at midnight, but starting at 9:00 am in your organization's configured time zone.

EOD Accounts Updated Notification

If an EOD process fails you may receive notifications for EOD process failure via webhooks or event streaming, but you must create the notifications yourself. EOD-related alarms are supported for production processing only.

Please Note

We recommend configuring EOD webhook notifications to improve your monitoring of the process. During the EOD process you may receive a notification that the accounts have been updated. The event will be trigger when either all of the daily account updates have been successfully processed, or when a failure occurred.

Please Note

The Accounts Updated event does not indicate the completion of the daily jobs, which includes more jobs unrelated to updating the accounts state. The completion or failure of all the daily jobs can be observed through the Background Process endpoints, see Get the ID of a currently-running job for more information.

In order to receive this notification create a webhook, select End of Day Processing as the Target and Accounts Updated as the On Event option. For more information, see Defining a new Webhook and Streaming API.

Manual end-of-day processing

This feature is not available by default.

If you would like to request access to this feature, please get in touch with your Mambu Customer Success Manager to discuss your requirements. For more information, see Mambu Release Cycle - Feature Release Status.

You may execute EOD processes manually instead of having them run automatically every night. Manual execution guarantees that Mambu will not run account appraisals every night.

You may trigger manual EOD processing at any time. The EOD process will always run on the snapshot of the data that was taken at midnight (00:00) of the current date. In other words, the EOD process is always processing the data of the previous day.

For example, if the EOD process starts on December 7th, at 23:00 then the snapshot that was taken on December 7th at 00:00 will be used. That snapshot will contain all the data of the previous day (December 6th), however it won't contain any of the data of the current day (December 7th).

To run manual EOD processing from Mambu:

  1. Make sure you have the Manual EOD Processing feature enabled - see Mambu Release Cycle- How do we identify the stage of a feature? for instructions. If you need it enabled, please contact you Customer Success Manager.
  2. On the main menu, go to Administration > Financial Setup > EOD Processing.
  3. In the End of Day Processing dropdown, select Manual.
  4. Select Run Now.

Manual end of day processing via the API

To run manual EOD processing using the API, please refer to the Crons documentation in our API v2 Reference.

Please Note

Triggering the EOD processing manually will run both the hourly and daily jobs. If the daily jobs already ran for the day, then only the hourly jobs will run. Remember to run them before closing accounting books, to make sure that all the accounts are up-to-date.

Cancelling EOD processing

This feature is not available by default.

If you would like to request access to this feature, please get in touch with your Mambu Customer Success Manager to discuss your requirements. For more information, see Mambu Release Cycle - Feature Release Status.

Under certain unusual circumstances, you may wish to cancel a running EOD process. Specific cron jobs cannot be terminated, but if a group of EOD processing jobs is taking a long time to complete, they may sometimes be terminated via API.

Warning!

If you terminate EOD processing jobs, you are responsible for ensuring that the jobs are re-run. If you are using manual EOD processing, you must reinitiate the job. If you are using automatic EOD processing, the cancelled group of jobs will re-run automatically at the next scheduled time.

To cancel EOD processing, use the Background Process endpoints. For more information, see Background Process in our API Reference.

To access the Background Process endpoints, your user or API consumer must have Admin access rights or the Manage EOD Processing (MANAGE_EOD_PROCESSING) permission. For more information, see Creating a User - User Rights.

EOD process cancellation requests

Manually-triggered EOD processing jobs with the MANUAL_CRON_JOBS_TRIGGER type and automatically-triggered EOD processing jobs with the CRON_JOBS type may be cancelled under either of the following conditions:

  • The state of the currently-running cron job is QUEUED; or
  • The state of the currently-running cron job is IN_PROGRESS, and its execution time has already taken longer than the longest of the last five EOD processing jobs of the same type that have been run.

Cancelling EOD processing has two steps: getting the ID of a currently-running job, and sending the cancellation request.

Get the ID of a currently-running job

The first step is to retrieve the ID (encoded key) of the group of cron jobs by making a GET request to /api/backgroundprocess/latest, specifying the type query parameter as either CRON_JOBS or MANUAL_CRON_JOBS_TRIGGER depending on which EOD processing mechanism you have set up. The endpoint will return the last-started group of jobs of the specified type and indicate whether or not it is still executing.

We recommend making two GET requests: one with type=CRON_JOBS and another with type=MANUAL_CRON_JOBS_TRIGGER to be certain you are getting any possibly-running job. If you request a background process with a type that has never been used in your instance, you will get an error informing you that there was No background process found by specified type.

The following example shows a request for data on the currently-running job with the CRON_JOBS type:

GET https://TENANT_NAME.mambu.com/api/backgroundprocess/latest?type=CRON_JOBS

Example response:

{
    "encodedKey": "402881647fb680c8017fb68c29f00470",
    "type": "CRON_JOBS",
    "state": "QUEUED",
    "creationDate": "2022-03-30T09:00:00Z"
}

In this example, the job may be cancelled, because the type is CRON_JOBS and the state is QUEUED.

Sending the cancellation request

The second step is to send a cancellation request using the returned encodedKey value. To do so, make a PUT request to /api/backgroundprocess/{encodedKey}, passing in the encodedKey value of the jobs you retrieved in the first step, and providing the string "CANCEL" as the payload.

Example request:

PUT https://TENANT_NAME.mambu.com/api/backgroundprocess/402881647fb680c8017fb68c29f00470

"CANCEL"

Example response:

{
    "encodedKey": "402881647fb680c8017fb68c29f00470",
    "type": "CRON_JOBS",
    "state": "CANCEL",
    "creationDate": "2022-03-23T11:31:53Z",
    "startDate": "2022-03-23T11:31:54Z",
    "endDate": "2022-03-23T11:31:58Z"
}

This response indicates that the set of EOD Processing jobs has been stopped. Be sure to manually re-initiate the jobs if necessary.


Was this article helpful?