File tree 3 files changed +46
-0
lines changed
3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Omnipay \Payflow \Message ;
4
+
5
+ /**
6
+ * Payflow Void Request
7
+ */
8
+ class VoidRequest extends AuthorizeRequest
9
+ {
10
+ protected $ action = 'V ' ;
11
+
12
+ /**
13
+ * Void prevents transactions from being settled.
14
+ *
15
+ * @return array ... the data Payflow needs to void a transaction
16
+ * @throws \Omnipay\Common\Exception\InvalidRequestException
17
+ */
18
+ public function getData ()
19
+ {
20
+ $ this ->validate ('transactionReference ' );
21
+
22
+ $ data = $ this ->getBaseData ();
23
+ $ data ['ORIGID ' ] = $ this ->getTransactionReference ();
24
+
25
+ return $ data ;
26
+ }
27
+ }
Original file line number Diff line number Diff line change @@ -90,4 +90,9 @@ public function refund(array $parameters = array())
90
90
{
91
91
return $ this ->createRequest ('\Omnipay\Payflow\Message\RefundRequest ' , $ parameters );
92
92
}
93
+
94
+ public function void (array $ parameters = array ())
95
+ {
96
+ return $ this ->createRequest ('\Omnipay\Payflow\Message\VoidRequest ' , $ parameters );
97
+ }
93
98
}
Original file line number Diff line number Diff line change @@ -95,4 +95,18 @@ public function testRefund()
95
95
$ this ->assertTrue ($ response ->isSuccessful ());
96
96
$ this ->assertEquals ('A10A6AE7042E ' , $ response ->getTransactionReference ());
97
97
}
98
+
99
+ public function testVoid ()
100
+ {
101
+ $ options = array (
102
+ 'transactionReference ' => 'abc123 ' ,
103
+ );
104
+
105
+ $ this ->setMockHttpResponse ('PurchaseSuccess.txt ' );
106
+
107
+ $ response = $ this ->gateway ->void ($ options )->send ();
108
+
109
+ $ this ->assertTrue ($ response ->isSuccessful ());
110
+ $ this ->assertEquals ('A10A6AE7042E ' , $ response ->getTransactionReference ());
111
+ }
98
112
}
You can’t perform that action at this time.
0 commit comments