Skip to content

Commit

Permalink
Merge pull request #168 from buckaroo-it/BP-3481-Update-test-release-…
Browse files Browse the repository at this point in the history
…v4.2.1

Bp 3481 update test release v4.2.1
  • Loading branch information
vegimcarkaxhija authored Jun 20, 2024
2 parents 33a2027 + a0f9fea commit f895bfd
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 37 deletions.
4 changes: 2 additions & 2 deletions buckaroo3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)');
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions config.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>buckaroo3</name>
<displayName><![CDATA[Buckaroo Payments (v 4.2.0)]]></displayName>
<version><![CDATA[4.2.0]]></version>
<description><![CDATA[Buckaroo Payment module. Compatible with PrestaShop version 1.7.x + 8.1.4]]></description>
<displayName><![CDATA[Buckaroo Payments (v 4.2.1)]]></displayName>
<version><![CDATA[4.2.1]]></version>
<description><![CDATA[Buckaroo Payment module. Compatible with PrestaShop version 1.7.x + 8.1.6]]></description>
<author><![CDATA[Buckaroo]]></author>
<tab><![CDATA[payments_gateways]]></tab>
<confirmUninstall><![CDATA[Are you sure you want to delete Buckaroo Payments module?]]></confirmUninstall>
Expand Down
21 changes: 2 additions & 19 deletions library/checkout/billinkcheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -100,15 +101,14 @@ 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');
}

return $payload;
}


public function getRecipientCategory()
{
$category = self::CUSTOMER_TYPE_B2C;
Expand All @@ -119,23 +119,6 @@ public function getRecipientCategory()
return $category;
}

protected function prepareProductArticles()
{
$articles = [];
foreach ($this->products as $item) {
$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['vatPercentage'] = $item['rate'];
$tmp['description'] = $item['name'];
$articles[] = $tmp;
}

return $articles;
}

public function getBirthDate()
{
return date(
Expand Down
4 changes: 2 additions & 2 deletions library/checkout/checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ protected function prepareBuckarooFeeArticle()
return [
'identifier' => '0',
'quantity' => '1',
'price' => round($buckarooFee['buckaroo_fee_tax_excl'], 2),
'price' => round($buckarooFee['buckaroo_fee_tax_incl'], 2),
'vatPercentage' => '0',
'description' => 'buckaroo_fee',
];
Expand All @@ -370,7 +370,7 @@ protected function prepareProductArticles()
$article = [
'identifier' => $item['id_product'],
'quantity' => $item['quantity'],
'price' => $item['price_wt']->toPrecision(2),
'price' => round($item['price_wt'], 2),
'vatPercentage' => $item['rate'],
'description' => $item['name'],
];
Expand Down
29 changes: 18 additions & 11 deletions upgrade/upgrade-4.2.1.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,27 @@ 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`
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"');

Expand Down

0 comments on commit f895bfd

Please sign in to comment.