Skip to content

Commit

Permalink
Merge pull request #7 from evryn/2.x
Browse files Browse the repository at this point in the history
Upgrade to 2.x
  • Loading branch information
AmirrezaNasiri authored Apr 10, 2021
2 parents fcd74bc + ae2fe63 commit a13bede
Show file tree
Hide file tree
Showing 119 changed files with 6,269 additions and 1,721 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ phpunit.xml
coverage
coverage.xml
.phpunit.result.cache
docker-compose.yml
4 changes: 0 additions & 4 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
preset: laravel

finder:
exclude:
- "tests"
43 changes: 23 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,37 @@ cache:
matrix:
fast_finish: true
include:
- php: 7.2
env: LARAVEL='5.8.*' TESTBENCH='3.8.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.2
env: LARAVEL='5.8.*' TESTBENCH='3.8.*' COMPOSER_FLAGS='--prefer-stable'
# Laravel 7
- php: 7.3
env: LARAVEL='5.8.*' TESTBENCH='3.8.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.3
env: LARAVEL='5.8.*' TESTBENCH='3.8.*' COMPOSER_FLAGS='--prefer-stable'
- php: 7.2
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.2
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-stable'
- php: 7.3
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-lowest'
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.3
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-stable'
- php: 7.2
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-stable'

- php: 7.4
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.2
- php: 7.4
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-stable'
- php: 7.3

- php: 8.0
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.3
- php: 8.0
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-stable'

# Laravel 8
- php: 7.3
env: LARAVEL='8.*' TESTBENCH='6.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.3
env: LARAVEL='8.*' TESTBENCH='6.*' COMPOSER_FLAGS='--prefer-stable'

- php: 7.4
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-lowest'
env: LARAVEL='8.*' TESTBENCH='6.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.4
env: LARAVEL='7.*' TESTBENCH='5.*' COMPOSER_FLAGS='--prefer-stable' COVERAGE=true
env: LARAVEL='8.*' TESTBENCH='6.*' COMPOSER_FLAGS='--prefer-stable' COVERAGE=true

- php: 8.0
env: LARAVEL='8.*' TESTBENCH='6.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 8.0
env: LARAVEL='8.*' TESTBENCH='6.*' COMPOSER_FLAGS='--prefer-stable'

before_install:
- travis_retry composer self-update
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.md → CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to Laravel Toman will be documented in this file.

## Version 2.0

### Change
- Package interfaces are significantly changed

## Version 1.0

### Added
Expand Down
12 changes: 5 additions & 7 deletions docs/contributing.md → CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
# Contributing

