Coupon API - ahoo-studio/queq-doc GitHub Wiki

4. Coupon

[X] 4.1 Get coupon

GET /api/v2/coupon/list

Description:

ดึงข้อมูลรายการคูปอง

Query parameters:

Field Description Optional Default
lat ค่าละติจูด Yes true
long ค่าลองจิจูด Yes true
distance ระยะทางที่ใกล้ที่สุด Yes true
indoorKey mapIndoorFloorKey Yes
mallId id ของห้างนั้น Yes
partnerType ค่า Partner Type Yes
isHighlight ไฮไลท์ ชนิดที่ต้องการ Yes true
page หน้าปัจจุบัน Yes 0
limit จำกัดจำนวนต่อหน้า Yes 10

Returns:

{
    "data": {
        "coupon": [
            {
                "_id": "5d19f0224ffb94b97007dba3",
                "diamondInclude": 0,
                "expireDate": "2019-10-21T00:00:00Z",
                "isOutOfStock": false,
                "isReachDateTime": false,
                "itemAssertImageSlot1": "5d1f2472b5106.jpg",
                "itemAssertImageSlot2": "5d1c8cd8e254c.png",
                "itemDetail": {
                    "chi1": "",
                    "chi2": "",
                    "eng": "Congratulations. You get a discount of 20 baht.\r\nPlease click on the picture to get the privilege immediately.\r\n\r\nTerms of use of coupons\r\n1. 20 baht discount for buying regular price drinks\r\n2. One coupon per 1 Person\r\n3. Please give coupons to employees before ordering\r\n4. Only available at branches participating in the Black Canyon 4 branches\r\nMBK Center, 7th Floor / Platinum Fashion Mall, 3rd Floor / Novotel Bangkok Platinum, 5th Floor / BTS National Stadium\r\n5. Cannot be used in conjunction with other promotions or discount cards\r\n6. Coupon valid until 31 October 2019 (limited for 800 privileges)",
                    "thai": "ยินดีด้วย คุณได้รับสิทธิ์ ส่วนลด 20 บาท \r\nกรุณาคลิกที่รูปเพื่อรับสิทธิ์ทันที\r\n\r\nเงื่อนไขการใช้คูปอง\r\n1.ส่วนลด 20 บาท สำหรับซื้อเครื่องดื่มราคาปกติ \r\n2.คูปอง 1 ใบ ต่อ 1 ที่ \r\n3.โปรดมอบคูปองให้พนักงานก่อนสั่ง \r\n4.ใช้ได้เฉพาะสาขาที่ร่วมรายการ ได้แก่ Black Canyon สาขา มาบุญครอง ชั้น7 / แพลทตินัมแฟชั่นมอลล์ชั้น 3 และ ชั้น 5 / BTS สนามกีฬาแห่งชาติ \r\n5.ไม่สามารถใช้ร่วมกับรายการส่งเสริมการขายหรือบัตรส่วนลดอื่นๆ ได้\r\n6.ระยะเวลาใช้สิทธิ์ 6 ก.ค. 62 - 31 ต.ค. 62 จำกัด 800 สิทธิ์ (หรือจนกว่าสิทธิ์จะหมด)"
                },
                "itemName": {
                    "chi1": "",
                    "chi2": "",
                    "eng": "20 Baht Discount for Drinks in BLACK CANYON store.",
                    "thai": "ส่วนลด 20 บาท เมนูเครื่องดื่ม BLACK CANYON"
                },
                "nameReport": "ส่วนลด 20 บาท เมนูเครื่องดื่ม BLACK CANYON",
                "shop": {
                    "shopName": {
                        "chi1": "TANKstore",
                        "chi2": "TANKstore",
                        "eng": "TANKstore",
                        "thai": "TANKstore (แท้งค์ สโตร์)"
                    }
                }
            },
            {
                "_id": "5d5d0ef14ffb94a1b22f8322",
                "diamondInclude": 0,
                "expireDate": "2019-12-31T00:00:00Z",
                "isOutOfStock": false,
                "isReachDateTime": true,
                "itemAssertImageSlot1": "5d5d0ef19d17f.png",
                "itemAssertImageSlot2": "5d5d0ef1c0a67.jpg",
                "itemDetail": {
                    "chi1": "Terms of use of coupons\r\n1. Please use this coupon to employees before ordering food\r\n2. Discount 20% for regular food price\r\n3. E-voucher is used for 1 ordering / bill (cannot separate the bill)\r\n4. Only available at participating branches at MBK Center, Central World, Fashion Island, Cosmo Bazaar, Terminal 21 Pattaya and Century The Movie Plaza Sukhumvit\r\n5. Cannot be used in conjunction with other promotions or discount cards\r\n6. XOHO reserves the right to change without announcement\r\n7. Coupon valid until 31 December 2019",
                    "chi2": "Terms of use of coupons\r\n1. Please use this coupon to employees before ordering food\r\n2. Discount 20% for regular food price\r\n3. E-voucher is used for 1 ordering / bill (cannot separate the bill)\r\n4. Only available at participating branches at MBK Center, Central World, Fashion Island, Cosmo Bazaar, Terminal 21 Pattaya and Century The Movie Plaza Sukhumvit\r\n5. Cannot be used in conjunction with other promotions or discount cards\r\n6. XOHO reserves the right to change without announcement\r\n7. Coupon valid until 31 December 2019",
                    "eng": "Terms of use of coupons\r\n1. Please use this coupon to employees before ordering food\r\n2. Discount 20% for regular food price\r\n3. E-voucher is used for 1 ordering / bill (cannot separate the bill)\r\n4. Only available at participating branches at MBK Center, Central World, Fashion Island, Cosmo Bazaar, Terminal 21 Pattaya and Century The Movie Plaza Sukhumvit\r\n5. Cannot be used in conjunction with other promotions or discount cards\r\n6. XOHO reserves the right to change without announcement\r\n7. Coupon valid until 31 December 2019",
                    "thai": "เงื่อนไขการใช้คูปอง\r\n1. กรุณาแสดง E-Voucher นี้ก่อนรับประทานอาหาร\r\n2. E-Voucher นี้สามารถใช้แทนเป็นส่วนลดเฉพาะค่าอาหาร 20% \r\n3. E-Voucher   นี้สามารถใช้ได้สำหรับ 1 โต๊ะอาหาร/บิลเท่านั้น (ไม่สามารถแยกบิลได้)\r\n4. บัตรนี้สำหรับใช้ทานอาหารร้าน XOHO ที่สาขา MBK Center, Central World, Fashion Island, Cosmo Bazaar, Terminal 21 Pattaya และ เซ็นจูรี่ เดอะมูฟวี่ พลาซ่า สาขาสุขุมวิท \r\n5. E-Voucher นี้ไม่สามารถร่วมกับโปรโมชั่นอื่นๆ ได้\r\n6. ขอสงวนสิทธิ์ในการเปลี่ยนแปลงเงื่อนไขโดยไม่ต้องแจ้งให้ทราบล่วงหน้า\r\n7. ใช้ได้ถึง วันที่ 31 ธันวาคม 2562 เท่านั้น"
                },
                "itemName": {
                    "chi1": "Discount 15% food price at XOHO",
                    "chi2": "Discount 15% food price at XOHO",
                    "eng": "Discount 20% food price at XOHO",
                    "thai": "ส่วนลดค่าอาหาร 20% ที่ XOHO"
                },
                "nameReport": "ส่วนลดค่าอาหาร 20% ที่ XOHO",
                "shop": {
                    "shopName": {
                        "chi1": "DoiTung",
                        "chi2": "DoiTung",
                        "eng": "DoiTung",
                        "thai": "DoiTung"
                    }
                }
            }
        ],
        "pageIndex": -1,
        "pageLimit": -1,
        "pages": 1,
        "paging": {
            "next": "",
            "previous": ""
        }
    },
    "isSuccess": true
}

