Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
AuthorizationReversalRequest Class
Namespace
Example
Add your reversal classes to your payment gateway adapter. We recommend adding AuthorizationReversal as a possible requestType value when calling processRequest on the gateway’s response.
1global commercepayments.GatewayResponse processRequest(commercepayments.paymentGatewayContext gatewayContext) {
2 commercepayments.RequestType requestType = gatewayContext.getPaymentRequestType();
3 commercepayments.GatewayResponse response;
4
5 try {
6 //add other requestType values here
7 //..
8 else if (requestType == commercepayments.RequestType.AuthorizationReversal) {
9 response = createAuthReversalResponse((commercepayments.AuthorizationReversalRequest)gatewayContext.getPaymentRequest());}
10
11 return response;Then, add a class that sets the amount of the authorization reversal request, as well as gateway information and the Salesforce result code.
1global commercepayments.GatewayResponse createAuthReversalResponse(commercepayments.AuthorizationReversalRequest authReversalRequest) {
2 commercepayments.AuthorizationReversalResponse authReversalResponse = new commercepayments.AuthorizationReversalResponse();
3 if(authReversalRequest.amount!=null )
4 {
5 authReversalResponse.setAmount(authReversalRequest.amount);
6 }
7 else
8 {
9 throw new SalesforceValidationException('Required Field Missing : Amount');
10 }
11
12 system.debug('Response - success');
13 authReversalResponse.setGatewayDate(system.now());
14 authReversalResponse.setGatewayResultCode('00');
15 authReversalResponse.setGatewayResultCodeDescription('Transaction Normal');
16 authReversalResponse.setGatewayReferenceNumber('SF'+getRandomNumber(6));
17 authReversalResponse.setSalesforceResultCodeInfo(SUCCESS_SALESFORCE_RESULT_CODE_INFO);
18 return authReversalResponse;
19 }AuthorizationReversalRequest Constructors
The following are constructors for AuthorizationReversalRequest.
AuthorizationReversalRequest(amount, authorizationId)
AuthorizationReversalRequest Properties
The following are properties for AuthorizationReversalRequest.
paymentAuthorizationId
Signature
global String paymentAuthorizationId {get; set;}
Property Value
Type: String
AuthorizationReversalRequest Methods
The following are methods for AuthorizationReversalRequest.
equals(obj)
Signature
global Boolean equals(Object obj)
Parameters
-
obj:
Type:
Object External object whose key is to be validated.
Return Value
Type: Boolean
hashCode()
Signature
global Integer hashCode()
Return Value
Type: Integer