Skip to content

Commit

Permalink
Revert "Add an option to enabled/disable WLB installment. (#484)"
Browse files Browse the repository at this point in the history
This reverts commit b2e9776.
  • Loading branch information
aashishgurung authored Jul 24, 2024
1 parent b2e9776 commit 7871e7d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
6 changes: 1 addition & 5 deletions Model/Ui/CcConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Magento\Payment\Model\CcConfig as MagentoCcConfig;
use Omise\Payment\Block\Adminhtml\System\Config\CardFormCustomization\Theme;
use Omise\Payment\Model\Config\Cc as OmiseCcConfig;
use Omise\Payment\Model\Config\Installment;
use Omise\Payment\Model\Customer;

class CcConfigProvider implements ConfigProviderInterface
Expand Down Expand Up @@ -46,8 +45,6 @@ public function getConfig()
$theme = new Theme();
$customDesign = $this->omiseCcConfig->getCardThemeConfig();
$selectedTheme = $this->omiseCcConfig->getCardTheme();
$enableWlbInstallment = $this->omiseCcConfig->getValue('enable_wlb_installment', Installment::CODE);

return [
'payment' => [
'ccform' => [
Expand All @@ -61,8 +58,7 @@ public function getConfig()
'locale' => $this->omiseCcConfig->getStoreLocale(),
'secureForm' => $this->omiseCcConfig->getSecureForm(),
'formDesign' => $theme->getFormDesign($selectedTheme, $customDesign),
'theme' => $selectedTheme,
'enableWlbInstallment' => $enableWlbInstallment
'theme' => $selectedTheme
],
]
];
Expand Down
10 changes: 2 additions & 8 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,19 +222,13 @@
<comment>This controls the title which the user sees during checkout.</comment>
<config_path>payment/omise_offsite_installment/title</config_path>
</field>
<field id="enable_wlb_installment" translate="label" type="select" sortOrder="271" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable WLB installments</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/omise_offsite_installment/enable_wlb_installment</config_path>
<comment>This controls whether you want to enable WLB installments or non-WLB installments.</comment>
</field>
<field id="allowspecific" translate="label comment" type="select" sortOrder="272" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="allowspecific" translate="label comment" type="select" sortOrder="271" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Allowed Countries</label>
<config_path>payment/omise_offsite_installment/allowspecific</config_path>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
<comment>If not set to all, guest customers will not have a billing country and may not be able to check out.</comment>
</field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="273" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="specificcountry" translate="label" type="multiselect" sortOrder="272" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Payment from specific countries</label>
<config_path>payment/omise_offsite_installment/specificcountry</config_path>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
Expand Down
1 change: 0 additions & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
<payment_action>authorize_capture</payment_action>
<can_refund_partial_per_invoice>1</can_refund_partial_per_invoice>
<can_refund>1</can_refund>
<enable_wlb_installment>0</enable_wlb_installment>
</omise_offsite_internetbanking>

<omise_offsite_alipay>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,23 @@ define(
},

applyOmiseJsToElement: function (self, element) {
const iframeHeightMatching = {
'40px': 258,
'44px': 270,
'48px': 282,
'52px': 295,
}

const localeMatching = {
en_US: 'en',
ja_JP: 'ja',
th_TH: 'th'
}

const { locale, enableWlbInstallment } = window.checkoutConfig.payment.omise_cc
element.style.height = enableWlbInstallment === '1' ? '450px' : '200px'
const { theme, locale, formDesign } = window.checkoutConfig.payment.omise_cc
const { font, input, checkbox } = formDesign
let iframeElementHeight = iframeHeightMatching[input.height]
element.style.height = 500 + 'px';

OmiseCard.configure({
publicKey: self.getPublicKey(),
Expand All @@ -182,10 +191,9 @@ define(
customCardForm: false,
customInstallmentForm: true,
locale: localeMatching[locale] ?? 'en',
defaultPaymentMethod: 'installment',
enableWlbInstallment: enableWlbInstallment === '1'
defaultPaymentMethod: 'installment'
});

OmiseCard.open({
onCreateSuccess: (payload) => {
self.createOrder(self, payload)
Expand Down

0 comments on commit 7871e7d

Please sign in to comment.