8000 returnUrl, cancelUrl and notifyUrl added for API 2.0.6 · dercoder/omnipay-ecopayz@b45ee81 · GitHub
[go: up one dir, main page]

Skip to content

Commit b45ee81

Browse files
committed
returnUrl, cancelUrl and notifyUrl added for API 2.0.6
1 parent 583cfee commit b45ee81

File tree

8 files changed

+39
-5
lines changed

8 files changed

+39
-5
lines changed

.coveralls.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
coverage_clover: ./clover.xml
2+
json_path: ./coveralls-upload.json

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ php:
55
- 5.4
66
- 5.5
77
- 5.6
8+
- 7.0
89
- hhvm
910

1011
before_script:
1112
- composer install -n --dev --prefer-source
1213

1314
script: vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpunit --coverage-text
15+
16+
after_script: vendor/bin/coveralls -v

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
**Ecopayz driver for the Omnipay PHP payment processing library**
44

55
[![Build Status](https://travis-ci.org/dercoder/omnipay-ecopayz.png?branch=master)](https://travis-ci.org/dercoder/omnipay-ecopayz)
6+
[![Coverage Status](https://coveralls.io/repos/dercoder/omnipay-ecopayz/badge.svg?branch=master&service=github)](https://coveralls.io/github/dercoder/omnipay-ecopayz?branch=master)
67
[![Dependency St 10000 atus](https://www.versioneye.com/user/projects/54366b4be993e89c45000137/badge.png)](https://www.versioneye.com/user/projects/54366b4be993e89c45000137)
78

89
[![Latest Stable Version](https://poser.pugx.org/dercoder/omnipay-ecopayz/v/stable.png)](https://packagist.org/packages/dercoder/omnipay-ecopayz)

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"omnipay/common": "~2.3"
2020
},
2121
"require-dev": {
22-
"omnipay/tests": "~2.0"
22+
"omnipay/tests": "~2.0",
23+
"satooshi/php-coveralls": "1.0.0"
2324
},
2425
"extra": {
2526
"branch-alias": {

src/Omnipay/Ecopayz/Message/PurchaseRequest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @author Alexander Fedra <contact@dercoder.at>
1313
* @copyright 2015 DerCoder
1414
* @license http://opensource.org/licenses/mit-license.php MIT
15-
* @version 2.0.3 Ecopayz API Specification
15+
* @version 2.0.6 Ecopayz API Specification
1616
*/
1717
class PurchaseRequest extends AbstractRequest
1818
{
@@ -65,8 +65,20 @@ public function getData()
6565
$data['Amount'] = $this->getAmount();
6666
$data['Currency'] = $this->getCurrency();
6767
$data['MerchantFreeText'] = $this->getDescription();
68-
$data['Checksum'] = $this->calculateArrayChecksum($data);
6968

69+
if ($returnUrl = $this->getReturnUrl()) {
70+
$data['OnSuccessUrl'] = $returnUrl;
71+
}
72+
73+
if ($cancelUrl = $this->getCancelUrl()) {
74+
$data['OnFailureUrl'] = $cancelUrl;
75+
}
76+
77+
if ($notifyUrl = $this->getNotifyUrl()) {
78+
$data['TransferUrl'] = $notifyUrl;
79+
}
80+
81+
$data['Checksum'] = $this->calculateArrayChecksum($data);
7082
return $data;
7183
}
7284

tests/Omnipay/Ecopayz/Message/FetchTransactionResponseTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function testSuccess()
3737
$this->assertSame('OK', $response->getMessage());
3838
$this->assertSame('2064', $response->getTransactionId());
3939
$this->assertSame('1865010000008316336', $response->getTransactionReference());
40+
$this->assertSame('', $response->getTransactionDescription());
4041
$this->assertSame('7.91', $response->getAmount());
4142
$this->assertSame('EUR', $response->getCurrency());
4243
$this->assertSame('110355', $response->getMerchantAccountNumber());

tests/Omnipay/Ecopayz/Message/PurchaseRequestTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ public function setUp()
1818
'transactionId' => 'TX4567890',
1919
'description' => 'Free Text Description',
2020
'amount' => '12.34',
21-
'currency' => 'EUR'
21+
'currency' => 'EUR',
22+
'returnUrl' => 'http://example.com/return',
23+
'cancelUrl' => 'http://example.com/cancel',
24+
'notifyUrl' => 'http://example.com/notify',
2225
));
2326
}
2427

@@ -33,6 +36,16 @@ public function testGetData()
3336
$this->assertSame('12.34', $data['Amount']);
3437
$this->assertSame('EUR', $data['Currency']);
3538
$this->assertSame('Free Text Description', $data['MerchantFreeText']);
36-
$this->assertSame('84bbad2a636aa9226c03f17ff813a181', $data['Checksum']);
39+
$this->assertSame('7320d93a3daa1e296f56fa7f40d6fb8b', $data['Checksum']);
40+
$this->assertSame('http://example.com/return', $data['OnSuccessUrl']);
41+
$this->assertSame('http://example.com/cancel', $data['OnFailureUrl']);
42+
$this->assertSame('http://example.com/notify', $data['TransferUrl']);
43+
}
44+
45+
public function testSendData()
46+
{
47+
$data = $this->request->getData();
48+
$response = $this->request->sendData($data);
49+
$this->assertSame('Omnipay\Ecopayz\Message\PurchaseResponse', get_class($response));
3750
}
3851
}

tests/Omnipay/Ecopayz/Message/PurchaseResponseTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public function testResult()
1919
));
2020

2121
$this->assertFalse($response->isSuccessful());
22+
$this->assertTrue($response->isRedirect());
2223
$this->assertNull($response->getCode());
2324
$this->assertNull($response->getMessage());
2425
$this->assertSame('https://secure.ecopayz.com/PrivateArea/WithdrawOnlineTransfer.aspx?PaymentPageID=100&MerchantAccountNumber=100001&CustomerIdAtMerchant=1123456789&TxID=TX4567890&Amount=12.34&Currency=EUR&MerchantFreeText=Free+Text+Description&Checksum=84bbad2a636aa9226c03f17ff813a181', $response->getRedirectUrl());

0 commit comments

Comments
 (0)
0