@@ -242,6 +242,18 @@ protected function getTransactionHash(): string
242242 $ this ->getSecurityHash ())));
243243 }
244244
245+ /**
246+ * @return string
247+ */
248+ protected function getCompletePurchaseTransactionHash (): string
249+ {
250+ return strtoupper (SHA1 (sprintf ('%s%s%s%s ' ,
251+ $ this ->getOrderId (),
252+ $ this ->getTerminalId (),
253+ $ this ->getAmountInteger (),
254+ $ this ->getSecurityHash ())));
255+ }
256+
245257 /**
246258 * @return string
247259 */
@@ -259,10 +271,7 @@ protected function getRefundOrVoidHash(): string
259271 */
260272 protected function getSalesRequestParams (): array
261273 {
262- $ data ['Version ' ] = $ this ->version ;
263- $ data ['Mode ' ] = $ this ->getTestMode () ? 'TEST ' : 'PROD ' ;
264-
265-
274+ $ data = $ this ->getInfo ();
266275 $ data ['Card ' ] = array (
267276 'Number ' => $ this ->getCard ()->getNumber (),
268277 'ExpireDate ' => $ this ->getCard ()->getExpiryDate ('my ' ),
@@ -298,13 +307,44 @@ protected function getSalesRequestParams(): array
298307 return $ data ;
299308 }
300309
310+ /**
311+ * @return array
312+ */
313+ protected function getCompleteSalesRequestParams (): array
314+ {
315+ $ data = $ this ->getInfo ();
316+ $ data ['Order ' ] = array (
317+ 'OrderID ' => $ this ->getOrderId ()
318+ );
319+
320+ $ data ['Customer ' ] = array (
321+ 'IPAddress ' => $ this ->getClientIp (),
322+ );
323+
324+ $ data ['Terminal ' ] = [
325+ 'ProvUserID ' => $ this ->getUserName (),
326+ 'HashData ' => $ this ->getCompletePurchaseTransactionHash (),
327+ 'UserID ' => $ this ->getUserName (),
328+ 'ID ' => $ this ->getTerminalId (),
329+ 'MerchantID ' => $ this ->getMerchantId ()
330+ ];
331+
332+ $ data ['Transaction ' ] = array (
333+ 'Type ' => 'sales ' ,
334+ 'Amount ' => $ this ->getAmountInteger (),
335+ 'CurrencyCode ' => $ this ->currency_list [$ this ->getCurrency ()],
336+ 'MotoInd ' => "N "
337+ );
338+
339+ return $ data ;
340+ }
341+
301342 /**
302343 * @return array
303344 */
304345 protected function getAuthorizeRequestParams (): array
305346 {
306- $ data ['Version ' ] = $ this ->version ;
307- $ data ['Mode ' ] = $ this ->getTestMode () ? 'TEST ' : 'PROD ' ;
347+ $ data = $ this ->getInfo ();
308348 $ data ['Terminal ' ] = [
309349 'ProvUserID ' => $ this ->getUserName (),
310350 'HashData ' => $ this ->getTransactionHash (),
@@ -377,4 +417,15 @@ private function getSecurityHash(): string
377417
378418 return strtoupper (SHA1 (sprintf ('%s%s ' , $ this ->getPassword (), $ terminalId )));
379419 }
420+
421+ /**
422+ * @return array
423+ */
424+ private function getInfo (): array
425+ {
426+ $ data ['Version ' ] = $ this ->version ;
427+ $ data ['Mode ' ] = $ this ->getTestMode () ? 'TEST ' : 'PROD ' ;
428+
429+ return $ data ;
430+ }
380431}
0 commit comments