fix(пополнение): одно кодирование Receipt в подписи и адресе
Пробелы в JSON кодируются %20, как в строке подписи, а не +; тест проверяет проводной вид Receipt. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -116,7 +116,7 @@ def create(order: dict) -> dict:
|
|||||||
"SignatureValue": sig}
|
"SignatureValue": sig}
|
||||||
if _test_mode():
|
if _test_mode():
|
||||||
params["IsTest"] = "1"
|
params["IsTest"] = "1"
|
||||||
return {"provider_id": inv, "pay_url": f"{PAY_URL}?{urlencode(params)}"}
|
return {"provider_id": inv, "pay_url": f"{PAY_URL}?{urlencode(params, quote_via=quote)}"}
|
||||||
|
|
||||||
|
|
||||||
def ip_allowed(ip: str) -> bool:
|
def ip_allowed(ip: str) -> bool:
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ def test_create_url_and_signature_by_docs(rk, monkeypatch, algo):
|
|||||||
assert "IsTest" not in q
|
assert "IsTest" not in q
|
||||||
assert parts.query.startswith("MerchantLogin=")
|
assert parts.query.startswith("MerchantLogin=")
|
||||||
assert "Receipt=%7B%22items%22%3A" in parts.query
|
assert "Receipt=%7B%22items%22%3A" in parts.query
|
||||||
|
assert "Receipt=" in parts.query and "+" not in parts.query.split("Receipt=", 1)[1].split("&", 1)[0]
|
||||||
receipt = _receipt(100_000)
|
receipt = _receipt(100_000)
|
||||||
assert q["Receipt"] == receipt
|
assert q["Receipt"] == receipt
|
||||||
base = (f"{LOGIN}:1000.00:1012:{quote(receipt, safe='')}:"
|
base = (f"{LOGIN}:1000.00:1012:{quote(receipt, safe='')}:"
|
||||||
|
|||||||
Reference in New Issue
Block a user