Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add an option to enabled/disable WLB installment." #486

Merged
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
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
Loading