# Trueyou Privilege APIs

# Redemption API

Method: POST
Path: {WeOmni_Platform_Domain}/trueyouprivilege/api/project/{projectId}/redeems/campaign
Description: Redemption api let you burn your True points to get a privilege, like coupon code

  • Scope:
    • ty-privilege.burn

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Request Body

Param Description Type Required Example
trnNo External transaction number, created by partner. String(35) Y typ_clm_200303_1
channel This api call from where. This is pre-defined value from Trueyou Privilege system String Y RPP
subChannel This value belong to subChannel. (Optional) String N RPP
identifierType Identifier type code. Available value: THAIID, TMH, TRUECARD, PERSONAL String(10) Y THAIID
identifierNo Identifier value belong to Identifier type String(30) Y 160012345xxxx
partnerCode Code of the partner (Merchant Id), from dictionary PARTNERS. String(36) N 0022796
terminalCode Code of the terminal. If partner or location is provided then terminal Code is stored for informational purposes String(36) N 69000712
locationCode Code of the location (outlet), from dictionary LOCATIONS. If provided, transaction partner is set to the partner assigned to the location. If there are many locations with the provided code, then the partner is mandatory to provide String(36) N 00001
rewards List of rewards in the basket Array 0..N
pricePlanCode Code of reward’s price plan. By default reward price plan is the same as campaign code String(36) Y POINT-81866
quantity Amount of ordered rewards Number N 1
comment Transaction comment String(400) N Test redemption

Example Request:

curl -X POST \
  https://alpha-gateway.weomni-test.com/trueyouprivilege/api/project/123456789/redeems/campaign \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6Ikp...03XSJ-w' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 327' \
  -H 'Content-Type: application/json' \
  -H 'Cookie: AWSALB=Ex/HvK5cSHu....625-4a83-8ae6-e176cd7237e4' \
  -H 'Host: alpha-gateway.weomni-test.com' \
  -H 'Postman-Token: 973ab896-91ed-42ac-8d4b-9761449ae42f,4d9e35a8-1426-48ee-81dc-90f94f2f5462' \
  -H 'User-Agent: PostmanRuntime/7.20.1' \
  -H 'X-XSRF-TOKEN: 84c68d7b-ae60-4d48-bf6b-5e0e38bfa66d' \
  -H 'cache-control: no-cache' \
  -d '{
   "trnNo":"typ_clm_200303_4",
   "channel":"RPP",
   "subChannel":"",
   "identifierType":"THAIID",
   "identifierNo":"160010036xxxx",
   "terminalCode":"69000712",
   "locationCode":"00001",
   "partnerCode":"0022796",
   "rewards":[
      {
         "pricePlanCode":"POINT-81866",
         "quantity":1
      }
   ],
   "comment":"alpha test"
}'

Response Body

Param Description Type Required Example
transactionId Unique id of the transaction, returned only if transaction was successfully processed and created Long Y 4782
message Additional message returned to the invoker (e.g. POS message) String Y คุณใช้ 100 TruePoint แลกคูปองเงินสด 30 บาท(เงื่อนไขเป็นไปตามบริษัทกำหนด)
balance Main points balance after transaction processing. Depending on the processing level it is the balance of the account or of the customer Number Y 385170
points Total amount of main points issued/redeemed for the transaction Number Y -100
blockUser Indicates if user was blocked as a result of fraud detection Boolean Y false
blockCustomer Indicates if customer was blocked as a result of fraud detection Boolean Y false
blockAccount Indicates if account was blocked as a result of fraud detection Boolean Y false
campaignCode Specific campaign code, If provided CLM will only process business rules associated with the specified campaign String(36) Y POINT-81866
issuedCoupon List of issued coupons Array Y
couponNumber Coupon Number String (50) Y 81866430818472

Response Codes:

HTTP Status Code Description Remark
200 OK Successfully redeemed
500 Internal server error Required fields is not defined or invalid value format
401 Unauthorized Access Token is invalid or expired
403 Forbidden No Permission

Example Response:

{
    "transactionId": 4782,
    "message": "คุณใช้ 100 TruePoint แลกคูปองเงินสด 30 บาท(เงื่อนไขเป็นไปตามบริษัทกำหนด)",
    "balance": 385170,
    "points": -100,
    "blockUser": false,
    "blockCustomer": false,
    "blockAccount": false,
    "campaignCode": "POINT-81866",
    "issuedCoupons": [
        {
            "couponNumber": "81866430818472"
        }
    ]
}

Example Response for error cases:

{
  "error": "TRN_PROCESSOR_ERROR",
  "message": "Transaction Processor error.",
  "path": "/B2B/trnprocessor/identifiers/no=1100000000xxxx/ext-redemptions",
  "status": 500,
  "timestamp": "2019-11-07T14:58:21+07:00",
  "businessError": null,
  "requestToken": null
}
{
    "error": "MISSING_MANDATORY_PARAMETER",
    "message": "Missing mandatory parameter.",
    "path": "/B2B/trnprocessor/identifiers/no=160010036xxxx/ext-redemptions",
    "status": 500,
    "timestamp": "2019-11-15T14:24:55+07:00",
    "businessError": null,
    "requestToken": null
}
{
    "error": "ORDER_INVALID_PRICE_PLAN",
    "message": "Invalid price plan",
    "path": "/B2B/trnprocessor/identifiers/no=160010036xxxx/ext-redemptions",
    "status": 500,
    "timestamp": "2019-11-15T14:17:09+07:00",
    "businessError": null,
    "requestToken": null
}
{
   "error":"TRN_NOT_ENOUGH_POINTS",
   "message":"Not enough points",
   "path":"/B2B/trnprocessor/identifiers/no=087000000xxxx/ext-redemptions",
   "status":500,
   "timestamp":"2019-11-14T11:37:40+07:00",
   "businessError":null,
   "requestToken":null
}

