Skip to content

Commit

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

See merge request agence-dnd/marketplace/magento-2/external/module-checkout-magento2-plugin!35
  • Loading branch information
Rémi V committed Apr 27, 2022
2 parents 9ae2ea6 + b1c9b17 commit ef3cb04
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 9 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion Controller/Api/v2.php → Controller/Api/V2.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
use CheckoutCom\Magento2\Model\Service\OrderStatusHandlerService;
use CheckoutCom\Magento2\Model\Service\PaymentErrorHandlerService;
use CheckoutCom\Magento2\Model\Service\QuoteHandlerService;
use Klarna\Core\Api\OrderRepositoryInterface;
use Magento\Sales\Api\OrderRepositoryInterface;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Controller\Result\Json;
Expand Down
2 changes: 1 addition & 1 deletion Model/Methods/AlternativePaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
use CheckoutCom\Magento2\Helper\Utilities;
use CheckoutCom\Magento2\Model\Service\ApiHandlerService;
use CheckoutCom\Magento2\Model\Service\QuoteHandlerService;
use CheckoutCom\Magento2\Model\Service\shopperHandlerService;
use CheckoutCom\Magento2\Model\Service\ShopperHandlerService;
use CheckoutCom\Magento2\Model\Service\VersionHandlerService;
use Magento\Backend\Model\Auth\Session;
use Magento\Backend\Model\Session\Quote;
Expand Down
1 change: 1 addition & 0 deletions Observer/Backend/MotoPaymentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public function execute(Observer $observer): MotoPaymentRequest
$request->capture = $this->config->needsAutoCapture($methodId);
$request->amount = $this->prepareMotoAmount($order);
$request->reference = $order->getIncrementId();
$request->customer = $api->createCustomer($order);
$request->payment_type = 'MOTO';
if ($order->getIsNotVirtual()) {
$request->shipping = $api->createShippingAddress($order);
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": "3.1.0",
"version": "3.1.1",
"autoload": {
"files": [
"registration.php"
Expand Down
7 changes: 7 additions & 0 deletions view/adminhtml/templates/payment/moto.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ use CheckoutCom\Magento2\Block\Adminhtml\Payment\Moto;
publicKey: '<?= $block->escapeHtml($block->getConfig()->getAccountKeys('checkoutcom_moto')['public_key']) ?>',
debug: Boolean(<?= $block->escapeHtml($block->getConfig()->getValue('debug')) ?>),
cardValidationChanged: function(event) {
var cardholderName = $('#order-billing_address_firstname').val() + ' ' + $('#order-billing_address_lastname').val();

if (Frames.isCardValid()) {
if(cardholderName.length > 0) {
Frames.cardholder = {
name: cardholderName
};
}
Frames.submitCard();
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,15 @@ define(
function (event) {
var valid = Frames.isCardValid()
if (valid) {
if(cardholderName.length > 0) {
// Add the card holder name
if(cardholderName.length === 0) {
if(Utilities.getBillingAddress()) {
cardholderName = Utilities.getCustomerName();
}
}

if (cardholderName.length > 0) {
Frames.cardholder = {
name: cardholderName
name: cardholderName
};
}

Expand Down
6 changes: 3 additions & 3 deletions view/frontend/web/js/view/payment/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ define(
getCustomerName: function () {
var billingAddress = this.getBillingAddress();
var customerName = '';
if (billingAddress) {
customerName += billingAddress.firstname;
customerName += ' ' + billingAddress.lastname;
if (billingAddress && billingAddress.firstname && billingAddress.lastname) {
customerName += billingAddress.firstname;
customerName += ' ' + billingAddress.lastname;
}

return customerName;
Expand Down

0 comments on commit ef3cb04

Please sign in to comment.