Newer Version Available
AuthorizationReversalRequest Class
Sends information about an authorization reversal request to a gateway
adapter during a service call.
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)
Maintains the integrity of lists of type AuthorizationReversalRequest by determining the equality of
external objects in a list. This method is dynamic and based on the equals method in
Java.
Signature
global Boolean equals(Object obj)
Parameters
- obj
- Type: Object
- External object whose key is to be validated.
Return Value
Type: Boolean
hashCode()
Maintains the integrity of lists of type AuthorizationReversalRequest by determining the uniqueness
of the external object in a list.
Signature
global Integer hashCode()
Return Value
Type: Integer