# Customer APIs

Method: GET
Path: {WeOmni_Platform_Domain}/trueyouprivilege/api/project/{projectId}/customers/card Description: Get customer card data

  • Scope:
    • ty-privilege.customer.read

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Path variable

Variable Description Type Required Example
projectId Project Id which user belong to String Y 5cf88e55ea2b210001ad1c3d

Request param

Param Description Type Required Example
customerIdnNo Customer’s identifier number. String(30) N 1600100xxxxxx
idnType Type of Customer’s identifier number. String(10) N This value is identifier type. There are four types which are, PERSONAL,THAIID,TMH,TRUECARD
channel Trueyou Privilege system will provide channel to user String(10) N RPP
subChannel Trueyou Privilege system will provide sub channel to user if needed String(10) N RPP

Example Request:

curl --location --request GET 'https://alpha-gateway.weomni-test.com/trueyouprivilege/api/project/123456789/customers/card?channel=RPP&customerIdnNo=092479xxxx&idnType=TMH' \
--header 'X-XSRF-TOKEN: aa65dc4a-d785-4f62-851d-15758a1b2f9e' \
--header 'Authorization: Bearer <O2O Token>'

Response Body

Param Description Type Required Example
code HTTP status code Number Y 200
description CLM doesn't provide this information String N
service_desc CLM doesn't provide this information String N
ext_transaction_id CLM doesn't provide this information String N
method CLM doesn't provide this information String N
channel This api call from where. This is pre-defined value from Trueyou Privilege system String Y RPP
transaction_id CLM doesn't provide this information String N
pointBalance Number of main points on the Customer’s account String Y 300000
moreInfo Contains customer information Object Y
isMember Indicates if the Customer can perform redemption. String Y Y = Yes , N = No
isTrueProduct Customer owns True Products String Y Y = Yes , N = No
isTrueCard Customer owns True card String Y Y = Yes , N = No
cardInfo TrueCard information which belongs to customer Object Y
cardStatus TrueCard status String Y A
cardType TrueCard type e.g RED, BLACK, WHITE, BLUE String (1) Y BLACK
cardId TrueCard id String (30) Y BLACK
cardExpired TrueCard expiration date Date Y 2020-06-30T00:00:00.000+0000
accountGrade Grade of the Account that Customer is part of Object Y
cardType W = WHITE, GREEN = Y, BLUE = O, RED = G, BLACK C = P, BLACK B = B, BLACK A = A, VIP = V String (10) Y B
customerType Customer type given by grading process. Dictionary GRADING_CUSTOMER_TYPE. String (10) Y NOR
level Grade class (Classic/Red/Black) String (10) Y BLACK
reasonCode Reason for acquiring specific grade. Dictionary GRADING_CHANGE_REASONS String (10) Y 014
additionalData Additional Data Object Y
arpa Reason for acquiring specific grade. Dictionary GRADING_CHANGE_REASONS Number Y 014
aging Reason for acquiring specific grade. Dictionary GRADING_CHANGE_REASONS Number Y 014
cardDeliveryStatus
Card Delivery Status Description
I Identifier did not pass validation
Q Requested
J Request rejected
S Card production to be reprocessed
X Non-deliverable
T Tier set
E New card not needed (Retain)
P Produced
A Approved
D Disregarded
N New
R Returned
C Sent to Chanvanich
001 ที่อยู่ไม่ชัดเจน
002 ไม่มีเลขที่บ้านตามจ่าหน้า
003 ไม่มีผู้รับตามจ่าหน้า
004 ไม่มารับภายในกำหนด
005 ย้ายไม่ทราบที่อยู่ใหม่
006 ที่อยู่ไม่ชัดเจน
007 ไม่ยอมรับ
008 บ้านรื้อถอน
009 เสียชีวิต
010 เลิกกิจการ
011 ที่อยู่ไม่ชัดเจน
012 อื่นๆ
999 Default
888 Produced
777 Inconsistent delivery data provided
String (10) Y X
cardRequestCount Number of time card has been requested Number Y 0
pointPockets Grade of the Account that Customer is part of Object Y
description CLM doesn't provide this information String N
balance Number of points on the Customer’s point pocket Number Y 300000
expire The point pocket's expiration date Date Y 2021-12-31T00:00:00.000+0000

Response Codes:

HTTP Status Code Description Remark
200 OK Get customer card data successfully
500 Internal server error Required fields is not defined or invalid value format
401 Unauthorized Access Token is invalid or expired
403 Forbidden No Permission
404 Not Found Cannot find data with specific value

Example Response for success case

