Skip to content

Commit

Permalink
Return response from SnappPay::eligible (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
amirzpr authored Aug 12, 2024
1 parent 6452bb6 commit c7bf2e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Drivers/SnappPay/SnappPay.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ public function eligible()

$body = json_decode($response->getBody()->getContents(), true);

if ($response->getStatusCode() != 200) {
if ($response->getStatusCode() != 200 || $body['successful'] === false) {
$message = $body['errorData']['message'] ?? 'خطا در هنگام درخواست برای پرداخت رخ داده است.';
throw new InvalidPaymentException($message, (int) $response->getStatusCode());
}

return $body;
return $body['response'];
}

private function normalizerAmount(int $amount): int
Expand Down

0 comments on commit c7bf2e8

Please sign in to comment.