On This Page
Order Management
Salesforce
B2C Commerce does not natively support order management functions. This cartridge has functions that can be used to process captures and authorization reversals.These functions must be customized before use in the
Salesforce
B2C Commerce user interface.The ServiceFrameworkTest example controllers referenced below are for testing
only. Access is granted only when
all
of the following are true:- The Salesforce instance isnota production instance.
- TheEnable Visa Acceptance Test Endpointspreference (Custom Preferences > Visa Acceptance Cartridge configuration) is enabled. It is disabled by default.
- The caller is anauthenticated, registered customerwho is a member of theVisaAcceptanceTestAdmincustomer group
The VisaAcceptanceTestAdmin customer group is not created by the metadata import — you
must create it in Business Manager under
Merchant Tools > Customers > Customer
Groups
and assign it only to authorized merchant staff. Only members of this
group can access the test endpoints; any request from a non-member (or an
unauthenticated visitor) is redirected to the home page.Capture
The capture function can be found in the script
scripts/http/capture.js
. A
working example is available in the ServiceFrameworkTest-TestCaptureService
controller.Reference the capture.js object and make this request:
var captureObj = require("~/cartridge/scripts/http/capture.js"); var serviceResponse = captureObj.httpCapturePayment(requestID, merchantRefCode, paymentTotal, currency);
The resulting serviceResponse object contains the full response object generated by
the request. The contents of this object determine your logic in handling errors and
successes. These are the Capture request parameters:
Capture Request Parameters:
- requestID: TheVisa Acceptance for SMBRequest ID from the initial authorization.
- merchantRefCode: TheSalesforceOrder Number.
- purchaseTotal: The capture amount.
- currency: Currency Code.
Function Signature:
httpCapturePayment(requestID, merchantRefCode, purchaseTotal, currency)
Authorization Reversal
The authorization reversal function can be found in the script called
scripts/http/authReversal.js
. A working example is in the
ServiceFrameworkTest-TestAuthReversal controller.Reference the AuthReversal.js object and make this request:
var reversalObj = require("~/cartridge/scripts/http/authReversal.js"); var serviceResponse = reversalObj.httpAuthReversal(requestID, merchantRefCode, paymentTotal, currency);
The resulting serviceResponse object contains the full response object generated by
the request. The contents of this object determine your logic in handling errors and
successes. These are the Authorization reversal request parameters:
Authorization Reversal Request Parameters:
- requestID: TheVisa Acceptance for SMBRequest ID from the initial authorization.
- merchantRefCode: TheSalesforceOrder Number.
- purchaseTotal: The reversal amount.
- currency: Currency Code.
Refund
The refund function can be found in the script called
scripts/http/refund.js
.
A working example is in the ServiceFrameworkTest-RefundService controller.Reference the refund.js object and make this request:
var refundObj = require("~/cartridge/scripts/http/refund.js"); var serviceResponse = refundObj.httpRefundPayment(transactionId, merchantRefCode, paymentTotal, currency, refundEndpointType);
The resulting serviceResponse object contains the full response object generated by
the request. The contents of this object determine your logic in handling errors and
successes. These are the Authorization reversal request parameters:
Authorization Reversal Request Parameters:
- requestID: TheVisa Acceptance for SMBRequest ID from the capture or sale.
- merchantRefCode: TheSalesforceOrder Number.
- paymentTotal: The refund amount.
- currency: Currency Code.
- refundEndpointType: 'payments' for ACH/eCheck amd 'captures' for all other payments
Function Signature:
httpRefundPayment(transactionId, referenceInformationCode, total, currency, refundEndpointType)
Refunds are capped at the remaining refundable balance. A
refund (whether full, a single partial, or the running total of multiple
partials) that exceeds the captured amount is rejected before the gateway
call.