Brief Description
This technical refinement is aimed at the need for a new option so that the value of the service fee can be added or removed in the value of crown coins when finalizing the customer's order, this option will be included within sanity where there will be a way to activate or disable this calculation.
Development
To do this, it will be necessary to make some adjustments to both the Sanity and the Loyalty Service so that we can know the value of the service fee, whereas today these systems are only aware of some fees and the value of the product.
You must pay attention to the fact that there are many factors that must be clear for this feature to work in the system, these points will be described in the next topics, but in short, you need to pay attention to whether the market you are using has the option of active service fee as well as in sanity the crown points calculation options are configured correctly, this may affect the final calculation because it is necessary to look to which tax and fees will be considered in the final calculation.
Feature Flags
The first validation we need to do is to know if this feature flag has been enabled, it is responsible for enabling the service fee calculation in the user's request. If this feature flag is disabled, no fee calculation will be calculated.
Title | Description | Link |
---|---|---|
Enable Get Fees and Discount by Brand | Feature flag responsible for enabling fees calculations. | |
Tiered Delivery Fees | Feature flag responsible for controlling the values that will be used for each fee. |
Code Changes
The final solution was based on the following pull requests:
INTL - Loyalty
https://github.com/rbilabs/intl-loyalty/pull/442/files
https://github.com/rbilabs/intl-loyalty/pull/455/files
INTL - Sanity
https://github.com/rbilabs/intl-sanity-shared-schemas/pull/16 Deprecated !
https://github.com/rbilabs/intl-whitelabel-cms
Loyalty
In addition, it will be necessary to make unit tests to validate the solution.
CMS - Sanity ( intl-whitelabel-cms )
The final result of sanity screen is to be equal below, can be found at this link
Tests
Scenarios
Scenarios | Description | Sum |
---|---|---|
The business want to calculate subtotal, tax and service fee | This sum will be based on the values obtained in sanity, for this, the subtotal, tax and service fee options must be activated. | Crown Coins = Subtotal + Tax + Service Fee |
The business want to calculate only subtotal and service fee | This sum will be based on the values obtained in sanity, for this, only subtotal and service fee options must be activated. | Crown Coins = Subtotal + Service Fee |
The business will include the full price | This sum will be based on the values obtained in sanity, for this, all options must be activated | Crown Coins = Subtotal + Tax + Delivery Fee + Service Fee |
The business will not include the full price | This sum will be based on the values obtained in sanity, for this, only subtotal option must be activated. | Crown Coins = Subtotal |
The business will not give crown coins | This sum is equal to 0 and will be based on the values obtained in sanity, for this all options must be deactivated | Crown Coins = 0 |
The business will include the subtotal and service fee with discount | This sum will be based on the values obtained in sanity, for this, only subtotal and service fee options must be activated. | Crown Coins = Subtotal + ( Service Fee - Service Fee Discount ) |
The business will include the subtotal and service fee with feature flag deactivated | This sum will be based on the values obtained in sanity, for this, only subtotal and service fee options must be activated. The feature flag must be turned off. | Crown Coins = Subtotal |
DMP Process
To carry out the test, you must have access to the development environment DMP so that it is possible to change the order to the dropped off status, because loyalty calculations will only be calculated after the order is delivered and confirmed by the DMP. For PLK ES you can use this link: https://euw3-dev-plk-exp-tablet.com.rbi.tools/orders-management
Your order will start in the New Orders table and you must proceed to the last screen and after that, complete the order successfully
To confirm that your order has been completed, you need to be on the order confirmation page with the current order open and all steps must have been completed.
At the end of this process, your order is ready to generate crown coins.
Crown Coins
Once the order is completed and is in delivery status, you will need to go to the main whitelabel page, click on the "hamburger menu" and click on the first button called "Popeyes Rewards". On this page, the order statement and how many points you earned with each one will be displayed.
To check whether the value of crown coins received is valid, we use that every $1 spent is equivalent to 100 crown coins.
It should be noted whether the fees were applied to the total value, otherwise, these fees will not be considered in the value of the crown coins. You can find out which fees are enabled in sanity.
Possible Issues
Delivery Fee and Final Order value
When I did some tests in development I noticed that some values did not match correctly with the final order value. For example, in the case of the Delivery Fee, the value is set to zero, but in the database it had a value of 2.99. This can create some confusion when carrying out some tests related to the amount of value that the user can receive from crown coins.
This issue is already under development, so you just need to confirm that everything is aligned.
Add Comment