Skip to content

Commit

Permalink
Merge pull request #192 from getbread/pg-1677-pg-1722-updates
Browse files Browse the repository at this point in the history
service auth URl & bundled products ALA
  • Loading branch information
KiprotichMaritim authored Apr 20, 2023
2 parents eb5c52b + f549c1b commit 37e4bf2
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 31 deletions.
26 changes: 25 additions & 1 deletion Block/Product/Bundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,4 +510,28 @@ public function isDownloadable()
public function getApiVersion() {
return (string) $this->dataHelper->getApiVersion();
}
}

/**
* @since 2.1.0
* @return string
*/
public function getIntegrationKey() {
return $this->dataHelper->getIntegrationKey();
}

/**
* @since 2.1.0
* @return string
*/
public function getConfigClient() {
return $this->dataHelper->getConfigClient();
}

/**
* @since 2.1.0
* @return string
*/
public function getCurrentCurrencyCode() {
return $this->catalogHelper->getCurrentCurrencyCode();
}
}
3 changes: 1 addition & 2 deletions Model/Payment/Api/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,7 @@ protected function getUpdateTransactionUrl($transactionId)
*/
protected function getAuthTokenUrl() {
$baseUrl = $this->helper->getTransactionApiUrl('bread_2', $this->getStoreId());
//return join('/', [trim($baseUrl, '/'), 'auth/service/authorize']);
return join('/', [trim($baseUrl, '/'), 'auth/sa/authenticate']);
return join('/', [trim($baseUrl, '/'), 'auth/service/authorize']);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
== Changelog ==

= 2.3.1
* Current release
* ALA button now shows correctly for Bundled products under the view category section
* Fixed the fetch Auth token API end-point
* Extension is now PHP 8.2 compatible
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"description": "Offers Bread Pay financing and checkout tools for your Magento store",
"license": "MIT",
"minimum-stability": "stable",
"version": "2.3.0",
"version": "2.3.1",
"require": {
"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"
"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||8.2.0"
},
"type": "magento2-module",
"repositories": [{
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Bread_BreadCheckout" setup_version="2.3.0">
<module name="Bread_BreadCheckout" setup_version="2.3.1">
<sequence>
<module name="Magento_Checkout"/>
<module name="Magento_Sales"/>
Expand Down
51 changes: 27 additions & 24 deletions view/frontend/templates/breadcheckout/catalog/product/view.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Maritim, Kip
* @copyright (c) 2023, Bread Financial
*
* @var Bread\BreadCheckout\Block\CatalogProductCollection $block
* @var Bread\BreadCheckout\Block\Catalog\ProductCollection $block
*/
$collection = $block->getCategoryProductCollection();
$products = array();
Expand All @@ -21,30 +21,33 @@ endforeach;
var currentCurrencyCode = "<?= /* @noEscape */ $block->getCurrentCurrencyCode(); ?>";
var placementObject = [];
<?php foreach ($products as $product) : ?>
var itemPlacement = {
"allowCheckout": allowCheckout,
"financingType": "installment",
"domID": 'bread-checkout-btn-<?= /* @noEscape */ $product['id'];?>',
"locationType": buttonLocation,
"order": {
"items": [
{
"name": "<?= /* @noEscape */ $product['name']?>",
"quantity": <?= /* @noEscape */ $product['quantity']?>,
"shippingCost": {"currency": currentCurrencyCode, "value": 0},
"shippingDescription": "",
"unitTax": {"currency": currentCurrencyCode, "value": 0},
"unitPrice": {"currency": currentCurrencyCode, "value": <?= /* @noEscape */ $product['price']?>}
var price = <?= /* @noEscape */ $product['price']?>;
if(price != 0) {
var itemPlacement = {
"allowCheckout": allowCheckout,
"financingType": "installment",
"domID": 'bread-checkout-btn-<?= /* @noEscape */ $product['id'];?>',
"locationType": buttonLocation,
"order": {
"items": [
{
"name": "<?= /* @noEscape */ $product['name']?>",
"quantity": <?= /* @noEscape */ $product['quantity']?>,
"shippingCost": {"currency": currentCurrencyCode, "value": 0},
"shippingDescription": "",
"unitTax": {"currency": currentCurrencyCode, "value": 0},
"unitPrice": {"currency": currentCurrencyCode, "value": <?= /* @noEscape */ $product['price']?>}
}
],
"subTotal": {"currency": currentCurrencyCode, "value": <?= /* @noEscape */ $product['price']?>},
"totalPrice": {"currency": currentCurrencyCode, "value": <?= /* @noEscape */ $product['price']?>},
"totalDiscounts": {"currency": currentCurrencyCode, "value": 0},
"totalShipping": {"currency": currentCurrencyCode, "value": 0},
"totalTax": {"currency": currentCurrencyCode, "value": 0}
}
],
"subTotal": {"currency": currentCurrencyCode, "value": <?= /* @noEscape */ $product['price']?>},
"totalPrice": {"currency": currentCurrencyCode, "value": <?= /* @noEscape */ $product['price']?>},
"totalDiscounts": {"currency": currentCurrencyCode, "value": 0},
"totalShipping": {"currency": currentCurrencyCode, "value": 0},
"totalTax": {"currency": currentCurrencyCode, "value": 0}
}
};
placementObject.push(itemPlacement);
};
placementObject.push(itemPlacement);
}
<?php endforeach; ?>
if (typeof window.BreadPayments !== 'undefined' || typeof window.RBCPayPlan !== 'undefined') {
var bread_sdk = null;
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/templates/breadcheckout/view.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<?php endif; ?>
bread_sdk.registerPlacements([{
allowCheckout: false,
domID: 'bread-btn-render',
domID: 'bread-checkout-btn',
order: {
currency: currentCurrencyCode,
items: itemsObject,
Expand Down

0 comments on commit 37e4bf2

Please sign in to comment.