Align avatar recharge plan IDs with WeChat virtual products
This commit is contained in:
@@ -9,8 +9,8 @@ from services import wechat_virtual_payment as virtual
|
||||
|
||||
|
||||
def test_build_payment_params_signs_the_exact_compact_payload():
|
||||
order = SimpleNamespace(order_no="AV202609080001", plan_id="plan-1", price_cents=1000)
|
||||
plan = SimpleNamespace(id="plan-1", virtual_product_id="points_plan_1")
|
||||
order = SimpleNamespace(order_no="AV202609080001", plan_id="Basic", price_cents=1000)
|
||||
plan = SimpleNamespace(id="Basic", virtual_product_id="stale-product-id")
|
||||
env = {
|
||||
"WECHAT_VIRTUAL_ENV": "sandbox",
|
||||
"WECHAT_VIRTUAL_SANDBOX_APP_KEY": "sandbox-key",
|
||||
@@ -25,10 +25,10 @@ def test_build_payment_params_signs_the_exact_compact_payload():
|
||||
"buyQuantity": 1,
|
||||
"env": 1,
|
||||
"currencyType": "CNY",
|
||||
"productId": "points_plan_1",
|
||||
"productId": "Basic",
|
||||
"goodsPrice": 1000,
|
||||
"outTradeNo": "AV202609080001",
|
||||
"attach": '{"orderNo":"AV202609080001","planId":"plan-1"}',
|
||||
"attach": '{"orderNo":"AV202609080001","planId":"Basic"}',
|
||||
}, ensure_ascii=False, separators=(",", ":"))
|
||||
assert result["paySig"] == hmac.new(
|
||||
b"sandbox-key", f"requestVirtualPayment&{sign_data}".encode(), hashlib.sha256
|
||||
|
||||
Reference in New Issue
Block a user