Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 26 Next »

Acceptance Criteria

  • For use QRCode, need to active:

    • At least one service mode;

    • Add duration for show QRCode in home and recent order screen;

    • At least one Store;

    • At least one product of type item;

  • Reviewed by Paula Winter
  • Reviewed by Felipe Gonçalves
  • Reviewed by Raphael Gomes

Repos that we’ll change

intl-whitelabel-app: https://github.com/rbilabs/intl-whitelabel-app

intl-whitlabel-cms: https://github.com/rbilabs/intl-whitelabel-cms

intl-whitlabel-graphql: https://github.com/rbilabs/intl-whitelabel-graphql

Solution proposal

When the system completes the purchase successfully, it will validate if any of the purchased products provide a drink refill, this validation will occur through information contained in Sanity.

Sanity will return a list of stores and products that provide the drink refill, the whitelabel-app will go through this information from Sanity, validating if it has a product that is compatible, if so, it will send some information to the “GraphQL” backend .

In the backend we will get the information, and we will get the secrets from DynamoDB, this secrets is a key to generate an MD5 and with that we will generate a hash with MD5 encryption, and this hash will be returned to the whitelabel-app to use as QRCode.

Task summary

Intl Whitelabel CMS:

  • Task 1 - Add new Fields for add Stores and Items

Intl Whitelabel GraphQL:

  • Task 1 - Create new function GetRefillDrinkQRCode for generate hash

 

Intl Whitelabel App:

  • Task 1 - Update GraphQL Query to get new data (validate cache)

  • Task 2 - Validate if purchased products have a refill

  • Task 3 - Create a new request for backend “intl-whitelabel-graphql” - GetRefillDrinkQRCode (Request GraphQL implementation)

  • Task 4 - Get and use QRCode of GetRefillDrinkQRCode (Request GraphQL implementation)

Tasks breakdown

Intl Whitelabel CMS

Task 1 - Add new Fields for add Stores and Items

  • Add this new objects in the document of QRCode refill schemas/features/documents/refill-drinks-qrcode.tsx

  • About List of Stores we can use the object src/schemas/menu/documents/restaurant-group.ts of shared schema, we need just to add the code of restaurants in our code of QRCode.

  • About the Items List, we can add the same idea of items free, but the component need to have just items, don’t have combo or menu.

  • In Figma this activity don’t finished yet, but the main idea is it:

DOD-LIKE

  • Show Restaurant List with validate have one.

  • Show Items List with validate have one.

    • Just add items of “item” type

  • Validate messages and layout with designers

Intl Whitelabel GraphQL

Task 1 - Create new function GetRefillDrinkQRCode for generate hash (Request Whitelabel implementation)

  • Add secrets in DynamoDB

  • Create a new provider into directory src/functions/graphql/providers/ RefillDrinkQRCodeProvider;

    • Create a request for get secrets of MD5

    • In this provider, we need to create a hash, this code is an example of how to create the logic for it.

    • Run graphql:types

  • Create a new function for generated hash with MD5, but we need to get the key of cryptography of MD5;

  • Create a new resolver into directory src/functions/graphql/resolvers/;

  • Create new types, interface, etc;

You can be based in the PR https://github.com/rbilabs/intl-whitelabel-app/pull/296/files#diff-a88f2462d7ab31319f2455bbd95c349d30a54980e31ee54277a804ac3acd8e62

DOD-LIKE

  • Create unit test

  • Call by postman with success

  • Generate a valid hash code

Intl Whitelabel App

Task 1 - Update GraphQL Query to get new data

Add new objects stores and items in src/queries/sanity/feature-qr-code-refill-drinks.graphql query

DOD-LIKE

  • Codegen should not be broken and apollo:generate command should work without problem after add the new GraphQL files

Task 2 - Update hook for get new objects of sanity (validate cache)

Update src/hooks/use-feature-qrcode-refill-drinks/use-feature-qrcode-refill-drinks.ts hook for get stores and items of sanity.

Add this new data in cache.

DOD-LIKE

  • Get data with success;

  • Create or adjust unit tests for this flow;

  • Create cache with success

Task 3 - Validate if purchased products have a refill for this store

Validate if the items purchased have a refill drink and if this store gives a refill drink.

When finish the order, the system needs to get information of sanity about items, stores, duration, service modes available to create and display QRCode. So at this moment we need to create a new logic for iterate these items, similar items free.

This new logic can be created in the hook src/hooks/use-feature-qrcode-refill-drinks/use-feature-qrcode-refill-drinks.ts

DOD-LIKE

  • Validate if items purchased have can generate a QRCode

    • have a store;

    • have an item available;

    • have a service mode;

  • Create a unit tests

Task 3 - Create a new request for backend “intl-whitelabel-graphql” - GetRefillDrinkQRCode (Request GraphQL implementation)

We need to create new request for back-end, case the system have an item purchased available for get a refill drink, so we must call the back-end to generate a QRCode.

The new request can call of GetRefillDrinkQRCode

  • Create a new query in src/queries/rbi/ with parameters storeId, transactionId, transactionDatetime.

  • And the return must be a hash for the QRCode

  • These parameters we can get of getOrder response.

  • Run apollo:generate

  • Create a function GetRefillDrinkQRCode in the hook of refill drink and use the new query of GraphQL

DOD-LIKE

  • create unit test

Task 4 - Get and use QRCode of GetRefillDrinkQRCode (Request GraphQL implementation)

Get the response of GetRefillDrinkQRCode and return hash, use this hash in our application for transform in QRCode.

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.