{
    "code": 200,
    "description": null,
    "service_desc": null,
    "ext_transaction_id": null,
    "method": null,
    "channel": "RPP",
    "transaction_id": null,
    "pointBalance": 1719021,
    "moreInfo": {
        "isMember": "Y",
        "isTrueProduct": "Y",
        "isTrueCard": "Y",
        "cardInfo": {
            "cardStatus": "A",
            "cardType": "BLACK",
            "cardId": "790683552000xxxx",
            "cardExpired": "2020-06-30T00:00:00.000+0000",
            "customerName": "MOSMOS ZAZA"
        },
        "accountGrade": {
            "cardType": "B",
            "customerType": "NOR",
            "level": "BLACK",
            "reasonCode": "014"
        },
        "additionalData": {
            "arpa": 249,
            "aging": 18,
            "cardDeliveryStatus": null,
            "cardRequestCount": 0
        },
        "pointPockets": [
            {
                "description": null,
                "balance": 1702416,
                "expire": "2021-12-31T00:00:00.000+0000"
            },
            {
                "description": null,
                "balance": 10538,
                "expire": "2022-12-31T00:00:00.000+0000"
            },
            {
                "description": null,
                "balance": 6067,
                "expire": "2025-12-31T00:00:00.000+0000"
            }
        ]
    }
}

Example Response for error cases:

{
    "error": "INVALID_CHANNEL_PARAMETER",
    "message": "Invalid channel parameter",
    "path": "https://partner-api-uat.trueyou.co.th/tyclm-b2b-uat/profile/customers/customerIdnNo={customerIdnNo}/ext?idnType={idnType}&fields=firstName;lastName;mainPointsBalance;redemptionEnabled;hasCard;hasProduct;trueCard&extensions=trueCard",
    "status": 500,
    "timestamp": "2020-03-31T14:49:37.078+07:00",
    "businessError": null,
    "requestToken": null
}
{
    "error": "IDENTIFIER_BY_NUMBER_AND_TYPE_NOT_FOUND",
    "message": "IDENTIFIER_BY_NUMBER_AND_TYPE_NOT_FOUND",
    "path": "/B2B/profile/customers/customerIdnNo=/ext",
    "status": 404,
    "timestamp": "2020-03-31T14:50:16+07:00",
    "businessError": null,
    "requestToken": ""
}

# Earn Point Transaction APIs

Method: POST
Path: {WeOmni_Platform_Domain}/trueyouprivilege/api/project/{projectId}/points/earn

Description: Earn point

  • Scope:
    • ty-privilege.earn

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Path variable

Variable Description Type Required Example
projectId Project Id which user belong to String Y 5cf88e55ea2b210001ad1c3d

Request Body

Param Description Type Required Example
trnNo External transaction number, created by partner. String(35) Y typ_clm_200303_1
eventType Use “ISSUANCE” String (20) Y ISSUANCE
channel This api call from where. This is pre-defined value from Trueyou Privilege system String Y RPP
subChannel This value belong to subChannel. (Optional) String N RPP
identifierType Identifier type code. Available value: THAIID, TMH, TRUECARD, PERSONAL String(10) Y THAIID
identifierNo Identifier value belong to Identifier type String(30) Y 160012345xxxx
partnerCode Code of the partner (Merchant Id), from dictionary PARTNERS. String(36) N 0022796
terminalCode Code of the terminal. If partner or location is provided then terminal Code is stored for informational purposes String(36) N 69000712
locationCode Code of the location (outlet), from dictionary LOCATIONS. If provided, transaction partner is set to the partner assigned to the location. If there are many locations with the provided code, then the partner is mandatory to provide String(36) N 00001
campaignCode Specific campaign code, If provided CLM will only process business rules associated with the specified campaign String(36) N POINT-81866
amount Amount for earning point.
Currency unit: Thai Baht
Double N 25.0
date Transaction date, if not provided, current date is used. String N Date time format pattern: yyyy-MM-dd'T'HH:mm:ss.SSSXXX.
2019-14-10T12:27:57.415+07:00
comment Transaction comment or action parameterUse: action:{!action name}|multiplier:{!number} String(400) N action:RPP001|multiplier:1

Example Request:

curl --location --request POST 'https://alpha-platform.weomni-test.com/trueyouprivilege/api/project/5cfa27bc2c97280001d40765/points/earn' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <O2O Token>' \
--data-raw '{
   "trnNo":"rpp-15710-3087-8101",
   "eventType":"ISSUANCE",
   "identifierNo":"9890xxxxxxx",
   "identifierType":"THAIID",
   "channel":"RPP",
   "subChannel":"",
   "partnerCode":"1100001",
   "locationCode":"153",
   "terminalCode":"69000153",
   "campaignCode":"POINT-A",
   "amount":20640,
   "date":"2019-14-10T12:27:57.415+07:00",
   "comment": "action:RPP001|multiplier:1"
}'

Response Body

Param Description Type Required Example
data Unique id of the transaction, returned only if transaction was successfully processed and created String Y success
status Additional status Object Y
code The code message that returned from CLM when earn success String Y Accepted
message The message that returned from CLM when earn success String Y Success

Response Codes:

HTTP Status Code Description Remark
200 OK Earn successfully
500 Internal server error Required fields is not defined or invalid value format
401 Unauthorized Access Token is invalid or expired
403 Forbidden No Permission
404 Not Found Cannot find data with specific value

