-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
70 changed files
with
7,132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 codemenco | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
<div dir="rtl"> | ||
|
||
|
||
``` | ||
متاسفانه این پکیج دیگر پشتیبانی نمی شود | ||
``` | ||
|
||
پکیج اتصال به تمامی IPG ها و بانک های ایرانی. | ||
|
||
این پکیج با ورژن های | ||
( ۴ و ۵ و ۶ ) | ||
لاراول سازگار می باشد | ||
|
||
|
||
پشتیبانی تنها از درگاهای زیر می باشد: | ||
1. MELLAT | ||
2. SADAD (MELLI) | ||
3. SAMAN | ||
4. PARSIAN | ||
5. PASARGAD | ||
6. ZARINPAL | ||
7. PAYPAL | ||
8. ASAN PARDAKHT | ||
9. PAY.IR ( برای فراخوانی از 'payir' استفاده نمایید) | ||
10. Irankish (**جدید** - برای فراخوانی از 'irankish' استفاده نمایید) | ||
11. Jibit (درگاه جیبیت) | ||
12. Idpay | ||
---------- | ||
|
||
|
||
**نصب**: | ||
|
||
دستورات زیر را جهت نصب دنبال کنید : | ||
|
||
**مرحله ۱)** | ||
|
||
</div> | ||
|
||
|
||
```php | ||
|
||
composer require codemenco/gateway | ||
|
||
``` | ||
|
||
<div dir="rtl"> | ||
|
||
**مرحله ۲)** | ||
|
||
تغییرات زیر را در فایل config/app.php اعمال نمایید: | ||
|
||
**توجه برای نسخه های لاراول ۶ به بعد این مرحله نیاز به انجام نمی باشد** | ||
|
||
</div> | ||
|
||
```php | ||
|
||
'providers' => [ | ||
... | ||
Codemenco\Gateway\GatewayServiceProvider::class, // <-- add this line at the end of provider array | ||
], | ||
|
||
|
||
'aliases' => [ | ||
... | ||
'Gateway' => Codemenco\Gateway\Gateway::class, // <-- add this line at the end of aliases array | ||
] | ||
|
||
``` | ||
|
||
|
||
|
||
<div dir="rtl"> | ||
|
||
**مرحله ۳) - انتقال فایل های مورد نیاز** | ||
|
||
برای لاراول ۵ : | ||
</div> | ||
|
||
```php | ||
|
||
php artisan vendor:publish --provider=Codemenco\Gateway\GatewayServiceProviderLaravel5 | ||
|
||
``` | ||
|
||
<div dir="rtl"> | ||
برای لاراول ۶ به بعد : | ||
</div> | ||
|
||
```php | ||
|
||
php artisan vendor:publish | ||
|
||
// then choose : GatewayServiceProviderLaravel6 | ||
|
||
``` | ||
|
||
<div dir="rtl"> | ||
|
||
**مرحله ۴) - ایجاد جداول** | ||
|
||
</div> | ||
|
||
```php | ||
|
||
php artisan migrate | ||
|
||
``` | ||
|
||
|
||
<div dir="rtl"> | ||
|
||
**مرحله ۵)** | ||
|
||
عملیات نصب پایان یافته است حال فایل gateway.php را در مسیر app/ باز نموده و تنظیمات مربوط به درگاه بانکی مورد نظر خود را در آن وارد نمایید . | ||
|
||
حال میتوایند برای اتصال به api بانک از یکی از روش های زیر به انتخاب خودتان استفاده نمایید . (Facade , Service container): | ||
</div> | ||
|
||
1. Gateway::make(new Mellat()) | ||
2. Gateway::make('mellat') | ||
3. Gateway::mellat() | ||
4. app('gateway')->make(new Mellat()); | ||
5. app('gateway')->mellat(); | ||
|
||
<div dir="rtl"> | ||
|
||
مثال :اتصال به بانک ملت (درخواست توکن و انتقال کاربر به درگاه بانک) | ||
توجه : مقدار متد price به ریال وارد شده است و معادل یکصد تومان می باشد | ||
|
||
یک روت از نوع GET با آدرس /bank/request ایجاد نمایید و کد های زیر را در آن قرار دهید . | ||
|
||
</div> | ||
|
||
|
||
```php | ||
|
||
try { | ||
|
||
$gateway = \Gateway::make('mellat'); | ||
|
||
$gateway->setCallback(url('/bank/response')); // You can also change the callback | ||
$gateway->price(1000) | ||
// setShipmentPrice(10) // optional - just for paypal | ||
// setProductName("My Product") // optional - just for paypal | ||
->ready(); | ||
|
||
$refId = $gateway->refId(); // شماره ارجاع بانک | ||
$transID = $gateway->transactionId(); // شماره تراکنش | ||
|
||
// در اینجا | ||
// شماره تراکنش بانک را با توجه به نوع ساختار دیتابیس تان | ||
// در جداول مورد نیاز و بسته به نیاز سیستم تان | ||
// ذخیره کنید . | ||
|
||
return $gateway->redirect(); | ||
|
||
} catch (\Exception $e) { | ||
|
||
echo $e->getMessage(); | ||
} | ||
|
||
``` | ||
|
||
<div dir="rtl"> | ||
|
||
و سپس روت با مسیر /bank/response و از نوع post ایجاد نمایید و کد های زیر را در آن قرار دهید : | ||
|
||
</div> | ||
|
||
|
||
```php | ||
|
||
try { | ||
|
||
$gateway = \Gateway::verify(); | ||
$trackingCode = $gateway->trackingCode(); | ||
$refId = $gateway->refId(); | ||
$cardNumber = $gateway->cardNumber(); | ||
|
||
// تراکنش با موفقیت سمت بانک تایید گردید | ||
// در این مرحله عملیات خرید کاربر را تکمیل میکنیم | ||
|
||
} catch (\Codemenco\Gateway\Exceptions\RetryException $e) { | ||
|
||
// تراکنش قبلا سمت بانک تاییده شده است و | ||
// کاربر احتمالا صفحه را مجددا رفرش کرده است | ||
// لذا تنها فاکتور خرید قبل را مجدد به کاربر نمایش میدهیم | ||
|
||
echo $e->getMessage() . "<br>"; | ||
|
||
} catch (\Exception $e) { | ||
|
||
// نمایش خطای بانک | ||
echo $e->getMessage(); | ||
} | ||
|
||
``` | ||
|
||
<div dir="rtl"> | ||
|
||
در صورت تمایل جهت همکاری در توسعه : | ||
|
||
1. توسعه مستندات پکیج. | ||
2. گزارش باگ و خطا. | ||
3. همکاری در نوشتن ماژول دیگر بانک ها برای این پکیج . | ||
|
||
|
||
درصورت بروز هر گونه | ||
[باگ](https://github.com/codemenco/gateway/issues) یا [خطا](https://github.com/codemenco/gateway/issues) . | ||
ما را آگاه سازید . | ||
|
||
این پکیج از پکیج دیگری بنام poolport مشتق شده است اما برخی از عملیات آن متناسب با فریموورک لارول تغییر کرده است | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"name": "codemenco/gateway", | ||
"homepage": "https://github.com/codemenco/gateway", | ||
"description": "A Laravel package for connecting to all Iraninan payment gateways", | ||
"keywords": [ | ||
"laravel", | ||
"iran", | ||
"payment", | ||
"gateway", | ||
"port", | ||
"bank", | ||
"pay", | ||
"mellat", | ||
"saman", | ||
"pasargad", | ||
"parsian", | ||
"sadad", | ||
"meli", | ||
"payline", | ||
"jahanpay", | ||
"zarinpal", | ||
"iranian-banks", | ||
"persian-banks", | ||
"pardakht", | ||
"dargah", | ||
"shaparak", | ||
"poolport", | ||
"ipay", | ||
"payir", | ||
"jibit", | ||
"asan-pardakht", | ||
"pay-ir", | ||
"paypal" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "HamidReza Shafiei", | ||
"email": "codemenco@gmail.com" | ||
} | ||
], | ||
"require": { | ||
"nesbot/carbon": "*", | ||
"paypal/rest-api-sdk-php": "*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Codemenco\\Gateway\\": "src/", | ||
"Codemenco\\Gateway\\Tests\\": "tests/" | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Codemenco\\Gateway\\GatewayServiceProvider" | ||
], | ||
"aliases": { | ||
"Gateway": "Codemenco\\Gateway\\Gateway" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.