Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel6
outlinefalse
stylenone
typelist
printablefalse

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.

...

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 /restaurant 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.

...

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 enableddisabled, no fee calculation will be calculated.

Title

Description

Link

Enable Get Fees and Discount by Brand

Feature flag responsible for enabling fees calculations.

enable-get-fees-and-discount-by-brand

Tiered Delivery Fees

Feature flag responsible for controlling the values ​​that will be used for each fee.

tiered-delivery-fees

Code Changes

The final solution was based on the following pull requests:

...

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

Loyalty

...

titleloyalty-engine-sdk/api.ts - Update Types

...

languagetypescript

...

Deprecated !
https://github.com/rbilabs/intl-whitelabel-cms

Loyalty

Expand
titlemodels/configuration/configuration.enums.ts - Update Types
Code Block
languagetypescript
export enum PointsDependsOn {
  DeliveryFee = 'Delivery Fee',
  ServiceFee = 'ServiceFee',
}

...

Expand
titleloyalty-engine-sdk/dist/api.d.ts - Ensure the type was generated
Code Block
languagetypescript
export declare enum EnginePointsDependsOn {
    DeliveryFee = "Delivery Fee",
    ServiceFee = "Service Fee",
}
Expand
titleloyalty-engine-sdk/api.ts - Ensure the type was generated
Code Block
languagetypescript
export enum EnginePointsDependsOn {
    DeliveryFee = 'Delivery Fee',
    ServiceFee = 'Service Fee',
}
Info

In addition, it will be necessary to make unit tests to validate the solution.

...

CMS - Sanity ( intl-whitelabel-cms )

Expand
titleloyalty/documents/earning-calculation.ts
Code Block
export enum PointsDependsOn {
  DeliveryFee = 'Delivery Fee',
  ServiceFee = 'Service Fee',
}
Code Block
export const LOYALTY_POINTS_DEPENDS_ON = [
  { title: 'Delivery Fee', value: PointsDependsOn.DeliveryFee },
  { title: 'Service Fee', value: PointsDependsOn.ServiceFee },
];

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

The POS Restaurant dont use service fee integration

This sum will be based on the values ​​obtained in sanity, for this, service fee should not be calculated in loyalty points

Crown Coins = Sanity Values ( ignore service fee )

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

...

To check whether the value of crown coins received is valid, we use that every $1 spent is equivalent to 100 crown coins . in ES Market ( This calculation is made by adding the "subtotal" (without the tax charged) + feesis also configurable in the same Sanity page, not always $1 = 100 points for all markets ).

Info

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.

...

Info

This issue is already under development, so you just need to confirm that everything is aligned.

POS fees integration

Currenty airtouch is not supported with service fee because the integration doesn't have the service fee implemented. So for this integration we need to take care in the restaurant that use this POS and disable the service fee calculation in loyalty as well. For this include a text in sanity to advice if service fee is not calculating even the option is enabled.