Skip to content

Commit

Permalink
Update pasargad driver
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammad3250 committed Aug 18, 2024
1 parent efa4f3a commit 5818492
Show file tree
Hide file tree
Showing 76 changed files with 9,261 additions and 1,440 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,11 @@ Temporary Items
# VSCode project's cache
.vscode

# phpunit cache
.phpunit.result.cache

# Vendor directory
vendor/

# Composer.lock file
composer.lock
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
language: php

php:
- '7.2'
- '7.3'
before_script: composer install
- 7.2
- 7.3
- 7.4

before_script:
- travis_retry composer self-update
- travis_retry composer update
- travis_retry composer install --prefer-source --no-interaction --dev

script: phpunit
321 changes: 280 additions & 41 deletions README-FA.md

Large diffs are not rendered by default.

120 changes: 93 additions & 27 deletions README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
[![Software License][ico-license]](LICENSE.md)
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Total Downloads on Packagist][ico-download]][link-packagist]
[![StyleCI](https://github.styleci.io/repos/169948762/shield?branch=master)](https://github.styleci.io/repos/169948762)
[![Maintainability](https://api.codeclimate.com/v1/badges/e6a80b17298cb4fcb56d/maintainability)](https://codeclimate.com/github/shetabit/multipay/maintainability)
[![StyleCI](https://github.styleci.io/repos/268039684/shield?branch=master)](https://github.styleci.io/repos/268039684)
[![Maintainability](https://api.codeclimate.com/v1/badges/3aa790c544c9f2132b16/maintainability)](https://codeclimate.com/github/shetabit/multipay/maintainability)
[![Quality Score][ico-code-quality]][link-code-quality]

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

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

For **Laravel** integration you can use [shetabit/payment](https://github.com/shetabit/payment) package.

> 此软件包可用于多个驱动程序,如果在[当前驱动程序列表](#list-of-available-drivers)中找不到驱动程序,则可以创建它们
- [داکیومنت فارسی][link-fa]
Expand Down Expand Up @@ -45,20 +47,43 @@
- [License](#license)

# 可用驱动列表
- [asanpardakht](https://asanpardakht.ir/) :warning: (未测试)

- [aqayepardakht](https://aqayepardakht.ir/) :heavy_check_mark:
- [asanpardakht](https://asanpardakht.ir/) :heavy_check_mark:
- [atipay](https://www.atipay.net/) :heavy_check_mark:
- [azkiVam (Installment payment)](https://www.azkivam.com/) :heavy_check_mark:
- [behpardakht (mellat)](http://www.behpardakht.com/) :heavy_check_mark:
- [bitpay](https://bitpay.ir/) :heavy_check_mark:
- [digipay](https://www.mydigipay.com/) :heavy_check_mark:
- [etebarino (Installment payment)](https://etebarino.com/) :heavy_check_mark:
- [fanavacard](https://www.fanava.com/) :heavy_check_mark:
- [gooyapay](https://gooyapay.ir/) :heavy_check_mark:
- [idpay](https://idpay.ir/) :heavy_check_mark:
- [irankish](http://irankish.com/) :heavy_check_mark:
- [jibit](https://jibit.ir/) :heavy_check_mark:
- [local](#local-driver) :heavy_check_mark:
- [minipay](https://minipay.me/) :heavy_check_mark:
- [nextpay](https://nextpay.ir/) :heavy_check_mark:
- [omidpay](https://omidpayment.ir/) :heavy_check_mark:
- [parsian](https://www.pec.ir/) :heavy_check_mark:
- [pasargad](https://bpi.ir/) :heavy_check_mark:
- [payfa](https://payfa.com/) :heavy_check_mark:
- [payir](https://pay.ir/) :heavy_check_mark:
- [paypal](http://www.paypal.com/) (在下一个版本中很快就支持了)
- [paypal](http://www.paypal.com/) (will be added soon in next version)
- [payping](https://www.payping.ir/) :heavy_check_mark:
- [paystar](http://paystar.ir/) :heavy_check_mark:
- [poolam](https://poolam.ir/) :heavy_check_mark:
- [rayanpay](https://rayanpay.com/) :heavy_check_mark:
- [sadad (melli)](https://sadadpsp.ir/) :heavy_check_mark:
- [saman](https://www.sep.ir) :heavy_check_mark:
- [sep (saman electronic payment) Keshavarzi & Saderat](https://www.sep.ir) :heavy_check_mark:
- [sepehr (saderat)](https://www.sepehrpay.com/) :heavy_check_mark:
- [sepordeh](https://sepordeh.com/) :heavy_check_mark:
- [sizpay](https://www.sizpay.ir/) :heavy_check_mark:
- [toman](https://tomanpay.net/) :heavy_check_mark:
- [snapppay](https://snapppay.ir/) :heavy_check_mark:
- [vandar](https://vandar.io/) :heavy_check_mark:
- [walleta (Installment payment)](https://walleta.ir/) :heavy_check_mark:
- [yekpay](https://yekpay.com/) :heavy_check_mark:
- [zarinpal](https://www.zarinpal.com/) :heavy_check_mark:
- [zibal](https://www.zibal.ir/) :heavy_check_mark:
Expand All @@ -76,7 +101,6 @@
- wepay
- payoneer
- paysimple
- saderat

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

```php
use Shetabit\MultipayMultipay;
use Shetabit\Multipay\Payment

// load the config file from your project
$paymentConfig = require('path/to/payment.php');
Expand Down Expand Up @@ -184,24 +208,30 @@ $invoice->detail('detailName1','your detail1 goes here')
```php
// At the top of the file.
use Shetabit\Multipay\Invoice;
use Shetabit\Multipay\Facade\Payment;
use Shetabit\Multipay\Payment;
...

// load the config file from your project
$paymentConfig = require('path/to/payment.php');

$payment = new Payment($paymentConfig);


// Create new invoice.
$invoice = (new Invoice)->amount(1000);

// Purchase the given invoice.
Payment::purchase($invoice,function($driver, $transactionId) {
$payment->purchase($invoice,function($driver, $transactionId) {
// We can store $transactionId in database.
});

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

// You can specify callbackUrl
Payment::callbackUrl('http://yoursite.com/verify')->purchase(
$payment->callbackUrl('http://yoursite.com/verify')->purchase(
$invoice,
function($driver, $transactionId) {
// We can store $transactionId in database.
Expand All @@ -216,19 +246,25 @@ Payment::callbackUrl('http://yoursite.com/verify')->purchase(
```php
// At the top of the file.
use Shetabit\Multipay\Invoice;
use Shetabit\Multipay\Facade\Payment;
use Shetabit\Multipay\Payment;
...

// load the config file from your project
$paymentConfig = require('path/to/payment.php');

$payment = new Payment($paymentConfig);


// Create new invoice.
$invoice = (new Invoice)->amount(1000);
// Purchase and pay the given invoice.
// You should use return statement to redirect user to the bank page.
return Payment::purchase($invoice, function($driver, $transactionId) {
return $payment->purchase($invoice, function($driver, $transactionId) {
// Store transactionId in database as we need it to verify payment in the future.
})->pay()->render();

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

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

```php
// At the top of the file.
use Shetabit\Multipay\Facade\Payment;
use Shetabit\Multipay\Payment;
use Shetabit\Multipay\Exceptions\InvalidPaymentException;
...

// load the config file from your project
$paymentConfig = require('path/to/payment.php');

$payment = new Payment($paymentConfig);


// 您需要验证支付机构的回传数据,以确保付款成功
// 我们需要使用交易ID来验证
// 使用交易金额来验证,也是一个很好的方法
try {
$receipt = Payment::amount(1000)->transactionId($transaction_id)->verify();
$receipt = $payment->amount(1000)->transactionId($transaction_id)->verify();

// You can show payment referenceId to the user.
echo $receipt->getReferenceId();
Expand All @@ -283,8 +325,14 @@ try {
```php
// At the top of the file.
use Shetabit\Multipay\Invoice;
use Shetabit\Multipay\Facade\Payment;
use Shetabit\Multipay\Payment;
...

// load the config file from your project
$paymentConfig = require('path/to/payment.php');

$payment = new Payment($paymentConfig);


// Create new invoice.
$invoice = (new Invoice)->amount(1000);
Expand All @@ -303,11 +351,17 @@ try {
```php
// At the top of the file.
use Shetabit\Multipay\Invoice;
use Shetabit\Multipay\Facade\Payment;
use Shetabit\Multipay\Payment;
...

// load the config file from your project
$paymentConfig = require('path/to/payment.php');

$payment = new Payment($paymentConfig);


// Purchase (we set invoice to null).
Payment::callbackUrl($url)->amount(1000)->purchase(
$payment->callbackUrl($url)->amount(1000)->purchase(
null,
function($driver, $transactionId) {
// We can store $transactionId in database.
Expand All @@ -320,14 +374,20 @@ try {
```php
// At the top of the file.
use Shetabit\Multipay\Invoice;
use Shetabit\Multipay\Facade\Payment;
use Shetabit\Multipay\Payment;
...

// load the config file from your project
$paymentConfig = require('path/to/payment.php');

$payment = new Payment($paymentConfig);


// Create new invoice.
$invoice = (new Invoice)->amount(1000);

// Purchase the given invoice.
Payment::via('driverName')->purchase(
$payment->via('driverName')->purchase(
$invoice,
function($driver, $transactionId) {
// We can store $transactionId in database.
Expand All @@ -340,22 +400,28 @@ try {
```php
// At the top of the file.
use Shetabit\Multipay\Invoice;
use Shetabit\Multipay\Facade\Payment;
use Shetabit\Multipay\Payment;
...

// load the config file from your project
$paymentConfig = require('path/to/payment.php');

$payment = new Payment($paymentConfig);


// Create new invoice.
$invoice = (new Invoice)->amount(1000);

// Purchase the given invoice with custom driver configs.
Payment::config('mechandId', 'your mechand id')->purchase(
$payment->config('mechandId', 'your mechand id')->purchase(
$invoice,
function($driver, $transactionId) {
// We can store $transactionId in database.
}
);

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

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

#### 事件
#### 事件:

**Notice 1: **event listeners will be registered globaly for all payments.
**Notice 1:** event listeners will be registered globaly for all payments.

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

Expand Down
Loading

0 comments on commit 5818492

Please sign in to comment.