action.skip

EntryReductionAPI

EntryReductionAPI: Description

The class EntryReductionAPI can be used to reduce entries via Salesforce flows or own Apex code.

Entry reduction concepts

As a result of certain business use cases, some payment requests may have to be reduced – like, for example, when creating a partial credit for an invoice or when writing off an invoice. To support such use cases, JustOn Cash Management introduces reductions.

When reducing an entry, JustOn Cash Management will

  • recalculate the Open Amount of the reduced entry

    Initial Amount + Reduction Amount = Open Amount

  • reduce existing settlements, that is, payment assignments, by the reduction amount – adjusting the relevant amount values on the related entry item (decrease the Assigned Amount) and the related payment (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 (Prepared Refund by default, see Reduce Entry | Entry and Payment Lifecycle)

Invocable Method

API Name Label Description
reduceEntry Reduce Entry Reduces a list of entries

Limitations

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

Request Parameters

API Name Required Type Label Description
entryId String Entry Id The reference to the ID field of the entry to be reduced
reductionAmount Decimal Reduction Amount The amount by which the entry amount is to be reduced
Always has the opposite sign to the initial amount of the related entry
reductionType String Reduction Type The type of the reduction, depends on the related entry and the related business process
Possible values include
Credit
Write-Off
Entry Settlement
reductionReason String Reduction Reason The reason why this entry is being reduced
reductionCBS String Reduction Credit Balance Strategy The credit balance strategy to be applied when the entry is reduced
Possible values include
Future Settlement
Prepared Refund
Direct Refund
reductionDate Date Reduction Date The date on which the reduction is applied
statement String Statement The unique salesforce ID of the document that justifies the entry reduction
statementDescription String Statement Description The description of the related statement document
statementDistributionUrl String Statement Distribution Url The publicly accessible web link to the related statement document
statementId String Statement Id The unique external identifier of the related statement document
statementNo String Statement No The unique number of the related statement document

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 result for each entry in the reduction request. see entry results table below
Code Details Description
Next Steps
200 Entries reduced All entries have been reduced successful
There is an error reducing entries Some entries could not be reduced
Check the entry field Error Message.
There are no entries to reduce specified The list of entries to reduce is empty
400 The entries to reduce must be unique The list of entries to reduce contains duplicates
500 Service unreachable Technical issue (for example, platform service not available)
Contact JustOn Support.
Entries Results
Value
Type Description
id String The reference to the ID field of the entry to be reduced
status String Open, Balanced
error-message String Detailed information in case of an error

EntryReductionAPI: Example Use Cases

Using Salesforce Flow

Assume the following use case: You use an own integration with JustOn Cash Management, which creates entries from custom objects. When an event reduces the amount of an entry source record, you must synchronize the related entry, reducing its amount, too. You use the amount modification on the source record to trigger a Salesforce flow that reduces the corresponding entry.

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

Flow Element Option Value
Start Object entry source object
Trigger A record is updated
Conditions All Conditions Are Met (AND)
Amount Is Changed True
Run Only when a record is updated to meet the condition requirements
Action Action Reduce Entry
Input Values Entry Id: {!$Record.JPAY1__Entry__r.Id}
Reduction Amount: amount difference
Reduction Type: Credit
Reduction Reason: Source object reduced

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 reduction credit balance strategy or the related statement.

Using Apex Code

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

public class CustomReduceEntry {

    public void executeReduceEntry(Id entryId, String type, Decimal amount, String reason) {
        JPAY1.EntryReductionAPI.Request req = new JPAY1.EntryReductionAPI.Request();
        req.entryId = entryId;
        req.reductionType = type;
        req.reductionAmount = amount;
        req.cancellationReason = reason;

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