File tree Expand file tree Collapse file tree 2 files changed +36
-6
lines changed
src/Omnipay/Paysafecard/Message
tests/Omnipay/Paysafecard/Message Expand file tree Collapse file tree 2 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -66,10 +66,6 @@ public function getData()
66
66
'amount '
67
67
);
68
68
69
- if ($ this ->getDispositionState () !== 'S ' ) {
70
- throw new InvalidRequestException ('Transaction state must be "Disposed" ' );
71
- }
72
-
73
69
$ document = new \DOMDocument ('1.0 ' , 'utf-8 ' );
74
70
$ document ->formatOutput = false ;
75
71
$ document ->createElement ('soapenv:Header ' );
@@ -118,7 +114,10 @@ public function getData()
118
114
return $ document ->saveXML ();
119
115
}
120
116
121
- protected function getDispositionState ()
117
+ /**
118
+ * {@inheritdoc}
119
+ */
120
+ public function sendData ($ data )
122
121
{
123
122
if (!$ this ->fetchTransaction ) {
124
123
$ this ->fetchTransaction = new FetchTransactionRequest ($ this ->httpClient , $ this ->httpRequest );
@@ -134,7 +133,11 @@ protected function getDispositionState()
134
133
'amount ' => $ this ->getAmount (),
135
134
))->send ();
136
135
137
- return $ response ->getDispositionState ();
136
+ if ($ response ->getDispositionState () !== 'S ' ) {
137
+ return $ response ;
138
+ }
139
+
140
+ return parent ::sendData ($ data );
138
141
}
139
142
140
143
/**
Original file line number Diff line number Diff line change @@ -103,4 +103,31 @@ public function testSendData()
103
103
$ response = $ this ->request ->sendData ($ data );
104
104
$ this ->assertSame ('Omnipay\Paysafecard\Message\CompletePurchaseResponse ' , get_class ($ response ));
105
105
}
106
+
107
+ public function testSendInvalidData ()
108
+ {
109
+ $ httpResponse = $ this ->getMockHttpResponse ('FetchTransactionSuccess.txt ' );
110
+
111
+ $ mockPlugin = new \Guzzle \Plugin \Mock \MockPlugin ();
112
+ $ mockPlugin ->addResponse ($ httpResponse );
113
+
114
+ $ httpClient = new HttpClient ();
115
+ $ httpClient ->addSubscriber ($ mockPlugin );
116
+
117
+ $ request = new CompletePurchaseRequest ($ httpClient , new HttpRequest ());
118
+ $ response = $ request ->initialize (array (
119
+ 'username ' => 'SOAP_USERNAME ' ,
120
+ 'password ' => 'oJ2rHLBVSbD5iGfT ' ,
121
+ 'transactionId ' => 'TX9997888 ' ,
122
+ 'SubId ' => 'shop1 ' ,
123
+ 'amount ' => '1.00 ' ,
124
+ 'currency ' => 'EUR '
125
+ ))->send ();
126
+
127
+ $ this ->assertSame ('Omnipay\Paysafecard\Message\FetchTransactionResponse ' , get_class ($ response ));
128
+ $ this ->assertTrue ($ response ->isSuccessful ());
129
+ $ this ->assertSame (0 , $ response ->getCode ());
130
+ $ this ->assertSame ('Consumed ' , $ response ->getMessage ());
131
+ $ this ->assertSame ('9922921184073520;1.00 ' , $ response ->getSerialNumbers ());
132
+ }
106
133
}
You can’t perform that action at this time.
0 commit comments