fix(payments): reuse pending links by provider identity

This commit is contained in:
BADtochka
2026-06-10 03:42:49 +03:00
parent 5c96fcd519
commit 1fca62de75
8 changed files with 198 additions and 47 deletions
+1 -8
View File
@@ -295,24 +295,17 @@ class FreeKassaService(HttpClientMixin):
if not success:
return None
expected_currency = normalize_payment_currency_code(getattr(payment, "currency", None))
for order in response_data.get("orders") or []:
if not isinstance(order, dict):
continue
try:
is_new = int(order.get("status", -1)) == 0
amount_matches = decimal_amounts_equal(
order.get("amount"),
getattr(payment, "amount", None),
)
except (TypeError, ValueError):
continue
if not is_new or not amount_matches:
if not is_new:
continue
if str(order.get("merchant_order_id") or "") != str(payment.payment_id):
continue
if normalize_payment_currency_code(order.get("currency")) != expected_currency:
continue
fk_order_id = str(order.get("fk_order_id") or "").strip()
if fk_order_id:
payment_url = (self.config.PAYMENT_URL or "https://pay.freekassa.net/").rstrip("/")