diff --git a/Block/Adminhtml/Order/View/BreadApiVersionInfo.php b/Block/Adminhtml/Order/View/BreadApiVersionInfo.php new file mode 100644 index 00000000..815ec6ec --- /dev/null +++ b/Block/Adminhtml/Order/View/BreadApiVersionInfo.php @@ -0,0 +1,35 @@ +_reorderHelper = $reorderHelper; + $this->_coreRegistry = $registry; + $this->_salesConfig = $salesConfig; + parent::__construct($context, $registry, $salesConfig, $reorderHelper, $data); + } + +} diff --git a/Helper/Category.php b/Helper/Category.php index 43ac04dc..6ea2a3d5 100644 --- a/Helper/Category.php +++ b/Helper/Category.php @@ -67,7 +67,11 @@ public function useDefaultButtonSizeCategory($store = \Magento\Store\Model\Scope */ public function getBreadCategories($store = \Magento\Store\Model\ScopeInterface::SCOPE_STORE) { - return explode(",", $this->scopeConfig->getValue(self::XML_CONFIG_SELECT_CATEGORIES, $store)); + $selectedCategories =$this->scopeConfig->getValue(self::XML_CONFIG_SELECT_CATEGORIES, $store); + if(!is_null($selectedCategories)) { + return explode(",", $this->scopeConfig->getValue(self::XML_CONFIG_SELECT_CATEGORIES, $store)); + } + return array(); } /** @@ -105,6 +109,11 @@ public function isEnabledForCategory($category) if (!$this->isActive() || !$this->isEnabledOnCAT() || empty($category)) { return false; } + $breadCategories = $this->getBreadCategories(); + if(count($breadCategories) < 1) { + return true; + } + return in_array($category->getId(), $this->getBreadCategories()); } } diff --git a/Helper/Data.php b/Helper/Data.php index f410417d..e3e86e5a 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -63,6 +63,10 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper { const XML_CONFIG_API_SECRET_KEY = 'payment/breadcheckout/api_secret_key'; const XML_CONFIG_API_SANDBOX_PUB_KEY = 'payment/breadcheckout/api_sandbox_public_key'; const XML_CONFIG_API_SANDBOX_SECRET_KEY = 'payment/breadcheckout/api_sandbox_secret_key'; + const XML_CONFIG_CLASSIC_API_PUB_KEY = 'payment/breadcheckout/classic_api_public_key'; + const XML_CONFIG_CLASSIC_API_SECRET_KEY = 'payment/breadcheckout/classic_api_secret_key'; + const XML_CONFIG_CLASSIC_API_SANDBOX_PUB_KEY = 'payment/breadcheckout/classic_api_sandbox_public_key'; + const XML_CONFIG_CLASSIC_API_SANDBOX_SECRET_KEY = 'payment/breadcheckout/classic_api_sandbox_secret_key'; const XML_CONFIG_JS_LIB_LOCATION = 'payment/breadcheckout/js_location'; const XML_CONFIG_BUTTON_ON_PRODUCTS = 'payment/breadcheckout/button_on_products'; const XML_CONFIG_BUTTON_DESIGN = 'payment/breadcheckout/button_design'; @@ -238,12 +242,25 @@ public function getProductTypeMessage($store = \Magento\Store\Model\ScopeInterfa * @param null $store * @return mixed */ - public function getApiPublicKey($storeCode = null, $store = \Magento\Store\Model\ScopeInterface::SCOPE_STORE) { - if ($this->scopeConfig->getValue(self::XML_CONFIG_API_MODE, $store)) { - return $this->scopeConfig->getValue(self::XML_CONFIG_API_PUB_KEY, $store, $storeCode); + public function getApiPublicKey($breadApiVersion = null, $storeCode = null, $store = \Magento\Store\Model\ScopeInterface::SCOPE_STORE) { + $apiVersion = $this->getApiVersion(); + if(!is_null($breadApiVersion)) { + $apiVersion = $breadApiVersion; + } + if($apiVersion === 'bread_2') { + if ($this->scopeConfig->getValue(self::XML_CONFIG_API_MODE, $store)) { + return $this->scopeConfig->getValue(self::XML_CONFIG_API_PUB_KEY, $store, $storeCode); + } else { + return $this->scopeConfig->getValue(self::XML_CONFIG_API_SANDBOX_PUB_KEY, $store, $storeCode); + } } else { - return $this->scopeConfig->getValue(self::XML_CONFIG_API_SANDBOX_PUB_KEY, $store, $storeCode); + if ($this->scopeConfig->getValue(self::XML_CONFIG_API_MODE, $store)) { + return $this->scopeConfig->getValue(self::XML_CONFIG_CLASSIC_API_PUB_KEY, $store, $storeCode); + } else { + return $this->scopeConfig->getValue(self::XML_CONFIG_CLASSIC_API_SANDBOX_PUB_KEY, $store, $storeCode); + } } + } /** @@ -252,15 +269,31 @@ public function getApiPublicKey($storeCode = null, $store = \Magento\Store\Model * @param null $store * @return string */ - public function getApiSecretKey($storeCode = null, $store = \Magento\Store\Model\ScopeInterface::SCOPE_STORE) { - if ($this->scopeConfig->getValue(self::XML_CONFIG_API_MODE, $store)) { - return (string) $this->encryptor->decrypt( - $this->scopeConfig->getValue(self::XML_CONFIG_API_SECRET_KEY, $store, $storeCode) - ); + public function getApiSecretKey($breadApiVersion = null, $storeCode = null, $store = \Magento\Store\Model\ScopeInterface::SCOPE_STORE) { + $apiVersion = $this->getApiVersion(); + if(!is_null($breadApiVersion)) { + $apiVersion = $breadApiVersion; + } + if($apiVersion === 'bread_2') { + if ($this->scopeConfig->getValue(self::XML_CONFIG_API_MODE, $store)) { + return (string) $this->encryptor->decrypt( + $this->scopeConfig->getValue(self::XML_CONFIG_API_SECRET_KEY, $store, $storeCode) + ); + } else { + return (string) $this->encryptor->decrypt( + $this->scopeConfig->getValue(self::XML_CONFIG_API_SANDBOX_SECRET_KEY, $store, $storeCode) + ); + } } else { - return (string) $this->encryptor->decrypt( - $this->scopeConfig->getValue(self::XML_CONFIG_API_SANDBOX_SECRET_KEY, $store, $storeCode) - ); + if ($this->scopeConfig->getValue(self::XML_CONFIG_API_MODE, $store)) { + return (string) $this->encryptor->decrypt( + $this->scopeConfig->getValue(self::XML_CONFIG_CLASSIC_API_SECRET_KEY, $store, $storeCode) + ); + } else { + return (string) $this->encryptor->decrypt( + $this->scopeConfig->getValue(self::XML_CONFIG_CLASSIC_API_SANDBOX_SECRET_KEY, $store, $storeCode) + ); + } } } @@ -307,8 +340,11 @@ public function getJsLibLocation($store = \Magento\Store\Model\ScopeInterface::S * @param null $store * @return mixed */ - public function getTransactionApiUrl($storeCode = null, $store = \Magento\Store\Model\ScopeInterface::SCOPE_STORE) { + public function getTransactionApiUrl($breadApiVersion = null, $storeCode = null, $store = \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $apiVersion = null) { $apiVersion = $this->getApiVersion($storeCode, $store); + if(!is_null($breadApiVersion)) { + $apiVersion = $breadApiVersion; + } if($apiVersion === 'bread_2') { $tenant = strtoupper($this->getConfigClient($storeCode, $store)); if ($this->scopeConfig->getValue(self::XML_CONFIG_API_MODE, $store, $storeCode)) { @@ -1004,8 +1040,9 @@ public function getPlatformApiUri($tenant, $env) { * @return string */ public function getApiVersion($storeCode = null, $store = \Magento\Store\Model\ScopeInterface::SCOPE_STORE) { - if($this->scopeConfig->getValue(self::XML_CONFIG_API_VERSION, $store, $storeCode)) { - return (string) $this->scopeConfig->getValue(self::XML_CONFIG_API_VERSION, $store, $storeCode); + $apiVersion = $this->scopeConfig->getValue(self::XML_CONFIG_API_VERSION, $store, $storeCode); + if($apiVersion) { + return (string) $apiVersion; } else { return 'bread_2'; } diff --git a/Model/Payment/Api/Client.php b/Model/Payment/Api/Client.php index f856ebd8..7e60e202 100644 --- a/Model/Payment/Api/Client.php +++ b/Model/Payment/Api/Client.php @@ -106,15 +106,23 @@ public function setOrder(\Magento\Sales\Model\Order $order) public function cancel($breadTransactionId, $amount = 0, $lineItems = []) { $this->logger->info('Call API Cancel method. Bread trxId: '. $breadTransactionId); + + $apiVersion = $this->helper->getApiVersion(); + $payment = $this->order->getPayment(); + $paymentApiVersion = $payment->getData('bread_api_version'); + $this->logger->info('Payment API version: '. $paymentApiVersion); + if(!is_null($paymentApiVersion) && in_array($paymentApiVersion, ['classic','bread_2'])) { + $apiVersion = strtolower($paymentApiVersion); + } + /* Check if already canceled in bread */ - $transaction = $this->getInfo($breadTransactionId); + $transaction = $this->getInfo($breadTransactionId, $apiVersion); if (strtoupper($transaction['status']) === self::STATUS_CANCELED || strtoupper($transaction['status']) === 'CANCELLED') { $this->logger->info('Transaction is already canceled in Bread. Bread trxId: '. $breadTransactionId); return $transaction; } - $apiVersion = $this->helper->getApiVersion(); - + if ($apiVersion === 'bread_2') { $this->logger->info('Bread platform transaction. Bread trxId: '. $breadTransactionId); $currency = $transaction['totalAmount']['currency']; @@ -178,6 +186,12 @@ public function authorize($breadTransactionId, $amount, $merchantOrderId = null) $validateAmount = $this->getInfo($breadTransactionId); $this->logger->info('Trx: ' . json_encode($validateAmount)); $apiVersion = $this->helper->getApiVersion(); + + $payment = $this->order->getPayment(); + $paymentApiVersion = $payment->getData('bread_api_version'); + if(!is_null($paymentApiVersion) && in_array($paymentApiVersion, ['classic','bread_2'])) { + $apiVersion = strtolower($paymentApiVersion); + } // set transaction id so it can be fetched for split payment cancel $this->setBreadTransactionId($breadTransactionId); @@ -229,10 +243,11 @@ public function authorize($breadTransactionId, $amount, $merchantOrderId = null) 'orderId' => $merchantOrderId ]); $data = '{"externalID":"' . $merchantOrderId . '","metadata":{"externalMerchantData":"externalInfo"}}'; + $updateMerchantOrderIdResult = $this->call( $this->getTransactionInfoUrl($breadTransactionId), $data, - \Zend_Http_Client::PUT, + \Zend_Http_Client::PATCH, false ); $this->logger->info('Response: ' . json_encode($updateMerchantOrderIdResult) . 'Bread trxId: '. $breadTransactionId); @@ -311,6 +326,13 @@ public function settle($breadTransactionId, $amount = null, $currency = null) { $this->logger->info('Call API settle method. Bread trxId: '. $breadTransactionId); $apiVersion = $this->helper->getApiVersion(); + + $payment = $this->order->getPayment(); + $paymentApiVersion = $payment->getData('bread_api_version'); + if(!is_null($paymentApiVersion) && in_array($paymentApiVersion, ['classic','bread_2'])) { + $apiVersion = strtolower($paymentApiVersion); + } + if ($apiVersion === 'bread_2') { $validateAmount = $this->getInfo($breadTransactionId); $currency = trim($validateAmount['totalAmount']['currency']); @@ -358,7 +380,14 @@ public function settle($breadTransactionId, $amount = null, $currency = null) public function refund($breadTransactionId, $amount = 0, $lineItems = [], $currency = null) { $this->logger->info('Call API refund method. Bread trxId: '. $breadTransactionId); - $apiVersion = $this->helper->getApiVersion(); + $apiVersion = $this->helper->getApiVersion(); + + $payment = $this->order->getPayment(); + $paymentApiVersion = $payment->getData('bread_api_version'); + if(!is_null($paymentApiVersion) && in_array($paymentApiVersion, ['classic','bread_2'])) { + $apiVersion = strtolower($paymentApiVersion); + } + if ($apiVersion === 'bread_2') { $validateAmount = $this->getInfo($breadTransactionId); $currency = trim($validateAmount['totalAmount']['currency']); @@ -397,11 +426,11 @@ public function refund($breadTransactionId, $amount = 0, $lineItems = [], $curre * @return mixed * @throws \Exception */ - public function getInfo($breadTransactionId) + public function getInfo($breadTransactionId, $apiVersion = null) { $this->logger->info('Call API getInfo method. Bread trxId: '. $breadTransactionId); return $this->call( - $this->getTransactionInfoUrl($breadTransactionId), + $this->getTransactionInfoUrl($breadTransactionId, $apiVersion), [], \Zend_Http_Client::GET ); @@ -433,7 +462,7 @@ public function submitCartData($data) */ public function getAsLowAs($data) { - $baseUrl = $this->helper->getTransactionApiUrl($this->getStoreId()); + $baseUrl = $this->helper->getTransactionApiUrl('classic', $this->getStoreId()); $asLowAsUrl = join('/', [ trim($baseUrl, '/'), 'aslowas' ]); return $this->call( $asLowAsUrl, @@ -455,11 +484,21 @@ public function getAsLowAs($data) */ protected function call($url, $data, $method = \Zend_Http_Client::POST, $jsonEncode = true) { + $this->logger->info('We are at call'); $storeId = $this->getStoreId(); - $username = $this->helper->getApiPublicKey($storeId); - $password = $this->helper->getApiSecretKey($storeId); $apiVersion = $this->helper->getApiVersion(); + if(!is_null($this->order)) { + $payment = $this->order->getPayment(); + $paymentApiVersion = $payment->getData('bread_api_version'); + if (!is_null($paymentApiVersion) && in_array($paymentApiVersion, ['classic', 'bread_2'])) { + $apiVersion = strtolower($paymentApiVersion); + } + } + $this->logger->info("API Version :: " . $apiVersion ); + $username = $this->helper->getApiPublicKey($apiVersion, $storeId); + $password = $this->helper->getApiSecretKey($apiVersion, $storeId); + if($apiVersion === 'bread_2') { try { $authToken = $this->helper->getAuthToken(); @@ -639,7 +678,7 @@ protected function callBread($url, $authToken, $data, $method = \Zend_Http_Clien curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } - if ($method == \Zend_Http_Client::PUT) { + if ($method == \Zend_Http_Client::PUT || $method == \Zend_Http_Client::PATCH) { $authorization = "Authorization: Bearer " . $authToken; curl_setopt($curl, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', @@ -764,7 +803,7 @@ public function sendEmail($cartId, $email, $name) public function setShippingDetails($transactionId, $trackingNumber, $carrierName) { $apiVersion = $this->helper->getApiVersion(); - $baseUrl = $this->helper->getTransactionApiUrl($this->getStoreId()); + $baseUrl = $this->helper->getTransactionApiUrl(null, $this->getStoreId()); if ($apiVersion === 'bread_2') { @@ -797,10 +836,13 @@ public function setShippingDetails($transactionId, $trackingNumber, $carrierName * @param $transactionId * @return string */ - protected function getTransactionInfoUrl($transactionId) - { + protected function getTransactionInfoUrl($transactionId, $breadApiVersion = null) + { $apiVersion = $this->helper->getApiVersion(); - $baseUrl = $this->helper->getTransactionApiUrl($this->getStoreId()); + if(!is_null($breadApiVersion)) { + $apiVersion = $breadApiVersion; + } + $baseUrl = $this->helper->getTransactionApiUrl($apiVersion, $this->getStoreId()); if ($apiVersion === 'bread_2') { return join('/', [trim($baseUrl, '/'), 'transaction', trim($transactionId, '/')]); } else { @@ -816,7 +858,7 @@ protected function getTransactionInfoUrl($transactionId) */ protected function getUpdateTransactionUrl($transactionId) { - $baseUrl = $this->helper->getTransactionApiUrl($this->getStoreId()); + $baseUrl = $this->helper->getTransactionApiUrl('classic', $this->getStoreId()); return join( '/', [ trim($baseUrl, '/'), 'transactions/actions', trim($transactionId, '/') ] @@ -830,7 +872,8 @@ protected function getUpdateTransactionUrl($transactionId) * @return string */ protected function getAuthTokenUrl() { - $baseUrl = $this->helper->getTransactionApiUrl($this->getStoreId()); + $baseUrl = $this->helper->getTransactionApiUrl('bread_2', $this->getStoreId()); + //return join('/', [trim($baseUrl, '/'), 'auth/service/authorize']); return join('/', [trim($baseUrl, '/'), 'auth/sa/authenticate']); } @@ -851,6 +894,7 @@ protected function generateAuthToken($url, $apiKey, $apiSecret) { $curl = curl_init($url); try { curl_setopt($curl, CURLOPT_HEADER, 0); + curl_setopt($curl, CURLOPT_USERPWD, $apiKey. ':' . $apiSecret); curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, [ @@ -948,7 +992,7 @@ protected function getStoreId() * @param type $action */ protected function getUpdateTransactionUrlPlatform($transactionId, $action) { - $baseUrl = $this->helper->getTransactionApiUrl($this->getStoreId()); + $baseUrl = $this->helper->getTransactionApiUrl('bread_2', $this->getStoreId()); $url = join('/', [trim($baseUrl, '/'), 'transaction', $transactionId, $action]); return $url; } diff --git a/Model/System/Config/Source/ApiVersion.php b/Model/System/Config/Source/ApiVersion.php index 876ec1e0..36cb4cba 100644 --- a/Model/System/Config/Source/ApiVersion.php +++ b/Model/System/Config/Source/ApiVersion.php @@ -20,7 +20,7 @@ class ApiVersion implements \Magento\Framework\Option\ArrayInterface { public function toOptionArray() { return [ ['value' => 'classic', 'label' => __('Bread Classic')], - ['value' => 'bread_2', 'label' => __('Bread 2.0')] + ['value' => 'bread_2', 'label' => __('Bread Platform')] ]; } @@ -32,7 +32,7 @@ public function toOptionArray() { public function toArray() { return [ 'classic' => __('Bread Classic'), - 'bread_2' => __('Bread 2.0') + 'bread_2' => __('Bread Platform') ]; } diff --git a/Observer/SaveBreadApiVersionObserver.php b/Observer/SaveBreadApiVersionObserver.php new file mode 100644 index 00000000..06ad3fa0 --- /dev/null +++ b/Observer/SaveBreadApiVersionObserver.php @@ -0,0 +1,72 @@ +logger = $logger; + $this->_state = $state; + $this->_quoteRepository = $quoteRepository; + $this->helper = $helper; + } + + /** + * + * @param EventObserver $observer + */ + public function execute(EventObserver $observer) { + + if ($this->_state->getAreaCode() != \Magento\Framework\App\Area::AREA_ADMINHTML) { + $paymentOrder = $observer->getEvent()->getPayment(); + $order = $paymentOrder->getOrder(); + $quote = $this->_quoteRepository->get($order->getQuoteId()); + $paymentQuote = $quote->getPayment(); + $method = $paymentQuote->getMethodInstance()->getCode(); + if ($method === \Bread\BreadCheckout\Model\Ui\ConfigProvider::CODE) { + $paymentOrder->setData('bread_api_version', $this->helper->getApiVersion()); + $paymentQuote->setData('bread_api_version', $this->helper->getApiVersion()); + } + } + } + +} diff --git a/Setup/InstallSchema.php b/Setup/InstallSchema.php new file mode 100644 index 00000000..53ba3267 --- /dev/null +++ b/Setup/InstallSchema.php @@ -0,0 +1,51 @@ +startSetup(); + + $setup->getConnection()->addColumn( + $setup->getTable('quote_payment'), + 'bread_api_version', + [ + 'type' => 'text', + 'nullable' => true, + 'comment' => 'Bread version' + ] + ); + + $setup->getConnection()->addColumn( + $setup->getTable('sales_order_payment'), + 'bread_api_version', + [ + 'type' => 'text', + 'nullable' => true, + 'comment' => 'Bread version' + ] + ); + + $setup->endSetup(); + } + +} diff --git a/Setup/UpgradeSchema.php b/Setup/UpgradeSchema.php new file mode 100644 index 00000000..3c8be796 --- /dev/null +++ b/Setup/UpgradeSchema.php @@ -0,0 +1,49 @@ +startSetup(); + + //Extension setup before 2.2.0 did not have the bread_api_version tracking + //column againt quote and order object + if (version_compare($context->getVersion(), '2.3.0', '<')) { + $setup->getConnection()->addColumn( + $setup->getTable('quote_payment'), + 'bread_api_version', + [ + 'type' => 'text', + 'nullable' => true, + 'comment' => 'Bread version' + ] + ); + + $setup->getConnection()->addColumn( + $setup->getTable('sales_order_payment'), + 'bread_api_version', + [ + 'type' => 'text', + 'nullable' => true, + 'comment' => 'Bread version' + ] + ); + } + + $setup->endSetup(); + } + +} \ No newline at end of file diff --git a/composer.json b/composer.json index 36f7f328..3a5f19c0 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Offers Bread Pay financing and checkout tools for your Magento store", "license": "MIT", "minimum-stability": "stable", - "version": "2.2.1", + "version": "2.3.0", "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" }, diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 94c4ada3..b5fc8570 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -32,6 +32,7 @@ 1 + bread_2 @@ -40,6 +41,7 @@ Magento\Config\Model\Config\Backend\Encrypted 1 + bread_2 @@ -55,6 +57,7 @@ 0 + bread_2 @@ -63,6 +66,7 @@ Magento\Config\Model\Config\Backend\Encrypted 0 + bread_2 @@ -73,44 +77,78 @@ bread_2 - + + validate-length maximum-length-60 validate-length minimum-length-20 + + + 1 + classic + + + + validate-length maximum-length-60 + + Magento\Config\Model\Config\Backend\Encrypted + + 1 + classic + + + + validate-length maximum-length-60 validate-length minimum-length-20 + + + 0 + classic + + + + validate-length maximum-length-60 + + Magento\Config\Model\Config\Backend\Encrypted + + 0 + classic + + + Bread\BreadCheckout\Model\System\Config\Source\PaymentAction - + The Position In the Payment Method List In Checkout validate-number - + Magento\Config\Model\Config\Source\Yesno 1 - + Magento\Config\Model\Config\Source\Yesno 1 - + Magento\Config\Model\Config\Source\Yesno 1 - + Magento\Config\Model\Config\Source\Yesno 1 - + Magento\Config\Model\Config\Source\Yesno @@ -124,7 +162,7 @@ ]]> - + Magento\Config\Model\Config\Source\Yesno @@ -132,7 +170,7 @@ classic - + Magento\Config\Model\Config\Source\Yesno @@ -140,11 +178,11 @@ classic - + Magento\Config\Model\Config\Source\Yesno - + - + - + - + Magento\Config\Model\Config\Source\Yesno @@ -193,7 +231,7 @@ classic - + Magento\Config\Model\Config\Source\Yesno @@ -212,25 +250,25 @@ classic - + Magento\Config\Model\Config\Source\Yesno 1 - + Magento\Config\Model\Config\Source\Yesno classic - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno @@ -244,7 +282,7 @@ classic - + Magento\Config\Model\Config\Source\Yesno @@ -258,7 +296,7 @@ classic - + - + Bread\BreadCheckout\Model\System\Config\Source\Tenant - + diff --git a/etc/csp_whitelist.xml b/etc/csp_whitelist.xml index d0a5b1a2..aeeab28c 100644 --- a/etc/csp_whitelist.xml +++ b/etc/csp_whitelist.xml @@ -3,32 +3,30 @@ - https://checkout-sandbox.getbread.com/bread.js - https://checkout.getbread.com/bread.js - https://connect-preview.breadpayments.com/sdk.js - https://connect.breadpayments.com/sdk.js - https://connect-preview.rbc.breadpayments.com/sdk.js - https://connect.rbcpayplan.com/sdk.js + *.getbread.com + *.breadpayments.com + *.rbcpayplan.com - https://checkout-sandbox.getbread.com - https://checkout.getbread.com - https://api-preview.rbc.breadpayments.com - https://api.rbcpayplan.com - https://api-preview.platform.breadpayments.com - https://api.platform.breadpayments.com + *.getbread.com + *.breadpayments.com + *.rbcpayplan.com - https://checkout-sandbox.getbread.com - https://checkout.getbread.com - https://api-preview.platform.breadpayments.com - https://api.platform.breadpayments.com - https://api-preview.rbc.breadpayments.com - https://api.rbcpayplan.com + *.getbread.com + *.breadpayments.com + *.rbcpayplan.com + + + + + *.getbread.com + *.breadpayments.com + *.rbcpayplan.com diff --git a/etc/events.xml b/etc/events.xml new file mode 100644 index 00000000..f180c5ab --- /dev/null +++ b/etc/events.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/etc/module.xml b/etc/module.xml index 60370da7..f4b85f5a 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - + diff --git a/view/adminhtml/layout/sales_order_view.xml b/view/adminhtml/layout/sales_order_view.xml new file mode 100644 index 00000000..5db3d81e --- /dev/null +++ b/view/adminhtml/layout/sales_order_view.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/view/adminhtml/templates/breadcheckout/api_version_info.phtml b/view/adminhtml/templates/breadcheckout/api_version_info.phtml new file mode 100644 index 00000000..0bcd39d8 --- /dev/null +++ b/view/adminhtml/templates/breadcheckout/api_version_info.phtml @@ -0,0 +1,23 @@ +getOrder()->getPayment(); +$method = $payment->getMethodInstance()->getCode(); +$version = $payment->getData('bread_api_version'); +if($version === 'bread_2') { + $version = 'platform'; +} +?> + + +
+
+ + +
+ \ No newline at end of file