RevertPayment
The RevertPayment
-CUWO is used to revert a previously performed payment. This is not done as part of a payment request but as part of a payout request, when a user later decides to "revert/refund this payment" in the sales history. The CUWO receives the information about the payment to revert as part of its input parameters.
Note that an EPM is not required to support reversion of payments. If an EPM does not support it, the client UI in enforePOS will not present the option to revert payments made via that payment method.
Even if the EPM is configured to support reversion of payments, it may not be possible to revert a specific payment. For example, because the payment was made a long time ago and reversion is only allowed within a short time window after making the payment. In those cases, the enforePOS UI will present the option to revert the payment and it is the responsibility of te CUWO to check whether the reversion is possible or not and to communicate that to the user.
For the CUWO to return as "success", it must have reverted the payment.
When the CUWO fails, the enfore platform will invoke the CancelPayout
workflow on the payout request and then mark it as failed. Note that the payment request is not changed (except by potentially updating the payment processing data), so the user may trigger the reversal again, which will create a new payout request and invoke the RevertPayment
CUWO again. The CUWO must be able to deal with the fact that a previous invocation may have already changed something in the external system.
Workflow parameters
The RevertPayment
-CUWO will receive a RevertPaymentWorkflowParameters
structure as input.
The structure is defined as:
/**
* The parameter/input structure for a "revert payment" workflow.
*/
class RevertPaymentWorkflowParameters extends WorkflowParameters {
readonly "@type" : string = "n4.cuwo.workflows.paymentsandpayouts.revertpayment.RevertPaymentWorkflowParameters";
/**
* The ID of the payout request for which the payment is to be reverted.
*/
public payoutRequestID : string;
/**
* The ID of the payment request whose payment is to be reverted.
*/
public paymentRequestID : string;
/**
* The payment reference of the payment to revert as provided
* by the AuthorizeOrCapturePayment workflow.
*/
public paymentReference? : string;
/**
* The payment processing data of the payment to revert as
* provided by the AuthorizeOrCapturePayment workflow.
*/
public paymentProcessingData? : string;
}
Success result
On success, the RevertPayment
-CUWO is expected to pass a RevertPaymentWorkflowResult
structure to terminateSuccess
.
The structure is defined as:
/**
* The result/output structure for a successful "revert payment" workflow.
*/
class RevertPaymentWorkflowResult extends WorkflowResult {
readonly "@type" : string = "n4.cuwo.workflows.paymentsandpayouts.revertpayment.RevertPaymentWorkflowResult";
/**
* A human-readable reference identifying the payout.
*
* This is an "external identifier" for the enfore platform, so it will only be stored,
* shown in the payment/sales UI of the enforePOS client and passed to subsequent CUWOs
* such as CancelPayout.
*
* The reason for requiring this reference is that even when all subsequent processing
* including CUWOs does not work, there is a way for the merchant/customer to look up
* the payout in the external system or call the external systems support hotline and
* be able to provide some kind if reference.
*/
public payoutReference : string;
/**
* Optional payout processing data of the payout.
*
* This data will be stored with the payout request and passed to subsequent CUWOs
* such as CancelPayout.
*
* Same as the payoutReference, this data is not interpreted by the enfore platform
* in any way. But other than the payoutReference, this data is not shown in any
* kind of user interface.
*/
public payoutProcessingData? : string;
/**
* Optional update for the payment processing data of the payment
* that was reverted.
*
* When provided, replaces the previously stored payment processing
* data. When not provided, a previously stored payment processing
* data stays unchanged.
*/
public paymentProcessingData? : string;
/**
* Additional information to be stored with/printed on the payout
* receipt/credit memo for the payout.
*/
public customReceiptDocumentInformation? : DataList<CustomDocumentInformation>;
}
Failure result
On failure, the RevertPayment
-CUWO is expected to pass a RevertPaymentWorkflowFailure
structure to terminateFailure
.
The structure is defined as:
/**
* The result/output structure for a failed "revert payment" workflow.
*/
class RevertPaymentWorkflowFailure extends WorkflowFailure {
readonly "@type" : string = "n4.cuwo.workflows.paymentsandpayouts.revertpayment.RevertPaymentWorkflowFailure";
/**
* The reason for the failure.
*/
public failureReason : RevertPaymentWorkflowFailureReason;
/**
* A failure code specific to the payment method.
*
* The enfore platform simply stores that code and displays it to the user but does
* not understand it or base any processing on it.
*
* This enables storing a short error identifier from an external system in a way
* that allows it to be shown in the enforePOS sales/payment history UI.
*/
public failureCode? : string;
/**
* Optional update for the payout processing data of the payout.
*
* When provided, replaces the previously stored payout processing
* data. When not provided, a previously stored payout processing
* data stays unchanged.
*/
public payoutProcessingData? : string;
/**
* Optional update for the payment processing data of the payment.
*
* When provided, replaces the previously stored payment processing
* data. When not provided, a previously stored payment processing
* data stays unchanged.
*/
public paymentProcessingData? : string;
}
Cancelation result
The RevertPayment
workflow does not support cancelation.