diff --git a/.gitignore b/.gitignore index 4c8b545..0f205a6 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ Temporary Items .idea vendor composer.lock +.phpunit.result.cache \ No newline at end of file diff --git a/README.md b/README.md index 51a6b21..6416a73 100644 --- a/README.md +++ b/README.md @@ -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//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) diff --git a/composer.json b/composer.json index 8237228..4ae5e10 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/src/Zarinpal.php b/src/Zarinpal.php index 4c60a5d..358c96a 100644 --- a/src/Zarinpal.php +++ b/src/Zarinpal.php @@ -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; @@ -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; } @@ -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); } /** @@ -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(); }