Exemplo n.º 1
1
 public static function apiUpdateOrder($order, $response)
 {
     if (!defined('ORDER_MANAGEMENT')) {
         define('ORDER_MANAGEMENT', true);
     }
     if (!empty($order['status'])) {
         $statuses = fn_get_statuses(STATUSES_ORDER, false, true);
         if (!isset($statuses[$order['status']])) {
             $response->addError('ERROR_OBJECT_UPDATE', str_replace('[object]', 'orders', __('twgadmin_wrong_api_object_data')));
         } else {
             fn_change_order_status($order['order_id'], $order['status']);
         }
     }
     $cart = array();
     fn_clear_cart($cart, true);
     $customer_auth = fn_fill_auth(array(), array(), false, 'C');
     fn_form_cart($order['order_id'], $cart, $customer_auth);
     $cart['order_id'] = $order['order_id'];
     // update only profile data
     $profile_data = fn_check_table_fields($order, 'user_profiles');
     $cart['user_data'] = fn_array_merge($cart['user_data'], $profile_data);
     $cart['user_data'] = fn_array_merge($cart['user_data'], $order);
     fn_calculate_cart_content($cart, $customer_auth, 'A', true, 'I');
     if (!empty($order['details'])) {
         db_query('UPDATE ?:orders SET details = ?s WHERE order_id = ?i', $order['details'], $order['order_id']);
     }
     if (!empty($order['notes'])) {
         $cart['notes'] = $order['notes'];
     }
     fn_update_payment_surcharge($cart, $customer_auth);
     list($order_id, $process_payment) = fn_place_order($cart, $customer_auth, 'save');
     return array($order_id, $process_payment);
 }
Exemplo n.º 2
0
 public function update($status)
 {
     $map = $this->getMap();
     $new_status = $this->default_status;
     if (isset($map[$status])) {
         $new_status = $map[$status];
     }
     self::$from_api = true;
     $result = fn_change_order_status($this->order['order_id'], $new_status);
     self::$from_api = false;
     return $result;
 }
