DR Terms component
Learn how to use the DR terms component.
Last updated
Learn how to use the DR terms component.
Last updated
Use the drb2b_drTermsElement
component to display the Digital River terms and conditions. The shopper must select the check box in this component to accept the Digital River terms and conditions. You can configure this component in the flow.
You can use the drb2b_drTermsElement
component with the . If the Bypass Validation value is true, the system bypasses validation for the drb2b_drTermsElement
component.
This component uses a visual force page where DigitalRiver.js and DR.CSS are loaded.
The Lightning Messaging service triggers an event every time a shopper selects or clears the check box next to the Digital River terms and conditions. The event data includes isSelected
with a value of true
or false
. The true
value indicates the shopper selected the check box and the false
value indicates the shopper cleared the check box. The event data also contains the termsString
variable which contains the text for the terms the shopper agrees to. The text includes any raw HTML tags returned by Digital River. This allows you to save the terms the shopper agreed to if needed.
You can subscribe to this event. This event is triggered when the shopper selects the check box to agree to the Digital River terms and conditions or a custom validation.
Import the digitalriverv3__DRTermsMessageChannel__c
message channel and message service into a custom javascript file as shown in below.
Declare the messageContext
variable as shown below.
Subscribe to an event as shown below.
The message contains the following parameters.
isSelected
The value is true
or false
depending on whether or not the shopper agreed to the terms and conditions by selecting the check box.
termsString
The value contains the HTML encoded text for the terms and conditions displayed to the shopper.
If you want to add the drb2b_drTermsElement
component to the Place Order page, you can only use one drb2b_orderSummary
component in the flow or template.
As mentioned, you use the drb2b_drTermsElement
component to display order terms and conditions. The checkbox used in this component lets a shopper actively accept terms and conditions of the order.
You use this component in your shopping flow as follows:
drb2b_drTermsElement
component is provided with a designer Hide Terms UI attribute by the name. By default, the value of this designer attribute is False. You can hide the terms by setting the value of the attribute to True.
When the DR terms component UI is hidden, you are responsible for ensuring that the shopper agrees to the Digital River terms, as the component validation is disabled when the UI is hidden. Additionally, when the cart contains subscription products, you must make sure to fire an event after the shopper agrees to the terms. The shopper's acceptance of the terms then updates the DR checkout with those agreed-to terms.
When subscription products are present in the cart if the Hide Terms UI designer attribute is set to true, you need to publish an event to ensure that the checkout is updated after the shopper agrees to the subscription terms. Refer to the Publishing DR Terms Component events section below for details on how to publish the event to update the checkout call with the terms string.
Complete the following tasks to publish various event types. The event purpose and payload will vary depending on the use case.
Import DigitalRiverMessageChannel__c message
channel and message service into custom JavaScript file as shown below.
Declare the message context variable as shown below.
Publish the event.
Refer to the following table for more information on the DR Terms component events.
toggleShowTermsComponent
{"isShow":true}
Publish this event to show {"isShow":true} or hide {"isShow":false} the DR Terms component
updateCheckoutWithTermsString
n/a
Publish this event to update the checkout with the terms string. This may be used for subscription use cases. See Publishing an event to make an update checkout call section.
By default, you can use the drb2b_drTermsElement
component to validate that a shopper has agreed to Digital River’s terms and conditions. Sometimes, however, you made need to perform custom validations. An example use case could be that you need to introduce additional client specific terms that shoppers must agree to or you need to provide navigation elements on the page such as a Back button.
Be aware of the following when using the DR Terms component with custom validations:
When you use the db2b_drTermsElement
component, it fires an event that contains a Boolean value based on whether the shopper has checked the checkbox next to the Digital River terms. This event also contains an HTML encoded string of the terms the shopper should be presented with. This event will be triggered on load of terms component and when change in value of checkbox.
When using this feature, you are responsible for validating that the shopper has agreed to the Digital River Terms in addition to performing any other validation logic.
To support custom validations, you need to set the Bypass validation designer attribute to True on the drb2b_drTerms
component. If you are using the component on the Place Order page, the Bypass Validation designer attribute on any drb2b_orderSummary components should be set to True as well.
When you do this, an event is published with the Terms string by using the digitalriverv3__DRTermsMessageChannel__c
event. You to this event to use the terms the shopper agrees to or to implement a custom validation.
You must , do the validation, and handle successes and errors.