Data Dictionary Item:

Field Type Description Default
_id ObjectId id ของรายการคูปองนั้น Auto Create
created_at Datetime วันที่บันทึกข้อมูล Gmt 0 Auto Create
diamondInclude Int ค่า diamondInclude
expireDate DateTime วันหมดอายุ Gmt 0
isOutOfStock Boolean เป็นจริงต่อเมื่อ diamondInclude มากกว่า 0 IsReachDateTime คูปองยังไม่วันหมดอายุ และ คูปอง Item ยังมีอยู่
isReachDateTime Boolean ใช้คำณวนวันหมดอายุ ถ้าเป็นจริง ส่วนเป็น False ถือว่าไม่หมดอายุ เมื่อดึงข้อมูล
itemAssertImageSlot1 String รูปภาพของไอเท็มรูปที่ 1 จากการอัพโหลด path https://{domain}/media/images/{itemAssertImageSlot1} และ https://{domain}/media/thumbnail/{itemAssertImageSlot1}
itemDetail Object รายละเอียดคำอธิบายของไอเท็ม "itemDetail": {"eng":"","thai":"","chi1":"","chi2":""}
itemName Object ชื่อของไอเท็ม "itemName": {"eng":"","thai":"","chi1":"","chi2":""}
nameReport String คำย่อของไอเท็ม
shop Object ข้อมูลของห้างที่ไอเท็มนั้นจัดรายการอยู่
updated_at Datetime วันที่แก้ไขข้อมูล Auto Update