Exemplo n.º 3
0
             }
             if ($amount == 0) {
                 continue;
             }
             $_data = array('item_id' => $key, 'shipment_id' => $shipment_id, 'order_id' => $_REQUEST['shipment_data']['order_id'], 'product_id' => $order_info['items'][$key]['product_id'], 'amount' => $amount);
             db_query("INSERT INTO ?:shipment_items ?e", $_data);
         }
         $force_notification = fn_get_notification_rules($_REQUEST);
         if (!empty($force_notification['C'])) {
             $shipment = array('shipment_id' => $shipment_id, 'timestamp' => $shipment_data['timestamp'], 'shipping' => db_get_field('SELECT shipping FROM ?:shipping_descriptions WHERE shipping_id = ?i', $shipment_data['shipping_id']), 'tracking_number' => $shipment_data['tracking_number'], 'carrier' => $shipment_data['carrier'], 'comments' => $shipment_data['comments'], 'items' => $_REQUEST['shipment_data']['products']);
             $view_mail->assign('shipment', $shipment);
             $view_mail->assign('order_info', $order_info);
             fn_send_mail($order_info['email'], Registry::get('settings.Company.company_orders_department'), 'shipments/shipment_products_subj.tpl', 'shipments/shipment_products.tpl', '', $order_info['lang_code']);
         }
         if (!empty($shipment_data['order_status'])) {
             fn_change_order_status($_REQUEST['shipment_data']['order_id'], $shipment_data['order_status']);
         }
         fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('shipment_has_been_created'));
     } else {
         fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('products_for_shipment_not_selected'));
     }
     $suffix = '.details?order_id=' . $_REQUEST['shipment_data']['order_id'];
 } elseif ($mode == 'packing_slip' && !empty($_REQUEST['shipment_ids'])) {
     $html = array();
     $params = $_REQUEST;
     foreach ($params['shipment_ids'] as $k => $v) {
         list($shipment, $order_info) = fn_get_packing_info($v);
         $view_mail->assign('order_info', $order_info);
         $view_mail->assign('shipment', $shipment);
         if (DISPATCH_EXTRA == 'pdf') {
             $html[] = $view_mail->display('orders/print_packing_slip.tpl', false);
Exemplo n.º 4
0
/**
 * Create/update shipment
 *
 * @param array $shipment_data Array of shipment data.
 * @param int $shipment_id Shipment identifier
 * @param int $group_key Group number
 * @param bool $all_products
 * @param mixed $force_notification user notification flag (true/false), if not set, will be retrieved from status parameters
 * @return int $shipment_id
 */
function fn_update_shipment($shipment_data, $shipment_id = 0, $group_key = 0, $all_products = false, $force_notification = array())
{
    if (!empty($shipment_id)) {
        $arow = db_query("UPDATE ?:shipments SET tracking_number = ?s, carrier = ?s WHERE shipment_id = ?i", $shipment_data['tracking_number'], $shipment_data['carrier'], $shipment_id);
        if ($arow === false) {
            fn_set_notification('E', __('error'), __('object_not_found', array('[object]' => __('shipment'))), '', '404');
            $shipment_id = false;
        }
    } else {
        if (empty($shipment_data['order_id']) || empty($shipment_data['shipping_id'])) {
            return false;
        }
        $order_info = fn_get_order_info($shipment_data['order_id'], false, true, true);
        $use_shipments = Settings::instance()->getValue('use_shipments', '', $order_info['company_id']) == 'Y' ? true : false;
        if (!$use_shipments && empty($shipment_data['tracking_number']) && empty($shipment_data['tracking_number'])) {
            return false;
        }
        if (!$use_shipments && $all_products) {
            foreach ($order_info['product_groups'] as $group) {
                foreach ($group['products'] as $item_key => $product) {
                    if (!empty($product['extra']['group_key'])) {
                        if ($group_key == $product['extra']['group_key']) {
                            $shipment_data['products'][$item_key] = $product['amount'];
                        }
                    } elseif ($group_key == 0) {
                        $shipment_data['products'][$item_key] = $product['amount'];
                    }
                }
            }
        }
        if (!empty($shipment_data['products']) && fn_check_shipped_products($shipment_data['products'])) {
            fn_set_hook('create_shipment', $shipment_data, $order_info, $group_key, $all_products);
            foreach ($shipment_data['products'] as $key => $amount) {
                if (isset($order_info['products'][$key])) {
                    $amount = intval($amount);
                    if ($amount > $order_info['products'][$key]['amount'] - $order_info['products'][$key]['shipped_amount']) {
                        $shipment_data['products'][$key] = $order_info['products'][$key]['amount'] - $order_info['products'][$key]['shipped_amount'];
                    }
                }
            }
            if (fn_check_shipped_products($shipment_data['products'])) {
                $shipment_data['timestamp'] = time();
                $shipment_id = db_query("INSERT INTO ?:shipments ?e", $shipment_data);
                foreach ($shipment_data['products'] as $key => $amount) {
                    if ($amount == 0) {
                        continue;
                    }
                    $_data = array('item_id' => $key, 'shipment_id' => $shipment_id, 'order_id' => $shipment_data['order_id'], 'product_id' => $order_info['products'][$key]['product_id'], 'amount' => $amount);
                    db_query("INSERT INTO ?:shipment_items ?e", $_data);
                }
                if (fn_check_permissions('orders', 'update_status', 'admin') && !empty($shipment_data['order_status'])) {
                    fn_change_order_status($shipment_data['order_id'], $shipment_data['order_status']);
                }
                /**
                 * 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
                 */
                fn_set_hook('create_shipment_post', $shipment_data, $order_info, $group_key, $all_products, $shipment_id);
                if (!empty($force_notification['C'])) {
                    $shipment = array('shipment_id' => $shipment_id, 'timestamp' => $shipment_data['timestamp'], 'shipping' => db_get_field('SELECT shipping FROM ?:shipping_descriptions WHERE shipping_id = ?i AND lang_code = ?s', $shipment_data['shipping_id'], $order_info['lang_code']), 'tracking_number' => $shipment_data['tracking_number'], 'carrier' => $shipment_data['carrier'], 'comments' => $shipment_data['comments'], 'items' => $shipment_data['products']);
                    Mailer::sendMail(array('to' => $order_info['email'], 'from' => 'company_orders_department', 'data' => array('shipment' => $shipment, 'order_info' => $order_info), 'tpl' => 'shipments/shipment_products.tpl', 'company_id' => $order_info['company_id']), 'C', $order_info['lang_code']);
                }
                fn_set_notification('N', __('notice'), __('shipment_has_been_created'));
            }
        } else {
            fn_set_notification('E', __('error'), __('products_for_shipment_not_selected'));
        }
    }
    return $shipment_id;
}
Exemplo n.º 5
0
/**
 * Function delete order
 *
 * @param int $order_id
 */
function fn_delete_order($order_id)
{
    // Log order deletion
    fn_log_event('orders', 'delete', array('order_id' => $order_id));
    fn_change_order_status($order_id, STATUS_INCOMPLETED_ORDER, '', fn_get_notification_rules(array(), false));
    // incomplete to increase inventory
    fn_set_hook('delete_order', $order_id);
    db_query("DELETE FROM ?:new_orders WHERE order_id = ?i", $order_id);
    db_query("DELETE FROM ?:order_data WHERE order_id = ?i", $order_id);
    db_query("DELETE FROM ?:order_details WHERE order_id = ?i", $order_id);
    db_query("DELETE FROM ?:orders WHERE order_id = ?i", $order_id);
    db_query("DELETE FROM ?:product_file_ekeys WHERE order_id = ?i", $order_id);
    db_query("DELETE FROM ?:profile_fields_data WHERE object_id = ?i AND object_type='O'", $order_id);
    db_query("DELETE FROM ?:order_docs WHERE order_id = ?i", $order_id);
}
Exemplo n.º 6
0
     $processor_data = fn_get_payment_method_data($payment_id);
     $order_info = fn_get_order_info($_REQUEST['order_id']);
     $order_number_id = $processor_data['processor_params']['mode'] == 'test' ? '1' : $_REQUEST['order_number'];
     $pp_response = array();
     if (strtoupper(md5($processor_data['processor_params']['secret_word'] . $processor_data['processor_params']['account_number'] . $order_number_id . $order_info['total'])) == $_REQUEST['key'] && $_REQUEST['credit_card_processed'] == 'Y') {
         $pp_response['order_status'] = $processor_data['processor_params']['fraud_verification'] == 'Y' ? $processor_data['processor_params']['fraud_wait'] : 'P';
         $pp_response['reason_text'] = __('order_id') . '-' . $_REQUEST['order_number'];
     } else {
         $pp_response['order_status'] = $_REQUEST['credit_card_processed'] == 'K' ? 'O' : 'F';
         $pp_response['reason_text'] = $_REQUEST['credit_card_processed'] == 'Y' ? "MD5 Hash is invalid" : __('order_id') . '-' . $_REQUEST['order_number'];
     }
     $pp_response['transaction_id'] = !empty($_REQUEST['tcoid']) ? $_REQUEST['tcoid'] : '';
     if (fn_check_payment_script('2checkout.php', $_REQUEST['order_id'])) {
         if ($processor_data['processor_params']['fraud_verification'] == 'Y') {
             fn_update_order_payment_info($_REQUEST['order_id'], $pp_response);
             fn_change_order_status($_REQUEST['order_id'], $pp_response['order_status'], '', false);
         } else {
             fn_finish_payment($_REQUEST['order_id'], $pp_response, false);
         }
         fn_order_placement_routines('route', $_REQUEST['order_id']);
     }
     // Fraud checking notification
 } elseif (!empty($_REQUEST['message_type']) && $_REQUEST['message_type'] == 'FRAUD_STATUS_CHANGED') {
     if (!empty($_REQUEST['vendor_order_id'])) {
         list($order_id) = explode('_', $_REQUEST['vendor_order_id']);
         if (!empty($order_id)) {
             $payment_id = db_get_field("SELECT payment_id FROM ?:orders WHERE order_id = ?i", $order_id);
             $processor_data = fn_get_payment_method_data($payment_id);
             $pp_response = array();
             if ($_REQUEST['fraud_status'] == 'pass') {
                 $pp_response['order_status'] = 'P';
Exemplo n.º 7
0
function fn_anti_fraud_remove_status()
{
    $settings = Registry::get('addons.anti_fraud');
    $o_ids = db_get_fields('SELECT order_id FROM ?:orders WHERE status = ?s', $settings['antifraud_order_status']);
    if (!empty($o_ids)) {
        foreach ($o_ids as $order_id) {
            fn_change_order_status($order_id, 'O');
            // Change order status from "Fraud checking" to "Open"
        }
    }
    fn_delete_status($settings['antifraud_order_status'], 'O');
}
Exemplo n.º 8
0
<?php

if (!defined('AREA')) {
    die('Access denied');
}
fn_change_order_status($orderId, 'O');
// Redirect to widget page
$postUrl = fn_url('paymentwall.payment&order_id=' . $order_info['order_id']);
$_SESSION['pw_order_id'] = $order_info['order_id'];
header("Location: {$postUrl}");
// Cancel auto redirect payment
exit;
 }
 if ($process_payment == true) {
     $payment_info = !empty($cart['payment_info']) ? $cart['payment_info'] : array();
     fn_start_payment($order_id, fn_get_notification_rules($_REQUEST), $payment_info);
 }
 if (!empty($_REQUEST['update_order']['details'])) {
     db_query('UPDATE ?:orders SET details = ?s WHERE order_id = ?i', $_REQUEST['update_order']['details'], $order_id);
 }
 $notification_rules = fn_get_notification_rules($_REQUEST);
 // change status if it posted
 if (!empty($_REQUEST['order_status'])) {
     $order_info = fn_get_order_short_info($order_id);
     if ($order_info['status'] != $_REQUEST['order_status']) {
         if ($process_payment == true) {
             fn_set_notification('W', __('warning'), __('status_changed_after_process_payment'));
         } elseif (fn_change_order_status($order_id, $_REQUEST['order_status'], '', $notification_rules)) {
             $order_info = fn_get_order_short_info($order_id);
             $new_status = $order_info['status'];
             if ($_REQUEST['order_status'] != $new_status) {
                 fn_set_notification('W', __('warning'), __('status_changed'));
             }
         } else {
             $error = false;
             if ($order_info['is_parent_order'] == 'Y') {
                 $suborders = fn_get_suborders_info($order_id);
                 if ($suborders) {
                     foreach ($suborders as $suborder) {
                         if ($suborder['status'] != $_REQUEST['order_status']) {
                             $error = true;
                             break;
                         }
Exemplo n.º 10
0
    if ($mode == 'notify') {
        $order_id = (int) $_REQUEST['order_id'];
        $order_info = fn_get_order_info($order_id);
        $processor_data = $order_info['payment_method'];
        // We are trying to avoid mess with declined and success urls
        $sign = md5($processor_data['processor_params']['product_id'] . '-' . $order_info['total'] . '-' . $processor_data['processor_params']['sharedsec']);
        // Because the callback comes only after return we have to make sure that this redirect is successful
        if (in_array($order_info['status'], array('D')) || empty($_REQUEST['sign']) || $sign != $_REQUEST['sign']) {
            $pp_response['order_status'] = 'D';
            $pp_response["reason_text"] = __('text_transaction_declined');
            fn_finish_payment($order_id, $pp_response, false);
        } else {
            // Set open status until callback from chronopay service is recieved
            if (fn_check_payment_script('chronopay_form.php', $order_id)) {
                if (isset($order_info['payment_info']['awaiting_callback']) && $order_info['payment_info']['awaiting_callback'] == true) {
                    fn_change_order_status($order_id, 'O', $order_info['status'], false);
                }
            }
        }
        fn_order_placement_routines('route', $order_id);
    }
} else {
    if (!defined('BOOTSTRAP')) {
        die('Access denied');
    }
    $post_url = fn_payment_url('current', 'chronopay_form.php');
    $return_url = fn_url("payment_notification.notify?payment=chronopay_form&order_id={$order_id}", AREA, 'current');
    $country = db_get_field("SELECT code_A3 FROM ?:countries WHERE code = ?s", $order_info['b_country']);
    $product_name = "";
    // Products
    if (!empty($order_info['products'])) {
Exemplo n.º 11
0
    die('Access denied');
}
$hsbc_errors = array("1" => "The user cancelled the transaction.", "2" => "The processor declined the transaction for an unknown reason.", "3" => "The transaction was declined because of a problem with the card. For example, an invalid card number or expiration date was specified.", "4" => "The processor did not return a response.", "5" => "The amount specified in the transaction was either too high or too low for the processor.", "6" => "The specified currency is not supported by either the processor or the card.", "7" => "The order is invalid because the order ID is a duplicate.", "8" => "The transaction was rejected by FraudShield.", "9" => "The transaction was placed in Review state by FraudShield.", "10" => "The transaction failed because of invalid input data.", "11" => "The transaction failed because the CPI was configured incorrectly.", "12" => "The transaction failed because the Storefront was configured incorrectly.", "13" => "The connection timed out.", "14" => "The transaction failed because the cardholders browser refused a cookie.", "15" => "The customers browser does not support 128-bit encryption.", "16" => "The CPI cannot communicate with the Secure ePayment engine.");
if (defined('PAYMENT_NOTIFICATION')) {
    if ($mode == 'notify') {
        $pp_response = array();
        if (empty($_REQUEST['CpiResultsCode'])) {
            $pp_response["order_status"] = "P";
            $pp_response["reason_text"] = "CpiResultsCode: " . $_REQUEST['CpiResultsCode'];
        } else {
            $pp_response["order_status"] = "F";
            $pp_response["reason_text"] = $hsbc_errors[$_REQUEST['CpiResultsCode']];
        }
        $order_id = $_REQUEST['OrderId'];
        if (fn_check_payment_script('hsbc.php', $order_id)) {
            fn_change_order_status($order_id, $pp_response["order_status"], '', true);
        }
        exit;
    } elseif ($mode == 'invoice') {
        if (empty($_REQUEST['CpiResultsCode'])) {
            $pp_response["order_status"] = "P";
            $pp_response["reason_text"] = "CpiResultsCode: " . $_REQUEST['CpiResultsCode'];
        } else {
            $pp_response["order_status"] = "F";
            $pp_response["reason_text"] = $hsbc_errors[$_REQUEST['CpiResultsCode']];
        }
        $order_id = $_REQUEST['OrderId'];
        if (fn_check_payment_script('hsbc.php', $order_id)) {
            fn_finish_payment($order_id, $pp_response, false);
            fn_order_placement_routines($order_id);
        }
Exemplo n.º 12
0
function fn_get_ebay_orders()
{
    $success_orders = $failed_orders = array();
    setlocale(LC_TIME, 'en_US');
    $params = array('OrderStatus' => 'Completed');
    $last_transaction = db_get_field('SELECT timestamp FROM ?:ebay_cached_transactions WHERE type = ?s AND status = ?s ORDER BY timestamp DESC', 'orders', 'C');
    // Need user_id
    if (!empty($last_transaction)) {
        $params['CreateTimeFrom'] = gmstrftime("%Y-%m-%dT%H:%M:%S", $last_transaction);
        $params['CreateTimeTo'] = gmstrftime("%Y-%m-%dT%H:%M:%S", TIME);
    }
    $data = array('timestamp' => TIME, 'user_id' => $_SESSION['auth']['user_id'], 'session_id' => Session::getId(), 'status' => 'A', 'type' => 'orders', 'result' => '', 'site_id' => 0);
    $transaction_id = db_query('INSERT INTO ?:ebay_cached_transactions ?e', $data);
    list(, $ebay_orders) = Ebay::instance()->GetOrders($params);
    $data = array('status' => 'C', 'result' => count($ebay_orders));
    db_query('UPDATE ?:ebay_cached_transactions SET ?u WHERE transaction_id = ?i', $data, $transaction_id);
    if (!empty($ebay_orders)) {
        foreach ($ebay_orders as $k => $v) {
            $item_transactions = $v['TransactionArray'];
            $cart = $products = array();
            if (!is_array($item_transactions)) {
                $item_transactions = array($item_transactions->Transaction);
            }
            $i = 1;
            foreach ($item_transactions as $item) {
                $email = (string) $item->Buyer->Email;
                break;
            }
            $shipping_address = $v['ShippingAddress'];
            $customer_name = explode(' ', (string) $shipping_address->Name);
            $firstname = array_shift($customer_name);
            $lastname = implode(' ', $customer_name);
            $cart = array('user_id' => 0, 'company_id' => Registry::get('runtime.company_id'), 'email' => $email, 'ebay_order_id' => $v['OrderID'], 'status' => 'P', 'timestamp' => strtotime($v['CreatedTime']), 'payment_id' => 0, 'user_data' => array('firstname' => $firstname, 'lastname' => $lastname, 'phone' => (string) $shipping_address->Phone, 's_firstname' => $firstname, 's_lastname' => $lastname, 's_address' => (string) $shipping_address->Street1, 's_city' => (string) $shipping_address->CityName, 's_state' => (string) $shipping_address->StateOrProvince, 's_country' => (string) $shipping_address->Country, 's_phone' => (string) $shipping_address->Phone, 's_zipcode' => (string) $shipping_address->PostalCode, 'b_firstname' => $firstname, 'b_lastname' => $lastname, 'b_address' => (string) $shipping_address->Street1, 'b_city' => (string) $shipping_address->CityName, 'b_state' => (string) $shipping_address->StateOrProvince, 'b_country' => (string) $shipping_address->Country, 'b_phone' => (string) $shipping_address->Phone, 'b_zipcode' => (string) $shipping_address->PostalCode), 'total' => $v['Total'], 'subtotal' => $v['Subtotal'], 'shipping_cost' => (double) $v['ShippingServiceSelected']->ShippingServiceCost);
            foreach ($item_transactions as $item) {
                $_item = (array) $item->Item;
                $product_id = db_get_field('SELECT product_id FROM ?:ebay_template_products WHERE ebay_item_id = ?i', $_item['ItemID']);
                // Need check company_id
                if (!$product_id) {
                    continue;
                }
                $product = fn_get_product_data($product_id, $cart['user_data']);
                $extra = array("product_options" => array());
                $options = db_get_array('SELECT ?:product_options.option_id, ?:product_options_descriptions.option_name, ?:product_option_variants_descriptions.variant_id, ?:product_option_variants_descriptions.variant_name
                FROM ?:product_options
                JOIN ?:product_option_variants ON ?:product_option_variants.option_id = ?:product_options.option_id
                JOIN ?:product_options_descriptions ON ?:product_options_descriptions.option_id = ?:product_options.option_id
                JOIN ?:product_option_variants_descriptions ON ?:product_option_variants_descriptions.variant_id = ?:product_option_variants.variant_id
                WHERE product_id =?i', $product_id);
                if (isset($item->Variation)) {
                    $variations_xml = (array) $item->Variation->VariationSpecifics;
                    if (isset($variations_xml['NameValueList']->Name)) {
                        $variations = (array) $variations_xml['NameValueList'];
                    } else {
                        foreach ($variations_xml['NameValueList'] as $variation) {
                            $variations[] = (array) $variation;
                        }
                    }
                    if (isset($variations)) {
                        if (isset($variations['Name'])) {
                            foreach ($options as $option) {
                                if ($variations['Name'] == $option['option_name'] && $variations['Value'] == $option['variant_name']) {
                                    $extra['product_options'][$option['option_id']] = $option['variant_id'];
                                }
                            }
                        } else {
                            foreach ($variations as $variation) {
                                foreach ($options as $option) {
                                    if ($variation['Name'] == $option['option_name'] && $variation['Value'] == $option['variant_name']) {
                                        $extra['product_options'][$option['option_id']] = $option['variant_id'];
                                    }
                                }
                            }
                        }
                        $variations = array();
                    }
                }
                $products[$i] = array('product_id' => $product_id, 'amount' => (int) $item->QuantityPurchased, 'price' => (double) $item->TransactionPrice, 'base_price' => (double) $item->TransactionPrice, 'is_edp' => $product['is_edp'], 'edp_shipping' => $product['edp_shipping'], 'free_shipping' => $product['free_shipping'], 'stored_price' => 'Y', 'company_id' => Registry::get('runtime.company_id'), 'extra' => $extra);
                unset($product);
                $i += 1;
            }
            if (empty($products)) {
                continue;
            }
            $cart['products'] = $products;
            unset($products);
            $location = fn_get_customer_location($cart['user_data'], $cart);
            $cart['product_groups'] = Shippings::groupProductsList($cart['products'], $location);
            list($order_id, $status) = fn_update_order($cart);
            if (!empty($order_id)) {
                fn_change_order_status($order_id, 'P', $status, fn_get_notification_rules(array(), false));
                $success_orders[] = $order_id;
            } else {
                $failed_orders[] = $cart['ebay_order_id'];
            }
        }
    }
    return array($success_orders, $failed_orders);
}
Exemplo n.º 13
0
function fn_process_epayph_ipn($order_id, $data)
{
    $order_info = fn_get_order_info($order_id);
    if (!empty($order_info) && !empty($data['txn_id']) && (empty($order_info['payment_info']['txn_id']) || $data['payment_status'] != 'Completed' || $data['payment_status'] == 'Completed' && $order_info['payment_info']['txn_id'] !== $data['txn_id'])) {
        //Can't check refund transactions.
        if (isset($data['txn_type']) && !fn_validate_epayph_order_info($data, $order_info)) {
            return false;
        }
        $pp_settings = fn_get_epayph_settings();
        $data['payment_status'] = strtolower($data['payment_status']);
        fn_clear_cart($cart, true);
        $customer_auth = fn_fill_auth(array(), array(), false, 'C');
        fn_form_cart($order_id, $cart, $customer_auth);
        if ($pp_settings['override_customer_info'] == 'Y') {
            $cart['user_data'] = fn_epayph_get_customer_info($data);
        }
        $cart['order_id'] = $order_id;
        $cart['payment_info'] = $order_info['payment_info'];
        $cart['payment_info']['protection_eligibility'] = !empty($data['protection_eligibility']) ? $data['protection_eligibility'] : '';
        $cart['payment_id'] = $order_info['payment_id'];
        if (!empty($data['memo'])) {
            //Save customer notes
            $cart['notes'] = $data['memo'];
        }
        if ($data['payment_status'] == 'Completed') {
            //save uniq ipn id to avoid double ipn processing
            $cart['payment_info']['txn_id'] = $data['txn_id'];
        }
        fn_calculate_cart_content($cart, $customer_auth);
        list($order_id, ) = fn_update_order($cart, $order_id);
        if ($order_id) {
            $send_notification = $order_info['status'] == $pp_settings['pp_statuses'][$data['payment_status']] ? false : array();
            $short_order_data = fn_get_order_short_info($order_id);
            fn_change_order_status($order_id, $pp_settings['pp_statuses'][$data['payment_status']], $short_order_data['status'], $send_notification);
        }
        return true;
    }
}
Exemplo n.º 14
0
             fn_finish_payment($_REQUEST['order_id'], $pp_response);
         }
     }
     exit;
 } elseif ($mode == 'return') {
     if (fn_check_payment_script('paypal.php', $_REQUEST['order_id'])) {
         $order_info = fn_get_order_info($_REQUEST['order_id'], true);
         if ($order_info['status'] == STATUS_INCOMPLETED_ORDER) {
             fn_change_order_status($_REQUEST['order_id'], 'O', '', false);
         }
         if (fn_allowed_for('MULTIVENDOR')) {
             if ($order_info['status'] == STATUS_PARENT_ORDER) {
                 $child_orders = db_get_hash_single_array("SELECT order_id, status FROM ?:orders WHERE parent_order_id = ?i", array('order_id', 'status'), $_REQUEST['order_id']);
                 foreach ($child_orders as $order_id => $order_status) {
                     if ($order_status == STATUS_INCOMPLETED_ORDER) {
                         fn_change_order_status($order_id, 'O', '', false);
                     }
                 }
             }
         }
     }
     fn_order_placement_routines('route', $_REQUEST['order_id'], false);
 } elseif ($mode == 'cancel') {
     $order_info = fn_get_order_info($_REQUEST['order_id']);
     $pp_response['order_status'] = 'N';
     $pp_response["reason_text"] = __('text_transaction_cancelled');
     if (!empty($_REQUEST['payer_email'])) {
         $pp_response['customer_email'] = $_REQUEST['payer_email'];
     }
     if (!empty($_REQUEST['payer_id'])) {
         $pp_response['client_id'] = $_REQUEST['payer_id'];
Exemplo n.º 15
0
         $update_order['payment_surcharge'] = 0;
     }
     //Default change order status back to Open
     $change_order_status = STATUSES_ORDER;
     /**
      * Data change for a repayed order
      * @param array     $order_info Order information
      * @param array     $update_order New order data
      * @param array     $payment  Payment information
      * @param array     $payment_info Payment information received from a user
      * @param string    $change_order_status New order status
      */
     fn_set_hook('repay_order', $order_info, $update_order, $payment, $payment_info, $change_order_status);
     db_query('UPDATE ?:orders SET ?u WHERE order_id = ?i', $update_order, $_REQUEST['order_id']);
     // Change order status and restore amount.
     fn_change_order_status($order_info['order_id'], $change_order_status, $order_info['status'], fn_get_notification_rules(array(), false));
     Tygh::$app['session']['cart']['placement_action'] = 'repay';
     // Process order (payment)
     fn_start_payment($order_info['order_id'], array(), $payment_info);
     fn_order_placement_routines('repay', $order_info['order_id'], array(), true);
     // Request for order tracking
 } elseif ($mode == 'track_request') {
     if (fn_image_verification('track_orders', $_REQUEST) == false) {
         exit;
     }
     $condition = fn_get_company_condition('?:orders.company_id');
     if (!empty($auth['user_id'])) {
         $allowed_id = db_get_field('SELECT user_id ' . 'FROM ?:orders ' . 'WHERE user_id = ?i AND order_id = ?i AND is_parent_order != ?s' . $condition, $auth['user_id'], $_REQUEST['track_data'], 'Y');
         if (!empty($allowed_id)) {
             Tygh::$app['ajax']->assign('force_redirection', fn_url('orders.details?order_id=' . $_REQUEST['track_data']));
             exit;
Exemplo n.º 16
0
*    Copyright (c) 2009 Simbirsk Technologies Ltd. All rights reserved.    *
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
//
// $Id: proxypay3_confirmation.php 7502 2009-05-19 14:54:59Z zeke $
//
DEFINE('AREA', 'C');
DEFINE('AREA_NAME', 'customer');
require './../prepare.php';
require './../init.php';
if (!empty($_REQUEST['Ref'])) {
    $order_id = strpos($_REQUEST['Ref'], '_') ? substr($_REQUEST['Ref'], 0, strpos($_REQUEST['Ref'], '_')) : $_REQUEST['Ref'];
    if (fn_check_payment_script('proxypay3.php', $order_id)) {
        fn_change_order_status($order_id, 'P', '', true);
        $pp_response = array();
        $pp_response['order_status'] = 'P';
        print '[OK]';
    } else {
        $pp_response['reason_text'] = 'Error in data confirmation';
        // FIXME: this variable is not used
        print '[ERROR]';
    }
}
exit;
Exemplo n.º 17
0
function fn_process_paypal_ipn($order_id, $data)
{
    $order_info = fn_get_order_info($order_id);
    if (!empty($order_info) && !empty($data['txn_id']) && (empty($order_info['payment_info']['txn_id']) || $data['payment_status'] != 'Completed' || $data['payment_status'] == 'Completed' && $order_info['payment_info']['txn_id'] !== $data['txn_id'])) {
        //Can't check refund transactions.
        if (isset($data['txn_type']) && !fn_validate_paypal_order_info($data, $order_info)) {
            return false;
        }
        $pp_settings = fn_get_paypal_settings();
        fn_clear_cart($cart, true);
        $customer_auth = fn_fill_auth(array(), array(), false, 'C');
        fn_form_cart($order_id, $cart, $customer_auth);
        if ($pp_settings['override_customer_info'] == 'Y') {
            $cart['user_data'] = fn_paypal_get_customer_info($data);
        }
        $cart['order_id'] = $order_id;
        $cart['payment_info'] = $order_info['payment_info'];
        $cart['payment_info']['protection_eligibility'] = !empty($data['protection_eligibility']) ? $data['protection_eligibility'] : '';
        $cart['payment_id'] = $order_info['payment_id'];
        if (!empty($data['memo'])) {
            //Save customer notes
            $cart['notes'] = $data['memo'];
        }
        if ($data['payment_status'] == 'Completed') {
            //save uniq ipn id to avoid double ipn processing
            $cart['payment_info']['txn_id'] = $data['txn_id'];
        }
        if (!empty($data['payer_email'])) {
            $cart['payment_info']['customer_email'] = $data['payer_email'];
        }
        if (!empty($data['payer_id'])) {
            $cart['payment_info']['client_id'] = $data['payer_id'];
        }
        //Sometimes, for some reasons cart_id in product products calculated incorrectle, so we need recalculate it.
        $cart['change_cart_products'] = true;
        fn_calculate_cart_content($cart, $customer_auth);
        $cart['payment_info']['order_status'] = $pp_settings['pp_statuses'][strtolower($data['payment_status'])];
        list($order_id, ) = fn_update_order($cart, $order_id);
        if ($order_id) {
            fn_change_order_status($order_id, $pp_settings['pp_statuses'][strtolower($data['payment_status'])]);
            if (fn_allowed_for('MULTIVENDOR')) {
                $child_order_ids = db_get_fields("SELECT order_id FROM ?:orders WHERE parent_order_id = ?i", $order_id);
                if (!empty($child_order_ids)) {
                    foreach ($child_order_ids as $child_order_id) {
                        fn_update_order_payment_info($child_order_id, $cart['payment_info']);
                    }
                }
            }
        }
        return true;
    }
}
Exemplo n.º 18
0
 public function update($id, $params)
 {
     fn_define('ORDER_MANAGEMENT', true);
     $data = array();
     $valid_params = true;
     $status = Response::STATUS_BAD_REQUEST;
     if ($valid_params) {
         fn_clear_cart($cart, true);
         $customer_auth = fn_fill_auth(array(), array(), false, 'C');
         $cart_status = md5(serialize($cart));
         // Order info was not found or customer does not have enought permissions
         if (fn_form_cart($id, $cart, $customer_auth) && $cart_status != md5(serialize($cart))) {
             unset($params['product_groups']);
             if (empty($params['shipping_id'])) {
                 $shipping = reset($cart['shipping']);
                 if (!empty($shipping['shipping_id'])) {
                     $params['shipping_id'] = $shipping['shipping_id'];
                 }
             }
             $cart['order_id'] = $id;
             fn_calculate_cart_content($cart, $customer_auth);
             if (!empty($params['user_id'])) {
                 $cart['user_data'] = fn_get_user_info($params['user_id']);
             } elseif (!empty($params)) {
                 $cart['user_data'] = array_merge($cart['user_data'], $params);
             }
             if (!empty($cart['product_groups']) && !empty($params['shipping_id'])) {
                 foreach ($cart['product_groups'] as $key => $group) {
                     foreach ($group['shippings'] as $shipping_id => $shipping) {
                         if ($params['shipping_id'] == $shipping['shipping_id']) {
                             $cart['chosen_shipping'][$key] = $shipping_id;
                             break;
                         }
                     }
                 }
             }
             if (!empty($params['payment_id'])) {
                 if (!empty($params['payment_info'])) {
                     $cart['payment_info'] = $params['payment_info'];
                 } elseif ($params['payment_id'] != $cart['payment_id']) {
                     $cart['payment_info'] = array();
                 }
                 $cart['payment_id'] = $params['payment_id'];
             }
             if (!empty($params['products'])) {
                 $cart['products'] = $params['products'];
             }
             fn_calculate_cart_content($cart, $customer_auth);
             if (!empty($cart) && empty($cart['shipping_failed'])) {
                 $cart['parent_order_id'] = 0;
                 fn_update_payment_surcharge($cart, $customer_auth);
                 list($order_id, $order_status) = fn_update_order($cart, $id);
                 if ($order_id) {
                     if (!empty($params['status']) && fn_check_permissions('orders', 'update_status', 'admin')) {
                         fn_change_order_status($order_id, $params['status'], '', fn_get_notification_rules($params, false));
                     } elseif (!empty($order_status)) {
                         fn_change_order_status($order_id, $order_status, '', fn_get_notification_rules($params, false));
                     }
                     $status = Response::STATUS_OK;
                     $data = array('order_id' => $order_id);
                 }
             }
         }
     }
     return array('status' => $status, 'data' => $data);
 }
Exemplo n.º 19
0
     }
 }
 if ($mode == 'products_range') {
     if (!empty($_REQUEST['order_ids'])) {
         unset($_REQUEST['redirect_url']);
         return array(CONTROLLER_STATUS_REDIRECT, 'products.manage?order_ids=' . implode(',', $_REQUEST['order_ids']));
     }
 }
 if ($mode == 'delete') {
     fn_delete_order($_REQUEST['order_id']);
     return array(CONTROLLER_STATUS_REDIRECT);
 }
 if ($mode == 'update_status') {
     $order_info = fn_get_order_short_info($_REQUEST['id']);
     $old_status = $order_info['status'];
     if (fn_change_order_status($_REQUEST['id'], $_REQUEST['status'], '', fn_get_notification_rules($_REQUEST))) {
         $order_info = fn_get_order_short_info($_REQUEST['id']);
         fn_check_first_order($order_info);
         $new_status = $order_info['status'];
         if ($_REQUEST['status'] != $new_status) {
             Registry::get('ajax')->assign('return_status', $new_status);
             Registry::get('ajax')->assign('color', fn_get_status_param_value($new_status, 'color'));
             fn_set_notification('W', __('warning'), __('status_changed'));
         } else {
             fn_set_notification('N', __('notice'), __('status_changed'));
         }
     } else {
         fn_set_notification('E', __('error'), __('error_status_not_changed'));
         Registry::get('ajax')->assign('return_status', $old_status);
         Registry::get('ajax')->assign('color', fn_get_status_param_value($old_status, 'color'));
     }
Exemplo n.º 20
0
            }
            $dom->appendChild($order);
            $extra = array('headers' => array('Content-type: application/x-www-form-urlencoded;charset=utf-8', 'Expect:'));
            $result_xml = Http::post($url, array('xml' => $dom->saveXML()), $extra);
            $xml_data = @simplexml_load_string($result_xml);
            if (!empty($xml_data->response_message)) {
                if ($xml_data->response_code == 0) {
                    fn_set_notification('N', __('notify'), $xml_data->response_message);
                    $payment_info['avangard_refunded_transaction_id'] = strval($xml_data->id);
                    $payment_info['avangard_refunded_time'] = date('c');
                    $payment_info['avangard_refund_amount'] = $refund_data['amount'];
                    if (!empty($refund_data['cause'])) {
                        $payment_info['avangard_refund_cause'] = $refund_data['cause'];
                    }
                    fn_update_order_payment_info($order_info['order_id'], $payment_info);
                    fn_change_order_status($order_info['order_id'], $pdata['processor_params']['returned_order_status']);
                } else {
                    fn_set_notification('E', __('error'), $xml_data->response_message);
                }
            }
        }
        return array(CONTROLLER_STATUS_OK, "orders.details?order_id={$_REQUEST['order_id']}");
    }
}
if ($mode == 'details') {
    $order_info = Tygh::$app['view']->getTemplateVars('order_info');
    if ($order_info && !empty($order_info['payment_method']['processor_id'])) {
        $processor_id = $order_info['payment_method']['processor_id'];
        $processor_script = db_get_field("SELECT processor_script FROM ?:payment_processors WHERE processor_id = ?i", $processor_id);
        Tygh::$app['view']->assign('processor_script', $processor_script);
    }
Exemplo n.º 21
0
            if (fn_check_payment_script('paytm.php', $order_id, $processor_data)) {
                $pp_response = array();
                $order_info = fn_get_order_info($order_id);
                if ($bool == "TRUE") {
                    if ($_REQUEST['RESPCODE'] == 01) {
                        $pp_response['order_status'] = 'P';
                        $pp_response['reason_text'] = "Thank you. Your order has been processed successfully." . $paytmTxnIdText;
                    } else {
                        $pp_response['order_status'] = 'F';
                        $pp_response['reason_text'] = "Thank you. Your order has been unsuccessfull" . $paytmTxnIdText;
                    }
                } else {
                    $pp_response['order_status'] = 'D';
                    $pp_response['reason_text'] = "Thank you. Your order has been declined due to security reasons." . $paytmTxnIdText;
                }
                fn_change_order_status($order_id, $pp_response['order_status']);
                fn_finish_payment($order_id, $pp_response, array());
                fn_order_placement_routines('route', $order_id);
            }
            exit;
        }
    }
} else {
    $merchant_id = $processor_data["processor_params"]['merchant_id'];
    $industry_type = $processor_data["processor_params"]['industry_type'];
    $website_name = $processor_data["processor_params"]['website_name'];
    $channel_id = $processor_data["processor_params"]['channel_id'];
    $current_location = Registry::get('config.current_location');
    $mod = $processor_data["processor_params"]['transaction_mode'];
    $callback = $processor_data["processor_params"]['callback'];
    $log = $processor_data['processor_params']['log_params'];
Exemplo n.º 22
0
             }
             $times++;
             if ($times > MB_MAX_TIME) {
                 break;
             }
         }
     } else {
         $order_id = $_REQUEST['order_id'];
     }
     // If order was placed successfully, associate the order with this customer
     if (!empty($order_id)) {
         $auth['order_ids'][] = $order_id;
         if (fn_check_payment_script('skrill_ewallet.php', $order_id)) {
             $order_info = fn_get_order_info($_REQUEST['order_id'], true);
             if ($order_info['status'] == 'N') {
                 fn_change_order_status($_REQUEST['order_id'], 'O', '', false);
             }
             fn_order_placement_routines('route', $order_id, false);
         }
     } else {
         fn_set_notification('E', __('error'), __('text_mb_failed_order'));
         fn_order_placement_routines('checkout_redirect');
     }
 } elseif ($mode == 'cancel') {
     if (!empty($_REQUEST['iframe_mode'])) {
         fn_set_notification('E', __('error'), __('text_transaction_cancelled'));
         fn_order_placement_routines('checkout_redirect');
     }
     if (fn_check_payment_script('skrill_ewallet.php', $_REQUEST['order_id'])) {
         $pp_response['order_status'] = 'N';
         $pp_response['reason_text'] = __('text_transaction_declined');
Exemplo n.º 23
0
                $update_order['total'] = fn_format_price($order_info['total']);
            } else {
                $update_order['total'] = fn_format_price($order_info['total'] - $order_info['payment_surcharge'] + $surcharge_value);
            }
        } else {
            if (fn_allowed_for('MULTIVENDOR') && fn_take_payment_surcharge_from_vendor($order_info['products'])) {
                $update_order['total'] = fn_format_price($order_info['total']);
            } else {
                $update_order['total'] = fn_format_price($order_info['total'] - $order_info['payment_surcharge']);
            }
            $update_order['payment_surcharge'] = 0;
        }
        fn_set_hook('repay_order', $order_info, $update_order, $payment, $payment_info);
        db_query('UPDATE ?:orders SET ?u WHERE order_id = ?i', $update_order, $_REQUEST['order_id']);
        // Change order status back to Open and restore amount.
        fn_change_order_status($order_info['order_id'], STATUSES_ORDER, $order_info['status'], fn_get_notification_rules(array(), false));
        $_SESSION['cart']['placement_action'] = 'repay';
        // Process order (payment)
        fn_start_payment($order_info['order_id'], array(), $payment_info);
        fn_order_placement_routines('repay', $order_info['order_id'], array(), true);
    }
    return array(CONTROLLER_STATUS_OK, 'orders.details?order_id=' . $_REQUEST['order_id']);
}
fn_add_breadcrumb(__('orders'), $mode == 'search' ? '' : "orders.search");
//
// Show invoice
//
if ($mode == 'invoice') {
    fn_add_breadcrumb(__('order') . ' #' . $_REQUEST['order_id'], "orders.details?order_id={$_REQUEST['order_id']}");
    fn_add_breadcrumb(__('invoice'));
    Registry::get('view')->assign('order_info', fn_get_order_info($_REQUEST['order_id']));
Exemplo n.º 24
0
    db_query("REPLACE INTO ?:order_data ?e", $data);
    fn_update_order_payment_info($order_id, $pp_response);
    fn_order_placement_routines('route', $order_id);
} elseif ($message_recognizer == 'OrderCancelledNotification') {
    // Customer cancel this order on the Amazon side. We need to cancel the order in the shop
    list($amazon_sess_id, $payment_id) = explode(';', base64_decode((string) $xml->ProcessedOrder->ProcessedOrderItems->ProcessedOrderItem->CartCustomData->ClientRequestId));
    $processor_data = fn_get_payment_method_data($payment_id);
    // If we use the signed cart, validate the request
    if (!fn_amazon_validate_request($processor_data, $_POST)) {
        die('Access denied');
    }
    $transaction_id = (string) $xml->ProcessedOrder->AmazonOrderID;
    $order_id = db_get_field('SELECT order_id FROM ?:order_data WHERE type = ?s AND data = ?s', 'E', $transaction_id);
    if (!empty($order_id)) {
        fn_change_order_status($order_id, 'I');
    }
} elseif ($message_recognizer == 'OrderReadyToShipNotification') {
    // Order was processed by Amazon. We need to process the order in the shop
    list($amazon_sess_id, $payment_id) = explode(';', base64_decode((string) $xml->ProcessedOrder->ProcessedOrderItems->ProcessedOrderItem->CartCustomData->ClientRequestId));
    $processor_data = fn_get_payment_method_data($payment_id);
    // If we use the signed cart, validate the request
    if (!fn_amazon_validate_request($processor_data, $_POST)) {
        die('Access denied');
    }
    $transaction_id = (string) $xml->ProcessedOrder->AmazonOrderID;
    $order_id = db_get_field('SELECT order_id FROM ?:order_data WHERE type = ?s AND data = ?s', 'E', $transaction_id);
    if (!empty($order_id)) {
        fn_change_order_status($order_id, 'P');
    }
}
exit;
Exemplo n.º 25
0
function fn_manageState($state, $idstate, $mode, $orderId, $payNLTransactionID, $processor_data)
{
    switch ($state) {
        case 'PENDING':
            if ($mode == 'exchange') {
                echo 'TRUE| state:PENDING, orderId:' . $orderId . ', transactionId:' . $payNLTransactionID . ',idState:' . $idstate . ', service_id:' . $processor_data['processor_params']['service_id'] . ',token_api:' . $processor_data['processor_params']['token_api'] . ',statuses:' . print_r($processor_data['processor_params']['statuses'], true);
            } else {
                fn_order_placement_routines('route', $orderId);
            }
            die;
            break;
        case 'PAID':
            $payData = fn_paynl_getInfo($payNLTransactionID, $processor_data);
            $pp_response = array('order_status' => $idstate, 'naam' => $payData['paymentDetails']['identifierName'], 'rekening' => $payData['paymentDetails']['identifierPublic']);
            if ($mode == 'exchange') {
                echo 'TRUE| orderId=' . $orderId . ', transactionId=' . $payNLTransactionID . ',idState:' . $idstate . ', service_id:' . $processor_data['processor_params']['service_id'] . ',token_api:' . $processor_data['processor_params']['token_api'] . ',statuses:' . print_r($processor_data['processor_params']['statuses'], true);
                fn_finish_payment($orderId, $pp_response, true);
                fn_updatePayTransaction($payNLTransactionID, 'PAID');
                die;
            } else {
                fn_order_placement_routines('route', $orderId);
            }
            break;
        case 'CANCEL':
            if ($mode == 'exchange') {
                echo 'TRUE| CANCEL orderId=' . $orderId . ', transactionId=' . $payNLTransactionID . ',idState:' . $idstate . ', service_id:' . $processor_data['processor_params']['service_id'] . ',token_api:' . $processor_data['processor_params']['token_api'] . ',statuses:' . print_r($processor_data['processor_params']['statuses'], true);
                fn_updatePayTransaction($payNLTransactionID, 'CANCEL');
                die;
            } else {
                fn_updatePayTransaction($payNLTransactionID, 'CANCEL');
                fn_change_order_status($orderId, $idstate, '', false);
                fn_order_placement_routines('route', $orderId);
            }
            break;
        case 'CHECKAMOUNT':
            if ($mode == 'exchange') {
                echo 'TRUE| CHECKAMOUNT orderId=' . $orderId . ', transactionId=' . $payNLTransactionID . ',idState:' . $idstate . ', service_id:' . $processor_data['processor_params']['service_id'] . ',token_api:' . $processor_data['processor_params']['token_api'] . ',statuses:' . print_r($processor_data['processor_params']['statuses'], true);
                fn_updatePayTransaction($payNLTransactionID, 'CHECKAMOUNT');
                die;
            } else {
                fn_updatePayTransaction($payNLTransactionID, 'CHECKAMOUNT');
                fn_change_order_status($orderId, $idstate, '', false);
                fn_order_placement_routines('route', $orderId, false);
            }
            break;
        default:
            $pp_response['order_status'] = $processor_data['processor_params']['statuses'][$state];
            fn_updatePayTransaction($payNLTransactionID, 'PENDING');
            fn_change_order_status($orderId, $pp_response['order_status'], '', false);
            break;
    }
}