Skip to content

Commit

Permalink
Release v7.9.2
Browse files Browse the repository at this point in the history
* [ADD] Developer options for checkout v4 API tests.
  • Loading branch information
alexhernandezord authored Sep 20, 2023
2 parents 937e20e + c737906 commit b53f3bc
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 4 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Change Log

#### [v7.9.2](https://github.com/aplazame/prestashop/tree/v7.9.2) (2023-09-20)

* [ADD] Developer options for checkout v4 API tests.

#### [v7.9.1](https://github.com/aplazame/prestashop/tree/v7.9.1) (2023-08-14)

* API improvements.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version ?= v7.9.1
version ?= v7.9.2
errors = $(shell find aplazame -type f -name "*.php" -exec php -l "{}" \;| grep "Errors parsing ";)

syntax.checker:
Expand Down
50 changes: 47 additions & 3 deletions aplazame/aplazame.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct()
{
$this->name = 'aplazame';
$this->tab = 'payments_gateways';
$this->version = '7.9.1';
$this->version = '7.9.2';
$this->author = 'Aplazame SL';
$this->author_uri = 'https://aplazame.com';
$this->module_key = '64b13ea3527b4df3fe2e3fc1526ce515';
Expand Down Expand Up @@ -120,7 +120,7 @@ public function install()
Configuration::updateValue('APLAZAME_CART_CSS', '#total_price');

/**
* Widget v4 params.
* Widget v4 settings.
*/
Configuration::updateValue('WIDGET_LEGACY', false);
Configuration::updateValue('PRODUCT_WIDGET_BORDER', true);
Expand All @@ -133,6 +133,11 @@ public function install()
Configuration::updateValue('CART_WIDGET_ALIGN', 'center');
Configuration::updateValue('CART_WIDGET_MAX_DESIRED', false);

/**
* Developer settings.
*/
Configuration::updateValue('APLAZAME_V4', false);

return ($this->registerHook('actionOrderSlipAdd')
&& $this->registerHook('actionOrderStatusUpdate')
&& $this->registerHook('displayAdminProductsExtra')
Expand Down Expand Up @@ -276,6 +281,7 @@ public function getContent()
'APLAZAME_PRODUCT_CSS',
'APLAZAME_CART_CSS',
'APLAZAME_WIDGET_OUT_OF_LIMITS',
'APLAZAME_V4',
'WIDGET_LEGACY',
'PRODUCT_WIDGET_BORDER',
'PRODUCT_WIDGET_PRIMARY_COLOR',
Expand Down Expand Up @@ -897,6 +903,38 @@ protected function getConfigForm()
),
);

/**
* Developer settings form.
*/
$dev_settings =
array(
'form' => array(
'legend' => array(
'title' => $this->l('Developer Settings (WARNING: DO NOT TOUCH IF NOT NECESSARY)'),
'icon' => 'icon-cogs',
),
'input' => array(
array(
'type' => $switch_or_radio,
'label' => $this->l('Use v4 checkout API'),
'name' => 'APLAZAME_V4',
'is_bool' => true,
'desc' => $this->l('API version'),
'values' => array(
array(
'id' => 'active_on',
'value' => true,
),
array(
'id' => 'active_off',
'value' => false,
),
),
),
),
),
);

/**
* Save button.
*/
Expand All @@ -908,6 +946,7 @@ protected function getConfigForm()
$form[] = $product_widget;
$form[] = $cart_widget;
$form[] = $button;
$form[] = $dev_settings;

return $form;
}
Expand Down Expand Up @@ -1303,7 +1342,12 @@ public function createCheckoutOnAplazame(Cart $cart)
{
$checkout = Aplazame_Aplazame_BusinessModel_Checkout::createFromCart($cart, (int) $this->id, $this->currentOrder);

return $this->callToRest('POST', '/checkout', Aplazame_Sdk_Serializer_JsonSerializer::serializeValue($checkout), 3);
return $this->callToRest(
'POST',
'/checkout',
Aplazame_Sdk_Serializer_JsonSerializer::serializeValue($checkout),
Configuration::get('APLAZAME_V4') ? 4 : 3
);
}

private function registerController($className, $name)
Expand Down
19 changes: 19 additions & 0 deletions aplazame/upgrade/Upgrade-7.9.2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* This file is part of the official Aplazame module for PrestaShop.
*
* @author Aplazame <[email protected]>
* @copyright 2015-2023 Aplazame
* @license see file: LICENSE
*/

if (!defined('_PS_VERSION_')) {
exit;
}

function upgrade_module_7_9_2(Aplazame $module)
{
Configuration::updateValue('APLAZAME_V4', false);

return true;
}

0 comments on commit b53f3bc

Please sign in to comment.