From 368d49e6c434bf3441d2152232652e21c5053976 Mon Sep 17 00:00:00 2001 From: woutse Date: Mon, 22 Feb 2021 18:09:53 +0100 Subject: [PATCH] Updated objectinfo --- paynlpaymentmethods/paynlpaymentmethods.php | 28 +++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/paynlpaymentmethods/paynlpaymentmethods.php b/paynlpaymentmethods/paynlpaymentmethods.php index ac12113..1b95c14 100644 --- a/paynlpaymentmethods/paynlpaymentmethods.php +++ b/paynlpaymentmethods/paynlpaymentmethods.php @@ -725,16 +725,7 @@ public function startPayment(Cart $cart, $payment_option_id, $extra_data = array $description = Configuration::get('PAYNL_DESCRIPTION_PREFIX') . $description; } - $object_string = 'prestashop '; - if(isset($this->version) && !empty($this->version)){ - $object_string .= $this->version; - } - if(defined('_PS_VERSION_') && !empty(_PS_VERSION_)){ - $object_string .= ' | ' . _PS_VERSION_; - } - if(defined('PHP_VERSION') && !empty(PHP_VERSION)){ - $object_string .= ' | ' . PHP_VERSION; - } + $startData = array( 'amount' => $cart->getOrderTotal(true, Cart::BOTH, null, null, false), @@ -746,7 +737,7 @@ public function startPayment(Cart $cart, $payment_option_id, $extra_data = array 'testmode' => Configuration::get('PAYNL_TEST_MODE'), 'extra1' => $cart->id, 'products' => $products, - 'object' => substr($object_string, 0, 64), + 'object' => $this->getObjectInfo() ); $addressData = $this->_getAddressData($cart); @@ -798,6 +789,21 @@ public function startPayment(Cart $cart, $payment_option_id, $extra_data = array return $payTransaction->getRedirectUrl(); } + /** + * @return false|string + */ + private function getObjectInfo() + { + $object_string = 'prestashop | '; + $object_string .= !empty($this->version) ? $this->version : '-'; + $object_string .= ' | '; + $object_string .= defined('_PS_VERSION_') ? _PS_VERSION_ : '-'; + $object_string .= ' | '; + $object_string .= substr(phpversion(), 0, 3); + + return substr($object_string, 0, 64); + } + /** * Retrieve the settings of a specific payment with payment_profile_id *