Skip to content

Commit

Permalink
Merge branch 'release/v4.1.2' into 'master'
Browse files Browse the repository at this point in the history
release/v4.1.2 into master

See merge request agence-dnd/marketplace/magento-2/external/module-checkout-magento2-plugin!63
  • Loading branch information
JuliosDnd committed Sep 28, 2022
2 parents b5dd339 + bad3b16 commit 95d56c1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
10 changes: 5 additions & 5 deletions Controller/Apm/DisplaySepa.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
use Magento\Quote\Api\Data\AddressInterface;
use Magento\Quote\Api\Data\CartInterface;
use Magento\Store\Model\Information;
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\Store;
use Magento\Store\Model\StoreManagerInterface;

Expand Down Expand Up @@ -158,6 +159,7 @@ public function execute(): Json
$html = $this->runTask();
}


return $this->jsonFactory->create()->setData(['html' => $html]);
}

Expand Down Expand Up @@ -278,10 +280,8 @@ public function getMandate(): string
* @return Sepa
* @throws NoSuchEntityException|LocalizedException
*/
protected function requestSepa(): Sepa
protected function requestSepa(): ?Sepa
{
/** @var string $bic */
$bic = $this->getRequest()->getParam('bic');
/** @var string $accountIban */
$accountIban = $this->getRequest()->getParam('account_iban');
/** @var CartInterface $quote */
Expand All @@ -295,7 +295,7 @@ protected function requestSepa(): Sepa

// Initialize the API handler
$checkoutApi = $this->apiHandler
->init($storeCode)
->init($storeCode, ScopeInterface::SCOPE_STORE)
->getCheckoutApi();

// Build the address
Expand All @@ -314,7 +314,7 @@ protected function requestSepa(): Sepa
$billingAddress->getFirstname(),
$billingAddress->getLastname(),
$accountIban,
$bic,
'',
$this->config->getStoreName(),
'single'
);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"magento/framework": ">=100.0.1"
},
"type": "magento2-module",
"version": "4.1.1",
"version": "4.1.2",
"autoload": {
"files": [
"registration.php"
Expand Down
9 changes: 3 additions & 6 deletions view/frontend/templates/payment/apm/sepa.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@
<form id="cko-apm-form-<?= $block->escapeHtmlAttr($block->getData('apm_id'))?>">
<input type="hidden" name="source" value="<?= $block->escapeHtmlAttr($block->getData('apm_id'))?>" required>
<input type="hidden" name="task" value="mandate">
<div class="input-group">
<label class="icon" for="bic">
<span class="ckojs ckojs-card"></label>
<input type="text" id="bic" name="bic" placeholder="<?= $block->escapeHtmlAttr(__('BIC')); ?>" class="input-control">
</div>

<div class="input-group">
<label class="icon" for="account_iban">
<span class="ckojs ckojs-card"></label>
<span class="ckojs ckojs-card"></span>
</label>
<input type="text" id="account_iban" name="account_iban" placeholder="<?= $block->escapeHtmlAttr(__('Account IBAN')); ?>" class="input-control" required>
</div>
<br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
define(
[
'jquery',
'ko',
'Magento_Checkout/js/view/payment/default',
'CheckoutCom_Magento2/js/view/payment/utilities',
'CheckoutCom_Magento2/js/frames/multi',
Expand All @@ -25,7 +26,7 @@ define(
'Magento_Checkout/js/model/quote',
'framesjs'
],
function ($, Component, Utilities, FramesMulti, FramesSingle, AdditionalValidators, Customer, Quote) {
function ($, ko, Component, Utilities, FramesMulti, FramesSingle, AdditionalValidators, Customer, Quote) {
'use strict';
window.checkoutConfig.reloadOnBillingAddress = true;
const METHOD_ID = 'checkoutcom_card_payment';
Expand All @@ -43,7 +44,8 @@ define(
cardBin: null,
saveCard: false,
supportedCards: null,
redirectAfterPlaceOrder: false
redirectAfterPlaceOrder: false,
allowPlaceOrder: ko.observable(false)
},

/**
Expand Down Expand Up @@ -124,7 +126,8 @@ define(

// Option click event
$('.payment-method input[type="radio"]').on('click', function () {
Utilities.allowPlaceOrder(self.buttonId, false);
self.allowPlaceOrder(false);

if ($(this).attr('id') == METHOD_ID) {
self.getCkoPaymentForm();
} else {
Expand Down Expand Up @@ -300,7 +303,8 @@ define(
// Submit the payment form
Frames.submitCard();
}
Utilities.allowPlaceOrder(self.buttonId, false);

self.allowPlaceOrder(false);
}
);

Expand All @@ -315,8 +319,8 @@ define(
// Enable the submit form
Frames.enableSubmitForm();

// Enable place order button only when tokenized.
Utilities.allowPlaceOrder(self.buttonId, true);
// Set allowPlaceOrder to true only when tokenized.
self.allowPlaceOrder(true);
}
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,11 @@
type="submit"
data-bind="
click: placeOrder,
attr: {title: $t('Place Order'), 'id': buttonId}
" disabled="disabled">
attr: {title: $t('Place Order'), 'id': buttonId},
enable: (getCode() == isChecked()),
css: {disabled: !isPlaceOrderActionAllowed() || !allowPlaceOrder()}
"
disabled>
<span data-bind="i18n: 'Place Order'"></span>
</button>
</div>
Expand Down

0 comments on commit 95d56c1

Please sign in to comment.