Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions src/Drivers/Payping/Payping.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ public function purchase()
$description = $this->extractDetails('description');

$data = [
"amount" => $this->invoice->getAmount() / ($this->settings->currency == 'T' ? 1 : 10), // convert to toman
"returnUrl" => $this->settings->callbackUrl,
"payerIdentity" => $mobile ?: $email,
"payerName" => $name,
"description" => $description,
"clientRefId" => $this->invoice->getUuid(),
"Amount" => $this->invoice->getAmount() / ($this->settings->currency == 'T' ? 1 : 10), // convert to toman
"ReturnUrl" => $this->settings->callbackUrl,
"PayerIdentity" => $mobile ?: $email,
"PayerName" => $name,
"Description" => $description,
"ClientRefId" => $this->invoice->getUuid(),
];

$response = $this
Expand All @@ -98,7 +98,7 @@ public function purchase()
]
);

$responseBody = mb_strtolower($response->getBody()->getContents());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure about this change ? it makes sure the response is in lower case.
see line 112

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, of course, I have tested it on a project

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunatly, payping has been updated its api structure

$responseBody = $response->getBody()->getContents();
$body = @json_decode($responseBody, true);
$statusCode = $response->getStatusCode();

Expand Down Expand Up @@ -135,9 +135,12 @@ public function pay() : RedirectionForm
*/
public function verify() : ReceiptInterface
{
$refId = Request::input('refid');
$requestData = json_decode(Request::input('data'));
$refId = $requestData->paymentRefId ?? '';

$data = [
'paymentRefId' => $refId
'Amount' => $this->invoice->getAmount() / ($this->settings->currency == 'T' ? 1 : 10), // convert to toman
'PaymentRefId' => $refId,
];


Expand All @@ -155,7 +158,7 @@ public function verify() : ReceiptInterface
]
);

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

$statusCode = $response->getStatusCode();
Expand All @@ -169,7 +172,7 @@ public function verify() : ReceiptInterface
$receipt = $this->createReceipt($refId);

$receipt->detail([
"cardNumber" => $body['cardnumber'],
"cardNumber" => $body['cardNumber'] ?? '',
]);


Expand Down