action.skip

EntryCancellation

EntryCancellation: Description

The class EntryCancellation can be used to cancel entries via Salesforce flows or own Apex code.

Entry cancellation concepts

As a result of certain business use cases, some payment requests may no longer be justified – like, for example, when canceling an invoice or changing a payment plan. Consequently, the corresponding entries must be canceled.

When canceling an entry, JustOn Cash Management will

Invocable Method

API Name Label Description
cancelEntry Cancel Entry Cancels 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 canceled
cancellationReason String Cancellation Reason The reason why this entry has been canceled
cancellationCBS String Cancellation Credit Balance Strategy The credit balance strategy to be applied when the entry is canceled
Possible values include
Future Settlement
Prepared Refund
Direct Refund
cancellationDistributionUrl String Cancellation Distribution Url The publicly accessible web link to the cancellation document, usually a PDF file
cancellationDocument String Cancellation Document The unique Salesforce ID of the original cancellation document
cancellationId String Cancellation Id The unique external identifier of the document that justifies the entry cancellation
cancellationNo String Cancellation Number The unique number of the document that justifies the entry cancellation

Response Parameters

API Name Type Label Description Values
code String Status Code The response status code of the platform 200, 500
detail String Details The detailed description of the status code see detail table below
Code Details Description
Next Steps
200 Entries canceled All entries have been canceled successful
There is an error canceling entries Some entries could not be canceled
Check the entry field Error Message.
There are no entries to cancel or all are already canceled The specified entries could not be found or are already canceled
There are no entries to cancel specified The list of entries to cancel is empty
500 Service unreachable Technical issue (for example, platform service not available)
Contact JustOn Support.

EntryCancellation: Example Use Cases

Using Salesforce Flow

Assume the following use case: You use JustOn Cash Management's payment page to invite your buyers to pay their purchases – represented as entries. As soon as the buyer has interacted with the payment page, JustOn Cash Management creates a Payment record in the status Open. If the buyer cancels the payment process on the payment page, the payment provider notifies JustOn Cash Management about the cancellation. Consequently, the software sets the payment status Canceled. Now you can use this status modification as a condition to trigger a Salesforce flow that cancels the corresponding entry.

You can set up the flow as follows:

Flow Element Option Value
Start Object Payment (JPAY1__Payment__c)
Trigger A record is updated
Conditions All Conditions Are Met (AND)
JPAY1__Status__c Equals Canceled
Run Only when a record is updated to meet the condition requirements
Action Action Cancel Entry
Input Values Entry Id: {!$Record.JPAY1__Entry__r.Id}
Cancellation Reason: Payment canceled

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

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 EntryCancellation, like, for example

public class CustomCancelEntry {

    public void executeCancelEntry(Id entryId, String reason) {
        JPAY1.EntryCancellation.Request req = new JPAY1.EntryCancellation.Request();
        req.entryId = entryId;
        req.cancellationReason = reason;

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