@@ -16,7 +16,7 @@ |
||
16 | 16 | $this->driver = $driver; |
17 | 17 | } |
18 | 18 | |
19 | - abstract public function init($amount, $orderId, $callbackUrl, $detail = []); |
|
19 | + abstract public function init($amount, $orderId, $callbackUrl, $detail = []); |
|
20 | 20 | |
21 | 21 | abstract public function verify($request); |
22 | 22 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | $this->loadMigrationsFrom(__DIR__ . '/database/migrations'); |
29 | 29 | |
30 | 30 | $this->publishes([ |
31 | - __DIR__.'/config/gateway.php' =>config_path('gateway.php') |
|
31 | + __DIR__ . '/config/gateway.php' =>config_path('gateway.php') |
|
32 | 32 | ], 'gateway'); |
33 | 33 | } |
34 | 34 | } |
@@ -10,11 +10,11 @@ |
||
10 | 10 | use HasFactory; |
11 | 11 | |
12 | 12 | protected $fillable = ['order_id', 'status', 'amount', 'driver', 'ref_no', 'token', 'description']; |
13 | - protected $appends = ['gateway','toman','status_label','status_badge']; |
|
13 | + protected $appends = ['gateway', 'toman', 'status_label', 'status_badge']; |
|
14 | 14 | |
15 | 15 | public function parent() |
16 | 16 | { |
17 | - return $this->belongsTo( config('gateway.model'), 'order_id' ); |
|
17 | + return $this->belongsTo(config('gateway.model'), 'order_id'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function getGatewayAttribute() |
@@ -13,10 +13,10 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('transactions', function (Blueprint $table) { |
|
16 | + Schema::create('transactions', function(Blueprint $table) { |
|
17 | 17 | $table->id(); |
18 | 18 | $table->unsignedBigInteger('order_id'); |
19 | - $table->decimal('amount', 15,2); |
|
19 | + $table->decimal('amount', 15, 2); |
|
20 | 20 | $table->string('driver', 128); |
21 | 21 | $table->enum('status', ['pending', 'successful', 'failed', 'refunded']); |
22 | 22 | $table->string('ref_no')->nullable(); |
@@ -16,16 +16,16 @@ discard block |
||
16 | 16 | $class = new PasargadIpg($this->getInformation()); |
17 | 17 | $class->verifySSL(config('gateway.information')['pasargad']['options']['verifySSL']); |
18 | 18 | |
19 | - $result = $class->getToken( $amount, $transaction->id, $transaction->created_at->format('Y/m/d H:i:s'), $callbackUrl ); |
|
19 | + $result = $class->getToken($amount, $transaction->id, $transaction->created_at->format('Y/m/d H:i:s'), $callbackUrl); |
|
20 | 20 | |
21 | - if(isset($detail['auto_redirect']) && $detail['auto_redirect'] == false && $result->status == 'success') { |
|
21 | + if (isset($detail['auto_redirect']) && $detail['auto_redirect'] == false && $result->status == 'success') { |
|
22 | 22 | $result->token = $result->token; |
23 | 23 | $result->url = 'https://pep.shaparak.ir/payment.aspx?n=' . $result->token; |
24 | 24 | return $result; |
25 | 25 | |
26 | - } elseif($result->status == 'success') { |
|
26 | + } elseif ($result->status == 'success') { |
|
27 | 27 | $this->updateTransactionData($transaction->id, ['token' => $result->token]); |
28 | - header( 'Location: https://pep.shaparak.ir/payment.aspx?n=' . $result->token ); |
|
28 | + header('Location: https://pep.shaparak.ir/payment.aspx?n=' . $result->token); |
|
29 | 29 | die(); |
30 | 30 | |
31 | 31 | } |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | $class = new PasargadIpg($this->getInformation()); |
39 | 39 | $class->verifySSL(config('gateway.information')['pasargad']['options']['verifySSL']); |
40 | 40 | |
41 | - $check = $class->checkTransaction( $request['iN'], $request['iD'] ); |
|
41 | + $check = $class->checkTransaction($request['iN'], $request['iD']); |
|
42 | 42 | |
43 | 43 | if ($check->status == 'success') { |
44 | 44 | $transaction = $this->getTransaction($request['iN']); |
45 | - $result = $class->verifyTransaction( (int) $transaction->amount, $request['iN'], $request['iD'] ); |
|
45 | + $result = $class->verifyTransaction((int) $transaction->amount, $request['iN'], $request['iD']); |
|
46 | 46 | |
47 | 47 | if ($result->status == 'success') { |
48 | 48 | $this->updateTransactionData($request['iN'], ['status' => 'successful', 'ref_no' => $request['tref']]); |
@@ -18,16 +18,16 @@ discard block |
||
18 | 18 | |
19 | 19 | $given_result = (object) array('token' => '', 'url' => ''); |
20 | 20 | |
21 | - if ($result['status'] == 1){ |
|
21 | + if ($result['status'] == 1) { |
|
22 | 22 | $this->updateTransactionData($transaction->id, ['token' => $result['token']]); |
23 | 23 | } |
24 | - if(isset($detail['auto_redirect']) && $detail['auto_redirect'] == false && $result['status'] == 1) { |
|
24 | + if (isset($detail['auto_redirect']) && $detail['auto_redirect'] == false && $result['status'] == 1) { |
|
25 | 25 | $given_result->token = $result['token']; |
26 | 26 | $given_result->url = 'https://ipg.vandar.io/v3/' . $result['token']; |
27 | 27 | return $given_result; |
28 | 28 | |
29 | - } elseif($result['status'] == 1 && $detail['auto_redirect'] == true) { |
|
30 | - header( 'Location: https://ipg.vandar.io/v3/' . $result['token']); |
|
29 | + } elseif ($result['status'] == 1 && $detail['auto_redirect'] == true) { |
|
30 | + header('Location: https://ipg.vandar.io/v3/' . $result['token']); |
|
31 | 31 | die(); |
32 | 32 | } |
33 | 33 | |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | } |
47 | 47 | return $result; |
48 | 48 | |
49 | - }elseif ($result['status'] == 0){ |
|
49 | + }elseif ($result['status'] == 0) { |
|
50 | 50 | $this->updateTransactionData($request['transId'], ['status' => 'failed', 'description' => $result['error']]); |
51 | - }elseif ($result['status'] == 3){ |
|
51 | + }elseif ($result['status'] == 3) { |
|
52 | 52 | $this->updateTransactionData($request['transId'], ['status' => 'failed', 'description' => $result['errors'][0]]); |
53 | 53 | } |
54 | 54 | return $result; |
@@ -46,9 +46,9 @@ |
||
46 | 46 | } |
47 | 47 | return $result; |
48 | 48 | |
49 | - }elseif ($result['status'] == 0){ |
|
49 | + } elseif ($result['status'] == 0){ |
|
50 | 50 | $this->updateTransactionData($request['transId'], ['status' => 'failed', 'description' => $result['error']]); |
51 | - }elseif ($result['status'] == 3){ |
|
51 | + } elseif ($result['status'] == 3){ |
|
52 | 52 | $this->updateTransactionData($request['transId'], ['status' => 'failed', 'description' => $result['errors'][0]]); |
53 | 53 | } |
54 | 54 | return $result; |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | $class = new ParsianIpg($this->getInformation()); |
17 | 17 | $result = $class->paymentRequest($amount, $transaction->id, $callbackUrl); |
18 | 18 | |
19 | - if(isset($detail['auto_redirect']) && $detail['auto_redirect'] == false && $result->status == 'success') { |
|
19 | + if (isset($detail['auto_redirect']) && $detail['auto_redirect'] == false && $result->status == 'success') { |
|
20 | 20 | $result->token = $result->token; |
21 | 21 | $result->url = 'https://pec.shaparak.ir/NewIPG/?Token=' . $result->token; |
22 | 22 | return $result; |
23 | 23 | |
24 | - } elseif($result->status == 'success') { |
|
24 | + } elseif ($result->status == 'success') { |
|
25 | 25 | $this->updateTransactionData($transaction->id, ['token' => $result->token]); |
26 | - header( 'Location: https://pec.shaparak.ir/NewIPG/?Token=' . $result->token ); |
|
26 | + header('Location: https://pec.shaparak.ir/NewIPG/?Token=' . $result->token); |
|
27 | 27 | die(); |
28 | 28 | |
29 | 29 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $class = new ParsianIpg($this->getInformation()); |
37 | 37 | |
38 | - $result = $class->confirmPayment( $request['Token'] ); |
|
38 | + $result = $class->confirmPayment($request['Token']); |
|
39 | 39 | |
40 | 40 | if ($result->status == 'success') { |
41 | 41 | $this->updateTransactionData($request['OrderId'], ['status' => 'successful', 'ref_no' => $request['RRN']]); |