Skip to content

Commit f2cb03d

Browse files
committed
Fix SagePay getService not returning correct value. Closes #117 Closes #118
1 parent 03e4b79 commit f2cb03d

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

src/Omnipay/SagePay/Message/AbstractRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function setSimulatorMode($value)
4242

4343
public function getService()
4444
{
45-
return $this->getParameter('action');
45+
return $this->action;
4646
}
4747

4848
protected function getBaseData()
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Omnipay package.
5+
*
6+
* (c) Adrian Macneil <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Omnipay\SagePay\Message;
13+
14+
use Omnipay\TestCase;
15+
16+
class RefundRequestTest extends TestCase
17+
{
18+
public function setUp()
19+
{
20+
parent::setUp();
21+
22+
$this->request = new RefundRequest($this->getHttpClient(), $this->getHttpRequest());
23+
$this->request->initialize(
24+
array(
25+
'amount' => '12.00',
26+
'transactionReference' => '{"SecurityKey":"JEUPDN1N7E","TxAuthNo":"4255","VPSTxId":"{F955C22E-F67B-4DA3-8EA3-6DAC68FA59D2}","VendorTxCode":"438791"}',
27+
'testMode' => true,
28+
)
29+
);
30+
}
31+
32+
public function testGetData()
33+
{
34+
$data = $this->request->getData();
35+
36+
$this->assertSame('REFUND', $data['TxType']);
37+
$this->assertSame('12.00', $data['Amount']);
38+
$this->assertSame('438791', $data['RelatedVendorTxCode']);
39+
$this->assertSame('{F955C22E-F67B-4DA3-8EA3-6DAC68FA59D2}', $data['RelatedVPSTxId']);
40+
$this->assertSame('JEUPDN1N7E', $data['RelatedSecurityKey']);
41+
$this->assertSame('4255', $data['RelatedTxAuthNo']);
42+
}
43+
44+
public function testGetEndpoint()
45+
{
46+
$url = $this->request->getEndpoint();
47+
48+
$this->assertSame('https://test.sagepay.com/gateway/service/refund.vsp', $url);
49+
}
50+
}

0 commit comments

Comments
 (0)