Skip to content

Commit

Permalink
Merge pull request #155 from getbread/OSD-4249
Browse files Browse the repository at this point in the history
Osd 4249
  • Loading branch information
KiprotichMaritim authored Nov 10, 2021
2 parents 1a7f1f7 + a1b88aa commit 9db902e
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 22 deletions.
13 changes: 13 additions & 0 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
const XML_CONFIG_AS_LOW_AS = 'payment/breadcheckout/as_low_as';
const XML_CONFIG_PAYMENT_ACTION = 'payment/breadcheckout/payment_action';
const XML_CONFIG_HEALTHCARE_MODE = 'payment/breadcheckout/healthcare_mode';
const XML_CONFIG_SHOW_SPLITPAY_LABEL = 'payment/breadcheckout/show_splitpay_label';
const XML_CONFIG_ACTIVE_ON_PDP = 'payment/breadcheckout/enabled_on_product_page';
const XML_CONFIG_ACTIVE_ON_CAT = 'payment/breadcheckout/bread_category/enabled_on_category_page';
const XML_CONFIG_ACTIVE_ON_CART_VIEW = 'payment/breadcheckout/enabled_on_cart_page';
Expand Down Expand Up @@ -540,6 +541,18 @@ public function isHealthcare($storeCode = null, $store = \Magento\Store\Model\Sc
$this->isActive($store, $storeCode) && $this->scopeConfig->getValue(self::XML_CONFIG_HEALTHCARE_MODE, $store, $storeCode)
);
}

/**
* Are we showing the split pay label
*
* @param null $store
* @return bool
*/
public function showSplitpayLabelOnCheckout($storeCode = null, $store = \Magento\Store\Model\ScopeInterface::SCOPE_STORE) {
return (bool) (
$this->isActive($store, $storeCode) && $this->scopeConfig->getValue(self::XML_CONFIG_SHOW_SPLITPAY_LABEL, $store, $storeCode)
);
}