Data Dictionary Shop:

Field Type Description Default
shopName Object ชื่อของห้างนั้น "shopName": {"eng":"","thai":"","chi1":"","chi2":""}

[X] 4.2 Get coupon detail

GET /api/v2/coupon/detail?id={id}&uniqueId={uniqueId}

Description:

ดึงข้อมูลรายการคูปอง โดยใช้ id และ uniqueId 

Query parameters:

Field Description Optional Default
id id ของคูปอง No
uniqueId uniqueId ของผู้ใช้ Yes

Returns:

{
    "data": {
        "coupon":{
               "_id": "5bf51b1c9dc6d624f7398182",
            "coin": 200,
            "couponCodeCount": 0,
            "couponCodeCountMax": 0,
            "created_at": "2018-11-21T08:45:16Z",
            "diamond": 0,
            "expireDate": "2019-04-20T00:00:00Z",
            "isActive": true,
            "isOutOfStock": true,
            "isReachDateTime": false,
            "isStore": false,
            "itemAssertImageSlot1": "5c5d4117529e6.png",
            "itemAssertImageSlot2": "",
            "itemAssertVersion": 1,
            "itemCategoryId": "5bf51a089dc6d625002f4ce2",
            "itemCondition": {
                "chi1": "",
                "chi2": "",
                "eng": "",
                "thai": ""
            },
            "itemDetail": {
                "chi1": "french fries",
                "chi2": "french fries",
                "eng": "french fries",
                "thai": "เฟรนช์ฟรายส์"
            },
            "itemName": {
                "chi1": "French fries",
                "chi2": "French fries",
                "eng": "French fries",
                "thai": "เฟรนช์ฟรายส์"
            },
            "itemOrder": 0,
            "itemStoreDetail": {
                "chi1": "",
                "chi2": "",
                "eng": "",
                "thai": ""
            },
            "itemStoreName": {
                "chi1": "",
                "chi2": "",
                "eng": "",
                "thai": ""
            },
            "mainTab": [
                "Coin"
            ],
            "nameReport": "French fries",
            "partnerTypeId": [
                "5d9c1fa94ffb949fb23319b2"
            ],
            "shop": {},
            "shops": [],
            "subTab": [
                "Hunger"
            ],
            "updated_at": "2019-06-26T07:36:30Z"
         }
         "couponPlayer": {
            "_id": "5daea7a763998b3a70cbc424",
            "couponDatetime1": "2019-10-22T06:54:32.045Z",
            "couponGiftId": "9999",
            "couponPassword": "XOHO",
            "createAt": "2019-10-22T06:54:32.045Z",
            "isActive": true,
            "itemId": "5bf51b1c9dc6d624f7398182",
            "uniqueId": "adcd"
        }
     }
}

Data Dictionary Item:

Field Type Description Default
_id ObjectId id ของรายการคูปอง Auto
created_at Datetime วันที่บันทึกข้อมูล Auto
diamondInclude Int ค่า diamondInclude
expireDate DateTime วันหมดอายุ
isActive Boolean สถานะการใช้งาน
isOutOfStock Boolean เป็นจริงต่อเมื่อ diamondInclude มากกว่า 0 IsReachDateTime คูปองยังไม่วันหมดอายุ และ คูปอง Item ยังมีอยู่
isReachDateTime Boolean ใช้คำณวนวันหมดอายุ ถ้าเป็นจริง ส่วนเป็น False ถือว่าไม่หมดอายุ เมื่อดึงข้อมูล
itemAssertImageSlot1 String รูปภาพของไอเท็มรูปที่ 1 จากการอัพโหลด path https://{domain}/media/images/{itemAssertImageSlot1} และ https://{domain}/media/thumbnail/{itemAssertImageSlot1}
itemDetail Object รายละเอียดคำอธิบายของไอเท็ม "itemDetail": {"eng":"","thai":"","chi1":"","chi2":""}
itemName Object ชื่อของไอเท็ม "itemName": {"eng":"","thai":"","chi1":"","chi2":""}
itemOrder Int ลำดับไอเท็ม
itemStoreDetail Object รายละเอียดการเก็บไอเท็ม "itemStoreDetail" : {"eng":"","thai":"","chi1":"","chi2":""}
itemStoreName Object ชื่อที่เก็บไอเท็ม "itemStoeName" : {"eng":"","thai":"","chi1":"","chi2":""}
mainTab Array String ค่า mainTab
nameReport String คำย่อของไอเท็ม
partnerTypeId Array id ค่า partnerTypeId
shop Object ข้อมูลของร้านในห้างที่ไอเท็มนั้นจัดรายการอยู่ เลือกไว้โชว์หน้าแรก โดยตั้งค่า set ใน backend
shops Array Object ข้อมูลลำดับร้านในห้าง
updated_at Datetime วันที่แก้ไขข้อมูล Auto Update

Data Dictionary Coupon Player:

Field Type Description Default
_id ObjectId id ของรายการคูปองผู้เล่นนั้น Auto Create
createAt Datetime วันที่บันทึกข้อมูล Auto Create
couponGiftId string ค่า couponGiftId ได้จากคีย์ใน code ใน couponIem
couponPassword string ค่า couponPassword ได้จาก ค่าของ itemDetailEffect Json SHOP_CODE
couponDatetime1 Datetime วันที่ผู้ใช้สร้างคูปอง Auto Update
couponDatetime2 Datetime วันที่ผู้ใช้ Redeem คูปอง Auto Update
itemId ObjectId ไอเท็มที่ผู้ใช้เลือกมาสร้างคูปอง Auto
uniqueId string ค่า uniqueId ของผู้เล่น
isActive Boolean สถานะการใช้งาน

[X] 4.3 Get coupon

POST api/v2/coupon/getCoupon

Description:

ใช้สร้างคูปองของผู้เล่น โดยใช้ id และ uniqueId 

Body parameters:

Field Description Optional Default
id _id คูปอง จาก api ข้อ 4.1 No
uniqueId uniqueId ของผู้ใช้ No

Returns:

