action.skip

EntryCrossSettlementAPI

EntryCrossSettlementAPI: Description

The class EntryCrossSettlementAPI can be used to settle pairs of opposite entries via Salesforce flows or own Apex code.

Entry settlement concepts

As a result of certain business use cases, some receivables and payables may have to be offset directly – like, for example, when a customer has to pay an invoice and receives a credit note at the same time. To support such use cases, JustOn Cash Management introduces the entry settlement functionality: particular debit entries and credit entries are offset against each other.

When settling entry pairs, JustOn Cash Management will

  • offset the credit entry against the debit entry applying the specified settlement amount (or the smaller of the two entry amounts if no specific amount is provided)
  • recalculate the Open Amount of the two entries involved in the settlement operation

    Initial Amount + Reduction Amount = Open Amount

  • reduce existing payment settlements, that is, payment assignments, by the reduction amount – adjusting the relevant amount values on the related entry items (decrease the Assigned Amount) and the related payments (decrease the Assigned Amount, increase the Available Amount), see Reduce Entry | Entry and Payment Lifecycle

  • apply the defined credit balance strategy to the related payments (Future Settlement by default, see Settle Entries | Entry and Payment Lifecycle)

Invocable Method

API Name Label Description
crossSettleEntries Settlement of Entries Settles a list of entry pairs

Limitations

To prevent performance issues or timeouts, JustOn recommends limiting the number of entry pairs being processed to a maximum of 30 per execution.

Request Parameters

API Name Required Type Label Description
creditEntryId String Credit Entry Id The reference to the ID field of the credit entry to be settled
debitEntryId String Debit Entry Id The reference to the ID field of the debit entry to be settled
settlementReason String Settlement Reason The reason why these entries are settled
settlementAmount Decimal Settlement Amount The amount to use for settlement of the two entries
If not specified, the lowest amout of the two entries (the open amount of the debit entry or the payable amount of the credit entry) will be used.
settlementCBS String Settlement Credit Balance Strategy The credit balance strategy to be applied when the entries are settled
Possible values include
Future Settlement
Prepared Refund
Direct Refund
settlementDate Date Settlement Date The date when the entry settlement is applied

Response Parameters

API Name Type Label Description Values
code String Status Code The response status code of the platform 200, 400, 500
detail String Details The detailed description of the status code see code/detail table below
entries String Entry Results The results for each pair of entries in the settlement request. see entry results table below
Code Details Description
Next Steps
200 Entry pairs settled All entry pairs have been settled successfully
Some entry pairs could not be settled Some entries could not be settled
Check the entry field Error Message.
There are no entries to settle specified The list of entries to settle is empty
400 The entry pairs must be unique The list of entry pairs to settle contains duplicates
500 Service unreachable Technical issue (for example, platform service not available)
Contact JustOn Support.
Entry Results
Value
Type Description
creditEntryId String The reference to the ID field of the credit entry that was settled
debitEntryId String The reference to the ID field of the debit entry that was settled
creditEntryStatus String Open, Balanced
debitEntryStatus String Open, Balanced
errorMessage String Detailed information in case of an error

EntryCrossSettlementAPI: Example Use Cases

Using Salesforce Flow

Assume the following use case: A customer has both an outstanding invoice (represented as a debit entry) and a pending credit (represented as a credit entry). You want to offset these entries against each other to reduce the open amount of the two entries. You use a Salesforce flow to automatically settle the relevant pair of opposite entries.

Following the example, you may set up the flow as follows:

Flow Element Option Value
Start Object Account
or a custom object handling entry pairs
Trigger A record is created or updated
Conditions credit entry and debit entry IDs are populated and settlement amount is set
Action Action Settlement of Entries
Input Values Credit Entry Id: {!$Record.CreditEntry__r.Id}
Debit Entry Id: {!$Record.DebitEntry__r.Id}
Settlement Reason: Automatic offsetting
Settlement Amount: {!$Record.SettlementAmount}

Depending on your specific use case, the flow setup will vary. You may, for example, require more specific flow conditions or need to specify additional input parameters, like a settlement credit balance strategy or the settlement date.

Using Apex Code

Assume your business has developed an own integration with JustOn Cash Management that manages entries. Now you need a piece of Apex code that calls the class EntryCrossSettlementAPI, like, for example

public class CustomCrossSettleEntry {

    public void executeCrossSettlement(Id creditEntryId, Id debitEntryId, Decimal amount, String reason) {
        JPAY1.EntryCrossSettlementAPI.Request req = new JPAY1.EntryCrossSettlementAPI.Request();
        req.creditEntryId = creditEntryId;
        req.debitEntryId = debitEntryId;
        req.settlementAmount = amount;
        req.settlementReason = reason;

        List<JPAY1.EntryCrossSettlementAPI.Request> reqList = new List<JPAY1.EntryCrossSettlementAPI.Request>{req};
        JPAY1.EntryCrossSettlementAPI.Response res = JPAY1.EntryCrossSettlementAPI.crossSettleEntries(reqList)[0];
    }
}