@@ -231,43 +231,38 @@ protected function getHttpMethod(): string
231231
232232 /**
233233 * @return string
234+ * @throws \Omnipay\Common\Exception\InvalidRequestException
234235 */
235236 protected function getTransactionHash (): string
236237 {
238+ $ amount = (int )$ this ->getAmount ();
239+
237240 return strtoupper (SHA1 (sprintf ('%s%s%s%s%s ' ,
238241 $ this ->getOrderId (),
239242 $ this ->getTerminalId (),
240243 $ this ->getCard ()->getNumber (),
241- $ this -> getAmountInteger () ,
244+ $ amount ,
242245 $ this ->getSecurityHash ())));
243246 }
244247
245248 /**
246249 * @return string
250+ * @throws \Omnipay\Common\Exception\InvalidRequestException
247251 */
248- protected function getCompletePurchaseTransactionHash (): string
252+ protected function getTransactionHashWithoutCardNumber (): string
249253 {
250- return strtoupper (SHA1 (sprintf ('%s%s%s%s ' ,
251- $ this ->getOrderId (),
252- $ this ->getTerminalId (),
253- $ this ->getAmountInteger (),
254- $ this ->getSecurityHash ())));
255- }
254+ $ amount = (int )$ this ->getAmount ();
256255
257- /**
258- * @return string
259- */
260- protected function getRefundOrVoidHash (): string
261- {
262256 return strtoupper (SHA1 (sprintf ('%s%s%s%s ' ,
263257 $ this ->getOrderId (),
264258 $ this ->getTerminalId (),
265- $ this -> getAmountInteger () ,
259+ $ amount ,
266260 $ this ->getSecurityHash ())));
267261 }
268262
269263 /**
270264 * @return array
265+ * @throws \Omnipay\Common\Exception\InvalidRequestException
271266 */
272267 protected function getSalesRequestParams (): array
273268 {
@@ -298,7 +293,7 @@ protected function getSalesRequestParams(): array
298293 $ data ['Transaction ' ] = array (
299294 'Type ' => 'sales ' ,
300295 'InstallmentCnt ' => $ this ->getInstallment (),
301- 'Amount ' => $ this ->getAmountInteger (),
296+ 'Amount ' => ( int ) $ this ->getAmount (),
302297 'CurrencyCode ' => $ this ->currency_list [$ this ->getCurrency ()],
303298 'CardholderPresentCode ' => "0 " ,
304299 'MotoInd ' => "N "
@@ -307,11 +302,14 @@ protected function getSalesRequestParams(): array
307302 return $ data ;
308303 }
309304
305+
310306 /**
311307 * @return array
308+ * @throws \Omnipay\Common\Exception\InvalidRequestException
312309 */
313310 protected function getCompleteSalesRequestParams (): array
314311 {
312+
315313 $ data = $ this ->getInfo ();
316314 $ data ['Order ' ] = array (
317315 'OrderID ' => $ this ->getOrderId ()
@@ -323,15 +321,15 @@ protected function getCompleteSalesRequestParams(): array
323321
324322 $ data ['Terminal ' ] = [
325323 'ProvUserID ' => $ this ->getUserName (),
326- 'HashData ' => $ this ->getCompletePurchaseTransactionHash (),
324+ 'HashData ' => $ this ->getTransactionHashWithoutCardNumber (),
327325 'UserID ' => $ this ->getUserName (),
328326 'ID ' => $ this ->getTerminalId (),
329327 'MerchantID ' => $ this ->getMerchantId ()
330328 ];
331329
332330 $ data ['Transaction ' ] = array (
333331 'Type ' => 'sales ' ,
334- 'Amount ' => $ this ->getAmountInteger (),
332+ 'Amount ' => ( int ) $ this ->getAmount (),
335333 'CurrencyCode ' => $ this ->currency_list [$ this ->getCurrency ()],
336334 'MotoInd ' => "N "
337335 );
@@ -341,6 +339,7 @@ protected function getCompleteSalesRequestParams(): array
341339
342340 /**
343341 * @return array
342+ * @throws \Omnipay\Common\Exception\InvalidRequestException
344343 */
345344 protected function getAuthorizeRequestParams (): array
346345 {
@@ -366,7 +365,7 @@ protected function getAuthorizeRequestParams(): array
366365 $ data ['Transaction ' ] = array (
367366 'Type ' => 'preauth ' ,
368367 'InstallmentCnt ' => $ this ->getInstallment (),
369- 'Amount ' => $ this ->getAmountInteger (),
368+ 'Amount ' => ( int ) $ this ->getAmount (),
370369 'CurrencyCode ' => $ this ->currency_list [$ this ->getCurrency ()],
371370 'CardholderPresentCode ' => "0 " ,
372371 'MotoInd ' => "N "
@@ -377,6 +376,7 @@ protected function getAuthorizeRequestParams(): array
377376
378377 /**
379378 * @return array
379+ * @throws \Omnipay\Common\Exception\InvalidRequestException
380380 */
381381 protected function getSalesRequestParamsFor3d (): array
382382 {
@@ -387,7 +387,7 @@ protected function getSalesRequestParamsFor3d(): array
387387 $ params ['terminalid ' ] = $ this ->getTerminalId ();
388388 $ params ['terminalmerchantid ' ] = $ this ->getMerchantId ();
389389 $ params ['txntype ' ] = 'sales ' ;
390- $ params ['txnamount ' ] = $ this ->getAmountInteger ();
390+ $ params ['txnamount ' ] = ( int ) $ this ->getAmount ();
391391 $ params ['txncurrencycode ' ] = $ this ->currency_list [$ this ->getCurrency ()];
392392 $ params ['txninstallmentcount ' ] = $ this ->getInstallment ();
393393 $ params ['customeremailaddress ' ] = $ this ->getCard ()->getEmail ();
0 commit comments