Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatible with Laravel-8 and update requirements | new version + support new zarinpal system Authority code #47

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ Temporary Items
.idea
vendor
composer.lock
.phpunit.result.cache
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# How to use this fork as zarinpal/zarinpal
* Fork this repository and add this code to your composer.json
```
"repositories": [
{
"type": "vcs",
"url":"https://github.com/<Your_GitHub_Username>/zarinpal-composer-library"
}
],
```
* Append `"zarinpal/zarinpal": "dev-master"` to `"require"`
* Execute command `composer update`
* Generate GitHub Token key (open link that printed in console by composer for token generating)
* Enter Token and Done!
# zarinpal-composer-library
[![Build Status](https://travis-ci.org/RTLer/zarinpal-composer-library.svg?branch=master)](https://travis-ci.org/RTLer/zarinpal-composer-library)
[![StyleCI](https://styleci.io/repos/37937280/shield)](https://styleci.io/repos/37937280)
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
],
"minimum-stability": "stable",
"require": {
"guzzlehttp/guzzle": "^6.2"
"php": "^7.3|^8.0",
"guzzlehttp/guzzle": "^7.0.1"
},
"require-dev": {
"phpunit/phpunit": "6.3.*",
"satooshi/php-coveralls": "^1.0"
"php-coveralls/php-coveralls": "^2.4",
"phpunit/phpunit": "^9.3.3"
},
"autoload": {
"psr-4": {
Expand Down
12 changes: 8 additions & 4 deletions src/Zarinpal.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class Zarinpal
{
private $redirectUrl = 'https://www.zarinpal.com/pg/StartPay/%u';
private $redirectUrl = 'https://www.zarinpal.com/pg/StartPay/%s';
private $merchantID;
private $driver;
private $Authority;
Expand Down Expand Up @@ -91,7 +91,7 @@ public function verify($amount, $authority)

public function redirect()
{
header('Location: '.sprintf($this->redirectUrl, $this->Authority));
header('Location: '.$this->makeRedirectURL($this->Authority));
die;
}

Expand All @@ -100,7 +100,11 @@ public function redirect()
*/
public function redirectUrl()
{
return sprintf($this->redirectUrl, $this->Authority);
return $this->makeRedirectURL($this->Authority);
}

public function makeRedirectURL($Authority){
return sprintf($this->redirectUrl, $Authority);
}

/**
Expand All @@ -116,7 +120,7 @@ public function getDriver()
*/
public function enableSandbox()
{
$this->redirectUrl = 'https://sandbox.zarinpal.com/pg/StartPay/%u';
$this->redirectUrl = 'https://sandbox.zarinpal.com/pg/StartPay/%s';
$this->getDriver()->enableSandbox();
}

Expand Down