Skip to content

Commit

Permalink
remove json_decode from payme
Browse files Browse the repository at this point in the history
  • Loading branch information
shaxzodbek-uzb committed Feb 2, 2022
1 parent 0b708d7 commit 5251efe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Http/Classes/Payme/Payme.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private function CheckTransaction()
);
}

$detail = json_decode($transaction->detail, true);
$detail = $transaction->detail;
$this->response->success([
'create_time' => 1 * $detail['create_time'],
'perform_time' => 1 * $detail['perform_time'],
Expand Down Expand Up @@ -235,7 +235,7 @@ private function PerformTransaction()
$transaction->state = Transaction::STATE_COMPLETED;
$transaction->updated_time = $perform_time;

$detail = json_decode($transaction->detail, true);
$detail = $transaction->detail;
$detail['perform_time'] = $perform_time;
$detail = json_encode($detail);

Expand All @@ -254,7 +254,7 @@ private function PerformTransaction()
break;

case Transaction::STATE_COMPLETED: // handle complete transaction
$detail = json_decode($transaction->detail, true);
$detail = $transaction->detail;

$this->response->success([
'transaction' => (string)$transaction->id,
Expand Down Expand Up @@ -323,7 +323,7 @@ private function CancelTransaction()
if (true) {
$transaction->cancel(1 * $this->request->params['reason']);

$detail = json_decode($transaction->detail, true);
$detail = $transaction->detail;

PaymentService::payListener(null, $transaction, 'cancel-pay');

Expand Down
13 changes: 12 additions & 1 deletion src/Http/Classes/Paynet/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,21 @@ private function paramsCancel($par)

private function paramsInformation($par)
{
$key = $par['parameters'];
if (isset($key['paramValue'])) {
$key = $key['paramValue'];
} else {
$keys = $key;
foreach ($keys as $k) {
if ($k['paramKey'] == 'key') {
$key = $k['paramValue'];
}
}
}
$res = [
'method' => self::METHOD_GetInformation,
'key' => $par['parameters']['paramValue']
];
$this->params = array_merge($this->params, $res);
}
}
}

0 comments on commit 5251efe

Please sign in to comment.