Newer Version Available

This content describes an older version of this product. View Latest

BaseNotification Class

Abstract class for storing notification information sent from payment gateways.

Namespace

CommercePayments

Usage

An abstract class that contains the common fields from payment gateways. BaseNotification can’t be instantiated on its own.

The constructor of this class takes no arguments. For example:

CommercePayments.BaseNotification bnt = new CommercePayments.BaseNotification();

Example

1commercepayments.BaseNotification notification = null;
2        if ('CAPTURE'.equals(eventCode)) {
3            notification = new commercepayments.CaptureNotification();
4        } else if ('REFUND'.equals(eventCode)) {
5            notification = new commercepayments.ReferencedRefundNotification();
6        }

BaseNotification Methods

The following are methods for BaseNotification.

setAmount(amount)

Sets the transaction amount. Must be a non-negative value.

Signature

global void setAmount(Double amount)

Parameters

amount
Type: Double
The amount of the transaction.

Return Value

Type: void

setGatewayDate(gatewayDate)

Sets the date that the notification occurred. Some gateways don’t send this value.

Signature

global void setGatewayDate(Datetime gatewayDate)

Parameters

gatewayDate
Type: Datetime
The date that the notification occurred.

Return Value

Type: void

setGatewayMessage(gatewayMessage)

Sets error messages that the gateway returned for the notification request. Maximum length of 255 characters.

Signature

global void setGatewayMessage(String gatewayMessage)

Parameters

gatewayMessage
Type: String
The message that the gateway returned with the notification request. Contains additional information about the notification.

Return Value

Type: void

setGatewayReferenceDetails(gatewayReferenceDetails)

Sets the payment gateway’s reference details.

Signature

global void setGatewayReferenceDetails(String gatewayReferenceDetails)

Parameters

gatewayReferenceDetails
Type: String
Provides information about the gateway communication.

Return Value

Type: void

setGatewayReferenceNumber(gatewayReferenceNumber)

Sets the payment gateway’s reference number.

Signature

global void setGatewayReferenceNumber(String gatewayReferenceNumber)

Parameters

gatewayReferenceNumber
Type: String
Unique transaction ID created by the payment gateway.

Return Value

Type: void

setGatewayResultCode(gatewayResultCode)

Sets a gateway-specific result code. The code can be mapped to a Salesforce-specific result code. Maximum length of 64 characters.

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)

Sets a description of the gateway-specific result code that a payment gateway returned. Maximum length of 1000 characters.

Signature

global void setGatewayResultCodeDescription(String gatewayResultCodeDescription)

Parameters

gatewayResultCodeDescription
Type: String
Provides additional information about the result code and why the gateway returned the code. Descriptions vary between different gateways.

Return Value

Type: void

setId(id)

Sets the ID of the notification sent by the gateway.

Signature

global void setId(String id)

Parameters

id
Type: String

Return Value

Type: void

setSalesforceResultCodeInfo(salesforceResultCodeInfo)

Sets the information about the Salesforce-specific result code used to match a result code from a payment gateway.

Signature

global void setSalesforceResultCodeInfo(commercepayments.SalesforceResultCodeInfo salesforceResultCodeInfo)

Parameters

salesforceResultCodeInfo
Type: commercepayments.SalesforceResultCodeInfo
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

setStatus(status)

Sets the status of the notification sent by the gateway.

Signature

global void setStatus(commercepayments.NotificationStatus status)

Parameters

status
Type: commercepayments.NotificationStatus
Shows whether the payments platform successfully received the notification from the gateway.

Return Value

Type: void