@@ -21,7 +21,7 @@ class FetchTransactionRequest extends AbstractRequest
21
21
* Get the data for this request.
22
22
*
23
23
* @throws InvalidRequestException
24
- * @return string request data
24
+ * @return string request data
25
25
*/
26
26
public function getData ()
27
27
{
@@ -56,9 +56,17 @@ public function getData()
56
56
$ document ->createElement ('q0:QueryBySVSTransactionIDRequest ' )
57
57
);
58
58
59
- $ request ->appendChild ($ document ->createElement ('q0:MerchantID ' , $ this ->getMerchantId ()));
60
- $ request ->appendChild ($ document ->createElement ('q0:MerchantPassword ' , $ this ->getMerchantPassword ()));
61
- $ request ->appendChild ($ document ->createElement ('q0:SVSTxID ' , $ transactionReference ));
59
+ $ request ->appendChild (
60
+ $ document ->createElement ('q0:MerchantID ' , $ this ->getMerchantId ())
61
+ );
62
+
63
+ $ request ->appendChild (
64
+ $ document ->createElement ('q0:MerchantPassword ' , $ this ->getMerchantPassword ())
65
+ );
66
+
67
+ $ request ->appendChild (
68
+ $ document ->createElement ('q0:SVSTxID ' , $ transactionReference )
69
+ );
62
70
63
71
} elseif ($ transactionId = $ this ->getTransactionId ()) {
64
72
@@ -70,9 +78,17 @@ public function getData()
70
78
$ document ->createElement ('q0:QueryByCustomerTransactionIDRequest ' )
71
79
);
72
80
73
- $ request ->appendChild ($ document ->createElement ('q0:MerchantID ' , $ this ->getMerchantId ()));
74
- $ request ->appendChild ($ document ->createElement ('q0:MerchantPassword ' , $ this ->getMerchantPassword ()));
75
- $ request ->appendChild ($ document ->createElement ('q0:TxID ' , $ transactionId ));
81
+ $ request ->appendChild (
82
+ $ document ->createElement ('q0:MerchantID ' , $ this ->getMerchantId ())
83
+ );
84
+
85
+ $ request ->appendChild (
86
+ $ document ->createElement ('q0:MerchantPassword ' , $ this ->getMerchantPassword ())
87
+ );
88
+
89
+ $ request ->appendChild (
90
+ $ document ->createElement ('q0:TxID ' , $ transactionId )
91
+ );
76
92
77
93
} else {
78
94
@@ -87,7 +103,7 @@ public function getData()
87
103
/**
88
104
* Send the request with specified data
89
105
*
90
- * @param mixed $data The data to send
106
+ * @param mixed $data The data to send
91
107
* @throws InvalidResponseException
92
108
* @throws InvalidRequestException
93
109
* @return FetchTransactionResponse
@@ -109,14 +125,16 @@ public function sendData($data)
109
125
->children ('http://www.ecocard.com/merchantAPI/ ' );
110
126
111
127
if (!isset ($ xmlResponse ->QueryBySVSTransactionIDResponse )) {
112
- throw new InvalidResponseException ('Missing "QueryBySVSTransactionIDResponse" element in XML response ' );
128
+ throw new InvalidResponseException ('Missing element in XML response ' );
113
129
}
114
130
115
131
if (!isset ($ xmlResponse ->QueryBySVSTransactionIDResponse ->TransactionResponse )) {
116
- throw new InvalidResponseException ('Missing "QueryBySVSTransactionIDResponse/TransactionResponse" element in XML response ' );
132
+ throw new InvalidResponseException ('Missing element in XML response ' );
117
133
}
118
134
119
- return new FetchTransactionResponse ($ this , $ xmlResponse ->QueryBySVSTransactionIDResponse ->TransactionResponse );
135
+ return new FetchTransactionResponse ($ this , $ xmlResponse
136
+ ->QueryBySVSTransactionIDResponse
137
+ ->TransactionResponse );
120
138
121
139
} elseif (strpos ($ data , 'QueryByCustomerTransactionID ' ) !== false ) {
122
140
@@ -132,14 +150,16 @@ public function sendData($data)
132
150
->children ('http://www.ecocard.com/merchantAPI/ ' );
133
151
134
152
if (!isset ($ xmlResponse ->QueryByCustomerTransactionIDResponse )) {
135
- throw new InvalidResponseException ('Missing "QueryByCustomerTransactionIDResponse" element in XML response ' );
153
+ throw new InvalidResponseException ('Missing element in XML response ' );
136
154
}
137
155
138
156
if (!isset ($ xmlResponse ->QueryByCustomerTransactionIDResponse ->TransactionResponse )) {
139
- throw new InvalidResponseException ('Missing "QueryByCustomerTransactionIDResponse/TransactionResponse" element in XML response ' );
157
+ throw new InvalidResponseException ('Missing element in XML response ' );
140
158
}
141
159
142
- return new FetchTransactionResponse ($ this , $ xmlResponse ->QueryByCustomerTransactionIDResponse ->TransactionResponse );
160
+ return new FetchTransactionResponse ($ this , $ xmlResponse
161
+ ->QueryByCustomerTransactionIDResponse
162
+ ->TransactionResponse );
143
163
144
164
} else {
145
165
0 commit comments