SalesforceCommerceCloud / b2c-crm-sync

... a contemporary perspective on how to integrate B2C Commerce and the Salesforce Customer 360 Platform to power frictionless customer experiences in the B2C domain.
https://salesforcecommercecloud.github.io/b2c-crm-sync/
BSD 3-Clause "New" or "Revised" License
64 stars 47 forks source link

Introduction of the B2C Active Customer Promotions use case #101

Closed jbachelet closed 2 years ago

jbachelet commented 2 years ago

Introduction

This pull-request introduces a new use case: as a customer service agent, being able to see right from the Core Platform, on the contact/personAccount record, the currently active promotions for the customer. This gives more power to the customer service agent in order to re-engage the customer in a new buying journey.

How it works?

This new workflow is working with both Account/Contact and PersonAccount models. Here are the steps on how the feature is working:

  1. Within the Core Platform, either on the Contact or the PersonAccount record page, a new Engagement tab has been introduced, completing the existing Details and Related tabs.
  2. When goging into this tab, a new flow loads and start the "Active Customer Promotions Retrieval" process.
  3. If multiple sites are active and have the Enable_Active_Customer_Promotion_Sync__c field to true, then the user has to choose what site will be used to retrieve the active customer promotions. This is important as, depending on the site, different promotions might be fetched (as promotions are on a per-site basis in B2C Commerce).
  4. Once the user clicks on next, an OCAPI call is done to the B2C Commerce instance in order to get the customer profile through the Shop API, including active promotions.
  5. Then a second OCAPI call is done to get the details of the promotions. The goal of this second API call is to use the data mapping from the core platform to only get the required fields from B2C Commerce, along with coupons IDs if the promotion is tied to some coupons.
  6. A screen is then rendered to the user with the active promotions for the given customer.
  7. The user can, in case the promotion is activable through coupons, use the Retrieve Coupon Code(s) bouton to fetch coupon codes from B2C Commerce. This allows the agent to see the coupon codes for the given coupon and so provide one of them to the customer which whom he/she is talking with.
  8. The user can finally refresh the screen to restart the process at step 3, and so be able to choose another site in case multiple ones matched the configuration, or re-render promotions directly in case only one site matches.

Screenshots

Screenshot 2022-01-19 at 7 04 52 PM Screenshot 2022-01-19 at 7 05 01 PM Screenshot 2022-01-19 at 7 05 11 PM


Unit tests

This feature is :100: covered in terms of unit tests :white_check_mark:, either from Core and from B2C :white_check_mark: Screenshot 2022-01-19 at 5 53 35 PM Screenshot 2022-01-19 at 5 56 34 PM