Extending the Salesforce B2C LINK Cartridge
Extend the Salesforce B2C LINK Cartridge.
Custom code
IMPORTANT: Follow the instructions below only when you can’t use the cartridge directly, or you need to resolve conflicts with other cartridges on your project. Otherwise, you must compile the client-side scripts and styles, upload the cartridge, and add it to your storefront cartridge path. Cartridge int_digitalriver_sfra already contains all templates and script changes described in Custom code.
Templates
Make the following changes to the template files:
Template: cartridge\templates\default\account\payment\addPayment.isml Add this Digital River script to Drop-in functionality on the page.
And apply the changes to Drop-in styles.
<script src="
https://js.digitalriverws.com/v1/DigitalRiver.js">
</script>And apply the changes to Drop-in styles.
assets.addCss('/css/digitalRiver.css');
Put the following condition inside the card-body div.

Template: cartridge\templates\default\cart\cartTotals.isml. Include the Digital River Duty section in the cart totals template after the discount section.

Template: cartridge\templates\default\checkout\billing\paymentOptions\paymentOptionsSummary.isml. Extend the condition with the
‘DIGITAL_RIVER_DROPIN’payment method.

Template: cartridge\templates\default\checkout\billing\billing.isml. Include the Digital River payment options template.

Template: cartridge\templates\default\checkout\billing\storedPaymentInstruments.isml. Extend the
card-imageclass condition as follows:
Also, wrap the security-code-input div with the following condition:

Template: cartridge\templates\default\checkout\shipping\shippingAddress.isml. Extend the shipping address form with the email address input field.

Template: cartridge\templates\default\checkout\checkout.isml. Include the Digital River styles.
Add a condition that will control the submit payment button display.

Template: cartridge\templates\default\checkout\orderTotalSummary.isml. Add the Digital River Duty section.

Client scripts
Make the following changes to the client script files:
Note: Do not forget to compile client-side scripts after implementing changes in the source code.
Script cartridge\client\default\js\checkout.js Include the drDropIn script on the checkout page.

Script cartridge\client\default\js\checkout\checkout.js Add the following code to the shipping submit success handler.

Extend the code on line 222 as follows:

Script cartridge\client\default\js\checkout\billing.js Extend the condition inside the function.
Add the <getCreditCardPaymentInfoHtml> function.
And use it for creating HTML inside the <updatePaymentInformation> function.

Wrap the <clearCreditCardForm> function content with the following condition.

Wrap the <handleCreditCardNumber> content with the following condition.
Add the condition inside the <selectSavedPaymentInstrument>.

Add the following code in the <addNewPaymentInstrument> function.
Add the following code in the <addNewPaymentInstrument> function.

Script cartridge\client\default\js\paymentInstruments.js Add the Drop-in script to the page.

External interfaces
The cartridge uses the Digital River API endpoints. You can find API service documentation on the Digital River website: https://docs.digitalriver.com/digital-river-api/.
There is a service sharing one profile and one credential.
DigitalRiver.http.service
Also, this cartridge uses the Digital River Drop-in external script to handle client payments.
Important: The DIGITAL_RIVER_DROPIN payment integration represents not one but multiple payment types such as credit card, PayPal, Wire Transfer, and so on. The Drop-in integration provides the selection of payment types, and the client-side/backend scripts handle it. We designed this cartridge mainly to handle the credit card payment type, though it will also successfully process any other payment type provided by the Drop-in integration. To add any business logic for a specific payment type or provide shoppers with a better customer experience, you can extend Drop-in data handlers as described below:
int_digitalriver\cartridge\scripts\digitalRiver\dropinHelper.js
switch(source.type)in functionsaveDropInPaymentToWallet—to save any specific payment data from Drop-in to the customer wallet which will be used in further checkouts.switch(paymentType)in functiongetPaymentInformationFromPaymentInstrument—to handle any payment type specific data which was saved in the customer profile.switch(source.type)in functiongetPaymentInformationFromDropIn—to handle any payment type-specific data which was provided by Drop-in.
int_digitalriver_sfra\cartridge\models\payment.js
function
extendDigitalRiverInfo—extract all information you want to be available in templates or be provided to the client-side as JSON.
int_digitalriver_sfra\cartridge\client\default\js\checkout\billing.js
switch(selectedPaymentInstrument.paymentType)in functionupdatePaymentInformation—add payment information to html. Make sure you have the necessary data provided by the Payment model.
Last updated