Skip to content

Commit 5818492

Browse files
committed
Update pasargad driver
1 parent efa4f3a commit 5818492

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+9261
-1440
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,11 @@ Temporary Items
5252
# VSCode project's cache
5353
.vscode
5454

55+
# phpunit cache
56+
.phpunit.result.cache
57+
5558
# Vendor directory
5659
vendor/
60+
61+
# Composer.lock file
62+
composer.lock

.travis.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
language: php
2+
23
php:
3-
- '7.2'
4-
- '7.3'
5-
before_script: composer install
4+
- 7.2
5+
- 7.3
6+
- 7.4
7+
8+
before_script:
9+
- travis_retry composer self-update
10+
- travis_retry composer update
11+
- travis_retry composer install --prefer-source --no-interaction --dev
12+
13+
script: phpunit

README-FA.md

Lines changed: 280 additions & 41 deletions
Large diffs are not rendered by default.

README-ZH.md

Lines changed: 93 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
[![Software License][ico-license]](LICENSE.md)
1010
[![Latest Version on Packagist][ico-version]][link-packagist]
1111
[![Total Downloads on Packagist][ico-download]][link-packagist]
12-
[![StyleCI](https://github.styleci.io/repos/169948762/shield?branch=master)](https://github.styleci.io/repos/169948762)
13-
[![Maintainability](https://api.codeclimate.com/v1/badges/e6a80b17298cb4fcb56d/maintainability)](https://codeclimate.com/github/shetabit/multipay/maintainability)
12+
[![StyleCI](https://github.styleci.io/repos/268039684/shield?branch=master)](https://github.styleci.io/repos/268039684)
13+
[![Maintainability](https://api.codeclimate.com/v1/badges/3aa790c544c9f2132b16/maintainability)](https://codeclimate.com/github/shetabit/multipay/maintainability)
1414
[![Quality Score][ico-code-quality]][link-code-quality]
1515

1616
这是一个用于整合支付网关的PHP包。这个包依赖 `PHP 7.2+`.
1717

1818
[捐赠我](https://yekpay.me/mahdikhanzadi) 如果你喜欢这个包:sunglasses: :bowtie:
1919

20+
For **Laravel** integration you can use [shetabit/payment](https://github.com/shetabit/payment) package.
21+
2022
> 此软件包可用于多个驱动程序,如果在[当前驱动程序列表](#list-of-available-drivers)中找不到驱动程序,则可以创建它们
2123
2224
- [داکیومنت فارسی][link-fa]
@@ -45,20 +47,43 @@
4547
- [License](#license)
4648

4749
# 可用驱动列表
48-
- [asanpardakht](https://asanpardakht.ir/) :warning: (未测试)
50+
51+
- [aqayepardakht](https://aqayepardakht.ir/) :heavy_check_mark:
52+
- [asanpardakht](https://asanpardakht.ir/) :heavy_check_mark:
53+
- [atipay](https://www.atipay.net/) :heavy_check_mark:
54+
- [azkiVam (Installment payment)](https://www.azkivam.com/) :heavy_check_mark:
4955
- [behpardakht (mellat)](http://www.behpardakht.com/) :heavy_check_mark:
56+
- [bitpay](https://bitpay.ir/) :heavy_check_mark:
57+
- [digipay](https://www.mydigipay.com/) :heavy_check_mark:
58+
- [etebarino (Installment payment)](https://etebarino.com/) :heavy_check_mark:
59+
- [fanavacard](https://www.fanava.com/) :heavy_check_mark:
60+
- [gooyapay](https://gooyapay.ir/) :heavy_check_mark:
5061
- [idpay](https://idpay.ir/) :heavy_check_mark:
5162
- [irankish](http://irankish.com/) :heavy_check_mark:
63+
- [jibit](https://jibit.ir/) :heavy_check_mark:
64+
- [local](#local-driver) :heavy_check_mark:
65+
- [minipay](https://minipay.me/) :heavy_check_mark:
5266
- [nextpay](https://nextpay.ir/) :heavy_check_mark:
67+
- [omidpay](https://omidpayment.ir/) :heavy_check_mark:
5368
- [parsian](https://www.pec.ir/) :heavy_check_mark:
5469
- [pasargad](https://bpi.ir/) :heavy_check_mark:
70+
- [payfa](https://payfa.com/) :heavy_check_mark:
5571
- [payir](https://pay.ir/) :heavy_check_mark:
56-
- [paypal](http://www.paypal.com/) (在下一个版本中很快就支持了)
72+
- [paypal](http://www.paypal.com/) (will be added soon in next version)
5773
- [payping](https://www.payping.ir/) :heavy_check_mark:
5874
- [paystar](http://paystar.ir/) :heavy_check_mark:
5975
- [poolam](https://poolam.ir/) :heavy_check_mark:
76+
- [rayanpay](https://rayanpay.com/) :heavy_check_mark:
6077
- [sadad (melli)](https://sadadpsp.ir/) :heavy_check_mark:
6178
- [saman](https://www.sep.ir) :heavy_check_mark:
79+
- [sep (saman electronic payment) Keshavarzi & Saderat](https://www.sep.ir) :heavy_check_mark:
80+
- [sepehr (saderat)](https://www.sepehrpay.com/) :heavy_check_mark:
81+
- [sepordeh](https://sepordeh.com/) :heavy_check_mark:
82+
- [sizpay](https://www.sizpay.ir/) :heavy_check_mark:
83+
- [toman](https://tomanpay.net/) :heavy_check_mark:
84+
- [snapppay](https://snapppay.ir/) :heavy_check_mark:
85+
- [vandar](https://vandar.io/) :heavy_check_mark:
86+
- [walleta (Installment payment)](https://walleta.ir/) :heavy_check_mark:
6287
- [yekpay](https://yekpay.com/) :heavy_check_mark:
6388
- [zarinpal](https://www.zarinpal.com/) :heavy_check_mark:
6489
- [zibal](https://www.zibal.ir/) :heavy_check_mark:
@@ -76,7 +101,6 @@
76101
- wepay
77102
- payoneer
78103
- paysimple
79-
- saderat
80104

81105
> 如果找不到你需要的,您可以创建你自己的驱动,阅读`创建自定义驱动`部分,可以了解更多
82106
@@ -122,7 +146,7 @@ b. 在配置文件中,您可以将 `default`设置项设置为你希望的付
122146
c. Instantiate the `Payment` class and **pass configs to it** like the below:
123147

124148
```php
125-
use Shetabit\MultipayMultipay;
149+
use Shetabit\Multipay\Payment
126150

127151
// load the config file from your project
128152
$paymentConfig = require('path/to/payment.php');
@@ -184,24 +208,30 @@ $invoice->detail('detailName1','your detail1 goes here')
184208
```php
185209
// At the top of the file.
186210
use Shetabit\Multipay\Invoice;
187-
use Shetabit\Multipay\Facade\Payment;
211+
use Shetabit\Multipay\Payment;
188212
...
189213

214+
// load the config file from your project
215+
$paymentConfig = require('path/to/payment.php');
216+
217+
$payment = new Payment($paymentConfig);
218+
219+
190220
// Create new invoice.
191221
$invoice = (new Invoice)->amount(1000);
192222

193223
// Purchase the given invoice.
194-
Payment::purchase($invoice,function($driver, $transactionId) {
224+
$payment->purchase($invoice,function($driver, $transactionId) {
195225
// We can store $transactionId in database.
196226
});
197227

198228
// Purchase method accepts a callback function.
199-
Payment::purchase($invoice, function($driver, $transactionId) {
229+
$payment->purchase($invoice, function($driver, $transactionId) {
200230
// We can store $transactionId in database.
201231
});
202232

203233
// You can specify callbackUrl
204-
Payment::callbackUrl('http://yoursite.com/verify')->purchase(
234+
$payment->callbackUrl('http://yoursite.com/verify')->purchase(
205235
$invoice,
206236
function($driver, $transactionId) {
207237
// We can store $transactionId in database.
@@ -216,19 +246,25 @@ Payment::callbackUrl('http://yoursite.com/verify')->purchase(
216246
```php
217247
// At the top of the file.
218248
use Shetabit\Multipay\Invoice;
219-
use Shetabit\Multipay\Facade\Payment;
249+
use Shetabit\Multipay\Payment;
220250
...
221251

252+
// load the config file from your project
253+
$paymentConfig = require('path/to/payment.php');
254+
255+
$payment = new Payment($paymentConfig);
256+
257+
222258
// Create new invoice.
223259
$invoice = (new Invoice)->amount(1000);
224260
// Purchase and pay the given invoice.
225261
// You should use return statement to redirect user to the bank page.
226-
return Payment::purchase($invoice, function($driver, $transactionId) {
262+
return $payment->purchase($invoice, function($driver, $transactionId) {
227263
// Store transactionId in database as we need it to verify payment in the future.
228264
})->pay()->render();
229265

230266
// Do all things together in a single line.
231-
return Payment::purchase(
267+
return $payment->purchase(
232268
(new Invoice)->amount(1000),
233269
function($driver, $transactionId) {
234270
// 把交易ID保存到数据库.
@@ -237,7 +273,7 @@ return Payment::purchase(
237273
})->pay()->render();
238274

239275
// Retrieve json format of Redirection (in this case you can handle redirection to bank gateway)
240-
return Payment::purchase(
276+
return $payment->purchase(
241277
(new Invoice)->amount(1000),
242278
function($driver, $transactionId) {
243279
// 把交易ID保存到数据库.
@@ -252,15 +288,21 @@ return Payment::purchase(
252288

253289
```php
254290
// At the top of the file.
255-
use Shetabit\Multipay\Facade\Payment;
291+
use Shetabit\Multipay\Payment;
256292
use Shetabit\Multipay\Exceptions\InvalidPaymentException;
257293
...
258294

295+
// load the config file from your project
296+
$paymentConfig = require('path/to/payment.php');
297+
298+
$payment = new Payment($paymentConfig);
299+
300+
259301
// 您需要验证支付机构的回传数据,以确保付款成功
260302
// 我们需要使用交易ID来验证
261303
// 使用交易金额来验证,也是一个很好的方法
262304
try {
263-
$receipt = Payment::amount(1000)->transactionId($transaction_id)->verify();
305+
$receipt = $payment->amount(1000)->transactionId($transaction_id)->verify();
264306

265307
// You can show payment referenceId to the user.
266308
echo $receipt->getReferenceId();
@@ -283,8 +325,14 @@ try {
283325
```php
284326
// At the top of the file.
285327
use Shetabit\Multipay\Invoice;
286-
use Shetabit\Multipay\Facade\Payment;
328+
use Shetabit\Multipay\Payment;
287329
...
330+
331+
// load the config file from your project
332+
$paymentConfig = require('path/to/payment.php');
333+
334+
$payment = new Payment($paymentConfig);
335+
288336

289337
// Create new invoice.
290338
$invoice = (new Invoice)->amount(1000);
@@ -303,11 +351,17 @@ try {
303351
```php
304352
// At the top of the file.
305353
use Shetabit\Multipay\Invoice;
306-
use Shetabit\Multipay\Facade\Payment;
354+
use Shetabit\Multipay\Payment;
307355
...
308356

357+
// load the config file from your project
358+
$paymentConfig = require('path/to/payment.php');
359+
360+
$payment = new Payment($paymentConfig);
361+
362+
309363
// Purchase (we set invoice to null).
310-
Payment::callbackUrl($url)->amount(1000)->purchase(
364+
$payment->callbackUrl($url)->amount(1000)->purchase(
311365
null,
312366
function($driver, $transactionId) {
313367
// We can store $transactionId in database.
@@ -320,14 +374,20 @@ try {
320374
```php
321375
// At the top of the file.
322376
use Shetabit\Multipay\Invoice;
323-
use Shetabit\Multipay\Facade\Payment;
377+
use Shetabit\Multipay\Payment;
324378
...
325379

380+
// load the config file from your project
381+
$paymentConfig = require('path/to/payment.php');
382+
383+
$payment = new Payment($paymentConfig);
384+
385+
326386
// Create new invoice.
327387
$invoice = (new Invoice)->amount(1000);
328388

329389
// Purchase the given invoice.
330-
Payment::via('driverName')->purchase(
390+
$payment->via('driverName')->purchase(
331391
$invoice,
332392
function($driver, $transactionId) {
333393
// We can store $transactionId in database.
@@ -340,22 +400,28 @@ try {
340400
```php
341401
// At the top of the file.
342402
use Shetabit\Multipay\Invoice;
343-
use Shetabit\Multipay\Facade\Payment;
403+
use Shetabit\Multipay\Payment;
344404
...
345405

406+
// load the config file from your project
407+
$paymentConfig = require('path/to/payment.php');
408+
409+
$payment = new Payment($paymentConfig);
410+
411+
346412
// Create new invoice.
347413
$invoice = (new Invoice)->amount(1000);
348414

349415
// Purchase the given invoice with custom driver configs.
350-
Payment::config('mechandId', 'your mechand id')->purchase(
416+
$payment->config('mechandId', 'your mechand id')->purchase(
351417
$invoice,
352418
function($driver, $transactionId) {
353419
// We can store $transactionId in database.
354420
}
355421
);
356422

357423
// Also we can change multiple configs at the same time.
358-
Payment::config(['key1' => 'value1', 'key2' => 'value2'])->purchase(
424+
$payment->config(['key1' => 'value1', 'key2' => 'value2'])->purchase(
359425
$invoice,
360426
function($driver, $transactionId) {
361427
// We can store $transactionId in database.
@@ -455,11 +521,11 @@ class MyDriver extends Driver
455521
]
456522
```
457523

458-
**Note:-** 必须确保 `map` 数组的键与 `drivers` 数组的键相同。
524+
**Note:** 必须确保 `map` 数组的键与 `drivers` 数组的键相同。
459525

460-
#### 事件
526+
#### 事件:
461527

462-
**Notice 1: **event listeners will be registered globaly for all payments.
528+
**Notice 1:** event listeners will be registered globaly for all payments.
463529

464530
**Notice 2:** if you want your listeners work correctly, you **must** subcribe them before the target event dispatches.
465531

0 commit comments

Comments
 (0)