Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleAdd the “current value points” on GQL to each order

File: src/remote/queries/fragments/intl-loyalty-transaction.ts
In const INTLLoyaltyTransactionFragmentForTimeline add:

Code Block
transactionDetails {
  person {
    currentPoints
  }
}

DOD:

Return “currentPoints” in the currentPoints for each order of useruser order. We can verify if this value is reflected on the src/components/intl-loyalty/points-balance.tsx (Layout Transaction) screen.

Frontend:

Expand
titleCreate a Feature Flag

Name suggestion: display-points-balance
Local: Intl Tech - Platform
Type: Temporary

...

Expand
titleImprove Loyalty Transactions Screen

File: src/components/intl-loyalty/points-balance.tsx
Changes:

  • Label “Balance“ to “Points Balance“

  • Label “Total“ to “Total transaction points“

  • Add “ - “ before “Points used”

    • Add “-“ only in numbers greater than 0'

      • points used: 0

      • points used: -123

  • Add field “Initial points balance“

    • Calculate value: totalPoints - pointsEarned - poinstUsed

  • Add field “Final points balance“

  • Add “bonusPoints” on “pointsEarned”

image-20240821-173423.pngImage Added
Expand
titleImprove Recent Orders Screen

File: src/components/customer-orders/order-timeline-item.tsx
Changes:

  • Change from Line to Collapsible item - Points Balance

  • Label “Points“ to “Points Balance“

  • Label “Awarded“ to “Earned“

  • Label “Redeemed“ to “Used“

  • Add field “Initial points balance“

    • use transaction?.loyaltyTransaction?.pointsBalance

  • Add field “Points earned“

  • Add field “Poinst used“

    • Add “-“ only in numbers greater than 0'

      • points used: 0

      • points used: -123

  • Add field “Total transaction Points“

    • pointsEarned - pointsUsed consider bonusPoints as well

  • Add field “Final points balance“

    • transaction?.loyaltyTransaction?.pointsBalance + (pointsEarned - pointsUsed) consider debits as well

image-20240821-173524.pngImage Added

Expand
titleImprove Order Details Screen

File: src/components/points-details-card/index.tsx
Changes:

  • Add field “Initial points balance“

  • Add “ - “ before “Points used”

    • Add “-“ only in numbers greater than 0'

      • points used: 0

      • points used: -123

  • Add filed “Total transaction points“

    • pointsEarned - pointsUsed consider bonusPoints as well

  • Label “Balance“ to “Final points balance“

    • pointsBalance + (pointsEarned - pointsUsed) consider debits as well

image-20240821-173549.pngImage Added

Expand
titleCreate new functions to calculate transactions values

File src/utils/utils.ts

  • function to calculate initial points value

  • function to calculate earn points value (earn + bonus)

  • function to calcutate transaction points value (earn + bonus - used)

  • function to calculate final point value (balancePoints + (pointsEarned - pointsUsed) )

...

Info

Include here any configuration required (Sanity, LaunchDarkly flags, etc.) required to enable the solution.

The information contained in this section is already available and ready. It is provided for reference and awareness in case any changes are needed.

LaunchDarkly

Create and enable a new feature flag: display-points-balance

...

Configuration of Product Loyalty Points Price

We need a product to utilize the points. To add products to a specific restaurant, we need to access the DOP (FZ-Portal).

...

Step

Expected Results

If the FF is enable

Show new fields on the screens:

  • Loyalty Transactions

  • Orders

  • Recent Orders

Existing orders with the status CLAIMED

Show the order with earned values, used values, transactions, initial points, and final points.

In this status, the calculation must change the user's final points.

image-20240821-175950.pngImage Added

Existing orders with the status CONFIRMED

Show the order with earned values, used values, transactions, initial points, and final points.

In this status, the calculation must not change the user's final points.

After complete delivery this status change to CLAIMED or VOID

image-20240821-175634.pngImage Added

Existing orders with the status VOID

Show the order with earned values, used values, transactions, initial points, and final points.

In this status, the calculation must not change the user's final points.

image-20240821-175734.pngImage Added

If the user has 2 or more order with CONFIRMED

Show the order with earned values, used values, transactions, initial points, and final points.

In this status, the calculation must not change the user's final points.

After complete delivery this status change to CLAIMED or VOID

For each order, the initial and final points are the same because confirmed transactions do not accumulate points.

If the user has 2 or more order with CONFIRMED and change to VOID

Show the order with earned values, used values, transactions, initial points, and final points.

In this status, the calculation must not change the user's final points.

The order change to VOID and don’t change the final poins

If the user has 2 or more order with CONFIRMED and change to CLAIMED

Show the order with earned values, used values, transactions, initial points, and final points.

In this status, the calculation must not change the user's final points.

The order change to CLAIMED and change the final poins

If the user has 2 or more order with CONFIRMED and change one to CLAIMED and other to VOID

Show the order with earned values, used values, transactions, initial points, and final points.

In this status, the calculation must not change the user's final points.

Attetion:

If the oldest order is successfully completed (CLAIMED) and the most recent one fails (VOID), the value of the CLAIMED order will impact the final points. However, the VOID order will not impact the points and will retain its initial and final values as outdated, since when an order is marked as VOID, it is not considered.

image-20240820-135926.png

image-20240820-140013.png

...