Reconciling and Sending Money Overseas

You can trigger this workflow on a cron or per event basis. Let's take the per event use case for this example.

{
  "id"                        : "d5e368c6-5077-40fc-bff3-5164617e42bc",
  "direction"                 : "in",
  "method"                    : "BIFAST",
  "internal_bic"              : "CENAIDJA",
  "internal_account_id"       : "5271639857",
  "resulting_account_balance" : 11000000,
  "external_bic"              : "BUSTIDJ1",
  "external_account_number"   : "770007888808",
  "external_sender_name"      : "VINCENT TJIANATTAN",
  "external_reference_number" : "BF25070600395675",
  "notes"                     : "TX1234567890",
  "currency"                  : "IDR",
  "amount"                    : 1000000,
  "fees"                      : 0,
  "metadata" : {
    "transaction_purpose" : 2
  }
}

You can then use the following rule to trigger everytime there is a transfer in to the BCA account. You can also filter based on recepient, so it's highly modular according to your needs. But for this example. Let's say you want to always keep your BCA to be no higher than 10 million rupiah and automatically transfer it out once it reaches that amount

{
  "direction": ["in"],
  "internal_bic": ["CENAIDJA"],
  "internal_account_id" : ["5271639857"],
  "resulting_account_balance": [ { "numeric": [ ">=", 10000000 ] } ]
}

@worfklow-send_money_overseas(amount=$event.resulting_account_balance)

version: 1
name: Send money overseas

inputs:
  amount:
    type: number
    required: true

jobs:
  send_money_from_bca:
    integration: "bca"
    account: 5271639857
    steps:
      - uses: bifast
        amount: ${input.amount - 2500}
        destination: $contacts.self
        purpose: 02
        notes: "Send money to Paymongo Wallet"
  send_money_from_paymongo_wallet:
    integration: "paymongo"
    account: 506285930632
    steps:
      - uses: await_for_event
        event_pattern: |
          {
            "direction": ["in"],
  					"internal_terminal_id": ["PAEYPHM2"],
            "internal_account_id" : ["506285930632"],
            "external_terminal_id": ["CENAIDJA"],
            "external_account_number": ["5271639857"],
            "currency": ["IDR"],
            "amount": [ ${input.amount - 2500} ],
            "notes": "Automated funding to Paymongo Wallet"
          }
        timeout: "1h"
			- uses: lightnet
        amount: ${input.amount - 2500}
        destination: $contacts.self.singapore_dbs