PUT a restaurant
Important: tried to add more items later and noticed that we have some delays in this sync where the items take a lot of time to be shown in the menu (at least 20 minutes in my tests)
Method: PUT
Url: https://{{awsRegion}}-{{env}}-{{brand}}-partners-admin.rbictg.com/api/v1/admin/restaurants
Example: https://euw3-dev-plk-partners-admin.rbictg.com/api/v1/admin/restaurants
Authorization:
Token: partners api secret (dynamodb)
Header:
key: x-ui-region
value: ES
Body:
{ "address": { "address1": "Calle de Bravo Murillo 100, 28850", "address2": "", "city": "Madrid", "country": "Spain", "postalCode": "28020", "stateProvince": "", "stateProvinceShort": "" }, "coordinates": { "latitude": 40.447520, "longitude": -3.703660 }, "menuItems": [{"plu":"940270","price": 2500}], "restaurantName": "CIT Shop Rapha", "storeId": "7788", "timezone": "Europe/Madrid" }
Generate an integrationId and a partnerId
yarn install
/wiki/spaces/CA/pages/3278241911:
aws-vault exec rbi.dev.admin
unset AWS_VAULT
aws-vault exec rbi.dev.admin --no-session
yarn generate:jwt
Important: pay attation to the first configuration about awsRegion. Fill this before press enter
$ ts-node ./scripts/generate-jwt.ts prompt: awsRegion: (eu-central-1) (node:21731) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023. Please migrate your code to use AWS SDK for JavaScript (v3). For more information, check the migration guide at https://a.co/7PzMCcy (Use `node --trace-warnings ...` to show where the warning was created) eu-west-3 prompt: stage: (dev) prompt: brand: (PLK) prompt: 2-letter region code: ES prompt: Partner name (will be used as JWT sub claim): shoprapha prompt: Usage plan (basic or premium): (basic) prompt: API Key (leave blank to auto generate): prompt: Integration Id (leave blank to auto generate): prompt: Partner Id (leave blank to auto generate): Input received: ┌───────────────┬────────────────────────────────────────┐ │ (index) │ Values │ ├───────────────┼────────────────────────────────────────┤ │ awsRegion │ 'eu-west-3' │ │ stage │ 'dev' │ │ brand │ 'PLK' │ │ region │ 'ES' │ │ sub │ 'shoprapha' │ │ usagePlan │ 'basic' │ │ apiKey │ '' │ │ integrationId │ 'dd58dca8-abca-4722-9893-e39dbde8f8f1' │ │ partnerId │ 'db5c3402-50e1-433a-876b-c10ddc439e8f' │ └───────────────┴────────────────────────────────────────┘ ===API Gateway: Found=== { id: 'x4rki34mgd', name: 'dev-plk-partners-api-apigw', description: 'REST API Gateway for Partners API', createdDate: 2022-05-10T12:47:01.000Z, binaryMediaTypes: [ '*/*' ], apiKeySource: 'AUTHORIZER', endpointConfiguration: { types: [ 'REGIONAL' ] }, tags: { app: 'partners-api', brand: 'plk', env: 'dev', 'rbi:brand': 'plk', 'rbi:service': 'partners-api', 'rbi:source': 'terraform', 'rbi:stage': 'dev', service: 'partners-api', stage: 'dev', version: 'ca8dbd0e' }, disableExecuteApiEndpoint: false } ===API Key: Created=== { id: 'jemf6c7rc8', value: 'Kw9EkBW6Yf6KpojDNqZq48FhRRhTe6yp7R1ygqD7', name: 'dev-plk-partners-api-shoprapha', description: 'shoprapha|db5c3402-50e1-433a-876b-c10ddc439e8f|dd58dca8-abca-4722-9893-e39dbde8f8f1', enabled: true, createdDate: 2023-09-13T15:25:51.000Z, lastUpdatedDate: 2023-09-13T15:25:51.000Z, stageKeys: [] } ===Usage Plan: Found=== { id: '70m16n', name: 'dev-plk-partners-api-basic-usage-plan', description: 'Basic usage plan', apiStages: [ { apiId: 'x4rki34mgd', stage: 'dev' } ], throttle: { burstLimit: 5, rateLimit: 500 }, quota: { limit: 20000, offset: 0, period: 'DAY' } } ===Usage Plan Key: Created=== { id: 'jemf6c7rc8', type: 'API_KEY', value: 'Kw9EkBW6Yf6KpojDNqZq48FhRRhTe6yp7R1ygqD7', name: 'dev-plk-partners-api-shoprapha' } ===API Gateway Deployment: Created=== { id: 'd7167p', createdDate: 2023-09-13T15:25:54.000Z } ===JWT Payload=== { iat: 1694618755, sub: 'shoprapha', brand: 'PLK', partnerId: 'db5c3402-50e1-433a-876b-c10ddc439e8f', integrationId: 'dd58dca8-abca-4722-9893-e39dbde8f8f1', apiKey: 'Kw9EkBW6Yf6KpojDNqZq48FhRRhTe6yp7R1ygqD7', region: 'ES' } ===JWT=== eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2OTQ2MTg3NTUsInN1YiI6InNob3ByYXBoYSIsImJyYW5kIjoiUExLIiwicGFydG5lcklkIjoiZGI1YzM0MDItNTBlMS00MzNhLTg3NmItYzEwZGRjNDM5ZThmIiwiaW50ZWdyYXRpb25JZCI6ImRkNThkY2E4LWFiY2EtNDcyMi05ODkzLWUzOWRiZGU4ZjhmMSIsImFwaUtleSI6Ikt3OUVrQlc2WWY2S3BvakROcVpxNDhGaFJSaFRlNnlwN1IxeWdxRDciLCJyZWdpb24iOiJFUyJ9.NczhVp1vBoWwDt7FM9DQMKVo18ZqSofk9efxooKq5Hw
Create Integration
Method: POST
Url: https://{{awsRegion}}-{{env}}-{{brand}}-partners-admin.rbictg.com/api/v1/admin/integrations
Example: https://euw3-dev-plk-partners-admin.rbictg.com/api/v1/admin/integrations
Authorization:
Token: partners api secret (dynamodb)
Example:
Header:
key: x-ui-region
value: ES
Body:
{ "brand": "PLK", "country": "ES", "storeIds": ["7788"], "integrationId": "dd58dca8-abca-4722-9893-e39dbde8f8f1", "partnerId": "db5c3402-50e1-433a-876b-c10ddc439e8f" }
Note that the storeIds were inputted above, but later, you’ll that this association really didn’t work. According to the swagger, it could work using an object like
{ "secret": "819759eedea160697759890eb5d9aeb9", "stores": [ { "country": "ES", "storeId": "7788" } ] }
Alternatively, you can update your integration as you can see in the following steps.
Validate the integration
Method: GET
Url: https://{{awsRegion}}-{{env}}-{{brand}}-partners-admin.rbictg.com/api/v1/admin/integrations/{integrationId}
Authorization:
Token: partners api secret (dynamodb)
Example:
Header:
key: x-ui-region
value: ES
Body: N/A
Note: See the missing stores.
Update your integration to include your restaurant
Method: PUT
Url: https://{{awsRegion}}-{{env}}-{{brand}}-partners-admin.rbictg.com/api/v1/admin/integrations/{integrationId}
Authorization:
Token: partners api secret (dynamodb)
Example:
Header:
key: x-ui-region
value: ES
Body:
{ "secret": "819759eedea160697759890eb5d9aeb9", "stores": [ { "country": "ES", "storeId": "7788" } ] }
Find the restaurant in the app
Note that only the Menu Items that you configured for the restaurant will be available:
The following cart page will only be available if the restaurant webhooks are well configured
Created restaurants
BK ES → In the moment I’m writing this we can’t reach the success page
Metro Sol, C. de Esparteros, 3, 28012 Madrid, Spain
BK PT → In the moment I’m writing this we can reach the success page
R. Maria Amália Vaz de Carvalho 47, 1700-333 Lisboa, Portugal
PLK ES → In the moment I’m writing this we can reach the success page
C. de Eduardo Torroja, 28914 Leganés, Madrid, Spain
Add Comment