需求背景
用户收藏后,主动发起议价可带来订单增长
需求描述
1.每小时获取一次用户收藏接口:https://api.ebay.com/sell/negotiation/v1/find_eligible_items?limit=200&offset=0,获取未发送主动议价的listing数据传参示例如下:
token = get_each_token(ordersourcename)
headers = {
'Authorization': "Bearer " + token,
'Content-Type': 'application/json',
'X-EBAY-C-MARKETPLACE-ID': marketplace
}
2.将获取到的数据实时调用https://api.ebay.com/sell/negotiation/v1/send_offer_to_interested_buyers接口,将主动议价信息发送给用户,数据传参示例如下:
headers = {
'Authorization': "Bearer " + token,
'Content-Type': 'application/json',
'X-EBAY-C-MARKETPLACE-ID': marketplace
}
for listing in listing_list:
parms = {
"message": "Great News! Get my item at a discounted price.",
"offeredItems": [
{
"quantity": "1",
"listingId": listing,
"discountPercentage": "5"
}
],
"allowCounterOffer": "false",
"offerDuration": {
"unit": "DAY",
"value": "2"
}
}
发送成功后将数据按来源渠道+listing+时间保存在数据库
查验了对应表数据落表情况: