# Rewardpoints Some "documentation" for these things Edited 2023-10-16 ## Rewardpoints **rewardHistory** Stores receipt data from users spending/earning + location | userId | createdAt | amount | cashback | location | orderId | points | printableReceipt | products | | - | - | - | - | - | - | - | - | - | | String | String | Float | Float | String | String | Float | json | json | **userRewards** Stores users earned points | userId | createdAt | amount | location | locationId | points | validUntil | | - | - | - | - | - | - | - | | String | String | Float | String | String | String | String | (If we use same tables for rewardPoints and giftCards need to add type column to tables) Points received from all purchases **except from buying giftCards**, payment with giftcard adds points **NOTE 23.10.2023** - added paymentList ### Response to POS after QR code query ``` { "customerId": "6666", "discountList": [ { "posDiscountId": "afe998ca-293b-4521-9803-0e9aaa7f6deb", "discountId": "1200_REWARD-CODE" }, "paymentList": [ { "posTenderId": "6729a2f7-dac3-4ef9-ab11-66c082177747", "paymentId": "REWARDPOINTS", "posDiscountId": "afe998ca-293b-4521-9803-0e9aaa7f6deb" } ], ] } ``` ### Data on receipt after usage from POS POS can't put used rewardpoints so need to be stripped from "couponId"... couponId format for rewards: POINTVALUE + "_some-unique-id" ``` ReceiptData { ... "receipt": { ... "customer": { "id": "00a22e55-7cfe-4291-94e6-445b7ab19120", "name": "Asiakas tunnistettu", "ident": "5eca8060-58ad-11ee-a8da-27114ad5d941", "couponId": "1200_REWARD-CODE" }, ... } ... } ``` ---