@@ -21,7 +21,7 @@ class FetchTransactionRequest extends AbstractRequest
2121 * Get the data for this request.
2222 *
2323 * @throws InvalidRequestException
24- * @return string request data
24+ * @return string request data
2525 */
2626 public function getData ()
2727 {
@@ -56,9 +56,17 @@ public function getData()
5656 $ document ->createElement ('q0:QueryBySVSTransactionIDRequest ' )
5757 );
5858
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+ );
6270
6371 } elseif ($ transactionId = $ this ->getTransactionId ()) {
6472
@@ -70,9 +78,17 @@ public function getData()
7078 $ document ->createElement ('q0:QueryByCustomerTransactionIDRequest ' )
7179 );
7280
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+ );
7692
7793 } else {
7894
@@ -87,7 +103,7 @@ public function getData()
87103 /**
88104 * Send the request with specified data
89105 *
90- * @param mixed $data The data to send
106+ * @param mixed $data The data to send
91107 * @throws InvalidResponseException
92108 * @throws InvalidRequestException
93109 * @return FetchTransactionResponse
@@ -109,14 +125,16 @@ public function sendData($data)
109125 ->children ('http://www.ecocard.com/merchantAPI/ ' );
110126
111127 if (!isset ($ xmlResponse ->QueryBySVSTransactionIDResponse )) {
112- throw new InvalidResponseException ('Missing "QueryBySVSTransactionIDResponse" element in XML response ' );
128+ throw new InvalidResponseException ('Missing element in XML response ' );
113129 }
114130
115131 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 ' );
117133 }
118134
119- return new FetchTransactionResponse ($ this , $ xmlResponse ->QueryBySVSTransactionIDResponse ->TransactionResponse );
135+ return new FetchTransactionResponse ($ this , $ xmlResponse
136+ ->QueryBySVSTransactionIDResponse
137+ ->TransactionResponse );
120138
121139 } elseif (strpos ($ data , 'QueryByCustomerTransactionID ' ) !== false ) {
122140
@@ -132,14 +150,16 @@ public function sendData($data)
132150 ->children ('http://www.ecocard.com/merchantAPI/ ' );
133151
134152 if (!isset ($ xmlResponse ->QueryByCustomerTransactionIDResponse )) {
135- throw new InvalidResponseException ('Missing "QueryByCustomerTransactionIDResponse" element in XML response ' );
153+ throw new InvalidResponseException ('Missing element in XML response ' );
136154 }
137155
138156 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 ' );
140158 }
141159
142- return new FetchTransactionResponse ($ this , $ xmlResponse ->QueryByCustomerTransactionIDResponse ->TransactionResponse );
160+ return new FetchTransactionResponse ($ this , $ xmlResponse
161+ ->QueryByCustomerTransactionIDResponse
162+ ->TransactionResponse );
143163
144164 } else {
145165
0 commit comments