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 2 Next »

This document lists all the graphql endpoints will be used in BK ES Loyalty migration Phase 1 and Phase 2.

Authentication

Different authentication <token> will be provided for test(staging) and production(prod) enviroments, and the authentication is also vendor specific.

And the Bearer Authentication is utilized in our system, when calling the endpoints, the authorization attribute needs to be added in the headers, with the value as Bearer <token>, the <token> is shared offline.

(blue star) For security purpose, all the calls to our graphQL endpoints should NOT be directly from the frontend, please integrate the calls into existing/new-created backend APIs.

Endpoints

The base URL is also environment specific, it’s https://euw3-<env>-bk-loyalty-middleware.rbictg.com/loyalty, for example,

the test base URL is:

https://euw3-staging-bk-loyalty-middleware.rbictg.com/loyalty

the production base URL is:

https://euw3-prod-bk-loyalty-middleware.rbictg.com/loyalty

Get RBI Loyalty User

Desc: This endpoint is used to get the details of a RBI Loyalty user, includes the information like RBI Loyalty Id, user email, Loyalty points and Loyalty tier.

URL: /user/{id} (id is the user’s RBI Loyalty Id)

Method: GET

Example response:

{
  "createdAt": "string",
  "id": "string", // RBI Loyalty Id
  "name": "string",
  "updatedAt": "string",
  "clientUserId": "string",
  "dateOfBirth": "string",
  "email": "string", // user email
  "emailVerified": true,
  "expirationBuckets": [
    {
      "expirationDate": "string",
      "pointsToExpire": 0
    }
  ],
  "loyaltyTier": {
    "loyaltyTierExpiryDate": "string",
    "loyaltyTierKey": "Tier_1", // Loyalty Tier, can be Tier_1 and Tier_2
    "pointsEarnedInTimeConstraint": 0,
    "startAt": "string"
  },
  "metadata": {
    "additionalProp1": "string",
    "additionalProp2": "string",
    "additionalProp3": "string"
  },
  "offerRedemptionAvailability": {
    "availableAfter": "string",
    "transactionId": "string"
  },
  "phoneNumber": "string",
  "phoneVerified": true,
  "points": 0, // Loyalty points
  "pointsEarningDisabled": true,
  "pointsExpiryDateKey": "string"
}

[APP] Create RBI Loyalty Transaction - Airtouch

Desc: This endpoint is used to submit a transaction to RBI Loyalty platform for both Web and Mobile App. The payload needs to include the information, like RBI user Id, RBI Loyalty Id, items information, store id

(blue star) If we don’t need to store the order items information, we can keep cartEntries as a empty list, the important part is payments, which we are using to calculate the Loyalty points, amount is the paid amount in cent unit, e.g. if we need to calculate the Loyalty points based on $8.99, the amount should be 899.

URL: /transaction

Method: POST

Without Reward

Payload:

{
  "cartEntries": [],
  "channel": "APP", // WEB, APP
  "cognitoId": "{{testRbiUserId}}", // RBI user Id
  "currency": "EUR", // currency
  "email": "{{testUserEmail}}", // user email
  "fulfillment": {"type": "DELIVERY"}, // DELIVERY, DRIVE_THRU, EAT_IN, TAKEOUT, N/A
  "loyaltyId": "{{testLoyaltyId}}",
  "orderId": {
    "id": "test-transaction-id", // the same as posVendor-transactionId
    "type": "AIRTOUCH" // the same as posVendor-type
  },
  "payments": [{
    "amount": 100, // in cent unit
    "type": "VISA" // VISA, AMEX, CASH, OTHER
  }],
  "posVendor": {
    "transactionId": "test-transaction-id", // can be a unique id to indicate the order
    "type": "AIRTOUCH"
  },
  "promotions": [], // rewards can be added
  "serviceMode": "DELIVERY" // DELIVERY, DRIVE_THRU, EAT_IN, TAKEOUT, N/A
}

