LogoLogo
Partner Integrations
Salesforce Lightning B2B Commerce App 2.0
Salesforce Lightning B2B Commerce App 2.0
  • Salesforce Lightning B2B Commerce App 2.0
  • Introduction
    • How it works
    • What's new in version 2.0
  • Upgrading to version 2.0
  • Integrate the Salesforce Lightning app
    • Step 1: Install the Digital River app
    • Step 2: Configure the Digital River app
    • Step 3: Register external services
    • Step 4: Configure DCM logs
    • Step 5: Add custom fields to the page layouts
    • Step 6: Enable email deliverability
    • Step 7: Import ECCN codes, tax groups, and tax types
    • Step 8: Configure and synchronize the products
    • Step 9: Schedule backend jobs
    • Step 10: Set up integration between Salesforce and Digital River
    • Step 11: Set up webhooks
    • Step 12: Configure landed cost
    • Step 13: Manage permission sets
    • Step 14: Configure shipping integration
    • Step 15: Integrating refunds
    • Step 16: Configure the From email address
    • Step 17: Integrate the Digital River components into the Commerce storefront
      • Integrate the Digital River components into the B2B Commerce LWR template
        • Add components to the Checkout page
        • Add custom components outside of checkout
      • Integrate the Digital River components into an asynchronous checkout flow
        • Custom components used in the checkout subflows
        • Subflow configuration
          • Configure the delivery method subflow
          • Configure the Checkout Summary subflow
          • Configure the Payment and Billing Address subflow
            • Edit the Payment Method screen
            • Edit the decision elements
            • Link screen components
          • Configure the shipping address subflow
            • Configure the shipping address screen
        • Configure the main checkout flow
      • Integrate the Digital River components into a synchronous checkout flow
        • Deploy flows using Salesforce Workbench
        • Update the flow nodes in the synchronous checkout flow
          • Create custom variables
          • Delete nodes
          • Connect nodes
          • Modify nodes
          • Add nodes
        • Configure screens for a customized synchronous flow
          • Add custom components to screens in the synchronous checkout flow
          • Configure the Shipping Options screen
          • Configure the Delivery Method Screen
          • Configure the Checkout Summary screen
          • Configure the Payment And Billing Address screen
          • Configure the Place Order Confirmation screen
      • Add custom components to pages (Aura)
        • Drag and drop (custom) components
    • Step 18: Test the Salesforce Lightning app integration
    • Step 19: Consider recommended extensions
  • Extend the Salesforce Lightning app
    • Customizing the Lightning web components
      • Designer attributes
        • Designer attributes for LWR
        • Designer attributes for Aura
      • Components
        • Buyer info component
        • DR util component
        • DR Terms component
        • Checkout summary component
        • Order Summary component
        • Place order component
        • Payments component
        • Payment details component
        • Tax identifier component
        • DR compliance component
        • Address details component
        • Offline refund component
        • Hide checkout summary component (Aura only)
    • Extend the Ship From address
    • Extend the webhook framework
    • Configure subscriptions
    • Shipping choice extension point
    • Customer credit
      • addCustomerCreditSourceToCheckout
      • deattachPaymentToCheckout
      • getAmountRemainingforCheckout
      • getCartDetailsById
      • Publishing connector events
    • Tax calculation
    • Overriding Digital River CSS
    • Mapping custom fields (LWR only)
    • Add a spinner component (LWR only)
  • User guide
    • Regulatory fees
    • Tax certificates
    • Tax identifiers
    • My wallet
    • Customer credit
    • Checkout and order creation
    • Fulfillment/cancellation flow
    • Refunds
    • Offline refunds
    • Invoices and credit memos
  • Support
  • Appendix
    • Custom fields and objects
    • Contact point address
    • Multi-currency support
Powered by GitBook
On this page
  • Publish events
  • Subscribe to an event to get Contact Point Address ID (Aura only)
  1. Extend the Salesforce Lightning app
  2. Customizing the Lightning web components
  3. Components

Buyer info component

Learn how to use the Buyer Info component.

PreviousComponentsNextDR util component

