function osC_Checkout_Process() { global $osC_Session, $osC_ShoppingCart, $osC_Customer, $osC_NavigationHistory, $osC_Payment; if ($osC_ShoppingCart->hasContents() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL')); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if ($osC_ShoppingCart->hasShippingMethod() === false && $osC_ShoppingCart->getContentType() != 'virtual') { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL')); } if ($osC_ShoppingCart->hasBillingMethod()) { // load selected payment module include 'includes/classes/payment.php'; $osC_Payment = new osC_Payment($osC_ShoppingCart->getBillingMethod('id')); } include 'includes/classes/order.php'; if ($osC_ShoppingCart->hasBillingMethod()) { $osC_Payment->process(); } else { $orders_id = osC_Order::insert(); osC_Order::process($orders_id, ORDERS_STATUS_PAID); } $osC_ShoppingCart->reset(true); // unregister session variables used during checkout unset($_SESSION['comments']); osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'success', 'SSL')); }
function osC_Checkout_Process() { global $osC_Session, $osC_ShoppingCart, $osC_Customer, $osC_NavigationHistory, $osC_Payment; if ($osC_Customer->isLoggedOn() === false) { $osC_NavigationHistory->setSnapshot(); osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } if ($osC_ShoppingCart->hasContents() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL')); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if ($osC_ShoppingCart->hasShippingMethod() === false && $osC_ShoppingCart->getContentType() != 'virtual') { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL')); } // load selected payment module include 'includes/classes/payment.php'; $osC_Payment = new osC_Payment($osC_ShoppingCart->getBillingMethod('id')); if ($osC_Payment->hasActive() && $osC_ShoppingCart->hasBillingMethod() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment', 'SSL')); } include 'includes/classes/order.php'; $osC_Payment->process(); $osC_ShoppingCart->reset(true); // unregister session variables used during checkout unset($_SESSION['comments']); osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'success', 'SSL')); }
function osC_Checkout_Payment() { global $osC_Database, $osC_Session, $osC_ShoppingCart, $osC_Customer, $osC_Services, $osC_Language, $osC_NavigationHistory, $osC_Breadcrumb, $osC_Payment; if ($osC_Customer->isLoggedOn() === false) { $osC_NavigationHistory->setSnapshot(); osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } if ($osC_ShoppingCart->hasContents() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL')); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if ($osC_ShoppingCart->hasShippingMethod() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL')); } // Stock Check if (STOCK_CHECK == '1' && STOCK_ALLOW_CHECKOUT == '-1') { foreach ($osC_ShoppingCart->getProducts() as $products) { if ($osC_ShoppingCart->isInStock($products['item_id']) === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'SSL')); break; } } } $this->_page_title = $osC_Language->get('payment_method_heading'); if ($osC_Services->isStarted('breadcrumb')) { $osC_Breadcrumb->add($osC_Language->get('breadcrumb_checkout_payment'), osc_href_link(FILENAME_CHECKOUT, $this->_module, 'SSL')); } // redirect to the billing address page when no default address exists if ($osC_Customer->hasDefaultAddress() === false) { $this->_page_title = $osC_Language->get('payment_address_heading'); $this->_page_contents = 'checkout_payment_address.php'; $this->addJavascriptFilename('templates/' . $this->getCode() . '/javascript/checkout_payment_address.js'); $this->addJavascriptPhpFilename('includes/form_check.js.php'); } else { $this->addJavascriptFilename('templates/' . $this->getCode() . '/javascript/checkout_payment.js'); // if no billing destination address was selected, use the customers own address as default if ($osC_ShoppingCart->hasBillingAddress() == false) { $osC_ShoppingCart->setBillingAddress($osC_Customer->getDefaultAddressID()); } else { // verify the selected billing address $Qcheck = $osC_Database->query('select address_book_id from :table_address_book where address_book_id = :address_book_id and customers_id = :customers_id limit 1'); $Qcheck->bindTable(':table_address_book', TABLE_ADDRESS_BOOK); $Qcheck->bindInt(':address_book_id', $osC_ShoppingCart->getBillingAddress('id')); $Qcheck->bindInt(':customers_id', $osC_Customer->getID()); $Qcheck->execute(); if ($Qcheck->numberOfRows() !== 1) { $osC_ShoppingCart->setBillingAddress($osC_Customer->getDefaultAddressID()); $osC_ShoppingCart->resetBillingMethod(); } } // load all enabled payment modules include 'includes/classes/payment.php'; $osC_Payment = new osC_Payment(); $this->addJavascriptBlock($osC_Payment->getJavascriptBlocks()); } if (isset($_GET['payment_error']) && is_object(${$_GET['payment_error']}) && ($error = ${$_GET['payment_error']}->get_error())) { $osC_MessageStack->add('checkout_payment', $error['error'], 'error'); } }
function osC_Checkout_Confirmation() { global $osC_Session, $osC_Services, $osC_Language, $osC_ShoppingCart, $osC_Customer, $osC_MessageStack, $osC_NavigationHistory, $osC_Breadcrumb, $osC_Payment; if ($osC_Customer->isLoggedOn() === false) { $osC_NavigationHistory->setSnapshot(); osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } if ($osC_ShoppingCart->hasContents() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL')); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if ($osC_ShoppingCart->hasShippingAddress() == false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL')); } include 'includes/classes/order.php'; $this->_page_title = $osC_Language->get('confirmation_heading'); $osC_Language->load('order'); if ($osC_Services->isStarted('breadcrumb')) { $osC_Breadcrumb->add($osC_Language->get('breadcrumb_checkout_confirmation'), osc_href_link(FILENAME_CHECKOUT, $this->_module, 'SSL')); } if (isset($_POST['comments']) && isset($_SESSION['comments']) && empty($_POST['comments'])) { unset($_SESSION['comments']); } elseif (!empty($_POST['comments'])) { $_SESSION['comments'] = osc_sanitize_string($_POST['comments']); } if (DISPLAY_CONDITIONS_ON_CHECKOUT == '1') { if (!isset($_POST['conditions']) || $_POST['conditions'] != '1') { $osC_MessageStack->add('checkout_payment', $osC_Language->get('error_conditions_not_accepted'), 'error'); } } // load the selected payment module include 'includes/classes/payment.php'; $osC_Payment = new osC_Payment(isset($_POST['payment_method']) ? $_POST['payment_method'] : $osC_ShoppingCart->getBillingMethod('id')); if (isset($_POST['payment_method'])) { $osC_ShoppingCart->setBillingMethod(array('id' => $_POST['payment_method'], 'title' => $GLOBALS['osC_Payment_' . $_POST['payment_method']]->getMethodTitle())); } if ($osC_Payment->hasActive() && (isset($GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]) === false || isset($GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]) && is_object($GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]) && $GLOBALS['osC_Payment_' . $osC_ShoppingCart->getBillingMethod('id')]->isEnabled() === false)) { $osC_MessageStack->add('checkout_payment', $osC_Language->get('error_no_payment_module_selected'), 'error'); } if ($osC_MessageStack->size('checkout_payment') > 0) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment', 'SSL')); } if ($osC_Payment->hasActive()) { $osC_Payment->pre_confirmation_check(); } // Stock Check if (STOCK_CHECK == '1' && STOCK_ALLOW_CHECKOUT == '-1') { foreach ($osC_ShoppingCart->getProducts() as $product) { if (!$osC_ShoppingCart->isInStock($product['item_id'])) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'AUTO')); } } } }
function osC_Checkout_Checkout() { global $osC_ShoppingCart, $osC_Customer, $osC_NavigationHistory, $messageStack, $osC_Language; if ($osC_Customer->isLoggedOn() === false) { $osC_NavigationHistory->setSnapshot(); osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } if ($osC_ShoppingCart->hasContents() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL')); } else { //check the products stock in the cart if (STOCK_ALLOW_CHECKOUT == '-1') { foreach ($osC_ShoppingCart->getProducts() as $product) { if ($osC_ShoppingCart->isInStock($product['id']) === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL')); } } //add the out of stock message for the checkout one page } else { foreach ($osC_ShoppingCart->getProducts() as $product) { //it's gift certificate if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) { if ($product['quantity'] < 1) { $messageStack->add('checkout', STOCK_MARK_PRODUCT_OUT_OF_STOCK . $product['name']); } } else { if ($osC_ShoppingCart->isInStock($product['id']) === false) { $messageStack->add('checkout', STOCK_MARK_PRODUCT_OUT_OF_STOCK . $product['name']); } } } if ($osC_ShoppingCart->hasStock() === false) { $messageStack->add('checkout', sprintf($osC_Language->get('products_out_of_stock_checkout_possible'), STOCK_MARK_PRODUCT_OUT_OF_STOCK)); } } } if ($osC_ShoppingCart->hasBillingMethod()) { // load selected payment module include 'includes/classes/payment.php'; $osC_Payment = new osC_Payment($osC_ShoppingCart->getBillingMethod('id')); $payment_error = $osC_Payment->get_error(); if (is_array($payment_error) && !empty($payment_error)) { $messageStack->add('payment_error_msg', '<strong>' . $payment_error['title'] . '</strong> ' . $payment_error['error']); } } $this->addHeaderJavascriptFilename('includes/javascript/checkout.js'); }
function install() { global $osC_Database; parent::install(); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable NOCHEX Module', 'MODULE_PAYMENT_NOCHEX_STATUS', 'True', 'Do you want to accept NOCHEX payments?', '6', '3', 'osc_cfg_set_boolean_value(array(\\'True\\', \\'False\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('E-Mail Address', 'MODULE_PAYMENT_NOCHEX_ID', '*****@*****.**', 'The e-mail address to use for the NOCHEX service', '6', '4', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_NOCHEX_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_NOCHEX_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'osc_cfg_use_get_zone_class_title', 'osc_cfg_set_zone_classes_pull_down_menu', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_NOCHEX_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'osc_cfg_set_order_statuses_pull_down_menu', 'osc_cfg_use_get_order_status_title', now())"); }
function install() { global $osC_Database; parent::install(); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable iPayment Module', 'MODULE_PAYMENT_IPAYMENT_STATUS', 'True', 'Do you want to accept iPayment payments?', '6', '1', 'osc_cfg_set_boolean_value(array(\\'True\\', \\'False\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Account Number', 'MODULE_PAYMENT_IPAYMENT_ID', '99999', 'The account number used for the iPayment service', '6', '2', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('User ID', 'MODULE_PAYMENT_IPAYMENT_USER_ID', '99999', 'The user ID for the iPayment service', '6', '3', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('User Password', 'MODULE_PAYMENT_IPAYMENT_PASSWORD', '0', 'The user password for the iPayment service', '6', '4', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Security Key', 'MODULE_PAYMENT_IPAYMENT_SECURITY_KEY', '', 'The security key used to generate the security hash', '6', '5', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Currency', 'MODULE_PAYMENT_IPAYMENT_CURRENCY', 'Either EUR or USD, else EUR', 'The currency to use for credit card transactions', '6', '6', 'osc_cfg_set_boolean_value(array(\\'Always EUR\\', \\'Always USD\\', \\'Either EUR or USD, else EUR\\', \\'Either EUR or USD, else USD\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_IPAYMENT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '7', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_IPAYMENT_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '8', 'osc_cfg_use_get_zone_class_title', 'osc_cfg_set_zone_classes_pull_down_menu', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_IPAYMENT_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '9', 'osc_cfg_set_order_statuses_pull_down_menu', 'osc_cfg_use_get_order_status_title', now())"); }
/** * Send a status enquiry of the transaction to the gateway server * * @access public * @param $id The ID of the order */ function inquiryTransaction($id) { global $osC_Database; $Qorder = $osC_Database->query('select transaction_return_value from :table_orders_transactions_history where orders_id = :orders_id and transaction_code = 1 order by date_added limit 1'); $Qorder->bindTable(':table_orders_transactions_history', TABLE_ORDERS_TRANSACTIONS_HISTORY); $Qorder->bindInt(':orders_id', $id); $Qorder->execute(); if ($Qorder->numberOfRows() === 1) { $osC_XML = new osC_XML($Qorder->value('transaction_return_value')); $result_array = $osC_XML->toArray(); $params = array('PSPID' => MODULE_PAYMENT_OGONE_DIRECTLINK_CC_MERCHANT_ID, 'PSWD' => MODULE_PAYMENT_OGONE_DIRECTLINK_CC_PASSWORD, 'PAYID' => $result_array['ncresponse attr']['PAYID']); if (osc_empty(MODULE_PAYMENT_OGONE_DIRECTLINK_CC_USER_ID) === false) { $params['USERID'] = MODULE_PAYMENT_OGONE_DIRECTLINK_CC_USER_ID; } $post_string = ''; foreach ($params as $key => $value) { $post_string .= $key . '=' . urlencode($value) . '&'; } $post_string = substr($post_string, 0, -1); $result = osC_Payment::sendTransactionToGateway($this->_inquiry_gateway_url, $post_string); if (empty($result) === false) { $osC_XML = new osC_XML($result); $result_array = $osC_XML->toArray(); switch ($result_array['ncresponse attr']['STATUS']) { case '': case '0': $transaction_return_status = '0'; break; default: $transaction_return_status = '1'; break; } $Qtransaction = $osC_Database->query('insert into :table_orders_transactions_history (orders_id, transaction_code, transaction_return_value, transaction_return_status, date_added) values (:orders_id, :transaction_code, :transaction_return_value, :transaction_return_status, now())'); $Qtransaction->bindTable(':table_orders_transactions_history', TABLE_ORDERS_TRANSACTIONS_HISTORY); $Qtransaction->bindInt(':orders_id', $id); $Qtransaction->bindInt(':transaction_code', 4); $Qtransaction->bindValue(':transaction_return_value', $result); $Qtransaction->bindInt(':transaction_return_status', $transaction_return_status); $Qtransaction->execute(); } } }
function install() { global $osC_Database; parent::install(); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable 2CheckOut Module', 'MODULE_PAYMENT_2CHECKOUT_STATUS', 'True', 'Do you want to accept 2CheckOut payments?', '6', '0', 'osc_cfg_set_boolean_value(array(\\'True\\', \\'False\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Login/Store Number', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', '18157', 'Login/Store Number used for the 2CheckOut service', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Mode', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'Test', 'Transaction mode used for the 2Checkout service', '6', '0', 'osc_cfg_set_boolean_value(array(\\'Test\\', \\'Production\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Merchant Notifications', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'True', 'Should 2CheckOut e-mail a receipt to the store owner?', '6', '0', 'osc_cfg_set_boolean_value(array(\\'True\\', \\'False\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_2CHECKOUT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_2CHECKOUT_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'osc_cfg_use_get_zone_class_title', 'osc_cfg_set_zone_classes_pull_down_menu', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'osc_cfg_set_order_statuses_pull_down_menu', 'osc_cfg_use_get_order_status_title', now())"); }
function install() { global $osC_Database; parent::install(); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable PSiGate Module', 'MODULE_PAYMENT_PSIGATE_STATUS', 'True', 'Do you want to accept PSiGate payments?', '6', '1', 'osc_cfg_set_boolean_value(array(\\'True\\', \\'False\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant ID', 'MODULE_PAYMENT_PSIGATE_MERCHANT_ID', 'teststorewithcard', 'Merchant ID used for the PSiGate service', '6', '2', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Mode', 'MODULE_PAYMENT_PSIGATE_TRANSACTION_MODE', 'Always Good', 'Transaction mode to use for the PSiGate service', '6', '3', 'osc_cfg_set_boolean_value(array(\\'Production\\', \\'Always Good\\', \\'Always Duplicate\\', \\'Always Decline\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Type', 'MODULE_PAYMENT_PSIGATE_TRANSACTION_TYPE', 'PreAuth', 'Transaction type to use for the PSiGate service', '6', '4', 'osc_cfg_set_boolean_value(array(\\'Sale\\', \\'PreAuth\\', \\'PostAuth\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Credit Card Collection', 'MODULE_PAYMENT_PSIGATE_INPUT_MODE', 'Local', 'Should the credit card details be collected locally or remotely at PSiGate?', '6', '5', 'osc_cfg_set_boolean_value(array(\\'Local\\', \\'Remote\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Currency', 'MODULE_PAYMENT_PSIGATE_CURRENCY', 'USD', 'The currency to use for credit card transactions', '6', '6', 'osc_cfg_set_boolean_value(array(\\'CAD\\', \\'USD\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PSIGATE_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PSIGATE_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'osc_cfg_use_get_zone_class_title', 'osc_cfg_set_zone_classes_pull_down_menu', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_PSIGATE_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'osc_cfg_set_order_statuses_pull_down_menu', 'osc_cfg_use_get_order_status_title', now())"); }
/** * Send a status enquiry of the transaction to the gateway server * * @access public * @param $id The ID of the order */ function inquiryTransaction($id) { global $osC_Database; $Qorder = $osC_Database->query('select transaction_return_value from :table_orders_transactions_history where orders_id = :orders_id and transaction_code = 1 order by date_added limit 1'); $Qorder->bindTable(':table_orders_transactions_history', TABLE_ORDERS_TRANSACTIONS_HISTORY); $Qorder->bindInt(':orders_id', $id); $Qorder->execute(); if ($Qorder->numberOfRows() === 1) { $osC_XML = new osC_XML($Qorder->value('transaction_return_value')); $result_array = $osC_XML->toArray(); $post_string = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:noNamespaceSchemaLocation="wirecard.xsd">' . "\n" . ' <W_REQUEST>' . "\n" . ' <W_JOB>' . "\n" . ' <JobID>Job 1</JobID>' . "\n" . ' <BusinessCaseSignature>' . MODULE_PAYMENT_WIRECARD_CC_BUSINESS_SIGNATURE . '</BusinessCaseSignature>' . "\n" . ' <FNC_CC_QUERY>' . "\n" . ' <FunctionID>Query 1</FunctionID>' . "\n" . ' <CC_TRANSACTION mode="' . MODULE_PAYMENT_WIRECARD_CC_TRANSACTION_MODE . '">' . "\n" . ' <TransactionID>' . $result_array['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_CC_PREAUTHORIZATION']['CC_TRANSACTION']['TransactionID'] . '</TransactionID>' . "\n" . ' <GuWID>' . $result_array['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_CC_PREAUTHORIZATION']['CC_TRANSACTION']['PROCESSING_STATUS']['GuWID'] . '</GuWID>' . "\n" . ' </CC_TRANSACTION>' . "\n" . ' </FNC_CC_QUERY>' . "\n" . ' </W_JOB>' . "\n" . ' </W_REQUEST>' . "\n" . '</WIRECARD_BXML>'; $result = osC_Payment::sendTransactionToGateway($this->_gateway_url, $post_string, array('Content-type: text/xml')); if (empty($result) === false) { $osC_XML = new osC_XML($result); $result_array = $osC_XML->toArray(); $transaction_return_status = '0'; if (isset($result_array['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_CC_QUERY']['CC_TRANSACTION']['PROCESSING_STATUS']['FunctionResult'])) { if ($result_array['WIRECARD_BXML']['W_RESPONSE']['W_JOB']['FNC_CC_QUERY']['CC_TRANSACTION']['PROCESSING_STATUS']['FunctionResult'] == 'ACK') { $transaction_return_status = '1'; } } $Qtransaction = $osC_Database->query('insert into :table_orders_transactions_history (orders_id, transaction_code, transaction_return_value, transaction_return_status, date_added) values (:orders_id, :transaction_code, :transaction_return_value, :transaction_return_status, now())'); $Qtransaction->bindTable(':table_orders_transactions_history', TABLE_ORDERS_TRANSACTIONS_HISTORY); $Qtransaction->bindInt(':orders_id', $id); $Qtransaction->bindInt(':transaction_code', 4); $Qtransaction->bindValue(':transaction_return_value', $result); $Qtransaction->bindInt(':transaction_return_status', $transaction_return_status); $Qtransaction->execute(); } } }
function _getOrderConfirmationForm() { global $osC_Language, $osC_ShoppingCart, $osC_Payment, $osC_Currencies, $osC_Tax; $osC_Language->load('account'); $osC_Language->load('checkout'); $osC_Language->load('order'); if (!is_object($osC_Payment)) { require_once 'includes/classes/payment.php'; $osC_Payment = new osC_Payment($osC_ShoppingCart->getBillingMethod('id')); if ($osC_Payment->hasActive()) { $osC_Payment->pre_confirmation_check(); } } ob_start(); if (isset($_REQUEST['template']) && !empty($_REQUEST['template'])) { require_once 'templates/' . $_REQUEST['template'] . '/modules/order_confirmation_form.php'; } else { require_once 'includes/modules/order_confirmation_form.php'; } $form = ob_get_contents(); ob_end_clean(); return $form; }
/** * Cancels the transaction at the gateway server * * @access public * @param $id The ID of the order */ function cancelTransaction($id) { global $osC_Database; $Qorder = $osC_Database->query('select transaction_return_value from :table_orders_transactions_history where orders_id = :orders_id and transaction_code = 1 order by date_added limit 1'); $Qorder->bindTable(':table_orders_transactions_history', TABLE_ORDERS_TRANSACTIONS_HISTORY); $Qorder->bindInt(':orders_id', $id); $Qorder->execute(); if ($Qorder->numberOfRows() === 1) { $inquiry_regs = preg_split("/,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/", $Qorder->value('transaction_return_value')); foreach ($inquiry_regs as $key => $value) { $inquiry_regs[$key] = substr($value, 1, -1); // remove double quotes } $params = array('x_version' => '3.1', 'x_delim_data' => 'TRUE', 'x_delim_char' => ',', 'x_encap_char' => '"', 'x_type' => 'VOID', 'x_login' => MODULE_PAYMENT_AUTHORIZENET_CC_LOGIN_ID, 'x_tran_key' => MODULE_PAYMENT_AUTHORIZENET_CC_TRANSACTION_KEY, 'x_trans_id' => $inquiry_regs[6], 'x_amount' => $inquiry_regs[9]); $post_string = ''; foreach ($params as $key => $value) { $post_string .= $key . '=' . urlencode(trim($value)) . '&'; } $post_string = substr($post_string, 0, -1); $result = osC_Payment::sendTransactionToGateway($this->_gateway_url, $post_string); if (empty($result) === false) { $regs = preg_split("/,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/", $result); foreach ($regs as $key => $value) { $regs[$key] = substr($value, 1, -1); // remove double quotes } $transaction_return_status = $regs[0]; if ($transaction_return_status == '1') { if (!osc_empty(MODULE_PAYMENT_AUTHORIZENET_CC_MD5_HASH)) { if ($regs[37] != strtoupper(md5(MODULE_PAYMENT_AUTHORIZENET_CC_MD5_HASH . MODULE_PAYMENT_AUTHORIZENET_CC_LOGIN_ID . $inquiry_regs[6] . $inquiry_regs[9]))) { $transaction_return_status = '0'; } } } else { $transaction_return_status = '0'; } $Qtransaction = $osC_Database->query('insert into :table_orders_transactions_history (orders_id, transaction_code, transaction_return_value, transaction_return_status, date_added) values (:orders_id, :transaction_code, :transaction_return_value, :transaction_return_status, now())'); $Qtransaction->bindTable(':table_orders_transactions_history', TABLE_ORDERS_TRANSACTIONS_HISTORY); $Qtransaction->bindInt(':orders_id', $id); $Qtransaction->bindInt(':transaction_code', 2); $Qtransaction->bindValue(':transaction_return_value', $result); $Qtransaction->bindInt(':transaction_return_status', $transaction_return_status); $Qtransaction->execute(); } } }
function install() { global $osC_Database; parent::install(); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Check/Money Order Module', 'MODULE_PAYMENT_MONEYORDER_STATUS', 'True', 'Do you want to accept Check/Money Order payments?', '6', '1', 'osc_cfg_set_boolean_value(array(\\'True\\', \\'False\\'))', now());"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Make Payable to:', 'MODULE_PAYMENT_MONEYORDER_PAYTO', '', 'Who should payments be made payable to?', '6', '1', now());"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_MONEYORDER_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_MONEYORDER_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'osc_cfg_use_get_zone_class_title', 'osc_cfg_set_zone_classes_pull_down_menu', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'osc_cfg_set_order_statuses_pull_down_menu', 'osc_cfg_use_get_order_status_title', now())"); }
function install() { global $osC_Database; parent::install(); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable SECpay Module', 'MODULE_PAYMENT_SECPAY_STATUS', 'True', 'Do you want to accept SECPay payments?', '6', '1', 'osc_cfg_set_boolean_value(array(\\'True\\', \\'False\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant ID', 'MODULE_PAYMENT_SECPAY_MERCHANT_ID', 'secpay', 'Merchant ID to use for the SECPay service', '6', '2', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Currency', 'MODULE_PAYMENT_SECPAY_CURRENCY', 'Any Currency', 'The currency to use for credit card transactions', '6', '3', 'osc_cfg_set_boolean_value(array(\\'Any Currency\\', \\'Default Currency\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Mode', 'MODULE_PAYMENT_SECPAY_TEST_STATUS', 'Always Successful', 'Transaction mode to use for the SECPay service', '6', '4', 'osc_cfg_set_boolean_value(array(\\'Always Successful\\', \\'Always Fail\\', \\'Production\\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_SECPAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '5', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_SECPAY_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '6', 'osc_cfg_use_get_zone_class_title', 'osc_cfg_set_zone_classes_pull_down_menu', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_SECPAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '7', 'osc_cfg_set_order_statuses_pull_down_menu', 'osc_cfg_use_get_order_status_title', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Digest Key', 'MODULE_PAYMENT_SECPAY_DIGEST_KEY', 'secpay', 'Key to use for the digest functionality', '6', '8', now())"); }