With Reward

Payload:

{
  "cartEntries": [],
  "channel": "APP", // WEB, APP
  "cognitoId": "{{testRbiUserId}}", // RBI user Id
  "currency": "EUR", // currency
  "email": "{{testUserEmail}}", // user email
  "fulfillment": {"type": "DELIVERY"}, // DELIVERY, DRIVE_THRU, EAT_IN, TAKEOUT, N/A
  "loyaltyId": "{{testLoyaltyId}}",
  "orderId": {
    "id": "test-transaction-id", // the same as posVendor-transactionId
    "type": "AIRTOUCH" // the same as posVendor-type
  },
  "payments": [{
    "amount": 100, // in cent unit
    "type": "VISA" // VISA, AMEX, CASH, OTHER
  }],
  "posVendor": {
    "transactionId": "test-transaction-id", // a unique id to indicate the order
    "type": "AIRTOUCH"
  },
  "promotions": [
    {
      "id": "{{testRewardLoyaltyId}}", // the RBI Loyalty engine id of a Reward
      "name": "test-reward-id", // get from Sanity
      "type": "REWARD"
    }
  ], // rewards can be added
  "serviceMode": "DELIVERY" // DELIVERY, DRIVE_THRU, EAT_IN, TAKEOUT, N/A
}

[WEB] Create RBI Loyalty Transaction - Homeria

Desc: This endpoint is used to submit a transaction to RBI Loyalty platform for both Web and Mobile App. The payload needs to include the information, like RBI user Id, RBI Loyalty Id, items information, store id

URL: /transaction

Method: POST

Without Reward

Payload:

{
  "cartEntries": [],
  "channel": "WEB", // WEB, APP
  "cognitoId": "{{testRbiUserId}}", // RBI user Id
  "currency": "EUR", // currency
  "email": "{{testUserEmail}}", // user email
  "fulfillment": {"type": "DELIVERY"}, // DELIVERY, DRIVE_THRU, EAT_IN, TAKEOUT, N/A
  "loyaltyId": "{{testLoyaltyId}}",
  "orderId": {
    "id": "test-transaction-id", // the same as posVendor-transactionId
    "type": "HOMERIA" // the same as posVendor-type
  },
  "payments": [{
    "amount": 100, // in cent unit
    "type": "VISA" // VISA, AMEX, CASH, OTHER
  }],
  "posVendor": {
    "transactionId": "test-transaction-id", // can be a unique id to indicate the order
    "type": "HOMERIA"
  },
  "promotions": [], // rewards can be added
  "serviceMode": "DELIVERY" // DELIVERY, DRIVE_THRU, EAT_IN, TAKEOUT, N/A
}

With Reward

Payload:

{
  "cartEntries": [],
  "channel": "WEB", // WEB, APP
  "cognitoId": "{{testRbiUserId}}", // RBI user Id
  "currency": "EUR", // currency
  "email": "{{testUserEmail}}", // user email
  "fulfillment": {"type": "DELIVERY"}, // DELIVERY, DRIVE_THRU, EAT_IN, TAKEOUT, N/A
  "loyaltyId": "{{testLoyaltyId}}",
  "orderId": {
    "id": "test-transaction-id", // the same as posVendor-transactionId
    "type": "HOMERIA" // the same as posVendor-type
  },
  "payments": [{
    "amount": 100, // in cent unit
    "type": "VISA" // VISA, AMEX, CASH, OTHER
  }],
  "posVendor": {
    "transactionId": "test-transaction-id", // can be a unique id to indicate the order
    "type": "HOMERIA"
  },
  "promotions": [
    {
      "id": "{{testRewardLoyaltyId}}", // the RBI Loyalty engine id of a Reward
      "name": "test-reward-name", // get from Sanity
      "type": "REWARD"
    }
  ], // rewards can be added
  "serviceMode": "DELIVERY" // DELIVERY, DRIVE_THRU, EAT_IN, TAKEOUT, N/A
}

