diff --git a/src/app/lib/other/smarty/plugins/block.msp_issuers.php b/src/app/lib/other/smarty/plugins/block.msp_issuers.php deleted file mode 100644 index 652f49f..0000000 --- a/src/app/lib/other/smarty/plugins/block.msp_issuers.php +++ /dev/null @@ -1,70 +0,0 @@ - - * @copyright Copyright (c) 2018 MultiSafepay, Inc. (https://www.multisafepay.com) - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -function smarty_block_msp_issuers($params, $content, &$smarty, &$repeat) -{ - $repeat = false; - $processor_data = fn_get_processor_data($_SESSION['cart']['payment_id']); - - if(empty($processor_data) && isset($_REQUEST['order_id'])) { - $order_info = fn_get_order_info($_REQUEST['order_id']); - $processor_data = fn_get_processor_data($order_info['payment_id']); - } - - require_once (DIR_ROOT . '/app/payments/MultiSafepay.combined.php'); - - if ($processor_data['processor_params']['mode'] == 'T') { - $test = true; - } else { - $test = false; - } - - $msp = new MultiSafepay(); - $msp->test = $test; - $msp->merchant['account_id'] = $processor_data['processor_params']['account']; - $msp->merchant['site_id'] = $processor_data['processor_params']['site_id']; - $msp->merchant['site_code'] = $processor_data['processor_params']['securitycode']; - - $iDealIssuers = $msp->getIdealIssuers(); - - $idealselect = '
'; - $idealselect .= '
'; - - return $idealselect; -} - -?> diff --git a/src/app/lib/other/templater/plugins/block.msp_issuers.php b/src/app/lib/other/templater/plugins/block.msp_issuers.php deleted file mode 100644 index 652f49f..0000000 --- a/src/app/lib/other/templater/plugins/block.msp_issuers.php +++ /dev/null @@ -1,70 +0,0 @@ - - * @copyright Copyright (c) 2018 MultiSafepay, Inc. (https://www.multisafepay.com) - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -function smarty_block_msp_issuers($params, $content, &$smarty, &$repeat) -{ - $repeat = false; - $processor_data = fn_get_processor_data($_SESSION['cart']['payment_id']); - - if(empty($processor_data) && isset($_REQUEST['order_id'])) { - $order_info = fn_get_order_info($_REQUEST['order_id']); - $processor_data = fn_get_processor_data($order_info['payment_id']); - } - - require_once (DIR_ROOT . '/app/payments/MultiSafepay.combined.php'); - - if ($processor_data['processor_params']['mode'] == 'T') { - $test = true; - } else { - $test = false; - } - - $msp = new MultiSafepay(); - $msp->test = $test; - $msp->merchant['account_id'] = $processor_data['processor_params']['account']; - $msp->merchant['site_id'] = $processor_data['processor_params']['site_id']; - $msp->merchant['site_code'] = $processor_data['processor_params']['securitycode']; - - $iDealIssuers = $msp->getIdealIssuers(); - - $idealselect = '
'; - $idealselect .= '
'; - - return $idealselect; -} - -?> diff --git a/src/app/lib/vendor/smarty/smarty/libs/plugins/block.msp_issuers.php b/src/app/lib/vendor/smarty/smarty/libs/plugins/block.msp_issuers.php deleted file mode 100644 index 7a189d7..0000000 --- a/src/app/lib/vendor/smarty/smarty/libs/plugins/block.msp_issuers.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @copyright Copyright (c) 2018 MultiSafepay, Inc. (https://www.multisafepay.com) - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -function smarty_block_msp_issuers($params, $content, &$smarty, &$repeat) -{ - $repeat = false; - $processor_data = fn_get_processor_data($_SESSION['cart']['payment_id']); - - if(empty($processor_data) && isset($_REQUEST['order_id'])) { - $order_info = fn_get_order_info($_REQUEST['order_id']); - $processor_data = fn_get_processor_data($order_info['payment_id']); - } - - require_once (DIR_ROOT . '/app/payments/MultiSafepay.combined.php'); - - if ($processor_data['processor_params']['mode'] == 'T') { - $test = true; - } else { - $test = false; - } - - $msp = new MultiSafepay(); - $msp->test = $test; - $msp->merchant['account_id'] = $processor_data['processor_params']['account']; - $msp->merchant['site_id'] = $processor_data['processor_params']['site_id']; - $msp->merchant['site_code'] = $processor_data['processor_params']['securitycode']; - - $iDealIssuers = $msp->getIdealIssuers(); - - $idealselect = '
'; - $idealselect .= '
'; - - return $idealselect; -} - -?> - diff --git a/src/app/payments/MultiSafepay.combined.php b/src/app/payments/MultiSafepay.combined.php index 5d7f216..239f44b 100644 --- a/src/app/payments/MultiSafepay.combined.php +++ b/src/app/payments/MultiSafepay.combined.php @@ -107,7 +107,6 @@ class MultiSafepay 'phone' => '', 'email' => '', 'gender' => '', - 'issuer' => '' ); var $plugin = array( 'shop' => '', @@ -215,30 +214,6 @@ function checkSettings() $this->merchant['site_code'] = trim($this->merchant['site_code']); } - public function getIdealIssuers() - { - $this->request_xml = $this->createIdealIssuersRequest(); - $this->api_url = $this->getApiUrl(); - $this->reply_xml = $this->xmlPost($this->api_url, $this->request_xml); - $issuers = $this->parseXmlResponse($this->reply_xml); - - - return $issuers; - } - - function createIdealIssuersRequest() - { - $request = ' - - - ' . $this->xmlEscape($this->merchant['account_id']) . ' - ' . $this->xmlEscape($this->merchant['site_id']) . ' - ' . $this->xmlEscape($this->merchant['site_code']) . ' - - '; - return $request; - } - /* * Starts a transaction and returns the payment url */ @@ -589,27 +564,12 @@ function getGateways() $rootNode['gateways']['gateway'] = $xml_gateways; } - // get gatesways + // get gateways $gateways = array(); foreach ($rootNode['gateways']['gateway'] as $xml_gateway) { $gateway = array(); $gateway['id'] = $xml_gateway['id']['VALUE']; $gateway['description'] = $xml_gateway['description']['VALUE']; - - // issuers - if (isset($xml_gateway['issuers'])) { - $issuers = array(); - - foreach ($xml_gateway['issuers']['issuer'] as $xml_issuer) { - $issuer = array(); - $issuer['id'] = $xml_issuer['id']['VALUE']; - $issuer['description'] = $xml_issuer['description']['VALUE']; - $issuers[$issuer['id']] = $issuer; - } - - $gateway['issuers'] = $issuers; - } - $gateways[$gateway['id']] = $gateway; } @@ -623,12 +583,6 @@ function getGateways() function createTransactionRequest() { - // issuer attribute - $issuer = ""; - if (!empty($this->issuer)) { - $issuer = ' issuer="' . $this->xmlEscape($this->issuer) . '"'; - } - $request = ' @@ -690,7 +644,7 @@ function createTransactionRequest() ' . $this->xmlEscape($this->transaction['manual']) . ' ' . $this->xmlEscape($this->transaction['daysactive']) . ' ' . $this->xmlEscape($this->transaction['secondsactive']) . ' - ' . $this->xmlEscape($this->transaction['gateway']) . ' + ' . $this->xmlEscape($this->transaction['gateway']) . ' ' . $this->xmlEscape($this->signature) . ' '; @@ -701,17 +655,6 @@ function createTransactionRequest() function createDirectXMLTransactionRequest() { $this->cart_xml = $this->cart->GetXML(); - $issuer = ""; - if (!empty($this->issuer)) { - $issuer = ' issuer="' . $this->xmlEscape($this->issuer) . '"'; - } - if ($this->extravars != '') { - $gatewayinfo = ' - ' . $this->extravars . ' - '; - } else { - $gatewayinfo = ''; - } $request = ' @@ -727,7 +670,7 @@ function createDirectXMLTransactionRequest() ' . $this->xmlEscape($this->transaction['manual']) . ' ' . $this->xmlEscape($this->transaction['daysactive']) . ' ' . $this->xmlEscape($this->transaction['secondsactive']) . ' - ' . $this->xmlEscape($this->transaction['gateway']) . ' + ' . $this->xmlEscape($this->transaction['gateway']) . ' ' . $this->xmlEscape($this->merchant['account_id']) . ' @@ -776,7 +719,6 @@ function createDirectXMLTransactionRequest() ' . $this->xmlEscape($this->delivery['phone']) . ' ' . $this->xmlEscape($this->delivery['email']) . ' - ' . $gatewayinfo . ' ' . $this->cart_xml . ' ' . $this->xmlEscape($this->signature) . ' '; @@ -786,10 +728,6 @@ function createDirectXMLTransactionRequest() function createDirectBankTransferTransactionRequest() { - $issuer = ""; - if (!empty($this->issuer)) { - $issuer = ' issuer="' . $this->xmlEscape($this->issuer) . '"'; - } $request = ' @@ -804,7 +742,7 @@ function createDirectBankTransferTransactionRequest() ' . $this->xmlEscape($this->transaction['manual']) . ' ' . $this->xmlEscape($this->transaction['daysactive']) . ' ' . $this->xmlEscape($this->transaction['secondsactive']) . ' - ' . $this->xmlEscape($this->transaction['gateway']) . ' + ' . $this->xmlEscape($this->transaction['gateway']) . ' ' . $this->xmlEscape($this->merchant['account_id']) . ' @@ -960,7 +898,6 @@ function createCheckoutRequest() ' . $this->xmlEscape($this->gatewayinfo['bankaccount']) . ' ' . $this->xmlEscape($this->gatewayinfo['phone']) . ' ' . $this->xmlEscape($this->gatewayinfo['email']) . ' - ' . $this->xmlEscape($this->gatewayinfo['issuer']) . ' ' . $this->xmlEscape($this->transaction['id']) . ' @@ -1417,6 +1354,15 @@ function rstrpos($haystack, $needle, $offset = null) return $size - $pos - strlen($needle); } + /* + * Empty method to add retro compatibility + * when some old files are retained in the + * upgrading process + */ + function getIdealIssuers() + { + return null; + } } /** diff --git a/src/app/payments/multisafepay.php b/src/app/payments/multisafepay.php index b649faf..05a7277 100644 --- a/src/app/payments/multisafepay.php +++ b/src/app/payments/multisafepay.php @@ -286,15 +286,15 @@ $msp->transaction['id'] = $order_id; $msp->transaction['currency'] = ($order_info['secondary_currency'] ? $order_info['secondary_currency'] : $processor_data['processor_params']['currency']); $msp->cart->currency = $msp->transaction['currency']; - $msp->transaction['amount'] = fn_format_price_by_currency_multisafepay($order_info['total'], CART_PRIMARY_CURRENCY, CART_SECONDARY_CURRENCY) * 100; + $msp->transaction['amount'] = (int) round(fn_format_price_by_currency_multisafepay($order_info['total'], CART_PRIMARY_CURRENCY, CART_SECONDARY_CURRENCY) * 100, 2); $msp->transaction['description'] = 'Order #' . $msp->transaction['id']; $msp->transaction['items'] = $cart_items; $msp->transaction['gateway'] = getGateway($processor_data['processor_params']['gateway']); $msp->plugin_name = 'CS-Cart 4.x'; - $msp->version = '1.6.2'; + $msp->version = '1.7.0'; $msp->plugin['shop'] = 'CS-Cart'; $msp->plugin['shop_version'] = PRODUCT_VERSION; - $msp->plugin['plugin_version'] = '1.6.1'; + $msp->plugin['plugin_version'] = '1.7.0'; $msp->plugin['partner'] = ''; $msp->plugin['shop_root_url'] = Registry::get('config.current_location'); @@ -444,17 +444,7 @@ $msp->cart->AddAlternateTaxTables($taxtable); } - - if ($processor_data['processor_params']['gateway'] == 'IDEAL' && isset($order_info['payment_info']['issuer']) && $order_info['payment_info']['issuer'] != null) { - $msp->extravars = $order_info['payment_info']['issuer']; - } - - if (in_array($processor_data['processor_params']['gateway'], array('CBC', 'KBC', 'INGHOME', 'ALIPAY', 'PAYPAL'))) { - $url = $msp->startDirectXMLTransaction(); - } elseif ($processor_data['processor_params']['gateway'] == 'IDEAL' && isset($order_info['payment_info']['issuer']) && $order_info['payment_info']['issuer'] != null) { - if (empty($msp->gatewayinfo['issuer'])) { - $msp->gatewayinfo['issuer'] = $order_info['payment_info']['issuer']; - } + if (in_array($processor_data['processor_params']['gateway'], array('ALIPAY', 'CBC', 'IDEAL', 'INGHOME', 'KBC', 'PAYPAL'))) { $url = $msp->startDirectXMLTransaction(); } else { $url = $msp->startCheckout(); diff --git a/src/app/payments/multisafepay/multisafepay_fastcheckout.functions.php b/src/app/payments/multisafepay/multisafepay_fastcheckout.functions.php index 91f031e..951e80a 100644 --- a/src/app/payments/multisafepay/multisafepay_fastcheckout.functions.php +++ b/src/app/payments/multisafepay/multisafepay_fastcheckout.functions.php @@ -37,9 +37,7 @@ function fn_multisafepay_set_fastcheckout($payment_id, $order_id = 0, $order_inf $auth['tax_exempt'] = '0'; $cart['payment_id'] = $payment_id; - - $result = fn_place_order($cart, $auth, $action = '', $issuer_id = null, $parent_order_id = 0); - + $result = fn_place_order($cart, $auth); $processor_data = fn_get_payment_method_data($payment_id); $taxes = array(); @@ -84,14 +82,14 @@ function fn_multisafepay_set_fastcheckout($payment_id, $order_id = 0, $order_inf $msp->customer['forwardedip'] = $ip['proxy']; $msp->transaction['currency'] = (isset($order_info['secondary_currency']) ? $order_info['secondary_currency'] : $processor_data['processor_params']['currency']); - $msp->transaction['amount'] = $order_info['total'] * 100; + $msp->transaction['amount'] = (int) round($order_info['total'] * 100, 2); $msp->transaction['description'] = 'Order #' . $msp->transaction['id']; $msp->transaction['items'] = $cart_items; $msp->plugin_name = 'CS-Cart 4.x'; - $msp->version = '1.6.2'; + $msp->version = '1.7.0'; $msp->plugin['shop'] = 'CS-Cart'; $msp->plugin['shop_version'] = PRODUCT_VERSION; - $msp->plugin['plugin_version'] = '1.6.1'; + $msp->plugin['plugin_version'] = '1.7.0'; $msp->plugin['partner'] = ''; $msp->plugin['shop_root_url'] = Registry::get('config.current_location'); diff --git a/src/app/payments/multisafepay_payafter.php b/src/app/payments/multisafepay_bnpl_mf.php similarity index 100% rename from src/app/payments/multisafepay_payafter.php rename to src/app/payments/multisafepay_bnpl_mf.php diff --git a/src/design/themes/basic/templates/views/orders/components/payments/msp_payafter.tpl b/src/design/backend/templates/views/orders/components/payments/msp_bnpl_mf.tpl similarity index 100% rename from src/design/themes/basic/templates/views/orders/components/payments/msp_payafter.tpl rename to src/design/backend/templates/views/orders/components/payments/msp_bnpl_mf.tpl diff --git a/src/design/backend/templates/views/payments/components/cc_processors/msp_payafter.tpl b/src/design/backend/templates/views/payments/components/cc_processors/msp_bnpl_mf.tpl similarity index 98% rename from src/design/backend/templates/views/payments/components/cc_processors/msp_payafter.tpl rename to src/design/backend/templates/views/payments/components/cc_processors/msp_bnpl_mf.tpl index 1e68dc1..6fad67f 100644 --- a/src/design/backend/templates/views/payments/components/cc_processors/msp_payafter.tpl +++ b/src/design/backend/templates/views/payments/components/cc_processors/msp_bnpl_mf.tpl @@ -1,6 +1,6 @@ {* $Id: cc_multisafepay.tpl,v 1.0 2008/04/20 letun Exp $ *} -{assign var="r_url" value="`$config.http_location`/`$config.customer_index`?dispatch=payment_notification.notify&payment=multisafepay_payafter"} -{assign var="e_url" value="`$config.http_location`/`$config.customer_index`?dispatch=payment_notification&payment_notification.result=multisafepay_payafter"} +{assign var="r_url" value="`$config.http_location`/`$config.customer_index`?dispatch=payment_notification.notify&payment=multisafepay_bnpl_mf"} +{assign var="e_url" value="`$config.http_location`/`$config.customer_index`?dispatch=payment_notification&payment_notification.result=multisafepay_bnpl_mf"}

MultiSafepay

@@ -13,7 +13,7 @@ - + {* account id *}

diff --git a/src/design/themes/basic/templates/addons/my_changes/overrides/views/checkout/components/payments/payments_list.tpl b/src/design/themes/basic/templates/addons/my_changes/overrides/views/checkout/components/payments/payments_list.tpl index 1717b63..8bd47c7 100644 --- a/src/design/themes/basic/templates/addons/my_changes/overrides/views/checkout/components/payments/payments_list.tpl +++ b/src/design/themes/basic/templates/addons/my_changes/overrides/views/checkout/components/payments/payments_list.tpl @@ -42,7 +42,7 @@ {/if} {/if} {else} - {if $smarty.session.cart.total >= $payment_data.processor_params.minamount && $smarty.session.cart.total <= $payment_data.processor_params.maxamount && $payment_data.processor_params.gateway != 'PAYAFTER'} + {if $smarty.session.cart.total >= $payment_data.processor_params.minamount && $smarty.session.cart.total <= $payment_data.processor_params.maxamount && $payment_data.processor_params.gateway != 'BNPL_MF'}
  • @@ -96,7 +96,7 @@ {/if} {/if} {else} - {if $payment_data.processor_params.gateway != 'VISA' && $payment_data.processor_params.gateway != 'MASTERCARD' && $smarty.session.settings.secondary_currencyC.value == 'EUR' && $payment_data.processor_params.gateway != 'PAYAFTER'} + {if $payment_data.processor_params.gateway != 'VISA' && $payment_data.processor_params.gateway != 'MASTERCARD' && $smarty.session.settings.secondary_currencyC.value == 'EUR' && $payment_data.processor_params.gateway != 'BNPL_MF'} {if $smarty.session.cart.total >= $payment_data.processor_params.minamount && $smarty.session.cart.total <= $payment_data.processor_params.maxamount}
  • @@ -123,7 +123,7 @@ {/if} {/if} {/if} - {elseif $payment_data.params.gateway == 'PAYAFTER' && $smarty.session.cart.user_data.b_country == "NL"} + {elseif $payment_data.params.gateway == 'BNPL_MF' && $smarty.session.cart.user_data.b_country == "NL"} {if $smarty.session.cart.total >= $payment_data.processor_params.minamount && $smarty.session.cart.total <= $payment_data.processor_params.maxamount}
  • @@ -181,7 +181,7 @@ {/if} {else} - {if $payment_data.processor_params.gateway != 'VISA' && $payment_data.processor_params.gateway != 'MASTERCARD' && $smarty.session.settings.secondary_currencyC.value == 'EUR' && $payment_data.processor_params.gateway != 'PAYAFTER'} + {if $payment_data.processor_params.gateway != 'VISA' && $payment_data.processor_params.gateway != 'MASTERCARD' && $smarty.session.settings.secondary_currencyC.value == 'EUR' && $payment_data.processor_params.gateway != 'BNPL_MF'}
  • @@ -207,7 +207,7 @@ {/if} {/if} - {elseif $payment_data.params.gateway == 'PAYAFTER' && $smarty.session.cart.user_data.b_country == "NL"} + {elseif $payment_data.params.gateway == 'BNPL_MF' && $smarty.session.cart.user_data.b_country == "NL"} {if $smarty.session.cart.total >= $payment_data.processor_params.minamount && $smarty.session.cart.total <= $payment_data.processor_params.maxamount}
  • diff --git a/src/design/themes/responsive/templates/views/orders/components/payments/msp_payafter.tpl b/src/design/themes/basic/templates/views/orders/components/payments/msp_bnpl_mf.tpl similarity index 100% rename from src/design/themes/responsive/templates/views/orders/components/payments/msp_payafter.tpl rename to src/design/themes/basic/templates/views/orders/components/payments/msp_bnpl_mf.tpl diff --git a/src/design/themes/basic/templates/views/orders/components/payments/msp_ideal.tpl b/src/design/themes/basic/templates/views/orders/components/payments/msp_ideal.tpl index b96cbd4..e69de29 100644 --- a/src/design/themes/basic/templates/views/orders/components/payments/msp_ideal.tpl +++ b/src/design/themes/basic/templates/views/orders/components/payments/msp_ideal.tpl @@ -1 +0,0 @@ -{msp_issuers}{/msp_issuers} diff --git a/src/design/themes/responsive/templates/addons/my_changes/overrides/views/checkout/components/payments/payments_list.tpl b/src/design/themes/responsive/templates/addons/my_changes/overrides/views/checkout/components/payments/payments_list.tpl index 1717b63..8bd47c7 100644 --- a/src/design/themes/responsive/templates/addons/my_changes/overrides/views/checkout/components/payments/payments_list.tpl +++ b/src/design/themes/responsive/templates/addons/my_changes/overrides/views/checkout/components/payments/payments_list.tpl @@ -42,7 +42,7 @@ {/if} {/if} {else} - {if $smarty.session.cart.total >= $payment_data.processor_params.minamount && $smarty.session.cart.total <= $payment_data.processor_params.maxamount && $payment_data.processor_params.gateway != 'PAYAFTER'} + {if $smarty.session.cart.total >= $payment_data.processor_params.minamount && $smarty.session.cart.total <= $payment_data.processor_params.maxamount && $payment_data.processor_params.gateway != 'BNPL_MF'}
  • @@ -96,7 +96,7 @@ {/if} {/if} {else} - {if $payment_data.processor_params.gateway != 'VISA' && $payment_data.processor_params.gateway != 'MASTERCARD' && $smarty.session.settings.secondary_currencyC.value == 'EUR' && $payment_data.processor_params.gateway != 'PAYAFTER'} + {if $payment_data.processor_params.gateway != 'VISA' && $payment_data.processor_params.gateway != 'MASTERCARD' && $smarty.session.settings.secondary_currencyC.value == 'EUR' && $payment_data.processor_params.gateway != 'BNPL_MF'} {if $smarty.session.cart.total >= $payment_data.processor_params.minamount && $smarty.session.cart.total <= $payment_data.processor_params.maxamount}
  • @@ -123,7 +123,7 @@ {/if} {/if} {/if} - {elseif $payment_data.params.gateway == 'PAYAFTER' && $smarty.session.cart.user_data.b_country == "NL"} + {elseif $payment_data.params.gateway == 'BNPL_MF' && $smarty.session.cart.user_data.b_country == "NL"} {if $smarty.session.cart.total >= $payment_data.processor_params.minamount && $smarty.session.cart.total <= $payment_data.processor_params.maxamount}
  • @@ -181,7 +181,7 @@ {/if} {else} - {if $payment_data.processor_params.gateway != 'VISA' && $payment_data.processor_params.gateway != 'MASTERCARD' && $smarty.session.settings.secondary_currencyC.value == 'EUR' && $payment_data.processor_params.gateway != 'PAYAFTER'} + {if $payment_data.processor_params.gateway != 'VISA' && $payment_data.processor_params.gateway != 'MASTERCARD' && $smarty.session.settings.secondary_currencyC.value == 'EUR' && $payment_data.processor_params.gateway != 'BNPL_MF'}
  • @@ -207,7 +207,7 @@ {/if} {/if} - {elseif $payment_data.params.gateway == 'PAYAFTER' && $smarty.session.cart.user_data.b_country == "NL"} + {elseif $payment_data.params.gateway == 'BNPL_MF' && $smarty.session.cart.user_data.b_country == "NL"} {if $smarty.session.cart.total >= $payment_data.processor_params.minamount && $smarty.session.cart.total <= $payment_data.processor_params.maxamount}
  • diff --git a/src/design/themes/responsive/templates/views/orders/components/payments/msp_bnpl_mf.tpl b/src/design/themes/responsive/templates/views/orders/components/payments/msp_bnpl_mf.tpl new file mode 100644 index 0000000..e69de29 diff --git a/src/design/themes/responsive/templates/views/orders/components/payments/msp_ideal.tpl b/src/design/themes/responsive/templates/views/orders/components/payments/msp_ideal.tpl index b96cbd4..e69de29 100644 --- a/src/design/themes/responsive/templates/views/orders/components/payments/msp_ideal.tpl +++ b/src/design/themes/responsive/templates/views/orders/components/payments/msp_ideal.tpl @@ -1 +0,0 @@ -{msp_issuers}{/msp_issuers} diff --git a/src/images/msp/afterpay.png b/src/images/msp/afterpay.png deleted file mode 100644 index 0ab7e55..0000000 Binary files a/src/images/msp/afterpay.png and /dev/null differ diff --git a/src/images/msp/bnpl_mf.png b/src/images/msp/bnpl_mf.png new file mode 100644 index 0000000..84f28c4 Binary files /dev/null and b/src/images/msp/bnpl_mf.png differ diff --git a/src/images/msp/payafter.png b/src/images/msp/payafter.png deleted file mode 100644 index ab80f2c..0000000 Binary files a/src/images/msp/payafter.png and /dev/null differ diff --git a/src/msp_installer.php b/src/msp_installer.php index 4919a18..444f48b 100644 --- a/src/msp_installer.php +++ b/src/msp_installer.php @@ -5,12 +5,12 @@ * * Do not edit or add to this file if you wish to upgrade the MultiSafepay plugin * to newer versions in the future. If you wish to customize the plugin for your - * needs please document your changes and make backups before you update. + * needs, please document your changes and make backups before you update. * * @category MultiSafepay * @package Connect * @author MultiSafepay - * @copyright Copyright (c) MultiSafepay, Inc. (https://www.multisafepay.com) + * @copyright Copyright © MultiSafepay, Inc. (https://www.multisafepay.com) * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR @@ -27,121 +27,181 @@ // Load user configuration define('AREA', true); -define('DIR_ROOT', dirname(__FILE__)); +define('DIR_ROOT', __DIR__); -require_once(dirname(__FILE__) . '/config.php'); +require_once(DIR_ROOT . '/config.php'); -/** - * If this is an update of the plugin, - * we first have to rename some deprecated payment names. - */ +// Declare a global variable to indicate if CLI is being used +global $isCli; +$isCli = (PHP_SAPI === 'cli'); + +if ($isCli) { + echo "Starting msp_installer.php...\n"; +} +$errorCount = 0; + +// Rename deprecated payment names const PAYMENTS_TO_RENAME = [ 'Multisafepay Wallet' => 'MultiSafepay', 'Betaalplan' => 'Santander Consumer Finance Pay per Month', ]; foreach (PAYMENTS_TO_RENAME as $oldName => $newName) { + if ($isCli) { + echo "Renaming payment: $oldName to $newName\n\n"; + } renamePaymentNames($oldName, $newName, $config); } $payments = array( - "BANKTRANS" => "Bank transfer", - "DIRDEB" => "Direct Debit", - "DIRECTBANK" => "SOFORT Banking", - "GIROPAY" => "Giropay", - "IDEAL" => "iDEAL", - "MAESTRO" => "Maestro", - "MASTERCARD" => "Mastercard", - "BANCONTACT" => "Bancontact", - "WALLET" => "MultiSafepay", - "VISA" => "Visa", - "PAYPAL" => "PayPal", - "FERBUY" => "Ferbuy", - "DOTPAY" => "Dotpay", - "PAYSAFECARD" => "Paysafecard", - "PAYAFTER" => "Pay After Delivery", - "EINVOICE" => "E-Invoicing", - "KLARNA" => "Klarna", - "AMEX" => "American Express", - "ING" => "ING Home''Pay", - "KBC" => "KBC", - "BELFIUS" => "Belfius", - "SANTANDER" => "Santander Consumer Finance Pay per Month", - "ALIPAY" => "Alipay", - "TRUSTLY" => "Trustly", - "TRUSTPAY" => "TrustPay", - "EPS" => "EPS", - "IDEALQR" => "iDEAL QR", - "AFTERPAY" => "AfterPay", - "APPLEPAY" => "Apple Pay", - "DBRTP" => "Request to Pay", - "CBC" => "CBC", + 'BANKTRANS' => 'Bank transfer', + 'DIRDEB' => 'Direct Debit', + 'DIRECTBANK' => 'SOFORT Banking', + 'GIROPAY' => 'Giropay', + 'IDEAL' => 'iDEAL', + 'MAESTRO' => 'Maestro', + 'MASTERCARD' => 'Mastercard', + 'BANCONTACT' => 'Bancontact', + 'WALLET' => 'MultiSafepay', + 'VISA' => 'Visa', + 'PAYPAL' => 'PayPal', + 'FERBUY' => 'Ferbuy', + 'DOTPAY' => 'Dotpay', + 'PAYSAFECARD' => 'Paysafecard', + 'BNPL_MF' => 'Pay After Delivery', + 'EINVOICE' => 'E-Invoicing', + 'KLARNA' => 'Klarna', + 'AMEX' => 'American Express', + 'ING' => 'ING Home Pay', + 'KBC' => 'KBC', + 'BELFIUS' => 'Belfius', + 'SANTANDER' => 'Santander Consumer Finance Pay per Month', + 'ALIPAY' => 'Alipay', + 'TRUSTLY' => 'Trustly', + 'TRUSTPAY' => 'TrustPay', + 'EPS' => 'EPS', + 'IDEALQR' => 'iDEAL QR', + 'AFTERPAY' => 'AfterPay', + 'APPLEPAY' => 'Apple Pay', + 'DBRTP' => 'Request to Pay', + 'CBC' => 'CBC', ); - foreach ($payments as $paymentcode => $naam) { - upd($naam, "`" . $config['table_prefix'] . "payment_processors` SET `processor` = 'MultiSafepay " . $naam . "', `processor_script` = 'multisafepay_" . strtolower($paymentcode) . ".php', `admin_template` = 'msp_" . strtolower($paymentcode) . ".tpl', `processor_template` = 'views/orders/components/payments/msp_" . strtolower($paymentcode) . ".tpl', `callback` = 'Y', `type` = 'P'", $config); + if ($isCli) { + echo "Updating payment: $naam with code: $paymentcode\n"; + } + upd($naam, '`' . $config['table_prefix'] . 'payment_processors` SET `processor` = \'MultiSafepay ' . $naam . '\', `processor_script` = \'multisafepay_' . strtolower($paymentcode) . '.php\', `admin_template` = \'msp_' . strtolower($paymentcode) . '.tpl\', `processor_template` = \'views/orders/components/payments/msp_' . strtolower($paymentcode) . '.tpl\', `callback` = \'Y\', `type` = \'P\'', $config); } - $html = ''; $html .= ''; +$html .= 'CS-Cart Gateway Installation | MultiSafepay'; $html .= ''; $html .= ''; -$html .= ''; +$html .= ''; $html .= ''; $html .= ''; -$html .= ''; -$html .= '
    '; -$html .= '

    '; +$html .= ''; +$html .= '
    '; +$html .= '

    '; $html .= '

    CS-Cart MultiSafepay Gateway Installation

    '; $html .= '
    '; $html .= '
    '; $html .= '

    Please remove this file after installation!


    '; + foreach ($payments as $paymentcode => $naam) { $html .= 'Gateway: ' . $naam . ' added
    '; } -$html .= '
    Copyright © ' . date("Y") . ' MultiSafepay. Alle rechten voorbehouden.
    '; +$html .= '
    Copyright © ' . date('Y') . ' MultiSafepay. Alle rechten voorbehouden.
    '; $html .= '
    '; $html .= ''; $html .= ''; -echo $html; + +if (!$isCli) { + echo $html; +} function upd($naam, $query, $config) { + global $errorCount, $isCli; + if ($isCli) { + echo "\nConnecting to database for updating payment: $naam\n"; + } $mysqli = new mysqli($config['db_host'], $config['db_user'], $config['db_password'], $config['db_name']); if ($mysqli->connect_errno) { - printf("Connect failed: %s\n", $mysqli->connect_error); - exit(); + printf('Connect failed: %s\n', $mysqli->connect_error); + $errorCount++; + return; } - $q = $mysqli->query("SELECT * FROM `" . $config['table_prefix'] . "payment_processors` WHERE `processor` = 'MultiSafepay " . $naam . "'"); - - if (!$q || ($n = mysqli_num_rows($q)) == 0) { - $ex = $mysqli->query("INSERT INTO " . $query); - echo 'insert ' . $ex . '
    '; + $q = $mysqli->query('SELECT * FROM `' . $config['table_prefix'] . 'payment_processors` WHERE `processor` = \'MultiSafepay ' . $naam . '\''); + + if (!$q || ((string)mysqli_num_rows($q) === '0')) { + if ($isCli) { + echo "Inserting new payment: $naam\n"; + } + $ex = $mysqli->query('INSERT INTO ' . $query); + if ($isCli) { + echo 'Insert result: ' . ($ex ? 'Success' : 'Failed') . "\n"; + } } else { + if ($isCli) { + echo "Updating existing payment: $naam\n"; + } $r = mysqli_fetch_assoc($q); - $ex = $mysqli->query("UPDATE " . $query . " WHERE `processor_id` = '" . $r['processor_id'] . "'"); - echo 'update ' . $ex . '
    '; + $ex = $mysqli->query('UPDATE ' . $query . ' WHERE `processor_id` = \'' . $r['processor_id'] . '\''); + if ($isCli) { + echo 'Update result: ' . ($ex ? 'Success' : 'Failed') . "\n"; + } + } + if (!$ex) { + $errorCount++; } } - function renamePaymentNames($oldName, $newName, $config) { + global $errorCount, $isCli; + if ($isCli) { + echo "Connecting to database for renaming payment: $oldName to $newName\n"; + } $mysqli = new mysqli($config['db_host'], $config['db_user'], $config['db_password'], $config['db_name']); if ($mysqli->connect_errno) { - printf("Connect failed: %s\n", $mysqli->connect_error); - exit(); + printf('Connect failed: %s\n', $mysqli->connect_error); + $errorCount++; + return; } $query = 'UPDATE ' . $config['table_prefix'] . 'payment_processors' . - " SET processor = 'MultiSafepay " . $newName . "' " . - " WHERE processor = 'MultiSafepay " . $oldName . "'"; + ' SET processor = \'MultiSafepay ' . $newName . '\' ' . + ' WHERE processor = \'MultiSafepay ' . $oldName . '\''; + + if ($isCli) { + echo "Executing query: $query\n"; + } + $result = $mysqli->query($query); - $mysqli->query($query); + if ($result) { + if ($isCli) { + echo "Successfully renamed $oldName to $newName\n\n"; + } + } else { + if ($isCli) { + echo "Error renaming $oldName to $newName: " . $mysqli->error . "\n\n"; + } + $errorCount++; + } +} + +if ($isCli) { + echo "\n" . 'msp_installer.php completed.' . "\n"; + if ($errorCount > 0) { + echo "Total errors: $errorCount\n\n"; + } else { + echo 'No errors encountered.' . "\n\n"; + } }