Example #1
0
        }
    }
} else {
    $conf_key = md5($order_id . TIME . Tygh::$app['session']['auth']['user_id']);
    $data = array('order_id' => $order_id, 'type' => 'E', 'data' => $conf_key);
    db_query("REPLACE INTO ?:order_data ?e", $data);
    $submit_url = 'https://vault.safepay.com.au/cgi-bin/' . ($processor_data['processor_params']['mode'] == 'live' ? 'make' : 'test') . '_payment.pl';
    $return_url = fn_url("payment_notification.notify?payment=direct_one&order_id={$order_id}", AREA, 'current');
    $process_url = fn_url("payment_notification.process?payment=direct_one&order_id={$order_id}&payment_number=&conf_key={$conf_key}", AREA, 'current');
    $post_data = array('vendor_name' => $processor_data['processor_params']['merchant_id'], 'return_link_url' => $return_url, 'reply_link_url' => $process_url, 'Billing_name' => $order_info['b_firstname'], 'Billing_address1' => $order_info['b_address'], 'Billing_address2' => $order_info['b_address_2'], 'Billing_city' => $order_info['b_city'], 'Billing_state' => $order_info['b_state_descr'], 'Billing_zip' => $order_info['b_zipcode'], 'Billing_country' => $order_info['b_country_descr'], 'Delivery_name' => $order_info['s_firstname'], 'Delivery_address1' => $order_info['s_address'], 'Delivery_address2' => $order_info['s_address_2'], 'Delivery_city' => $order_info['s_city'], 'Delivery_state' => $order_info['s_state_descr'], 'Delivery_zip' => $order_info['s_zipcode'], 'Delivery_country' => $order_info['s_country_descr'], 'Contact_email' => $order_info['email'], 'Contact_phone' => $order_info['phone'], 'information_fields' => 'Billing_name,Billing_address1,Billing_address2,Billing_city,Billing_state,Billing_zip,Billing_country,Delivery_name,Delivery_address1,Delivery_address2,Delivery_city,Delivery_state,Delivery_zip,Delivery_country,Contact_email,Contact_phone', 'suppress_field_names' => '', 'hidden_fields' => '', 'print_zero_qty' => false);
    if (empty($order_info['use_gift_certificates']) && !floatval($order_info['subtotal_discount']) && empty($order_info['points_info']['in_use'])) {
        // Products
        if (!empty($order_info['products'])) {
            foreach ($order_info['products'] as $k => $v) {
                $v['product'] = htmlspecialchars(strip_tags($v['product']));
                $v['price'] = fn_format_price(($v['subtotal'] - fn_external_discounts($v)) / $v['amount']);
                $post_data[$v['product']] = "{$v['amount']},{$v['price']}";
            }
        }
        // Taxes
        if (!empty($order_info['taxes']) && Registry::get('settings.General.tax_calculation') == 'subtotal') {
            foreach ($order_info['taxes'] as $tax_id => $tax) {
                if ($tax['price_includes_tax'] == 'Y') {
                    continue;
                }
                $item_name = htmlspecialchars(strip_tags($tax['description']));
                $item_price = fn_format_price($tax['tax_subtotal']);
                $post_data[$item_name] = "1,{$item_price}";
            }
        }
        // Gift Certificates
Example #2
0
    <input type="hidden" name="ship_country" value="{$order_info['s_country']}" />
    <input type="hidden" name="fixed" value="Y" />
    <input type="hidden" name="id_type" value="1" />
    <input type="hidden" name="sh_cost" value="{$sh_cost}" />
    <input type="hidden" name="demo" value="{$is_test}" />
    <input type="hidden" name="dispatch" value="payment_notification" />
    <input type="hidden" name="payment" value="2checkout" />
    <input type="hidden" name="order_id" value="{$order_id}" />
EOT;
    // Products
    $it = 0;
    if (!empty($order_info['products'])) {
        foreach ($order_info['products'] as $k => $v) {
            $it++;
            $is_tangible = !empty($v['extra']['is_edp']) && $v['extra']['is_edp'] == 'Y' ? 'N' : 'Y';
            $price = fn_format_price($v['price'] - fn_external_discounts($v) / $v['amount']);
            $suffix = "_{$it}";
            echo <<<EOT
    <input type="hidden" name="c_prod{$suffix}" value="{$v['product_id']},{$v['amount']}" />
    <input type="hidden" name="c_name{$suffix}" value="{$v['product']}" />
    <input type="hidden" name="c_description{$suffix}" value="{$v['product']}" />
    <input type="hidden" name="c_price{$suffix}" value="{$price}" />
    <input type="hidden" name="c_tangible{$suffix}" value="{$is_tangible}" />
EOT;
        }
    }
    // Certificates
    if (!empty($order_info['gift_certificates'])) {
        foreach ($order_info['gift_certificates'] as $k => $v) {
            $it++;
            $v['amount'] = !empty($v['extra']['exclude_from_calculate']) ? 0 : $v['amount'];
Example #3
0
 $post['CustomerName'] = $order_info['firstname'] . ' ' . $order_info['lastname'];
 $post['ContactNumber'] = $order_info['phone'];
 $post['ContactFax'] = $order_info['fax'];
 $post['CustomerEMail'] = $order_info['email'];
 // Form Cart products
 $strings = 0;
 $products_string = '';
 if (!empty($order_info['products']) && is_array($order_info['products'])) {
     $strings += count($order_info['products']);
 }
 if (!empty($order_info['gift_certificates']) && is_array($order_info['gift_certificates'])) {
     $strings += count($order_info['gift_certificates']);
 }
 if (!empty($order_info['products'])) {
     foreach ($order_info['products'] as $v) {
         $products_string .= ":" . str_replace(':', ' ', $v['product']) . ':' . $v['amount'] . ':' . fn_format_price(($v['subtotal'] - fn_external_discounts($v)) / $v['amount']) . ':::' . fn_format_price($v['subtotal'] - fn_external_discounts($v));
     }
 }
 if (!empty($order_info['gift_certificates'])) {
     foreach ($order_info['gift_certificates'] as $v) {
         $v['amount'] = !empty($v['extra']['exclude_from_calculate']) ? 0 : $v['amount'];
         $products_string .= ':' . str_replace(':', ' ', $v['gift_cert_code']) . ':1:' . fn_format_price($v['amount']) . ':::' . fn_format_price($v['amount']);
     }
 }
 if (floatval($order_info['payment_surcharge'])) {
     $products_string .= ':Payment surcharge:---:---:---:---:' . fn_format_price($order_info['payment_surcharge']);
     $strings++;
 }
 if (fn_order_shipping_cost($order_info)) {
     $products_string .= ':Shipping cost:---:---:---:---:' . fn_format_price($order_info['shipping_cost']);
     $strings++;
Example #4
0
     // all other states
 } else {
     $_b_state = fn_get_state_name($order_info['b_state'], $order_info['b_country']);
 }
 $return_url = fn_url("payment_notification.return?payment=paypal&order_id={$order_id}", AREA, 'current');
 $cancel_url = fn_url("payment_notification.cancel?payment=paypal&order_id={$order_id}", AREA, 'current');
 $notify_url = fn_url("payment_notification.notify?payment=paypal&order_id={$order_id}", AREA, 'current');
 $post_data = array('charset' => 'utf-8', 'cmd' => '_cart', 'custom' => $order_id, 'invoice' => $paypal_order_id, 'redirect_cmd' => '_xclick', 'rm' => 2, 'email' => $order_info['email'], 'first_name' => $order_info['b_firstname'], 'last_name' => $order_info['b_lastname'], 'address1' => $order_info['b_address'], 'address2' => $order_info['b_address_2'], 'country' => $order_info['b_country'], 'city' => $order_info['b_city'], 'state' => $_b_state, 'zip' => $order_info['b_zipcode'], 'day_phone_a' => $_ph_a, 'day_phone_b' => $_ph_b, 'day_phone_c' => $_ph_c, 'night_phone_a' => $_ph_a, 'night_phone_b' => $_ph_b, 'night_phone_c' => $_ph_c, 'business' => $paypal_account, 'item_name' => $paypal_item_name, 'amount' => $paypal_total, 'upload' => '1', 'handling_cart' => $paypal_shipping, 'currency_code' => $paypal_currency, 'return' => $return_url, 'cancel_return' => $cancel_url, 'notify_url' => $notify_url, 'bn' => 'ST_ShoppingCart_Upload_US');
 $i = 1;
 // Products
 if (empty($order_info['use_gift_certificates']) && !floatval($order_info['subtotal_discount']) && empty($order_info['points_info']['in_use']) && count($order_info['products']) < MAX_PAYPAL_PRODUCTS) {
     if (!empty($order_info['products'])) {
         foreach ($order_info['products'] as $k => $v) {
             $suffix = '_' . $i++;
             $v['product'] = htmlspecialchars(strip_tags($v['product']));
             $v['price'] = fn_format_price(($v['subtotal'] - fn_external_discounts($v)) / $v['amount'], $paypal_currency);
             $post_data["item_name{$suffix}"] = $v['product'];
             $post_data["amount{$suffix}"] = $v['price'];
             $post_data["quantity{$suffix}"] = $v['amount'];
             if (!empty($v['product_options'])) {
                 foreach ($v['product_options'] as $_k => $_v) {
                     $_v['option_name'] = htmlspecialchars(strip_tags($_v['option_name']));
                     $_v['variant_name'] = htmlspecialchars(strip_tags($_v['variant_name']));
                     $post_data["on{$_k}{$suffix}"] = $_v['option_name'];
                     $post_data["os{$_k}{$suffix}"] = $_v['variant_name'];
                 }
             }
         }
     }
     if (!empty($order_info['taxes']) && Registry::get('settings.General.tax_calculation') == 'subtotal') {
         foreach ($order_info['taxes'] as $tax_id => $tax) {
Example #5
0
             foreach ($order_info['shipping'] as $_k => $_v) {
                 // Find shipping id in the item key
                 if (substr($item_id, 0, strrpos($item_id, '_')) == "S_" . $_k) {
                     $_tax_s[$_k] = $value['rate_value'];
                 }
             }
         }
     }
 }
 // Products
 if (!empty($order_info['items'])) {
     foreach ($order_info['items'] as $k => $v) {
         $post[] = "<freeform_purchase>";
         $post[] = "<line_number>" . ++$i . "</line_number>";
         $post[] = "<description><![CDATA[" . $v['product'] . "]]></description>";
         $post[] = "<price_including_vat>" . fn_format_price(($v['subtotal'] - fn_external_discounts($v) + @$product_tax[$v['cart_id']]) / $v['amount']) . "</price_including_vat>";
         $post[] = "<vat_percentage>" . $_tax . "</vat_percentage>";
         $post[] = "<quantity>" . $v['amount'] . "</quantity>";
         $post[] = "</freeform_purchase>";
     }
 }
 // Gift Cartificates
 if (!empty($order_info['gift_certificates'])) {
     foreach ($order_info['gift_certificates'] as $k => $v) {
         $v['amount'] = !empty($v['extra']['exclude_from_calculate']) ? 0 : $v['amount'];
         $post[] = "<freeform_purchase>";
         $post[] = "<line_number>" . ++$i . "</line_number>";
         $post[] = "<description><![CDATA[" . $v['gift_cert_code'] . "]]></description>";
         $post[] = "<price_including_vat>" . fn_format_price($v['amount']) . "</price_including_vat>";
         $post[] = "<vat_percentage>0</vat_percentage>";
         $post[] = "<quantity>1</quantity>";
Example #6
0
function fn_pp_standart_prepare_products($order_info, $paypal_currency = '', $max_pp_products = MAX_PAYPAL_PRODUCTS)
{
    $post_data = array();
    $product_count = 1;
    if (empty($paypal_currency)) {
        $paypal_currency = !empty($order_info['payment_method']['processor_params']['currency']) ? $order_info['payment_method']['processor_params']['currency'] : CART_PRIMARY_CURRENCY;
    }
    $paypal_shipping = fn_order_shipping_cost($order_info);
    $paypal_total = fn_format_price($order_info['total'] - $paypal_shipping, $paypal_currency);
    if (empty($order_info['use_gift_certificates']) && !floatval($order_info['subtotal_discount']) && empty($order_info['points_info']['in_use']) && count($order_info['products']) < MAX_PAYPAL_PRODUCTS) {
        $i = 1;
        if (!empty($order_info['products'])) {
            foreach ($order_info['products'] as $k => $v) {
                $suffix = '_' . $i++;
                $v['product'] = htmlspecialchars(strip_tags($v['product']));
                $v['price'] = fn_format_price(($v['subtotal'] - fn_external_discounts($v)) / $v['amount'], $paypal_currency);
                $post_data["item_name{$suffix}"] = $v['product'];
                $post_data["amount{$suffix}"] = $v['price'];
                $post_data["quantity{$suffix}"] = $v['amount'];
                if (!empty($v['product_options'])) {
                    foreach ($v['product_options'] as $_k => $_v) {
                        $_v['option_name'] = htmlspecialchars(strip_tags($_v['option_name']));
                        $_v['variant_name'] = htmlspecialchars(strip_tags($_v['variant_name']));
                        $post_data["on{$_k}{$suffix}"] = $_v['option_name'];
                        $post_data["os{$_k}{$suffix}"] = $_v['variant_name'];
                    }
                }
            }
        }
        if (!empty($order_info['taxes']) && Registry::get('settings.General.tax_calculation') == 'subtotal') {
            foreach ($order_info['taxes'] as $tax_id => $tax) {
                if ($tax['price_includes_tax'] == 'Y') {
                    continue;
                }
                $suffix = '_' . $i++;
                $item_name = htmlspecialchars(strip_tags($tax['description']));
                $item_price = fn_format_price($tax['tax_subtotal'], $paypal_currency);
                $post_data["item_name{$suffix}"] = $item_name;
                $post_data["amount{$suffix}"] = $item_price;
                $post_data["quantity{$suffix}"] = '1';
            }
        }
        // Gift Certificates
        if (!empty($order_info['gift_certificates'])) {
            foreach ($order_info['gift_certificates'] as $k => $v) {
                $suffix = '_' . $i++;
                $v['gift_cert_code'] = htmlspecialchars($v['gift_cert_code']);
                $v['amount'] = !empty($v['extra']['exclude_from_calculate']) ? 0 : fn_format_price($v['amount'], $paypal_currency);
                $post_data["item_name{$suffix}"] = $v['gift_cert_code'];
                $post_data["amount{$suffix}"] = $v['amount'];
                $post_data["quantity{$suffix}"] = '1';
            }
        }
        if (fn_allowed_for('MULTIVENDOR') && fn_take_payment_surcharge_from_vendor('')) {
            $take_surcharge = false;
        } else {
            $take_surcharge = true;
        }
        // Payment surcharge
        if ($take_surcharge && floatval($order_info['payment_surcharge'])) {
            $suffix = '_' . $i++;
            $name = __('surcharge');
            $payment_surcharge_amount = fn_format_price($order_info['payment_surcharge'], $paypal_currency);
            $post_data["item_name{$suffix}"] = $name;
            $post_data["amount{$suffix}"] = $payment_surcharge_amount;
            $post_data["quantity{$suffix}"] = '1';
        }
        $product_count = $i - 1;
    } elseif ($paypal_total <= 0) {
        $post_data['item_name_1'] = __('total_product_cost');
        $post_data['amount_1'] = fn_format_price($order_info['total'], $paypal_currency);
        $post_data['quantity_1'] = '1';
        $post_data['amount'] = fn_format_price($order_info['total'], $paypal_currency);
        $post_data['shipping_1'] = 0;
    } else {
        $post_data['item_name_1'] = __('total_product_cost');
        $post_data['amount_1'] = $paypal_total;
        $post_data['quantity_1'] = '1';
    }
    return array($post_data, $product_count);
}
Example #7
0
            $pp_response['order_status'] = 'P';
            $pp_response['reason_text'] = __('kupivkredit_widget_processed');
        }
    }
    if (fn_check_payment_script('kupivkredit.php', $order_id)) {
        fn_finish_payment($order_id, $pp_response);
        fn_order_placement_routines('route', $order_id, false);
    }
} else {
    $url = $processor_data['processor_params']['test'] == 'Y' ? 'https://' . KVK_WIDGET_TEST_URL : 'https://' . KVK_WIDGET_URL;
    $kvk_order_id = ($order_info['repaid'] ? $order_info['order_id'] . '_' . $order_info['repaid'] : $order_info['order_id']) . '_' . fn_date_format(time(), '%H_%M_%S');
    //We should save this iformation for the actions such as 'confirm order', 'cancel order' in the admin area.
    fn_update_order_payment_info($order_id, array('kvk_order_id' => $kvk_order_id));
    $order = array();
    foreach ($order_info['products'] as $k => $item) {
        $price = fn_format_price(($item['subtotal'] - fn_external_discounts($item)) / $item['amount']);
        $order['items'][] = array('title' => $item['product'], 'category' => db_get_field("SELECT ?:category_descriptions.category FROM ?:category_descriptions LEFT JOIN ?:products_categories ON ?:category_descriptions.category_id = ?:products_categories.category_id WHERE ?:products_categories.product_id = ?i AND ?:products_categories.link_type = ?s AND ?:category_descriptions.lang_code = ?s", $item['product_id'], 'M', $order_info['lang_code']), 'qty' => $item['amount'], 'price' => fn_format_rate_value($price, 'F', 0, '.', '', ''));
    }
    if (!empty($order_info['shipping_cost'])) {
        $order['items'][] = array('title' => __('shipping_cost'), 'category' => '', 'qty' => 1, 'price' => fn_format_rate_value($order_info['shipping_cost'], 'F', 0, '.', '', ''));
    }
    if (!empty($order_info['taxes'])) {
        foreach ($order_info['taxes'] as $tax) {
            if ($tax['price_includes_tax'] == 'N') {
                $order['items'][] = array('title' => __('tax'), 'category' => '', 'qty' => 1, 'price' => fn_format_rate_value($tax['tax_subtotal'], 'F', 0, '.', '', ''));
            }
        }
    }
    $surcharge = isset($order_info['payment_surcharge']) ? intval($order_info['payment_surcharge']) : 0;
    if ($surcharge != 0) {
        $order['items'][] = array('title' => __('payment_surcharge'), 'category' => '', 'qty' => 1, 'price' => fn_format_rate_value($order_info['payment_surcharge'], 'F', 0, '.', '', ''));
Example #8
0
 $post_data['shipping_city'] = $order_info['s_city'];
 // if ($order_info['b_country'] == 'US') {
 $post_data['shipping_state'] = $order_info['s_state'];
 // }
 $post_data['shipping_country'] = $order_info['s_country'];
 $post_data['shipping_zip'] = $order_info['s_zipcode'];
 if (!empty($order_info['b_company'])) {
     $post_data['company'] = $order_info['b_company'];
 }
 if (empty($order_info['use_gift_certificates']) && !floatval($order_info['subtotal_discount']) && empty($order_info['points_info']['in_use'])) {
     // Products
     if (!empty($order_info['products'])) {
         foreach ($order_info['products'] as $k => $v) {
             $tax = !empty($v['tax_value']) ? $v['tax_value'] : 0;
             $post_data['sku'][] = $v['product_code'];
             $post_data['price'][] = fn_format_price(($v['subtotal'] - fn_external_discounts($v) - $tax) / $v['amount']);
             $post_data['tax_amount'][] = $tax / $v['amount'];
             $post_data['description'][] = htmlspecialchars(strip_tags($v['product']));
             $post_data['quantity'][] = $v['amount'];
         }
     }
     // Taxes
     if (!empty($order_info['taxes']) && Registry::get('settings.General.tax_calculation') == 'subtotal') {
         foreach ($order_info['taxes'] as $tax_id => $tax) {
             if ($tax['price_includes_tax'] == 'Y') {
                 continue;
             }
             $post_data['sku'][] = 'TAX' . $tax_id;
             $post_data['price'][] = $tax['tax_subtotal'];
             $post_data['tax_amount'][] = 0;
             $post_data['description'][] = htmlspecialchars(strip_tags($tax['description']));
Example #9
0
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Http;
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
$error_message = array("N" => "Transaction not authorised. Failure message text available to merchant", "C" => "Communication problem. Trying again later may well work", "P:A" => "Pre-bank checks. Amount not supplied or invalid", "P:X" => "Pre-bank checks. Not all mandatory parameters supplied", "P:P" => "Pre-bank checks. Same payment presented twice", "P:S" => "Pre-bank checks. Start date invalid", "P:E" => "Pre-bank checks. Expiry date invalid", "P:I" => "Pre-bank checks. Issue number invalid", "P:C" => "Pre-bank checks. Card number fails LUHN check", "P:T" => "Pre-bank checks. Card type invalid - i.e. does not match card number prefix", "P:N" => "Pre-bank checks. Customer name not supplied", "P:M" => "Pre-bank checks. Merchant does not exist or not registered yet", "P:B" => "Pre-bank checks. Merchant account for card type does not exist", "P:D" => "Pre-bank checks. Merchant account for this currency does not exist", "P:V" => "Pre-bank checks. CV2 security code mandatory and not supplied / invalid", "P:R" => "Pre-bank checks. Transaction timed out awaiting a virtual circuit. Merchant may not have enough virtual circuits for the volume of business.", "P:#" => "Pre-bank checks. No MD5 hash / token key set up against account");
$_order_id = $order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id;
// Order details
$ord = '';
if (!empty($order_info['products'])) {
    foreach ($order_info['products'] as $v) {
        $ord .= ",prod=" . $v['product_code'];
        $ord .= ",item_amount=" . fn_format_price(($v['subtotal'] - fn_external_discounts($v)) / $v['amount']) . "x" . $v['amount'];
    }
}
if (!empty($order_info['taxes']) && Registry::get('settings.General.tax_calculation') == 'subtotal') {
    foreach ($order_info['taxes'] as $tax_id => $tax) {
        if ($tax['price_includes_tax'] == 'N') {
            $ord .= ",prod=" . $tax['description'];
            $ord .= ",item_amount=" . fn_format_price($tax['tax_subtotal']) . "x1";
        }
    }
}
if (!empty($order_info['gift_certificates'])) {
    foreach ($order_info['gift_certificates'] as $v) {
        $v['amount'] = !empty($v['extra']['exclude_from_calculate']) ? 0 : $v['amount'];
        $ord .= ",prod=" . $v['gift_cert_code'];
        $ord .= ",item_amount=" . fn_format_price($v['amount']) . "x1";
Example #10
0
 $post[] = "<purchase>";
 $post[] = "<currency>" . $processor_data["processor_params"]["currency"] . "</currency>";
 $post[] = "<reference_id>" . ($order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id) . "</reference_id>";
 $post[] = "<purchase_list>";
 $i = 0;
 // Products
 if (!empty($order_info['products'])) {
     foreach ($order_info['products'] as $k => $v) {
         $product_tax = 0;
         if (!empty($order_info['taxes'])) {
             list($product_tax, $tax_percent) = fn_get_pay_read_tax($order_info['taxes'], $k);
         }
         $post[] = "<freeform_purchase>";
         $post[] = "<line_number>" . ++$i . "</line_number>";
         $post[] = "<description><![CDATA[" . $v['product'] . "]]></description>";
         $post[] = "<price_including_vat>" . fn_format_price($v['price'] - fn_external_discounts($v) + $product_tax / $v['amount']) . "</price_including_vat>";
         $post[] = "<vat_percentage>{$tax_percent}</vat_percentage>";
         $post[] = "<quantity>" . $v['amount'] . "</quantity>";
         $post[] = "</freeform_purchase>";
     }
 }
 // Gift Cartificates
 if (!empty($order_info['gift_certificates'])) {
     foreach ($order_info['gift_certificates'] as $k => $v) {
         $v['amount'] = !empty($v['extra']['exclude_from_calculate']) ? 0 : $v['amount'];
         $post[] = "<freeform_purchase>";
         $post[] = "<line_number>" . ++$i . "</line_number>";
         $post[] = "<description><![CDATA[" . $v['gift_cert_code'] . "]]></description>";
         $post[] = "<price_including_vat>" . fn_format_price($v['amount']) . "</price_including_vat>";
         $post[] = "<vat_percentage>0</vat_percentage>";
         $post[] = "<quantity>1</quantity>";
Example #11
0
 $post_encrypted .= 'DeliveryCity=' . $order_info['s_city'] . '&';
 $post_encrypted .= 'DeliveryFirstnames=' . $order_info['s_firstname'] . '&';
 $post_encrypted .= 'DeliverySurname=' . $order_info['s_lastname'] . '&';
 // Form Ordered products
 $strings = 0;
 $products_string = '';
 if (!empty($order_info['items']) && is_array($order_info['items'])) {
     $strings += count($order_info['items']);
 }
 if (!empty($order_info['gift_certificates']) && is_array($order_info['gift_certificates'])) {
     $strings += count($order_info['gift_certificates']);
 }
 if (!empty($order_info['items'])) {
     foreach ($order_info['items'] as $v) {
         //		$v['discount'] = empty($v['discount']) ? 0 : $v['discount'];
         $products_string .= ":" . str_replace(":", " ", $v['product']) . ":" . $v['amount'] . ":" . fn_format_price(($v['subtotal'] - fn_external_discounts($v)) / $v['amount']) . ":::" . fn_format_price($v['subtotal'] - fn_external_discounts($v));
     }
 }
 if (!empty($order_info['gift_certificates'])) {
     foreach ($order_info['gift_certificates'] as $v) {
         $v['amount'] = !empty($v['extra']['exclude_from_calculate']) ? 0 : $v['amount'];
         $products_string .= ":" . str_replace(":", " ", $v['gift_cert_code']) . ":1:" . fn_format_price($v['amount']) . ":::" . fn_format_price($v['amount']);
     }
 }
 if (floatval($order_info['payment_surcharge'])) {
     $products_string .= ":Payment surcharge:---:---:---:---:" . fn_format_price($order_info['payment_surcharge']);
     $strings++;
 }
 if (fn_order_shipping_cost($order_info)) {
     $products_string .= ":Shipping cost:---:---:---:---:" . fn_order_shipping_cost($order_info);
     $strings++;
 $post_encrypted .= 'DeliveryCity=' . $order_info['s_city'] . '&';
 $post_encrypted .= 'DeliveryFirstnames=' . $order_info['s_firstname'] . '&';
 $post_encrypted .= 'DeliverySurname=' . $order_info['s_lastname'] . '&';
 // Form Ordered products
 $strings = 0;
 $products_string = '';
 if (!empty($order_info['products']) && is_array($order_info['products'])) {
     $strings += count($order_info['products']);
 }
 if (!empty($order_info['gift_certificates']) && is_array($order_info['gift_certificates'])) {
     $strings += count($order_info['gift_certificates']);
 }
 if (!empty($order_info['products'])) {
     foreach ($order_info['products'] as $v) {
         //		$v['discount'] = empty($v['discount']) ? 0 : $v['discount'];
         $products_string .= ":" . str_replace(":", " ", $v['product']) . ":" . $v['amount'] . ":" . fn_format_price(($v['subtotal'] - fn_external_discounts($v)) / $v['amount'], CART_PRIMARY_CURRENCY, null, false) . ":::" . fn_format_price($v['subtotal'] - fn_external_discounts($v), CART_PRIMARY_CURRENCY, null, false);
     }
 }
 if (!empty($order_info['gift_certificates'])) {
     foreach ($order_info['gift_certificates'] as $v) {
         $v['amount'] = !empty($v['extra']['exclude_from_calculate']) ? 0 : $v['amount'];
         $products_string .= ":" . str_replace(":", " ", $v['gift_cert_code']) . ":1:" . fn_format_price($v['amount'], CART_PRIMARY_CURRENCY, null, false) . ":::" . fn_format_price($v['amount'], CART_PRIMARY_CURRENCY, null, false);
     }
 }
 if (floatval($order_info['payment_surcharge'])) {
     $products_string .= ":Payment surcharge:---:---:---:---:" . fn_format_price($order_info['payment_surcharge'], CART_PRIMARY_CURRENCY, null, false);
     $strings++;
 }
 if (fn_order_shipping_cost($order_info)) {
     $products_string .= ":Shipping cost:---:---:---:---:" . fn_order_shipping_cost($order_info);
     $strings++;