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.
SaleResponse Class
Namespace
Usage
The constructor of this class takes no arguments. For example:
CommercePayments.SaleResponse slr CommercePayments.SaleResponse();This class contains details about a customer card that was used as a payment method for Authorization, Sale, or Tokenization request. The gateway adapter reads the fields of this class while constructing a transaction JSON request, which it then sends to the payment gateway. The object of this class is made available by the cardPaymentMethod field in SaleApiPaymentMethodRequest and AuthApiPaymentMethodRequest.
Example
1commercepayments.SaleResponse saleResponse = new commercepayments.SaleResponse();
2saleResponse.setGatewayReferenceDetails("refDetailString");
3saleResponse.setGatewayResultCode("res_code");
4saleResponse.setGatewayResultCodeDescription("");
5saleResponse.setGatewayReferenceNumber("");
6saleResponse.setSalesforceResultCodeInfo(getSalesforceResultCodeInfo(commercepayments.SalesforceResultCode.SUCCESS.name()));SaleResponse Methods
The following are methods for SaleResponse.
setAmount(amount)
Signature
global void setAmount(Double amount)
Parameters
- amount: Type: Double The amount of the transaction.
Return Value
Type: void
setAsync(async)
Signature
public void setAsync(Boolean async)
Parameters
- async: Type: Boolean
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 authorization 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
setPaymentMethodTokenizationResponse(paymentMethodTokenizationResponse)
Signature
global void setPaymentMethodTokenizationResponse(commercepayments.PaymentMethodTokenizationResponse paymentMethodTokenizationResponse)
Parameters
- paymentMethodTokenizationResponse: Type: PaymentMethodTokenizationResponse Gateway response sent by payment gateway adapters for the payment method tokenization request. The response includes the payment method’s token ID value.
Return Value
Type: void
setRetryCategory(retryCategory)
Signature
public void setRetryCategory(commercepayments.RetryCategory retryCategory)
Parameters
- retryCategory: Type: commercepayments.RetryCategory Specifies the payment failure category used to determine retry eligibility.
Return Value
Type: void
setRetryDecision(retryDecision)
Signature
public void setRetryDecision(commercepayments.RetryDecision retryDecision)
Parameters
- retryDecision: Type: commercepayments.RetryDecision Determines whether the payment operation can be retried based on the retry category.
Return Value
Type: void
setSalesforceResultCodeInfo(salesforceResultCodeInfo)
Signature
global void setSalesforceResultCodeInfo(commercepayments.SalesforceResultCodeInfo salesforceResultCodeInfo)
Parameters
- salesforceResultCodeInfo: Type: SalesforceResultCodeInfo Sets the Salesforce-specific result code information. Payment gateways have many response codes for payment calls. Salesforce uses the result code information to map payment gateway codes to a predefined set of standard Salesforce result codes.
Return Value
Type: void