Skip to content

Commit

Permalink
Merge pull request #40 from MultiSafepay/release/1.6.0
Browse files Browse the repository at this point in the history
Release of 1.6.0
  • Loading branch information
Jasper-MultiSafepay authored Jun 18, 2021
2 parents 2546cdf + 227be48 commit 0b2f48e
Show file tree
Hide file tree
Showing 22 changed files with 479 additions and 47 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## 1.6.0
Release date - Jun 18th, 2021

### Added
+ DAVAMS-271: Add CBC payment method
+ PLGCSCS-121: Add Request to Pay

### Fixed
+ Include address2 field for house number parsing
+ PLGCSCS-124: Fix incorrect shopping cart when multiple discounts are used

### Changed
+ DAVAMS-347: Update Trustly logo
+ DAVAMS-286: Update name and logo for Santander
+ PLGCSCS-99: Set order to status shipped for all payment methods

***

## 1.5.0
Release date - April 1st, 2020

Expand Down
11 changes: 11 additions & 0 deletions app/addons/multisafepay/addon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0"?>

<addon scheme='3.0'>
<id>multisafepay</id>
<version>1.0</version>
<name>MultiSafepay</name>
<description>MultiSafepay</description>
<priority>100500</priority>
<status>active</status>
<auto_install>PROFESSIONAL,MULTIVENDOR,ULTIMATE</auto_install>
</addon>
45 changes: 45 additions & 0 deletions app/addons/multisafepay/func.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
if (!defined('BOOTSTRAP')) { die('Access denied'); }

require_once(__DIR__ . '/../../payments/MultiSafepay.combined.php');

/**
* Called after new shipment creation.
*
* @param array $shipment_data Array of shipment data.
* @param array $order_info Shipment order info
* @param int $group_key Group number
* @param bool $all_products
* @param int $shipment_id Created shipment identifier
*/
function fn_multisafepay_create_shipment_post($shipment_data, $order_info, $group_key, $all_products, $shipment_id)
{
// Only continue if in the Admin and order is processed by MultiSafepay
if (AREA !== 'A' || empty($shipment_data) || !fn_is_multisafepay_order($order_info)) {
return;
}

$processor_params = $order_info['payment_method']['processor_params'];

$msp = new MultiSafepay();
$msp->test = $processor_params['mode'] === 'T';
$msp->merchant['account_id'] = $processor_params['account'];
$msp->merchant['site_id'] = $processor_params['site_id'];
$msp->merchant['site_code'] = $processor_params['securitycode'];
$msp->transaction['id'] = $shipment_data['order_id'];
$msp->transaction['status'] = 'shipped';
$msp->transaction['tracktracecode'] = $shipment_data['tracking_number'];
$msp->transaction['reason'] = $shipment_data['comments'];
$msp->transaction['carrier'] = $shipment_data['carrier'];
$msp->transaction['shipdate'] = date("Y-m-d", $shipment_data['timestamp']);

$msp->updateTransaction();
}

function fn_is_multisafepay_order($order_info)
{
if (empty($order_info)) {
return false;
}
return strncmp($order_info['payment_method']['processor'], 'MultiSafepay', 12) === 0;
}
4 changes: 4 additions & 0 deletions app/addons/multisafepay/init.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
if (!defined('BOOTSTRAP')) { die('Access denied'); }

fn_register_hooks('create_shipment_post');
5 changes: 5 additions & 0 deletions app/payments/MultiSafepay.combined.php
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,11 @@ function createUpdateTransactionRequest()
<id>' . $this->xmlEscape($this->transaction['id']) . '</id>
<invoiceid>' . $this->xmlEscape($this->transaction['invoice_id']) . '</invoiceid>
<shipdate>' . $this->xmlEscape($this->transaction['shipdate']) . '</shipdate>
<status>' . $this->xmlEscape($this->transaction['status']) . '</status>
<tracktracecode>' . $this->xmlEscape($this->transaction['tracktracecode']) . '</tracktracecode>
<reason>' . $this->xmlEscape($this->transaction['reason']) . '</reason>
<carrier>' . $this->xmlEscape($this->transaction['carrier']) . '</carrier>
<shipdate>' . $this->xmlEscape($this->transaction['shipdate']) . '</shipdate>
</transaction>
</updatetransaction>';

Expand Down
65 changes: 29 additions & 36 deletions app/payments/multisafepay.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
$msp->customer['country'] = $order_info['b_country'];
$msp->customer['ipaddress'] = $ip['host'];
$msp->customer['forwardedip'] = $ip['proxy'];
$msp->parseCustomerAddress($order_info['b_address']);
$msp->parseCustomerAddress($order_info['b_address'] . ' ' . $order_info['b_address_2']);

$msp->delivery['firstname'] = $order_info['s_firstname'];
$msp->delivery['lastname'] = $order_info['s_lastname'];
Expand All @@ -281,7 +281,7 @@
$msp->delivery['state'] = $order_info['s_state'];
$msp->delivery['phone'] = $order_info['s_phone'];
$msp->delivery['country'] = $order_info['s_country'];
$msp->parseDeliveryAddress($order_info['s_address']);
$msp->parseDeliveryAddress($order_info['s_address'] . ' ' . $order_info['s_address_2']);

$msp->transaction['id'] = $order_id;
$msp->transaction['currency'] = ($order_info['secondary_currency'] ? $order_info['secondary_currency'] : $processor_data['processor_params']['currency']);
Expand All @@ -291,10 +291,10 @@
$msp->transaction['items'] = $cart_items;
$msp->transaction['gateway'] = getGateway($processor_data['processor_params']['gateway']);
$msp->plugin_name = 'CS-Cart 4.x';
$msp->version = '1.5.0';
$msp->version = '1.6.0';
$msp->plugin['shop'] = 'CS-Cart';
$msp->plugin['shop_version'] = PRODUCT_VERSION;
$msp->plugin['plugin_version'] = '1.5.0';
$msp->plugin['plugin_version'] = '1.6.0';
$msp->plugin['partner'] = '';
$msp->plugin['shop_root_url'] = Registry::get('config.current_location');

