6
6
7
7
transaction request library for zarinpal
8
8
9
- ##laravel ready
9
+ ## laravel ready
10
10
this package is going to work with all kinds of projects, but for laravel i add provider to make it as easy as possible.
11
11
just add :
12
12
``` php
13
- 'providers' => array(
13
+ 'providers' => [
14
14
...
15
15
Zarinpal\Laravel\ZarinpalServiceProvider::class
16
16
...
17
- )
17
+ ]
18
18
```
19
- to providers list in "config/app.php". and run
20
- '` php artisan vendor:publish --provider="Zarinpal\Laravel\ZarinpalServiceProvider" ` '
21
- to add config file to laravel configs directory config it and you are good to go
19
+ to providers list in "config/app.php". then add this to ` config/services.php `
20
+ ``` php
21
+ 'zarinpal' => [
22
+ 'merchantID' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
23
+ 'driver' => 'Rest',
24
+ ],
25
+ ```
26
+ and you are good to go (legacy config still works)
22
27
now you can access the zarinpal lib like this:
23
28
``` php
24
29
use Zarinpal\Laravel\Facade\Zarinpal;
@@ -28,8 +33,8 @@ Zarinpal::verify('OK',1000,$answer['Authority']);
28
33
```
29
34
30
35
31
- ##usage
32
- ###installation
36
+ ## usage
37
+ ### installation
33
38
`` composer require zarinpal/zarinpal ``
34
39
or
35
40
``` json
40
45
},
41
46
```
42
47
43
- ###request
48
+ ### request
44
49
``` php
45
50
use Zarinpal\Zarinpal;
46
51
@@ -54,7 +59,7 @@ if(isset($answer['Authority'])) {
54
59
//$answer['Authority'] must save somewhere to do the verification
55
60
```
56
61
57
- ###verify
62
+ ### verify
58
63
``` php
59
64
use Zarinpal\Zarinpal;
60
65
@@ -63,22 +68,3 @@ $answer['Authority'] = file_get_contents('Authority');
63
68
echo json_encode($test->verify('OK',1000,$answer['Authority']));
64
69
//'Status'(index) going to be 'success', 'error' or 'canceled'
65
70
```
66
- ##change driver
67
- driver can be changed between restAPI , soap and NuSoap with using:
68
-
69
- restAPI (recommended):
70
- ``` php
71
- $test = new Zarinpal('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');
72
- ```
73
- or soap:
74
- ``` php
75
- use Zarinpal\Drivers\SoapDriver;
76
- $test = new Zarinpal('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',new soapDriver());
77
- ```
78
- or nuSoap:
79
- ``` php
80
- use Zarinpal\Drivers\NuSoapDriver;
81
- $test = new Zarinpal('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',new NuSoapDriver());
82
- ```
83
-
84
-
0 commit comments