Skip to content

Commit

Permalink
updated idpay
Browse files Browse the repository at this point in the history
  • Loading branch information
hassanamjad1129 committed Jun 11, 2021
1 parent c496fe1 commit 85ade3e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/IDPay/IDPay.php
Expand Up @@ -2,7 +2,7 @@

namespace hugenet\Gateway\IDPay;

use hugenet\Gateway\Asanpardakht\IDPayException;
use hugenet\Gateway\IDPay\IDPayException;
use hugenet\Gateway\Enum;
use hugenet\Gateway\PortAbstract;
use hugenet\Gateway\PortInterface;
Expand Down Expand Up @@ -121,10 +121,9 @@ function getCallback()
protected function sendPayRequest()
{
$this->newTransaction();
//dd($this->getCallback());
$api = $this->config->get('gateway.idpay.api');
$sandbox = $this->config->get('gateway.idpay.sandbox');
$fields = [
'X-API-KEY' => $this->config->get('gateway.idpay.api'),
'X-SANDBOX' => $this->config->get('gateway.idpay.sandbox'),
'amount' => $this->amount,
'callback' => $this->getCallback(),
'phone' => $this->config->get('gateway.idpay.phone')
Expand All @@ -141,8 +140,8 @@ protected function sendPayRequest()
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'X-SANDBOX: true',
'X-API-KEY: 6a7f99eb-7c20-4412-a972-6dfb7cd253a4'
'X-SANDBOX: ' . $sandbox,
'X-API-KEY: ' . $api
));
$response = curl_exec($ch);
$response = json_decode($response, true);
Expand Down Expand Up @@ -194,18 +193,18 @@ protected function userPayment()
*/
protected function verifyPayment()
{
$api = $this->config->get('gateway.idpay.api');
$sandbox = $this->config->get('gateway.idpay.sandbox');
$fields = [
'X-API-KEY' => $this->config->get('gateway.payir.api'),
'X-SANDBOX' => $this->config->get('gateway.idpay.sandbox'),
'id' => $this->refId(),
'order_id'=>$this->trackingCode
'order_id' => $this->trackingCode
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->serverVerifyUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'X-SANDBOX: true',
'X-API-KEY: 6a7f99eb-7c20-4412-a972-6dfb7cd253a4'
'X-SANDBOX: ' . $sandbox,
'X-API-KEY: ' . $api
));

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
Expand Down
5 changes: 5 additions & 0 deletions src/Zarinpal/Zarinpal.php
Expand Up @@ -60,6 +60,11 @@ class Zarinpal extends PortAbstract implements PortInterface
*/
protected $mobileNumber;

public function setFactorNumber($id)
{
return $this;
}

/**
* Address of gate for redirect
*
Expand Down

0 comments on commit 85ade3e

Please sign in to comment.