SaleRequest Class

Stores information about a sales request.

Namespace

CommercePayments

Usage

This class holds all the required details about a sale request. Gateway adapters read the fields of this class object while constructing a sale JSON request thatis sent to the payment gateway. The object of this class is made available through commercepayments.paymentGatewayContext by calling getPaymentRequest().

Example

This code sample retrieves the SaleRequest object from the PaymentGatewayContext class.
commercepayments.SaleRequest = (commercepayments.SaleRequest)gatewayContext.getPaymentRequest()

SaleRequest Constructors

The following are constructors for SaleRequest.

SaleRequest(amount)

Constructor for defining an amount for the sale request. This constructor is intended for test usage and throws an exception if used outside of the Apex test context.

Signature

global SaleRequest(Double amount)

Parameters

amount
Type: Double
Amount of the sale request.

SaleRequest Properties

The following are properties for SaleRequest.

accountId

Customer account ID for the sale request.

Signature

global String accountId {get; set;}

Property Value

Type: String

amount

Amount of the sale request. Can be positive only.

Signature

global Double amount {get; set;}

Property Value

Type: Double

comments

Additional information about the sale request.

Signature

global String comments {get; set;}

Property Value

Type: String

currencyIsoCode

Currency code for the sale request.

Signature

global String currencyIsoCode {get; set;}

Property Value

Type: String

paymentMethod

Payment method used in the sale request.

Signature

global commercepayments.SaleApiPaymentMethodRequest paymentMethod {get; set;}

Property Value

Type: SaleApiPaymentMethodRequest

SaleRequest Methods

The following are methods for SaleRequest.

equals(obj)

Compares this object with the specified object and returns true if both objects are equal; otherwise, returns false.

Signature

global Boolean equals(Object obj)

Parameters

obj
Type: Object

Return Value

Type: Boolean

hashCode()

Maintains the integrity of lists of type SaleRequest by determining the uniqueness of the external object records in a list.

Signature

global Integer hashCode()

Return Value

Type: Integer

toString()

Converts a date to a string.

Signature

global String toString()

Return Value

Type: String