fix(пополнение): одно кодирование Receipt в подписи и адресе

Пробелы в JSON кодируются %20, как в строке подписи, а не +;
тест проверяет проводной вид Receipt.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
anor
2026-11-20 23:13:02 +10:00
co-authored by Claude Code
parent d5b2d42112
commit f5c4da425b
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -116,7 +116,7 @@ def create(order: dict) -> dict:
"SignatureValue": sig}
if _test_mode():
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:
+1
View File
@@ -88,6 +88,7 @@ def test_create_url_and_signature_by_docs(rk, monkeypatch, algo):
assert "IsTest" not in q
assert parts.query.startswith("MerchantLogin=")
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)
assert q["Receipt"] == receipt
base = (f"{LOGIN}:1000.00:1012:{quote(receipt, safe='')}:"