[Fix] 获取addressId出现错误
Tuffy163 opened this issue · comments
Tuffy163 commented
Reason:
因为微软账号没有设置姓名,导致请求addresses时报Bad Requests
Solutions:
①使用设置了姓名的微软账号
②在请求addresses之前请求设置姓名的profiles
Possible version:
# 确认使用支付宝订阅
url = f"https://paymentinstruments.mp.microsoft.com/v6.0/users/me/paymentInstrumentsEx/{payment_instrument_id}?language=zh-CHT&partner=webblends&country=hk&completePrerequisites=True"
add_alipay = client.get(url=url, headers=headers)
# ===========================================================================
# setname
url = "https://paymentinstruments.mp.microsoft.com/v6.0/users/me/profiles"
body = {
"profileType":"consumerprerequisites",
"profileCountry":"hk",
"profileOperation":"add",
"type":"consumer",
"first_name":"fix",
"last_name":"fix",
"email_address":ms_email,
"culture":"EN"
}
setname = client.post(url=url, json=body, headers=headers)
# ===========================================================================
# 添加地址信息
# url = "https://jcmsfd.account.microsoft.com/JarvisCM/me/addresses"
url = "https://paymentinstruments.mp.microsoft.com/v6.0/users/me/addresses"
body = {
"addressCountry": "hk",
"addressType": "billing",
"address_line1": "b",
"address_line2": "",
"city": "a",
"country": "hk"
}
addresses = client.post(url=url, json=body, headers=headers)
AneryCoft commented
感谢!你可以考虑建立一个PR这样你可以成为贡献者