Example Response Body For Success Case

{
  "data": "success",
  "status": {
    "code": "Accepted",
    "message": "Success"
  }
}

Example Response for error cases:

{
    "error": "INVALID_CHANNEL_PARAMETER",
    "message": "Invalid channel parameter",
    "path": "https://partner-api-uat.trueyou.co.th/tyclm-b2b-uat/profile/customers/customerIdnNo={customerIdnNo}/ext?idnType={idnType}&fields=firstName;lastName;mainPointsBalance;redemptionEnabled;hasCard;hasProduct;trueCard&extensions=trueCard",
    "status": 500,
    "timestamp": "2020-03-31T14:49:37.078+07:00",
    "businessError": null,
    "requestToken": null
}

# Earn Point with WeCampaign APIs

Method: POST
Path: {WeOmni_Platform_Domain}/trueyouprivilege/api/project/{projectId}/points/issue

Description: Earn point with WeCampaign

  • Scope:
    • ty-privilege.earn
  • Scope for search and redeem campaign:
    • camp.search
    • camp.redeem.w

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Path variable

Variable Description Type Required Example
projectId Project Id which user belong to String Y 5de626d53d901d0001823a6a

Request Body

Param Description Type Required Example
trnNo External transaction number, created by partner. String(35) Y typ_clm_200303_1
transactionDate Transaction date ZonedDateTime Y This field accept UTC+0 timezone.
Pattern: yyyy-MM-dd'T'HH:mm.ss.SSSZ.
Example: 2020-05-27T02:20:30.451Z
channel [Point] Merchant Earn Point
  • Fixed 'O2OMER'
  • String Y RPP
    subChannel This value belong to subChannel. (Optional) String N RPP
    action [Point] Merchant Earn Point
  • Fixed 'DEFAULT'
  • String Y RPP
    identifierType Identifier type code. Available value: THAIID, TMH, TRUECARD, PERSONAL String(10) Y THAIID
    identifierNo Identifier value belong to Identifier type String(30) Y 160012345xxxx
    merchantId Code of the partner (Merchant Id), from dictionary PARTNERS. String(36) N 0022796
    outletId Code of the location (outlet), from dictionary LOCATIONS. If provided, transaction partner is set to the partner assigned to the location. If there are many locations with the provided code, then the partner is mandatory to provide String(36) N 00001
    terminalId Code of the terminal. If partner or location is provided then terminal Code is stored for informational purposes String(36) N 69000712
    amount Amount for earning point.
    Currency Unit: Thai Satang
    Long Y 2500

    Example Request:

    curl --location --request POST 'https://alpha-platform.weomni-test.com/trueyouprivilege/api/project/5de626d53d901d0001823a6a/points/issue' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer <O2O Token>' \
    --data-raw '{
      "action": "DEFAULT",
      "amount": 0,
      "channel": "O2OMER",
      "identifierNo": "1600100366042",
      "identifierType": "THAIID",
      "merchantId": "1100001",
      "outletId": "50",
      "subChannel": "O2OMER",
      "terminalId": "69000050",
      "transactionDate": "2020-05-27T02:20:30.451Z",
      "transactionNo": "testEarnTrx002"
    }'
    

    Response Body

    Param Description Type Required Example
    data Unique id of the transaction, returned only if transaction was successfully processed and created String Y success
    status Additional status Object Y
    code The code message that returned from CLM when earn success String Y Accepted
    message The message that returned from CLM when earn success String Y Success
    redemptionTxId Redemption transaction Id from WeCampaign String Y 1234

    Response Codes:

    HTTP Status Code Description Remark
    200 OK Earn point with WeCampaign successfully
    500 Internal server error Required fields is not defined or invalid value format
    401 Unauthorized Access Token is invalid or expired
    403 Forbidden No Permission
    404 Not Found Cannot find data with specific value

    Example Response Body For Success Case

    {
      "data": "success",
      "status": {
        "code": "Accepted",
        "message": "Success"
      },
      "redemptionTxId": "1234"
    }
    

    Search Condition on WeCampaign

    {
      "attribute": {
        "type": "earn_point",
        "target": "kk-sale",
        "channel": "WEMALL",
        "subChannel": "subChannel",
        "action": "WEMALL",
        "amount": 0,
        "identifierType": "THAIID"
      }
    }
    

    Example Response for error cases:

    • Promotion Campaign Not Found
    {
        "code": "500003",
        "referenceCode": "5ed898684a77170001e0647c",
        "type": "points/issue",
        "title": "Promotion Campaign not found",
        "status": 500
    }
    
    • Promotion Campaign search return error
    {
        "code": "500004",
        "referenceCode": "5ed8987b4a77170001e0647d",
        "type": "points/issue",
        "title": "Promotion Campaign search return error",
        "status": 500
    }
    

    # Mark Used APIs

    Method: POST
    Path: {WeOmni_Platform_Domain}/trueyouprivilege/api/project/{projectId}/redeems/mark-used

    Description: Validate and use coupons

    • Scope:
      • ty-privilege.mark-used

    Request Header:

    Param Description Required Example
    Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
    Content-Type The MIME type of this content Y application/json

    Path variable

    Variable Description Type Required Example
    projectId Project Id which user belong to String Y 5cf88e55ea2b210001ad1c3d

    Request Body

    Param Description Type Required Example
    trnNo Partner transaction number String(35) Y typ_clm_200303_1
    identifierType Identifier type code. Available value: THAIID, TMH, TRUECARD, PERSONAL String(10) Y THAIID
    identifierNo Identifier value belong to Identifier type String(30) Y 160012345xxxx
    partnerCode Code of the partner (Merchant Id), from dictionary PARTNERS. String(36) N 0022796
    locationCode Code of the location (outlet), from dictionary LOCATIONS. If provided, transaction partner is set to the partner assigned to the location. If there are many locations with the provided code, then the partner is mandatory to provide String(36) N 00001
    terminalCode Code of the terminal. If partner or location is provided then terminal Code is stored for informational purposes String(36) N 69000712
    campaignCode Coupon will only be validated if campaign that coupon was issued by, has the same code as the one provided. String(36) Y POINT-81866
    comment Transaction comment String(400) N Transaction comment
    coupons List of coupons used in the transaction. If identifierNo is not provided then at least one coupon has to be in the list. Array 0..N
    couponNumber 81866576967104 String(50) Y

    Example Request:

    curl --location --request POST 'https://alpha-platform.weomni-test.com/trueyouprivilege/api/project/5cfa27bc2c97280001d40765/redeems/mark-used' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer <O2O Token>' \
    --data-raw '{
            "trnNo":"10034008sun6",
            "identifierNo":"1600100366042",
            "identifierType":"THAIID",
            "partnerCode":"0022796",
            "locationCode":"00001",
            "terminalCode":"69000712",
            "campaignCode":"POINT-81866",
            "comment": "testt",
            "coupons":[
              "81866576967104"
            ]
    }'
    

    Response Body

    Param Description Type Required Example
    transactionId Unique id of the transaction, returned only if transaction was successfully processed and created Long Y 2432
    message Additional message returned to the invoker String Y Success
    usedCoupons List of used coupons (available only if coupon was sent in the accumulation request) Array 0..N
    couponNumber Coupon number String(50) Y 81866576967104
    status Code of the status of the coupon, from dictionary COUPON_STATUSES String(10) Y U
    useResult Code of the result of coupon’s processing, from dictionary COUPON_USE_RESULTS String(10) Y U
    useQuantity Number of times that the coupon was used in the transaction. In case when coupon may be used many times this value will be increased each time that the coupon is used. Number Y 1

    Response Codes:

    HTTP Status Code Description Remark
    200 OK Mark used coupon successfully
    500 Internal server error Required fields is not defined or invalid value format
    401 Unauthorized Access Token is invalid or expired
    403 Forbidden No Permission
    404 Not Found Cannot find data with specific value

    Example Response Body For Success Case

    {
        "transactionId": 141,
        "message": "Success",
        "usedCoupons": [
            {
                "couponNumber": "81866576967104",
                "status": "U",
                "useResult": "U",
                "useQuantity": 1
            }
        ]
    }
    

    Example Response for error cases:

    • Coupon is invalid
    {
      "error": "TRN_INVALID_COUPON",
      "message": "Provided in request coupon in not valid.",
      "path": "/B2B/trnprocessor/identifiers/ext-coupon-redemptions",
      "status": 500,
      "timestamp": "2019-11-12T13:38:49+07:00",
      "businessError": null,
      "requestToken": ""
    }
    
    • Coupon was already mark used
    {
        "error": "TRN_INVALID_STATUS_COUPON",
        "message": "Provided coupon has invalid status to process transaction.",
        "path": "/B2B/trnprocessor/identifiers/ext-coupon-redemptions",
        "status": 500,
        "timestamp": "2019-11-15T09:11:27+07:00",
        "businessError": null,
        "requestToken": ""
    }
    

    # Void Redemption APIs

    Method: POST
    Path: {WeOmni_Platform_Domain}/trueyouprivilege/api/project/{projectId}/voids/burn

    Description: Void redemption transaction

    • Scope:
      • ty-privilege.void

    Request Header:

    Param Description Required Example
    Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
    Content-Type The MIME type of this content Y application/json

    Path variable

    Variable Description Type Required Example
    projectId Project Id which user belong to String Y 5cf88e55ea2b210001ad1c3d

    Request Body

    Param Description Type Required Example
    prtTrnNo Transaction number (trnNo) from redemption transaction String(35) Y typ_clm_200303_1
    channel This api call from where. This is pre-defined value from Trueyou Privilege system String Y RPP
    subChannel This value belong to subChannel. (Optional) String N RPP
    partnerCode Code of the partner (Merchant Id), from dictionary PARTNERS. String(36) N 0022796
    terminalCode Code of the terminal. If partner or location is provided then terminal Code is stored for informational purposes String(36) N 69000712
    comment Transaction comment String(400) N Transaction comment

    Example Request:

    curl --location --request POST 'https://alpha-platform.weomni-test.com/trueyouprivilege/api/project/5cfa27bc2c97280001d40765/voids/burn' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer <O2O Token>' \
    --data-raw '{
      "comment": "rpp-15710-3087-8101",
      "partnerCode": "0022796",
      "prtTrnNo": "rpp-15710-3087-8101",
      "terminalCode": "69000712",
      "channel":"RPP",
      "subChannel":"String"
    }'
    

    Response Body

    Param Description Type Required Example
    transactionId Unique id of the transaction, it will always return null as CLM has changed to return empty body for this field Long Y null

    Response Codes:

    HTTP Status Code Description Remark
    200 OK Void redemption successfully
    500 Internal server error Required fields is not defined or invalid value format
    401 Unauthorized Access Token is invalid or expired
    403 Forbidden No Permission
    404 Not Found Cannot find data with specific value

    Example Response Body For Success Case

    {
      "transactionId": null
    }
    

    Example Response for error cases:

    {
        "error": "INVALID_CHANNEL_PARAMETER",
        "message": "Invalid channel parameter",
        "path": "https://partner-api-uat.trueyou.co.th/tyclm-b2b-uat/profile/customers/customerIdnNo={customerIdnNo}/ext?idnType={idnType}&fields=firstName;lastName;mainPointsBalance;redemptionEnabled;hasCard;hasProduct;trueCard&extensions=trueCard",
        "status": 500,
        "timestamp": "2020-03-31T14:49:37.078+07:00",
        "businessError": null,
        "requestToken": null
    }
    
    {
        "error": "NOT_FOUND",
        "message": "Resource with id 'rpp-15710-3087-8101' not found",
        "path": "/B2B/trnprocessor/transactions/prtTrnNo=rpp-15710-3087-8101/ext-reverse",
        "status": 404,
        "timestamp": "2020-06-04T16:34:58+07:00",
        "businessError": null,
        "requestToken": null
    }
    

    # Void Earn Point Transaction APIs

    Method: POST
    Path: {WeOmni_Platform_Domain}/trueyouprivilege/api/project/{projectId}/voids/earn

    Description: Void earned point transaction

    • Scope:
      • ty-privilege.void

    Request Header:

    Param Description Required Example
    Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
    Content-Type The MIME type of this content Y application/json

    Path variable

    Variable Description Type Required Example
    projectId Project Id which user belong to String Y 5cf88e55ea2b210001ad1c3d

    Request Body

    Param Description Type Required Example
    prtTrnNo Transaction number (trnNo) from redemption transaction String(35) Y typ_clm_200303_1
    channel This api call from where. This is pre-defined value from Trueyou Privilege system String Y RPP
    subChannel This value belong to subChannel. (Optional) String N RPP
    partnerCode Code of the partner (Merchant Id), from dictionary PARTNERS. String(36) N 0022796
    terminalCode Code of the terminal. If partner or location is provided then terminal Code is stored for informational purposes String(36) N 69000712
    comment Transaction comment String(400) N Transaction comment

    Example Request:

    curl --location --request POST 'https://alpha-platform.weomni-test.com/trueyouprivilege/api/project/5cfa27bc2c97280001d40765/voids/earn' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer <O2O Token>' \
    --data-raw '{
      "comment": "rpp-15710-3087-8101",
      "partnerCode": "0022796",
      "prtTrnNo": "rpp-15710-3087-8101",
      "terminalCode": "69000712",
      "channel":"RPP",
      "subChannel":"String"
    }'
    

    Response Body

    Param Description Type Required Example
    transactionId Unique id of the transaction, it will always return null as CLM has changed to return empty body for this field Long Y null

    Response Codes:

    HTTP Status Code Description Remark
    200 OK Void redemption successfully
    401 Unauthorized Access Token is invalid or expired
    403 Forbidden No Permission
    404 Not Found Cannot find data with specific value
    500 Internal server error Required fields is not defined or invalid value format

    Example Response Body For Success Case

    {
      "transactionId": null
    }
    

    Example Response for error cases:

    {
        "error": "NOT_FOUND",
        "message": "Resource with id 'rpp-15710-3087-8101' not found",
        "path": "/B2B/trnprocessor/transactions/prtTrnNo=rpp-15710-3087-8101/ext-reverse",
        "status": 404,
        "timestamp": "2020-06-04T16:34:58+07:00",
        "businessError": null,
        "requestToken": null
    }
    
    {
        "error": "INVALID_CHANNEL_PARAMETER",
        "message": "Invalid channel parameter",
        "path": "https://partner-api-uat.trueyou.co.th/tyclm-b2b-uat/profile/customers/customerIdnNo={customerIdnNo}/ext?idnType={idnType}&fields=firstName;lastName;mainPointsBalance;redemptionEnabled;hasCard;hasProduct;trueCard&extensions=trueCard",
        "status": 500,
        "timestamp": "2020-03-31T14:49:37.078+07:00",
        "businessError": null,
        "requestToken": null
    }
    

    # Void Earn Point with WeCampaign APIs

    Method: POST
    Path: {WeOmni_Platform_Domain}/trueyouprivilege/api/project/{projectId}/voids/issue

    Description: Void earned point with WeCampaign

    • Scope:
      • ty-privilege.void

    Request Header:

    Param Description Required Example
    Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
    Content-Type The MIME type of this content Y application/json

    Path variable

    Variable Description Type Required Example
    projectId Project Id which user belong to String Y 5cf88e55ea2b210001ad1c3d

    Request Body

    Param Description Type Required Example
    redemptionTxId Transaction Id from True Point V2 redeemed with Promotion WeCampaign String(100) Y typ_clm_200303_1
    merchantId Code of the partner, from dictionary PARTNERS. String(36) Y 0022796
    terminalId Code of the terminal. If partner or location is provided then terminal Code is stored for informational purposes String(36) Y 69000712

    Example Request:

    curl --location --request POST 'https://alpha-platform.weomni-test.com/trueyouprivilege/api/project/5cfa27bc2c97280001d40765/voids/issue' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer <O2O Token>' \
    --data-raw '{
      "redemptionTxId": "rpp-15710-3087-8101",
      "merchantId": "0022796",
      "terminalId": "69000712",
    }'
    

    Response Body

    Param Description Type Required Example
    redemptionStatus Redemption transaction status from WeCampaign on Promotion service String Y "VOID"

    Response Codes:

    HTTP Status Code Description Remark
    200 OK Void redemption successfully
    401 Unauthorized Access Token is invalid or expired
    403 Forbidden No Permission
    500 Internal server error Required fields is not defined or invalid value format or third party return error

    Example Response Body For Success Case

    {
      "redemptionStatus": "VOID"
    }
    

    Example Response for error cases:

    • Error when input parameters are empty
    {
        "type": "https://www.jhipster.tech/problem/constraint-violation",
        "title": "Method argument not valid",
        "status": 400,
        "path": "/api/project/5f4ccb110581b60001e588ca/voids/issue",
        "message": "error.validation",
        "fieldErrors": [
            {
                "objectName": "voidTruePointRequest",
                "field": "terminalId",
                "message": "NotEmpty"
            },
            {
                "objectName": "voidTruePointRequest",
                "field": "redemptionTxId",
                "message": "NotEmpty"
            },
            {
                "objectName": "voidTruePointRequest",
                "field": "merchantId",
                "message": "NotEmpty"
            }
        ]
    }
    
    • Error when issue point from third party (CLM not found)
    {
        "code": "500011",
        "referenceCode": "5efafc5f61c72c00013bc2d5",
        "type": "voids/issue",
        "title": "Resource with id 'rpp-15710-3087-8101' not found",
        "status": 500,
        "message": "Error when void issued point from third party"
    }
    
    • Error when issue point from third party (CLM invalid parameter)
    {
        "code": "500011",
        "referenceCode": "5efafc5f61c72c00013bc2d5",
        "type": "voids/issue",
        "title": "Invalid channel parameter",
        "status": 500,
        "message": "Error when void issued point from third party"
    }
    
    • Promotion get redemption return error
    {
        "code": "500010",
        "referenceCode": "5efafc5f61c72c00013bc2d5",
        "type": "voids/issue",
        "title": "Promotion redemption return with error",
        "status": 500,
        "message": "Promotion redemption return with error"
    }
    
    • Promotion get redemption return without Action Transaction
    {
        "code": "500008",
        "referenceCode": "5efafc5f61c72c00013bc2d5",
        "type": "voids/issue",
        "title": "Promotion redemption return without Action Transaction",
        "status": 500,
        "message": "Promotion redemption return without Action Transaction"
    }
    
    • Promotion get redemption return with status VOID
    {
        "code": "500007",
        "referenceCode": "5efafc5f61c72c00013bc2d5",
        "type": "voids/issue",
        "title": "Error redemption transaction was already voided",
        "status": 500,
        "message": "Error redemption transaction was already voided"
    }
    
    • Promotion get redemption return Not Found
    {
        "code": "500013",
        "referenceCode": "5efafc5f61c72c00013bc2d5",
        "type": "voids/issue",
        "title": "Promotion redemption transaction not found",
        "status": 500,
        "message": "Promotion redemption transaction not found"
    }
    

    # Multiple Redemption

    Method: POST
    Path: {WeOmni_Platform_Domain}/trueyouprivilege/api/project/{projectId}/multiple-redeems/campaign

    Description: Burn point by campaign code via CLM

    • Scope:
      • ty-privilege.burn

    Request Header:

    Param Description Required Example
    Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
    Content-Type The MIME type of this content Y application/json

    Path variable

    Variable Description Type Required Example
    projectId Project Id which user belong to String Y 5cf88e55ea2b210001ad1c3d

    Request Body

    Param Description Type Required Example
    trnNo External transaction number, created by partner. String(35) Y typ_clm_200303_1
    channel This api call from where. This is pre-defined value from Trueyou Privilege system String Y RPP
    subChannel This value belong to subChannel. (Optional) String N RPP
    identifierType Identifier type code. Available value: THAIID, TMH, TRUECARD, PERSONAL, TRUEID. String(10) Y THAIID
    identifierNo Identifier value belong to Identifier type String(30) Y 1600100366xxx
    partnerCode Code of the partner (Merchant Id), from dictionary PARTNERS. String(36) N 0022796
    terminalCode Code of the terminal. If partner or location is provided then terminal Code is stored for informational purposes String(36) N 69000712
    locationCode Code of the location (outlet), from dictionary LOCATIONS. If provided, transaction partner is set to the partner assigned to the location. If there are many locations with the provided code, then the partner is mandatory to provide String(36) N 00001
    comment Transaction comment String(400) N Transaction comment
    rewards List of rewards in the basket Array N
    pricePlanCode Code of reward’s price plan. By default reward price plan is the same as campaign code String(36) Y PRO-2054
    quantity Amount of ordered rewards Number N 1

    Example Request:

    curl -X POST \
      https://alpha-gateway.weomni-test.com/trueyouprivilege/api/project/123456789/multiple-redeems/campaign \
      -H 'Accept: */*' \
      -H 'Accept-Encoding: gzip, deflate' \
      -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6Ikp...03XSJ-w' \
      -H 'Cache-Control: no-cache' \
      -H 'Connection: keep-alive' \
      -H 'Content-Length: 327' \
      -H 'Content-Type: application/json' \
      -H 'Cookie: AWSALB=Ex/HvK5cSHu....625-4a83-8ae6-e176cd7237e4' \
      -H 'Host: alpha-gateway.weomni-test.com' \
      -H 'Postman-Token: 973ab896-91ed-42ac-8d4b-9761449ae42f,4d9e35a8-1426-48ee-81dc-90f94f2f5462' \
      -H 'User-Agent: PostmanRuntime/7.20.1' \
      -H 'X-XSRF-TOKEN: 84c68d7b-ae60-4d48-bf6b-5e0e38bfa66d' \
      -H 'cache-control: no-cache' \
      -d '{
       "trnNo":"typ_clm_200303_4",
       "channel":"RPP",
       "subChannel":"",
       "identifierType":"THAIID",
       "identifierNo":"160010036xxxx",
       "terminalCode":"69000712",
       "locationCode":"00001",
       "partnerCode":"0022796",
       "rewards":[
          {
             "pricePlanCode":"POINT-81866",
             "quantity":1
          },
          {
             "pricePlanCode":"POINT-81867",
             "quantity":2
          }      
       ],
       "comment":"alpha test"
    }'
    

    Response Body

    Param Description Type Required Example
    transactionId Unique id of the transaction Long Y 2432
    balance Main points balance after transaction processing. Depending on the processing level it is the balance of the account or of the customer Number Y 1000
    points Total amount of main points issued/redeemed for the transaction Number Y 1000
    details Array of issued coupon for campaign code Array Y
    campaignCode Specific campaign code, If provided CLM will only process business rules associated with the specified campaign String Y PRO-2054
    balance points balance after transaction processing for related campaign code. Number Y 1000
    issuedCoupons Array of coupons Array Y
    couponNumber Coupon Number String Y 2083394
    transactionId Unique id of the transaction return from CLM Long Y 18107
    message Additional message returned to the invoker (e.g. POS message) String Y คุณใช้ 100 ทรูพอยท์แลกคูปองเงินสด 30 บาท แสดงรหัส 2083394 คงเหลือ 82478 ใช้สิทธิ์ได้ถึง 30มิ.ย 2563

    Response Codes:

    HTTP Status Code Description Remark
    200 OK Multi Burn Point successfully
    500 Internal server error Required fields is not defined or invalid value format
    401 Unauthorized Access Token is invalid or expired
    403 Forbidden No Permission
    404 Not Found Cannot find data with specific value

    Example Response Body For Success Case

    {
      "transactionId": "5d8832c13fd8498e89ec5df010688dab",
      "balance": 82378,
      "points": -200,
      "details": [
        {
          "campaignCode": "PRO-2050",
          "balance": 82578,
          "points": 0,
          "issuedCoupons": [
            {
              "couponNumber": "108802266529172111",
              "transactionId": 18106,
              "message": "คุณรับลุ้นรับสิทธิ์ดื่มน้ำฟรี ณ วันที่ 2020-10-07 โชคดีขอให้ได้ดื่มน้ำคะ."
            }
          ]
        }
      ]
    }
    

    Example Response for error cases:

    {
      "code": "TRN_PROCESSOR_ERROR",
      "referenceCode": "e333f225e0ad49ef95084e26a6f9c890",
      "type": "https://alpha-platform.weomni-test.com/trueyouprivilege/api/project/123456789/multiple-redeems/campaign",
      "title": "Transaction Processor error.",
      "status": 500
    }
    
    {
      "code": "MISSING_MANDATORY_PARAMETER",
      "referenceCode": "e333f225e0ad49ef95084e26a6f9c890",
      "type": "https://alpha-platform.weomni-test.com/trueyouprivilege/api/project/123456789/multiple-redeems/campaign",
      "title": "Missing mandatory parameter.",
      "status": 500
    }
    
    {
      "code": "ORDER_INVALID_PRICE_PLAN",
      "referenceCode": "e333f225e0ad49ef95084e26a6f9c890",
      "type": "https://alpha-platform.weomni-test.com/trueyouprivilege/api/project/123456789/multiple-redeems/campaign",
      "title": "Invalid price plan",
      "status": 500
    }
    
    {
      "code": "TRN_NOT_ENOUGH_POINTS",
      "referenceCode": "e333f225e0ad49ef95084e26a6f9c890",
      "type": "https://alpha-platform.weomni-test.com/trueyouprivilege/api/project/123456789/multiple-redeems/campaign",
      "title": "Not enough points",
      "status": 500
    }
    
    Last Updated: 9/28/2021, 8:34:56 AM