Last updated 1 year ago

If you use a custom component instead of the drb2b_buyerinfo component, you must:

  • Populate the following fields in the WebCart object:

    • digitalriverv3__Buyer_Name__c

    • digitalriverv3__Buyer_Email__c

    • digitalriverv3__Buyer_Phone__c

    • digitalriverv3__BillingAddress

    • digitalriverv3__DR_Customer_Type__c

    • digitalriverv3__Buyer_OrganizationName__c Note: If you use a custom component, validate that the digitalriverv3__Buyer_Name__c field contains a space. Digital River expects both a First Name and Last Name and does a split on this field by looking for a space, ' ' ,value. Note: If you use the Buyer Info component, you are not required to make changes as the field is automatically displayed. If you are not using the Buyer Info component, use a field in your user interface to collect the Organization Name information if the shopper's purchase type is Business. This UI field updates the digitalriverv3__Buyer_OrganizationName__c field on the WebCart object.

  • Update the DeliverToAddress on the Cart Delivery Group object.

  • (LWR only): After your custom component collects all the data points listed above, update the WebCart synchronously and trigger tax calculation. The WebCart update must be completed before tax is calculated. For options for triggering tax calculation, see the section.

    • After your component has triggered tax calculation, refresh the page's other Digital River components. Do this by publishing the calculateTaxRefresh event as indicated below.

Publish events

This section provides information on publishing events when using this component.

Use the following steps to publish various event types. The event purpose and payload will vary depending on your use case.

Import theDigitalRiverMessageChannel__c message channel and message service into a custom JavaScript file, as shown below.

Import example
import dr_lms from "@salesforce/messageChannel/digitalriverv3__DigitalRiverMessageChannel__c";

import {publish, MessageContext } from "lightning/messageService";

Declare the message context variable as shown below.

Declare variable example
@wire(MessageContext) messageContext;

Publish the event.

Publish example
  publish(this.messageContext, dr_lms, { 
                    purpose: '<purpose>',           
                    payload: '<payload>'            
                });

The following table provides more information on the component events.

Event Purpose
Event Payload Example
Description

toggleShowBIComponent

{"isShow":true}

Publish this event to show {"isShow":true} or hide {"isShow":false} the Buyer Info component.

saveBuyerInfo

n/a

(Aura only) Publish this event to perform validation of the information entered into the buyer info component and save the data to the cart.

If publishing this event, you must subscribe to the contactPointAddressId event to return the saved Contact Point Address Id.

Use this event if the OOTB Next button is disabled.

calculateTaxRefresh

n/a

(LWR Only) If you are replacing the Buyer Info component with a custom version, publish this event to refresh other components on the page after tax calculation has completed.

Subscribe to an event to get Contact Point Address ID (Aura only)

You can use this event to have the saved Contact Point Address ID returned after the buyer information is saved using the saveBuyerInfo purpose. You use this value to update the Cart Delivery Group as appropriate. Complete the following tasks to subscribe to the event.

Import the DigitalRiverMessageChannel__c message channel and message service into a custom JavaScript file, as shown below.

Import example
import dr_lms from "@salesforce/messageChannel/digitalriverv3__DigitalRiverMessageChannel__c";

import {publish, MessageContext } from "lightning/messageService";

Declare the message context variable as shown below.

Declare variable example
@wire(MessageContext) messageContext;

Declare methods as shown below to get the Contact Point Address Id.

Declare methods example
subscribeToMessageChannel() {
        if (!this.subscription) {
            this.subscription = subscribe(this.messageContext, dr_lms,               (message) => this.handleMessage(message));
        }
    }

   handleMessage(message) {
        switch (message.purpose) {
            case " contactPointAddressId":
               // Call custom logic here 
               // message.payload will give Contact point address Id
                break;
        }
    }

The following is an example of the message format:

Message example:
{"purpose":"contactPointAddressId","payload":"8lW5Y000000Pz69UAC"}

Call a declared method in the connectedCallback method as shown below:

Call declared method
connectedCallback() {
        this.subscribeToMessageChannel();
  
Tax Calculation