diff --git a/README.md b/README.md index 43ac5b9..72f10aa 100644 --- a/README.md +++ b/README.md @@ -51,5 +51,5 @@ Installation ## Usage instructions: -See documentation at https://docs.getbread.com -Contact your Bread representative for login credentials. +See documentation at https://docs.breadpayments.com/bread-classic/docs/magento-2 +Contact your Bread representative for your merchant credentials. diff --git a/composer.json b/composer.json index a7aeabe..5e29d6d 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Offers the Bread financing and checkout tools for your Magento store", "license": "MIT", "minimum-stability": "stable", - "version": "1.1.18", + "version": "1.1.19", "require": { "php": "~7.0.13||~7.1.0||~7.1.3||~7.2.0||~7.3.0||~7.4.0" }, diff --git a/view/frontend/web/js/view/shipping.js b/view/frontend/web/js/view/shipping.js index 4aa50b1..460b182 100644 --- a/view/frontend/web/js/view/shipping.js +++ b/view/frontend/web/js/view/shipping.js @@ -7,98 +7,85 @@ */ /*global define*/ define( - [ - 'Magento_Checkout/js/view/shipping', - 'jquery', - 'Magento_Checkout/js/model/quote', - 'Magento_Checkout/js/model/full-screen-loader', - 'buttonConfig', - ], - function (Shipping, $, quote, fullScreenLoader, button) { - 'use strict'; - return Shipping.extend( - { - setShippingInformation: function () { - /** - * Call parent method - */ - Shipping.prototype.setShippingInformation.call(this); + [ + 'Magento_Checkout/js/view/shipping', + 'jquery', + 'Magento_Checkout/js/model/quote', + 'Magento_Checkout/js/model/full-screen-loader', + 'buttonConfig', + ], + function (Shipping, $, quote, fullScreenLoader, button) { + 'use strict'; + return Shipping.extend( + { + setShippingInformation: function () { + /** + * Call parent method + */ + Shipping.prototype.setShippingInformation.call(this); - this.updateConfigData(); - this.invalidateToken(); - this.refreshBreadPaymentMethod(); - }, + this.updateConfigData(); + this.invalidateToken(); + this.refreshBreadPaymentMethod(); + }, - /** - * Add updated shipping option data to window.checkoutConfig global variable - * - * @see Bread\BreadCheckout\Model\Ui\ConfigProvider - */ - updateConfigData: function () { - window.checkoutConfig.payment.breadcheckout.breadConfig.shippingOptions = { - type: quote.shippingMethod().carrier_title + ' - ' + quote.shippingMethod().method_title, - typeId: quote.shippingMethod().carrier_code + '_' + quote.shippingMethod().method_code, - cost: this.round(quote.shippingMethod().base_amount) - }; - }, + /** + * Add updated shipping option data to window.checkoutConfig global variable + * + * @see Bread\BreadCheckout\Model\Ui\ConfigProvider + */ + updateConfigData: function () { + window.checkoutConfig.payment.breadcheckout.breadConfig.shippingOptions = { + type: quote.shippingMethod().carrier_title + ' - ' + quote.shippingMethod().method_title, + typeId: quote.shippingMethod().carrier_code + '_' + quote.shippingMethod().method_code, + cost: this.round(quote.shippingMethod().base_amount) + }; + }, - /** - * Invalidate existing transaction ID (in case user filled out payment - * form and then went back a step) - */ - invalidateToken: function () { - if (window.checkoutConfig.payment.breadcheckout.transactionId !== null) { - window.checkoutConfig.payment.breadcheckout.transactionId = null; - } - }, - - /** - * - * Refresh the payment method section if transactionId is not set - */ - refreshBreadPaymentMethod: function () { + /** + * Invalidate existing transaction ID (in case user filled out payment + * form and then went back a step) + */ + invalidateToken: function () { + if (window.checkoutConfig.payment.breadcheckout.transactionId !== null) { + window.checkoutConfig.payment.breadcheckout.transactionId = null; + } + }, + + /** + * + * Refresh the payment method section if transactionId is not set + */ + refreshBreadPaymentMethod: function () { var paymentMethod = quote.paymentMethod(); - if (typeof paymentMethod.method !== 'undefined' && paymentMethod !== null) { - if (quote.paymentMethod().method === 'breadcheckout' - && window.checkoutConfig.payment.breadcheckout.transactionId === null) { - button.embeddedCheckout(); + if (typeof paymentMethod !== 'undefined') { + if (typeof paymentMethod.method !== 'undefined') { + if (quote.paymentMethod().method === 'breadcheckout' + && window.checkoutConfig.payment.breadcheckout.transactionId === null) { + button.embeddedCheckout(); + } } + } - - }, + }, - /** - * - * Refresh the payment method section if transactionId is not set - */ - refreshBreadPaymentMethod: function () { - var paymentMethod = quote.paymentMethod(); - if ( paymentMethod !== null && typeof paymentMethod.method !== 'undefined') { - if (quote.paymentMethod().method === 'breadcheckout' - && window.checkoutConfig.payment.breadcheckout.transactionId === null) { - button.embeddedCheckout(); + /** + * Round float to 2 decimal plates and convert to integer + * + * @param value + * @returns {Number} + */ + round: function (value) { + if (isNaN(value)) { + return 0; + } + return parseInt( + Number(Math.round(parseFloat(value) + 'e' + 2) + 'e-' + 2) + * 100 + ); } - } - }, - - - /** - * Round float to 2 decimal plates and convert to integer - * - * @param value - * @returns {Number} - */ - round: function (value) { - if (isNaN(value)) { - return 0; } - return parseInt( - Number(Math.round(parseFloat(value)+'e'+2)+'e-'+2) - * 100 - ); - } - } - ); - } + ); + } );