Skip to content

Commit

Permalink
add direct redirection to bank gateway (#33)
Browse files Browse the repository at this point in the history
* direct url
  • Loading branch information
AfshinEfati authored and khanzadimahdi committed Dec 30, 2019
1 parent bed6276 commit 76710b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions config/payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,13 @@
'description' => 'payment in '.config('app.name'),
],
'zibal' => [
/* normal api */
'apiPurchaseUrl' => 'https://gateway.zibal.ir/v1/request',
'apiPaymentUrl' => 'https://gateway.zibal.ir/start/',
'apiVerificationUrl' => 'https://gateway.zibal.ir/v1/verify',

'mode' => 'normal', // can be normal, direct

'merchantId' => '',
'callbackUrl' => 'http://yoursite.com/path/to',
'description' => 'payment in '.config('app.name'),
Expand Down
7 changes: 6 additions & 1 deletion src/Drivers/Zibal/Zibal.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ public function purchase()
*/
public function pay()
{
$payUrl = $this->settings->apiPaymentUrl.$this->invoice->getTransactionId();
if (strtolower($this->getMode()) == 'direct') {
$payUrl = $this->settings->apiPaymentUrl.$this->invoice->getTransactionId().'/direct';
} else {
$payUrl = $this->settings->apiPaymentUrl.$this->invoice->getTransactionId();
}


// redirect using laravel logic
return redirect()->to($payUrl);
Expand Down

0 comments on commit 76710b0

Please sign in to comment.