Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Block/System/Config/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getButtonHtml(): string
$button = $this->getLayout()->createBlock(WidgetButton::class);
$button->setData([
'id' => 'connection-test',
'label' => __('Test Connection'),
'label' => __('Test connection'),
]);

return $button->toHtml();
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Settings/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function execute()
throw new LocalizedException(__('Some fields are empty'));
}

// Handle already saved app secret
// Handle already saved APP secret
if ($jsParams['appSecret'] === '******') {
$jsParams['appSecret'] = $this->config->getAppSecret($jsParams['environment'], $scopeId);
}
Expand Down
6 changes: 6 additions & 0 deletions Gateway/Config/BnplConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ class BnplConfig extends BaseConfig
const CODE = 'fintecture_bnpl';

const KEY_ACTIVE = 'active';
const KEY_RECOMMEND_BNPL_BADGE = 'recommend_bnpl_badge';

public function isActive(): bool
{
return (bool) $this->getValue(self::KEY_ACTIVE);
}

public function isRecommendedBnplBadgeActive(): bool
{
return (bool) $this->getValue(self::KEY_RECOMMEND_BNPL_BADGE);
}
}
8 changes: 7 additions & 1 deletion Gateway/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class Config extends BaseConfig
{
const CODE = 'fintecture';
const VERSION = '3.1.0';
const VERSION = '3.2.0';

const KEY_SHOP_NAME = 'general/store_information/name';
const KEY_ACTIVE = 'active';
Expand All @@ -30,6 +30,7 @@ class Config extends BaseConfig
const KEY_CHECKOUT_DESIGN_SELECTION = 'checkout_design_selection';
const KEY_CUSTOM_RECONCILIATION_FIELD_ACTIVE = 'custom_reconciliation_field_active';
const KEY_CUSTOM_RECONCILIATION_FIELD = 'custom_reconciliation_field';
const KEY_RECOMMEND_IT_BADGE = 'recommend_it_badge';

public function getShopName(): ?string
{
Expand Down Expand Up @@ -153,6 +154,11 @@ public function getCustomReconciliationField(): ?string
return $this->getValue(self::KEY_CUSTOM_RECONCILIATION_FIELD);
}

public function isRecommendedItBadgeActive(): bool
{
return (bool) $this->getValue(self::KEY_RECOMMEND_IT_BADGE);
}

public function getNewOrderStatus(): string
{
$status = $this->getValue('payment/fintecture/new_order_status');
Expand Down
8 changes: 8 additions & 0 deletions Helper/Stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Fintecture\Payment\Helper;

use Fintecture\Payment\Gateway\Config\BnplConfig;
use Fintecture\Payment\Gateway\Config\Config;
use Fintecture\Payment\Logger\Logger as FintectureLogger;
use Fintecture\Payment\Model\Environment;
Expand All @@ -17,6 +18,9 @@ class Stats
/** @var Config */
protected $config;

/** @var BnplConfig */
protected $bnplConfig;

/** @var FintectureLogger */
protected $fintectureLogger;

Expand All @@ -34,13 +38,15 @@ class Stats

public function __construct(
Config $config,
BnplConfig $bnplConfig,
FintectureLogger $fintectureLogger,
ResourceConnection $resourceConnection,
ProductMetadataInterface $productMetadata,
PaymentConfig $paymentConfig,
StoreManagerInterface $storeManager
) {
$this->config = $config;
$this->bnplConfig = $bnplConfig;
$this->fintectureLogger = $fintectureLogger;
$this->resourceConnection = $resourceConnection;
$this->productMetadata = $productMetadata;
Expand Down Expand Up @@ -99,6 +105,8 @@ public function getConfigurationSummary(): array
'module_production_app_id' => $this->config->getAppId(Environment::ENVIRONMENT_PRODUCTION),
'module_branding' => $this->config->isShowLogo(),
'module_checkout_design' => $this->config->getCheckoutDesign(),
'module_recommended_it' => $this->config->isRecommendedItBadgeActive(),
'module_recommended_bnpl' => $this->bnplConfig->isRecommendedBnplBadgeActive(),
];
}
}
File renamed without changes.
6 changes: 3 additions & 3 deletions Model/Config/File/PemFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ protected function _getDeleteCheckbox()
$value = $this->getValue();
if ($value) {
if (substr_compare($value, '.pem', -strlen('.pem')) === 0) {
return '<div><br>' . __('Please re-upload Private Key file') . '</div>';
return '<div><br>' . __('Please re-upload private key file') . '</div>';
} else {
return '<div><br>' . __('Private Key file already saved') . '</div>';
return '<div><br>' . __('Private key file already saved') . '</div>';
}
} else {
return '<div><br>' . __('Please upload Private Key file') . '</div>';
return '<div><br>' . __('Please upload private key file') . '</div>';
}
}
}
4 changes: 2 additions & 2 deletions Model/Config/Options/CheckoutDesignSelectionOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public function toOptionArray()
return [
['value' => 'it', 'label' => __('Immediate Transfer')],
['value' => 'ist', 'label' => __('Immediate Transfer & Smart Transfer')],
['value' => 'ist_long', 'label' => __('Long Version')],
['value' => 'ist_short', 'label' => __('Short Version')],
['value' => 'ist_long', 'label' => __('Long version')],
['value' => 'ist_short', 'label' => __('Short version')],
];
}
}
1 change: 1 addition & 0 deletions Model/Ui/BnplConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function getConfig()
'active' => $this->gatewayConfig->isActive(),
'todayDate' => $this->beautifulDate->formatDatetime($today),
'laterDate' => $this->beautifulDate->formatDatetime($later),
'recommendBnplBadge' => $this->gatewayConfig->isRecommendedBnplBadgeActive(),
],
],
];
Expand Down
1 change: 1 addition & 0 deletions Model/Ui/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function getConfig()
Config::CODE => [
'active' => $this->gatewayConfig->isActive(),
'checkoutDesign' => $this->gatewayConfig->getCheckoutDesign(),
'recommendItBadge' => $this->gatewayConfig->isRecommendedItBadgeActive(),
],
],
];
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ To enable it, you must install this dependency:
Go to Stores > Configuration > Sales > Payment methods.