/**
* Use As Low As Pricing View?
Expand Down
3 changes: 2 additions & 1 deletion Model/Ui/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public function getConfig()
'methodTooltip' => $this->helper->getMethodTooltip(),
'productTypeMessage' => $this->helperData->getProductTypeMessage(),
'cartValidation' => $this->helper->validateAllowedProductTypes(),
'methodTitle' => $this->breadMethod->getTitle()
'methodTitle' => $this->breadMethod->getTitle(),
'showSplitpayLabel' => $this->helper->showSplitpayLabelOnCheckout()
]
]
]
Expand Down
56 changes: 50 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,55 @@
# Bread Checkout for Magento 2
Bread Checkout for Magento 2
============================

Bread is a full-funnel, white label financing solution that helps retailers acquire
and convert more customers. Retailers who use Bread have seen an increase of 5-15% in sales,
up to 120% higher AOV, and an 84% increase in email click-through-rates.

Bread’s Features
----------------

* Full Funnel. Your shoppers can discover, pre-qualify, and check out from anywhere - your homepage,
category page, product page, cart, or checkout.
* Real-Time Decision. Pre-qualification is quick and easy. Let your customers learn
about their purchase power in seconds without ever leaving your site.

Installation
------------

### Install using Composer

1. Navigate to your Magento 2 root folder

2. Install the Bread Checkout module

```bash
composer require breadfinance/module-breadcheckout
```
3. Enable module
```bash
bin/magento module:enable Bread/BreadCheckout
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy
```

### Install using Zip archive

1. Download Bread checkout module from Magento marketplace
https://marketplace.magento.com/bread-module-breadcheckout.html

2. Unzip contents into `app/code/Bread/BreadCheckout` folder

3. Enable module
```bash
bin/magento module:enable Bread/BreadCheckout
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy
```

## Installation instructions:
1. Download repository as zip file
2. Unzip contents into `app/code` folder
3. Run `magento module:enable Bread_BreadCheckout`
4. Run `magento module:update`

## Usage instructions:

See documentation at https://docs.getbread.com
Contact your Bread representative for login credentials.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"description": "Offers the Bread financing and checkout tools for your Magento store",
"license": "MIT",
"minimum-stability": "stable",
"version": "1.1.17",
"version": "1.1.18",
"require": {
"php": "~7.0.13||~7.1.0||~7.1.3||~7.2.0||~7.3.0||~7.4.0"
},
"type": "magento2-module",
"repositories": [{
"type": "vcs",
"url": "[email protected]:breadfinance/magento-v2-bread.git"
"url": "[email protected]:getbread/magento-v2-bread.git"
}],
"autoload": {
"files": ["registration.php"],
Expand Down
31 changes: 19 additions & 12 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,25 @@
]]>
</comment>
</field>
<field id="use_default_button_size" type="select" sortOrder="13" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="show_splitpay_label" type="select" sortOrder="13" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Show Splipay label on checkout title</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="use_default_button_size" type="select" sortOrder="14" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Use default button size</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="button_on_products" type="select" sortOrder="14" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="button_on_products" type="select" sortOrder="15" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Display as Button on Product Detail Pages When Logged In</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="button_design" type="textarea" sortOrder="15" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="button_design" type="textarea" sortOrder="16" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Bread Button Design</label>
<comment>
<![CDATA[
Expand All @@ -125,7 +132,7 @@
]]>
</comment>
</field>
<field id="title" type="text" sortOrder="16" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="title" type="text" sortOrder="17" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Payment Method Title</label>
<comment>
<![CDATA[
Expand All @@ -135,7 +142,7 @@
]]>
</comment>
</field>
<field id="incomplete_checkout_message" type="textarea" sortOrder="17" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="incomplete_checkout_message" type="textarea" sortOrder="18" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Incomplete Bread Checkout error</label>
<comment>
<![CDATA[
Expand All @@ -145,7 +152,7 @@
]]>
</comment>
</field>
<field id="allowcheckoutpdp" type="select" sortOrder="18" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="allowcheckoutpdp" type="select" sortOrder="19" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Allow Checkout From Bread Pop Up On Product Page</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>
Expand All @@ -161,7 +168,7 @@
]]>
</comment>
</field>
<field id="allowcheckoutcart" type="select" sortOrder="19" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="allowcheckoutcart" type="select" sortOrder="20" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Allow Checkout From Bread Pop Up On Cart Page</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>
Expand All @@ -177,15 +184,15 @@
]]>
</comment>
</field>
<field id="allowminicartcheckout" type="select" sortOrder="20" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="allowminicartcheckout" type="select" sortOrder="21" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Allow checkout from mini cart</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="embedded" type="select" sortOrder="21" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="embedded" type="select" sortOrder="22" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Embedded Checkout</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="split_auto_cancel" type="select" sortOrder="22" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="split_auto_cancel" type="select" sortOrder="23" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Auto-cancel Failed Split-Pay Orders</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>
Expand All @@ -196,7 +203,7 @@
]]>
</comment>
</field>
<field id="per_month" type="select" sortOrder="23" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="per_month" type="select" sortOrder="24" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label><![CDATA[Show "As Low As" price]]></label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>
Expand All @@ -207,7 +214,7 @@
]]>
</comment>
</field>
<field id="product_type_msg" type="textarea" sortOrder="24" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="product_type_msg" type="textarea" sortOrder="25" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Invalid product type message</label>
<comment>
<![CDATA[
Expand Down
1 change: 1 addition & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<title>Pay Over Time</title>
<payment_action>authorize</payment_action>
<api_mode>0</api_mode>
<show_splitpay_label>1</show_splitpay_label>
<!-- default to sandbox mode -->
<incomplete_checkout_message>Please click the pay over time button and complete the finance forms or choose another payment method.</incomplete_checkout_message>
<allowcheckoutpdp>1</allowcheckoutpdp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,14 @@ define(
var SPLITPAY_GREEN = '#57c594';
var label = jQuery('#breadcheckout').next('label').attr("for", "breadcheckout");
label.text('');
label.append('Pay Over Time with ' +
if(window.checkoutConfig.payment[this.getCode()].breadConfig.showSplitpayLabel) {
label.append('Pay Over Time with ' +
'<span style="color: ' + INSTALLMENTS_BLUE + '; font-weight: 600;">Installments</span> or ' +
'<span style="color: ' + SPLITPAY_GREEN + '; font-weight: 600;">SplitPay</span>');
} else {
label.append('Pay Over Time with ' +
'<span style="color: ' + INSTALLMENTS_BLUE + '; font-weight: 600;">Installments</span>');
}
return window.checkoutConfig.payment[this.getCode()].breadConfig.methodTitle;
},

Expand Down

0 comments on commit 9db902e

Please sign in to comment.