[WEB/APP] Create OTP

Desc: This endpoint is used to submit a transaction to RBI Loyalty platform for both Web and Mobile App. The payload needs to include the information, like RBI user Id, RBI Loyalty Id, items information, store id

URL: /otp

Method: POST

Without Reward

Payload:

{
  "loyaltyId": "string", // RBI Loyalty Id
  "order": [], // Rewards can be added
  "restaurantId": "string", // restaurant id
  "userDateTime": "string" // user time in the format like "2024-01-01 12:12:12"
}

With Reward

Payload:

{
  "loyaltyId": "string", // RBI Loyalty Id
  "order": [
    {
      "incentive": {
        "id": "{{testRewardLoyaltyId}}", // Reward RBI Loyalty Engine Id, get from Sanity
        "type": "REWARD"
      },
      "quantity": 1,
      "referenceId": "1",
      "productId": "{{testRewardSanityId}}", // Reward Sanity Id, get from Sanity
      "vendorConfigs": { // get from Sanity
        "_type": "vendorConfigs",
        "tablet": {
          "_type": "vendorConfig",
          "constantPlu": "4444",
          "pluType": "constantPlu"
        }
      }
    }
  ], // Rewards can be added
  "restaurantId": "string", // restaurant id
  "userDateTime": "string" // user time in the format like "2024-01-01 12:12:12"
}

Example response:

"test-otp" // the created OTP

[WEB/APP] Get OTP

Desc: This endpoint is used to get the order selection connected with the OTP, to check if the OTP is identified in store.

URL: /otp/{otp} (otp is the OTP needs to be used)

Method: GET

Example response:

{
  "updatedAt": "string",
  "createdAt": "string",
  "loyaltyId": "string", // RBI Loyalty Id
  "expiry": 300, // Original setting: after how many seconds, the OTP will be expired, not real-time
  "order": [],
  "otp": "string",
  "restaurantId": "string",
  "status": "claimed", // claimed or pending, used to indicate if the OTP is identified in store
  "transactionId": "string", // RBI Loyalty Transaction Id
  "userDateTime": "string" // // user time in the format like "2024-01-01 12:12:12"
}

[In-Store] Identify RBI Loyalty User

Desc: This endpoint is used to identify a RBI Loyalty User when the user wants to place in-store orders, in this case, we can use the OTP created in last step as the identifier.

(blue star) After the user is identified, a RBI Loyalty Transaction is created on RBI side, which will be updated during the order process, this is also why we cannot just use the Get RBI Loyalty User endpoint here.

URL: /identify

Method: POST

Payload:

{
  "identifier": "test-otp",
  "posVendor": {
    "operator": "300",
    "posType": "Winrest", // or "Tillster"
    "supportingPos": "Partner",
    "storeId": "9999",
    "terminal": "0",
    "transactionId": "000000000257"
  }
}

Example response:

{
  "balances": [
    {
      "amount": 14464,
      "currency": "points"
    }
  ],
  "loyaltyUser": {
    "created": "2021-08-10T12:18:39.180Z",
    "id": "rbi-loyalty-id",
    "name": "Farhan"
  },
  "order": [ // Reward information can be included
    {
      "productType": "REWARD",
      "quantity": 1,
      "referenceId": "00",
      "price": 0,
      "incentiveId": "bba6a12d-fe78-468a-a394-d817652442d4", // Reward Sanity Id
      "loyaltyEngineId": "bdgdgd-fe78-468a-4545-d817dfrd442d4" // Reward RBI Loyalty Engine Id
  }
  ],
  "transactionId": "f4190848-169d-4c69-9f53-f916318c432b" // this transactionId needs to be used in following Transaction update
}

[In-Store] Update RBI Loyalty Transaction

Refer to /wiki/spaces/EGMT/pages/4138467580

  • No labels