Expand Down Expand Up @@ -365,34 +365,31 @@

//add shipping line item
$shipping_cost = $order_info['shipping_cost'];
if ($shipping_cost >0) {
// Get (first) Shipping method
$shipping = reset($order_info['shipping']);
// Get (first) Shipping method
$shipping = reset($order_info['shipping']);

// Get (first) Shipping tax
if (!empty($shipping['taxes'])) {
$shipping_tax = reset($shipping['taxes']);
}
// Get (first) Shipping tax
if (!empty($shipping['taxes'])) {
$shipping_tax = reset($shipping['taxes']);
}

if (empty($shipping_tax)) {
$taxid = 'no-tax';
} else {
$rate = $shipping_tax['rate_value'];
$taxid = $shipping_tax['description'] . '-' . $rate;
$taxes[$taxid] = $rate;
if (empty($shipping_tax)) {
$taxid = 'no-tax';
} else {
$rate = $shipping_tax['rate_value'];
$taxid = $shipping_tax['description'] . '-' . $rate;
$taxes[$taxid] = $rate;

if ($shipping_tax['price_includes_tax'] == 'Y') {
$shipping_cost = $shipping_cost - $shipping_tax['tax_subtotal'];
}
if ($shipping_tax['price_includes_tax'] == 'Y') {
$shipping_cost = $shipping_cost - $shipping_tax['tax_subtotal'];
}


$c_item = new MspItem($shipping['shipping'], __('Shipping'), 1, fn_format_price_by_currency_multisafepay($shipping_cost, CART_PRIMARY_CURRENCY, CART_SECONDARY_CURRENCY), 'KG', 0);
$c_item->SetMerchantItemId('msp-shipping');
$c_item->SetTaxTableSelector($taxid);
$msp->cart->AddItem($c_item);
}

$c_item = new MspItem($shipping['shipping'], __('Shipping'), 1, fn_format_price_by_currency_multisafepay($shipping_cost, CART_PRIMARY_CURRENCY, CART_SECONDARY_CURRENCY), 'KG', 0);
$c_item->SetMerchantItemId('msp-shipping');
$c_item->SetTaxTableSelector($taxid);
$msp->cart->AddItem($c_item);


//Add payment surcharge
$total_surcharge = $order_info['payment_surcharge'];
Expand Down Expand Up @@ -422,19 +419,15 @@
$msp->cart->AddItem($c_item);
}


if (isset($order_info['promotions'])) {
foreach ($order_info['promotions'] as $key => $value) {
if ($order_info['subtotal_discount'] != '0.00') {
$discount_price = $order_info['subtotal_discount'];
$c_item = new MspItem($value['name'], 'Discount Price', 1, ('-' . fn_format_price_by_currency_multisafepay($discount_price, CART_PRIMARY_CURRENCY, CART_SECONDARY_CURRENCY)));
$c_item->SetTaxTableSelector('no-tax');
$msp->cart->AddItem($c_item);
}
if ($order_info['subtotal_discount'] != '0.00') {
$discount_price = $order_info['subtotal_discount'];
$c_item = new MspItem('Order discount', 'Amount', 1, ('-' . fn_format_price_by_currency_multisafepay($discount_price, CART_PRIMARY_CURRENCY, CART_SECONDARY_CURRENCY)));
$c_item->SetTaxTableSelector('no-tax');
$msp->cart->AddItem($c_item);
}
}


$taxrule = new MspDefaultTaxRule($taxes['no-tax'], false);
$msp->cart->AddDefaultTaxRules($taxrule);

Expand All @@ -451,7 +444,7 @@
$msp->extravars = $order_info['payment_info']['issuer'];
}

if (in_array($processor_data['processor_params']['gateway'], array('KBC', 'INGHOME', 'ALIPAY', 'PAYPAL'))) {
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) {
$url = $msp->startDirectXMLTransaction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ function fn_multisafepay_set_fastcheckout($payment_id, $order_id = 0, $order_inf
$msp->transaction['description'] = 'Order #' . $msp->transaction['id'];
$msp->transaction['items'] = $cart_items;
$msp->plugin_name = 'CS-Cart 4.x';
$msp->version = '1.5.0';
$msp->version = '1.6.0';

$msp->plugin['shop'] = 'CS-Cart';
$msp->plugin['shop_version'] = PRODUCT_VERSION;
$msp->plugin['plugin_version'] = '1.5.0';
$msp->plugin['plugin_version'] = '1.6.0';
$msp->plugin['partner'] = '';
$msp->plugin['shop_root_url'] = Registry::get('config.current_location');

Expand Down
23 changes: 23 additions & 0 deletions app/payments/multisafepay_cbc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
*
* DISCLAIMER
*
* 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.
*
* @category MultiSafepay
* @package Connect
* @author MultiSafepay <integration@multisafepay.com>
* @copyright Copyright (c) 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.
*/

require_once('multisafepay.php');
24 changes: 24 additions & 0 deletions app/payments/multisafepay_dbrtp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/**
*
* DISCLAIMER
*
* 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.
*
* @category MultiSafepay
* @package Connect
* @author TechSupport <techsupport@multisafepay.com>
* @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.
*/
require_once('multisafepay.php');
?>
Empty file.
Empty file.
Loading

0 comments on commit 0b2f48e

Please sign in to comment.