From 8293c9ffe244cf7cb939bd030b17e94c41652081 Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Wed, 12 Jun 2024 10:01:19 +0200 Subject: [PATCH 01/17] update version --- buckaroo3.php | 4 ++-- config.xml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/buckaroo3.php b/buckaroo3.php index bcde1aef..ec68eb9c 100644 --- a/buckaroo3.php +++ b/buckaroo3.php @@ -56,7 +56,7 @@ private function initializeModuleInfo() { $this->name = 'buckaroo3'; $this->tab = 'payments_gateways'; - $this->version = '4.2.0'; + $this->version = '4.2.1'; $this->author = 'Buckaroo'; $this->need_instance = 1; $this->bootstrap = true; @@ -84,7 +84,7 @@ private function initializeDisplayName() } elseif (isset($response->status) && $response->status > 0) { $this->displayName = (new RawPaymentMethodRepository())->getPaymentMethodsLabel($response->payment_method); } else { - $this->displayName = $this->l('Buckaroo Payments (v 4.2.0)'); + $this->displayName = $this->l('Buckaroo Payments (v 4.2.1)'); } } } diff --git a/config.xml b/config.xml index 47aafb5e..d7560f49 100644 --- a/config.xml +++ b/config.xml @@ -1,9 +1,9 @@ buckaroo3 - - - + + + From ed41b2f16c000945134844941c0a4575faebf751 Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Wed, 12 Jun 2024 11:20:27 +0200 Subject: [PATCH 02/17] fix upgrade file --- upgrade/upgrade-4.2.1.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/upgrade/upgrade-4.2.1.php b/upgrade/upgrade-4.2.1.php index a51bc54b..18c736e7 100644 --- a/upgrade/upgrade-4.2.1.php +++ b/upgrade/upgrade-4.2.1.php @@ -41,16 +41,20 @@ function upgrade_module_4_2_1($object) Db::getInstance()->execute($createTableQuery); - // Move data from old table to new table - $moveDataQuery = 'INSERT INTO `' . _DB_PREFIX_ . 'bk_buckaroo_fee` (reference, id_cart, buckaroo_fee_tax_incl, buckaroo_fee_tax_excl, currency, created_at) - SELECT reference, id_cart, buckaroo_fee, buckaroo_fee, currency, created_at - FROM `' . _DB_PREFIX_ . 'buckaroo_fee`'; + // Check if the old table exists + $tableExists = Db::getInstance()->executeS('SHOW TABLES LIKE "' . _DB_PREFIX_ . 'buckaroo_fee"'); + if ($tableExists) { + // Move data from old table to new table + $moveDataQuery = 'INSERT INTO `' . _DB_PREFIX_ . 'bk_buckaroo_fee` (reference, id_cart, buckaroo_fee_tax_incl, buckaroo_fee_tax_excl, currency, created_at) + SELECT reference, id_cart, buckaroo_fee, buckaroo_fee, currency, created_at + FROM `' . _DB_PREFIX_ . 'buckaroo_fee`'; - Db::getInstance()->execute($moveDataQuery); + Db::getInstance()->execute($moveDataQuery); - // Delete the old table - $deleteOldTableQuery = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'buckaroo_fee`'; - Db::getInstance()->execute($deleteOldTableQuery); + // Delete the old table + $deleteOldTableQuery = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'buckaroo_fee`'; + Db::getInstance()->execute($deleteOldTableQuery); + } // Example of additional existing operations Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'bk_giftcards` From d3c8ed57ff464af5330253ef9587627fb6c01e4c Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Wed, 12 Jun 2024 11:21:58 +0200 Subject: [PATCH 03/17] fix upgrade file --- upgrade/upgrade-4.2.1.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/upgrade/upgrade-4.2.1.php b/upgrade/upgrade-4.2.1.php index 18c736e7..efbdcd5e 100644 --- a/upgrade/upgrade-4.2.1.php +++ b/upgrade/upgrade-4.2.1.php @@ -56,9 +56,12 @@ function upgrade_module_4_2_1($object) Db::getInstance()->execute($deleteOldTableQuery); } - // Example of additional existing operations - Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'bk_giftcards` - ADD is_custom INT(11) DEFAULT 0 NOT NULL;'); + // Check if the column 'is_custom' already exists in 'bk_giftcards' + $columnExists = Db::getInstance()->executeS('SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'bk_giftcards` LIKE "is_custom"'); + if (empty($columnExists)) { + Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'bk_giftcards` + ADD is_custom INT(11) DEFAULT 0 NOT NULL;'); + } Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'bk_payment_methods WHERE name = "tinka"'); From a7a638516f01408a8a8673fe44ed0b340d4f488d Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Tue, 18 Jun 2024 13:41:45 +0200 Subject: [PATCH 04/17] update --- library/checkout/billinkcheckout.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/checkout/billinkcheckout.php b/library/checkout/billinkcheckout.php index ab963570..162c0b70 100644 --- a/library/checkout/billinkcheckout.php +++ b/library/checkout/billinkcheckout.php @@ -18,6 +18,7 @@ include_once _PS_MODULE_DIR_ . 'buckaroo3/classes/CarrierHandler.php'; use Buckaroo\Resources\Constants\RecipientCategory; +use PrestaShop\Decimal\DecimalNumber; if (!defined('_PS_VERSION_')) { exit; @@ -100,7 +101,7 @@ public function getBillingAddress() ]; if (self::CUSTOMER_TYPE_B2C != $this->customerType - && $this->companyExists($this->invoice_address->company) ? $this->invoice_address->company : null) { + && $this->companyExists($this->invoice_address->company) ? $this->invoice_address->company : null) { $payload['recipient']['careOf'] = $this->invoice_address->company; $payload['recipient']['chamberOfCommerce'] = Tools::getValue('customerbillink-coc'); } @@ -108,7 +109,6 @@ public function getBillingAddress() return $payload; } - public function getRecipientCategory() { $category = self::CUSTOMER_TYPE_B2C; @@ -126,8 +126,8 @@ protected function prepareProductArticles() $tmp = []; $tmp['identifier'] = $item['id_product']; $tmp['quantity'] = $item['quantity']; - $tmp['price'] = round($item['price_with_reduction'], 2); - $tmp['priceExcl'] = round($item['price_with_reduction_without_tax'], 2); + $tmp['price'] = (new DecimalNumber($item['price_with_reduction']))->toPrecision(2); + $tmp['priceExcl'] = (new DecimalNumber($item['price_with_reduction_without_tax']))->toPrecision(2); $tmp['vatPercentage'] = $item['rate']; $tmp['description'] = $item['name']; $articles[] = $tmp; From 348eab72c3056ad4b0db9c40ae2b2d6a7fb10d95 Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Tue, 18 Jun 2024 14:00:21 +0200 Subject: [PATCH 05/17] update --- library/checkout/billinkcheckout.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/checkout/billinkcheckout.php b/library/checkout/billinkcheckout.php index 162c0b70..1a0e5dac 100644 --- a/library/checkout/billinkcheckout.php +++ b/library/checkout/billinkcheckout.php @@ -126,8 +126,8 @@ protected function prepareProductArticles() $tmp = []; $tmp['identifier'] = $item['id_product']; $tmp['quantity'] = $item['quantity']; - $tmp['price'] = (new DecimalNumber($item['price_with_reduction']))->toPrecision(2); - $tmp['priceExcl'] = (new DecimalNumber($item['price_with_reduction_without_tax']))->toPrecision(2); + $tmp['price'] = $item['price_with_reduction']->toPrecision(2); + $tmp['priceExcl'] = $item['price_with_reduction_without_tax']->toPrecision(2); $tmp['vatPercentage'] = $item['rate']; $tmp['description'] = $item['name']; $articles[] = $tmp; From 62abf812c1177e67ecd5dfba05bb8062c6a1b89b Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Tue, 18 Jun 2024 14:02:30 +0200 Subject: [PATCH 06/17] update --- library/checkout/billinkcheckout.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/checkout/billinkcheckout.php b/library/checkout/billinkcheckout.php index 1a0e5dac..319914a8 100644 --- a/library/checkout/billinkcheckout.php +++ b/library/checkout/billinkcheckout.php @@ -126,8 +126,8 @@ protected function prepareProductArticles() $tmp = []; $tmp['identifier'] = $item['id_product']; $tmp['quantity'] = $item['quantity']; - $tmp['price'] = $item['price_with_reduction']->toPrecision(2); - $tmp['priceExcl'] = $item['price_with_reduction_without_tax']->toPrecision(2); + $tmp['price'] = (new DecimalNumber((string) $item['price_with_reduction']))->toPrecision(2); + $tmp['priceExcl'] = (new DecimalNumber((string) $item['price_with_reduction_without_tax']))->toPrecision(2); $tmp['vatPercentage'] = $item['rate']; $tmp['description'] = $item['name']; $articles[] = $tmp; From 837032aeb612972c7c18919f7552ab1c15eb57ce Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Tue, 18 Jun 2024 14:06:56 +0200 Subject: [PATCH 07/17] update --- library/checkout/billinkcheckout.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/library/checkout/billinkcheckout.php b/library/checkout/billinkcheckout.php index 319914a8..2de6ef49 100644 --- a/library/checkout/billinkcheckout.php +++ b/library/checkout/billinkcheckout.php @@ -123,14 +123,16 @@ protected function prepareProductArticles() { $articles = []; foreach ($this->products as $item) { - $tmp = []; - $tmp['identifier'] = $item['id_product']; - $tmp['quantity'] = $item['quantity']; - $tmp['price'] = (new DecimalNumber((string) $item['price_with_reduction']))->toPrecision(2); - $tmp['priceExcl'] = (new DecimalNumber((string) $item['price_with_reduction_without_tax']))->toPrecision(2); - $tmp['vatPercentage'] = $item['rate']; - $tmp['description'] = $item['name']; - $articles[] = $tmp; + $article = [ + 'identifier' => $item['id_product'], + 'quantity' => $item['quantity'], + 'price' => $item['price_with_reduction']->toPrecision(2), + 'priceExcl' => $item['price_with_reduction_without_tax']->toPrecision(2), + 'vatPercentage' => $item['rate'], + 'description' => $item['name'], + ]; + + $articles[] = $article; } return $articles; From 1e34b2860d2c93d16c8230dfd692cdf290d22494 Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Tue, 18 Jun 2024 14:19:26 +0200 Subject: [PATCH 08/17] update --- library/checkout/billinkcheckout.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/checkout/billinkcheckout.php b/library/checkout/billinkcheckout.php index 2de6ef49..631861b1 100644 --- a/library/checkout/billinkcheckout.php +++ b/library/checkout/billinkcheckout.php @@ -126,8 +126,8 @@ protected function prepareProductArticles() $article = [ 'identifier' => $item['id_product'], 'quantity' => $item['quantity'], - 'price' => $item['price_with_reduction']->toPrecision(2), - 'priceExcl' => $item['price_with_reduction_without_tax']->toPrecision(2), + 'price' => $item['price']->toPrecision(2), + 'priceExcl' => $item['price_wt']->toPrecision(2), 'vatPercentage' => $item['rate'], 'description' => $item['name'], ]; From 53a0b1fabeb12c816aba0745679a2567411fdc4b Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Tue, 18 Jun 2024 14:21:47 +0200 Subject: [PATCH 09/17] update --- library/checkout/billinkcheckout.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/checkout/billinkcheckout.php b/library/checkout/billinkcheckout.php index 631861b1..acbdca63 100644 --- a/library/checkout/billinkcheckout.php +++ b/library/checkout/billinkcheckout.php @@ -126,8 +126,8 @@ protected function prepareProductArticles() $article = [ 'identifier' => $item['id_product'], 'quantity' => $item['quantity'], - 'price' => $item['price']->toPrecision(2), - 'priceExcl' => $item['price_wt']->toPrecision(2), + 'price' => $item['price_wt']->toPrecision(2), + 'priceExcl' => $item['price']->toPrecision(2), 'vatPercentage' => $item['rate'], 'description' => $item['name'], ]; From 7d79cef2b3c77af2008a78975c0d40206d65182f Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Tue, 18 Jun 2024 14:35:37 +0200 Subject: [PATCH 10/17] update --- library/checkout/billinkcheckout.php | 4 ++-- library/checkout/checkout.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/checkout/billinkcheckout.php b/library/checkout/billinkcheckout.php index acbdca63..fbdb72b4 100644 --- a/library/checkout/billinkcheckout.php +++ b/library/checkout/billinkcheckout.php @@ -126,8 +126,8 @@ protected function prepareProductArticles() $article = [ 'identifier' => $item['id_product'], 'quantity' => $item['quantity'], - 'price' => $item['price_wt']->toPrecision(2), - 'priceExcl' => $item['price']->toPrecision(2), + 'price' => (new DecimalNumber((string) $item['price_wt']))->toPrecision(2), + 'priceExcl' => (new DecimalNumber((string) $item['price']))->toPrecision(2), 'vatPercentage' => $item['rate'], 'description' => $item['name'], ]; diff --git a/library/checkout/checkout.php b/library/checkout/checkout.php index f5be8943..bd4ca77a 100644 --- a/library/checkout/checkout.php +++ b/library/checkout/checkout.php @@ -357,7 +357,7 @@ protected function prepareBuckarooFeeArticle() return [ 'identifier' => '0', 'quantity' => '1', - 'price' => round($buckarooFee['buckaroo_fee_tax_excl'], 2), + 'price' => (new DecimalNumber((string) $buckarooFee['buckaroo_fee_tax_excl']))->toPrecision(2), 'vatPercentage' => '0', 'description' => 'buckaroo_fee', ]; @@ -370,7 +370,7 @@ protected function prepareProductArticles() $article = [ 'identifier' => $item['id_product'], 'quantity' => $item['quantity'], - 'price' => $item['price_wt']->toPrecision(2), + 'price' => (new DecimalNumber((string) $item['price_wt']))->toPrecision(2), 'vatPercentage' => $item['rate'], 'description' => $item['name'], ]; From 0db62cdfac26dac781ccb789c5227434ae204bde Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Tue, 18 Jun 2024 15:11:42 +0200 Subject: [PATCH 11/17] update --- library/checkout/billinkcheckout.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/checkout/billinkcheckout.php b/library/checkout/billinkcheckout.php index fbdb72b4..90eeef06 100644 --- a/library/checkout/billinkcheckout.php +++ b/library/checkout/billinkcheckout.php @@ -126,8 +126,8 @@ protected function prepareProductArticles() $article = [ 'identifier' => $item['id_product'], 'quantity' => $item['quantity'], - 'price' => (new DecimalNumber((string) $item['price_wt']))->toPrecision(2), - 'priceExcl' => (new DecimalNumber((string) $item['price']))->toPrecision(2), + 'price' => (new DecimalNumber((string) $item['price']))->toPrecision(2), + 'priceExcl' => (new DecimalNumber((string) $item['price_wt']))->toPrecision(2), 'vatPercentage' => $item['rate'], 'description' => $item['name'], ]; From d167d7b1aeffe1420831424ec8cbde16aa1743b8 Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Tue, 18 Jun 2024 15:13:23 +0200 Subject: [PATCH 12/17] update --- library/checkout/billinkcheckout.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/checkout/billinkcheckout.php b/library/checkout/billinkcheckout.php index 90eeef06..fbdb72b4 100644 --- a/library/checkout/billinkcheckout.php +++ b/library/checkout/billinkcheckout.php @@ -126,8 +126,8 @@ protected function prepareProductArticles() $article = [ 'identifier' => $item['id_product'], 'quantity' => $item['quantity'], - 'price' => (new DecimalNumber((string) $item['price']))->toPrecision(2), - 'priceExcl' => (new DecimalNumber((string) $item['price_wt']))->toPrecision(2), + 'price' => (new DecimalNumber((string) $item['price_wt']))->toPrecision(2), + 'priceExcl' => (new DecimalNumber((string) $item['price']))->toPrecision(2), 'vatPercentage' => $item['rate'], 'description' => $item['name'], ]; From f396a518d33fdf6ef79324794736ee39b8f123a5 Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Tue, 18 Jun 2024 15:15:43 +0200 Subject: [PATCH 13/17] update --- library/checkout/billinkcheckout.php | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/library/checkout/billinkcheckout.php b/library/checkout/billinkcheckout.php index fbdb72b4..327eaf25 100644 --- a/library/checkout/billinkcheckout.php +++ b/library/checkout/billinkcheckout.php @@ -119,25 +119,6 @@ public function getRecipientCategory() return $category; } - protected function prepareProductArticles() - { - $articles = []; - foreach ($this->products as $item) { - $article = [ - 'identifier' => $item['id_product'], - 'quantity' => $item['quantity'], - 'price' => (new DecimalNumber((string) $item['price_wt']))->toPrecision(2), - 'priceExcl' => (new DecimalNumber((string) $item['price']))->toPrecision(2), - 'vatPercentage' => $item['rate'], - 'description' => $item['name'], - ]; - - $articles[] = $article; - } - - return $articles; - } - public function getBirthDate() { return date( From 2ae3eed6ddc3c260f9de05a701474ca1b5c39a18 Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Tue, 18 Jun 2024 15:24:07 +0200 Subject: [PATCH 14/17] update --- library/checkout/checkout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/checkout/checkout.php b/library/checkout/checkout.php index bd4ca77a..84e4d861 100644 --- a/library/checkout/checkout.php +++ b/library/checkout/checkout.php @@ -370,7 +370,7 @@ protected function prepareProductArticles() $article = [ 'identifier' => $item['id_product'], 'quantity' => $item['quantity'], - 'price' => (new DecimalNumber((string) $item['price_wt']))->toPrecision(2), + 'price' => round($item['price_wt'], 2), 'vatPercentage' => $item['rate'], 'description' => $item['name'], ]; From 8f9fc7d7d93195244b4796b6ed2220b8e7641b45 Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Thu, 20 Jun 2024 16:04:53 +0200 Subject: [PATCH 15/17] fix --- library/checkout/checkout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/checkout/checkout.php b/library/checkout/checkout.php index 84e4d861..e89268fa 100644 --- a/library/checkout/checkout.php +++ b/library/checkout/checkout.php @@ -357,7 +357,7 @@ protected function prepareBuckarooFeeArticle() return [ 'identifier' => '0', 'quantity' => '1', - 'price' => (new DecimalNumber((string) $buckarooFee['buckaroo_fee_tax_excl']))->toPrecision(2), + 'price' => round($buckarooFee['buckaroo_fee_tax_excl'], 2), 'vatPercentage' => '0', 'description' => 'buckaroo_fee', ]; From 31a5a626e630808c65bdc11ecf30035d53da7adb Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Thu, 20 Jun 2024 16:11:40 +0200 Subject: [PATCH 16/17] fix --- library/checkout/checkout.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/checkout/checkout.php b/library/checkout/checkout.php index e89268fa..1cbbe3e9 100644 --- a/library/checkout/checkout.php +++ b/library/checkout/checkout.php @@ -354,10 +354,12 @@ protected function prepareBuckarooFeeArticle() return []; } + $buckarooFeeData['buckaroo_fee_tax'] = $buckarooFee['buckaroo_fee_tax_incl'] - $buckarooFee['buckaroo_fee_tax_excl']; + return [ 'identifier' => '0', 'quantity' => '1', - 'price' => round($buckarooFee['buckaroo_fee_tax_excl'], 2), + 'price' => round($buckarooFeeData['buckaroo_fee_tax'], 2), 'vatPercentage' => '0', 'description' => 'buckaroo_fee', ]; From a0f9fea158df574533a795a948e39d9f12975af2 Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Thu, 20 Jun 2024 16:16:00 +0200 Subject: [PATCH 17/17] fix --- library/checkout/checkout.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/library/checkout/checkout.php b/library/checkout/checkout.php index 1cbbe3e9..99532b42 100644 --- a/library/checkout/checkout.php +++ b/library/checkout/checkout.php @@ -354,12 +354,10 @@ protected function prepareBuckarooFeeArticle() return []; } - $buckarooFeeData['buckaroo_fee_tax'] = $buckarooFee['buckaroo_fee_tax_incl'] - $buckarooFee['buckaroo_fee_tax_excl']; - return [ 'identifier' => '0', 'quantity' => '1', - 'price' => round($buckarooFeeData['buckaroo_fee_tax'], 2), + 'price' => round($buckarooFee['buckaroo_fee_tax_incl'], 2), 'vatPercentage' => '0', 'description' => 'buckaroo_fee', ];