diff --git a/README-EN.md b/README-EN.md
index c8be3ef..087a22b 100644
--- a/README-EN.md
+++ b/README-EN.md
@@ -113,7 +113,7 @@ payment was successful).
return PaymentGateway::purchase($invoice, function (string $transactionId) {
// Save transaction_id and do stuff...
- })->render();
+ })->view();
```
### Verification
diff --git a/README.md b/README.md
index 50e40df..9c2c6e5 100644
--- a/README.md
+++ b/README.md
@@ -155,7 +155,7 @@
return PaymentGateway::purchase($invoice, function (string $transactionId) {
// Save transaction_id and do stuff...
- })->render();
+ })->view();
```
@@ -170,7 +170,7 @@
return PaymentGateway::setGateway('mellat.app')
->purchase($invoice, function (string $transactionId) {
// Save transaction_id and do stuff...
- })->render();
+ })->view();
```
diff --git a/composer.json b/composer.json
index cf0c838..e5ba644 100644
--- a/composer.json
+++ b/composer.json
@@ -5,18 +5,21 @@
"type": "library",
"license": "MIT",
"keywords": [
+ "laravel",
+ "php",
"payment",
"bank",
"shetab",
"gateway",
+ "invoice",
"behpardakht",
- "saman",
"mellat",
- "zarinpal",
+ "saman",
+ "sep",
"pasargad",
"eghtesad novin",
- "online payment",
- "laravel payment"
+ "zarinpal",
+ "zibal"
],
"authors": [
{
@@ -27,11 +30,15 @@
"require": {
"php": "^7.4|^8.0",
"ext-json": "*",
- "ext-soap": "*",
- "ext-openssl": "*",
"illuminate/support": "^7.0|^8.0",
"ramsey/uuid": "^4.0"
},
+ "suggest": {
+ "ext-bcmath": "Needed to use pasargad gateway",
+ "ext-openssl": "Needed to use eghtesad novin gateway",
+ "ext-simplexml": "Needed to use pasargad gateway",
+ "ext-soap": "Needed to use SOAP drivers: mellat, saman"
+ },
"require-dev": {
"orchestra/testbench": "^6.18"
},
@@ -45,6 +52,9 @@
"Omalizadeh\\MultiPayment\\Tests\\": "tests/"
}
},
+ "config": {
+ "sort-packages": true
+ },
"extra": {
"laravel": {
"providers": [
@@ -55,5 +65,6 @@
}
}
},
+ "minimum-stability": "dev",
"prefer-stable": true
-}
\ No newline at end of file
+}
diff --git a/composer.lock b/composer.lock
index e9af772..4502346 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "1135dfe18ef9d2c74c0141dd5bef5f8c",
+ "content-hash": "c00fae7c1dc02cb9488409e5fe20f380",
"packages": [
{
"name": "brick/math",
@@ -508,16 +508,16 @@
},
{
"name": "laravel/framework",
- "version": "v8.58.0",
+ "version": "v8.61.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
- "reference": "1b819bf99d87bd543a4d4895e5b3350f61ea7a23"
+ "reference": "3d528d3d3c8ecb444b50a266c212a52973a6669b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laravel/framework/zipball/1b819bf99d87bd543a4d4895e5b3350f61ea7a23",
- "reference": "1b819bf99d87bd543a4d4895e5b3350f61ea7a23",
+ "url": "https://api.github.com/repos/laravel/framework/zipball/3d528d3d3c8ecb444b50a266c212a52973a6669b",
+ "reference": "3d528d3d3c8ecb444b50a266c212a52973a6669b",
"shasum": ""
},
"require": {
@@ -554,7 +554,8 @@
"tightenco/collect": "<5.5.33"
},
"provide": {
- "psr/container-implementation": "1.0"
+ "psr/container-implementation": "1.0",
+ "psr/simple-cache-implementation": "1.0"
},
"replace": {
"illuminate/auth": "self.version",
@@ -672,7 +673,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
- "time": "2021-08-31T13:55:57+00:00"
+ "time": "2021-09-14T13:31:32+00:00"
},
{
"name": "league/commonmark",
@@ -963,16 +964,16 @@
},
{
"name": "league/mime-type-detection",
- "version": "1.7.0",
+ "version": "1.8.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/mime-type-detection.git",
- "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3"
+ "reference": "b38b25d7b372e9fddb00335400467b223349fd7e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3",
- "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3",
+ "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/b38b25d7b372e9fddb00335400467b223349fd7e",
+ "reference": "b38b25d7b372e9fddb00335400467b223349fd7e",
"shasum": ""
},
"require": {
@@ -1003,7 +1004,7 @@
"description": "Mime-type detection for Flysystem",
"support": {
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
- "source": "https://github.com/thephpleague/mime-type-detection/tree/1.7.0"
+ "source": "https://github.com/thephpleague/mime-type-detection/tree/1.8.0"
},
"funding": [
{
@@ -1015,28 +1016,28 @@
"type": "tidelift"
}
],
- "time": "2021-01-18T20:58:21+00:00"
+ "time": "2021-09-25T08:23:19+00:00"
},
{
"name": "monolog/monolog",
- "version": "2.3.2",
+ "version": "2.3.4",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
- "reference": "71312564759a7db5b789296369c1a264efc43aad"
+ "reference": "437e7a1c50044b92773b361af77620efb76fff59"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/71312564759a7db5b789296369c1a264efc43aad",
- "reference": "71312564759a7db5b789296369c1a264efc43aad",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/437e7a1c50044b92773b361af77620efb76fff59",
+ "reference": "437e7a1c50044b92773b361af77620efb76fff59",
"shasum": ""
},
"require": {
"php": ">=7.2",
- "psr/log": "^1.0.1"
+ "psr/log": "^1.0.1 || ^2.0 || ^3.0"
},
"provide": {
- "psr/log-implementation": "1.0.0"
+ "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0"
},
"require-dev": {
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
@@ -1051,7 +1052,7 @@
"phpunit/phpunit": "^8.5",
"predis/predis": "^1.1",
"rollbar/rollbar": "^1.3",
- "ruflin/elastica": ">=0.90 <7.0.1",
+ "ruflin/elastica": ">=0.90@dev",
"swiftmailer/swiftmailer": "^5.3|^6.0"
},
"suggest": {
@@ -1059,8 +1060,11 @@
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
"elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
+ "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler",
"ext-mbstring": "Allow to work properly with unicode symbols",
"ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
+ "ext-openssl": "Required to send log messages using SSL",
+ "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
@@ -1099,7 +1103,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
- "source": "https://github.com/Seldaek/monolog/tree/2.3.2"
+ "source": "https://github.com/Seldaek/monolog/tree/2.3.4"
},
"funding": [
{
@@ -1111,20 +1115,20 @@
"type": "tidelift"
}
],
- "time": "2021-07-23T07:42:52+00:00"
+ "time": "2021-09-15T11:27:21+00:00"
},
{
"name": "nesbot/carbon",
- "version": "2.52.0",
+ "version": "2.53.1",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
- "reference": "369c0e2737c56a0f39c946dd261855255a6fccbe"
+ "reference": "f4655858a784988f880c1b8c7feabbf02dfdf045"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/369c0e2737c56a0f39c946dd261855255a6fccbe",
- "reference": "369c0e2737c56a0f39c946dd261855255a6fccbe",
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/f4655858a784988f880c1b8c7feabbf02dfdf045",
+ "reference": "f4655858a784988f880c1b8c7feabbf02dfdf045",
"shasum": ""
},
"require": {
@@ -1136,7 +1140,7 @@
},
"require-dev": {
"doctrine/orm": "^2.7",
- "friendsofphp/php-cs-fixer": "^2.14 || ^3.0",
+ "friendsofphp/php-cs-fixer": "^3.0",
"kylekatarnls/multi-tester": "^2.0",
"phpmd/phpmd": "^2.9",
"phpstan/extension-installer": "^1.0",
@@ -1205,7 +1209,7 @@
"type": "tidelift"
}
],
- "time": "2021-08-14T19:10:52+00:00"
+ "time": "2021-09-06T09:29:23+00:00"
},
{
"name": "nette/schema",
@@ -1271,20 +1275,20 @@
},
{
"name": "nette/utils",
- "version": "v3.2.3",
+ "version": "v3.2.5",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
- "reference": "5c36cc1ba9bb6abb8a9e425cf054e0c3fd5b9822"
+ "reference": "9cd80396ca58d7969ab44fc7afcf03624dfa526e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nette/utils/zipball/5c36cc1ba9bb6abb8a9e425cf054e0c3fd5b9822",
- "reference": "5c36cc1ba9bb6abb8a9e425cf054e0c3fd5b9822",
+ "url": "https://api.github.com/repos/nette/utils/zipball/9cd80396ca58d7969ab44fc7afcf03624dfa526e",
+ "reference": "9cd80396ca58d7969ab44fc7afcf03624dfa526e",
"shasum": ""
},
"require": {
- "php": ">=7.2 <8.1"
+ "php": ">=7.2 <8.2"
},
"conflict": {
"nette/di": "<3.0.6"
@@ -1350,9 +1354,9 @@
],
"support": {
"issues": "https://github.com/nette/utils/issues",
- "source": "https://github.com/nette/utils/tree/v3.2.3"
+ "source": "https://github.com/nette/utils/tree/v3.2.5"
},
- "time": "2021-08-16T21:05:00+00:00"
+ "time": "2021-09-20T10:50:11+00:00"
},
{
"name": "opis/closure",
@@ -1588,30 +1592,30 @@
},
{
"name": "psr/log",
- "version": "1.1.4",
+ "version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
- "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
+ "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
- "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376",
+ "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376",
"shasum": ""
},
"require": {
- "php": ">=5.3.0"
+ "php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1.x-dev"
+ "dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
- "Psr\\Log\\": "Psr/Log/"
+ "Psr\\Log\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -1632,9 +1636,9 @@
"psr-3"
],
"support": {
- "source": "https://github.com/php-fig/log/tree/1.1.4"
+ "source": "https://github.com/php-fig/log/tree/2.0.0"
},
- "time": "2021-05-03T11:20:27+00:00"
+ "time": "2021-07-14T16:41:46+00:00"
},
{
"name": "psr/simple-cache",
@@ -1768,24 +1772,25 @@
},
{
"name": "ramsey/uuid",
- "version": "4.2.1",
+ "version": "4.2.3",
"source": {
"type": "git",
"url": "https://github.com/ramsey/uuid.git",
- "reference": "fe665a03df4f056aa65af552a96e1976df8c8dae"
+ "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ramsey/uuid/zipball/fe665a03df4f056aa65af552a96e1976df8c8dae",
- "reference": "fe665a03df4f056aa65af552a96e1976df8c8dae",
+ "url": "https://api.github.com/repos/ramsey/uuid/zipball/fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df",
+ "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df",
"shasum": ""
},
"require": {
"brick/math": "^0.8 || ^0.9",
"ext-json": "*",
- "php": "^7.2 || ^8",
+ "php": "^7.2 || ^8.0",
"ramsey/collection": "^1.0",
- "symfony/polyfill-ctype": "^1.8"
+ "symfony/polyfill-ctype": "^1.8",
+ "symfony/polyfill-php80": "^1.14"
},
"replace": {
"rhumsaa/uuid": "self.version"
@@ -1849,7 +1854,7 @@
],
"support": {
"issues": "https://github.com/ramsey/uuid/issues",
- "source": "https://github.com/ramsey/uuid/tree/4.2.1"
+ "source": "https://github.com/ramsey/uuid/tree/4.2.3"
},
"funding": [
{
@@ -1861,7 +1866,7 @@
"type": "tidelift"
}
],
- "time": "2021-08-11T01:06:55+00:00"
+ "time": "2021-09-25T23:10:38+00:00"
},
{
"name": "swiftmailer/swiftmailer",
@@ -4531,21 +4536,21 @@
},
{
"name": "fakerphp/faker",
- "version": "v1.15.0",
+ "version": "v1.16.0",
"source": {
"type": "git",
"url": "https://github.com/FakerPHP/Faker.git",
- "reference": "89c6201c74db25fa759ff16e78a4d8f32547770e"
+ "reference": "271d384d216e5e5c468a6b28feedf95d49f83b35"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/89c6201c74db25fa759ff16e78a4d8f32547770e",
- "reference": "89c6201c74db25fa759ff16e78a4d8f32547770e",
+ "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/271d384d216e5e5c468a6b28feedf95d49f83b35",
+ "reference": "271d384d216e5e5c468a6b28feedf95d49f83b35",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
- "psr/container": "^1.0",
+ "psr/container": "^1.0 || ^2.0",
"symfony/deprecation-contracts": "^2.2"
},
"conflict": {
@@ -4565,7 +4570,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "v1.15-dev"
+ "dev-main": "v1.16-dev"
}
},
"autoload": {
@@ -4590,9 +4595,9 @@
],
"support": {
"issues": "https://github.com/FakerPHP/Faker/issues",
- "source": "https://github.com/FakerPHP/Faker/tree/v1.15.0"
+ "source": "https://github.com/FakerPHP/Faker/tree/v1.16.0"
},
- "time": "2021-07-06T20:39:40+00:00"
+ "time": "2021-09-06T14:53:37+00:00"
},
{
"name": "guzzlehttp/psr7",
@@ -4727,16 +4732,16 @@
},
{
"name": "mockery/mockery",
- "version": "1.4.3",
+ "version": "1.4.4",
"source": {
"type": "git",
"url": "https://github.com/mockery/mockery.git",
- "reference": "d1339f64479af1bee0e82a0413813fe5345a54ea"
+ "reference": "e01123a0e847d52d186c5eb4b9bf58b0c6d00346"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/mockery/mockery/zipball/d1339f64479af1bee0e82a0413813fe5345a54ea",
- "reference": "d1339f64479af1bee0e82a0413813fe5345a54ea",
+ "url": "https://api.github.com/repos/mockery/mockery/zipball/e01123a0e847d52d186c5eb4b9bf58b0c6d00346",
+ "reference": "e01123a0e847d52d186c5eb4b9bf58b0c6d00346",
"shasum": ""
},
"require": {
@@ -4793,9 +4798,9 @@
],
"support": {
"issues": "https://github.com/mockery/mockery/issues",
- "source": "https://github.com/mockery/mockery/tree/1.4.3"
+ "source": "https://github.com/mockery/mockery/tree/1.4.4"
},
- "time": "2021-02-24T09:51:49+00:00"
+ "time": "2021-09-13T15:28:59+00:00"
},
{
"name": "myclabs/deep-copy",
@@ -4857,16 +4862,16 @@
},
{
"name": "nikic/php-parser",
- "version": "v4.12.0",
+ "version": "v4.13.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
- "reference": "6608f01670c3cc5079e18c1dab1104e002579143"
+ "reference": "50953a2691a922aa1769461637869a0a2faa3f53"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143",
- "reference": "6608f01670c3cc5079e18c1dab1104e002579143",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53",
+ "reference": "50953a2691a922aa1769461637869a0a2faa3f53",
"shasum": ""
},
"require": {
@@ -4907,28 +4912,28 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
- "source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0"
+ "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0"
},
- "time": "2021-07-21T10:44:31+00:00"
+ "time": "2021-09-20T12:20:58+00:00"
},
{
"name": "orchestra/testbench",
- "version": "v6.20.1",
+ "version": "v6.21.1",
"source": {
"type": "git",
"url": "https://github.com/orchestral/testbench.git",
- "reference": "986ff30846bca4547cf11ed422511673450dcb02"
+ "reference": "f61383c001a97f0a116b0c58f74385424aa9de33"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/orchestral/testbench/zipball/986ff30846bca4547cf11ed422511673450dcb02",
- "reference": "986ff30846bca4547cf11ed422511673450dcb02",
+ "url": "https://api.github.com/repos/orchestral/testbench/zipball/f61383c001a97f0a116b0c58f74385424aa9de33",
+ "reference": "f61383c001a97f0a116b0c58f74385424aa9de33",
"shasum": ""
},
"require": {
"laravel/framework": "^8.54",
"mockery/mockery": "^1.4.2",
- "orchestra/testbench-core": "^6.24.1",
+ "orchestra/testbench-core": "^6.25.2",
"php": "^7.3 || ^8.0",
"phpunit/phpunit": "^8.4 || ^9.3.3",
"spatie/laravel-ray": "^1.18"
@@ -4962,7 +4967,7 @@
],
"support": {
"issues": "https://github.com/orchestral/testbench/issues",
- "source": "https://github.com/orchestral/testbench/tree/v6.20.1"
+ "source": "https://github.com/orchestral/testbench/tree/v6.21.1"
},
"funding": [
{
@@ -4974,20 +4979,20 @@
"type": "liberapay"
}
],
- "time": "2021-08-25T05:23:48+00:00"
+ "time": "2021-09-18T09:37:03+00:00"
},
{
"name": "orchestra/testbench-core",
- "version": "v6.24.1",
+ "version": "v6.25.2",
"source": {
"type": "git",
"url": "https://github.com/orchestral/testbench-core.git",
- "reference": "0e77a2e62cf9be1e541cb44f65d3ac4774015c87"
+ "reference": "03d8cce6e500a9c64da4cbaa776236c91b2572a1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/0e77a2e62cf9be1e541cb44f65d3ac4774015c87",
- "reference": "0e77a2e62cf9be1e541cb44f65d3ac4774015c87",
+ "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/03d8cce6e500a9c64da4cbaa776236c91b2572a1",
+ "reference": "03d8cce6e500a9c64da4cbaa776236c91b2572a1",
"shasum": ""
},
"require": {
@@ -5024,7 +5029,10 @@
"autoload": {
"psr-4": {
"Orchestra\\Testbench\\": "src/"
- }
+ },
+ "files": [
+ "src/helpers.php"
+ ]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -5061,7 +5069,7 @@
"type": "liberapay"
}
],
- "time": "2021-08-25T05:01:24+00:00"
+ "time": "2021-09-18T01:47:58+00:00"
},
{
"name": "phar-io/manifest",
@@ -5285,16 +5293,16 @@
},
{
"name": "phpdocumentor/type-resolver",
- "version": "1.4.0",
+ "version": "1.5.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
- "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0"
+ "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
- "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
+ "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30f38bffc6f24293dadd1823936372dfa9e86e2f",
+ "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f",
"shasum": ""
},
"require": {
@@ -5302,7 +5310,8 @@
"phpdocumentor/reflection-common": "^2.0"
},
"require-dev": {
- "ext-tokenizer": "*"
+ "ext-tokenizer": "*",
+ "psalm/phar": "^4.8"
},
"type": "library",
"extra": {
@@ -5328,39 +5337,39 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
- "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0"
+ "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.0"
},
- "time": "2020-09-17T18:55:26+00:00"
+ "time": "2021-09-17T15:28:14+00:00"
},
{
"name": "phpspec/prophecy",
- "version": "1.13.0",
+ "version": "1.14.0",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
- "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea"
+ "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea",
- "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e",
+ "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.2",
- "php": "^7.2 || ~8.0, <8.1",
+ "php": "^7.2 || ~8.0, <8.2",
"phpdocumentor/reflection-docblock": "^5.2",
"sebastian/comparator": "^3.0 || ^4.0",
"sebastian/recursion-context": "^3.0 || ^4.0"
},
"require-dev": {
- "phpspec/phpspec": "^6.0",
+ "phpspec/phpspec": "^6.0 || ^7.0",
"phpunit/phpunit": "^8.0 || ^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.11.x-dev"
+ "dev-master": "1.x-dev"
}
},
"autoload": {
@@ -5395,29 +5404,29 @@
],
"support": {
"issues": "https://github.com/phpspec/prophecy/issues",
- "source": "https://github.com/phpspec/prophecy/tree/1.13.0"
+ "source": "https://github.com/phpspec/prophecy/tree/1.14.0"
},
- "time": "2021-03-17T13:42:18+00:00"
+ "time": "2021-09-10T09:02:12+00:00"
},
{
"name": "phpunit/php-code-coverage",
- "version": "9.2.6",
+ "version": "9.2.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "f6293e1b30a2354e8428e004689671b83871edde"
+ "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f6293e1b30a2354e8428e004689671b83871edde",
- "reference": "f6293e1b30a2354e8428e004689671b83871edde",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218",
+ "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*",
- "nikic/php-parser": "^4.10.2",
+ "nikic/php-parser": "^4.12.0",
"php": ">=7.3",
"phpunit/php-file-iterator": "^3.0.3",
"phpunit/php-text-template": "^2.0.2",
@@ -5466,7 +5475,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
- "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.6"
+ "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7"
},
"funding": [
{
@@ -5474,7 +5483,7 @@
"type": "github"
}
],
- "time": "2021-03-28T07:26:59+00:00"
+ "time": "2021-09-17T05:39:03+00:00"
},
{
"name": "phpunit/php-file-iterator",
@@ -5719,16 +5728,16 @@
},
{
"name": "phpunit/phpunit",
- "version": "9.5.9",
+ "version": "9.5.10",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b"
+ "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b",
- "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a",
+ "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a",
"shasum": ""
},
"require": {
@@ -5744,7 +5753,7 @@
"phar-io/version": "^3.0.2",
"php": ">=7.3",
"phpspec/prophecy": "^1.12.1",
- "phpunit/php-code-coverage": "^9.2.3",
+ "phpunit/php-code-coverage": "^9.2.7",
"phpunit/php-file-iterator": "^3.0.5",
"phpunit/php-invoker": "^3.1.1",
"phpunit/php-text-template": "^2.0.3",
@@ -5806,7 +5815,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
- "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.9"
+ "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10"
},
"funding": [
{
@@ -5818,7 +5827,60 @@
"type": "github"
}
],
- "time": "2021-08-31T06:47:40+00:00"
+ "time": "2021-09-25T07:38:51+00:00"
+ },
+ {
+ "name": "pimple/pimple",
+ "version": "v3.4.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/silexphp/Pimple.git",
+ "reference": "86406047271859ffc13424a048541f4531f53601"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/silexphp/Pimple/zipball/86406047271859ffc13424a048541f4531f53601",
+ "reference": "86406047271859ffc13424a048541f4531f53601",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2.5",
+ "psr/container": "^1.1"
+ },
+ "require-dev": {
+ "symfony/phpunit-bridge": "^5.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.4.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Pimple": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ }
+ ],
+ "description": "Pimple, a simple Dependency Injection Container",
+ "homepage": "https://pimple.symfony.com",
+ "keywords": [
+ "container",
+ "dependency injection"
+ ],
+ "support": {
+ "source": "https://github.com/silexphp/Pimple/tree/v3.4.0"
+ },
+ "time": "2021-03-06T08:28:00+00:00"
},
{
"name": "psr/http-factory",
@@ -6825,7 +6887,6 @@
"type": "github"
}
],
- "abandoned": true,
"time": "2020-09-28T06:45:17+00:00"
},
{
@@ -7001,16 +7062,16 @@
},
{
"name": "spatie/laravel-ray",
- "version": "1.25.0",
+ "version": "1.25.2",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-ray.git",
- "reference": "fc36d2f77e7258c0e443e9db1923b725d3ff3c0e"
+ "reference": "9379ed902a42d8909051d9bd5ca05a7329be7b87"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/spatie/laravel-ray/zipball/fc36d2f77e7258c0e443e9db1923b725d3ff3c0e",
- "reference": "fc36d2f77e7258c0e443e9db1923b725d3ff3c0e",
+ "url": "https://api.github.com/repos/spatie/laravel-ray/zipball/9379ed902a42d8909051d9bd5ca05a7329be7b87",
+ "reference": "9379ed902a42d8909051d9bd5ca05a7329be7b87",
"shasum": ""
},
"require": {
@@ -7023,7 +7084,7 @@
"spatie/backtrace": "^1.0",
"spatie/ray": "^1.27.1",
"symfony/stopwatch": "4.2|^5.1",
- "zbateson/mail-mime-parser": "^1.3.1"
+ "zbateson/mail-mime-parser": "^1.3.1|^2.0"
},
"require-dev": {
"facade/ignition": "^2.5",
@@ -7067,7 +7128,7 @@
],
"support": {
"issues": "https://github.com/spatie/laravel-ray/issues",
- "source": "https://github.com/spatie/laravel-ray/tree/1.25.0"
+ "source": "https://github.com/spatie/laravel-ray/tree/1.25.2"
},
"funding": [
{
@@ -7079,24 +7140,24 @@
"type": "other"
}
],
- "time": "2021-08-27T08:41:55+00:00"
+ "time": "2021-09-10T07:21:33+00:00"
},
{
"name": "spatie/macroable",
- "version": "1.0.1",
+ "version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/macroable.git",
- "reference": "7a99549fc001c925714b329220dea680c04bfa48"
+ "reference": "ec2c320f932e730607aff8052c44183cf3ecb072"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/spatie/macroable/zipball/7a99549fc001c925714b329220dea680c04bfa48",
- "reference": "7a99549fc001c925714b329220dea680c04bfa48",
+ "url": "https://api.github.com/repos/spatie/macroable/zipball/ec2c320f932e730607aff8052c44183cf3ecb072",
+ "reference": "ec2c320f932e730607aff8052c44183cf3ecb072",
"shasum": ""
},
"require": {
- "php": "^7.2|^8.0"
+ "php": "^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.3"
@@ -7127,22 +7188,22 @@
],
"support": {
"issues": "https://github.com/spatie/macroable/issues",
- "source": "https://github.com/spatie/macroable/tree/1.0.1"
+ "source": "https://github.com/spatie/macroable/tree/2.0.0"
},
- "time": "2020-11-03T10:15:05+00:00"
+ "time": "2021-03-26T22:39:02+00:00"
},
{
"name": "spatie/ray",
- "version": "1.30.0",
+ "version": "1.30.2",
"source": {
"type": "git",
"url": "https://github.com/spatie/ray.git",
- "reference": "8eff2ec7f7f5a5b74519a052302fcfb274c53b97"
+ "reference": "f6344f8abf3ede60c963d9d3f7f35fb526b6138c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/spatie/ray/zipball/8eff2ec7f7f5a5b74519a052302fcfb274c53b97",
- "reference": "8eff2ec7f7f5a5b74519a052302fcfb274c53b97",
+ "url": "https://api.github.com/repos/spatie/ray/zipball/f6344f8abf3ede60c963d9d3f7f35fb526b6138c",
+ "reference": "f6344f8abf3ede60c963d9d3f7f35fb526b6138c",
"shasum": ""
},
"require": {
@@ -7192,7 +7253,7 @@
],
"support": {
"issues": "https://github.com/spatie/ray/issues",
- "source": "https://github.com/spatie/ray/tree/1.30.0"
+ "source": "https://github.com/spatie/ray/tree/1.30.2"
},
"funding": [
{
@@ -7204,7 +7265,7 @@
"type": "other"
}
],
- "time": "2021-08-20T09:09:05+00:00"
+ "time": "2021-09-10T07:22:57+00:00"
},
{
"name": "symfony/stopwatch",
@@ -7395,27 +7456,28 @@
},
{
"name": "zbateson/mail-mime-parser",
- "version": "1.3.2",
+ "version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/zbateson/mail-mime-parser.git",
- "reference": "8eb590750772849189c7fa30ed52bcdcd2c9d1ef"
+ "reference": "da7b5913052d7b84fe789608761c4915281d0801"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/zbateson/mail-mime-parser/zipball/8eb590750772849189c7fa30ed52bcdcd2c9d1ef",
- "reference": "8eb590750772849189c7fa30ed52bcdcd2c9d1ef",
+ "url": "https://api.github.com/repos/zbateson/mail-mime-parser/zipball/da7b5913052d7b84fe789608761c4915281d0801",
+ "reference": "da7b5913052d7b84fe789608761c4915281d0801",
"shasum": ""
},
"require": {
"guzzlehttp/psr7": "^1.7.0|^2.0",
"php": ">=5.4",
+ "pimple/pimple": "^3.0",
"zbateson/mb-wrapper": "^1.0.1",
"zbateson/stream-decorators": "^1.0.6"
},
"require-dev": {
"mikey179/vfsstream": "^1.6.0",
- "sanmai/phpunit-legacy-adapter": "^6.3 || ^8"
+ "sanmai/phpunit-legacy-adapter": "^6.3 || ^8.2"
},
"suggest": {
"ext-iconv": "For best support/performance",
@@ -7463,7 +7525,7 @@
"type": "github"
}
],
- "time": "2021-07-08T19:06:28+00:00"
+ "time": "2021-08-23T02:13:55+00:00"
},
{
"name": "zbateson/mb-wrapper",
@@ -7595,15 +7657,13 @@
}
],
"aliases": [],
- "minimum-stability": "stable",
+ "minimum-stability": "dev",
"stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^7.4|^8.0",
- "ext-json": "*",
- "ext-soap": "*",
- "ext-openssl": "*"
+ "ext-json": "*"
},
"platform-dev": [],
"plugin-api-version": "2.1.0"
diff --git a/src/Drivers/Novin/Novin.php b/src/Drivers/Novin/Novin.php
index 4d3b622..d4626f9 100644
--- a/src/Drivers/Novin/Novin.php
+++ b/src/Drivers/Novin/Novin.php
@@ -14,20 +14,23 @@
class Novin extends Driver
{
- const BANK_BUY_TRANSACTION_TYPE = 'EN_GOODS';
+ protected const BANK_BUY_TRANSACTION_TYPE = 'EN_GOODS';
private ?string $sessionId = null;
public function purchase(): string
{
$response = $this->callApi($this->getLoginUrl(), $this->getLoginData());
+
if ($response['Result'] == $this->getSuccessResponseStatusCode()) {
$this->sessionId = $response['SessionId'];
} else {
throw new PurchaseFailedException($this->getStatusMessage($response['Result']));
}
+
$purchaseData = $this->getPurchaseData();
$response = $this->callApi($this->getPurchaseUrl(), $purchaseData);
+
if ($response['Result'] == $this->getSuccessResponseStatusCode()) {
$dataToSign = $response['DataToSign'];
$dataUniqueId = $response['UniqueId'];
@@ -55,24 +58,29 @@ public function pay(): RedirectionForm
'Token' => $this->getInvoice()->getToken(),
'Language' => $this->getLanguage()
];
- $payUrl .= ('?token=' . $data['Token'] . '&language=' . $data['Language']);
+ $payUrl .= ('?token='.$data['Token'].'&language='.$data['Language']);
return $this->redirect($payUrl, $data);
}
public function verify(): Receipt
{
- if (!empty(request('State')) and strtoupper(request('State')) !== 'OK') {
+ if (!empty(request('State')) && strtoupper(request('State')) !== 'OK') {
throw new PaymentFailedException('کاربر از انجام تراکنش منصرف شده است.');
}
$verificationData = $this->getVerificationData();
$response = $this->callApi($this->getVerificationUrl(), $verificationData);
- if ($response['Result'] == $this->getSuccessResponseStatusCode() and $response['Amount'] == $this->getInvoice()->getAmount()) {
+ if ($response['Result'] == $this->getSuccessResponseStatusCode() && $response['Amount'] == $this->getInvoice()->getAmount()) {
$this->getInvoice()->setTransactionId(request('RefNum'));
$this->getInvoice()->setInvoiceId(request('ResNum'));
- return new Receipt($this->getInvoice(), request('TraceNo'), request('CustomerRefNum'), request('CardMaskPan'));
+ return new Receipt(
+ $this->getInvoice(),
+ request('TraceNo'),
+ request('CustomerRefNum'),
+ request('CardMaskPan')
+ );
}
throw new PaymentFailedException($this->getStatusMessage($response['Result']));
}
@@ -90,8 +98,8 @@ private function getSignature(string $dataToSign): string
openssl_pkcs7_sign(
$this->getUnsignedDataFilePath(),
$this->getSignedDataFilePath(),
- 'file://' . $this->settings['certificate_path'],
- array('file://' . $this->settings['certificate_path'], $this->settings['certificate_password']),
+ 'file://'.$this->settings['certificate_path'],
+ array('file://'.$this->settings['certificate_path'], $this->settings['certificate_password']),
array(),
PKCS7_NOSIGS
);
@@ -221,17 +229,17 @@ protected function getSuccessResponseStatusCode(): string
protected function getLoginUrl(): string
{
- return $this->getBaseRestServiceUrl() . 'merchantLogin/';
+ return $this->getBaseRestServiceUrl().'merchantLogin/';
}
protected function getPurchaseUrl(): string
{
- return $this->getBaseRestServiceUrl() . 'generateTransactionDataToSign/';
+ return $this->getBaseRestServiceUrl().'generateTransactionDataToSign/';
}
protected function getTokenGenerationUrl(): string
{
- return $this->getBaseRestServiceUrl() . 'generateSignedDataToken/';
+ return $this->getBaseRestServiceUrl().'generateSignedDataToken/';
}
protected function getPaymentUrl(): string
@@ -241,7 +249,7 @@ protected function getPaymentUrl(): string
protected function getVerificationUrl(): string
{
- return $this->getBaseRestServiceUrl() . 'verifyMerchantTrans/';
+ return $this->getBaseRestServiceUrl().'verifyMerchantTrans/';
}
private function getBaseRestServiceUrl(): string
@@ -264,11 +272,11 @@ private function getLanguage(): string
private function checkPhoneNumberFormat(string $phoneNumber): string
{
- if (strlen($phoneNumber) == 12 and Str::startsWith($phoneNumber, '98')) {
+ if (strlen($phoneNumber) === 12 && Str::startsWith($phoneNumber, '98')) {
return Str::replaceFirst('98', '0', $phoneNumber);
}
- if (strlen($phoneNumber) == 10 and Str::startsWith($phoneNumber, '9')) {
- return '0' . $phoneNumber;
+ if (strlen($phoneNumber) === 10 && Str::startsWith($phoneNumber, '9')) {
+ return '0'.$phoneNumber;
}
return $phoneNumber;
@@ -276,11 +284,11 @@ private function checkPhoneNumberFormat(string $phoneNumber): string
private function getUnsignedDataFilePath(): string
{
- return $this->settings['temp_files_dir'] . 'unsigned.txt';
+ return $this->settings['temp_files_dir'].'unsigned.txt';
}
private function getSignedDataFilePath(): string
{
- return $this->settings['temp_files_dir'] . 'signed.txt';
+ return $this->settings['temp_files_dir'].'signed.txt';
}
}
diff --git a/src/Drivers/Pasargad/Helpers/RSA.php b/src/Drivers/Pasargad/Helpers/RSA.php
index 8c5c2bd..1e42a2a 100644
--- a/src/Drivers/Pasargad/Helpers/RSA.php
+++ b/src/Drivers/Pasargad/Helpers/RSA.php
@@ -8,41 +8,41 @@ class RSA
public static function rsaEncrypt($message, $publicKey, $modulus, $keylength)
{
- $padded = RSA::addPKCS1Padding($message, true, $keylength / 8);
- $number = RSA::binaryToNumber($padded);
- $encrypted = RSA::powMod($number, $publicKey, $modulus);
- $result = RSA::numberToBinary($encrypted, $keylength / 8);
- return $result;
+ $padded = self::addPKCS1Padding($message, true, $keylength / 8);
+ $number = self::binaryToNumber($padded);
+ $encrypted = self::powMod($number, $publicKey, $modulus);
+
+ return self::numberToBinary($encrypted, $keylength / 8);
}
public static function rsaDecrypt($message, $privateKey, $modulus, $keylength)
{
- $number = RSA::binaryToNumber($message);
- $decrypted = RSA::powMod($number, $privateKey, $modulus);
- $result = RSA::numberToBinary($decrypted, $keylength / 8);
- return RSA::removePKCS1Padding($result, $keylength / 8);
+ $number = self::binaryToNumber($message);
+ $decrypted = self::powMod($number, $privateKey, $modulus);
+ $result = self::numberToBinary($decrypted, $keylength / 8);
+ return self::removePKCS1Padding($result, $keylength / 8);
}
public static function rsaSign($message, $privateKey, $modulus, $keylength)
{
- $padded = RSA::addPKCS1Padding($message, false, $keylength / 8);
- $number = RSA::binaryToNumber($padded);
- $signed = RSA::powMod($number, $privateKey, $modulus);
- $result = RSA::numberToBinary($signed, $keylength / 8);
- return $result;
+ $padded = self::addPKCS1Padding($message, false, $keylength / 8);
+ $number = self::binaryToNumber($padded);
+ $signed = self::powMod($number, $privateKey, $modulus);
+
+ return self::numberToBinary($signed, $keylength / 8);
}
public static function rsaVerify($message, $publicKey, $modulus, $keylength)
{
- return RSA::rsaDecrypt($message, $publicKey, $modulus, $keylength);
+ return self::rsaDecrypt($message, $publicKey, $modulus, $keylength);
}
public static function rsaKypVerify($message, $publicKey, $modulus, $keylength)
{
- $number = RSA::binaryToNumber($message);
- $decrypted = RSA::powMod($number, $publicKey, $modulus);
- $result = RSA::numberToBinary($decrypted, $keylength / 8);
- return RSA::removeKYPPadding($result, $keylength / 8);
+ $number = self::binaryToNumber($message);
+ $decrypted = self::powMod($number, $publicKey, $modulus);
+ $result = self::numberToBinary($decrypted, $keylength / 8);
+ return self::removeKYPPadding($result, $keylength / 8);
}
public static function powMod($p, $q, $r)
@@ -54,7 +54,7 @@ public static function powMod($p, $q, $r)
$rem = bcmod($div, 2);
$div = bcdiv($div, 2);
if ($rem) {
- array_push($factors, $powerOfTwo);
+ $factors[] = $powerOfTwo;
}
$powerOfTwo++;
}
@@ -67,13 +67,14 @@ public static function powMod($p, $q, $r)
$partRes = bcmod($partRes, $r);
$idx++;
}
- array_push($partialResults, $partRes);
+ $partialResults[] = $partRes;
}
$result = "1";
foreach ($partialResults as $partRes) {
$result = bcmul($result, $partRes);
$result = bcmod($result, $r);
}
+
return $result;
}
diff --git a/src/Drivers/Pasargad/Helpers/RSAProcessor.php b/src/Drivers/Pasargad/Helpers/RSAProcessor.php
index 0aa42d5..bbf3018 100644
--- a/src/Drivers/Pasargad/Helpers/RSAProcessor.php
+++ b/src/Drivers/Pasargad/Helpers/RSAProcessor.php
@@ -7,10 +7,10 @@ class RSAProcessor
public const KEY_TYPE_XML_FILE = 'xml_file';
public const KEY_TYPE_XML_STRING = 'xml_string';
- private $publicKey = null;
- private $privateKey = null;
- private $modulus = null;
- private $keyLength = "1024";
+ private $publicKey;
+ private $privateKey;
+ private $modulus;
+ private $keyLength;
public function __construct($key, $keyType = null)
{
@@ -20,7 +20,7 @@ public function __construct($key, $keyType = null)
if ($keyType == null || $keyType == self::KEY_TYPE_XML_STRING) {
$xmlObject = simplexml_load_string($key);
} elseif ($keyType == self::KEY_TYPE_XML_FILE) {
- $xmlObject = simplexml_load_file($key);
+ $xmlObject = simplexml_load_string(file_get_contents($key));
}
$this->modulus = RSA::binaryToNumber(base64_decode($xmlObject->Modulus));
diff --git a/src/Drivers/Pasargad/Pasargad.php b/src/Drivers/Pasargad/Pasargad.php
index ef22576..f8e863a 100644
--- a/src/Drivers/Pasargad/Pasargad.php
+++ b/src/Drivers/Pasargad/Pasargad.php
@@ -2,18 +2,19 @@
namespace Omalizadeh\MultiPayment\Drivers\Pasargad;
-use Illuminate\Support\Str;
use Illuminate\Support\Facades\Http;
-use Omalizadeh\MultiPayment\RedirectionForm;
+use Illuminate\Support\Str;
use Omalizadeh\MultiPayment\Drivers\Contracts\Driver;
use Omalizadeh\MultiPayment\Drivers\Pasargad\Helpers\RSAProcessor;
+use Omalizadeh\MultiPayment\Exceptions\InvalidConfigurationException;
use Omalizadeh\MultiPayment\Exceptions\PaymentFailedException;
use Omalizadeh\MultiPayment\Exceptions\PurchaseFailedException;
use Omalizadeh\MultiPayment\Receipt;
+use Omalizadeh\MultiPayment\RedirectionForm;
class Pasargad extends Driver
{
- const BANK_BUY_ACTION_CODE = 1003;
+ protected const BANK_BUY_ACTION_CODE = 1003;
public function purchase(): string
{
@@ -77,15 +78,14 @@ public function verify(): Receipt
private function callApi(string $url, array $data)
{
- $body = json_encode($data);
+ $body = json_encode($data, JSON_THROW_ON_ERROR);
$sign = $this->signData($body);
$headers = $this->getRequestHeaders();
$headers = array_merge($headers, [
'Sign' => $sign
]);
- $response = Http::withHeaders($headers)->post($url, $data);
- return $response;
+ return Http::withHeaders($headers)->post($url, $data);
}
private function signData(string $stringifiedData)
@@ -185,10 +185,10 @@ private function getRequestHeaders(): array
private function checkPhoneNumberFormat(string $phoneNumber): string
{
- if (strlen($phoneNumber) == 12 and Str::startsWith($phoneNumber, '98')) {
+ if (strlen($phoneNumber) === 12 && Str::startsWith($phoneNumber, '98')) {
return Str::replaceFirst('98', '', $phoneNumber);
}
- if (strlen($phoneNumber) == 11 and Str::startsWith($phoneNumber, '0')) {
+ if (strlen($phoneNumber) === 11 && Str::startsWith($phoneNumber, '0')) {
return Str::replaceFirst('0', '', $phoneNumber);
}
return $phoneNumber;