- Select environment (sandbox/production)
- Fill app id, app secret and private key based on the selected environment (https://console.fintecture.com/)
- Fill APP ID, APP secret and private key based on the selected environment (https://console.fintecture.com/)
- Select payment method display (show logo or not)
- Test your connection (if everything is ok you should have a green message)
- Don't forget to enable the payment method unless it won't be displayed in the front end
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"email": "[email protected]"
},
"type": "magento2-module",
"version": "3.1.0",
"version": "3.2.0",
"license": [
"GPL-3.0"
],
Expand All @@ -28,7 +28,8 @@
"phpstan/phpstan": "^1",
"bitexpert/phpstan-magento": "^0.30.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/extension-installer": "^1.1"
"phpstan/extension-installer": "^1.1",
"phpunit/phpunit": "*"
},
"suggest": {
"chillerlan/php-qrcode": "QR Code library for payment with \"Login as Customer\" feature enabled"
Expand Down
9 changes: 9 additions & 0 deletions etc/adminhtml/events.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="admin_system_config_changed_section_payment">
<observer name="fintecture_admin_system_config_changed_section_payment" instance="Fintecture\Payment\Observer\ConfigObserver" />
</event>
<event name="sales_order_save_after">
<observer name="fintecture_sales_order_save_after" instance="Fintecture\Payment\Observer\Sales\OrderSaveAfter" />
</event>
</config>
68 changes: 44 additions & 24 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
</field>

<field id="bank_type" translate="label comment" type="select" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Bank Type</label>
<source_model>Fintecture\Payment\Model\Banktype</source_model>
<label>Bank type</label>
<source_model>Fintecture\Payment\Model\BankType</source_model>
<comment>Filter the bank type</comment>
</field>

<field id="show_logo" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Show Logo</label>
<label>Show logo</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>Show logo at checkout</comment>
</field>
Expand All @@ -51,7 +51,7 @@
</field>

<field id="fintecture_app_secret_sandbox" translate="label comment" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Fintecture APP Secret</label>
<label>Fintecture APP secret</label>
<depends>
<field id="environment">sandbox</field>
</depends>
Expand Down Expand Up @@ -84,7 +84,7 @@
</field>

<field id="fintecture_app_secret_production" translate="label comment" type="obscure" sortOrder="45" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Fintecture APP Secret</label>
<label>Fintecture APP secret</label>
<depends>
<field id="environment">production</field>
</depends>
Expand All @@ -95,7 +95,7 @@
</field>

<field id="custom_file_upload_production" translate="label" type="Fintecture\Payment\Model\Config\File\PemFile" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Fintecture Private Key</label>
<label>Fintecture private key</label>
<depends>
<field id="environment">production</field>
</depends>
Expand All @@ -110,47 +110,54 @@
<!-- PRODUCTION END -->
</group>

<!-- Start Payment Options -->
<!-- Start payment options -->
<group id="payment_options" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Payment Options</label>
<label>Payment options</label>

<field id="sort_order" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Sort Order</label>
<label>Sort order</label>
<frontend_class>validate-number</frontend_class>
<config_path>payment/fintecture/sort_order</config_path>
</field>

<field id="allowspecific" translate="label" type="allowspecific" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Payment from Applicable Countries</label>
<label>Payment from applicable countries</label>
<config_path>payment/fintecture/allowspecific</config_path>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
</field>

<field id="specificcountry" translate="label" type="multiselect" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Payment from Specific Countries</label>
<label>Payment from specific countries</label>
<config_path>payment/fintecture/specificcountry</config_path>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
</field>
</group>
<!-- End Payment Options -->
<!-- End payment options -->

<!-- Start Design Options -->
<!-- Start design options -->
<group id="design_options" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Design Options</label>
<label>Design options</label>

<field id="checkout_design_selection" translate="label comment" type="radios" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Checkout Design</label>
<label>Checkout design</label>
<comment>Please select the message you want to display on your checkout page, depending on the payment solutions you have.</comment>
<source_model>Fintecture\Payment\Model\Config\Options\CheckoutDesignSelectionOptions</source_model>
<config_path>payment/fintecture/checkout_design_selection</config_path>
</field>

<field id="recommend_it_badge" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
<label>"Recommended" badge</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>Recommend the payment method on checkout page</comment>
<config_path>payment/fintecture/recommend_it_badge</config_path>
</field>
</group>
<!-- End Design Options -->
<!-- End design options -->

<!-- Start Advanced Options -->
<!-- Start advanced options -->
<group id="fintecture_advanced" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Advanced Settings</label>
<label>Advanced settings</label>
<field id="version" type="text" translate="label comment" sortOrder="0" showInDefault="1" showInWebsite="1" showInStore="1">
<frontend_model>Fintecture\Payment\Block\Adminhtml\System\Config\Form\Version</frontend_model>
</field>
Expand Down Expand Up @@ -255,7 +262,7 @@
</field>
</group>
</group>
<!-- End Advanced Options -->
<!-- End advanced options -->
</group>

<group id="fintecture_bnpl" translate="label comment" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
Expand All @@ -275,21 +282,34 @@
</field>
</group>

<!-- Start Payment Options -->
<!-- Start payment options -->
<group id="payment_options_bnpl" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Payment Options</label>
<label>Payment options</label>

<field id="sort_order" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
<config_path>payment/fintecture_bnpl/sort_order</config_path>
</field>
</group>
<!-- End Payment Options -->
<!-- End payment options -->

<!-- Start Design Options -->
<group id="design_options" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Design options</label>

<field id="recommend_bnpl_badge" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>"Recommended" badge</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>Recommend the payment method on checkout page</comment>
<config_path>payment/fintecture_bnpl/recommend_bnpl_badge</config_path>
</field>
</group>
<!-- End Design Options -->

<!-- Start Advanced Options -->
<group id="advanced_bnpl" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Advanced Settings</label>
<label>Advanced settings</label>
<field id="version" type="text" translate="label" sortOrder="0" showInDefault="1" showInWebsite="1" showInStore="1">
<frontend_model>Fintecture\Payment\Block\Adminhtml\System\Config\Form\Version</frontend_model>
</field>
Expand All @@ -304,7 +324,7 @@
</field>
</group>
</group>
<!-- End Advanced Options -->
<!-- End advanced options -->
</group>
</section>
</system>
Expand Down
2 changes: 2 additions & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<alternative_method_active>0</alternative_method_active>
<alternative_method>qrcode</alternative_method>
<checkout_design_selection>it</checkout_design_selection>
<recommend_it_badge>0</recommend_it_badge>
</fintecture>
<fintecture_bnpl>
<debug>0</debug>
Expand All @@ -54,6 +55,7 @@
<title>Fintecture</title>
<allowspecific>0</allowspecific>
<specificcountry>FR</specificcountry>
<recommend_bnpl_badge>0</recommend_bnpl_badge>
</fintecture_bnpl>
</payment>
</default>
Expand Down
6 changes: 0 additions & 6 deletions etc/events.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,4 @@
<event name="controller_action_predispatch_checkout_index_index">
<observer name="fintecture_controller_action_predispatch_checkout_index_index" instance="Fintecture\Payment\Observer\Controller\ActionPredispatchCheckoutIndexIndex" />
</event>
<event name="admin_system_config_changed_section_payment">
<observer name="fintecture_admin_system_config_changed_section_payment" instance="Fintecture\Payment\Observer\ConfigObserver" />
</event>
<event name="sales_order_save_after">
<observer name="fintecture_sales_order_save_after" instance="Fintecture\Payment\Observer\Sales\OrderSaveAfter" />
</event>
</config>
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Fintecture_Payment" setup_version="3.1.0">
<module name="Fintecture_Payment" setup_version="3.2.0">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
Expand Down
Loading