DR Terms component
Learn how to use the DR terms component.
Note: The information in this section applies to both the drb2b_drTermsElement
component (Aura only) and the drb2b_drTermsElement_LWR
component (LWR only).
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 Bypass Validation designer attribute. If the Bypass Validation value is true, the system bypasses validation for the drb2b_drTermsElement
component.
Note: If you choose to bypass the validation, you must add a custom validation using the event triggered by the drb2b_drTermsElement
component to ensure the shopper agrees to the terms and conditions.
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.
Subscribing to an event
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.
Using the Hide Terms UI attribute to hide term
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 you do this, an event is published with the Terms string by using the
digitalriverv3__DRTermsMessageChannel__c
event. You subscribe to this event to use the terms the shopper agrees to or to implement a custom validation.
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.
Publishing an event to make an update checkout call
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.
Note: The stored termString
containing the Digital River standard terms is used to make the update checkout API call. Client-specific terms are not supported.
Publishing DR Terms component events
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.
Use an event to customize client validations
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 may 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 includes an HTML-encoded string of the terms the shopper should be presented with. This event will be triggered on a load of terms component and when there is a change in the value of the checkbox.You must subscribe to the event, validate, and handle successes and errors.
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.
You must set the Bypass validation designer attribute to True on the
drb2b_drTermsElement
component to support custom validations. If you use the component on the Place Order page, the Bypass Validation designer attribute on any drb2b_orderSummary components should also be set to True.
Note: If you call your custom client custom validation from the Place Order page, it is recommended that you hide the Place Order button(s) included in the Order Summary component and instead display a custom button. After performing the custom validation, you should fire an event to call the place order logic.
Note: If you choose to bypass the validation, you must add a custom validation using the event triggered by the drb2b_drTermsElement
component to ensure the shopper agrees to the terms and conditions.
Last updated