Skip to content

Commit ea611e1

Browse files
Merge pull request #165 from getbread/pg-1311-fix
Magento 2.4.4 compatibility update + bread pay branding
2 parents 18fedf0 + e2f3ba1 commit ea611e1

File tree

6 files changed

+83
-82
lines changed

6 files changed

+83
-82
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "bread/module-breadcheckout",
3-
"description": "Offers the Bread financing and checkout tools for your Magento store",
3+
"description": "Offers Bread Pay financing and checkout tools for your Magento store",
44
"license": "MIT",
55
"minimum-stability": "stable",
6-
"version": "1.1.19",
6+
"version": "2.0.1",
77
"require": {
8-
"php": "~7.0.13||~7.1.0||~7.1.3||~7.2.0||~7.3.0||~7.4.0"
8+
"php": "~7.0.13||~7.1.0||~7.1.3||~7.2.0||~7.3.0||~7.4.0||~8.0.0||~8.1.0"
99
},
1010
"type": "magento2-module",
1111
"repositories": [{

etc/adminhtml/system.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<system>
44
<section id="payment">
55
<group id="breadcheckout" type="text" sortOrder="305" showInDefault="1" showInWebsite="1" showInStore="1" translate="label">
6-
<label>Bread Checkout</label>
6+
<label>Bread Pay Checkout</label>
77
<fieldset_css>complex</fieldset_css>
88
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Group</frontend_model>
99
<comment>
1010
<![CDATA[
1111
<div>
1212
<span class="bread-logo"></span>
13-
Bread Payments by <a href="https://www.getbread.com/" target="_blank">getbread.com</a> - <b>Onsite Consumer Financing</b>.
14-
<br/> Developers API reference: <a href="https://docs.getbread.com/docs/integration/magento-2/magento-2-overview/" target="_blank">Bread Developer API Reference</a>
13+
Bread Pay by <a href="https://payments.breadfinancial.com/" target="_blank">payments.breadfinancial.com</a> - <b>Onsite Consumer Financing</b>.
14+
<br/> Developers API reference: <a href="https://docs.breadpayments.com/bread-classic/docs/magento-2/" target="_blank">Bread Developer API Reference</a>
1515
</div>
1616
]]>
1717
</comment>

view/adminhtml/templates/breadcheckout/css.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
height: 44px;
1010
margin-bottom: 10px;
1111
display: block;
12-
background: url('<?= /* @noEscape */ $block->getViewFileUrl('Bread_BreadCheckout/bread/images/bread-logo.png'); ?>');
12+
background: url('<?= /* @noEscape */ $block->getViewFileUrl('Bread_BreadCheckout/bread/images/bread-financial.png'); ?>');
1313
background-repeat: no-repeat;
1414
background-size: 155px 44px;
1515
}
7.17 KB
Loading
-12 KB
Binary file not shown.

view/frontend/web/js/view/shipping.js

Lines changed: 76 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -7,85 +7,86 @@
77
*/
88
/*global define*/
99
define(
10-
[
11-
'Magento_Checkout/js/view/shipping',
12-
'jquery',
13-
'Magento_Checkout/js/model/quote',
14-
'Magento_Checkout/js/model/full-screen-loader',
15-
'buttonConfig',
16-
],
17-
function (Shipping, $, quote, fullScreenLoader, button) {
18-
'use strict';
19-
return Shipping.extend(
20-
{
21-
setShippingInformation: function () {
22-
/**
23-
* Call parent method
24-
*/
25-
Shipping.prototype.setShippingInformation.call(this);
10+
[
11+
'Magento_Checkout/js/view/shipping',
12+
'jquery',
13+
'Magento_Checkout/js/model/quote',
14+
'Magento_Checkout/js/model/full-screen-loader',
15+
'buttonConfig'
16+
],
17+
function (Shipping, $, quote, fullScreenLoader, button) {
18+
'use strict';
19+
return Shipping.extend(
20+
{
21+
setShippingInformation: function () {
22+
/**
23+
* Call parent method
24+
*/
25+
Shipping.prototype.setShippingInformation.call(this);
2626

27-
this.updateConfigData();
28-
this.invalidateToken();
29-
this.refreshBreadPaymentMethod();
30-
},
27+
this.updateConfigData();
28+
this.invalidateToken();
29+
this.refreshBreadPaymentMethod();
30+
},
3131

32-
/**
33-
* Add updated shipping option data to window.checkoutConfig global variable
34-
*
35-
* @see Bread\BreadCheckout\Model\Ui\ConfigProvider
36-
*/
37-
updateConfigData: function () {
38-
window.checkoutConfig.payment.breadcheckout.breadConfig.shippingOptions = {
39-
type: quote.shippingMethod().carrier_title + ' - ' + quote.shippingMethod().method_title,
40-
typeId: quote.shippingMethod().carrier_code + '_' + quote.shippingMethod().method_code,
41-
cost: this.round(quote.shippingMethod().base_amount)
42-
};
43-
},
32+
/**
33+
* Add updated shipping option data to window.checkoutConfig global variable
34+
*
35+
* @see Bread\BreadCheckout\Model\Ui\ConfigProvider
36+
*/
37+
updateConfigData: function () {
38+
window.checkoutConfig.payment.breadcheckout.breadConfig.shippingOptions = {
39+
type: quote.shippingMethod().carrier_title + ' - ' + quote.shippingMethod().method_title,
40+
typeId: quote.shippingMethod().carrier_code + '_' + quote.shippingMethod().method_code,
41+
cost: this.round(quote.shippingMethod().base_amount)
42+
};
43+
},
4444

45-
/**
46-
* Invalidate existing transaction ID (in case user filled out payment
47-
* form and then went back a step)
48-
*/
49-
invalidateToken: function () {
50-
if (window.checkoutConfig.payment.breadcheckout.transactionId !== null) {
51-
window.checkoutConfig.payment.breadcheckout.transactionId = null;
52-
}
53-
},
54-
55-
/**
56-
*
57-
* Refresh the payment method section if transactionId is not set
58-
*/
59-
refreshBreadPaymentMethod: function () {
60-
var paymentMethod = quote.paymentMethod();
61-
if (typeof paymentMethod !== 'undefined') {
62-
if (typeof paymentMethod.method !== 'undefined') {
63-
if (quote.paymentMethod().method === 'breadcheckout'
64-
&& window.checkoutConfig.payment.breadcheckout.transactionId === null) {
65-
button.embeddedCheckout();
66-
}
67-
}
68-
69-
}
70-
71-
},
72-
73-
/**
74-
* Round float to 2 decimal plates and convert to integer
75-
*
76-
* @param value
77-
* @returns {Number}
78-
*/
79-
round: function (value) {
80-
if (isNaN(value)) {
81-
return 0;
45+
/**
46+
* Invalidate existing transaction ID (in case user filled out payment
47+
* form and then went back a step)
48+
*/
49+
invalidateToken: function () {
50+
if (window.checkoutConfig.payment.breadcheckout.transactionId !== null) {
51+
window.checkoutConfig.payment.breadcheckout.transactionId = null;
52+
}
53+
},
54+
55+
/**
56+
*
57+
* Refresh the payment method section if transactionId is not set
58+
*/
59+
refreshBreadPaymentMethod: function () {
60+
var paymentMethod = quote.paymentMethod();
61+
if ( paymentMethod !== null && typeof paymentMethod.method !== 'undefined') {
62+
if (quote.paymentMethod().method === 'breadcheckout'
63+
&& window.checkoutConfig.payment.breadcheckout.transactionId === null) {
64+
//Check if embeddedCheckout is enabled
65+
if(window.checkoutConfig.payment.breadcheckout.breadConfig.embeddedCheckout) {
66+
button.embeddedCheckout();
67+
} else {
68+
button.init();
8269
}
83-
return parseInt(
84-
Number(Math.round(parseFloat(value) + 'e' + 2) + 'e-' + 2)
85-
* 100
86-
);
8770
}
71+
}
72+
},
73+
74+
/**
75+
* Round float to 2 decimal plates and convert to integer
76+
*
77+
* @param value
78+
* @returns {Number}
79+
*/
80+
round: function (value) {
81+
if (isNaN(value)) {
82+
return 0;
8883
}
89-
);
90-
}
84+
return parseInt(
85+
Number(Math.round(parseFloat(value)+'e'+2)+'e-'+2)
86+
* 100
87+
);
88+
}
89+
}
90+
);
91+
}
9192
);

0 commit comments

Comments
 (0)