AuthorizationReversalResponse Class
Namespace
Usage
The constructor of this class takes no arguments. For example:
CommercePayments.AuthorizationReversalResponse authRevRes = new CommercePayments.AuthorizationResponse();Contains information about the payment gateway’s response following an authorization reversal transaction. The gateway adapter uses the payment gateway’s response to populate the AuthorizationReversalResponse fields. The payments platform uses the information from this class to construct the authorization gateway response shown to the user.
Example
This class builds an authorization reversal response that contains the amount of the original reversal request, gateway information, and the Salesforce result code.
global commercepayments.GatewayResponse createAuthReversalResponse(commercepayments.AuthorizationReversalRequest authReversalRequest) {
commercepayments.AuthorizationReversalResponse authReversalResponse = new commercepayments.AuthorizationReversalResponse();
if(authReversalRequest.amount!=null )
{
authReversalResponse.setAmount(authReversalRequest.amount);
}
else
{
throw new SalesforceValidationException('Required Field Missing : Amount');
}
system.debug('Response - success');
authReversalResponse.setGatewayDate(system.now());
authReversalResponse.setGatewayResultCode('00');
authReversalResponse.setGatewayResultCodeDescription('Transaction Normal');
authReversalResponse.setGatewayReferenceNumber('SF'+getRandomNumber(6));
authReversalResponse.setSalesforceResultCodeInfo(SUCCESS_SALESFORCE_RESULT_CODE_INFO);
return authReversalResponse;
}
AuthorizationReversalResponse Methods
The following are methods for AuthorizationReversalResponse.
setAmount(amount)
Signature
global void setAmount(Double amount)
Parameters
- amount
- Type: Double
Return Value
Type: void
setGatewayAvsCode(gatewayAvsCode)
Signature
global void setGatewayAvsCode(String gatewayAvsCode)
Parameters
- gatewayAvsCode
- Type: String
- Used to verify the address mapped to a payment method when the payments platform requests tokenization from the payment gateway.
Return Value
Type: void
setGatewayDate(gatewayDate)
Signature
global void setGatewayDate(Datetime gatewayDate)
Parameters
- gatewayDate
- Type: Datetime
Return Value
Type: void
setGatewayMessage(gatewayMessage)
Signature
global void setGatewayMessage(String gatewayMessage)
Parameters
- gatewayMessage
- Type: String
Return Value
Type: void
setGatewayReferenceDetails(gatewayReferenceDetails)
Signature
global void setGatewayReferenceDetails(String gatewayReferenceDetails)
Parameters
- gatewayReferenceDetails
- Type: String
Return Value
Type: void
setGatewayReferenceNumber(gatewayReferenceNumber)
Signature
global void setGatewayReferenceNumber(String gatewayReferenceNumber)
Parameters
- gatewayReferenceNumber
- Type: String
- Unique reference ID created by the payment gateway.
Return Value
Type: void
setGatewayResultCode(gatewayResultCode)
Signature
global void setGatewayResultCode(String gatewayResultCode)
Parameters
- gatewayResultCode
- Type: String
- Gateway-specific result code. Must be used to map a Salesforce-specific result code.
Return Value
Type: void
setGatewayResultCodeDescription(gatewayResultCodeDescription)
Signature
global void setGatewayResultCodeDescription(String gatewayResultCodeDescription)
Parameters
- gatewayResultCodeDescription
- Type: String
- Description of the gateway’s result code. Use this field to learn more about why the gateway returned a certain result code.
Return Value
Type: void
setSalesforceResultCodeInfo(salesforceResultCodeInfo)
Signature
global void setSalesforceResultCodeInfo(commercepayments.SalesforceResultCodeInfo salesforceResultCodeInfo)
Parameters
- salesforceResultCodeInfo
- Type: SalesforceResultCodeInfo
- Description of the Salesforce result code value.
Return Value
Type: void