Skip to content

Commit 973124f

Browse files
committed
Merge branch 'release/v1.3.2'
2 parents f9c5a8a + eefb006 commit 973124f

File tree

3 files changed

+43
-9
lines changed

3 files changed

+43
-9
lines changed

README.md

+22-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
**ZarinPal driver for the Omnipay PHP payment processing library**
44

5-
[![Packagist Version](https://img.shields.io/packagist/v/nekofar/omnipay-zarinpal.svg)][1]
6-
[![PHP from Packagist](https://img.shields.io/packagist/php-v/nekofar/omnipay-zarinpal.svg)][1]
7-
[![Travis (.com) branch](https://img.shields.io/travis/com/nekofar/omnipay-zarinpal/master.svg)][3]
8-
[![Codecov](https://img.shields.io/codecov/c/gh/nekofar/omnipay-zarinpal.svg)][4]
9-
[![Packagist](https://img.shields.io/packagist/l/nekofar/omnipay-zarinpal.svg)][2]
10-
[![Twitter: nekofar](https://img.shields.io/twitter/follow/nekofar.svg?style=flat)][7]
5+
[![Packagist Version][icon-packagist]][link-packagist]
6+
[![PHP from Packagist][icon-php-version]][link-packagist]
7+
[![Packagist Downloads][icon-downloads]][link-packagist]
8+
[![Tests Status][icon-workflow]][link-workflow]
9+
[![Coverage Status][icon-coverage]][link-coverage]
10+
[![License][icon-license]][link-license]
11+
[![Twitter: nekofar][icon-twitter]][link-twitter]
1112

1213
[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment
1314
processing library for PHP. This package implements ZarinPal support for Omnipay.
@@ -106,3 +107,18 @@ or better yet, fork the library and submit a pull request.
106107
[5]: https://packagist.org/providers/php-http/client-implementation
107108
[6]: https://zarinpal.com
108109
[7]: https://twitter.com/nekofar
110+
111+
[icon-packagist]: https://img.shields.io/packagist/v/nekofar/omnipay-zarinpal.svg
112+
[icon-php-version]: https://img.shields.io/packagist/php-v/nekofar/omnipay-zarinpal.svg
113+
[icon-workflow]: https://img.shields.io/github/workflow/status/nekofar/omnipay-zarinpal/Tests
114+
[icon-coverage]: https://codecov.io/gh/nekofar/omnipay-zarinpal/graph/badge.svg
115+
[icon-downloads]: https://img.shields.io/packagist/dt/nekofar/omnipay-zarinpal
116+
[icon-license]: https://img.shields.io/github/license/nekofar/omnipay-zarinpal.svg
117+
[icon-twitter]: https://img.shields.io/twitter/follow/nekofar.svg?style=flat
118+
119+
[link-packagist]: https://packagist.org/packages/nekofar/omnipay-zarinpal
120+
[link-twitter]: https://twitter.com/nekofar
121+
[link-coverage]: https://codecov.io/gh/nekofar/omnipay-zarinpal
122+
[link-workflow]: https://github.com/nekofar/omnipay-zarinpal/actions/workflows/tests.yml
123+
[link-coverage]: https://codecov.io/gh/nekofar/omnipay-zarinpal
124+
[link-license]: https://github.com/nekofar/omnipay-zarinpal/blob/master/LICENSE.md

src/Gateway.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ public function setReturnUrl(string $value)
7272
}
7373

7474
/**
75-
* @param array<string, integer|string|float> $params
75+
* @param array<string, integer|string|boolean> $params
7676
*/
7777
public function purchase(array $params = []): RequestInterface
7878
{
7979
return $this->createRequest(PurchaseRequest::class, $params);
8080
}
8181

8282
/**
83-
* @param array<string, integer|string|float> $params
83+
* @param array<string, integer|string|boolean> $params
8484
*/
8585
public function completePurchase(array $params = []): RequestInterface
8686
{

tests/GatewayTest.php

+19-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Omnipay\Tests\GatewayTestCase;
66
use Omnipay\ZarinPal\Gateway;
77
use Omnipay\ZarinPal\Message\AbstractResponse;
8+
use Omnipay\ZarinPal\Message\PurchaseRequest;
89

910
/**
1011
* Class GatewayTest
@@ -18,7 +19,7 @@ class GatewayTest extends GatewayTestCase
1819
protected $gateway;
1920

2021
/**
21-
* @var array<string, integer|string>
22+
* @var array<string, integer|string|boolean>
2223
*/
2324
protected $params;
2425

@@ -113,4 +114,21 @@ public function testCompletePurchaseFailure(): void
113114
self::assertFalse($response->isSuccessful());
114115
self::assertSame('Merchant ID or Acceptor IP is not correct.', $response->getMessage());
115116
}
117+
118+
/**
119+
*
120+
*/
121+
public function testTestMode(): void
122+
{
123+
parent::testTestMode();
124+
125+
$this->setMockHttpResponse('PurchaseSuccess.txt');
126+
127+
$this->params += ['testMode' => true];
128+
129+
/** @var AbstractResponse $response */
130+
$response = $this->gateway->purchase($this->params)->send();
131+
132+
self::assertStringContainsString('sandbox', $response->getRedirectUrl());
133+
}
116134
}

0 commit comments

Comments
 (0)