기능(Feature) #484
Updated by Dante Le 9 months ago
Validate coupon and return coupon information
Consider applying cache to avoid multiple users using the same coupon at the same time
*[Tech note]*
- Create new api to validate and return coupon info
- Valid Coupon:
+ Check expired time
+ Min booking's amount
+ 1 time/day (except booking cancel)
*[API info]*
*- Endpoint:* - Endpoint: /booking/hotel/hana/get-coupon
*- Request:* - Request:
<pre><code class="javascript">
{
"condition": {
"couponItemCode": "HANA_COUPON_ABCDEF",
"affiliateUserNo": "1bb0df1854a1802687c5cbf2752dda7e-45asdasd",
"bookingAmount": 2122144
},
"stationTypeCode": "STN01",
"currency": "KRW",
"country": "KR",
"language": "KO"
}
</code></pre>
*- Response:* - Response:
<pre><code class="javascript">
{
"result": {
"couponAmount": null,
"isValid": false,
"invalidCode": "COUPON_I01"
},
"serviceCode": "/booking/hotel/hana/get-coupon",
"transactionSetId": "BC2B57D9894C460C830F8E9677FEC599",
"succeedYn": true,
"serviceName": "/booking/hotel/hana/get-coupon"
}
</code></pre>
*- CUrl:*
<pre><code class="c">
curl --location 'http://localhost:8080/booking/hotel/hana/get-coupon' \
--header 'accept: application/json, text/plain, */*' \
--header 'accept-language: en-US,en;q=0.9,vi;q=0.8' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--header 'origin: https://www.ohmytrip.com' \
--header 'pragma: no-cache' \
--header 'priority: u=1, i' \
--header 'referer: https://www.ohmytrip.com/' \
--header 'sec-ch-ua: "Chromium";v="136", "Google Chrome";v="136", "Not.A/Brand";v="99"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "Windows"' \
--header 'sec-fetch-dest: empty' \
--header 'sec-fetch-mode: cors' \
--header 'sec-fetch-site: same-site' \
--header 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36' \
--data '{
"condition": {
"couponItemCode": "HANA_COUPON_ABCDEF",
"affiliateUserNo": "1bb0df1854a1802687c5cbf2752dda7e-45asdasd",
"bookingAmount": 2122144
},
"stationTypeCode": "STN01",
"currency": "KRW",
"country": "KR",
"language": "KO"
}'
</code></pre>