|
| 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