# Giftcards
Some "documentation" for these things
Edited 2023-10-16
## GiftCards
Uses mostly the same logic as RewardPoints (userRewards + rewardHistory)
**Needs extra table "giftCards"**
| redeemCode | amount | location | used | createdAt | validUntil |
| - | - | - | - | - | - |
| String | Float | String | boolean | String | String |
* validUntil = createdAt + 12months
Needs new endPoint for redeeming giftCard
Release 1:
giftCards table needs to have 2000 10e giftcards with unique redeemCodes (xmas presents for company nnnn)
### Redeem giftCard
1. User inputs redeemCode to App
2. BE validates code
3. if valid, sign giftcard to user and copy to userRewards with userId
4. track giftcard usage in rewardHistory
Future release:
Possibility to buy giftcard > BE adds rows to giftCard table for people to redeem
---
### Response to POS after QR code query
Send full sum of users available giftCardPoints
**Notes: 2023-10-16**
- need confirmation for posTenderId and paymentId
```
{
"customerId": "6666",
"paymentList": [
{
"posTenderId": "def82112-3726-45b4-b3cb-b4b12f86d69c",
"paymentId": "GIFTCARD",
"amount": 1200,
"allowOverTendering": false,
"allowUnderTendering": true
}
]
}
```
---
### Data on receipt after usage from POS
Can have multiple payment methods "tenderLines"
Example receipt:
10e used with giftcard "LAHJAKORTTI, MUUT"
2,70e used with card/cash "MAKSUPÄÄTE"
**Notes: 2023-10-16**
- need confirmation for tenderId and tenderName
```
ReceiptData
{
...
"receipt": {
...
"customer": {
"id": "00a22e55-7cfe-4291-94e6-445b7ab19120",
"name": "Asiakas tunnistettu",
"ident": "5eca8060-58ad-11ee-a8da-27114ad5d941",
},
...
"tenderLines": [
{
"id": "1",
"qty": 1,
"total": 1000,
"amount": 1000,
"tenderId": "0bf4e50d-57e9-4fb0-b89c-118691e7f478",
"overTender": 0,
"tenderGuid": "0bf4e50d-57e9-4fb0-b89c-118691e7f478",
"tenderName": "LAHJAKORTTI, MUUT",
"tenderType": "TENDER"
},
{
"id": "2",
"qty": 1,
"total": 270,
"amount": 270,
"tenderId": "02c45dda-4214-4b99-b832-ca70d395875c",
"overTender": 0,
"tenderGuid": "02c45dda-4214-4b99-b832-ca70d395875c",
"tenderName": "MAKSUPÄÄTE",
"tenderType": "TENDER"
}
],
}
...
}
```
---