{
    "data": {
        "couponPlayer": {
            "_id": "5daea7a763998b3a70cbc424",
            "couponDatetime1": "2019-10-22T06:54:32.045Z",
            "couponGiftId": "9999",
            "couponPassword": "XOHO",
            "createAt": "2019-10-22T06:54:32.045Z",
            "isActive": true,
            "itemId": "5bebbf8df9cec50850001e54",
            "uniqueId": "adcd"
        }
    },
    "isSuccess": true
}

Data Dictionary Coupon Player:

 ข้อมูลแบบเดียวกับข้อ 4.2

[X] 4.4 Redeem coupon

POST api/v2/coupon/redeem

Description:

ใช้ Redeem คูปองของผู้เล่น โดยใช้ id CouponPlayer เมื่อทำการส่งระบบจะ update couponDatetime2 ลงในข้อมูลของผู้ใช้

Body parameters:

Field Description Optional Default
id ไอดีคูปองของผู้ใช้ที่ต้องการ Redeem จากการ getCoupon No

Returns:

{
    "data": {
        "couponPlayer": {
            "_id": "5daea7a763998b3a70cbc424",
            "couponDatetime1": "2019-10-22T06:54:32.045Z",
            "couponDatetime2": "2019-10-22T11:14:42.383Z",
            "couponGiftId": "9999",
            "couponPassword": "XOHO",
            "createAt": "2019-10-22T06:54:32.045Z",
            "isActive": true,
            "itemId": "5bebbf8df9cec50850001e54",
            "uniqueId": "adcd"
        }
    },
    "isSuccess": true
}

Data Dictionary Coupon Player:

 ข้อมูลแบบเดียวกับข้อ 4.2

[X] 4.5 Get Coupon Player

GET api/v2/couponPlayer/list

Description:

ใช้ ดึงข้อมูลคูปองของผู้เล่น โดยใช้ uniqueId

Query parameters:

Field Description Optional Default
uniqueId uniqueId ของผู้ใช้ Yes
page หน้าปัจจุบัน Yes 0
limit จำนวนจำกัดหน้า Yes 10

Returns:

{
    "data": {
        "couponPlayer": [
            {
                "_id": "5dae98a263998b0d8c1f794d",
                "couponDatetime1": "2019-10-22T05:50:26.205Z",
                "couponGiftId": "9101112",
                "couponPassword": "BLACKCANYON",
                "createAt": "2019-10-22T05:50:26.205Z",
                "isActive": true,
                "itemId": "5da55a3bf9cec517e4000e3e",
                "uniqueId": "adcd"
            },
            {
                "_id": "5daea35863998b3a70cbc422",
                "couponDatetime1": "2019-10-22T06:36:08.332Z",
                "couponGiftId": "hello",
                "couponPassword": "CafeAmazon",
                "createAt": "2019-10-22T06:36:08.332Z",
                "isActive": true,
                "itemId": "5bebc06ff9cec50850001e56",
                "uniqueId": "adcd"
            }
        ],
        "pageIndex": -1,
        "pageLimit": -1,
        "pages": 1,
        "paging": {
            "next": "",
            "previous": ""
        }
    },
    "isSuccess": true
}

Data Dictionary Coupon Player:

 ข้อมูลแบบเดียวกับข้อ 4.2

[X] 4.5 Get Coupon Player

GET api/v2/couponPlayer/detail

Query parameters:

Field Description Optional Default
id คูปองของผู้เล่น Yes

Returns:

{
    "data": {
        "couponPlayer": {
            "_id": "5daea63c63998b3a70cbc423",
            "couponDatetime1": "2019-10-22T06:48:28.886Z",
            "couponGiftId": "9999",
            "couponPassword": "LineVillage",
            "createAt": "2019-10-22T06:48:28.886Z",
            "isActive": true,
            "itemId": "5bd94f59f9cec50730004696",
            "uniqueId": "adcd"
        }
    },
    "isSuccess": true
}

Data Dictionary Coupon Player:

 ข้อมูลแบบเดียวกับข้อ 4.2