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:
+5
-1
@@ -66,6 +66,8 @@ class Qbirr {
|
||||
'receiver_name' => $req['receiver_name'] ?? '',
|
||||
];
|
||||
if (!empty($req['receiver_account'])) $body['receiver_account'] = $req['receiver_account'];
|
||||
if (!empty($req['tolerance'])) $body['tolerance'] = $req['tolerance'];
|
||||
if (isset($req['max_age_hours'])) $body['max_age_hours'] = (int) $req['max_age_hours'];
|
||||
|
||||
return self::normalise($this->request('POST', '/api/v1/verify', $body));
|
||||
}
|
||||
@@ -106,6 +108,8 @@ class Qbirr {
|
||||
'retryable' => (bool) ($data['retryable'] ?? false),
|
||||
'code' => isset($data['code']) ? (string) $data['code'] : null,
|
||||
'receiver_source' => isset($data['receiver_source']) ? (string) $data['receiver_source'] : null,
|
||||
// Written for the CUSTOMER. Show this to the payer; `error` is for you.
|
||||
'payer_error' => isset($data['payer_error']) ? (string) $data['payer_error'] : null,
|
||||
'sandbox' => (bool) ($data['sandbox'] ?? false),
|
||||
];
|
||||
}
|
||||
@@ -138,7 +142,7 @@ class Qbirr {
|
||||
|
||||
$boundary = '----qbirrphp' . bin2hex(random_bytes(8));
|
||||
$body = '';
|
||||
foreach (['provider', 'amount', 'receiver_name', 'receiver_account'] as $k) {
|
||||
foreach (['provider', 'amount', 'receiver_name', 'receiver_account', 'tolerance', 'max_age_hours'] as $k) {
|
||||
if (isset($req[$k]) && $req[$k] !== '') {
|
||||
$body .= "--{$boundary}\r\n"
|
||||
. "Content-Disposition: form-data; name=\"{$k}\"\r\n\r\n"
|
||||
|
||||
Reference in New Issue
Block a user