Skip to content

Commit

Permalink
Update category rule model
Browse files Browse the repository at this point in the history
  • Loading branch information
ipfans committed Jun 30, 2022
1 parent 3151fb8 commit 8946984
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 15 deletions.
6 changes: 3 additions & 3 deletions product_.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ type AttributeList struct {
}

type ProductCertification struct {
Name string `json:"certification_name"`
ID string `json:"certification_id"`
Sample string `json:"certification_sample"`
Name string `json:"name"`
ID string `json:"id"`
Sample string `json:"sample"`
IsMandatory bool `json:"is_mandatory"`
}

Expand Down
81 changes: 69 additions & 12 deletions testdata/product/[3]get_category_rule.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
{
"product_certifications": [
{
"certification_name": "aaaa",
"certification_id": "11",
"certification_sample": "aaaaaaaaa",
"name": "aaaa",
"id": "11",
"sample": "aaaaaaaaa",
"is_mandatory": false
},
{
"certification_name": "bbbb",
"certification_id": "22",
"certification_sample": "bbbbbbbbb",
"name": "bbbb",
"id": "22",
"sample": "bbbbbbbbb",
"is_mandatory": false
}
],
Expand All @@ -49,15 +49,15 @@
{
"product_certifications": [
{
"certification_name": "aaaa",
"certification_id": "11",
"certification_sample": "aaaaaaaaa",
"name": "aaaa",
"id": "11",
"sample": "aaaaaaaaa",
"is_mandatory": false
},
{
"certification_name": "bbbb",
"certification_id": "22",
"certification_sample": "bbbbbbbbb",
"name": "bbbb",
"id": "22",
"sample": "bbbbbbbbb",
"is_mandatory": false
}
],
Expand All @@ -67,5 +67,62 @@
]
},
"want_err": false
},
{
"name": "GetCategoryRule in reality",
"args": {
"app_key": "12abcd",
"app_secret": "123",
"access_token": "abc1c123-3128-aa17-125e-2d2d51ab814fa",
"shop_id": "123456",
"category_id": "1234"
},
"request": {
"method": "GET",
"url": "https://open-api.tiktokglobalshop.com/api/products/categories/rules",
"headers": {},
"query": "access_token=abc1c123-3128-aa17-125e-2d2d51ab814fa&app_key=12abcd&category_id=1234&shop_id=123456&sign=220a13779c3760007c1d7c04ca0c4fe9f4b870719908d40f2d3fca7bac75d02f&timestamp=1600000000"
},
"response": {
"status": 200,
"body": {
"code": 0,
"message": "Success",
"request_id": "2022063008074001021713522620EFAA",
"data": {
"category_rules": [
{
"product_certifications": [
{
"id": "69567864873125168",
"is_mandatory": false,
"name": "BPOM Certificate",
"sample": "https://p16-oec-va.ibyteimg.com/tos-alisg-i-aphluv4xwc-s/55e5310bbf71a4453e2d760bb5301b4f.png~tplv-o3syd03w52-origin-image.image?"
}
],
"support_cod": true,
"support_size_chart": false
}
]
}
}
},
"want": {
"category_rules": [
{
"product_certifications": [
{
"id": "69567864873125168",
"is_mandatory": false,
"name": "BPOM Certificate",
"sample": "https://p16-oec-va.ibyteimg.com/tos-alisg-i-aphluv4xwc-s/55e5310bbf71a4453e2d760bb5301b4f.png~tplv-o3syd03w52-origin-image.image?"
}
],
"support_cod": true,
"support_size_chart": false
}
]
},
"want_err": false
}
]

0 comments on commit 8946984

Please sign in to comment.