Contributions are welcome and will be fully credited.
Contributions are welcome and will be fully credited. They are accepted via Pull Requests on [Laravel Toman](https://github.com/evryn/laravel-toman) repository.

Contributions are accepted via Pull Requests on [Github](https://github.com/amirrezanasiri/laraveltoman).

# Things you could do
# Things you can do
If you want to contribute but do not know where to start, this list provides some starting points.
* Add callback fakers to simulate actual gateway callbacks.
* Add a new Payment Gateway:
* [YekPay.com](https://yekpay.com/)
* [Pay.ir](https://pay.ir/)
* [PayPing.ir](https://www.payping.ir/)
* Refactor if you think there are better approach to do things.
* Improve documents and comments; Fix grammatical errors, typos, etc.

## Pull Requests

- **Add tests!** - Your patch won't be accepted if it doesn't have comprehensive tests.
- **Add tests** - We need to have tests for the features.

- **Document any change in behaviour** - Make sure documents in `docs/` directory are kept up-to-date.

- **Consider our release cycle** - We're following [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
- **Consider our release cycle** - We're following [SemVer v2.0.0](http://semver.org/).

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

Expand Down
2 changes: 1 addition & 1 deletion license.md → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2019 Amirreza Nasiri
Copyright (c) Amirreza Nasiri

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:

Expand Down
17 changes: 12 additions & 5 deletions readme.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<p align="center">
<a target="_blank" href="https://packagist.org/packages/evryn/laravel-toman"><img alt="Latest Version on Packagist" src="https://img.shields.io/packagist/v/evryn/laravel-toman.svg?label=release&style=flat-square"></a>
<a target="_blank" href="https://packagist.org/packages/evryn/laravel-toman"><img alt="Total Downloads" src="https://img.shields.io/packagist/dt/evryn/laravel-toman.svg?style=flat-square"></a>
<a target="_blank" href="https://travis-ci.org/evryn/laravel-toman"><img alt="Build Status" src="https://img.shields.io/travis/evryn/laravel-toman/master.svg?style=flat-square"></a>
<a target="_blank" href="https://travis-ci.com/evryn/laravel-toman"><img alt="Build Status" src="https://img.shields.io/travis/com/evryn/laravel-toman/master.svg?style=flat-square"></a>
<a target="_blank" href="https://codecov.io/gh/evryn/laravel-toman"><img alt="Code Coverage" src='https://img.shields.io/codecov/c/github/evryn/laravel-toman?label=coverage&style=flat-square'></a>
<a target="_blank" href="https://styleci.io/repos/214276918"><img alt="StyleCI" src="https://styleci.io/repos/214276918/shield"></a>
</p>
Expand All @@ -22,30 +22,37 @@
and start using in <5m
</p>

<p align="center">
<a target="_blank" href="https://evryn.github.io/laravel-toman/#/fa/">داکیومنت فارسی</a>
رو بخونین و تو 5 دقیقه استفاده‌اش کنین
📚
</p>

# About Toman (تومَن)
Toman is a Laravel package which makes working with popular payment gateways much easier.

## Supported Gateways

[Zarinpal.com](https://zarinpal.com)
[IDPay.ir](https://idpay.ir)
🔘 [YekPay.com](https://yekpay.com/)
🔘 [Pay.ir](https://pay.ir/)
🔘 [PayPing.ir](https://www.payping.ir/)
🔘 ...

## Simple to use

Request new payment as easy as:
Request a new payment:
<p align="center">
<a href="https://evryn.github.io/laravel-toman/">
<img alt="Request new Payment" src="./docs/_media/payment-request-canvas.png">
<img alt="Request new Payment" src="./docs/_media/payment-request.png">
</a>
</p>

And simply verify callback:
And simply verify its callback:
<p align="center">
<a href="https://evryn.github.io/laravel-toman/">
<img alt="Verify Payment" src="./docs/_media/payment-verification-canvas.png">
<img alt="Verify Payment" src="./docs/_media/payment-verification.png">
</a>
</p>

Expand Down
21 changes: 11 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "evryn/laravel-toman",
"description": "A simple stable Laravel package to handle popular payment gateways in Iran including Zarinpal.",
"description": "A simple stable Laravel package to handle popular payment gateways in Iran including ZarinPal and IDPay.",
"license": "MIT",
"authors": [
{
Expand All @@ -11,19 +11,20 @@
],
"homepage": "https://github.com/evryn/laravel-toman",
"keywords": [
"zarinpal", "زرین پال",
"idpay", "آیدی پی",
"laravel", "laraveltoman", "laravel-toman",
"toman", "zarinpal", "زرین پال", "payment",
"gateway", "درگاه", "پرداخت"
"toman", "payment", "gateway", "درگاه", "پرداخت"
],
"require": {
"php": "^7.2",
"illuminate/support": "~5.8.0|^6.0|^7.0",
"guzzlehttp/guzzle": "^6.3"
"php": "^7.3|^8.0",
"illuminate/support": "^7.0|^8.0",
"guzzlehttp/guzzle": "^6.3|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0",
"mockery/mockery": "^1.1",
"orchestra/testbench": "~3.8.0|^4.0|^5.0",
"mockery/mockery": "^1.3.3",
"orchestra/testbench": "~3.8.0|^4.0|^5.0|^6.0",
"sempro/phpunit-pretty-print": "^1.0"
},
"autoload": {
Expand All @@ -48,7 +49,7 @@
},
"scripts": {
"test": "vendor/bin/phpunit --exclude-group external",
"test-coverage": "vendor/bin/phpunit --exclude-group external --coverage-clover=coverage.xml",
"test-dev": "vendor/bin/phpunit --configuration=phpunit.xml --coverage-html=coverage --coverage-text"
"test-coverage": "vendor/bin/phpunit --coverage-clover coverage.xml",
"test-dev": "vendor/bin/phpunit --coverage-html coverage --coverage-text"
}
}
31 changes: 29 additions & 2 deletions config/toman.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,44 @@
'gateways' => [

'zarinpal' => [
// Use sandbox.zarinpal.com instead of zarinpal.com for testing
// purpose. Set it to false on production to receive real payments.
// Setting to true makes all payments happen in a testing environment to fake transactions.
// Set it to false on production to receive real payments.
'sandbox' => env('ZARINPAL_SANDBOX', false),

// Merchant ID of your gateway provided by Zarinpal for your gateway
// only. Looks like this: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
'merchant_id' => env('ZARINPAL_MERCHANT_ID'),
],

'idpay' => [
// Setting to true makes all payments happen in a testing environment to fake transactions.
// Set it to false on production to receive real payments.
'sandbox' => env('IDPAY_SANDBOX', false),

// API Key of your gateway provided by IDPay in your dashboard
// only. Looks like this: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
'api_key' => env('IDPAY_API_KEY'),
],

],

/*
|--------------------------------------------------------------------------
| Default Currency
|--------------------------------------------------------------------------
|
Gateways accept different currencies; So in order to avoid confusion
| when switching between gateways, you can specify your intended currency
| here, and Toman will convert to proper one automatically.
| You can of course override it and specify another currency during making
| requests using Money object too.
|
| Supported currencies: "toman", "rial"
|
*/

'currency' => 'toman',

/*
|--------------------------------------------------------------------------
| Default Description
Expand Down
19 changes: 19 additions & 0 deletions docker-compose.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3.4"

services:
php:
image: php:7.3-alpine
volumes:
- .:/var/www/html

composer:
image: composer:2
volumes:
- .:/app
- composer-cache:/tmp/cache
working_dir: /app
command: '-V'

volumes:
composer-cache:
name: composer-cache
40 changes: 40 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# About Toman (تومَن)
Toman is a Laravel package that makes working with popular payment gateways much easier.

There are dozens of gateway handlers; Here is why you may choose Laravel Toman:

## Heavily Tested
<a target="_blank" href="https://travis-ci.com/evryn/laravel-toman">
<img alt="Build Status" src="https://img.shields.io/travis/com/evryn/laravel-toman/master.svg?style=flat-square">
</a>
<a target="_blank" href="https://codecov.io/gh/evryn/laravel-toman">
<img alt="Code Coverage" src='https://img.shields.io/codecov/c/github/evryn/laravel-toman?label=coverage&style=flat-square'>
</a>

Payment is a critical topic, and its handlers must be tested from all aspects. Laravel Toman has an automated test suit with 100% coverage. On every released build, we're forced to pass all tests so you can add a payment to your code with confidence.

## Elegant API

APIs are pretty much easy to use! Requesting a new payment and verifying it will add ~10 lines to your codebase! 😎

## Supports Multiple Gateways

We are planning to add new gateway providers. They'll require minimum possible changes in your code.
Currently, following gateways are available to use:
[Zarinpal.com](https://zarinpal.com)
[IDPay.ir](https://idpay.ir)
🔘 [YekPay.com](https://yekpay.com/)
🔘 [Pay.ir](https://pay.ir/)
🔘 [PayPing.ir](https://www.payping.ir/)
🔘 ...

## Easy to Test

Writing a test for your application and want to see if you're using the package correctly? No problem at all!

See our testing instructions in your payment gateway section!

<br></br>
➡ Why don't you see yourself? [Quick Start](getting-started.md)

➡ Looking for old documents? <a href="v1/index.html">V1 Docs</a>
11 changes: 7 additions & 4 deletions docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

![logo](_media/logo.png)

# Laravel Toman <small>1.0</small>
# Laravel Toman <small>2.0</small>

> A painless payment handler!
Expand All @@ -13,8 +12,8 @@ Elegant API • Heavily Tested • Multiple Gateways
<a target="_blank" href="https://packagist.org/packages/evryn/laravel-toman">
<img alt="Total Downloads" src="https://img.shields.io/packagist/dt/evryn/laravel-toman.svg?style=flat-square">
</a>
<a target="_blank" href="https://travis-ci.org/evryn/laravel-toman">
<img alt="Build Status" src="https://img.shields.io/travis/evryn/laravel-toman/master.svg?style=flat-square">
<a target="_blank" href="https://travis-ci.com/evryn/laravel-toman">
<img alt="Build Status" src="https://img.shields.io/travis/com/evryn/laravel-toman/master.svg?style=flat-square">
</a>
<a target="_blank" href="https://codecov.io/gh/evryn/laravel-toman">
<img alt="Code Coverage" src='https://img.shields.io/codecov/c/github/evryn/laravel-toman?label=coverage&style=flat-square'>
Expand All @@ -25,3 +24,7 @@ Elegant API • Heavily Tested • Multiple Gateways

[GitHub](https://github.com/evryn/laravel-toman)
[Get Started](#quickstart)

<!-- background color -->

![color](#b3ffe9)
Binary file modified docs/_media/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/payment-request.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/payment-verification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/_navbar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* [English](/)
* [<span class="fa">فارسی</span>](/fa/)
21 changes: 8 additions & 13 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
* [Introduction](introduction.md)
* [Introduction](README.md)

* Getting started

* [Quick Start](quickstart.md)
* [Configuration](configuration.md)
* [Translations](translations.md)
* [Getting Started](getting-started.md)

* Available Gateways
* Payment Gateways

* [Zarinpal](gateways/zarinpal.md)

* [Testing](testing.md)
* [💳 Zarinpal](gateways/zarinpal.md)
* [💳 IDPay](gateways/idpay.md)

* [Contributing](contributing.md)
* [Changelog](changelog.md)
* [Support 💜](support.md)
* [Contributing](../CONTRIBUTING.md)
* [Changelog](../CHANGELOG.md)
* [💜 Support](support.md)

Loading

0 comments on commit a13bede

Please sign in to comment.