Document tolerance, max_age_hours and payer_error
The API accepts per-call overrides for the underpayment limit ("25" = 25 ETB,
"1%" = one percent) and the receipt age limit (hours, 0 disables), and returns
payer_error alongside error. None of it was in this SDK.
payer_error is the payer-facing wording: show it to the customer, because error
is written for the merchant and can name their own saved accounts.
This commit is contained in:
@@ -64,6 +64,9 @@ class VerifyResult:
|
|||||||
#: a ``verified=True`` with ``"none"`` means the reference exists and the
|
#: a ``verified=True`` with ``"none"`` means the reference exists and the
|
||||||
#: amount matches, but says nothing about who received the money.
|
#: amount matches, but says nothing about who received the money.
|
||||||
receiver_source: Optional[str] = None
|
receiver_source: Optional[str] = None
|
||||||
|
#: The same failure written for the CUSTOMER. Show this to the payer; ``error``
|
||||||
|
#: is the merchant-facing version and may name your own accounts.
|
||||||
|
payer_error: Optional[str] = None
|
||||||
|
|
||||||
#: True only on sandbox (``TEST-...``) responses.
|
#: True only on sandbox (``TEST-...``) responses.
|
||||||
sandbox: bool = False
|
sandbox: bool = False
|
||||||
@@ -81,6 +84,7 @@ class VerifyResult:
|
|||||||
retryable=bool(data.get("retryable")),
|
retryable=bool(data.get("retryable")),
|
||||||
code=data.get("code") or None,
|
code=data.get("code") or None,
|
||||||
receiver_source=data.get("receiver_source") or None,
|
receiver_source=data.get("receiver_source") or None,
|
||||||
|
payer_error=data.get("payer_error") or None,
|
||||||
sandbox=bool(data.get("sandbox")),
|
sandbox=bool(data.get("sandbox")),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,6 +128,8 @@ class Qbirr:
|
|||||||
amount: float,
|
amount: float,
|
||||||
receiver_name: str,
|
receiver_name: str,
|
||||||
receiver_account: Optional[str] = None,
|
receiver_account: Optional[str] = None,
|
||||||
|
tolerance: Optional[str] = None,
|
||||||
|
max_age_hours: Optional[int] = None,
|
||||||
) -> VerifyResult:
|
) -> VerifyResult:
|
||||||
"""
|
"""
|
||||||
Verify a single transaction.
|
Verify a single transaction.
|
||||||
@@ -142,6 +148,10 @@ class Qbirr:
|
|||||||
}
|
}
|
||||||
if receiver_account:
|
if receiver_account:
|
||||||
body["receiver_account"] = receiver_account
|
body["receiver_account"] = receiver_account
|
||||||
|
if tolerance:
|
||||||
|
body["tolerance"] = tolerance
|
||||||
|
if max_age_hours is not None:
|
||||||
|
body["max_age_hours"] = int(max_age_hours)
|
||||||
|
|
||||||
data = self._request("POST", "/api/v1/verify", json=body)
|
data = self._request("POST", "/api/v1/verify", json=body)
|
||||||
return VerifyResult.from_payload(data)
|
return VerifyResult.from_payload(data)
|
||||||
@@ -155,6 +165,8 @@ class Qbirr:
|
|||||||
filename: str = "upload.pdf",
|
filename: str = "upload.pdf",
|
||||||
content_type: str = "application/pdf",
|
content_type: str = "application/pdf",
|
||||||
receiver_account: Optional[str] = None,
|
receiver_account: Optional[str] = None,
|
||||||
|
tolerance: Optional[str] = None,
|
||||||
|
max_age_hours: Optional[int] = None,
|
||||||
) -> VerifyResult:
|
) -> VerifyResult:
|
||||||
"""
|
"""
|
||||||
Verify by uploading a receipt file (PDF, PNG, or JPEG).
|
Verify by uploading a receipt file (PDF, PNG, or JPEG).
|
||||||
|
|||||||
Reference in New Issue
Block a user