Skip to content

Commit cba6355

Browse files
committed
fixed code style using Pint tool
1 parent 7567b13 commit cba6355

26 files changed

+521
-648
lines changed

config/shaparak.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
|--------------------------------------------------------------------------
4242
*/
4343
'saman' => [
44-
'terminal_id' => env('SAMAN_TERMINAL_ID'),
44+
'terminal_id' => env('SAMAN_TERMINAL_ID'),
4545
'terminal_pass' => env('SAMAN_TERMINAL_PASS'),
46-
],
46+
],
4747
/*
4848
|--------------------------------------------------------------------------
4949
| Parsian gateway configuration
@@ -58,45 +58,45 @@
5858
|--------------------------------------------------------------------------
5959
*/
6060
'pasargad' => [
61-
'terminal_id' => env('PASARGAD_TERMINAL_ID'),
62-
'merchant_id' => env('PASARGAD_MERCHANT_ID'),
63-
'certificate_path' => env('PASARGAD_CERT_PATH', storage_path('shaparak/pasargad/certificate.xml')),
61+
'terminal_id' => env('PASARGAD_TERMINAL_ID'),
62+
'merchant_id' => env('PASARGAD_MERCHANT_ID'),
63+
'certificate_path' => env('PASARGAD_CERT_PATH', storage_path('shaparak/pasargad/certificate.xml')),
6464
],
6565
/*
6666
|--------------------------------------------------------------------------
6767
| Mellat gateway configuration
6868
|--------------------------------------------------------------------------
6969
*/
70-
'mellat' => [
71-
'username' => env('MELLAT_USERNAME'),
72-
'password' => env('MELLAT_PASSWORD'),
70+
'mellat' => [
71+
'username' => env('MELLAT_USERNAME'),
72+
'password' => env('MELLAT_PASSWORD'),
7373
'terminal_id' => env('MELLAT_TERMINAL_ID'),
7474
],
7575
/*
7676
|--------------------------------------------------------------------------
7777
| Melli/Sadad gateway configuration
7878
|--------------------------------------------------------------------------
7979
*/
80-
'melli' => [
81-
'merchant_id' => env('MELLI_MERCHANT_ID'),
82-
'terminal_id' => env('MELLI_TERMINAL_ID'),
80+
'melli' => [
81+
'merchant_id' => env('MELLI_MERCHANT_ID'),
82+
'terminal_id' => env('MELLI_TERMINAL_ID'),
8383
'transaction_key' => env('MELLI_TRANS_KEY'),
8484
],
8585
/*
8686
|--------------------------------------------------------------------------
8787
| Zarinpal gateway configuration
8888
|--------------------------------------------------------------------------
8989
*/
90-
'saderat' => [
91-
'terminal_id' => env('SADERAT_MERCHANT_ID'),
90+
'saderat' => [
91+
'terminal_id' => env('SADERAT_MERCHANT_ID'),
9292
],
9393
/*
9494
|--------------------------------------------------------------------------
9595
| Zarinpal gateway configuration
9696
|--------------------------------------------------------------------------
9797
*/
98-
'zarinpal' => [
99-
'merchant_id' => env('ZARINPAL_MERCHANT_ID'),
98+
'zarinpal' => [
99+
'merchant_id' => env('ZARINPAL_MERCHANT_ID'),
100100
],
101101
],
102102

@@ -109,7 +109,7 @@
109109
|
110110
*/
111111
'httpClientOptions' => [
112-
'soap' => [],
113-
'curl' => [],
112+
'soap' => [],
113+
'curl' => [],
114114
],
115115
];

src/Contracts/Factory.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace PhpMonsters\Shaparak\Contracts;
44

5-
use InvalidArgumentException;
6-
75
interface Factory
86
{
97
/**

src/Contracts/Provider.php

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,107 +9,80 @@ interface Provider
99
{
1010
/**
1111
* Determines whether the provider supports reverse transaction
12-
*
13-
* @return bool
1412
*/
15-
function refundSupport(): bool;
13+
public function refundSupport(): bool;
1614

1715
/**
18-
* @param array $parameters operation parameters
19-
*
20-
* @return Provider
16+
* @param array $parameters operation parameters
2117
*/
22-
function setParameters(array $parameters = []): Provider;
18+
public function setParameters(array $parameters = []): Provider;
2319

2420
/**
25-
* @param string|null $key
26-
*
27-
* @param null $default
28-
*
21+
* @param null $default
2922
* @return mixed
3023
*/
31-
function getParameters(string $key = null, $default = null);
24+
public function getParameters(string $key = null, $default = null);
3225

3326
/**
3427
* return rendered goto gate form
35-
*
36-
* @return View
3728
*/
38-
function getForm(): View;
29+
public function getForm(): View;
3930

4031
/**
4132
* return parameters that require for generating goto gate form
42-
*
43-
* @return array
4433
*/
45-
function getFormParameters(): array;
34+
public function getFormParameters(): array;
4635

4736
/**
4837
* get the transaction
49-
*
50-
* @return Transaction
5138
*/
52-
function getTransaction(): Transaction;
39+
public function getTransaction(): Transaction;
5340

5441
/**
5542
* verify transaction
56-
*
57-
* @return bool
5843
*/
59-
function verifyTransaction(): bool;
44+
public function verifyTransaction(): bool;
6045

6146
/**
6247
* for handling after verify methods like settle in Mellat gateway
6348
*
6449
* @return mixed
6550
*/
66-
function settleTransaction(): bool;
51+
public function settleTransaction(): bool;
6752

6853
/**
6954
* reverse/refund transaction if supported by the provider
70-
*
71-
* @return bool
7255
*/
73-
function refundTransaction(): bool;
56+
public function refundTransaction(): bool;
7457

7558
/**
7659
* accomplish transaction. It means the transaction is immutable from now on
77-
*
78-
* @return bool
7960
*/
80-
function accomplishTransaction(): bool;
61+
public function accomplishTransaction(): bool;
8162

8263
/**
8364
* fetch bak gateway reference id from callback parameters
84-
*
85-
* @return string
8665
*/
87-
function getGatewayReferenceId(): string;
66+
public function getGatewayReferenceId(): string;
8867

8968
/**
9069
* get the Url of different parts of a payment process of the gateway
9170
*
92-
* @param string $action
9371
*
94-
* @return string
9572
* @throws Exception
96-
*
9773
*/
98-
function getUrlFor(string $action): string;
74+
public function getUrlFor(string $action): string;
9975

10076
/**
10177
* Specifies whether it is possible to continue payment process with the return parameters from the bank gateway
102-
*
103-
* @return bool
10478
*/
105-
function canContinueWithCallbackParameters(): bool;
79+
public function canContinueWithCallbackParameters(): bool;
10680

10781
/**
10882
* check for required parameters
10983
*
110-
* @param array $parameters
11184
*
11285
* @throws Exception
11386
*/
114-
function checkRequiredActionParameters(array $parameters): void;
87+
public function checkRequiredActionParameters(array $parameters): void;
11588
}

src/Contracts/Transaction.php

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,154 +6,96 @@ interface Transaction
66
{
77
/**
88
* return the callback url of the transaction process
9-
*
10-
* @return string
119
*/
1210
public function getCallbackUrl(): string;
1311

1412
/**
1513
* set gateway token of transaction
16-
*
17-
* @param string $token
18-
* @param bool $save
19-
*
20-
* @return bool
2114
*/
2215
public function setGatewayToken(string $token, bool $save = true): bool;
2316

2417
/**
2518
* set reference ID of transaction شناسه/کد پیگیری
26-
*
27-
* @param string $referenceId
28-
* @param bool $save
29-
*
30-
* @return bool
3119
*/
3220
public function setReferenceId(string $referenceId, bool $save = true): bool;
3321

3422
/**
3523
* get reference ID of the
36-
* @return string
3724
*/
3825
public function getReferenceId(): string;
3926

4027
/**
4128
* return an order id for the transaction to requesting a payment token from the gateway
42-
*
43-
* @return int
4429
*/
4530
public function getGatewayOrderId(): int;
4631

4732
/**
4833
* check if transaction is ready for requesting token from payment gateway or not
49-
*
50-
* @return boolean
5134
*/
5235
public function isReadyForTokenRequest(): bool;
5336

5437
/**
5538
* check if transaction is ready for requesting verify method from payment gateway or not
56-
*
57-
* @return bool
5839
*/
5940
public function isReadyForVerify(): bool;
6041

6142
/**
6243
* check if transaction is ready for requesting inquiry method from payment gateway or not
6344
* This feature does not append to all payment gateways
64-
*
65-
* @return bool
6645
*/
6746
public function isReadyForInquiry(): bool;
6847

6948
/**
7049
* check if transaction is ready for requesting settlement method from payment gateway or not
7150
* This feature does not append to all payment gateways.
7251
* for example in Mellat gateway this method can assume as SETTLE method
73-
*
74-
* @return bool
7552
*/
7653
public function isReadyForSettle(): bool;
7754

7855
/**
7956
* check if transaction is ready for requesting refund method from payment gateway or not
8057
* This feature does not append to all payment gateways
81-
*
82-
* @return bool
8358
*/
8459
public function isReadyForRefund(): bool;
8560

8661
/**
8762
* Mark transaction as a verified transaction
88-
*
89-
* @param bool $save
90-
*
91-
* @return bool
9263
*/
9364
public function setVerified(bool $save = true): bool;
9465

9566
/**
9667
* Mark transaction as a after verified transaction
9768
* For example SETTLED in Mellat gateway
98-
*
99-
* @param bool $save
100-
*
101-
* @return bool
10269
*/
10370
public function setSettled(bool $save = true): bool;
10471

10572
/**
10673
* Mark transaction as a paid/successful transaction
107-
*
108-
* @param bool $save
109-
*
110-
* @return bool
11174
*/
11275
public function setAccomplished(bool $save = true): bool;
11376

11477
/**
11578
* Mark transaction as a refunded transaction
116-
*
117-
* @param bool $save
118-
*
119-
* @return bool
12079
*/
12180
public function setRefunded(bool $save = true): bool;
12281

12382
/**
12483
* Returns the payable amount af the transaction
125-
*
126-
* @return int
12784
*/
12885
public function getPayableAmount(): int;
12986

13087
/**
13188
* save the pan/card number that used for paying the transaction
132-
* @param string $cardNumber
133-
* @param bool $save
134-
*
135-
* @return bool
13689
*/
13790
public function setCardNumber(string $cardNumber, bool $save = false): bool;
13891

13992
/**
14093
* Set callback parameters from payment gateway
141-
*
142-
* @param array $parameters
143-
* @param bool $save
144-
*
145-
* @return bool
14694
*/
14795
public function setCallBackParameters(array $parameters, bool $save = true): bool;
14896

14997
/**
15098
* Set extra values of the transaction. Every key/value pair that you want to bind to the transaction
151-
*
152-
* @param string $key
153-
* @param $value
154-
* @param bool $save
155-
*
156-
* @return bool
15799
*/
158100
public function addExtra(string $key, $value, bool $save = true): bool;
159101
}

src/Exception.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
23
namespace PhpMonsters\Shaparak;
34

4-
class Exception extends \Exception {}
5+
class Exception extends \Exception
6+
{
7+
}

src/Exceptions/RefundException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66

77
class RefundException extends Exception
88
{
9-
109
}

src/Exceptions/RequestTokenException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66

77
class RequestTokenException extends Exception
88
{
9-
109
}

src/Exceptions/SettlementException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66

77
class SettlementException extends Exception
88
{
9-
109
}

0 commit comments

Comments
 (0)