Skip to content

Commit 6042fbc

Browse files
Release v3.2.0
* [ADD] PT widget. * [ADD] PHP 8.4 compatibility. * [FIX] CSP restrictions.
2 parents 2624a44 + 84bd54e commit 6042fbc

File tree

18 files changed

+88
-11
lines changed

18 files changed

+88
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
composer.lock
33
phpunit.xml
44
/vendor/
5+
/.idea/

HISTORY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## Change Log
22

3+
#### [v3.2.0](https://github.com/aplazame/magento2/tree/v3.2.0) (2025-09-25)
4+
5+
* [ADD] PT widget.
6+
* [ADD] PHP 8.4 compatibility.
7+
* [FIX] CSP restrictions.
8+
39
#### [v3.1.3](https://github.com/aplazame/magento2/tree/v3.1.3) (2025-03-27)
410

511
* [FIX] Deprecated broken event at shipment.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"require": {
2424
"php": ">5.5",
2525
"ext-json": "*",
26-
"aplazame/aplazame-api-sdk": "^0.3.6"
26+
"aplazame/aplazame-api-sdk": "^0.3.7"
2727
},
2828
"require-dev": {
2929
"phpunit/phpunit": "^5.7"

src/Block/Product/View/Widget.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public function getFinalPrice()
4141
return $product->getFinalPrice();
4242
}
4343

44+
public function getCountryCode()
45+
{
46+
return $this->config->getWidgetCountry();
47+
}
48+
4449
public function getCurrencyCode()
4550
{
4651
/** @var Currency $currencyModel */

src/Gateway/Config/Config.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Aplazame\Payment\Gateway\Config;
44

55
use Magento\Framework\App\Config\ScopeConfigInterface;
6+
use Magento\Store\Model\ScopeInterface;
67

78
class Config extends \Magento\Payment\Gateway\Config\Config
89
{
@@ -11,6 +12,11 @@ class Config extends \Magento\Payment\Gateway\Config\Config
1112
*/
1213
private $apiBaseUri;
1314

15+
/**
16+
* @var ScopeConfigInterface
17+
*/
18+
private $scopeConfig;
19+
1420
public function __construct(
1521
ScopeConfigInterface $scopeConfig,
1622
$methodCode = null,
@@ -19,6 +25,7 @@ public function __construct(
1925
parent::__construct($scopeConfig, $methodCode, $pathPattern);
2026

2127
$this->apiBaseUri = getenv('APLAZAME_API_BASE_URI') ? getenv('APLAZAME_API_BASE_URI') : 'https://api.aplazame.com';
28+
$this->scopeConfig = $scopeConfig;
2229
}
2330

2431
/**
@@ -39,6 +46,20 @@ public function isSandbox()
3946

4047
// Widget config
4148

49+
/**
50+
* @return string
51+
*/
52+
public function getWidgetCountry()
53+
{
54+
if ((string) $this->getValue('aplazame_widget/widget_country') == 'auto')
55+
{
56+
$currentLocale = $this->scopeConfig->getValue('general/locale/code', ScopeInterface::SCOPE_STORE);
57+
return substr($currentLocale, 0, 2);
58+
} else {
59+
return (string) $this->getValue('aplazame_widget/widget_country');
60+
}
61+
}
62+
4263
/**
4364
* @return string
4465
*/

src/Model/Api/Controller/Confirm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Confirm
3636
*/
3737
private $quoteRepository;
3838

39-
private static function ok(array $extra = null)
39+
private static function ok(?array $extra = null)
4040
{
4141
$response = array(
4242
'status' => 'ok',

src/Model/Aplazame.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function __construct(
4141
\Magento\Payment\Model\Method\Logger $logger,
4242
\Magento\Framework\Module\ModuleListInterface $moduleList,
4343
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
44-
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
45-
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
44+
?\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
45+
?\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
4646
array $data = []
4747
) {
4848
parent::__construct(

src/Model/Config/PrivateKey.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public function __construct(
2929
\Magento\Framework\Registry $registry,
3030
\Magento\Framework\App\Config\ScopeConfigInterface $config,
3131
\Magento\Framework\App\Cache\TypeListInterface $cacheTypeList,
32-
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
33-
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
32+
?\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
33+
?\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
3434
array $data = []
3535
) {
3636
parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Aplazame\Payment\Model\Config\Source;
4+
5+
class WidgetCountry implements \Magento\Framework\Data\OptionSourceInterface
6+
{
7+
public function toOptionArray()
8+
{
9+
return [
10+
['value' => 'auto', 'label' => __('Auto')],
11+
['value' => 'es', 'label' => __('ES (Spain)')],
12+
['value' => 'pt', 'label' => __('PT (Portugal)')]
13+
];
14+
}
15+
}

src/Model/Ui/ConfigProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function getConfig()
4141
'cart_legal_advice_enabled' => $this->config->isCartWidgetLegalAdviceEnabled() ? 'true' : 'false',
4242
'cart_pay_in_4_enabled' => $this->config->isCartWidgetPayIn4Enabled(),
4343
'cart_default_instalments' => $this->config->getCartDefaultInstalments(),
44+
'widget_country' => $this->config->getWidgetCountry(),
4445
'widget_out_of_limits' => $this->config->getWidgetOutOfLimits(),
4546
'cart_max_desired_enabled' => $this->config->isCartWidgetMaxDesiredEnabled() ? 'true' : 'false',
4647
'cart_widget_layout' => $this->config->getCartLayout(),

0 commit comments

Comments
 (0)