static onCustomerRegistered(order
:
Order)
:
void
Handles the account registration of the shopper who placed the given order.
attachPaymentMethod
Attaches the given payment method to the given customer. Use this method to attach a payment method of type
SalesforcePaymentMethod.TYPE_CARD to a shopper who registers as a customer after placing an order, and
has affirmatively elected to save their card as part of the registration process. This method will throw an error
if passed incompatible payment method and/or customer objects.
Parameters:
paymentMethod
-
payment method to attach to customer
customer
-
customer whose payment method to attach
Throws:
Exception
-
if there was an error attaching the payment method to the customer
detachPaymentMethod
Detaches the given payment method from its associated customer. Once detached the payment method remains
associated with payment intents in the payment account, but is no longer saved for use by the customer in future
orders.
Parameters:
paymentMethod
-
payment method to detach from customer
Throws:
Exception
-
if there was an error detaching the payment method from its customer
getAttachedPaymentMethods
Returns a collection containing the payment methods attached to the given customer. The collection will be empty
if there are no payment methods attached to the customer, or there was an error retrieving the attached payment
methods.
Parameters:
customer
-
customer whose payment methods to get
Returns:
collection of attached payment methods
Throws:
Exception
-
if the given customer is null
or undefined
getPaymentIntent
Returns the payment intent for the given basket, or null
if the given basket has none.
Parameters:
basket
-
basket to checkout and pay using Salesforce Payments
Returns:
The payment intent
Throws:
Exception
-
if there was an error retrieving the payment intent for the basket
getPaymentIntent
Returns the payment intent for the given order, or null
if the given order has none.
Parameters:
order
-
order paid using Salesforce Payments
Returns:
The payment intent
Throws:
Exception
-
if there was an error retrieving the payment intent for the order
getPaymentsSiteConfig
Returns a payments site configuration object for the current site.
Returns:
a payments site configuration or null if no payments site configuration found
Throws:
Exception
-
if there is no current site
getPayPalOrder
Returns the PayPal order for the given basket, or null
if the given basket has none.
Parameters:
basket
-
basket to checkout and pay using Salesforce Payments
Returns:
The PayPal order
Throws:
Exception
-
if there was an error retrieving the PayPal order for the basket
getPayPalOrder
Returns the PayPal order for the given order, or null
if the given order has none.
Parameters:
order
-
order paid using Salesforce Payments
Returns:
The PayPal order
Throws:
Exception
-
if there was an error retrieving the PayPal order for the order
getSavedPaymentMethods
Returns a collection containing the payment methods saved to be presented to the given customer for reuse in
checkouts. The collection will be empty if there are no payment methods saved for the customer, or there was an
error retrieving the saved payment methods.
Parameters:
customer
-
customer whose payment methods to get
Returns:
collection of attached payment methods
Throws:
Exception
-
if the given customer is null
or undefined
, or there is an error getting the saved payment methods
onCustomerRegistered
static
onCustomerRegistered(order
:
Order)
:
void
Handles the account registration of the shopper who placed the given order. Use this method to ensure the
registered customer profile is associated with the order in Salesforce Payments.
Parameters:
order
-
order paid using Salesforce Payments
Throws:
Exception
-
if there was an error attaching the payment method to the customer
removeSavedPaymentMethod
Removes the given saved payment method so that it is no longer presented to the given customer for reuse in
checkouts. The payment method remains in the payment account, but is no longer saved for use by the customer.
Parameters:
paymentMethod
-
payment method to detach from customer
Throws:
Exception
-
if there was an error removing the saved payment method from its customer
savePaymentMethod
Saves the given payment method to be presented to the given customer for reuse in subsequent checkouts. This
method will throw an error if passed incompatible payment method and/or customer objects.
Parameters:
customer
-
customer for which to save the payment method
paymentMethod
-
payment method to save for the customer
Throws:
Exception
-
if there was an error saving the payment method for the customer