diff --git a/README.md b/README.md new file mode 100644 index 0000000..19fe57b --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# NOVALNET PAYMENT MODULE FOR GAMBIO +Novalnet payment module for gambio simplifies your daily work by automating the entire payment process, from checkout till collection. This module is designed to help you increase your sales by offering various payment methods on a one-page checkout. The module which is perfectly adjusted to the gambio shop with top-quality range of services of the payment provider. + +Novalnet payment module for gambio is available in EN, DE + +Support is available in: EN, DE, FR, ES, IT, BS, CR, RU, HI, TA + +Through the individuality and flexibility, you can choose which payment methods and services you need. Get now a seamless integration with the various types of payments and payment-related services integrated in the one unique platform. + +## Important functions for gambio +* Easy configuration for all payment methods +* One platform for all relevant payment types and related services +* Complete automation of all payment processes +* More than 50 fraud prevention modules integrated to prevent risk in real-time +* Effortless configuration of risk management with fraud prevention +* Comprehensive affiliate system with automated split conversion of transaction on revenue sharing +* Multilevel claims management with integrated handover to collection and various export functions for the Accounting +* Automated e-mail notification function concerning payment status reports +* Automated bookkeeping report in XML, SOAP, CSV, MT940 +* No PCI DSS certification required +* Secure SSL- encoded gateways +* Easy way of managing ‘on-hold’ transactions (cancel or capture) and refunds (partial, full) +* Credit/Debit Card iframe integration +* Credit/Debit Card with 3D Secure +* One-click shopping supported for Credit/Debit Cards, Direct Debit SEPA, Direct Debit SEPA with payment guarantee & Instalment by Direct Debit SEPA +* Custom CSS configuration for Credit/Debit Card iframe +* Easy way of confirmation and cancellation of on-hold transactions for Direct Debit SEPA, Direct Debit SEPA with payment guarantee, Instalment payment for Direct Debit SEPA, Credit/Debit Cards, Invoice, Invoice with payment guarantee, Instalment payment for Invoice, Prepayment, PayPal, Apple Pay & Google Pay +* Refund option for Credit/Debit Cards, Direct Debit SEPA, Direct Debit SEPA with payment guarantee, Instalment by Direct Debit SEPA, Invoice, Invoice with payment guarantee, Instalment by Invoice, Prepayment, Barzahlen/viacash, Sofort, iDEAL, eps, giropay, PayPal, Przelewy24, PostFinance Card, PostFinance E-Finance, Bancontact, Apple Pay, Google Pay, Online bank transfer, Alipay, WeChat pay & Trustly +* Responsive templates +* Find currently supported payment methods on https://www.novalnet.com/integration/gambio-gx2-payment-module/ + +## More information +Find more about gambio module on: https://www.novalnet.de/site_pdf/Installation_Guide-gambio_4.2.0.0-4.7.2.1_novalnet_12.0.3.pdf
+To test our demo shop, please visit: https://gambio.novalnet.de + +## Contact +Novalnet AG
+Zahlungsinstitut (ZAG)
+Feringastr. 4
+85774 Unterföhring
+Deutschland
+E-mail: sales@novalnet.de
+Tel: +49 89 9230683-20
+Web: www.novalnet.de + +## License +See our License Agreement at: https://www.novalnet.com/payment-plugins/free/license + +## About Novalnet AG +Novalnet AG is a leading financial services institution offering online gateways for processing of online payments. Operating in the market as a full payment service provider, Novalnet AG was founded in Ismaning near Munich, and provides online merchants user-friendly payment modules for all major shop systems as well as for self-programmed websites. The product and service portfolio is very comprehensive and includes all commonly used payment methods of online payment. These include a variety of intelligent fraud prevention modules, free technical support, an automated accounts receivable management system, a comprehensive subscription and membership management, as well as a very useful affiliate program. The experienced and international team of specialists at Novalnet is committed to support online merchants with in-depth knowledge and to work together with them hand in hand to increase their revenue and the quality of their online payments. diff --git a/admin/novalnet_extension.php b/admin/novalnet_extension.php new file mode 100644 index 0000000..2abf480 --- /dev/null +++ b/admin/novalnet_extension.php @@ -0,0 +1,240 @@ + + +
+
+
+
+ +
+ + + + + + +
+ + + +
+ +
+ " . MODULE_PAYMENT_NOVALNET_BACK_TEXT . ""; + ?> +
+ +
+
+
+ + +
+
+
+
+ +
+ +
+ + + + +
+ + + + +
+ + + '', 'text' => MODULE_PAYMENT_NOVALNET_SELECT_STATUS_OPTION), + array('id'=>'CONFIRM', 'text' => MODULE_PAYMENT_NOVALNET_CONFIRM_TEXT), + array('id'=>'CANCEL', 'text' => MODULE_PAYMENT_NOVALNET_CANCEL_TEXT), + ); + echo xtc_draw_pull_down_menu('trans_status', $options, '', 'onclick="return remove_void_capture_error_message()"'); + ?> +
+ " . MODULE_PAYMENT_NOVALNET_BACK_TEXT . ""; + ?> +
+ +
+
+
+ 0) + && (($transaction_details['status'] == 'CONFIRMED' || in_array($transaction_details['status'], NovalnetHelper::$statuses['CONFIRMED'])) + || ($transaction_details['status']=='PENDING' && in_array($transaction_details['payment_type'],array('INVOICE','PREPAYMENT','CASHPAYMENT')))) + && !in_array($transaction_details['payment_type'],array('MULTIBANCO','INSTALMENT_INVOICE','INSTALMENT_DIRECT_DEBIT_SEPA','novalnet_instalment_invoice', 'novalnet_instalment_sepa')) + && ($transaction_details['refund_amount'] < $transaction_details['amount']) + ) + { +?> + +
+
+
+
+ +
+ + + +
+ + + + + + + + + + +
+ + +
+ + +
+ " . MODULE_PAYMENT_NOVALNET_BACK_TEXT . ""; + ?> +
+ +
+
+
+ +
+
+ +
+
+ +
+ +
+ + +
+ S.No".MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_BACKEND."".MODULE_PAYMENT_NOVALNET_INSTALMENT_PAID_DATE_BACKEND."".MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_DATE_BACKEND."".MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_BACKEND."".MODULE_PAYMENT_NOVALNET_INSTALMENT_REFERENCE_BACKEND.""; + $sno = 1; + foreach ($instalment_details as $key => $instalment_details_data) { + $instalment_amount = (strpos((string)$instalment_details_data['instalment_cycle_amount'], '.')) ? $instalment_details_data['instalment_cycle_amount']*100 : $instalment_details_data['instalment_cycle_amount']; + if(!empty($instalment_details_data['status'])) { + $status = $instalment_details_data['status']; + } else { + $status = (empty($instalment_details_data['reference_tid'])) ? 'Pending' : (($instalment_amount > 0) ? 'Paid' : 'Refunded'); + } + $status = constant('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_' . strtoupper($status)); + $href = ($instalment_details_data['reference_tid'] != '' && $instalment_amount != '0') ? "" : ''; + $instalment_amount_formatted = !empty($instalment_amount) ? xtc_format_price_order($instalment_amount/100, 1, $transaction_details['currency']) : '-'; + echo "".$sno++."".$instalment_amount_formatted.' '.$href." + ".$instalment_details_data['paid_date']."".$instalment_details_data['next_instalment_date']."$status".$instalment_details_data['reference_tid']."". + xtc_draw_form('nn_refund_confirm', 'novalnet_extension_helper.php'); + echo '"; + ?> +
+
+
+ '; +echo ''; +echo xtc_draw_hidden_field('nn_refund_amount_confirm', MODULE_PAYMENT_NOVALNET_PAYMENT_REFUND_CONFIRM); +echo xtc_draw_hidden_field('nn_select_status', MODULE_PAYMENT_NOVALNET_SELECT_STATUS_TEXT); +echo xtc_draw_hidden_field('nn_zero_amount_book_confirm', MODULE_PAYMENT_NOVALNET_PAYMENT_ZERO_AMOUNT_BOOK_CONFIRM); +echo xtc_draw_hidden_field('nn_amount_error', MODULE_PAYMENT_NOVALNET_AMOUNT_ERROR_MESSAGE); +?> + diff --git a/admin/novalnet_extension_helper.php b/admin/novalnet_extension_helper.php new file mode 100644 index 0000000..0b205c4 --- /dev/null +++ b/admin/novalnet_extension_helper.php @@ -0,0 +1,211 @@ +customer['ID']; +if (empty($order->customer['ID'])) { + $customerId = $order->customer['csID']; +} +// To process on-hold transaction +if (isset($request['nn_manage_confirm']) && !empty($request['trans_status'])) { + $order_status = ''; + $comments = ''; + $data['transaction'] = [ + 'tid' => $txn_details['tid'] + ]; + $custom_param = NovalnetHelper::getCustomData(); + $params = array_merge($data, $custom_param); + $endpoint = (!empty($request['trans_status']) && $request['trans_status'] == 'CONFIRM') ? 'transaction_capture' : 'transaction_cancel'; + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint($endpoint)); + $update_data = [ + 'status' => $response['transaction']['status'], + ]; + if ($response['result']['status'] == 'SUCCESS') { + if (in_array($order->info['payment_class'], array('novalnet_googlepay','novalnet_applepay'))) { + $order_status = NovalnetHelper::getOrderStatus ($update_data['status'], $order->info['payment_class']); + } else { + $order_status = NovalnetHelper::getOrderStatus ($update_data['status'], $order->info['payment_method']); + } + $order_status = ($request['trans_status'] == 'CONFIRM') ? $order_status : MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED; + if ($request['trans_status'] == 'CONFIRM') { + $comments .= PHP_EOL . sprintf(MODULE_PAYMENT_NOVALNET_TRANS_CONFIRM_SUCCESSFUL_MESSAGE, date('d.m.Y', strtotime(date('d.m.Y'))), date('H:i:s')) . PHP_EOL; + $comments .= NovalnetHelper::getTransactionDetails($response); + if (in_array($response['transaction']['payment_type'], array( 'INSTALMENT_INVOICE','GUARANTEED_INVOICE', 'INVOICE', 'PREPAYMENT'))) { + if (empty($response['transaction']['bank_details'])) { + $response['transaction']['bank_details'] = $payment_details; + } + $comments .= NovalnetHelper::getBankDetails($response, $request['oID']); + if (in_array($response['transaction']['payment_type'], array('GUARANTEED_INVOICE', 'INVOICE', 'PREPAYMENT'))) { + $comments .= PHP_EOL. MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT .PHP_EOL; + $comments .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 1, ('TID ' . $response['transaction']['tid'])) . PHP_EOL; + $comments .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, ('BNR-' . MODULE_PAYMENT_NOVALNET_PROJECT_ID . '-' . $request['oID'])) . PHP_EOL; + } + } + if (in_array($response['transaction']['payment_type'], array( 'INSTALMENT_INVOICE','INSTALMENT_DIRECT_DEBIT_SEPA'))) { + $comments .= NovalnetHelper::formInstalmentPaymentReference($response); + if (in_array($response['transaction']['status'],array('CONFIRMED', 'PENDING'))) { + $total_amount = ($txn_details['amount'] < $response['transaction']['amount']) ? $response['transaction']['amount'] : $txn_details['amount']; + $instalment_details = NovalnetHelper::storeInstalmentdetails($response, $total_amount); + $update_data['instalment_cycle_details'] = $instalment_details; + } + } + NovalnetHelper::sendOrderUpdateMail(array( + 'comments' => '
' . $comments, + 'order_no' => $request['oID'], + 'order' => $order, + ),array( + 'customer_id' => $customerId + )); + } elseif ($request['trans_status'] == 'CANCEL') { + $comments .= PHP_EOL.sprintf(MODULE_PAYMENT_NOVALNET_TRANS_DEACTIVATED_MESSAGE, date('d.m.Y', strtotime(date('d.m.Y'))), date('H:i:s')); + } + updateOrderStatus($request['oID'], $order_status, $comments); + $messageStack->add_session($response['result']['status_text'], 'success'); + } else { + $messageStack->add_session($response['result']['status_text'], 'error'); + } + if (!empty($request['oID'])) { + xtc_db_perform('novalnet_transaction_detail', $update_data, 'update', 'order_no='.$request['oID']); + } + xtc_redirect(xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(['action']) . 'action=edit' . '&oID=' . (int)$request['oID'])); +} elseif ((!empty($request['nn_refund_confirm']) && ($request['refund_trans_amount'] != '' ) && $txn_details['status'] != 'Canceled')) { // To process refund process + $refunded_amount = 0; + $data['transaction'] = [ + 'tid' => (!empty($request['refund_tid'])) ? $request['refund_tid'] : $txn_details['tid'], + 'amount' => $request['refund_trans_amount'], + ]; + $data['custom'] = [ + 'lang' => (isset($_SESSION['language_code'])) ? strtoupper($_SESSION['language_code']) : 'DE', + ]; + if (!empty($request['refund_reason'])){ + $data['transaction']['reason'] = $request['refund_reason']; + } + $response = NovalnetHelper::sendRequest($data, NovalnetHelper::get_action_endpoint('transaction_refund')); + + if ($response['result']['status'] == 'SUCCESS') { + $refunded_amount = $response['transaction']['refund']['amount']; + + if (in_array($response['transaction']['payment_type'], array('INSTALMENT_INVOICE','INSTALMENT_DIRECT_DEBIT_SEPA'))) { + $instalment_details = (!empty($txn_details['instalment_cycle_details'])) ? json_decode($txn_details['instalment_cycle_details'], true) : unserialize($txn_details['payment_details']); + if(!empty($instalment_details)) { + $cycle = $request['instalment_cycle']; + $instalment_amount = (strpos((string)$instalment_details[$cycle]['instalment_cycle_amount'], '.')) ? $instalment_details[$cycle]['instalment_cycle_amount']*100 : $instalment_details[$cycle]['instalment_cycle_amount']; + $instalment_amount = $instalment_amount - $refunded_amount; + $instalment_details[$cycle]['instalment_cycle_amount'] = $instalment_amount; + if($instalment_details[$cycle]['instalment_cycle_amount'] <= 0) { + $instalment_details[$cycle]['status'] = 'Refunded'; + } + $update_data = [ + 'instalment_cycle_details' => json_encode($instalment_details), + ]; + } + } + $update_data['refund_amount'] = (!empty($txn_details['refund_amount'])) ? ($refunded_amount + $txn_details['refund_amount']) : $refunded_amount; + $message = PHP_EOL. sprintf((MODULE_PAYMENT_NOVALNET_REFUND_PARENT_TID_MSG), $txn_details['tid'], xtc_format_price_order(($refunded_amount/100), 1, $txn_details['currency'])); + // Check for refund TID + if (!empty($response['transaction']['refund']['tid'])) { + $message .= PHP_EOL. sprintf((MODULE_PAYMENT_NOVALNET_REFUND_CHILD_TID_MSG), $response['transaction']['refund']['tid']); + } + if (!empty($request['oID'])) { + xtc_db_perform('novalnet_transaction_detail', $update_data, 'update', 'order_no='.$request['oID']); + } + if (in_array($order->info['payment_class'], array('novalnet_googlepay','novalnet_applepay'))) { + $order_status_value = ($update_data['refund_amount'] >= $txn_details['amount']) ? MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED : $order->info['orders_status']; + } else { + $order_status_value = ($update_data['refund_amount'] >= $txn_details['amount']) ? MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED : $order->info['orders_status']; + } + updateOrderStatus($request['oID'], $order_status_value, $message); + $messageStack->add_session($response['result']['status_text'], 'success'); + } else { + $messageStack->add_session($response['result']['status_text'], 'error'); + } + xtc_redirect(xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(['action']) . 'action=edit' . '&oID=' . (int)$request['oID'])); +} else if (!empty($request['nn_book_confirm']) && !empty($request['book_amount'])) { // To process zero amount booking transaction + $merchant_data = NovalnetHelper::getMerchantData(); + $customer_data = NovalnetHelper::getCustomerData(); + $transaction_data = NovalnetHelper::getTransactionData(); + $custom_data = NovalnetHelper::getCustomData(); + $customer_data['customer']['billing']['country_code'] = $order->billing['country_iso_code_2']; + $customer_data['customer']['delivery']['country_code'] = $order->delivery['country_iso_code_2']; + $transaction_data['transaction']['payment_type'] = $txn_details['payment_type']; + $data = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + $data['transaction']['amount'] = $request['book_amount']; + $data['transaction']['payment_data']['token'] = $payment_details['token']; + $response = NovalnetHelper::sendRequest($data, NovalnetHelper::get_action_endpoint('payment')); + if ($response['result']['status'] == 'SUCCESS' ) { + $order_status_value = xtc_db_fetch_array(xtc_db_query("SELECT orders_status from " . TABLE_ORDERS . " where orders_id = " . xtc_db_input($request['oID']))); + $message = PHP_EOL .PHP_EOL. sprintf(MODULE_PAYMENT_NOVALNET_TRANS_BOOKED_MESSAGE, xtc_format_price_order(($request['book_amount'] / 100), 1, $response['transaction']['currency']), $response['transaction']['tid']) . PHP_EOL; + $update_data = [ + 'amount' => $response['transaction']['amount'], + 'tid' => $response['transaction']['tid'], + ]; + if (!empty($request['oID'])) { + xtc_db_perform('novalnet_transaction_detail', $update_data, 'update', 'order_no='.$request['oID']); + } + updateOrderStatus($request['oID'], $order_status_value['orders_status'], $message); + $messageStack->add_session($response['result']['status_text'], 'success'); + } else { + $messageStack->add_session($response['result']['status_text'], 'error'); + } + xtc_redirect(xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(['action']) . 'action=edit' . '&oID=' . (int)$request['oID'])); +} else if (!empty($request['nn_instalment_cancel'])) { // To process instalment cancel + $data['instalment']['tid'] = $txn_details['tid']; + $data['custom'] = [ + 'lang' => (isset($_SESSION['language_code'])) ? strtoupper($_SESSION['language_code']) : 'DE', + ]; + $response = NovalnetHelper::sendRequest($data, NovalnetHelper::get_action_endpoint('instalment_cancel')); + if ($response['result']['status'] == 'SUCCESS') { + $update_data['status'] = 'DEACTIVATE'; + $message = PHP_EOL. sprintf((MODULE_PAYMENT_NOVALNET_REFUND_PARENT_TID_MSG), $txn_details['tid'], xtc_format_price_order(($response['transaction']['refund']['amount']/100), 1, $txn_details['currency'])); + if (!empty($response['transaction']['refund']['tid'])) { + $message .= PHP_EOL. sprintf((MODULE_PAYMENT_NOVALNET_REFUND_CHILD_TID_MSG), $response['transaction']['refund']['tid']); + } + if (!empty($request['oID'])) { + xtc_db_perform('novalnet_transaction_detail', $update_data, 'update', 'order_no='.$request['oID']); + } + $order_status_value = ($response['result']['status'] == 'SUCCESS') ? (MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED) : ''; + updateOrderStatus($request['oID'], $order_status_value, $message); + $messageStack->add_session($response['result']['status_text'], 'success'); + } else { + $messageStack->add_session($response['result']['status_text'], 'error'); + } + xtc_redirect(xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(['action']) . 'action=edit' . '&oID=' . (int)$request['oID'])); +} else { + xtc_redirect(xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(['action']) . 'action=edit' . '&oID=' . (int)$request['oID'])); +} +/** +* Update order status in the shop +* +* @param integer $order_id +* @param string $order_status +* @param string $message +*/ +function updateOrderStatus($order_id, $order_status, $message) { + $comments = xtc_db_fetch_array(xtc_db_query("SELECT comments FROM ". TABLE_ORDERS ." WHERE orders_id = '$order_id'")); + xtc_db_perform(TABLE_ORDERS, array( + 'orders_status' => $order_status, + ), "update", "orders_id='$order_id'"); + xtc_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments, customer_id) values ('".xtc_db_input($order_id)."', '".xtc_db_input($order_status)."', '" .date('Y-m-d H:i:s') . "', '1', '".xtc_db_prepare_input($message)."', '0')"); +} +?> diff --git a/callback/novalnet/callback.php b/callback/novalnet/callback.php new file mode 100644 index 0000000..6e09330 --- /dev/null +++ b/callback/novalnet/callback.php @@ -0,0 +1,870 @@ + [ + 'type', + 'checksum', + 'tid', + ], + 'merchant' => [ + 'vendor', + 'project', + ], + 'result' => [ + 'status', + ], + 'transaction' => [ + 'tid', + 'payment_type', + 'status', + ], + ]; + + /** + * Request parameters. + * + * @var array + */ + protected $event_data = []; + + /** + * Order reference values. + * + * @var array + */ + protected $order_details = []; + + /** + * Recived Event type. + * + * @var string + */ + protected $event_type; + + /** + * Recived Event TID. + * + * @var int + */ + protected $event_tid; + + /** + * Recived Event parent TID. + * + * @var int + */ + protected $parent_tid; + + /** + * Order language details. + * + * @var array + */ + protected $order_lang; + + /** + * Core Function : Constructor() + * + */ + function __construct() { + try { + $this->event_data = json_decode(file_get_contents('php://input'), true); + } catch (Exception $e) { + $this->displayMessage([ 'message' => 'Received data is not in the JSON format' . $e]); + } + $this->authenticateEventData(); + $this->event_tid = !empty($this->event_data ['event'] ['tid']) ? $this->event_data ['event'] ['tid'] : ''; + $this->event_type = $this->event_data['event']['type']; + $this->parent_tid = (!empty($this->event_data['event']['parent_tid'])) ? $this->event_data['event']['parent_tid'] :$this->event_data['event']['tid']; + $this->order_details = $this->getOrderReference(); + // If the order in the Novalnet server to the order number in Novalnet database doesn't match, then there is an issue + if (!empty($this->event_data['transaction']['order_no']) && !empty($this->order_details['shop_order']) + && (($this->event_data['transaction']['order_no']) != $this->order_details['shop_order'])) { + $this->displayMessage(['message' => 'Order reference not matching for the order number ' . $this->order_details['shop_order']]); + } + // If both the order number from Novalnet and in shop is missing, then something is wrong + if (!empty($this->event_data['transaction']['order_no']) && empty($this->order_details['shop_order'])) { + $this->displayMessage(['message' => 'Order reference not found for the TID ' . $this->parent_tid]); + } + + if (NovalnetHelper::is_success_status($this->event_data)) { + switch($this->event_type) { + case 'PAYMENT': + $this->displayMessage(['message' => "The webhook notification received ('".$this->event_data['transaction']['payment_type']."') for the TID: '".$this->event_tid."'"]); + break; + case 'TRANSACTION_CAPTURE': + $this->handleTransactionCapture(); + break; + case 'TRANSACTION_CANCEL': + $this->handleTransactionCancel(); + break; + case 'TRANSACTION_REFUND': + $this->handleTransactionRefund(); + break; + case 'CREDIT': + $this->handleTransactionCredit(); + break; + case 'CHARGEBACK': + $this->handleChargeback(); + break; + case 'INSTALMENT': + $this->handleInstalment(); + break; + case 'INSTALMENT_CANCEL': + $this->handleInstalmentCancel(); + break; + case 'TRANSACTION_UPDATE': + $this->handleTransactionUpdate(); + break; + case 'PAYMENT_REMINDER_1': + case 'PAYMENT_REMINDER_2': + $this->handlePaymentReminder(); + break; + case 'SUBMISSION_TO_COLLECTION_AGENCY': + $this->handleCollectionSubmission(); + break; + default: + $message = "The webhook notification has been received for the unhandled EVENT type('".$this->event_type."')"; + $this->displayMessage(['message' => $message]); + } + } + } + + /** + * Authenticate server request + * + */ + function authenticateEventData() { + $request_received_ip = xtc_get_ip_address(); + $novalnet_host_ip = gethostbyname($this->novalnet_host_name); + if (!empty($novalnet_host_ip) && ! empty($request_received_ip)) { + if ($novalnet_host_ip !== $request_received_ip && MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE == 'false') { + $this->displayMessage(['message' => 'Unauthorised access from the IP ' . $request_received_ip]); + } + } else { + $this->displayMessage([ 'message' => 'Unauthorised access from the IP. Host/recieved IP is empty' ]); + } + $this->validateEventData(); + $this->validateCheckSum(); + } + + /** + * Validate event_data + * + */ + function validateEventData() { + foreach ($this->mandatory as $category => $parameters) { + if (empty($this->event_data[ $category ])) { + $this->displayMessage([ 'message' => "Required parameter category($category) not received" ]); + } elseif (!empty($parameters)) { + foreach ($parameters as $parameter) { + if (empty($this->event_data [ $category ] [ $parameter ])) { + $this->displayMessage([ 'message' => "Required parameter($parameter) in the category($category) not received" ]); + } elseif (in_array($parameter, [ 'tid', 'parent_tid' ], true) && ! preg_match('/^\d{17}$/', $this->event_data [ $category ] [ $parameter ])) { + $this->displayMessage([ 'message' => "Invalid TID received in the category($category) not received $parameter" ]); + } + } + } + } + } + + /** + * Validate checksum + * + */ + function validateCheckSum() { + if (!empty($this->event_data['event']['checksum']) && ! empty($this->event_data['event']['tid']) && ! empty($this->event_data['event']['type']) + && !empty($this->event_data['result']['status'])) { + $token_string = $this->event_data['event']['tid'] . $this->event_data['event']['type'] . $this->event_data['result']['status']; + if (isset($this->event_data['transaction']['amount'])) { + $token_string .= $this->event_data['transaction']['amount']; + } + if (isset($this->event_data['transaction']['currency'])) { + $token_string .= $this->event_data['transaction']['currency']; + } + if (!empty(MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY)) { + $token_string .= strrev(MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY); + } + $generated_checksum = hash('sha256', $token_string); + if ($generated_checksum != $this->event_data['event']['checksum']) { + $this->displayMessage([ 'message' =>'While notifying some data has been changed. The hash check failed']); + } + } + } + + /* + * Get order reference from the novalnet_callback_history table + * + * @return array + */ + function getOrderReference() { + $this->order_details = $this->getOrderDetails(); + // If the order is not found in Novalnet DB and found in core table, it is communication failure + if (empty($this->order_details['nn_trans_details']) && !empty($this->order_details['shop_order'])) { + if ($this->event_data['transaction']['payment_type'] == 'ONLINE_TRANSFER_CREDIT') { + $this->event_data['transaction'] ['tid'] = $this->parent_tid; + $this->handleCommunicationFailure($this->order_details['shop_order_details']); + $this->order_details = $this->getOrderDetails(); + } elseif ($this->event_data ['event'] ['type'] == 'PAYMENT') { + $this->handleCommunicationFailure($this->order_details['shop_order_details']); + $this->order_details = $this->getOrderDetails(); + } else { + $this->displayMessage(array( 'message' => 'Order reference not found in the shop' )); + } + } + return $this->order_details; + } + + + function getOrderDetails(){ + $order_details = []; + $novalnet_order_details = xtc_db_fetch_array(xtc_db_query("SELECT * FROM novalnet_transaction_detail WHERE tid = '".$this->parent_tid."'")); + if(!empty($novalnet_order_details['payment_id'])){ + $transaction_details = xtc_db_fetch_array(xtc_db_query("SELECT payment_type,order_amount, order_no, sum(callback_amount) AS callback_total_amount FROM novalnet_callback_history WHERE original_tid = " . $this->parent_tid)); // Get transaction details from Novalnet tables + $novalnet_order_details['callback_amount'] = (!empty($novalnet_order_details['callback_amount'])) ? ($novalnet_order_details['callback_amount'] + $transaction_details['callback_total_amount']) : $transaction_details['callback_total_amount']; + } + $orderNumber = !empty($novalnet_order_details['order_no']) ? $novalnet_order_details['order_no'] : $this->event_data['transaction']['order_no']; + if(empty($orderNumber)) { + $this->displayMessage(array( 'message' => 'Order reference not found in the shop' )); + } + $shop_order_details = xtc_db_fetch_array(xtc_db_query("SELECT payment_method,payment_class,orders_id, customers_id,orders_status,comments,language FROM ".TABLE_ORDERS." WHERE orders_id = '".$orderNumber."'")); + + $this->order_lang = xtc_db_fetch_array(xtc_db_query("SELECT * FROM " . TABLE_LANGUAGES . " WHERE directory = '" . $shop_order_details['language'] ."'")); + $this->include_required_files($this->order_lang); + + $order_details['nn_trans_details'] = $novalnet_order_details; + $order_details['shop_order'] = $orderNumber; + $order_details['shop_order_details'] = $shop_order_details; + return $order_details; + } + + /* + * Update the communication failure + * + * @param $order_details + * @return array + */ + function handleCommunicationFailure($order_details) { + if ($this->event_data['result']['status'] == 'SUCCESS') { + $order = new order($order_details['orders_id']); + if (in_array($order_details['payment_class'], array('novalnet_googlepay','novalnet_applepay'))) { + $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($order_details['payment_class'], $this->event_data); + NovalnetHelper::updateOrderStatus($order_details['orders_id'], $order->info['comments'], $this->event_data, $order_details['payment_class']); + } else { + $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($order_details['payment_class'], $this->event_data); + NovalnetHelper::updateOrderStatus($order_details['orders_id'], $order->info['comments'], $this->event_data, $order_details['payment_method']); + } + $this->sendMailToCustomer(array( + 'order_no' => $order_details['orders_id'], + 'language' => $this->order_lang['language'], + 'language_id' => $this->order_lang['languages_id'], + 'comments' => nl2br($order->info['comments']), + ), true); + return; + } else { + $status_text = NovalnetHelper::getServerResponse($this->event_data['result']); + $novalnet_data = [ + 'tid' => (!empty($this->parent_tid)) ? $this->parent_tid: '', + ]; + NovalnetHelper::updateTempOrderFail($order_details['orders_id'], $novalnet_data['tid'], $status_text); + $this->displayMessage(array( 'message' => 'Novalnet callback received' )); + return; + } + } + + /** + * Handle transaction capture + * + */ + function handleTransactionCapture() { + if ($this->order_details['nn_trans_details']['status'] != $this->event_data['transaction']['status']) { + $novalnet_update_data = [ + 'status' => $this->event_data['transaction']['status'], + ]; + if (in_array($this->order_details['shop_order_details']['payment_class'], array('novalnet_googlepay','novalnet_applepay'))) { + $order_status = NovalnetHelper::getOrderStatus ($this->event_data['transaction']['status'], $this->order_details['shop_order_details']['payment_class']); + } else { + $order_status = NovalnetHelper::getOrderStatus ($this->event_data['transaction']['status'], $this->order_details['shop_order_details']['payment_method']); + } + $comments = PHP_EOL.sprintf(MODULE_PAYMENT_NOVALNET_TRANS_CONFIRM_SUCCESSFUL_MESSAGE, gmdate('d-m-Y'), gmdate('H:i:s')).PHP_EOL.PHP_EOL; + if (in_array($this->order_details['shop_order_details']['payment_method'], array('novalnet_instalment_sepa', 'novalnet_instalment_invoice'))) { + $total_amount = ($this->order_details['nn_trans_details']['amount'] < $this->event_data['transaction']['amount']) ? $this->event_data['transaction']['amount'] : $this->order_details['nn_trans_details']['amount']; + $novalnet_update_data['instalment_cycle_details'] = NovalnetHelper::storeInstalmentdetails($this->event_data, $total_amount); + } + $order_comment = $comments; + $order_comment .= NovalnetHelper::getTransactionDetails($this->event_data); + if (in_array($this->order_details['shop_order_details']['payment_method'], array('novalnet_invoice', 'novalnet_guarantee_invoice', 'novalnet_instalment_invoice'))) { + if (empty($this->event_data ['transaction']['bank_details'])) { + if (!empty($this->order_details['nn_trans_details']['payment_id'])) { + if(!empty($this->order_details['nn_trans_details']['payment_ref'])) { + $bank_data = unserialize($this->order_details['nn_trans_details']['payment_ref']); + $bank_details = array( + 'account_holder' => $bank_data['invoice_account_holder'], + 'iban' => $bank_data['invoice_iban'], + 'bic' => $bank_data['invoice_bic'], + 'bank_name' => $bank_data['invoice_bankname'], + 'bank_place' => $bank_data['invoice_bankplace'], + ); + } else { + $bank_data = unserialize($this->order_details['nn_trans_details']['payment_details']); + $bank_details = array( + 'account_holder' => $bank_data['account_holder'], + 'iban' => $bank_data['bank_iban'], + 'bic' => $bank_data['bank_bic'], + 'bank_name' => $bank_data['bank_name'], + 'bank_place' => $bank_data['bank_city'], + ); + } + } else { + $bank_details = json_decode($this->order_details['nn_trans_details']['payment_details'], true); + } + $this->event_data ['transaction']['bank_details'] = $bank_details; + } + $order_comment .= NovalnetHelper::getBankDetails($this->event_data, $this->order_details['shop_order']); + if (in_array($this->order_details['shop_order_details']['payment_method'], array('novalnet_invoice', 'novalnet_guarantee_invoice'))) { + $order_comment .= PHP_EOL. MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT .PHP_EOL; + $order_comment .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 1, ('TID ' . $this->parent_tid)) . PHP_EOL; + $order_comment .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, ('BNR-' . MODULE_PAYMENT_NOVALNET_PROJECT_ID . '-' . $this->event_data['transaction']['order_no'])) . PHP_EOL; + } + } + if (in_array($this->order_details['shop_order_details']['payment_method'], array('novalnet_instalment_sepa', 'novalnet_instalment_invoice'))) { + $order_comment .= NovalnetHelper::formInstalmentPaymentReference($this->event_data); + } + $this->updateOrderStatusHistory($this->event_data['transaction']['order_no'], $order_status, $order_comment); + $this->sendMailToCustomer(array( + 'comments' => '
' . $order_comment, + 'mail_subject' => sprintf(MODULE_PAYMENT_NOVALNET_ORDER_CAPTURE_MAIL_SUBJECT, $this->order_details['shop_order']), + 'order_no' => $this->order_details['shop_order'], + 'language' => $this->order_lang['language'], + 'language_id' => $this->order_lang['languages_id'], + ), true); + $this->updateNovalnetTransaction($novalnet_update_data, "tid='{$this->parent_tid}'"); + $this->sendWebhookMail($comments); + $this->displayMessage([ 'message' => $comments]); + } + } + + /** + * Handle transaction cancel + * + */ + function handleTransactionCancel() { + if ($this->order_details['nn_trans_details']['status'] != $this->event_data['transaction']['status']) { + $comments = sprintf(MODULE_PAYMENT_NOVALNET_TRANS_DEACTIVATED_MESSAGE, gmdate('d-m-Y'), gmdate('H:i:s')); + $novalnet_update_data = [ + 'status' => $this->event_data['transaction']['status'], + ]; + $this->updateNovalnetTransaction($novalnet_update_data, "tid='{$this->parent_tid}'"); + $this->updateOrderStatusHistory($this->event_data['transaction']['order_no'], MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED, $comments); + $this->sendWebhookMail($comments); + $this->displayMessage([ 'message' => $comments]); + } + } + + + /** + * Handle transaction refund + * + */ + function handleTransactionRefund() { + if (!empty($this->event_data['transaction']['refund']['amount'])) { + $order_status_id = ''; + $comments = PHP_EOL . sprintf(MODULE_PAYMENT_NOVALNET_REFUND_PARENT_TID_MSG, $this->parent_tid, xtc_format_price_order(($this->event_data['transaction']['refund']['amount']/100), 1, $this->event_data['transaction']['currency'])); + if (!empty($this->event_data['transaction']['refund']['tid'])) { + $comments .= sprintf(MODULE_PAYMENT_NOVALNET_REFUND_CHILD_TID_MSG, $this->event_data['transaction']['refund']['tid']); + } + $refund_amount = $this->event_data['transaction']['refund']['amount']; + $refunded_amount = $this->order_details['nn_trans_details']['refund_amount'] + $refund_amount; + $novalnet_update_data = array( + 'refund_amount' => $refunded_amount, + 'status' => $this->event_data['transaction']['status'], + ); + if(!empty($this->order_details['nn_trans_details']['payment_id'])) { + $callback_refund = xtc_db_fetch_array(xtc_db_query("SELECT sum(callback_amount) AS callback_refund_total FROM novalnet_callback_history WHERE payment_type IN ('PRZELEWY24_REFUND', 'RETURN_DEBIT_SEPA', 'CREDITCARD_BOOKBACK', 'PAYPAL_BOOKBACK', 'CREDITCARD_CHARGEBACK', 'REFUND_BY_BANK_TRANSFER_EU', 'REVERSAL','CASHPAYMENT_REFUND','GUARANTEED_SEPA_BOOKBACK','GUARANTEED_INVOICE_BOOKBACK','INSTALMENT_SEPA_BOOKBACK','INSTALMENT_INVOICE_BOOKBACK') AND original_tid = " . $this->parent_tid)); + $refunded_amount = (!empty($callback_refund['callback_refund_total'])) ? ($refunded_amount + $callback_refund['callback_refund_total']) : $refunded_amount; + } + if (in_array($this->event_data['transaction']['payment_type'], array('INSTALMENT_INVOICE','INSTALMENT_DIRECT_DEBIT_SEPA'))) { + $instalment_details = (!empty($this->order_details['nn_trans_details']['instalment_cycle_details'])) ? json_decode($this->order_details['nn_trans_details']['instalment_cycle_details'], true) : unserialize($this->order_details['nn_trans_details']['payment_details']); + if(!empty($instalment_details)) { + foreach($instalment_details as $cycle => $cycle_details){ + if(!empty($cycle_details['reference_tid']) && ($cycle_details['reference_tid'] == $this->parent_tid)) { + $instalment_amount = (strpos((string)$instalment_details[$cycle]['instalment_cycle_amount'], '.')) ? $instalment_details[$cycle]['instalment_cycle_amount']*100 : $instalment_details[$cycle]['instalment_cycle_amount']; + $instalment_amount = $instalment_amount - $refund_amount; + $instalment_details[$cycle]['instalment_cycle_amount'] = $instalment_amount; + if($instalment_details[$cycle]['instalment_cycle_amount'] <= 0) { + $instalment_details[$cycle]['status'] = 'Refunded'; + } + } + $novalnet_update_data['instalment_cycle_details'] =json_encode($instalment_details); + } + } + $novalnet_update_data['instalment_cycle_details'] =json_encode($instalment_details); + } + if ($refunded_amount >= $this->order_details['nn_trans_details']['amount']) { + $order_status_id = MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED; + } + $this->updateNovalnetTransaction($novalnet_update_data, "tid='{$this->parent_tid}'"); + $this->updateOrderStatusHistory($this->order_details['shop_order'], $order_status_id, $comments); + $this->sendWebhookMail($comments); + $this->displayMessage([ 'message' => $comments]); + } + } + + /** + * Handle chargeback + * + */ + function handleTransactionCredit() { + $update_comments = true; + $order_status = ''; + $comments = sprintf(NOVALNET_WEBHOOK_CREDIT_NOTE, $this->parent_tid, xtc_format_price_order(($this->event_data['transaction']['amount']/100), 1, $this->event_data['transaction']['currency']), gmdate('d-m-Y H:i:s'), $this->event_tid); + $order_status = NovalnetHelper::getOrderStatus($this->event_data['transaction']['status'], $this->order_details['shop_order_details']['payment_method']); + if (in_array($this->event_data['transaction']['payment_type'], ['INVOICE_CREDIT', 'CASHPAYMENT_CREDIT', 'MULTIBANCO_CREDIT'])) { + $paid_amount = (!empty($this->order_details['nn_trans_details']['refund_amount'])) ? ((int)$this->order_details['nn_trans_details']['refund_amount'] + (int)$this->order_details['nn_trans_details']['callback_amount']) : $this->order_details['nn_trans_details']['callback_amount']; + if ($paid_amount < $this->order_details['nn_trans_details']['amount']) { + $total_paid_amount = $paid_amount + $this->event_data['transaction']['amount']; + $update_data = array( + 'callback_amount' => $total_paid_amount + ); + if ($total_paid_amount >= $this->order_details['nn_trans_details']['amount']) { + $order_status = constant('MODULE_PAYMENT_'. strtoupper($this->order_details['shop_order_details']['payment_method']) .'_CALLBACK_ORDER_STATUS'); + $update_data['status'] = $this->event_data['transaction']['status']; + } + $this->updateNovalnetTransaction($update_data, "tid='{$this->parent_tid}'"); + } else { + $update_comments = false; + $comments = sprintf(('Callback script executed already'), gmdate('d-m-Y'), gmdate('H:i:s')); + } + } + if($update_comments) { + $this->updateOrderStatusHistory($this->event_data['transaction']['order_no'], $order_status, $comments, 1); + $this->sendWebhookMail($comments); + } + $this->displayMessage([ 'message' => $comments]); + } + + /** + * Handle chargeback + * + */ + function handleChargeback() { + if (($this->order_details['nn_trans_details']['status'] == 'CONFIRMED' || in_array($this->order_details['nn_trans_details']['status'], NovalnetHelper::$statuses['CONFIRMED'])) && !empty($this->event_data ['transaction'] ['amount'])) { + $comments =sprintf(NOVALNET_WEBHOOK_CHARGEBACK_NOTE , $this->parent_tid, xtc_format_price_order(($this->event_data['transaction']['amount']/100), 1, $this->event_data['transaction']['currency']), gmdate('d.m.Y'), gmdate('H:i:s'), $this->event_tid); + $this->updateOrderStatusHistory($this->event_data['transaction']['order_no'], '', $comments); + $this->sendWebhookMail($comments); + $this->displayMessage([ 'message' => $comments]); + } + } + + /** + * Handle instalment + * + */ + function handleInstalment() { + $comment = ''; + if ($this->event_data['transaction']['status'] == 'CONFIRMED' && !empty($this->event_data['instalment']['cycles_executed']) + && in_array($this->event_data['transaction']['payment_type'], array('INSTALMENT_INVOICE','INSTALMENT_DIRECT_DEBIT_SEPA'))) { + $instalment_details = (!empty($this->order_details['nn_trans_details']['instalment_cycle_details'])) ? json_decode($this->order_details['nn_trans_details']['instalment_cycle_details'], true) : unserialize($this->order_details['nn_trans_details']['payment_details']); + $instalment = $this->event_data['instalment']; + $cycle_index = $instalment['cycles_executed'] - 1; + if (!empty($instalment)) { + $instalment_details[$cycle_index]['next_instalment_date'] = (!empty($instalment['next_cycle_date'])) ? $instalment['next_cycle_date'] : '-'; + if (!empty($this->event_data['transaction']['tid'])) { + $instalment_details[$cycle_index]['reference_tid'] = $this->event_data['transaction']['tid']; + $instalment_details[$cycle_index]['status'] = 'Paid'; + $instalment_details[$cycle_index]['paid_date'] = date('Y-m-d H:i:s'); + } + } + if ($this->event_data['transaction']['payment_type'] == 'INSTALMENT_INVOICE' && empty($this->event_data ['transaction']['bank_details'])) { + if (!empty($this->order_details['nn_trans_details']['payment_id'])) { + if(!empty($this->order_details['nn_trans_details']['payment_ref'])) { + $bank_data = unserialize($this->order_details['nn_trans_details']['payment_ref']); + $this->event_data ['transaction']['bank_details'] = array( + 'account_holder' => $bank_data['invoice_account_holder'], + 'iban' => $bank_data['invoice_iban'], + 'bic' => $bank_data['invoice_bic'], + 'bank_name' => $bank_data['invoice_bankname'], + 'bank_place' => $bank_data['invoice_bankplace'], + ); + } + } else { + $this->event_data ['transaction']['bank_details'] = json_decode($this->order_details['nn_trans_details']['payment_details'], true); + } + } + $comment = sprintf(NOVALNET_WEBHOOK_NEW_INSTALMENT_NOTE, $this->parent_tid, xtc_format_price_order(($this->event_data['instalment']['cycle_amount']/100), 1, $this->event_data['transaction']['currency']), gmdate('d-m-Y'), $this->event_tid); + $this->updateNovalnetTransaction(array('instalment_cycle_details' => json_encode($instalment_details)), "tid='{$this->parent_tid}'"); + $this->updateOrderStatusHistory($this->event_data['transaction']['order_no'], '', $comment); + $transaction_comment = NovalnetHelper::insertTransactionDetails($this->order_details['shop_order'], $this->order_details['shop_order_details']['payment_method'], $this->event_data , false); + $this->sendMailToCustomer(array( + 'comments' => '
' . $transaction_comment, + 'order_no' => $this->order_details['shop_order'], + 'language' => $this->order_lang['language'], + 'language_id' => $this->order_lang['languages_id'], + ), true); + $this->updateOrderStatusHistory($this->event_data['transaction']['order_no'], '', $transaction_comment, 1); + $this->sendWebhookMail($comment); + $this->displayMessage([ 'message' => $comment]); + } + } + + /** + * Handle instalment cancel + * + */ + function handleInstalmentCancel() { + $comments = ''; + if ($this->event_data['transaction']['status'] == 'CONFIRMED') { + $novalnet_update_data = [ + 'status' => 'DEACTIVATED', + ]; + $comments .= sprintf(NOVALNET_WEBHOOK_INSTALMENT_CANCEL_NOTE, $this->parent_tid, date()); + } + $this->updateNovalnetTransaction($novalnet_update_data, "tid='{$this->parent_tid}'"); + $this->updateOrderStatusHistory($this->event_data['transaction']['order_no'], '', $comments); + $this->sendWebhookMail($comments); + $this->displayMessage(['message' => $comments]); + } + + /** + * Handle transaction update + * + */ + function handleTransactionUpdate() { + if (in_array( $this->event_data['transaction']['status'], array('PENDING', 'ON_HOLD', 'CONFIRMED', 'DEACTIVATED'))) { + $novalnet_update_data = [ + 'status' => $this->event_data ['transaction']['status'], + ]; + $order_status = ''; + if ($this->event_data['transaction']['status'] == 'DEACTIVATED') { + $comments = sprintf(MODULE_PAYMENT_NOVALNET_TRANS_DEACTIVATED_MESSAGE, gmdate('d.m.Y'), gmdate('H:i:s')); + $order_status = MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED; + } else { + if (in_array($this->order_details['nn_trans_details']['status'], array('PENDING', 'ON_HOLD' ), true) + || in_array($this->order_details['nn_trans_details']['status'], NovalnetHelper::$statuses['PENDING']) + || in_array($this->order_details['nn_trans_details']['status'], NovalnetHelper::$statuses['ON_HOLD']) + ) { + if ($this->event_data['transaction']['status'] == 'ON_HOLD') { + $order_status = MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE; + } elseif ($this->event_data['transaction']['status'] == 'CONFIRMED') { + if (in_array( $this->event_data['transaction']['payment_type'], array('INSTALMENT_INVOICE','INSTALMENT_DIRECT_DEBIT_SEPA'))) { + if (empty($this->order_details['nn_trans_details']['instalment_cycle_details'])) { + $total_amount = ($this->order_details['nn_trans_details']['amount'] < $this->event_data['transaction']['amount']) ? $this->event_data['transaction']['amount'] : $this->order_details['nn_trans_details']['amount']; + $novalnet_update_data['instalment_cycle_details'] = NovalnetHelper::storeInstalmentdetails($this->event_data, $total_amount); + } + } + $order_status = constant('MODULE_PAYMENT_' . strtoupper($this->order_details['shop_order_details']['payment_method']) . '_ORDER_STATUS'); + $novalnet_update_data['callback_amount'] = $this->order_details['nn_trans_details']['amount']; + } + // Reform the transaction comments. + $transaction_comments = NovalnetHelper::getTransactionDetails($this->event_data); + if (in_array($this->event_data['transaction']['payment_type'], array( 'INSTALMENT_INVOICE','GUARANTEED_INVOICE', 'INVOICE', 'PREPAYMENT'))) { + if (empty($this->event_data ['transaction']['bank_details'])) { + if (!empty($this->order_details['nn_trans_details']['payment_id'])) { + if(!empty($this->order_details['nn_trans_details']['payment_ref'])) { + $bank_data = unserialize($this->order_details['nn_trans_details']['payment_ref']); + $this->event_data ['transaction']['bank_details'] = array( + 'account_holder' => $bank_data['invoice_account_holder'], + 'iban' => $bank_data['invoice_iban'], + 'bic' => $bank_data['invoice_bic'], + 'bank_name' => $bank_data['invoice_bankname'], + 'bank_place' => $bank_data['invoice_bankplace'], + ); + } else { + $bank_data = unserialize($this->order_details['nn_trans_details']['payment_details']); + $this->event_data ['transaction']['bank_details'] = array( + 'account_holder' => $bank_data['account_holder'], + 'iban' => $bank_data['bank_iban'], + 'bic' => $bank_data['bank_bic'], + 'bank_name' => $bank_data['bank_name'], + 'bank_place' => $bank_data['bank_city'], + ); + } + } else { + $this->event_data ['transaction']['bank_details'] = json_decode($this->order_details['nn_trans_details']['payment_details'], true); + } + } + $transaction_comments .= NovalnetHelper::getBankDetails($this->event_data, $this->event_data['transaction']['order_no']); + + if ($this->event_data['transaction']['payment_type'] != 'INSTALMENT_INVOICE') { + $transaction_comments .= PHP_EOL. MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT .PHP_EOL; + $transaction_comments .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 1, ('TID ' . $this->event_data['transaction']['tid'])) . PHP_EOL; + if(!empty($this->order_details['shop_order']) || !empty($this->event_data['transaction']['invoice_ref'])) { + $invoice_ref = (!empty($this->event_data['transaction']['invoice_ref'])) ? $this->event_data['transaction']['invoice_ref'] : 'BNR-' . MODULE_PAYMENT_NOVALNET_PROJECT_ID . '-' . $this->order_details['shop_order']; + $transaction_comments .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, $invoice_ref) . PHP_EOL; + } + } + } + if ('CASHPAYMENT' === $this->event_data ['transaction']['payment_type']) { + $this->event_data ['transaction']['nearest_stores'] = json_decode($this->order_details['nn_trans_details']['payment_details'], true); + $transaction_comments .= NovalnetHelper::getBankDetails($this->event_data, $this->event_data['transaction']['order_no'] = ''); + } + if (in_array($this->event_data['transaction']['payment_type'], array( 'INSTALMENT_INVOICE','INSTALMENT_DIRECT_DEBIT_SEPA'))) { + $transaction_comments .= NovalnetHelper::formInstalmentPaymentReference($this->event_data); + } else { + if ((int)$this->event_data['transaction']['amount'] != (int)$this->order_details['nn_trans_details']['amount']) { + $novalnet_update_data['amount'] = $this->event_data['transaction']['amount']; + if('CONFIRMED' === $this->event_data['transaction']['status']) { + $novalnet_update_data['callback_amount'] = $this->event_data['transaction']['amount']; + } + } + } + + if (empty($this->event_data['instalment']['cycle_amount'])) { + $amount = $this->event_data['transaction']['amount']; + } else { + $amount = $this->event_data['instalment']['cycle_amount']; + } + + if (! empty($this->event_data['transaction']['due_date'])) { + $comments =sprintf(NOVALNET_WEBHOOK_TRANSACTION_UPDATE_NOTE_DUE_DATE, $this->event_tid, xtc_format_price_order(($amount/100), 1, $this->event_data['transaction']['currency']), $this->event_data['transaction']['due_date']); + } else { + $comments = sprintf(NOVALNET_WEBHOOK_TRANSACTION_UPDATE_NOTE, $this->event_tid, xtc_format_price_order(($amount/100), 1, $this->event_data['transaction']['currency'])); + } + } + } + $this->updateNovalnetTransaction($novalnet_update_data, "tid='{$this->parent_tid}'"); + $this->updateOrderStatusHistory($this->order_details['shop_order'], $order_status, $comments); + if (!empty($transaction_comments)) { + $this->updateOrderStatusHistory($this->order_details['shop_order'], $order_status, $transaction_comments); + $this->sendMailToCustomer(array( + 'comments' => '
' . $comments . '
' . $transaction_comments, + 'order_no' => $this->order_details['shop_order'], + 'language' => $this->order_lang['language'], + 'language_id' => $this->order_lang['languages_id'], + ), true); + } + $this->sendWebhookMail($comments); + $this->displayMessage([ 'message' => $comments]); + } + } + + /** + * Handle Payment Reminder + * + */ + function handlePaymentReminder() { + $comments =sprintf(NOVALNET_PAYMENT_REMINDER_NOTE , explode('_', $this->event_type)[2]); + $this->updateOrderStatusHistory($this->event_data['transaction']['order_no'], '', $comments, 0); + $this->sendWebhookMail($comments); + $this->displayMessage([ 'message' => $comments]); + } + + /** + * Handle Collection Agency Submission + * + */ + function handleCollectionSubmission() { + $comments =sprintf(NOVALNET_COLLECTION_SUBMISSION_NOTE , $this->event_data['collection']['reference']); + $this->updateOrderStatusHistory($this->event_data['transaction']['order_no'], '', $comments, 0); + $this->sendWebhookMail($comments); + $this->displayMessage([ 'message' => $comments]); + } + + /** + * Print the Webhook messages. + * + * @param $message + * + * @return void + */ + function displayMessage($message) { + echo json_encode($message); + exit; + } + + /** + * Update the details in Shop order status table. + * + * @param $order_id + * @param $order_status_id + * @param $comments + * @param $customer_notified + */ + function updateOrderStatusHistory($order_id, $order_status_id = '', $comments = '', $customer_notified = 1) { + $datas_need_to_update = []; + if ($order_status_id == '') { + $order_status_id = $this->order_details['shop_order_details']['orders_status']; + } + + $datas_need_to_update['orders_status'] = $order_status_id; + xtc_db_perform(TABLE_ORDERS, $datas_need_to_update, "update", "orders_id='$order_id'"); + + + $oh_data_array = array( + 'orders_id' => $order_id, + 'orders_status_id' => $order_status_id, + 'date_added' => date('Y-m-d H:i:s'), + 'customer_notified' => $customer_notified, + 'comments' => xtc_db_prepare_input($comments . PHP_EOL) + ); + xtc_db_perform(TABLE_ORDERS_STATUS_HISTORY,$oh_data_array); + } + /** + * To Form recurring order mail + * + * @param $datas array + * @param $update_comment boolean + * + */ + function sendMailToCustomer($datas, $update_comment=false){ + // GET MAIL CONTENTS ARRAY + $order = new order($datas['order_no']); + if($update_comment){ + $order->info['comments'] = $datas['comments']; + } + // GET WITHDRAWAL + MainFactory::create_object('ShopContentContentControl'); + $t_mail_attachment_array = array(); + // GET E-MAIL LOGO + $t_mail_logo = ''; + $t_logo_mail = MainFactory::create_object('GMLogoManager', array("gm_logo_mail")); + if($t_logo_mail->logo_use == '1') + { + $t_mail_logo = $t_logo_mail->get_logo(); + } + + $coo_send_order_content_view = MainFactory::create_object('SendOrderContentView'); + $coo_send_order_content_view->set_('order', $order); + if($datas['order_no'] != ''){ + $coo_send_order_content_view->set_('order_id', $datas['order_no']); + } + if($datas['language'] != ''){ + $coo_send_order_content_view->set_('language', $datas['language']); + $coo_send_order_content_view->set_('language_id', $datas['language_id']); + } + $coo_send_order_content_view->set_('mail_logo', $t_mail_logo); + $t_mail_content_array = $coo_send_order_content_view->get_mail_content_array(); + // GET HTML MAIL CONTENT + $t_content_mail = $t_mail_content_array['html']; + // GET TXT MAIL CONTENT + $t_txt_mail = $t_mail_content_array['txt']; + + if (extension_loaded('intl')) { + $formatted_date = utf8_encode_wrapper(DateFormatter::formatAsFullDate(new DateTime(), new LanguageCode(new StringType($this->order_lang['code'])))); + } else { + $formatted_date = utf8_encode_wrapper(strftime(DATE_FORMAT_LONG)); + } + + $order_subject = (!empty($datas['mail_subject'])) ? $datas['mail_subject'] : sprintf(MODULE_PAYMENT_NOVALNET_ORDER_MAIL_SUBJECT,$datas['order_no'],$formatted_date,''); + + // send mail to admin + // BOF GM_MOD: + if(SEND_EMAILS == 'true') + { + // get the sender mail adress. e.g. Host Europe has problems with the customer mail adress. + $from_email_address = $order->customer['email_address']; + if(SEND_EMAIL_BY_BILLING_ADRESS == 'SHOP_OWNER') { + $email_to = EMAIL_FROM; + } + xtc_php_mail($from_email_address, + $order->customer['firstname'].' '.$order->customer['lastname'], + EMAIL_BILLING_ADDRESS, + STORE_NAME, + EMAIL_BILLING_FORWARDING_STRING, + $order->customer['email_address'], + $order->customer['firstname'].' '.$order->customer['lastname'], + $t_mail_attachment_array, + '', + $order_subject, + $t_content_mail, + $t_txt_mail + ); + } + // send mail to customer + // BOF GM_MOD: + if (SEND_EMAILS == 'true') + { + xtc_php_mail(EMAIL_BILLING_ADDRESS, + EMAIL_BILLING_NAME, + $order->customer['email_address'], + $order->customer['firstname'].' '.$order->customer['lastname'], + '', + EMAIL_BILLING_REPLY_ADDRESS, + EMAIL_BILLING_REPLY_ADDRESS_NAME, + $t_mail_attachment_array, + '', + $order_subject, + $t_content_mail, + $t_txt_mail + ); + } + } + + /* + * Update the transaction details in Novalnet table + * + * @param $data + * @param $parameters + * @param $action + */ + function updateNovalnetTransaction($data, $parameters = '', $action = 'update') { + if ($action != 'insert' && $parameters == '') { + return false; + } + xtc_db_perform('novalnet_transaction_detail', $data, $action, $parameters); + } + + /** + * Send notification mail to Merchant + * + * @param $comments + */ + function sendWebhookMail($comments) { + $message = xtc_db_prepare_input($comments); + $email = NovalnetHelper::validateEmail(MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO); + // Assign email to address + $email_to = !empty($email) ? $email : STORE_OWNER_EMAIL_ADDRESS; + $order_subject = 'Novalnet Callback Script Access Report - '.STORE_NAME; + // Send mail + xtc_php_mail(EMAIL_FROM, STORE_NAME, $email_to, STORE_OWNER, '', '', '', '', '', $order_subject, $message, ''); + } + + /** + * Include language file and helper file. + */ + function include_required_files($lang_data) { + // include language + require_once (DIR_WS_CLASSES.'language.php'); + $lang = new language($lang_data['code']); + foreach (glob(DIR_FS_CATALOG.'lang/'.$lang->language['directory'].'/modules/payment/novalnet*.php') as $filename) { + include_once $filename; + } + // include helper file after language files. + require_once(DIR_FS_CATALOG . 'ext/novalnet/NovalnetHelper.class.php'); + return; + } +} +new NovalnetWebhooks(); +?> diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..ff22f5e --- /dev/null +++ b/changelog.txt @@ -0,0 +1,92 @@ +*** Changelog *** + += 12.0.3 - 10.02.2023 = +* Fix - SQL warning errors for specific languages + += 12.0.2 - 23.01.2023 = +* Fix - Compatibility for Gambio version 4.7.2.1 +* Fix - Warning errors during payment module uninstallation +* Fix - Transaction amount mismatch during VAT and Coupon calculation +* Fix - SQL errors while processing Credit/Debit Cards payments for the country Italy +* Removed - Button Theme configuration for Google Pay payment + += 12.0.1 - 23.12.2022 = +* New - Implemented Zero amount authorization for the payments Credit/Debit card and Direct Debit SEPA +* New - Updated cart details to PayPal +* Fix - Warning errors during payment module uninstallation +* Enhanced - Invoice payment name is updated for German translation + += 12.0.0 - 26.10.2022 = +* Major version release: Entire restructure & optimization of the older version with a new v2 API structure, additional payment methods integration, +and enhanced usability + += 11.3.0 - 05.01.2022 = +* New - Handled parameter variation for similar and different Shipping and Billing addresses in the payment call +* New - Implemented enforce 3D secure payment for countries outside EU +* New - Implemented Payment duration for Prepayment +* Fix - Compatibility issue for 4.5.1.1 +* Enhanced - Credit/Debit Cards payment with V2 process +* Removed - PIN by callback and PIN by SMS for Direct Debit SEPA and Invoice payment methods +* Removed - BCC field for Webhook Email notification +* Removed - Enable default payment method configuration + += 11.2.0 - 23.01.2021 = +* New - Implemented instalment payment for Direct Debit SEPA and Invoice +* Fix - Compatibility issue for 4.3.1.0 +* Enhanced - Barzahlen payment name and logo +* Removed - Proxy server configuration +* Removed - Gateway timeout configuration + += 11.1.8 - 03.07.2020 = +* Fix - Compatibility issue for 4.1.1.2 +* Enhanced - Callback has been optimized as per the new testcase + += 11.1.7 - 26.05.2020 = +* Enhanced - Adjusted validation in the checkout page for company name field +* Enhanced - Vendor script has been optimized +* Enhanced - Implemented new encryption method for redirect payments +* Enhanced - Auto configuration call perform via cURL method +* Enhanced - Novalnet bank details will be displayed for on-hold transactions in Invoice, Invoice with payment guarantee and Prepayment +* Enhanced - On-hold transaction configuration has been implemented for Credit Card, Direct Debit SEPA, Direct Debit SEPA with payment guarantee, Invoice, Invoice with payment guarantee and PayPal +* Enhanced - Callback has been optimized as per the new testcase +* Enhanced - Payment reference configuration for Invoice / prepayment +* Enhanced - Transaction reference in payments +* Enhanced - Autofill for payment data +* Removed - BIC field for Direct Debit SEPA +* Removed - CartaSi logo for Credit Card +* Removed - Proxy server configuration +* Removed - Dynamic subscription management + += 11.1.6 - 07.03.2019 = +* Fix - Compatible issue for gambio version 3.11.3.0 + += 11.1.5 - 01.12.2018 = +* Enhanced - Guaranteed payment minimum amount reduced to 9.99EUR +* Compatible - Compatibility has been checked upto PHP 7.2 version + += 11.1.4 - 13.10.2018 = +* New - Custom checkout overlay for Barzahlen +* New - Force 3D secure process has been implemented as per predefined filters and settings in the Novalnet admin portal +* Enhanced - Due date update notification in the shop, on activation of transaction for Invoice, Invoice with payment guarantee and Prepayment +* Enhanced - On-hold transaction configuration has been implemented for Credit Card, Direct Debit SEPA, Direct Debit SEPA with payment guarantee, Invoice, Invoice with payment guarantee and PayPal +* Enhanced - Optimized IP condition check for remote address +* Enhanced - Guaranteed payment pending status has been implemented +* Enhanced - Callback has been optimized as per the new testcase + += 11.1.3 - 01.12.2017 = +* Enhanced -Dynamic IP control applied through domain instead of static IP in vendor script. Actual IP of Novalnet will be extracted in real time from the domain + += 11.1.2 - 21.09.2017 = +* New - Implemented Barzahlen payment method +* Enhanced - Merchant Administration Portal link has been updated in shop admin +* Enhanced - Optimized vendor script validation +* Removed - Refund with account details from shop admin +* Removed - Enable debug mode configuration in Merchant script management + += 11.1.1 - 25.04.2017 = +* Enhanced - Updated payment logo for Credit Card and Invoice payment +* Enhanced - dded new parameter in all API calls +* Compatible - Tested upto gambio version 3.6.0.2 + += 11.1.0 - 07.03.2017 = +* New release diff --git a/ext/novalnet/NovalnetHelper.class.php b/ext/novalnet/NovalnetHelper.class.php new file mode 100644 index 0000000..1214562 --- /dev/null +++ b/ext/novalnet/NovalnetHelper.class.php @@ -0,0 +1,1439 @@ + array( '85', '91', '98', '99', '84' ), + 'CONFIRMED' => array( '100' ), + 'PENDING' => array( '90', '80', '86', '83', '75' ), + 'DEACTIVATED' => array( '103' ), + ); + /** + * Validate the merchant credentials + * + */ + public static function validateMerchantConfiguration() { + $error_display = self::checkMerchantCredentials(); + if (strpos(MODULE_PAYMENT_INSTALLED, $_GET['module']) && $_GET['module'] == 'novalnet_config' && (!isset($_GET['action']) || $_GET['action'] != 'edit')) { + if ($error_display) { + echo self::displayErrorMessage(MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_TITLE); + } + } + } + + /** + * Check the merchant credentials are empty + * + * @return boolean + */ + public static function checkMerchantCredentials() { + if ((!defined('MODULE_PAYMENT_NOVALNET_SIGNATURE') || MODULE_PAYMENT_NOVALNET_SIGNATURE == '' ) + || (!defined('MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY') || MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY == '' )) { + return true; + } else { + return false; + } + } + + /** + * Display error message + * + * @param $error_payment_name + * + * @return string + */ + public static function displayErrorMessage($error_payment_name) { + $_SESSION['error_msg_displayed'] = true; + return '
' . $error_payment_name . '

'. MODULE_PAYMENT_NOVALNET_VALID_MERCHANT_CREDENTIALS_ERROR . '
'; + } + + /** + * Check instalment payment conditions + * + * @param int $order_amount + * @param string $payment_name + * */ + public static function checkInstalmentConditions($order_amount, $payment_name) { + global $order; + $minimum_amount_gurantee = constant('MODULE_PAYMENT_'. strtoupper($payment_name) . '_MINIMUM_ORDER_AMOUNT') !='' ? constant('MODULE_PAYMENT_'. strtoupper($payment_name) . '_MINIMUM_ORDER_AMOUNT') : '1998'; + + $country_check = self::checkGuaranteeCountries(strtoupper($order->billing['country']['iso_code_2']),constant('MODULE_PAYMENT_'.strtoupper($payment_name).'_ALLOW_B2B'), $order->billing['company']); + + if ($order_amount >= $minimum_amount_gurantee && $country_check && $order->info['currency'] == 'EUR' && self::isBillingShippingsame()) { + return true; + } else { + return false; + } + } + + /** + * Get Instaments date + * + * @param $novalnet_instalment_cycle + * @param $novalnet_recurring_period_cycle + * + * @return $instalment_date_invoice + */ + public static function getInstalmentDate($novalnet_instalment_cycle, $novalnet_recurring_period_cycle) { + $total_invoice_instalment_cycle = !empty($novalnet_instalment_cycle) ? $novalnet_instalment_cycle[count($novalnet_instalment_cycle)-1]:''; + $current_month_invoice = date('m'); + for ($i=0; $i<$total_invoice_instalment_cycle; $i++) { + $last_day = date('Y-m-d', strtotime('+'.$novalnet_recurring_period_cycle * $i.'months')); + $instalment_date_month[] = date('m', strtotime('+'.$novalnet_recurring_period_cycle * $i.'months')); + if ($current_month_invoice > 12) { + $current_month_invoice = $current_month_invoice - 12; + } + if ($current_month_invoice == $instalment_date_month[$i]) { + $instalment_date_invoice[] = date('Y-m-d', strtotime('+'.$novalnet_recurring_period_cycle * $i.'months')); + } else { + $instalment_date_invoice[] = date('Y-m-d', strtotime($instalment_date_invoice[$i].' last day of previous month' , strtotime ($last_day))); + } + $current_month_invoice = $current_month_invoice + $novalnet_recurring_period_cycle; + } + $instalment_date_invoice = implode('/', $instalment_date_invoice); + return $instalment_date_invoice; + } + + /** + * Get available instalments + * + * @param int $amount + * @param array $total_period + * + * @return $cycles + */ + public static function getInstalmentCycles($amount, $total_period, $currency) { + $i = 0; + foreach ($total_period as $period) { + $cycle_amount = number_format($amount / $period, 2); + if ($cycle_amount >= 9.99) { + $cycle_amount = xtc_format_price_order($cycle_amount, 1, $currency); + $cycles .= ''; + $i++; + } + } + return $cycles; + } + + /** + * Show payment description and test mode notification to the payments + * + * @param $payment_name + * + * @return $payment_description + */ + public static function showPaymentDescription($payment_name) { + //Payment Method description + $payment_description = '
'; + // Add TestMode Label if the payment in Test Mode. + if (constant('MODULE_PAYMENT_'. strtoupper($payment_name) . '_TEST_MODE') == 'true') { + $payment_description .= '
'.MODULE_PAYMENT_NOVALNET_TESTMODE.'
'; + } + $payment_description .= constant('MODULE_PAYMENT_'.strtoupper($payment_name).'_TEXT_INFO'); + if (($payment_name == 'novalnet_cc') && (MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE == 'zero_amount')) { + $payment_description .= defined('MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_TEXT') ? MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_TEXT : ''; + } + $payment_description .= '
'; + return $payment_description; + } + + /** + * Show payment description and SEPA mandate text if the payment use IBAN field to the sepa payments + * + * @param $payment_name + * + * @return $payment_description + */ + public static function showSepaDescription($payment_name){ + $test_mode = ''; + $zeroamount_description = ''; + if (constant('MODULE_PAYMENT_'. strtoupper($payment_name) . '_TEST_MODE') == 'true') { + $test_mode = '
'.MODULE_PAYMENT_NOVALNET_TESTMODE.'
'; + } + if (($payment_name == 'novalnet_sepa') && (MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE == 'zero_amount')) { + $zeroamount_description .= defined('MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_TEXT') ? MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_TEXT : ''; + } + if($_SESSION['language_code'] == 'en'){ + return sprintf( + '
' . $test_mode . ''.MODULE_PAYMENT_NOVALNET_SEPA_DESC.$zeroamount_description.'%s', + $payment_name, + "jQuery('#" . $payment_name . "_about_mandate').toggle('slow')", + '

I hereby grant the mandate for the SEPA direct debit (electronic transmission) and confirm that the given bank details are correct!
', + $payment_name, + '
I authorise (A) Novalnet AG to send instructions to my bank to debit my account and (B) my bank to debit my account in accordance with the instructions from Novalnet AG.', + 'Creditor identifier: DE53ZZZ00000004253', + 'Note:', + 'You are entitled to a refund from your bank under the terms and conditions of your agreement with bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited.
' + ); + }elseif($_SESSION['language_code'] == 'de'){ + return sprintf( + '
'.MODULE_PAYMENT_NOVALNET_SEPA_DESC.$zeroamount_description.'%s', + $payment_name, + "jQuery('#" . $payment_name . "_about_mandate').toggle('slow')", + '

Ich erteile hiermit das SEPA-Lastschriftmandat (elektronische Übermittlung) und bestätige, dass die Bankverbindung korrekt ist!
', + $payment_name, + '
Ich ermächtige den Zahlungsempfänger, Zahlungen von meinem Konto mittels Lastschrift einzuziehen. Zugleich weise ich mein Kreditinstitut an, die von dem Zahlungsempfänger auf mein Konto gezogenen Lastschriften einzulösen.', + 'Gläubiger-Identifikationsnummer: DE53ZZZ00000004253', + 'Hinweis:', + 'Ich kann innerhalb von acht Wochen, beginnend mit dem Belastungsdatum, die Erstattung des belasteten Betrages verlangen. Es gelten dabei die mit meinem Kreditinstitut vereinbarten Bedingungen.
' + ); + } + } + + /** + * Get the order total amount and convert it into minimum unit amount (cents in Euro) + * + * @return int + */ + public static function getOrderAmount($order_amount) { + global $order; + if(($_SESSION['customers_status']['customers_status_show_price_tax'] == '0') && !isset($_SESSION['novalnet']['payment_amount']) && empty($_SESSION['novalnet']['payment_amount'])) { + $order_amount += (round($order->info['tax'], 2)); + } else if(!empty($_SESSION['novalnet']['payment_amount'])) { + $order_amount = $_SESSION['novalnet']['payment_amount']; + } + return (sprintf('%0.2f', $order_amount) * 100); + } + + /** + * Check payment is available for the order amount + * + * @param string $payment_name + * @return boolean + */ + public static function hidePaymentVisibility($payment_name) { + global $order; + $order_amount = self::getOrderAmount($order->info['total']); + $visibility_amount = constant('MODULE_PAYMENT_' . strtoupper($payment_name) . '_VISIBILITY_BY_AMOUNT'); + return ($visibility_amount == '' || (int) $visibility_amount <= (int) $order_amount); + } + + /** + * Get payment request url + * + * @param string $action + * @return string + */ + public static function get_action_endpoint($action) { + $endpoint = 'https://payport.novalnet.de/v2/'; + return $endpoint . str_replace('_', '/', $action); + } + + /** + * Initial Call to get Redirect URL + * + * @param int $order_no Temp order number. + * @param string $payment_name End customer choosen payment name. + * + * @return $response + */ + public static function getRedirectData($order_no, $payment_name) { + $merchant_data = self::getMerchantData(); + $customer_data = self::getCustomerData(); + $transaction_data = self::getTransactionData(); + $custom_data = self::getCustomData(); + $transaction_data['transaction']['payment_type'] = self::getPaymentName($payment_name); + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + $params['transaction']['order_no' ] = $order_no; + $params['transaction']['return_url'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']; + $params['transaction']['error_return_url'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']; + $response = self::sendRequest($params, self::get_action_endpoint('payment')); + return $response; + } + + /** + * Send request to server + * + * @param array $data + * @param string request url + */ + public static function sendRequest($data, $paygate_url) { + $headers = self::getHeadersParam(); + $json_data = json_encode($data); + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $paygate_url); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, $json_data); + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + $result = curl_exec($curl); + if (curl_errno($curl)) { + echo 'Request Error:' . curl_error($curl); + return $result; + } + curl_close($curl); + $result = json_decode($result, true); + return $result; + } + + /** + * Get payment response text + * + * @param array $response + * @param string + */ + public static function getServerResponse($response) { + if (!empty($response['status_desc'])) { + return $response['status_desc']; + } elseif (!empty($response['status_text'])) { + return $response['status_text']; + } elseif (!empty($response['status_message'])) { + return $response['status_message']; + } elseif (!empty($response['result']['status_text'])) { + return $response['result']['status_text']; + } else { + return MODULE_PAYMENT_NOVALNET_TRANSACTION_ERROR; + } + } + + /** + * Get Novalnet transaction details from novalnet table + * + * @param array $order_no + * @return integer + */ + public static function getNovalnetTransDetails($order_no) { + $txn_details = xtc_db_fetch_array(xtc_db_query("SELECT * FROM novalnet_transaction_detail WHERE order_no='" . xtc_db_input($order_no) . "'")); + if(!empty($txn_details['payment_id'])) { + $callback_amounts = xtc_db_fetch_array(xtc_db_query("SELECT sum(callback_amount) AS callback_amounts_total FROM novalnet_callback_history WHERE payment_type NOT IN ('PRZELEWY24_REFUND', 'RETURN_DEBIT_SEPA', 'CREDITCARD_BOOKBACK', 'PAYPAL_BOOKBACK', 'CREDITCARD_CHARGEBACK', 'REFUND_BY_BANK_TRANSFER_EU', 'REVERSAL','CASHPAYMENT_REFUND','GUARANTEED_SEPA_BOOKBACK','GUARANTEED_INVOICE_BOOKBACK','INSTALMENT_SEPA_BOOKBACK','INSTALMENT_INVOICE_BOOKBACK') AND original_tid = " . $txn_details['tid'])); + $txn_details['callback_amount'] = (!empty($txn_details['callback_amount'])) ? ($txn_details['callback_amount'] + $callback_amounts['callback_amounts_total']) : $callback_amounts['callback_total_amount']; + $callback_refund = xtc_db_fetch_array(xtc_db_query("SELECT sum(callback_amount) AS callback_refund_total FROM novalnet_callback_history WHERE payment_type IN ('PRZELEWY24_REFUND', 'RETURN_DEBIT_SEPA', 'CREDITCARD_BOOKBACK', 'PAYPAL_BOOKBACK', 'CREDITCARD_CHARGEBACK', 'REFUND_BY_BANK_TRANSFER_EU', 'REVERSAL','CASHPAYMENT_REFUND','GUARANTEED_SEPA_BOOKBACK','GUARANTEED_INVOICE_BOOKBACK','INSTALMENT_SEPA_BOOKBACK','INSTALMENT_INVOICE_BOOKBACK') AND original_tid = " . $txn_details['tid'])); + $txn_details['refund_amount'] = (!empty($txn_details['refund_amount'])) ? ($txn_details['refund_amount'] + $callback_refund['callback_refund_total']) : $callback_refund['callback_refund_total']; + } + return $txn_details; + } + + /** + * Get merchant data + * + * @return $data + */ + public static function getMerchantData() { + $data = []; + $data['merchant'] = [ + 'signature' => MODULE_PAYMENT_NOVALNET_SIGNATURE, + 'tariff' => MODULE_PAYMENT_NOVALNET_TARIFF_ID, + ]; + return $data; + } + + /** + * Get customer data + * + * @return $data + */ + public static function getCustomerData($receivedData = '') { + global $order; + $data['customer'] = [ + 'gender' => !empty($order->billing['gender']) ? $order->billing['gender'] : 'u', + 'first_name' => (!empty($receivedData) ? $receivedData['order']['billing']['contact']['firstName'] : $order->billing['firstname']), + 'last_name' => (!empty($receivedData) ? $receivedData['order']['billing']['contact']['lastName'] : $order->billing['lastname']), + 'email' => (!empty($receivedData)) ? (($order->info['payment_method'] == 'novalnet_googlepay') ? $receivedData['order']['billing']['contact']['email'] : $receivedData['order']['shipping']['contact']['email']) : $order->customer['email_address'], + 'customer_ip' => self::getIPAddress(), + 'customer_no' => $_SESSION['customer_id'], + 'billing' => [ + 'street' => (!empty($receivedData) ? $receivedData['order']['billing']['contact']['addressLines'] : $order->billing['street_address']), + 'city' => (!empty($receivedData) ? $receivedData['order']['billing']['contact']['locality'] : $order->billing['city']), + 'zip' => (!empty($receivedData) ? $receivedData['order']['billing']['contact']['postalCode'] : $order->billing['postcode']), + 'country_code' => (!empty($receivedData) ? $receivedData['order']['billing']['contact']['countryCode'] : $order->billing['country']['iso_code_2']), + 'search_in_street' => '1', + ], + ]; + if (!empty($order->billing['company'])) { + $data['customer']['billing']['company'] = $order->billing['company']; + } + if (self::isBillingShippingsame()) { + $data['customer']['shipping']['same_as_billing'] = 1; + } else { + $data['customer']['shipping'] = [ + 'street' => (!empty($receivedData) ? $receivedData['order']['shipping']['contact']['addressLines'] : $order->delivery['street_address']), + 'city' => (!empty($receivedData) ? $receivedData['order']['shipping']['contact']['locality'] : $order->delivery['city']), + 'zip' => (!empty($receivedData) ? $receivedData['order']['shipping']['contact']['postalCode'] : $order->delivery['postcode']), + 'country_code' => (!empty($receivedData) ? $receivedData['order']['shipping']['contact']['countryCode'] : $order->delivery['country']['iso_code_2']), + ]; + if (!empty($order->delivery['company'])) { + $data['customer']['shipping']['company'] = $order->delivery['company']; + } + } + return $data; + } + + /** + * Get payment method type for payment request + * + * @param $payment + */ + public static function getPaymentName($payment) { + $payment_title = array( + 'novalnet_applepay' => 'APPLEPAY', + 'novalnet_googlepay' => 'GOOGLEPAY', + 'novalnet_alipay' => 'ALIPAY', + 'novalnet_invoice' => 'INVOICE', + 'novalnet_prepayment' => 'PREPAYMENT', + 'novalnet_sepa' => 'DIRECT_DEBIT_SEPA', + 'novalnet_cc' => 'CREDITCARD', + 'novalnet_cashpayment' => 'CASHPAYMENT', + 'novalnet_ideal' => 'IDEAL', + 'novalnet_wechatpay' => 'WECHATPAY', + 'novalnet_trustly' => 'TRUSTLY', + 'novalnet_online_bank_transfer' => 'ONLINE_BANK_TRANSFER', + 'novalnet_instantbank' => 'ONLINE_TRANSFER', + 'novalnet_giropay' => 'GIROPAY', + 'novalnet_eps' => 'EPS', + 'novalnet_przelewy24' => 'PRZELEWY24', + 'novalnet_paypal' => 'PAYPAL', + 'novalnet_bancontact' => 'BANCONTACT', + 'novalnet_multibanco' => 'MULTIBANCO', + 'novalnet_guarantee_invoice' => 'GUARANTEED_INVOICE', + 'novalnet_guarantee_sepa' => 'GUARANTEED_DIRECT_DEBIT_SEPA', + 'novalnet_postfinance' => 'POSTFINANCE', + 'novalnet_postfinance_card' => 'POSTFINANCE_CARD', + 'novalnet_instalment_invoice' => 'INSTALMENT_INVOICE', + 'novalnet_instalment_sepa' => 'INSTALMENT_DIRECT_DEBIT_SEPA', + ); + return $payment_title[$payment]; + } + + /** + * Get transaction data + * + * @return $data + */ + public static function getTransactionData($receivedData = '') { + global $order, $gx_version; + include DIR_FS_CATALOG . 'release_info.php'; + $amount = (!empty($_SESSION['novalnet']['payment_amount']) && empty($_SESSION['novalnet']['wallet_amount']) ? ($_SESSION['novalnet']['payment_amount'] * 100) : ($_SESSION['novalnet']['wallet_amount'] * 100)); + $data['transaction'] = [ + 'amount' => (!empty($receivedData) ? $receivedData['transaction']['amount'] : (!empty($amount) ? $amount : self::getOrderAmount($order->info['total']))), + 'currency' => $order->info['currency'], + 'test_mode' => constant('MODULE_PAYMENT_'. strtoupper($order->info['payment_class']) . '_TEST_MODE') == 'true' ? 1 : 0, + 'system_name' => 'Gambio', + 'system_version' => $gx_version . '-NN(12.0.3)', + 'system_url' => ((ENABLE_SSL == true) ? HTTPS_SERVER : HTTP_SERVER . DIR_WS_CATALOG), + 'system_ip' => $_SERVER['SERVER_ADDR'], + ]; + return $data; + } + + /** + * Get account like IBAN, BIC etc., + * + * @return $data + */ + public static function getAccountDetails() { + if (!empty($_SESSION['novalnet_sepa_iban'])) { + $data['transaction']['payment_data'] ['iban'] = $_SESSION['novalnet_sepa_iban']; + if(!empty($_SESSION['novalnet_sepa_bic'])) { + $data['transaction']['payment_data'] ['bic'] = $_SESSION['novalnet_sepa_bic']; + } + } + return $data; + } + + /** + * Get Card details like pesudo hash etc., + * + * @return $data + */ + public static function getCardDetails($order_no) { + $data = array(); + if (empty($_SESSION['novalnet_cc_token'])) { + $data['transaction']['payment_data'] = [ + 'pan_hash' => $_SESSION['nn_pan_hash'], + 'unique_id' => $_SESSION['nn_uniqueid'] + ]; + $data['transaction']['enforce_3d'] = (MODULE_PAYMENT_NOVALNET_CC_3D_SECURE_FORCE == 'true') ? 1 : 0; + if(!empty($_SESSION['nn_do_redirect'])) { + $data['transaction']['order_no' ] = $order_no; + $data['transaction']['return_url'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']; + $data['transaction']['error_return_url'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']; + } + } + return $data; + } + + /** + * Get tokenization details + * @param $payment_name + * + * @return $data + */ + public static function getToeknizationDetails($payment_name, &$transaction_data) { + if (constant('MODULE_PAYMENT_'.strtoupper($payment_name).'_TOKENIZATION')=='true') { + if(!empty($_SESSION[$payment_name .'_token'])) { // Reference transaction + $transaction_data['transaction']['payment_data']['token'] = $_SESSION[$payment_name . '_token']; + unset($_SESSION[$payment_name . '_token']); + } elseif(!empty($_SESSION[$payment_name . '_create_token']) && $_SESSION[$payment_name.'_create_token'] == '1') { // New transaction + $transaction_data['transaction']['create_token'] = 1; + unset($_SESSION[$payment_name.'_create_token']); + } + } + } + + /** + * Get request header + */ + public static function getHeadersParam() { + $payment_access_key = MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY; + $encoded_data = base64_encode($payment_access_key); + $headers = [ + 'Content-Type:application/json', + 'Charset:utf-8', + 'Accept:application/json', + 'X-NN-Access-Key:' . $encoded_data + ]; + return $headers; + } + + /** + * Get due date + * @param $days + * + * @return $due_date + */ + public static function getDueDate($days) { + $due_date = date("Y-m-d",strtotime('+'.$days.' days')); + return $due_date; + } + + /** + * Get request custom block data + */ + public static function getCustomData() { + $data = []; + $data['custom'] = [ + 'lang' => (isset($_SESSION['language_code'])) ? strtoupper($_SESSION['language_code']) : 'DE', + ]; + return $data; + } + + /** + * Insert transaction, bank and nearest store details in the database + * @param $order_no + * @param $payment_method + * @param $response + * @param $status_update + * + * @return mixed + */ + public static function updateTransactionDetails($payment_method, $response) { + if ($response['result']['status'] == 'SUCCESS') { + $txn_details = self::getTransactionDetails($response); + // Invoice payments + if((in_array($response['transaction']['payment_type'], array('INVOICE', 'PREPAYMENT'))) + || (in_array($response['transaction']['payment_type'], array('GUARANTEED_INVOICE', 'INSTALMENT_INVOICE')) + && $response['transaction']['status'] != 'PENDING')) { + $txn_details .= self::getBankDetails($response, $orderno = ''); + } + // Cashpayment + if ($response['transaction']['payment_type'] == 'CASHPAYMENT') { + $txn_details .= self::getNearestStoreDetails($response); + } + if (in_array($response['transaction']['payment_type'], array('INSTALMENT_INVOICE', 'INSTALMENT_DIRECT_DEBIT_SEPA')) && (in_array($response['transaction']['status'], array('CONFIRMED', 'ON_HOLD')))) { + $txn_details .= self::formInstalmentPaymentReference($response); + } + return xtc_db_prepare_input($txn_details); + } + } + /** + * Insert transaction, bank and nearest store details in the database + * @param $order_no + * @param $payment_method + * @param $response + * @param $status_update + * + * @return mixed + */ + public static function insertTransactionDetails($order_no, $payment_method, $response, $status_update = true) { + if ($response['result']['status'] == 'SUCCESS') { + $txn_details = self::getTransactionDetails($response); + // Invoice payments + if((in_array($response['transaction']['payment_type'], array('INVOICE', 'PREPAYMENT'))) + || (in_array($response['transaction']['payment_type'], array('GUARANTEED_INVOICE', 'INSTALMENT_INVOICE')) + && $response['transaction']['status'] != 'PENDING')) { + $txn_details .= self::getBankDetails($response, $orderno); + } + // Cashpayment + if ($response['transaction']['payment_type'] == 'CASHPAYMENT') { + $txn_details .= self::getNearestStoreDetails($response); + } + if (in_array($response['transaction']['payment_type'], array('INSTALMENT_INVOICE', 'INSTALMENT_DIRECT_DEBIT_SEPA')) && ($response['transaction']['status'] == 'CONFIRMED')) { + $txn_details .= self::formInstalmentPaymentReference($response); + } + if ($status_update) { + self::updateOrderStatus($order_no, $txn_details, $response , $payment_method); + } else { + return xtc_db_prepare_input($txn_details); + } + } + } + + /** + * Get transaction details + * @param $response + * + * @return $note + */ + public static function getTransactionDetails($response) { + $txn_details = ''; + if (! empty($response ['transaction']['tid'])) { + $txn_details .= PHP_EOL. MODULE_PAYMENT_NOVALNET_TRANSACTION_ID .$response['transaction']['tid']; + $txn_details .= ($response ['transaction']['test_mode'] == 1) ? PHP_EOL. MODULE_PAYMENT_NOVALNET_PAYMENT_MODE : ''; + } + if ($response ['transaction']['amount'] == 0) { + $txn_details .= PHP_EOL. MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_MESSAGE; + } + // Only for Guarantee and instalment payments + if (in_array($response['transaction']['payment_type'], array('GUARANTEED_INVOICE', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'INSTALMENT_INVOICE', 'INSTALMENT_DIRECT_DEBIT_SEPA')) + && $response['transaction']['status'] == 'PENDING') { + $txn_details .= PHP_EOL . MODULE_PAYMENT_NOVALNET_MENTION_GUARANTEE_PAYMENT_PENDING_TEXT.PHP_EOL; + } + // Only for Multibanco + if ($response['transaction']['payment_type'] == 'MULTIBANCO') { + $amount = xtc_format_price_order($response['transaction']['amount']/100, 1, $response['transaction']['currency']); + $txn_details .= PHP_EOL . PHP_EOL . sprintf(MODULE_PAYMENT_NOVALNET_MULTIBANCO_NOTE, $amount); + $txn_details .= PHP_EOL . sprintf(MODULE_PAYMENT_NOVALNET_PARTNER_PAYMENT_REFERENCE, $response['transaction']['partner_payment_reference']) . PHP_EOL; + } + return $txn_details; + } + + /** + * Get Novalnet bank details and its reference + * @param $response + * @param $order_id + * + * @return $bank_details + */ + public static function getBankDetails($response, $orderno = '') { + $note = ''; + $amount = xtc_format_price_order($response['transaction']['amount']/100, 1, $response['transaction']['currency']); + if (!empty($response['instalment']['cycle_amount'])) { + $amount = xtc_format_price_order($response ['instalment']['cycle_amount']/100, 1, $response['transaction']['currency']); + } + if(in_array($response['transaction']['payment_type'], array('INVOICE', 'PREPAYMENT', 'GUARANTEED_INVOICE')) && ($response['transaction']['status'] == 'ON_HOLD')){ + $note .= PHP_EOL .PHP_EOL.sprintf(MODULE_PAYMENT_NOVALNET_AMOUNT_TRANSFER_NOTE, $amount) . PHP_EOL .PHP_EOL; + } + if($response['transaction']['status'] != 'ON_HOLD' && !empty($response['transaction']['due_date'])) { // If due date is not empty + if(in_array($response['transaction']['payment_type'], array('INVOICE', 'PREPAYMENT', 'GUARANTEED_INVOICE'))){ + $note = PHP_EOL .PHP_EOL.sprintf(MODULE_PAYMENT_NOVALNET_AMOUNT_TRANSFER_NOTE_DUE_DATE, $amount, $response['transaction']['due_date']) . PHP_EOL .PHP_EOL; + } + if(!empty($response['instalment']['cycle_amount'])) { // For Instalment payment + $note .= PHP_EOL . PHP_EOL.sprintf(MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_TRANSFER_NOTE_DUE_DATE, $amount, $response ['transaction']['due_date'] ) . PHP_EOL . PHP_EOL; + } + } else if(!empty( $response['instalment']['cycle_amount'] )) { // For Instalment payment + $note .= PHP_EOL . sprintf(MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_TRANSFER_NOTE, $amount) . PHP_EOL . PHP_EOL; + } + $bank_details = array( + 'account_holder' =>PHP_EOL.MODULE_PAYMENT_NOVALNET_ACCOUNT_HOLDER .$response['transaction']['bank_details']['account_holder'], + 'bank_name' =>MODULE_PAYMENT_NOVALNET_BANK_NAME .$response['transaction']['bank_details']['bank_name'], + 'bank_place' =>MODULE_PAYMENT_NOVALNET_BANK_PLACE .$response['transaction']['bank_details']['bank_place'] , + 'iban' =>MODULE_PAYMENT_NOVALNET_IBAN .$response['transaction']['bank_details']['iban'] , + 'bic' =>MODULE_PAYMENT_NOVALNET_BIC .$response['transaction']['bank_details']['bic'] , + ); + foreach ($bank_details as $key => $text) { + if (! empty($response ['transaction']['bank_details'][ $key ])) { + $note .= sprintf($text, $response['transaction']['bank_details'][ $key ]) . PHP_EOL; + } + } + + if(!empty($response['transaction']['order_no'])) { + $note .= PHP_EOL. MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT .PHP_EOL; + $note .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 1, ('TID ' . $response['transaction']['tid'])) . PHP_EOL; + $note .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, ('BNR-' . MODULE_PAYMENT_NOVALNET_PROJECT_ID . '-' . $response['transaction']['order_no'])) . PHP_EOL; + } + return $note; + } + + /** + * Get instalment details to store in Novalnet Transaction details + * + * @param $response + */ + public static function storeInstalmentdetails($response, $total_amount) { + if(empty($response['instalment'])) { + return false; + } + $instalment = $response['instalment']; + $total_cycles = count($instalment['cycle_dates']); + $cycle_amount = $instalment['cycle_amount']; + $last_cycle_amount = $total_amount - ($cycle_amount * ($total_cycles - 1)) ; + $cycles = $instalment['cycle_dates']; + $cycle_details = array(); + foreach($cycles as $cycle => $cycle_date) { + $cycle_details[$cycle -1 ]['date'] = $cycle_date; + if(!empty($cycles[$cycle + 1])) { + $cycle_details[$cycle -1 ]['next_instalment_date'] = $cycles[$cycle + 1]; + } + $cycle_details[$cycle -1 ]['status'] = 'Pending'; + if (!empty($instalment['cycles_executed']) && $cycle == $instalment['cycles_executed']) { + if (isset($instalment['tid']) && !empty($instalment['tid'])) { + $cycle_details[$cycle -1 ]['reference_tid'] = (!empty($instalment['tid']))?$instalment['tid'] : ''; + } else if(isset($response['transaction']['tid']) && !empty($response['transaction']['tid'])) { + $cycle_details[$cycle -1 ]['reference_tid'] = (!empty($response['transaction']['tid']))?$response['transaction']['tid'] : ''; + } + $cycle_details[$cycle -1 ]['status'] = 'Paid'; + $cycle_details[$cycle -1 ]['paid_date'] = date('Y-m-d H:i:s'); + } + $cycle_details[$cycle -1 ]['instalment_cycle_amount'] = ($cycle == $total_cycles)?$last_cycle_amount : $instalment['cycle_amount']; + } + return json_encode($cycle_details); + } + + /** + * Add instalment details in end customer comments + * + * @param $response + */ + public static function formInstalmentPaymentReference($response) { + $txn_details = ''; + $order_total = self::getOrderAmount($_SESSION['novalnet']['payment_amount']); + $total_amount = ($response['transaction']['amount'] < $order_total) ? $order_total : $response['transaction']['amount']; + $instalment_cycle_details = json_decode(self::storeInstalmentdetails($response, $total_amount), true); + if (!empty($response['instalment']['currency'])) { + $amount = xtc_format_price_order($instalment_cycle_details['1']['instalment_cycle_amount']/100, 1, $response['instalment']['currency']); + } else if (!isset($response['instalment']['currency'])) { + $amount = xtc_format_price_order($instalment_cycle_details['1']['instalment_cycle_amount']/100, 1, $response['transaction']['currency']); + } + if ($response['result']['status'] == 'SUCCESS') { + if ($response['transaction']['payment_type'] == 'INSTALMENT_INVOICE' && (in_array($response['transaction']['status'], array('CONFIRMED', 'ON_HOLD')))){ + $txn_details .= PHP_EOL. MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT .PHP_EOL; + $txn_details .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 1, ('TID ' . $response['transaction']['tid'])) . PHP_EOL; + if (!empty($response['transaction']['invoice_ref'])) { + $txn_details .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, $response['transaction']['invoice_ref']) . PHP_EOL; + } elseif(!empty($response['transaction']['order_no'])) { + $txn_details .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, ('BNR-' . MODULE_PAYMENT_NOVALNET_PROJECT_ID . '-' . $response['transaction']['order_no'])) . PHP_EOL; + } else { + $txn_details .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, ('BNR-' . MODULE_PAYMENT_NOVALNET_PROJECT_ID . '-###SHOPORDERNUMBER###')) . PHP_EOL; + } + } + if (in_array($response['transaction']['payment_type'], array('INSTALMENT_INVOICE', 'INSTALMENT_DIRECT_DEBIT_SEPA')) && $response['transaction']['status'] == 'CONFIRMED') { + $txn_details .= PHP_EOL.PHP_EOL.MODULE_PAYMENT_NOVALNET_INSTALMENT_INSTALMENTS_INFO.PHP_EOL.MODULE_PAYMENT_NOVALNET_INSTALMENT_PROCESSED_INSTALMENTS.$response['instalment']['cycles_executed'] . PHP_EOL; + $txn_details .= MODULE_PAYMENT_NOVALNET_INSTALMENT_DUE_INSTALMENTS.$response['instalment']['pending_cycles']. PHP_EOL; + $txn_details .= MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_INSTALMENT_AMOUNT.$amount. PHP_EOL; + if(!empty($response['instalment']['next_cycle_date'])) { + $txn_details .= MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_INSTALMENT_DATE. date('Y-m-d', strtotime($response['instalment']['next_cycle_date'])). PHP_EOL; + } + } + } + return $txn_details; + } + + /** + * Get nearest Cashpayment supported stores + * @param $response + * + * @return $txn_details + */ + public static function getNearestStoreDetails($response) { + $txn_details = ''; + $length = count($response['transaction']['nearest_stores']); + if (! empty($response['transaction']['due_date'])) { + $txn_details .= PHP_EOL . PHP_EOL.MODULE_PAYMENT_NOVALNET_TRANS_SLIP_EXPIRY_DATE .date(DATE_FORMAT,strtotime($response['transaction']['due_date'])); + } + $txn_details .= PHP_EOL . PHP_EOL .MODULE_PAYMENT_NOVALNET_NEAREST_STORE_DETAILS . PHP_EOL ; + if (!empty($response['transaction']['nearest_stores'])) { + for($i=1; $i <= $length; $i++) { + $country_name = xtc_db_fetch_array(xtc_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_iso_code_2 = '" . $response['transaction']['nearest_stores'][$i]['country_code'] . "'")); + $txn_details .= PHP_EOL . $response['transaction']['nearest_stores'][$i]['city']; + $txn_details .= PHP_EOL . $country_name['countries_name']; + $txn_details .= PHP_EOL . $response['transaction']['nearest_stores'][$i]['store_name']; + $txn_details .= PHP_EOL . $response['transaction']['nearest_stores'][$i]['street']; + $txn_details .= PHP_EOL . $response['transaction']['nearest_stores'][$i]['zip']; + $txn_details .= PHP_EOL . PHP_EOL; + } + } + return $txn_details; + } + + /** + * Get shop order status id + * + * @param $transaction_status + * @param $payment_method + * + * @return $order_status_id + */ + public static function getOrderStatus($transaction_status, $payment_method) { + if (($transaction_status == 'PENDING') && in_array($payment_method, array('novalnet_invoice', 'novalnet_prepayment', 'novalnet_cashpayment', 'novalnet_multibanco'))) { + $order_status_id = constant('MODULE_PAYMENT_' . strtoupper($payment_method) . '_ORDER_STATUS'); + }elseif ($transaction_status == 'PENDING'){ + $order_status_id = 1; + } elseif ($transaction_status == 'CONFIRMED') { + $order_status_id = constant('MODULE_PAYMENT_' . strtoupper($payment_method) . '_ORDER_STATUS'); + } elseif ($transaction_status == 'ON_HOLD') { + $order_status_id = MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE; + } + return $order_status_id; + } + + /** + * Update order status and insert the transaction details in the database + * @param $order_id + * @param $txn_details + * @param $response + * @param $payment_method + * + * @return mixed + */ + public static function updateOrderStatus($order_id, $txn_details, $response, $payment_method) { + global $order; + if(empty($order) && !empty($order_id)) { + $order = new order($order_id); + } + + $customerId = $order->customer['ID']; + if(empty($order->customer['ID'])) + { + $customerId = $order->customer['csID']; + } + $customerId = !empty($response['customer']['customer_no']) ? $response['customer']['customer_no'] : $customerId; + + $payment_status = []; + $status_update = []; + $payment_status['orders_status'] = $status_update['orders_status_id'] = self::getOrderStatus($response['transaction']['status'], $payment_method); + $order->info['comments'] = $txn_details; + $payment_status['comments'] = $status_update['comments'] = xtc_db_prepare_input($order->info['comments']); + $novalnet_transaction_details = array( + 'order_no' => $order_id, + 'tid' => $response['transaction']['tid'], + 'amount' => $response['transaction']['amount'], + 'currency' => $response['transaction']['currency'], + 'customer_id' => $customerId, + 'payment_type' => $response['transaction']['payment_type'], + 'test_mode' => $response['transaction']['test_mode'], + 'status' => $response['transaction']['status'], + ); + if (in_array($response['transaction']['payment_type'], array('INSTALMENT_INVOICE', 'INSTALMENT_DIRECT_DEBIT_SEPA')) + && ($response['transaction']['status'] == 'CONFIRMED')) { + $order_total = self::getOrderAmount($_SESSION['novalnet']['payment_amount']); + $total_amount = ($response['transaction']['amount'] < $order_total) ? $order_total : $response['transaction']['amount']; + $novalnet_transaction_details['instalment_cycle_details'] = self::storeInstalmentdetails($response, $total_amount); + } + if (in_array($response['transaction']['payment_type'], array('INVOICE', 'PREPAYMENT', 'GUARANTEED_INVOICE', 'INSTALMENT_INVOICE'))) { + $payment_details = $response['transaction']['bank_details']; + $payment_details['novalnet_due_date'] = $response['transaction']['due_date']; + $novalnet_transaction_details['payment_details'] = json_encode($payment_details); + } elseif ($response['transaction']['payment_type'] === 'CASHPAYMENT') { + $payment_details = $response['transaction']['nearest_stores']; + $payment_details['novalnet_due_date'] = $response['transaction']['due_date']; + $novalnet_transaction_details['payment_details'] = json_encode($payment_details); + } elseif (!empty($response['transaction']['payment_data']['token']) && constant('MODULE_PAYMENT_'. strtoupper($payment_method) . '_TOKENIZATION') == 'true') { + $payment_data = $response['transaction']['payment_data']; + $check_duplicate_token = true; + if (empty($response['custom']['inputval1'])) { + $check_duplicate_token = false; + $payment_data = array( + 'token' => $payment_data['token'] + ); + } + if (constant('MODULE_PAYMENT_'. strtoupper($payment_method) . '_AUTHENTICATE') == 'zero_amount') { + $payment_data['zero_amount_booking'] = 1; + } + $novalnet_transaction_details['payment_details'] = json_encode($payment_data); + + // Delete duplicate tokens in novalnet table + if(in_array($response['transaction']['payment_type'], array('DIRECT_DEBIT_SEPA', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'INSTALMENT_DIRECT_DEBIT_SEPA', 'CREDITCARD')) && $check_duplicate_token){ + self::checkDuplicateToken($customerId, $response); + } + } elseif (!empty($response['transaction']['payment_data']['token']) && constant('MODULE_PAYMENT_'. strtoupper($payment_method) . '_AUTHENTICATE') == 'zero_amount' && constant('MODULE_PAYMENT_'. strtoupper($payment_method) . '_TOKENIZATION') == 'false') { + $cardDetails = array( + 'token' => $response['transaction']['payment_data']['token'], + 'zero_amount_booking' => 1 + ); + $novalnet_transaction_details['payment_details'] = json_encode($cardDetails); + } + xtc_db_perform('novalnet_transaction_detail', $novalnet_transaction_details, 'insert'); + xtc_db_perform(TABLE_ORDERS, $payment_status, "update", "orders_id='$order_id'"); + xtc_db_perform(TABLE_ORDERS_STATUS_HISTORY, $status_update, "update", "orders_id='$order_id'"); + } + + /** + * Check duplicate token in novalnet table and update it + * @param $customerId + * @param $response + * + * @return none + */ + public static function checkDuplicateToken($customerId, $response) { + $check_string = 'No Data'; + if(empty($response['transaction']['payment_data'])) { + return true; + } + if (in_array($response['transaction']['payment_type'], array('DIRECT_DEBIT_SEPA', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'INSTALMENT_DIRECT_DEBIT_SEPA'))) { + $payment_details = xtc_db_query("SELECT payment_details, id, amount, order_no FROM novalnet_transaction_detail WHERE customer_id='" . xtc_db_input($customerId) . "' AND payment_details !='' AND status = 'CONFIRMED' AND payment_type in ('DIRECT_DEBIT_SEPA', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'INSTALMENT_DIRECT_DEBIT_SEPA')"); + $check_string = (!empty($response['transaction']['payment_data']['iban'])) ? $response['transaction']['payment_data']['iban'] : $check_string; + $check_data_payment = "SEPA"; + } elseif($response['transaction']['payment_type'] == 'CREDITCARD') { + $payment_details = xtc_db_query("SELECT payment_details, id, amount, order_no FROM novalnet_transaction_detail WHERE customer_id='" . xtc_db_input($customerId) . "' AND payment_details !='' AND status = 'CONFIRMED' AND payment_type = '{$response['transaction']['payment_type']}'"); + $check_value = $response['transaction']['payment_data']; + $check_string = $check_value['card_brand'] . $check_value['card_number'] . $check_value['card_expiry_month'] . $check_value['card_expiry_year']; + $check_data_payment = "CARD"; + } + if($check_string == 'No Data' || empty($check_string)) { + return true; + } + while ($payment_detail = xtc_db_fetch_array($payment_details)) { + $payment_data = json_decode($payment_detail['payment_details'], true); + $cardDetails = ""; + if ($payment_detail['amount'] <= 0 && !empty($payment_data['zero_amount_booking']) && $payment_data['zero_amount_booking'] == 1) { + $cardDetails = array( + 'token' => $payment_data['token'], + 'zero_amount_booking' => $payment_data['zero_amount_booking'] + ); + $cardDetails = json_encode($cardDetails); + } + if($check_data_payment == "CARD") { + $check_data = $payment_data['card_brand'] . $payment_data['card_number'] . $payment_data['card_expiry_month'] . $payment_data['card_expiry_year']; + }else if($check_data_payment == "SEPA"){ + $check_data = $payment_data['iban']; + } + if(($check_string == $check_data) && !empty($payment_detail['id'])) { + $payment_details = xtc_db_query("UPDATE novalnet_transaction_detail SET payment_details = '$cardDetails' WHERE id = {$payment_detail['id']} AND order_no = {$payment_detail['order_no']} AND customer_id = {$customerId}"); + } + } + } + + /** + * Hadnle temporary created order for the failure transaction + * + * @param string $payment_method + * @param int $order_id + * @param array $response + * @param string $error_text + * + * @return none + */ + public static function processTempOrderFail($payment_method, $order_id, $response, $error_text = '') { + if (!empty($order_id)) { + $status_text = self::getServerResponse($response); + $status_text = (!empty($status_text)) ? $status_text : $error_text; + self::updateTempOrderFail($order_id, $response['tid'], $status_text); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $payment_method . '&error=' . urlencode($status_text), 'SSL', true, false)); + } + } + + /** + * Update order status for the temporary created order. + * + * @param int $order_id + * @param bigint $tid + * @param string $status_text + */ + public static function updateTempOrderFail($order_id, $tid, $status_text) { + $note = ''; + $note = (!empty($tid)) ? PHP_EOL . MODULE_PAYMENT_NOVALNET_TRANSACTION_ID . $tid . PHP_EOL : ''; + $note .= $status_text; + xtc_db_query('UPDATE '.TABLE_ORDERS.' SET orders_status = '.MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED.', comments = "'.xtc_db_prepare_input($note).'" WHERE orders_id= '.$order_id); + xtc_db_query('UPDATE ' . TABLE_ORDERS_STATUS_HISTORY . ' SET orders_status_id = ' . MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED . ', comments = "'.xtc_db_prepare_input($note).'" WHERE orders_id='.$order_id); + } + + /** + * Handle redirect payments success response + * @param $request + * @param $session_order_id + * @param $payment_code + * + * @return none + * */ + public static function handleRedirectSuccessResponse($request, $session_order_id, $payment_code) { + global $order; + if(empty($order) && !empty($session_order_id)) { + $order = new order($session_order_id); + } + $transaction_details = array('transaction' =>array('tid' => $request['tid'])); + $action = self::get_action_endpoint('transaction_details'); + $response = self::sendRequest($transaction_details, $action); + $order_no = (!empty($response['transaction']['order_no'])) ? $response['transaction']['order_no'] : $session_order_id; + $order->info['comments'] .= self::updateTransactionDetails($payment_code, $response); + if(!empty($order_no)) { + self::updateOrderStatus($order_no, $order->info['comments'], $response, $payment_code); + } + } + + /** + * Send transaction update call to update order_no in Novalnet + * @param $order_no + * + * @return none + */ + public static function sendTransactionUpdate($order_no) { + $transaction_param = [ + 'transaction' => [ + 'tid' => $_SESSION['response']['transaction']['tid'], + 'order_no' => $order_no, + ], + ]; + $params = array_merge($transaction_param, self::getCustomData()); + self::sendRequest($params, self::get_action_endpoint('transaction_update')); + if (isset($_SESSION['response'])) { + unset($_SESSION['response']); + } + } + + /** + * Validate response checksum + * + * @param $data + * + * @return boolean + */ + public static function validateCheckSum($data) { + $payment_access_key = MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY; + if (!empty($data['checksum']) && !empty($data['tid']) && !empty($data['status']) && !empty($_SESSION['nn_txn_secret']) && !empty($payment_access_key)) { + $checksum = hash('sha256', $data['tid'] . $_SESSION['nn_txn_secret'] . $data['status'] . strrev($payment_access_key)); + if ($checksum == $data['checksum']) { + return true; + } + } + return false; + } + + /** + * Check for the success status of the + * Novalnet payment call. + * + * @param $data. + * + * @return boolean + */ + public static function is_success_status( $data ) { + return ( ( ! empty( $data['result']['status'] ) && 'SUCCESS' === $data['result']['status'] ) || ( ! empty( $data['status'] ) && 'SUCCESS' === $data['status'] ) ); + } + + /** + * To form guarantee payment order confirmation mail + * + * @param $datas array + */ + public static function sendOrderUpdateMail($datas,$db_details = ''){ + if($db_details == ''){ + $order = new order($datas['order_no']); + $customername = $order->customer['firstname'].' '.$order->customer['lastname']; + $customeremail = $order->customer['email_address']; + }else { + $customer_dbvalue = xtc_db_fetch_array(xtc_db_query("SELECT customers_firstname,customers_lastname,customers_email_address FROM " . TABLE_CUSTOMERS . " WHERE customers_id= ". xtc_db_input($db_details['customer_id']) ." ORDER BY customers_id DESC LIMIT 1")); + $customername = $customer_dbvalue['customers_firstname'].$customer_dbvalue['customers_lastname']; + $customeremail = $customer_dbvalue['customers_email_address']; + } + $subject = sprintf(MODULE_PAYMENT_GUARANTEE_PAYMENT_MAIL_SUBJECT,$datas['order_no'],STORE_NAME); + $get_mail_content = NovalnetHelper::get_mail_content_array_novalnet($datas['comments'],$datas); + $html_mail= $get_mail_content['smarty']->fetch(DIR_FS_CATALOG.'lang/'.$get_mail_content['lang'].'/original_mail_templates/order_mail.html'); + $txt_mail= $get_mail_content['smarty']->fetch(DIR_FS_CATALOG.'lang/'.$get_mail_content['lang'].'/original_mail_templates/order_mail.txt'); + xtc_php_mail(EMAIL_FROM, STORE_NAME, $customeremail, STORE_OWNER, '', '', '', '', '', $subject, $html_mail, $txt_mail); + } + + /** + * To form mail templete as like default mail + * + * @param $data array + */ + + public static function get_mail_content_array_novalnet($comments,$data) { + $smarty = new Smarty; + if(empty($data['order'])){ + $t_order = new order($data['order_no']); + }else{ + $t_order = $data['order']; + } + $order_lang = xtc_db_fetch_array(xtc_db_query("SELECT currency,language FROM ".TABLE_ORDERS." WHERE orders_id='". xtc_db_input($data['order_no']) ."'")); + $mail_lang_set = xtc_db_fetch_array(xtc_db_query("SELECT code FROM ".TABLE_LANGUAGES." WHERE directory='". xtc_db_input($order_lang['language']) ."'")); + + $t_order_id = $data['order_no']; + $t_language = $order_lang['language']; + $t_language_id = $mail_lang_set['code']; + // SET CONTENT DATA + $smarty->assign('csID', $t_order->customer['csID']); + $smarty->assign('customer_vat', $t_order->customer['vat_id']); + $smarty->assign('order_data', NovalnetHelper::getOrderData($t_order_id,$order_lang['currency'])); + $t_order_total = NovalnetHelper::getTotalData($t_order_id); + $smarty->assign('order_total', $t_order_total['data']); + $smarty->assign('language', $t_language); + $smarty->assign('language_id', $t_language_id); + $smarty->assign('tpl_path', DIR_FS_CATALOG . StaticGXCoreLoader::getThemeControl()->getThemeHtmlPath()); + $smarty->assign('logo_path', + HTTP_SERVER . DIR_WS_CATALOG . StaticGXCoreLoader::getThemeControl() + ->getThemeImagePath()); + $smarty->assign('oID', $t_order_id); + $t_payment_method = ''; + if ($t_order->info['payment_method'] != '' && $t_order->info['payment_method'] != 'no_payment') { + $t_payment_method = PaymentTitleProvider::getStrippedTagsTitle($t_order->info['payment_method']); + $smarty->assign('PAYMENT_MODUL', $t_order->info['payment_method']); + } + $smarty->assign('PAYMENT_METHOD', $t_payment_method); + $smarty->assign('NAME', $t_order->customer['name']); + $smarty->assign('GENDER', $t_order->customer['gender']); + $smarty->assign('COMMENTS', nl2br($comments)); + $smarty->assign('EMAIL', $t_order->customer['email_address']); + $smarty->assign('PHONE', $t_order->customer['telephone']); + if (defined('EMAIL_SIGNATURE')) { + $smarty->assign('EMAIL_SIGNATURE_HTML', nl2br(EMAIL_SIGNATURE)); + $smarty->assign('EMAIL_SIGNATURE_TEXT', EMAIL_SIGNATURE); + } + // PREPARE HTML MAIL + $smarty->assign('address_label_customer', xtc_address_format($t_order->customer['format_id'],$t_order->customer, 1, '', '
')); + $smarty->assign('address_label_shipping', xtc_address_format($t_order->delivery['format_id'], $t_order->delivery, 1,'','
')); + $smarty->assign('address_label_payment', xtc_address_format($t_order->billing['format_id'], $t_order->billing , 1, '', '
')); + return array( 'lang' => $t_language ,'smarty' => $smarty); + } + + public static function getOrderData($oID,$currency){ + require_once(DIR_FS_INC . 'xtc_get_attributes_model.inc.php'); + + $order_query = "SELECT + op.products_id, + op.orders_products_id, + op.products_model, + op.products_name, + op.checkout_information, + op.final_price, + op.products_shipping_time, + op.products_quantity, + opqu.quantity_unit_id, + opqu.unit_name + FROM " . TABLE_ORDERS_PRODUCTS . " op + LEFT JOIN orders_products_quantity_units opqu USING (orders_products_id) + WHERE op.orders_id = '" . (int)$oID . "'"; + $order_data = array(); + $order_query = xtc_db_query($order_query); + while($order_data_values = xtc_db_fetch_array($order_query)) + { + $attributes_query = "SELECT + products_options, + products_options_values, + price_prefix, + options_values_price + FROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " + WHERE orders_products_id='" . $order_data_values['orders_products_id'] . "' + AND orders_id='" . (int)$oID . "'"; + $attributes_data = ''; + $attributes_model = ''; + $attributes_query = xtc_db_query($attributes_query); + + while($attributes_data_values = xtc_db_fetch_array($attributes_query)) + { + $attributes_data .= '
' . $attributes_data_values['products_options'] . ':' . $attributes_data_values['products_options_values']; + $attributes_model .= '
' . xtc_get_attributes_model($order_data_values['products_id'], $attributes_data_values['products_options_values'], $attributes_data_values['products_options']); + } + + // properties + $coo_properties_control = MainFactory::create_object('PropertiesControl'); + $t_properties_array = $coo_properties_control->get_orders_products_properties($order_data_values['orders_products_id']); + + if(ACTIVATE_SHIPPING_STATUS == 'true') + { + $shipping_time = $order_data_values['products_shipping_time']; + } + else + { + $shipping_time = ''; + } + + // BOF GM_MOD GX-Customizer + require(DIR_FS_CATALOG . 'gm/modules/gm_gprint_order.php'); + + $order_data[] = array('PRODUCTS_MODEL' => $order_data_values['products_model'], + 'PRODUCTS_NAME' => $order_data_values['products_name'], + 'CHECKOUT_INFORMATION' => $order_data_values['checkout_information'], + 'CHECKOUT_INFORMATION_TEXT' => html_entity_decode_wrapper(strip_tags($order_data_values['checkout_information'])), + 'PRODUCTS_SHIPPING_TIME' => $shipping_time, + 'PRODUCTS_ATTRIBUTES' => $attributes_data, + 'PRODUCTS_ATTRIBUTES_MODEL' => $attributes_model, + 'PRODUCTS_PROPERTIES' => $t_properties_array, + 'PRODUCTS_PRICE' => xtc_format_price_order($order_data_values['final_price'], 1, $currency), + 'PRODUCTS_SINGLE_PRICE' => xtc_format_price_order($order_data_values['final_price'] / $order_data_values['products_quantity'], 1, $currency), + 'PRODUCTS_QTY' => gm_prepare_number($order_data_values['products_quantity'], ','), + 'UNIT' => $order_data_values['unit_name']); + } + + return $order_data; + } + + /** + * Get total data + * + * @param $oID + * + * @return array + */ + public static function getTotalData($oID){ + // get order_total data + $oder_total_query = "SELECT + title, + text, + class, + value, + sort_order + FROM " . TABLE_ORDERS_TOTAL . " + WHERE orders_id='" . (int)$oID . "' + ORDER BY sort_order ASC"; + + $order_total = array(); + $oder_total_query = xtc_db_query($oder_total_query); + while($oder_total_values = xtc_db_fetch_array($oder_total_query)) + { + $order_total[] = array('TITLE' => $oder_total_values['title'], + 'CLASS' => $oder_total_values['class'], + 'VALUE' => $oder_total_values['value'], + 'TEXT' => $oder_total_values['text']); + + if($oder_total_values['class'] == 'ot_total') + { + $total = $oder_total_values['value']; + } + } + + return array('data' => $order_total, 'total' => $total); + } + + + /** + * Validate customer date or birth + * + * @param $dob + * + * @return $error_message + */ + public static function dateOfBirth($dob) { + $error_message = ''; + if (time() < strtotime('+18 years', strtotime($dob))) { + $error_message = MODULE_PAYMENT_GUARANTEE_PAYMENT_AGE_ERROR_MESSAGE; + return $error_message; + } + } + + /** + * Validate customer email + * + * @param $emails + * + * @return boolean + */ + public static function validateEmail($emails) { + $email = explode(',', $emails); + foreach ($email as $value) { + // Validate E-mail. + if (!xtc_validate_email($value)) { + return false; + } + } + return $value; + } + + /** + * Get customer details + * + * @param $customer_email + * + * @return array + */ + public static function collectCustomerDobGenderFax($customer_email = '') { + if ($customer_email != '') { + $querySearch = (isset($_SESSION['customer_id']) && $_SESSION['customers_status']['customers_status_id'] != '1') ? 'customers_id= "'. xtc_db_input($_SESSION['customer_id']).'"' : 'customers_email_address= "'. xtc_db_input($customer_email).'"'; + $select_query = xtc_db_query("SELECT customers_id, customers_cid, customers_gender, customers_dob, customers_fax, customers_vat_id FROM ". TABLE_CUSTOMERS . " WHERE ".$querySearch." ORDER BY customers_id"); + $customer_dbvalue = xtc_db_fetch_array($select_query); + if (!empty($customer_dbvalue)) { + $customer_dbvalue['customers_dob'] = (($customer_dbvalue['customers_dob'] != '0000-00-00 00:00:00') && ($customer_dbvalue['customers_dob'] )) ? date('d.m.Y', strtotime($customer_dbvalue['customers_dob'])) : ''; + if($customer_dbvalue['customers_dob']) { + $year = substr($customer_dbvalue['customers_dob'], -4); + if($year < '1900') { + return ''; + } + } + return $customer_dbvalue; + } + } + + return array('u', '', '', '', ''); + } + + /** + * Create date of birth field + * + * @param $name + * @param $customer_details + * + * @return string + */ + public static function getGuaranteeField($name, $customer_details) { + $placeholder = MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_FORMAT; + return xtc_draw_input_field($name, (isset($customer_details['customers_dob']) ? $customer_details['customers_dob'] : ''), 'id="'.$name.'" placeholder="'.$placeholder.'" autocomplete="OFF" maxlength="10" onkeydown="return NovalnetUtility.isNumericBirthdate(this,event)"').xtc_draw_hidden_field('', $_SESSION['language_code'], 'id="nn_shop_lang"'); + } + + /** + * Check billing and shpping address is same + * + * @return boolean + */ + public static function isBillingShippingsame() { + global $order; + $delivery_address = array( + 'street' => ($order->delivery['street_address']), + 'city' => ( $order->delivery['city']), + 'postcode' => ( $order->delivery['postcode']), + 'country' => ($order->delivery['country']['iso_code_2']), + ); + $billing_address = array( + 'street' => ($order->billing['street_address']), + 'city' => ($order->billing['city']), + 'postcode' => ($order->billing['postcode']), + 'country' => ($order->billing['country']['iso_code_2']), + ); + return ($delivery_address === $billing_address); + } + + /** + * Check guarantee payments allowed countries for B2B and B2C + * + * @param $country + * @param $is_b2b + * @param $company + * + * @return $is_valid + */ + public static function checkGuaranteeCountries($country, $is_b2b, $company) { + $listOfAllCountriesInEU = [ + 'AT', // Österreich + 'BE', // Belgien + 'BG', // Bulgarien + 'CY', // Zypern + 'CZ', // Tschechische Republik + 'CH', // Schweiz + 'DE', // Deutschland + 'DK', // Dänemark + 'EE', // Estland + 'ES', // Spanien + 'FI', // Finnland + 'FR', // Frankreich + 'GR', // Griechenland + 'HR', // Kroatien + 'HU', // Ungarn + 'IE', // Irland + 'IT', // Italien + 'LT', // Litauen + 'LU', // Luxemburg + 'LV', // Lettland + 'MT', // Malta + 'NL', // Niederlande + 'PL', // Polen + 'PT', // Portugal + 'RO', // Rumänien + 'SE', // Schweden + 'SI', // Slowenien + 'SK', // Slowakei + 'XI', // Nordirland + ]; + $listOfDachCountries = [ + 'AT', // Österreich + 'CH', // Schweiz + 'DE', // Deutschland + ]; + $is_valid =(!empty($company) && $is_b2b == 'true') ? in_array($country, $listOfAllCountriesInEU, true) : in_array($country,$listOfDachCountries, true); + return $is_valid; + } + + /** + * Get customer IP address + * + * @return string + */ + public static function getIPAddress() { + $ip_keys = [ 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ]; + foreach ($ip_keys as $key) { + if (array_key_exists($key, $_SERVER) === true) { + foreach (explode(',', $_SERVER[$key]) as $ip) { + $ip = trim($ip); + if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === true) { + return $ip; + } + } + } + } + return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : false; + } + + /** + * Includes the support scripts in payment configuration page + * + * @param $paymentCode + * @param $authorize + */ + public static function includeAdminJS($paymentCode, $authorize = false) { + if ($_GET['module'] == $paymentCode && $_GET['action'] == 'edit') { + echo ''; + if ($authorize) { + $auth =constant('MODULE_PAYMENT_'. strtoupper($paymentCode) . '_AUTHENTICATE'); + $elementID = $paymentCode . '_auth'; + echo ''; + } + } + } + + /** + * Get customer data + * + * @return $data + */ + public static function getCustomerWalletData($receivedData = '') { + global $order; + $data['customer'] = [ + 'gender' => !empty($order->billing['gender']) ? $order->billing['gender'] : 'u', + 'first_name' => (!empty($receivedData) ? $receivedData['order']['billing']['contact']['firstName'] : $order->billing['firstname']), + 'last_name' => (!empty($receivedData) ? $receivedData['order']['billing']['contact']['lastName'] : $order->billing['lastname']), + 'email' => (!empty($receivedData) ? (($order->info['payment_method'] == 'novalnet_googlepay') ? $receivedData['order']['billing']['contact']['email'] : $receivedData['order']['shipping']['contact']['email']) : $order->customer['email_address']), + 'customer_ip' => self::getIPAddress(), + 'customer_no' => $_SESSION['customer_id'], + 'billing' => [ + 'street' => (!empty($receivedData) ? $receivedData['order']['billing']['contact']['addressLines'] : $order->billing['street_address']), + 'city' => (!empty($receivedData) ? $receivedData['order']['billing']['contact']['locality'] : $order->billing['city']), + 'zip' => (!empty($receivedData) ? $receivedData['order']['billing']['contact']['postalCode'] : $order->billing['postcode']), + 'country_code' => (!empty($receivedData) ? $receivedData['order']['billing']['contact']['countryCode'] : $order->billing['country']['iso_code_2']), + 'search_in_street' => '1', + ], + ]; + if (!empty($order->billing['company'])) { + $data['customer']['billing']['company'] = $order->billing['company']; + } + if (self::isBillingShippingsame()) { + $data['customer']['shipping']['same_as_billing'] = 1; + } else if (!empty($receivedData['order']['shipping'])) { + $data['customer']['shipping'] = [ + 'street' => (!empty($receivedData) ? $receivedData['order']['shipping']['contact']['addressLines'] : $order->delivery['street_address']), + 'city' => (!empty($receivedData) ? $receivedData['order']['shipping']['contact']['locality'] : $order->delivery['city']), + 'zip' => (!empty($receivedData) ? $receivedData['order']['shipping']['contact']['postalCode'] : $order->delivery['postcode']), + 'country_code' => (!empty($receivedData) ? $receivedData['order']['shipping']['contact']['countryCode'] : $order->delivery['country']['iso_code_2']), + ]; + if (!empty($order->delivery['company'])) { + $data['customer']['shipping']['company'] = $order->delivery['company']; + } + } + return $data; + } +} + +?> diff --git a/ext/novalnet/css/novalnet.css b/ext/novalnet/css/novalnet.css new file mode 100644 index 0000000..bf96ab4 --- /dev/null +++ b/ext/novalnet/css/novalnet.css @@ -0,0 +1,97 @@ +/** + * Novalnet payment module + * + * This script is used for Novalnet CSS adjustment + * + * @author Novalnet AG + * @copyright Copyright (c) Novalnet + * @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz + * @link https://www.novalnet.de + * + * Script: novalnet.css + */ +.novalnet-test-mode { + position: relative; + background-color: #0080c9; + color: #fff; + padding: 10px 20px; + margin-bottom: 8px; + font-size: 10px; + text-align: center; + text-transform: uppercase; + letter-spacing: 1px; + line-height: 0.8px; + border-radius: 0px 0px 5px 5px; + transition: transform 0.5s ease 0.5s; + animation: novalnet-test-mode-blinker 2s cubic-bezier(0.42, 0, 0.65, 0.99) infinite; + font-weight: bold; + float:right; +} +.novalnet-info-box { + position: relative; + width: 95%; + height: auto; + background: content-box; + font-size: 14px; + color: #333; + margin: 20px 0px; + padding: 1em; + border-left: 5px solid #0080c9; + box-shadow: 0 0 8px 0px rgb(0 0 0 / 40%); +} +@keyframes novalnet-test-mode-blinker { + 50% { + opacity: 0; + } +} +.info { + padding:1em 1em 1em 1.5em!important; +} +.info::before{ + display:none !important; +} +.novalnet-display-none { + display:none; +} +.novalnet-info-box ul { + margin: 0 20px 0px 20px; + padding: 0; +} +.novalnet-info-box li { + list-style: disc !important; +} +.novalnet-info-box li:before { + display:block !important; +} +a::after { + box-sizing: border-box; +} +table#novalnet_instalment_table_invoice , table#novalnet_instalment_table_sepa { + padding : 10px; + font-family: arial, sans-serif; + border-collapse: collapse; + width: 100%; +} +table#novalnet_instalment_table_invoice td,table#novalnet_instalment_table_sepa td, table#novalnet_instalment_table_invoice th,table#novalnet_instalment_table_sepa th { + border: 1px solid #dddddd; + text-align: left; + padding: 8px; +} +table#novalnet_instalment_table_invoice tr:nth-child(even),table#novalnet_instalment_table_sepa tr:nth-child(even) { + background-color: #dddddd; +} +.novalnet_cc img, .novalnet_online_bank_transfer img { + max-width: 60% !important; + height: 25px !important; +} +#nn_refund { + width: 100%; + height: 100%; + background: #4E9CAF; + padding: 10px; + text-align: center; + border-radius: 5px; + color: white; + font-weight: bold; + line-height: 25px; +} diff --git a/ext/novalnet/install/db_12.sql b/ext/novalnet/install/db_12.sql new file mode 100644 index 0000000..e74895a --- /dev/null +++ b/ext/novalnet/install/db_12.sql @@ -0,0 +1,16 @@ +CREATE TABLE IF NOT EXISTS novalnet_transaction_details ( + id INT(30) UNSIGNED AUTO_INCREMENT PRIMARY KEY, + `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + order_no INT(10) NOT NULL, + tid VARCHAR(30) NOT NULL, + amount INT(10) NOT NULL, + customer_id INT(10) NOT NULL, + payment_type VARCHAR(50), + test_mode VARCHAR(50), + status text(50), + payment_details text(100), + refund_amount int(11), + instalment_cycle_details text(100), + callback_amount int(11) unsigned DEFAULT '0' +)COMMENT='Novalnet transaction history'; + diff --git a/ext/novalnet/js/datepicker-de.js b/ext/novalnet/js/datepicker-de.js new file mode 100644 index 0000000..82c5733 --- /dev/null +++ b/ext/novalnet/js/datepicker-de.js @@ -0,0 +1,35 @@ +( function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "../widgets/datepicker" ], factory ); + } else { + + // Browser globals + factory( jQuery.datepicker ); + } +}( function( datepicker ) { + +datepicker.regional.de = { + closeText: "Schließen", + prevText: "<Zurück", + nextText: "Vor>", + currentText: "Heute", + monthNames: [ "Januar","Februar","März","April","Mai","Juni", + "Juli","August","September","Oktober","November","Dezember" ], + monthNamesShort: [ "Jan","Feb","Mär","Apr","Mai","Jun", + "Jul","Aug","Sep","Okt","Nov","Dez" ], + dayNames: [ "Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag" ], + dayNamesShort: [ "So","Mo","Di","Mi","Do","Fr","Sa" ], + dayNamesMin: [ "So","Mo","Di","Mi","Do","Fr","Sa" ], + weekHeader: "KW", + dateFormat: "dd.mm.yy", + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: "" }; +datepicker.setDefaults( datepicker.regional.de ); + +return datepicker.regional.de; + +} ) ); diff --git a/ext/novalnet/js/datepicker-en.js b/ext/novalnet/js/datepicker-en.js new file mode 100644 index 0000000..0e1ed2a --- /dev/null +++ b/ext/novalnet/js/datepicker-en.js @@ -0,0 +1,35 @@ +( function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "../widgets/datepicker" ], factory ); + } else { + + // Browser globals + factory( jQuery.datepicker ); + } +}( function( datepicker ) { + +datepicker.regional[ "en-GB" ] = { + closeText: "Done", + prevText: "Prev", + nextText: "Next", + currentText: "Today", + monthNames: [ "January","February","March","April","May","June", + "July","August","September","October","November","December" ], + monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], + dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], + dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], + dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], + weekHeader: "Wk", + dateFormat: "dd/mm/yy", + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: "" }; +datepicker.setDefaults( datepicker.regional[ "en-GB" ] ); + +return datepicker.regional[ "en-GB" ]; + +} ) ); diff --git a/ext/novalnet/js/jquery.js b/ext/novalnet/js/jquery.js new file mode 100644 index 0000000..73f33fb --- /dev/null +++ b/ext/novalnet/js/jquery.js @@ -0,0 +1,4 @@ +/*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m="1.11.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(l.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:k&&!k.call("\ufeff\xa0")?function(a){return null==a?"":k.call(a)}:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||n.guid++,e):void 0},now:function(){return+new Date},support:l}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="
",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=a.document,A=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,B=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:A.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:z,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=z.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return y.find(a);this.length=1,this[0]=d}return this.context=z,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};B.prototype=n.fn,y=n(z);var C=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!n(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function E(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return E(a,"nextSibling")},prev:function(a){return E(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(D[a]||(e=n.unique(e)),C.test(a)&&(e=e.reverse())),this.pushStack(e)}});var F=/\S+/g,G={};function H(a){var b=G[a]={};return n.each(a.match(F)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?G[a]||H(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&n.each(arguments,function(a,c){var d;while((d=n.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){if(a===!0?!--n.readyWait:!n.isReady){if(!z.body)return setTimeout(n.ready);n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(z,[n]),n.fn.trigger&&n(z).trigger("ready").off("ready"))}}});function J(){z.addEventListener?(z.removeEventListener("DOMContentLoaded",K,!1),a.removeEventListener("load",K,!1)):(z.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(z.addEventListener||"load"===event.type||"complete"===z.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===z.readyState)setTimeout(n.ready);else if(z.addEventListener)z.addEventListener("DOMContentLoaded",K,!1),a.addEventListener("load",K,!1);else{z.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&z.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!n.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}J(),n.ready()}}()}return I.promise(b)};var L="undefined",M;for(M in n(l))break;l.ownLast="0"!==M,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c=z.getElementsByTagName("body")[0];c&&(a=z.createElement("div"),a.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",b=z.createElement("div"),c.appendChild(a).appendChild(b),typeof b.style.zoom!==L&&(b.style.cssText="border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1",(l.inlineBlockNeedsLayout=3===b.offsetWidth)&&(c.style.zoom=1)),c.removeChild(a),a=b=null)}),function(){var a=z.createElement("div");if(null==l.deleteExpando){l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}}a=null}(),n.acceptData=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(n.acceptData(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f +}}function S(a,b,c){if(n.acceptData(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d]));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},X=/^(?:checkbox|radio)$/i;!function(){var a=z.createDocumentFragment(),b=z.createElement("div"),c=z.createElement("input");if(b.setAttribute("className","t"),b.innerHTML="
a",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){l.noCloneEvent=!1}),b.cloneNode(!0).click()),null==l.deleteExpando){l.deleteExpando=!0;try{delete b.test}catch(d){l.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=z.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),l[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var Y=/^(?:input|select|textarea)$/i,Z=/^key/,$=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,ab=/^([^.]*)(?:\.(.+)|)$/;function bb(){return!0}function cb(){return!1}function db(){try{return z.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof n===L||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(F)||[""],h=b.length;while(h--)f=ab.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(F)||[""],j=b.length;while(j--)if(h=ab.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,m,o=[d||z],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||z,3!==d.nodeType&&8!==d.nodeType&&!_.test(p+n.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[n.expando]?b:new n.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),k=n.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!n.isWindow(d)){for(i=k.delegateType||p,_.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||z)&&o.push(l.defaultView||l.parentWindow||a)}m=0;while((h=o[m++])&&!b.isPropagationStopped())b.type=m>1?i:k.bindType||p,f=(n._data(h,"events")||{})[b.type]&&n._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&n.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&n.acceptData(d)&&g&&d[p]&&!n.isWindow(d)){l=d[g],l&&(d[g]=null),n.event.triggered=p;try{d[p]()}catch(r){}n.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((n.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?n(c,this).index(i)>=0:n.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ib=/^\s+/,jb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,kb=/<([\w:]+)/,lb=/\s*$/g,sb={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:l.htmlSerialize?[0,"",""]:[1,"X
","
"]},tb=eb(z),ub=tb.appendChild(z.createElement("div"));sb.optgroup=sb.option,sb.tbody=sb.tfoot=sb.colgroup=sb.caption=sb.thead,sb.th=sb.td;function vb(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==L?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==L?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,vb(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function wb(a){X.test(a.type)&&(a.defaultChecked=a.checked)}function xb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function yb(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function zb(a){var b=qb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ab(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}function Bb(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Cb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(yb(b).text=a.text,zb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&X.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}n.extend({clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!hb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ub.innerHTML=a.outerHTML,ub.removeChild(f=ub.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=vb(f),h=vb(a),g=0;null!=(e=h[g]);++g)d[g]&&Cb(e,d[g]);if(b)if(c)for(h=h||vb(a),d=d||vb(f),g=0;null!=(e=h[g]);g++)Bb(e,d[g]);else Bb(a,f);return d=vb(f,"script"),d.length>0&&Ab(d,!i&&vb(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,m=a.length,o=eb(b),p=[],q=0;m>q;q++)if(f=a[q],f||0===f)if("object"===n.type(f))n.merge(p,f.nodeType?[f]:f);else if(mb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(kb.exec(f)||["",""])[1].toLowerCase(),k=sb[i]||sb._default,h.innerHTML=k[1]+f.replace(jb,"<$1>")+k[2],e=k[0];while(e--)h=h.lastChild;if(!l.leadingWhitespace&&ib.test(f)&&p.push(b.createTextNode(ib.exec(f)[0])),!l.tbody){f="table"!==i||lb.test(f)?""!==k[1]||lb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)n.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}n.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),l.appendChecked||n.grep(vb(p,"input"),wb),q=0;while(f=p[q++])if((!d||-1===n.inArray(f,d))&&(g=n.contains(f.ownerDocument,f),h=vb(o.appendChild(f),"script"),g&&Ab(h),c)){e=0;while(f=h[e++])pb.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.deleteExpando,m=n.event.special;null!=(d=a[h]);h++)if((b||n.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k?delete d[i]:typeof d.removeAttribute!==L?d.removeAttribute(i):d[i]=null,c.push(f))}}}),n.fn.extend({text:function(a){return W(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||z).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(vb(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&Ab(vb(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(vb(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return W(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(gb,""):void 0;if(!("string"!=typeof a||nb.test(a)||!l.htmlSerialize&&hb.test(a)||!l.leadingWhitespace&&ib.test(a)||sb[(kb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(jb,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(vb(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(vb(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,o=k-1,p=a[0],q=n.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&ob.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(i=n.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=n.map(vb(i,"script"),yb),f=g.length;k>j;j++)d=i,j!==o&&(d=n.clone(d,!0,!0),f&&n.merge(g,vb(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,n.map(g,zb),j=0;f>j;j++)d=g[j],pb.test(d.type||"")&&!n._data(d,"globalEval")&&n.contains(h,d)&&(d.src?n._evalUrl&&n._evalUrl(d.src):n.globalEval((d.text||d.textContent||d.innerHTML||"").replace(rb,"")));i=c=null}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],g=n(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Db,Eb={};function Fb(b,c){var d=n(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:n.css(d[0],"display");return d.detach(),e}function Gb(a){var b=z,c=Eb[a];return c||(c=Fb(a,b),"none"!==c&&c||(Db=(Db||n(" + + + '.$this->renderIframe(), + ]; + if ((defined('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION == 'true') && (!empty($saved_card_details))) { + $selection['fields'][] = ['title' => '']; + }else if((defined('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION == 'true') && (empty($saved_card_details))){ + $selection['fields'][] = ['title' => '
'.xtc_draw_checkbox_field('nn_cc_onclick', 1 , false, '').MODULE_PAYMENT_NOVALNET_CC_SAVE_CARD_DETAILS.'
']; + } + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + if($_REQUEST['novalnet_cc_token'] == 'new' || !empty($_SESSION['novalnet_cc_new'])){ + unset($_SESSION['novalnet_cc_new']); + $_SESSION['novalnet_cc_new'] = $_REQUEST['novalnet_cc_token']; + } + if (!empty($_SESSION['novalnet_cc_token']) || !empty($_SESSION['novalnet_cc_create_token']) || !empty($_SESSION['nn_do_redirect'])) { + unset($_SESSION['novalnet_cc_token']); + unset($_SESSION['novalnet_cc_create_token']); + unset($_SESSION['nn_do_redirect']); + } + + if (!empty($_REQUEST['nn_pan_hash']) && !empty($_REQUEST['nn_uniqueid'])) { + $_SESSION['nn_pan_hash'] = $_REQUEST['nn_pan_hash']; + $_SESSION['nn_uniqueid'] = $_REQUEST['nn_uniqueid']; + if ((defined('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION == 'true') && !empty($_REQUEST['nn_cc_onclick'])) { + $_SESSION['novalnet_cc_create_token'] = $_REQUEST['nn_cc_onclick']; + } + } elseif (!empty($_REQUEST['novalnet_cc_token']) && $_REQUEST['novalnet_cc_token'] != 'new' + && (defined('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION == 'true')) { + $_SESSION['novalnet_cc_token'] = $_REQUEST['novalnet_cc_token']; + } else { + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' .MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR, 'SSL', true, false)); + } + if (!empty($_REQUEST['do_redirect']) && $_REQUEST['do_redirect'] == '1') { + $_SESSION['nn_do_redirect'] = 1; + } + } + + /** + * Core Function : confirmation() + * + * Perform validations for post values + * @return boolean + */ + function confirmation() { + global $order; + if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') { + $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2))); + } else { + $_SESSION['novalnet']['payment_amount'] = $order->info['total']; + } + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site (Note : if the payment is redirect) + * @return boolean + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function before_process() { + global $order; + $post = $_REQUEST; + if (isset($post['tid'])) { + $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID']; + if ($post['status'] == 'SUCCESS') { // Success + if (NovalnetHelper::validateCheckSum($post)) { // Checksum success + NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code); + } else { // Checksum fail + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { // Failure + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post); + } + $this->tmpOrders = true; // After return to shop set tmpOrders to true for stop update status again. + } else { + if (!empty($_SESSION['nn_do_redirect']) && $_SESSION['nn_do_redirect'] == 1) { + $this->tmpOrders = true; + } else { + $response = $this->doPaymentCall(); + if ($response['result']['status'] == 'SUCCESS') { + $_SESSION['response'] = $response; + $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $response); + } else { + $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : ''); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false)); + } + } + } + } + + /** + * Core Function : payment_action() + * + * Send params to Novalnet server + */ + function payment_action() + { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $response = $this->doPaymentCall($insert_id); + unset($_SESSION['nn_do_redirect']); + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + xtc_redirect($response['result']['redirect_url']); + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Function : doPaymentCall() + * + * @return $data + */ + function doPaymentCall($order_no = '') { + global $order; + $merchant_data = NovalnetHelper::getMerchantData(); + $customer_data = NovalnetHelper::getCustomerData(); + if(empty($_SESSION['novalnet_cc_token'])){ + $transaction_data['transaction'] = array_merge(NovalnetHelper::getTransactionData()['transaction'], NovalnetHelper::getCardDetails($order_no)['transaction']); + }else{ + $transaction_data = NovalnetHelper::getTransactionData(); + } + $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code); + $custom_data = NovalnetHelper::getCustomData(); + if (!empty($_SESSION['saved_card_details']) && $_SESSION['novalnet_cc_new'] != 'new') { + NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + $params['transaction']['payment_data']['token'] = $transaction_data['transaction']['payment_data']['token']; + }else{ + NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + } + if (!empty($params['transaction']['create_token'])) { + $params['custom']['input1'] = 'store_payment_data'; + $params['custom']['inputval1'] = 1; + } + if ((defined('MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE == 'authorize') + && NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT : '')) { // Authorize transaction + $data = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize')); + } else { // Captue or Zero-amount transaction + if (MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE == 'zero_amount') { + $params['transaction']['amount'] = 0; + $params['transaction']['create_token'] = 1; + } + $data = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + } + if ($data['result']['status'] != 'SUCCESS' ) { + $error = (!empty($data['result']['status_text']) ? $data['result']['status_text'] : ''); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false)); + } + unset($_SESSION['novalnet']['payment_amount']); + unset($_SESSION['payment_details']); + unset($_SESSION['nn_pan_hash']); + unset($_SESSION['nn_uniqueid']); + unset($_SESSION['novalnet_cc_token']); + unset($_SESSION['novalnet_cc_create_token']); + unset($_SESSION['novalnet_cc_new']); + unset($_SESSION['saved_card_details']); + return $data; + } + + /** + * Core Function : after_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + * @param none + * @return void + */ + function after_process() { + global $order, $insert_id; + if(!$this->tmpOrders && !empty($_SESSION['response'])) { + NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code); + NovalnetHelper::sendTransactionUpdate($insert_id); + } + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_CC_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * + * Core Function : install() + * + * Payment module installation + */ + function install() { + $label = "font-weight:normal;font-family:Roboto,Arial,sans-serif;font-size:13px;line-height:1.42857"; + $input_field = "height:30px;border:1px solid #ccc;"; + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_VISIBILITY_BY_AMOUNT', '', '5', now());"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_INLINE_FORM','true', '6', 'switcher' ,now());"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_3D_SECURE_FORCE','false', '7', 'switcher' ,now());"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION', 'true' , '8', 'switcher' , now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE', '', '9', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT', '', '10', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_ORDER_STATUS', '2', '11', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE', '.$label.', '12', now());"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_INPUT', '.$input_field.', '17', now());"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_CSS_TEXT', '.$label.', '13', now());"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_SORT_ORDER', '2', '14', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_ENDCUSTOMER_INFO', '', '15', now());"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + * @return boolean + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code, true); + $lang = (isset($_SESSION['language_code'])) ? strtoupper($_SESSION['language_code']) : 'DE'; + echo ''; + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_CC_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_INLINE_FORM', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_3D_SECURE_FORCE', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_INPUT', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_CSS_TEXT', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_CC_ENDCUSTOMER_INFO', + ); + } + + /** + * To display Iframe in checkout page + * + * @return string + */ + function renderIframe() { + $data = $this->getNovalnetCCFormDetails(); + $cc_hidden_field = " + + + "; + return $cc_hidden_field; + } + + /** + * To get Iframe content in checkout page + * + * @return json data + */ + function getNovalnetCCFormDetails() { + global $order; + $iframedata = array( + 'client_key' => MODULE_PAYMENT_NOVALNET_CLIENT_KEY, + 'product_id' => MODULE_PAYMENT_NOVALNET_PROJECT_ID, + 'inline_form' => ((defined('MODULE_PAYMENT_NOVALNET_CC_INLINE_FORM') && MODULE_PAYMENT_NOVALNET_CC_INLINE_FORM == 'true') ? '1' : '0'), + 'test_mode' => ((defined('MODULE_PAYMENT_NOVALNET_CC_TEST_MODE') && MODULE_PAYMENT_NOVALNET_CC_TEST_MODE == 'true') ? '1' : '0'), + 'enforce_3d' => ((defined('MODULE_PAYMENT_NOVALNET_CC_3D_SECURE_FORCE') && MODULE_PAYMENT_NOVALNET_CC_3D_SECURE_FORCE == 'true') ? '1' : '0'), + 'first_name' => $order->billing['firstname'], + 'last_name' => $order->billing['lastname'], + 'email' => $order->customer['email_address'], + 'street' => $order->billing['street_address'], + 'city' => $order->billing['city'], + 'zip' => $order->customer['postcode'], + 'country_code' => $order->billing['country']['iso_code_2'], + 'amount' => $order->info['total']*100, + 'currency' => $order->info['currency'], + 'lang' => ((isset($_SESSION['language_code'])) ? strtoupper($_SESSION['language_code']) : 'DE'), + 'iframe_error' => MODULE_PAYMENT_NOVALNET_CC_IFRAME_ERROR, + 'iframe_holder_label' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_HOLDER, + 'iframe_holder_input' => MODULE_PAYMENT_NOVALNET_CC_IFRAME_HOLDER_INPUT_TEXT, + 'iframe_holder_error' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_HOLDER_ERROR, + 'iframe_number_label' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_NO, + 'iframe_number_input' => MODULE_PAYMENT_NOVALNET_CC_IFRAME_NUMBER_INPUT_TEXT, + 'iframe_number_error' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_NO_ERROR, + 'iframe_expire_label' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_VALID_DATE, + 'iframe_expire_error' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_VALID_DATE_ERROR, + 'iframe_cvc_label' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_CVC, + 'iframe_cvc_input' => MODULE_PAYMENT_NOVALNET_CC_IFRAME_CVC_INPUT_TEXT, + 'iframe_cvc_error' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_CVC_ERROR, + ); + return json_encode($iframedata); + } +} + diff --git a/includes/modules/payment/novalnet_config.php b/includes/modules/payment/novalnet_config.php new file mode 100644 index 0000000..e4c0f6a --- /dev/null +++ b/includes/modules/payment/novalnet_config.php @@ -0,0 +1,210 @@ +code = 'novalnet_config'; + $this->title = defined('MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_TITLE') ? MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_TITLE : ''; + $this->description = defined('MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_DESC') ? MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_DESC : ''; + $this->sort_order = 0; + $this->enabled = true; + $this->novalnet_version = '12.0.3'; + } + + /** + * + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_SIGNATURE'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + return false; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + $this->checkAdminAccess(); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SIGNATURE', '', '1', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY', '', '2', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TARIFF_ID', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CLIENT_KEY', '', '4', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PROJECT_ID', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE', '1', '4', 'order-status', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED', '99', '5', 'order-status',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE','false', '6', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_URL', '" . ((defined('ENABLE_SSL_CATALOG') && ENABLE_SSL_CATALOG === true) ? HTTPS_SERVER : HTTP_SERVER . DIR_WS_CATALOG) . 'callback/novalnet/callback.php' ."', '7',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO', '', '8',now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + * @return boolean + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + * @return boolean + */ + function keys() { + static $error_display_count = 0; + echo ' '; + + if (isset($_SESSION['error_msg_displayed'])) { + unset($_SESSION['error_msg_displayed']); + } + + // Validate the merchant configuration in shop backend + if (!isset($_SESSION['error_msg_displayed']) && $error_display_count == 0) { + NovalnetHelper::validateMerchantConfiguration(); + $error_display_count++; + } + + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_SIGNATURE', + 'configuration/MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY', + 'configuration/MODULE_PAYMENT_NOVALNET_TARIFF_ID', + 'configuration/MODULE_PAYMENT_NOVALNET_CLIENT_KEY', + 'configuration/MODULE_PAYMENT_NOVALNET_PROJECT_ID', + 'configuration/MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE', + 'configuration/MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED', + 'configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_URL', + 'configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO', + ); + + } + + /** + * Check Novalnet column in admin access table + * + */ + function checkAdminAccess() { + $novalet_alter_table = false; + if (xtc_db_fetch_array(xtc_db_query("show tables like 'admin_access'"))) { + $novalnet_check = xtc_db_query('DESC admin_access'); + // Check Novalnet column in admin access table + while ($check_column = xtc_db_fetch_array($novalnet_check)) { + if (in_array($check_column['Field'], array('novalnet_extension_helper', 'novalnet'))) { + $novalet_alter_table = true; + break; + } + } + if (!$novalet_alter_table) { + xtc_db_query('ALTER TABLE admin_access ADD novalnet int(1) NOT NULL DEFAULT "1",COMMENT="Novalnet Admin page"'); + xtc_db_query('ALTER TABLE admin_access ADD novalnet_extension_helper int(1) NOT NULL DEFAULT "1",COMMENT="Novalnet Admin extension"'); + } + } + $version_table = xtc_db_query("SHOW TABLES LIKE 'novalnet_version_detail'"); + $table_count = $version_table->num_rows; + if($table_count > 0) { // If version table exists + $novalnet = xtc_db_fetch_array(xtc_db_query("SELECT * FROM novalnet_version_detail")); + if(version_compare($novalnet['version'], '11.3.0', '<=')){ + // Import Novalnet package SQL tables + $sql_file = DIR_FS_CATALOG . 'ext/novalnet/sql/db.sql'; + $sql_lines = file_get_contents($sql_file); + $sql_linesArr = explode(";", $sql_lines); + foreach ($sql_linesArr as $sql) { + if (trim($sql) > '') { + xtc_db_query($sql); + } + } + + xtc_db_perform('novalnet_version_detail',array('version' => $this->novalnet_version), 'update', "version='{$novalnet['version']}'"); + + // Check whether novalnet table exist in shop + $nn_check = xtc_db_query('DESC ' . 'novalnet_callback_history'); + $nn_alter_table = false; + while ($checks_column = xtc_db_fetch_array($nn_check)) { + if (in_array($checks_column['Field'] ,array('callback_datetime','original_tid','order_amount','callback_amount'))) { + $nn_alter_table = true; + break; + } + } + // Alter the novalnet table if already exists in shop + if (!$nn_alter_table) { + xtc_db_query('ALTER TABLE novalnet_callback_history CHANGE org_tid original_tid bigint(20) unsigned COMMENT "Original Transaction ID"'); + xtc_db_query('ALTER TABLE novalnet_callback_history CHANGE amount order_amount int(20) COMMENT "Amount in minimum unit of currency. E.g. enter 100 which is equal to 1.00"'); + xtc_db_query('ALTER TABLE novalnet_callback_history CHANGE total_amount callback_amount int(11) COMMENT "Amount in minimum unit of currency. E.g. enter 100 which is equal to 1.00"'); + xtc_db_query('ALTER TABLE novalnet_callback_history CHANGE `date` callback_datetime datetime COMMENT "Callback excute DATE TIME"'); + } + + // Check whether novalnet table exist in shop + $nn_check = xtc_db_query('DESC ' . 'novalnet_transaction_detail'); + $nn_alter_table = false; + while ($checks_column = xtc_db_fetch_array($nn_check)) { + if (in_array($checks_column['Field'] ,array('status', 'instalment_cycle_details', 'callback_amount'))) { + $nn_alter_table = true; + break; + } + } + // Alter the novalnet table if already exists in shop + if (!$nn_alter_table) { + xtc_db_query('ALTER TABLE novalnet_transaction_detail CHANGE gateway_status status varchar(60) COMMENT "Transaction status"'); + xtc_db_query('ALTER TABLE novalnet_transaction_detail ADD instalment_cycle_details text NULL COMMENT "Instalment information used in gateways"'); + xtc_db_query('ALTER TABLE novalnet_transaction_detail ADD callback_amount int(20) NULL COMMENT "Instalment information used in gateways"'); + } + } else { + $sql_file = DIR_FS_CATALOG . 'ext/novalnet/sql/db_12_0_0.sql'; + $sql_lines = file_get_contents($sql_file); + $sql_linesArr = explode(";", $sql_lines); + foreach ($sql_linesArr as $sql) { + if (trim($sql) > '') { + xtc_db_query($sql); + } + } + } + } else { + $sql_file = DIR_FS_CATALOG . 'ext/novalnet/sql/db_12_0_0.sql'; + $sql_lines = file_get_contents($sql_file); + $sql_linesArr = explode(";", $sql_lines); + foreach ($sql_linesArr as $sql) { + if (trim($sql) > '') { + xtc_db_query($sql); + } + } + } + } +} diff --git a/includes/modules/payment/novalnet_eps.php b/includes/modules/payment/novalnet_eps.php new file mode 100644 index 0000000..6b8061c --- /dev/null +++ b/includes/modules/payment/novalnet_eps.php @@ -0,0 +1,246 @@ +code = 'novalnet_eps'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_EPS_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_EPS_TEXT_TITLE : ''); + $this->info = ((defined('MODULE_PAYMENT_NOVALNET_EPS_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_EPS_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_EPS_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_EPS_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_EPS_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_EPS_STATUS') && MODULE_PAYMENT_NOVALNET_EPS_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_EPS_TEST_MODE') && MODULE_PAYMENT_NOVALNET_EPS_TEST_MODE == 'true') ? true : false); + $this->tmpOrders = true; + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_EPS_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_EPS_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + return false; + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + global $order; + $post = $_REQUEST; + if (isset($post['tid'])) { + $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID']; + if ($post['status'] == 'SUCCESS') { // Success + if (NovalnetHelper::validateCheckSum($post)) { // Checksum success + NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code); + } else { // Checksum fail + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { // Failure + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post); + } + } + } + + /** + * Core Function : payment_action() + */ + function payment_action() { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $response = NovalnetHelper::getRedirectData($insert_id, $this->code); + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + xtc_redirect($response['result']['redirect_url']); + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Core Function : after_process() + * + */ + function after_process() { + global $order, $insert_id; + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_EPS_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_VISIBILITY_BY_AMOUNT', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_ORDER_STATUS', '2', '8', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_SORT_ORDER', '16', '7', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_ENDCUSTOMER_INFO', '', '3', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_EPS_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_EPS_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_EPS_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_EPS_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_EPS_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_EPS_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_EPS_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_EPS_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_giropay.php b/includes/modules/payment/novalnet_giropay.php new file mode 100644 index 0000000..7a4f5a4 --- /dev/null +++ b/includes/modules/payment/novalnet_giropay.php @@ -0,0 +1,247 @@ +code = 'novalnet_giropay'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_GIROPAY_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_GIROPAY_TEXT_TITLE : ''); + $this->info = ((defined('MODULE_PAYMENT_NOVALNET_GIROPAY_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_GIROPAY_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_GIROPAY_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_GIROPAY_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_GIROPAY_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_GIROPAY_STATUS') && MODULE_PAYMENT_NOVALNET_GIROPAY_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_GIROPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_GIROPAY_TEST_MODE == 'true') ? true : false); + $this->tmpOrders = true; + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_GIROPAY_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_GIROPAY_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { + unset($_SESSION['payment']); + } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + return false; + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + $post = $_REQUEST; + if (isset($post['tid'])) { + $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID']; + if ($post['status'] == 'SUCCESS') { // Success + if (NovalnetHelper::validateCheckSum($post)) { // Checksum success + NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code); + } else { // Checksum fail + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { // Failure + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post); + } + } + } + + /** + * Core Function : payment_action() + */ + function payment_action() { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $response = NovalnetHelper::getRedirectData($insert_id, $this->code); + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + xtc_redirect($response['result']['redirect_url']); + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Core Function : after_process() + * + */ + function after_process() { + global $order, $insert_id; + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_ORDER_STATUS', '2', '6', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_SORT_ORDER', '13', '7', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_ENDCUSTOMER_INFO', '', '8', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_googlepay.php b/includes/modules/payment/novalnet_googlepay.php new file mode 100644 index 0000000..dceff76 --- /dev/null +++ b/includes/modules/payment/novalnet_googlepay.php @@ -0,0 +1,571 @@ +code = 'novalnet_googlepay'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEXT_TITLE : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_GOOGLEPAY_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_GOOGLEPAY_SORT_ORDER) : 0; + $this->info = (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO != '') ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO)) : ''; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_STATUS') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE == 'true') ? true : false); + $this->tmpOrders = false; + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + global $order; + if (NovalnetHelper::checkMerchantCredentials($this->code) || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { + unset($_SESSION['payment']); + } + return false; + } + if (!empty($order->info['deduction']) || $_SESSION['customers_status']['customers_status_show_price_tax'] == '0') { + $_SESSION['novalnet']['deduction_amount'] = $order->info['deduction']; + $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2))); + } else { + $_SESSION['novalnet']['deduction_amount'] = $order->info['deduction']; + $_SESSION['novalnet']['payment_amount'] = $order->info['total']; + } + $display_page = defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY') ? explode('|', MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY) : array(); + if ($this->enabled === true && in_array('checkout page',$display_page)) { + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => '' .NovalnetHelper::showPaymentDescription($this->code) . $this->info + .'' + .'' + .'' + .''.$this->getParam($order), + ]; + + $selection['fields'][] = ['title' => ' + ']; + return $selection; + } + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + if (!empty($_REQUEST['nn_google_wallet']) || !empty($_SESSION['wallet_token'])) { + unset($_SESSION['wallet_token']); + $_SESSION['wallet_token'] = $_REQUEST['nn_google_wallet']; + } + if (!empty($_REQUEST['nn_wallet_doredirect']) || !empty($_SESSION['nn_wallet_doredirect'])) { + unset($_SESSION['nn_wallet_doredirect']); + $_SESSION['nn_wallet_doredirect'] = $_REQUEST['nn_wallet_doredirect']; + } + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + global $order; + if($_SESSION['customers_status']['customers_status_show_price_tax'] == '0') { + $_SESSION['novalnet']['wallet_amount'] = ($order->info['total'] - (round($order->info['deduction_amount'], 2))) + round($order->info['tax'], 2); + } else { + $_SESSION['novalnet']['wallet_amount'] = $order->info['total']; + } + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function before_process() { + global $order; + if (!empty($_SESSION['received_data'])) { + $receivedData = $_SESSION['received_data']; + $_SESSION['nn_wallet_doredirect'] = $receivedData['transaction']['doRedirect']; + } + $post = $_REQUEST; + if (isset($post['tid'])) { + if ($post['status'] == 'SUCCESS') { + if (NovalnetHelper::validateCheckSum($post)) { + $transaction_details = array('transaction' =>array('tid' => $post['tid'])); + $action = NovalnetHelper::get_action_endpoint('transaction_details'); + $response = NovalnetHelper::sendRequest($transaction_details, $action); + $_SESSION['response'] = $response; + } else { + NovalnetHelper::processTempOrderFail($this->code, $_SESSION['nn_tempOID'], $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { + NovalnetHelper::processTempOrderFail($this->code, $_SESSION['nn_tempOID'], $post); + } + } else { + if (!empty($_SESSION['nn_wallet_doredirect']) && $_SESSION['nn_wallet_doredirect'] == 'true') { + $this->tmpOrders = true; + } else { + $response = $this->doPaymentCall(); + if ($response['result']['status'] == 'SUCCESS') { + $_SESSION['response'] = $response; + } else { + $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : ''); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false)); + } + } + } + $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']); + } + + /** + * Core Function : payment_action() + * + * Send params to Novalnet server + */ + function payment_action() + { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $response = $this->doPaymentCall($insert_id); + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + $_SESSION['nn_redirect_url'] = $response['result']['redirect_url']; + if (empty($_SESSION['received_data'])) { + xtc_redirect($response['result']['redirect_url']); + } + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Function : doPaymentCall() + * + * @return $data + */ + function doPaymentCall($order_no = '') { + global $order; + include DIR_FS_CATALOG . 'release_info.php'; + $receivedData = $_SESSION['received_data']; + $merchant_data = NovalnetHelper::getMerchantData(); + $custom_data = NovalnetHelper::getCustomData(); + if (empty($_SESSION['received_data'])) { + $customer_data = NovalnetHelper::getCustomerData(); + $transaction_data = NovalnetHelper::getTransactionData(); + $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code); + $transaction_data['transaction']['payment_data']['wallet_token'] = $_SESSION['wallet_token']; + $custom_data = NovalnetHelper::getCustomData(); + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + } else{ + $customer_data = NovalnetHelper::getCustomerData($receivedData); + $transaction_data = NovalnetHelper::getTransactionData($receivedData); + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + $params['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code); + if (!empty($_SESSION['tmp_oID'])) { + $params['transaction']['order_no'] = $_SESSION['tmp_oID']; + } + $params['transaction']['payment_data']['wallet_token'] = $_SESSION['token']; + } + if($_SESSION['nn_wallet_doredirect'] == 'true') { + $params['transaction']['order_no' ] = $order_no; + $params['transaction']['return_url'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']; + $params['transaction']['error_return_url'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']; + } + // payment call send to novalnet server + if ((defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_AUTHENTICATE == 'true') && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT : ''))) { // for on-hold transaction + $data = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize')); + } else { + $data = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + } + unset($_SESSION['novalnet']['payment_amount']); + unset($_SESSION['novalnet']['deduction_amount']); + unset($_SESSION['novalnet']['wallet_amount']); + if ($data['result']['status'] != 'SUCCESS' ) { + $error = (!empty($data['result']['status_text']) ? $data['result']['status_text'] : ''); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false)); + } + return $data; + } + /** + * Core Function : after_process() + * + */ + function after_process() { + global $order, $insert_id; + if (!empty($_SESSION['received_data']) && !empty($_SESSION['nn_tempOID'])) { + NovalnetHelper::updateOrderStatus($_SESSION['nn_tempOID'], $order->info['comments'], $_SESSION['response'], $this->code); + NovalnetHelper::sendTransactionUpdate($_SESSION['nn_tempOID']); + } else { + NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code); + NovalnetHelper::sendTransactionUpdate($_SESSION['nn_tempOID']); + } + unset($_SESSION['response']); + unset($_SESSION['received_data']); + unset($_SESSION['shipping']); + unset($_SESSION['nn_wallet_doredirect']); + unset($_SESSION['wallet_token']); + unset($_SESSION['token']); + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT', '0', '5', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_AUTHENTICATE','false', '6' ,'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT', '', '7', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME', '', '8', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE','false', '9' ,'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID', '', '10', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE', 'Default', '11', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT', '', '13', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY', 'shopping cart page|product page|checkout page', '11', 'multiselect', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ORDER_STATUS', '2', '14', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_SORT_ORDER', '4', '15', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO', '', '16', now());"); + } + + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code, true); + echo ' + + '; + echo ''; + $button_display = defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY') ? MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY : ''; + echo ''; + return array('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_AUTHENTICATE', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO', + ); + } + + /** + * Show GooglePay button Cart Page + */ + function googlepayCart_page_button() { + if ($this->enabled === true + && $_SESSION['cart']->show_total() > 0 + && (!isset($_SESSION['allow_checkout']) || $_SESSION['allow_checkout'] == 'true') && (strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') == true && MODULE_PAYMENT_NOVALNET_SIGNATURE !='' && MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY !='' && MODULE_PAYMENT_NOVALNET_TARIFF_ID !='')) + { + echo ''.$this->getParam().''; + } + } + + /** + * Show GooglePay button Product Page + */ + function googlepayProduct_page_button() { + if ($this->enabled === true + && (strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') == true && MODULE_PAYMENT_NOVALNET_SIGNATURE !='' && MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY !='' && MODULE_PAYMENT_NOVALNET_TARIFF_ID !='')) { + echo ''.$this->getParam().''; + } + } + + /** + * Get parameter for GooglePay process + * + * @return string Hidden fields with GooglePay data. + */ + function getParam($nn_order = '') { + global $xtPrice; + require_once(DIR_WS_CLASSES.'order.php'); + $order = new order(); + // customers default address + $customers = xtc_db_fetch_array(xtc_db_query("SELECT customer_id FROM admin_access_users limit 1")); + $address_query = xtc_db_fetch_array(xtc_db_query("SELECT entry_country_id FROM ". TABLE_ADDRESS_BOOK ." WHERE customers_id = '". $customers['customer_id'] ."'")); + // countries + $country_query = xtc_db_fetch_array(xtc_db_query("SELECT countries_name, countries_iso_code_2, address_format_id FROM ". TABLE_COUNTRIES ." WHERE countries_id = '". $address_query['entry_country_id'] ."'")); + + // googlepay button types + $googlepay_button_type = (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE') && !empty(MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE)) ? MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE : 'plain'; + $display_page = defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY') ? explode('|', MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY) : array(); + $current_page = explode('.php', basename($_SERVER['PHP_SELF'])); + $data = array( + 'client_key' => MODULE_PAYMENT_NOVALNET_CLIENT_KEY, + 'test_mode' => (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE == 'true') ? '1' : '0', + 'currency' => $order->info['currency'], + 'product_name' => $order->products[0]['name'], + 'country_code' => (isset($country_query['countries_iso_code_2']) ? $country_query['countries_iso_code_2'] : ''), + 'seller_name' => (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME != '') ? MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME : STORE_NAME, + 'lang' => ((isset($_SESSION['language_code'])) ? strtoupper($_SESSION['language_code']) : 'DE'), + 'googlepay_button_type' => $googlepay_button_type, + 'googlepay_button_height' => MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT, + 'payment_method' => 'GOOGLEPAY', + 'product_type' => $GLOBALS['product']->data['product_type'], + 'current_page' => $current_page[0], + 'environment' => (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE == 'true') ? 'SANDBOX' : 'PRODUCTION', + 'enforce_3d' => (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE == 'true') ? true : false, + 'partner_id' => (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID') && !empty(MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID)) ? MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID : '' + ); + if (!empty($GLOBALS['product']->data['products_id']) && in_array('product page',$display_page)) { + $data['total_amount'] = (string)($order->info['total'] * 100); + $data['product_id'] = $GLOBALS['product']->data['products_id']; + $data['payment_page'] = 'product_page'; + } else { + if (!empty($_SESSION['novalnet']['payment_amount']) && $_SESSION['customers_status']['customers_status_show_price_tax'] == '0') { + $data['total_amount'] = (string) ($_SESSION['novalnet']['payment_amount'] * 100); + } else { + $data['total_amount'] = (string)($order->info['total'] * 100); + } + } + $data['show_shipping_option'] = 0; + if($GLOBALS['product']->data['product_type'] && $GLOBALS['product']->data['product_type'] != 2) { + $data['show_shipping_option'] = 1; + } + $articleDetails = []; + foreach($order->products as $key => $products) { + if($products['product_type'] != 2) { + $data['show_shipping_option'] = 1; + } + + $articleDetails[] = array('label'=> $products['name']. ' x ' .$products['qty'], + 'amount' => (string)(($products['qty'] * $products['price'])*100), + 'type' => 'SUBTOTAL', + ); + } + if (empty($nn_order)) { + if (!empty($order->info['tax']) && $_SESSION['customers_status']['customers_status_show_price_tax'] != '0') { // Price incl tax + $articleDetails[] = array( + 'label' => 'Incl.Tax', + 'amount' => (string)((round($order->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } else if (!empty($order->info['tax']) && $_SESSION['customers_status']['customers_status_show_price_tax'] == '0') { // Price excl tax + $articleDetails[] = array( + 'label' => 'Excl.Tax', + 'amount' => (string)((round($order->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } + } + if(empty($articleDetails) && !empty($GLOBALS['product']->data['products_id'])) { + $products_price = $xtPrice->xtcGetPrice($GLOBALS['product']->data['products_id'], true, 1, $GLOBALS['product']->data['products_tax_class_id'], $GLOBALS['product']->data['products_price'], 1, 0, true, true, '', true); + $articleDetails[] = array('label'=> $GLOBALS['product']->data['products_name'] . ' x ' .$GLOBALS['product']->data['qty'], + 'amount' => (string)($products_price['plain'] * 100) * $GLOBALS['product']->data['qty'], + 'type' => 'SUBTOTAL', + ); + $tax_rate = $xtPrice->getTaxRateByTaxClassId($GLOBALS['product']->data['products_tax_class_id']); + $tax = $xtPrice->xtcGetTax($GLOBALS['product']->data['products_price'], $tax_rate); + if($_SESSION['customers_status']['customers_status_show_price_tax'] != '0'){ + $articleDetails[] = array( + 'label' => 'Incl.Tax', + 'amount' => (string)((round($order->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } else { + $articleDetails[] = array( + 'label' => 'Excl.Tax', + 'amount' => (string)((round($tax, 2))*100), + 'type' => 'SUBTOTAL' + ); + } + if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') { + $discount_price = round($xtPrice->xtcFormat($GLOBALS['product']->data['products_price'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2); + $articleDetails[] = array( + 'label' => $_SESSION['customers_status']['customers_status_discount']. '%' .'Discount', + 'amount' => (string) (round($discount_price, 2) *100), + 'type' => 'SUBTOTAL' + ); + } + $data['total_amount'] = (string)(($products_price['plain'] * 100) - round($discount_price, 2) *100); + } + if ($current_page[0] == 'checkout_payment') { + $articleDetails[] = array('label'=> 'shipping', + 'amount' => (string)($nn_order->info['shipping_cost']*100), + 'type' => 'SUBTOTAL'); + if(!empty($nn_order->info['deduction']) || ($_SESSION['customers_status']['customers_status_discount'] != '0')) { // To add discount + $discount_price = round($xtPrice->xtcFormat($order->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2); + $deduction = abs($discount_price + $nn_order->info['deduction']); + $articleDetails[] = array('label'=> 'Discount', + 'amount' => (string) (round($deduction, 2) * 100), + 'type' => 'SUBTOTAL'); + } + if(!empty($nn_order->info['deduction']) || ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00')) { // Price incl tax + $articleDetails[] = array( + 'label' => 'Incl.Tax', + 'amount' => (string)((round($nn_order->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } else if (!empty($nn_order->info['tax']) && $_SESSION['customers_status']['customers_status_show_price_tax'] == '0') { // Price excl tax + $articleDetails[] = array( + 'label' => 'Excl.Tax', + 'amount' => (string)((round($nn_order->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } + if ($_SESSION['customers_status']['customers_status_show_price_tax'] != 0) { + $data['total_amount'] = (string)($nn_order->info['total'] * 100); + $data['orig_amount'] = $data['total_amount']; + } else { + $data['total_amount'] = (string)(($nn_order->info['total'] * 100) + (round($nn_order->info['tax'], 2) * 100)); + $data['orig_amount'] = (string)(($nn_order->info['total'] * 100) + (round($nn_order->info['tax'], 2) * 100)); + } + } + if ($current_page[0] != 'checkout_payment') { + if ($_SESSION['customers_status']['customers_status_show_price_tax'] != 0) { + $data['orig_amount'] = $data['total_amount']; + } else { + $data['orig_amount'] = (string)($data['total_amount'] + (round($order->info['tax'], 2) * 100)); + } + } + $input = json_encode($data); + $googlepay_hidden_field = "". + "". + ""; + return $googlepay_hidden_field; + } +} + +?> diff --git a/includes/modules/payment/novalnet_guarantee_invoice.php b/includes/modules/payment/novalnet_guarantee_invoice.php new file mode 100644 index 0000000..3338945 --- /dev/null +++ b/includes/modules/payment/novalnet_guarantee_invoice.php @@ -0,0 +1,338 @@ +code = 'novalnet_guarantee_invoice'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEXT_TITLE : ''); + $this->info = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEST_MODE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEST_MODE == 'true') ? true : false); + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + global $order; + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { + unset($_SESSION['payment']); + } + return false; + } + // Get customer details + $customer_details = NovalnetHelper::collectCustomerDobGenderFax($order->customer['email_address']); + + if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS == 'true') { + if ($this->proceedToGuranteePayment()) { + $selection = [ + 'id' => $this->code, + 'module' => defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEXT_TITLE') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEXT_TITLE : '', + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + $is_b2b = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B == 'true') && !empty($order->billing['company'])) ? true : false; + if (!$is_b2b) { + $selection['fields'][] = ['title' =>'' .MODULE_PAYMENT_GUARANTEE_DOB_FIELD.''.''.''. '', ]; + $selection['fields'][] = ['title' => NovalnetHelper::getGuaranteeField($this->code.'birthdate', $customer_details)]; + } + } else { + return false; + } + } + return $selection; + } + + /** + * Core Function : confirmation() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + global $order; + if (!empty($_REQUEST['novalnet_guarantee_invoicebirthdate'])) { + $error_message = NovalnetHelper::dateOfBirth($_REQUEST['novalnet_guarantee_invoicebirthdate']); + if (!empty($error_message) && (((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE == 'true') + && (defined('MODULE_PAYMENT_NOVALNET_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_INVOICE_STATUS == 'true')))) { + $_SESSION['error_message'] = $error_message; + } elseif (!empty($error_message)) { + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error_message) .MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR, 'SSL', true, false)); + } + $_SESSION['novalnet_guarantee_invoicebirthdate'] = date("Y-m-d", strtotime($_REQUEST['novalnet_guarantee_invoicebirthdate'])); + } elseif (empty($order->billing['company'])) { + $_SESSION['error_message'] = defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE : ''; + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($_SESSION['error_message']), 'SSL', true, false)); + } else { + return false; + } + } + + /** + * Core Function : process_button() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + global $order; + if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') { + $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2))); + } else { + $_SESSION['novalnet']['payment_amount'] = $order->info['total']; + } + } + + /** + * Core Function : process_button() + * + * Displays confirmation page + * @return boolean + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function before_process(){ + global $order; + if (!empty($_SESSION['error_message']) && (defined('MODULE_PAYMENT_NOVALNET_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_INVOICE_STATUS == 'true') && (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE == 'true')) { + $this->code = 'novalnet_invoice'; + $order->info['payment_method'] = 'novalnet_invoice'; + $order->info['payment_class'] = 'novalnet_invoice'; + unset($_SESSION['error_message']); + } + $merchant_data = NovalnetHelper::getMerchantData(); + $customer_data = NovalnetHelper::getCustomerData(); + $transaction_data = NovalnetHelper::getTransactionData(); + $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code); + $custom_data = NovalnetHelper::getCustomData(); + + if (!empty($_SESSION['novalnet_guarantee_invoicebirthdate']) && (empty($order->billing['company']) + || (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B == 'false'))) { + if(isset($customer_data['customer']['billing']['company'])) { + unset($customer_data['customer']['billing']['company']); + } + $customer_data['customer']['birth_date'] = $_SESSION['novalnet_guarantee_invoicebirthdate']; + } elseif (!empty($order->billing['company'])) { + $customer_data['customer']['billing']['company'] = $order->billing['company']; + } + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + if($this->code == 'novalnet_invoice'){ + $due_date_in_days = defined('MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE') ? MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE : ''; + if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) { + $params['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days); + } + if ((defined('MODULE_PAYMENT_NOVALNET_INVOICE_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_INVOICE_AUTHENTICATE == 'true')&& (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT : ''))) { // Authorize transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize')); + } else { // Captue transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + } + }else if($this->code == 'novalnet_guarantee_invoice'){ + if ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE == 'true') + && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT : ''))) { // Authorize transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize')); + } else { // Captue transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + } + } + if ($response['result']['status'] == 'SUCCESS') { + $_SESSION['response'] = $response; + } else { + $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : ''); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false)); + } + unset($_SESSION['novalnet']['payment_amount']); + $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']); + unset($_SESSION['novalnet_guarantee_invoicebirthdate']); + } + + /** + * Core Function : after_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function after_process() { + global $order, $insert_id; + if (in_array($_SESSION['response']['transaction']['status'], array('CONFIRMED', 'ON_HOLD')) + || ($_SESSION['response']['transaction']['status'] == 'PENDING' && $_SESSION['response']['transaction']['payment_type'] == 'INVOICE') + ) { + $order->info['comments'] .= PHP_EOL. MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT .PHP_EOL; + $order->info['comments'] .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 1, ('TID ' . $_SESSION['response']['transaction']['tid'])) . PHP_EOL; + $order->info['comments'] .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, ('BNR-' . MODULE_PAYMENT_NOVALNET_PROJECT_ID . '-' . $insert_id)) . PHP_EOL; + } + NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code); + NovalnetHelper::sendTransactionUpdate($insert_id); + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`,`last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE', 'false', '1', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS','false', '2', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEST_MODE','false', '3', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE','true', '4', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B','true', '6', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOWED', '', '7', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_PAYMENT_ZONE', '0', '8', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE','false', '10' ,'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT', '', '11', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ORDER_STATUS', '2', '12', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_SORT_ORDER', '7', '13', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO', '', '14', now());"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code, true); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO', + ); + } + + /** + * To Proceed and validate Guarantee payment basic requirements in checkout + * + * @return boolean + */ + function proceedToGuranteePayment() { + global $order; + $b2b = defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B : ''; + $minimum_amount_gurantee = trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT) != '' ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT : '999'; + if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS == 'true') { + $country_check = NovalnetHelper::checkGuaranteeCountries(strtoupper($order->billing['country']['iso_code_2']),$b2b, $order->billing['company']); + if (NovalnetHelper::getOrderAmount($order->info['total']) >= $minimum_amount_gurantee && $country_check && $order->info['currency'] == 'EUR' && NovalnetHelper::isBillingShippingsame()) { + return true; + } + return false; + } + } +} + diff --git a/includes/modules/payment/novalnet_guarantee_sepa.php b/includes/modules/payment/novalnet_guarantee_sepa.php new file mode 100644 index 0000000..4c8461d --- /dev/null +++ b/includes/modules/payment/novalnet_guarantee_sepa.php @@ -0,0 +1,455 @@ +code = 'novalnet_guarantee_sepa'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEXT_TITLE : ''); + $this->info = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEST_MODE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEST_MODE == 'true') ? true : false); + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + global $order; + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { + unset($_SESSION['payment']); + } + return false; + } + if (!$this->proceedToGuranteePayment()) + return false; + + // Get customer details + $customer_details = NovalnetHelper::collectCustomerDobGenderFax($order->customer['email_address']); + $selection = [ + 'id' => $this->code, + 'module' => defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEXT_TITLE') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEXT_TITLE : '', + 'description' => '' . NovalnetHelper::showSepaDescription($this->code) . $this->info + .'' + .'', + 'module_cost' => $this->cost, + ]; + if(defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE != 'true'){ + $selection['fields'][] = ['title' => '']; + } + $is_b2b = (!empty($order->billing['company']) && (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B == 'true')) ? true : false; + if (!$is_b2b || (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE == 'false')) { + $dob_field = [ + 'title' => MODULE_PAYMENT_GUARANTEE_DOB_FIELD. NovalnetHelper::getGuaranteeField($this->code.'birthdate', $customer_details), + ]; + } + $bic_field = ['title' => '' + ]; + $payment_details = xtc_db_query("SELECT payment_details, id FROM novalnet_transaction_detail WHERE customer_id='" . xtc_db_input($_SESSION['customer_id']) . "' AND payment_details !='' AND payment_type in ('DIRECT_DEBIT_SEPA', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'INSTALMENT_DIRECT_DEBIT_SEPA') AND status IN ('CONFIRMED', 'ON_HOLD') ORDER BY id DESC LIMIT 10"); + $sepa_saved_card_details = []; + $count = 0; + while ($payment_detail = xtc_db_fetch_array($payment_details)) { + $decode_details = json_decode($payment_detail['payment_details'], true); + if (empty($decode_details['iban'])) { + continue; + } + $decode_details['id'] = $payment_detail['id']; + $sepa_saved_card_details[$count] = $decode_details; + $count++; + } + if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION == 'true') { + if (!empty($sepa_saved_card_details) || !empty($_SESSION['sepa_saved_card_details'])) { + unset($_SESSION['sepa_saved_card_details']); + $payment_data = []; + foreach ($sepa_saved_card_details as $key => $value) { + if (empty($value['iban']) || in_array($value['iban'], $payment_data)) { + continue; + } + if (empty($value)) { + continue; + } + $_SESSION['sepa_saved_card_details'] = $sepa_saved_card_details; + $oneclick = (!empty($sepa_saved_card_details)) ? ''.sprintf(('IBAN %s'),$value['iban']) . '  Delete' : ''; + if(!empty($value['iban'])){ + $selection['fields'][] = [ 'title' => $oneclick ]; + } + array_push($payment_data, $value['iban']); + } + $selection['fields'][] = [ 'title' => ''.MODULE_PAYMENT_NOVALNET_SEPA_NEW_ACCOUNT_DETAILS.'']; + + $selection['fields'][] = ['title' => ''. xtc_draw_input_field('novalnet_sepa_iban', '', 'id="novalnet_sepa_iban_field" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" style="display:none;" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');"'), + ]; + $selection['fields'][] = $bic_field; + $selection['fields'][] = $dob_field; + $selection['fields'][] = ['title' => '', + ]; + } else{ + $selection['fields'][] = [ + 'title' => MODULE_PAYMENT_NOVALNET_SEPA_IBAN. xtc_draw_input_field('novalnet_sepa_iban', '', 'id="novalnet_sepa_iban_field" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');"'), + ]; + $selection['fields'][] = $bic_field; + $selection['fields'][] = $dob_field; + $selection['fields'][] = ['title' => '
'.xtc_draw_checkbox_field('nn_sepa_checkbox', 1 , false, 'id="novalnet_sepa_onclick"')." ".MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS.'
', + ]; + } + } else if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION == 'false') { + $selection['fields'][] = [ + 'title' => MODULE_PAYMENT_NOVALNET_SEPA_IBAN. xtc_draw_input_field('novalnet_sepa_iban', '', 'id="novalnet_sepa_iban_field" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');"'), + ]; + $selection['fields'][] = $bic_field; + $selection['fields'][] = $dob_field; + } + return $selection; + } + + /** + * Core Function : confirmation() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + global $order; + if (!empty($_SESSION['novalnet_sepa_new'])) { + unset($_SESSION['novalnet_sepa_new']); + } + if (isset($_REQUEST['novalnet_sepa_token']) && $_REQUEST['novalnet_sepa_token'] == 'new') { + $_SESSION['novalnet_sepa_new'] = 'new'; + } + if (isset($_SESSION['error_message'])) { + unset($_SESSION['error_message']); + } + if (!empty($_SESSION['novalnet_guarantee_sepa_token']) || !empty($_SESSION['novalnet_guarantee_sepa_create_token'])) { + unset($_SESSION['novalnet_guarantee_sepa_token']); + unset($_SESSION['novalnet_guarantee_sepa_create_token']); + } + if (!empty($_SESSION['novalnet_guarantee_sepa_birthdate']) || !empty($_SESSION['novalnet_sepa_iban'])) { + unset($_SESSION['novalnet_guarantee_sepa_birthdate']); + unset($_SESSION['novalnet_sepa_iban']); + } + + if (!empty($_REQUEST['novalnet_sepa_token']) && ($_REQUEST['novalnet_sepa_token'] != 'new') + && (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION == 'true')) { + $_SESSION['novalnet_guarantee_sepa_token'] = $_REQUEST['novalnet_sepa_token']; + } else { + if (!empty($_REQUEST['novalnet_sepa_iban'])) { + $_SESSION['novalnet_sepa_iban'] = $_REQUEST['novalnet_sepa_iban']; + $_SESSION['novalnet_sepa_bic'] = !empty($_REQUEST['novalnet_sepa_bic']) ? $_REQUEST['novalnet_sepa_bic'] : ''; + if ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION == 'true') && !empty($_REQUEST['nn_sepa_checkbox']) + && $_REQUEST['nn_sepa_checkbox'] != 'new') { + $_SESSION['novalnet_guarantee_sepa_create_token'] = $_REQUEST['nn_sepa_checkbox']; + } + } else { + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' .MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR, 'SSL', true, false)); + } + } + if (!empty($_REQUEST['novalnet_guarantee_sepabirthdate'])) { + $error_message = NovalnetHelper::dateOfBirth($_REQUEST['novalnet_guarantee_sepabirthdate']); + if (!empty($error_message) && (((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE == 'true') + && (defined('MODULE_PAYMENT_NOVALNET_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_SEPA_STATUS == 'true')))) { + $_SESSION['error_message'] = $error_message; + } elseif (!empty($error_message)) { + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error_message) .MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR, 'SSL', true, false)); + } + $_SESSION['novalnet_guarantee_sepa_birthdate'] = date("Y-m-d", strtotime($_REQUEST['novalnet_guarantee_sepabirthdate'])); + } elseif (empty($order->billing['company'])) { + $_SESSION['error_message'] = MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE; + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($_SESSION['error_message']), 'SSL', true, false)); + } + } + + /** + * Core Function : process_button() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + global $order; + if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') { + $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2))); + } else { + $_SESSION['novalnet']['payment_amount'] = $order->info['total']; + } + } + + /** + * Core Function : process_button() + * + * Displays confirmation page + * @return boolean + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function before_process() { + global $order; + if (!empty($_SESSION['error_message']) && (defined('MODULE_PAYMENT_NOVALNET_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_SEPA_STATUS == 'true') && (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE == 'true')) { + $this->code = 'novalnet_sepa'; + $order->info['payment_method'] = 'novalnet_sepa'; + $order->info['payment_class'] = 'novalnet_sepa'; + if(!empty($_SESSION['novalnet_guarantee_sepa_token'])) { + $_SESSION[$this->code . '_token'] = $_SESSION['novalnet_guarantee_sepa_token']; + unset($_SESSION['novalnet_guarantee_sepa_token']); + } + if(!empty($_SESSION['novalnet_guarantee_sepa_create_token'])) { + $_SESSION[$this->code . '_create_token'] = $_SESSION['novalnet_guarantee_sepa_create_token']; + unset($_SESSION['novalnet_guarantee_sepa_create_token']); + } + unset($_SESSION['error_message']); + } + + $merchant_data = NovalnetHelper::getMerchantData(); + $customer_data = NovalnetHelper::getCustomerData(); + $transaction_data = NovalnetHelper::getTransactionData(); + $custom_data = NovalnetHelper::getCustomData(); + $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code); + if (!empty($_SESSION['novalnet_guarantee_sepa_birthdate']) && (empty($order->billing['company']) + || (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B == 'false'))) { + if(isset($customer_data['customer']['billing']['company'])) { + unset($customer_data['customer']['billing']['company']); + } + $customer_data['customer']['birth_date'] = $_SESSION['novalnet_guarantee_sepa_birthdate']; + } elseif (!empty($order->billing['company'])) { + $customer_data['customer']['billing']['company'] = $order->billing['company']; + } + // Add token data if it's enabled + if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION == 'true') { + if (!empty($_SESSION['sepa_saved_card_details']) && empty($_SESSION['novalnet_sepa_new'])) { + NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + $params['transaction']['payment_data']['token'] = $transaction_data['transaction']['payment_data']['token']; + }else if ((isset($_SESSION['novalnet_sepa_new']) && $_SESSION['novalnet_sepa_new'] == 'new')) { + NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); + $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data']; + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + } else { + NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); + $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data']; + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + } + } else { + NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); + $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data']; + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + } + $due_date_in_days = constant('MODULE_PAYMENT_' . strtoupper($this->code) . '_DUE_DATE'); + if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) { + $params['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days); + } + if($this->code == 'novalnet_sepa'){ + if ((defined('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE == 'true') && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT : ''))) { // Authorize transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize')); + } else { // Captue transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + } + }else if($this->code == 'novalnet_guarantee_sepa'){ + if ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE == 'true') && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT : ''))) { // Authorize transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize')); + } else { // Captue transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + } + } + if ($response['result']['status'] == 'SUCCESS') { + $_SESSION['response'] = $response; + } else { + $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : ''); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false)); + } + unset($_SESSION['novalnet']['payment_amount']); + $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']); + unset($_SESSION['novalnet_sepa_iban']); + unset($_SESSION[$this->code .'_token']); + unset($_SESSION[$this->code . '_create_token']); + unset($_SESSION['novalnet_guarantee_sepa_birthdate']); + unset($_SESSION['novalnet_sepa_bic']); + unset($_SESSION['novalnet_sepa_new']); + unset($_SESSION['sepa_saved_card_details']); + } + + /** + * Core Function : after_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function after_process() { + global $order, $insert_id; + NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code); + NovalnetHelper::sendTransactionUpdate($insert_id); + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA', 'false', '1', 'switcher',now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS','false', '2', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEST_MODE','false', '3', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE','true', '4', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B','true', '6', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOWED', '', '7', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_PAYMENT_ZONE', '0', '8', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION','true' , '9', 'switcher' , now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE', '', '10', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE','false', '11' ,'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT', '', '12', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ORDER_STATUS', '2', '13', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SORT_ORDER', '8', '14', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO', '', '15', now());"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code, true); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO', + ); + } + + /** + * To Proceed and validate Guarantee payment basic requirements in checkout + * + * @return boolean + */ + function proceedToGuranteePayment() { + global $order; + $b2b = defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B : ''; + $minimum_amount_gurantee = trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT) != '' ? MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT : '999'; + $country_check = NovalnetHelper::checkGuaranteeCountries(strtoupper($order->billing['country']['iso_code_2']),$b2b, $order->billing['company']); + if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS == 'true') { + if (NovalnetHelper::getOrderAmount($order->info['total']) >= $minimum_amount_gurantee && $country_check && $order->info['currency'] == 'EUR' && NovalnetHelper::isBillingShippingsame()) { + return true; + } + return false; + } + } +} + diff --git a/includes/modules/payment/novalnet_ideal.php b/includes/modules/payment/novalnet_ideal.php new file mode 100644 index 0000000..1db1656 --- /dev/null +++ b/includes/modules/payment/novalnet_ideal.php @@ -0,0 +1,244 @@ +code = 'novalnet_ideal'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_TITLE : ''); + $this->info = ((defined('MODULE_PAYMENT_NOVALNET_IDEAL_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_IDEAL_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_IDEAL_STATUS') && MODULE_PAYMENT_NOVALNET_IDEAL_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE') && MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE == 'true') ? true : false); + $this->tmpOrders = true; + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_IDEAL_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_IDEAL_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + return false; + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + $post = $_REQUEST; + if (isset($post['tid'])) { + $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID']; + if ($post['status'] == 'SUCCESS') { // Success + if (NovalnetHelper::validateCheckSum($post)) { // Checksum success + NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code); + } else { // Checksum fail + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { // Failure + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post); + } + } + } + + /** + * Core Function : payment_action() + */ + function payment_action() { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $response = NovalnetHelper::getRedirectData($insert_id, $this->code); + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + xtc_redirect($response['result']['redirect_url']); + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Core Function : after_process() + * + */ + function after_process() { + global $order, $insert_id; + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_ORDER_STATUS', '2', '6', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`,`last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER', '11', '7', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_ENDCUSTOMER_INFO', '', '8', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_instalment_invoice.php b/includes/modules/payment/novalnet_instalment_invoice.php new file mode 100644 index 0000000..c628e08 --- /dev/null +++ b/includes/modules/payment/novalnet_instalment_invoice.php @@ -0,0 +1,317 @@ +code = 'novalnet_instalment_invoice'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_TEXT_TITLE : ''); + $this->info = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_SORT_ORDER') + && trim(MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_STATUS') + && MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_TEST_MODE') + && MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_TEST_MODE == 'true') ? true : false); + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + global $order; + $order_amount = NovalnetHelper::getOrderAmount($order->info['total']); + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { + unset($_SESSION['payment']); + } + return false; + } + if (empty(NovalnetHelper::checkInstalmentConditions($order_amount, $this->code))) { + return false; + } + // Get customer details + $customer_details = NovalnetHelper::collectCustomerDobGenderFax($order->customer['email_address']); + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info + . '' + . '' + . '', + ]; + if (($order->billing['company'] == '') || ($order->billing['company'] != '' && MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B == 'false')) { + $selection['fields'][] = ['title' => ''.MODULE_PAYMENT_GUARANTEE_DOB_FIELD.'' ]; + $selection['fields'][] = ['title' => ''.NovalnetHelper::getGuaranteeField($this->code.'birthdate', $customer_details).''] ; + } + + //Instalment cycles + $novalnet_instalment_cycle = defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE') ? explode('|', MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE) : array(); + $novalnet_recurring_period_cycle = '1m'; + $selection['fields'][] = ['title' => (sprintf(( ''.MODULE_PAYMENT_NOVALNET_INSTALLMENT_TEXT.''), xtc_format_price_order($order_amount/100, 1, $order->info['currency'])))]; + $selection['fields'][] = [ + 'field' => ''.xtc_draw_hidden_field('', MODULE_PAYMENT_NOVALNET_INSTALLMENT_CYCLES_FRONTEND , 'id="nn_cycles_frontend"').xtc_draw_hidden_field('', MODULE_PAYMENT_NOVALNET_INSTALLMENT_AMOUNT_FRONTEND , 'id="nn_amount_frontend"').xtc_draw_hidden_field('', MODULE_PAYMENT_NOVALNET_INSTALLMENT_FRONTEND , 'id="nn_installment_frontend"'). + xtc_draw_hidden_field('', $order->info['currency'], 'id="nn_installmnet_currency"').'
', + ]; + if (NovalnetHelper::getInstalmentCycles($order_amount/100,$novalnet_instalment_cycle, $order->info['currency']) == '0') { + return false; + } + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + global $order; + $_SESSION['novalnet_instalment_invoicebirthdate'] = date('Y-m-d',strtotime($_REQUEST['novalnet_instalment_invoicebirthdate'])); + $_SESSION['novalnet_instalment_invoice_cycles'] = $_REQUEST['novalnet_global_recurring_period_cycles']; + if (($order->billing['company'] == '') || ($order->billing['company'] != '' + && (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B == 'false'))) { + if ($_REQUEST['novalnet_instalment_invoicebirthdate'] == '') { + $error_message = MODULE_PAYMENT_GUARANTEE_PAYMENT_DOB_EMPTY_ERROR_MESSAGE; + } else if ($_REQUEST['novalnet_instalment_invoicebirthdate'] != '') { + $error_message = NovalnetHelper::dateOfBirth($_REQUEST['novalnet_instalment_invoicebirthdate']); + } + } + if ($error_message != '') { + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error_message), 'SSL', true, false)); + } + } + + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + global $order; + if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') { + $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2))); + } else { + $_SESSION['novalnet']['payment_amount'] = $order->info['total']; + } + } + + /** + * Core Function : process_button() + * + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function before_process() { + global $order; + $merchant_data = NovalnetHelper::getMerchantData(); + $customer_data = NovalnetHelper::getCustomerData(); + $transaction_data = NovalnetHelper::getTransactionData(); + $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code); + $custom_data = NovalnetHelper::getCustomData(); + if (!empty($_SESSION['novalnet_instalment_invoicebirthdate']) && (empty($order->billing['company']) + || (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B == 'false'))){ + if(isset($customer_data['customer']['billing']['company'])) { + unset($customer_data['customer']['billing']['company']); + } + $customer_data['customer']['birth_date'] = $_SESSION['novalnet_instalment_invoicebirthdate']; + } elseif (!empty($order->billing['company'])) { + $customer_data['customer']['billing']['company'] = $order->billing['company']; + } + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + // Instalment payments params + $params['instalment'] = [ + 'interval' => '1m', + 'cycles' => $_SESSION['novalnet_instalment_invoice_cycles'], + ]; + // To perform on-hold process + if ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE == 'true') + && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT : ''))) { + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize')); + } else { + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + } + if ($response['result']['status'] == 'SUCCESS') { + $_SESSION['response'] = $response; + } else { + $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : ''); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false)); + } + $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']); + unset($_SESSION['novalnet_instalment_invoicebirthdate']); + unset($_SESSION['novalnet_instalment_invoice_cycles']); + } + + /** + * Core Function : after_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function after_process() { + global $order, $insert_id; + if($_SESSION['response']['transaction']['payment_type'] == 'INSTALMENT_INVOICE' && (in_array($_SESSION['response']['transaction']['status'], array('CONFIRMED', 'ON_HOLD')))) { + $order->info['comments'] = str_replace('###SHOPORDERNUMBER###', $insert_id, $order->info['comments']); + } + NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code); + $response = NovalnetHelper::sendTransactionUpdate($insert_id); + unset($_SESSION['novalnet']['payment_amount']); + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`,`last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_BASIC_REQ', 'false', '1', 'switcher',now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_STATUS','false', '2', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_TEST_MODE','false', '3', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE','2|3|4|5|6|7|8|9|10|11|12', '4', 'text' , now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MINIMUM_ORDER_AMOUNT', '1998', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOWED', '', '6', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B','true', '7', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_PAYMENT_ZONE', '0', '8', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE','false', '9' ,'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT', '', '10', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ORDER_STATUS', '2', '11', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_SORT_ORDER', '9', '12', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO', '', '13', now());"); + + + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code, true); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_BASIC_REQ', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MINIMUM_ORDER_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_instalment_sepa.php b/includes/modules/payment/novalnet_instalment_sepa.php new file mode 100644 index 0000000..9d52910 --- /dev/null +++ b/includes/modules/payment/novalnet_instalment_sepa.php @@ -0,0 +1,419 @@ +code = 'novalnet_instalment_sepa'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TEXT_TITLE : ''); + $this->info = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SORT_ORDER') + && trim(MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_STATUS') + && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TEST_MODE') + && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TEST_MODE == 'true') ? true : false); + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + global $order; + $order_amount = NovalnetHelper::getOrderAmount($order->info['total']); + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { + unset($_SESSION['payment']); + } + return false; + } + // Get customer details + $customer_details = NovalnetHelper::collectCustomerDobGenderFax($order->customer['email_address']); + if (empty(NovalnetHelper::checkInstalmentConditions($order_amount, $this->code))) { + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => ''.NovalnetHelper::showSepaDescription($this->code) . $this->info + . '' + . '' + . '', + ]; + $is_b2b = (!empty($order->billing['company']) && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B == 'true')?true:false; + if (!$is_b2b) { + $dob_field = [ + 'title' => MODULE_PAYMENT_GUARANTEE_DOB_FIELD. NovalnetHelper::getGuaranteeField($this->code.'birthdate', $customer_details), + ]; + } + $bic_field = ['title' => '' + ]; + $payment_details = xtc_db_query("SELECT payment_details, id FROM novalnet_transaction_detail WHERE customer_id='" . xtc_db_input($_SESSION['customer_id']) . "' AND payment_details !='' AND payment_type in ('DIRECT_DEBIT_SEPA', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'INSTALMENT_DIRECT_DEBIT_SEPA') AND status IN ('CONFIRMED', 'ON_HOLD') ORDER BY id DESC LIMIT 10"); + $instasaved_card_details = []; + $count = 0; + while ($payment_detail = xtc_db_fetch_array($payment_details)) { + $decode_details = json_decode($payment_detail['payment_details'], true); + if (empty($decode_details['iban'])) { + continue; + } + $decode_details['id'] = $payment_detail['id']; + $instasaved_card_details[$count] = $decode_details; + $count++; + } + if (MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION == 'true') { + if(isset($_SESSION['instasaved_card_details'])) { + unset($_SESSION['instasaved_card_details']); // If instasaved_card_details unset it. + } + if (!empty($instasaved_card_details)) { + $_SESSION['instasaved_card_details'] = $instasaved_card_details; + $payment_data = []; + foreach ($instasaved_card_details as $key => $value) { + if (empty($value['iban']) || in_array($value['iban'], $payment_data)) { + continue; + } + if (empty($value)) { + continue; + } + $oneclick = (!empty($instasaved_card_details)) ? ''.sprintf(('IBAN %s'),$value['iban']) . '  Delete' : ''; + if(!empty($value['iban'])){ + $selection['fields'][] = [ 'title' => $oneclick ]; + } + array_push($payment_data, $value['iban']); + } + $selection['fields'][] = [ 'title' => ''.MODULE_PAYMENT_NOVALNET_SEPA_NEW_ACCOUNT_DETAILS.'']; + + $selection['fields'][] = ['title' => ''. xtc_draw_input_field('novalnet_instalment_sepa_iban', '', 'id="novalnet_instalment_sepa_iban_field" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" style="display:none;" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');"'), + ]; + $selection['fields'][] = $bic_field; + $selection['fields'][] = $dob_field; + $selection['fields'][] = ['title' => '', + ]; + } else { + $selection['fields'][] = ['title' => MODULE_PAYMENT_NOVALNET_SEPA_IBAN. xtc_draw_input_field('novalnet_instalment_sepa_iban', '', 'id="novalnet_instalment_sepa_iban_field" autocomplete="off" placeholder="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');"'), + ]; + $selection['fields'][] = $bic_field; + $selection['fields'][] = $dob_field; + $selection['fields'][] = ['title' => '
'.xtc_draw_checkbox_field('nn_instalment_sepa_checkbox', 1 , false, 'id="novalnet_instalment_sepa_onclick"')." ".MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS.'
', + ]; + } + } else { + $selection['fields'][] = [ + 'title' => MODULE_PAYMENT_NOVALNET_SEPA_IBAN. xtc_draw_input_field('novalnet_instalment_sepa_iban', '', 'id="novalnet_instalment_sepa_iban_field" autocomplete="off" placeholder="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');"'), + ]; + $selection['fields'][] = $bic_field; + $selection['fields'][] = $dob_field; + } + //Instalment cycles + $novalnet_instalment_cycle = defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE') ? explode('|', MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE) : array(); + $novalnet_recurring_period_cycle = '1m'; + $selection['fields'][] = ['title' => (sprintf(( '' . MODULE_PAYMENT_NOVALNET_INSTALLMENT_TEXT . ''), xtc_format_price_order($order_amount/100, 1, $order->info['currency'])))]; + + $selection['fields'][] = [ + 'field' => ''.xtc_draw_hidden_field('', MODULE_PAYMENT_NOVALNET_INSTALLMENT_CYCLES_FRONTEND , 'id="nn_cycles_frontend"').xtc_draw_hidden_field('', MODULE_PAYMENT_NOVALNET_INSTALLMENT_AMOUNT_FRONTEND , 'id="nn_amount_frontend"').xtc_draw_hidden_field('', MODULE_PAYMENT_NOVALNET_INSTALLMENT_FRONTEND , 'id="nn_installment_frontend"'). + xtc_draw_hidden_field('', $order->info['currency'], 'id="nn_installmnet_currency"').'
', + ]; + if (NovalnetHelper::getInstalmentCycles($order_amount/100,$novalnet_instalment_cycle, $order->info['currency']) == '0') { + return false; + } + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + global $order; + if (!empty($_SESSION['novalnet_instalment_sepa_new'])) { + unset($_SESSION['novalnet_instalment_sepa_new']); + } + if (isset($_REQUEST['novalnet_instalment_sepa_token']) && $_REQUEST['novalnet_instalment_sepa_token'] == 'new') { + unset($_SESSION['novalnet_instalment_sepa_new']); + $_SESSION['novalnet_instalment_sepa_new'] = 'new'; + } + if (!empty($_SESSION['novalnet_instalment_sepa_token']) || !empty($_SESSION['novalnet_instalment_sepa_create_token'])) { + unset($_SESSION['novalnet_instalment_sepa_token']); + unset($_SESSION['novalnet_instalment_sepa_create_token']); + } + if (!empty($_REQUEST['novalnet_instalment_sepa_iban'])) { + $_SESSION['novalnet_sepa_iban'] = $_REQUEST['novalnet_instalment_sepa_iban']; + $_SESSION['novalnet_sepa_bic'] = !empty($_REQUEST['novalnet_instalment_sepa_bic']) ? $_REQUEST['novalnet_instalment_sepa_bic'] : ''; + if ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION == 'true') && !empty($_REQUEST['nn_instalment_sepa_checkbox'])) + { + $_SESSION['novalnet_instalment_sepa_create_token'] = $_REQUEST['nn_instalment_sepa_checkbox']; + } + } elseif (!empty($_REQUEST['novalnet_instalment_sepa_token']) && ($_REQUEST['novalnet_instalment_sepa_token'] != 'new') && (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION == 'true')) { + $_SESSION['novalnet_instalment_sepa_token'] = $_REQUEST['novalnet_instalment_sepa_token']; + } else { + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' .MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR, 'SSL', true, false)); + } + $_SESSION['novalnet_instalment_sepa_birthdate'] = date('Y-m-d',strtotime($_REQUEST['novalnet_instalment_sepabirthdate'])); + $_SESSION['novalnet_instalment_sepa_cycles'] = $_REQUEST['novalnet_global_recurring_period_cycles_sepa']; + if (($order->billing['company'] == '') || ($order->billing['company'] != '' + && (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B == 'false'))) { + if ($_REQUEST['novalnet_instalment_sepabirthdate'] == '') { + $error_message = MODULE_PAYMENT_GUARANTEE_PAYMENT_DOB_EMPTY_ERROR_MESSAGE; + } else if ($_REQUEST['novalnet_instalment_sepabirthdate'] != '') { + $error_message = NovalnetHelper::dateOfBirth($_REQUEST['novalnet_instalment_sepabirthdate']); + } + } + if ($error_message != '') { + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error_message), 'SSL', true, false)); + } + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + global $order; + if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') { + $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2))); + } else { + $_SESSION['novalnet']['payment_amount'] = $order->info['total']; + } + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + global $order; + $merchant_data = NovalnetHelper::getMerchantData(); + $customer_data = NovalnetHelper::getCustomerData(); + $transaction_data = NovalnetHelper::getTransactionData(); + $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code); + $custom_data = NovalnetHelper::getCustomData(); + if (!empty($_SESSION['novalnet_instalment_sepa_birthdate']) && (empty($order->billing['company']) + || (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B == 'false'))) { + if(isset($customer_data['customer']['billing']['company'])) { + unset($customer_data['customer']['billing']['company']); + } + $customer_data['customer']['birth_date'] = $_SESSION['novalnet_instalment_sepa_birthdate']; + } elseif (!empty($order->billing['company'])) { + $customer_data['customer']['billing']['company'] = $order->billing['company']; + } + // Add token data if it's enabled + if (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION == 'true') { + if (!empty($_SESSION['instasaved_card_details']) && empty($_SESSION['novalnet_instalment_sepa_new'])) { + NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + } else { + NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); // If the create token is set it will added in request. + $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data']; + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + } + } else { + $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data']; + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + } + $due_date_in_days = constant('MODULE_PAYMENT_' . strtoupper($this->code) . '_PAYMENT_DUE_DATE'); + if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) { + $params['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days); + } + // Instalment payments params + $params['instalment'] = [ + 'interval' => '1m', + 'cycles' => $_SESSION['novalnet_instalment_sepa_cycles'], + ]; + if ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE == 'true') + && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT : ''))) { + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize')); + } else { + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + } + if ($response['result']['status'] == 'SUCCESS') { + $_SESSION['response'] = $response; + } else { + $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : ''); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false)); + } + $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']); + unset($_SESSION['novalnet_sepa_iban']); + unset($_SESSION['novalnet_instalment_sepa_birthdate']); + unset($_SESSION['novalnet_instalment_sepa_cycles']); + unset($_SESSION['novalnet_instalment_sepa_create_token']); + unset($_SESSION['novalnet_instalment_sepa_token']); + unset($_SESSION['novalnet_sepa_bic']); + unset($_SESSION['novalnet_instalment_sepa_new']); + unset($_SESSION['instasaved_card_details']); + } + + /** + * Core Function : after_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function after_process() { + global $order, $insert_id; + NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code); + NovalnetHelper::sendTransactionUpdate($insert_id); + unset($_SESSION['novalnet']['payment_amount']); + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_BASIC_REQ', 'false', '1', 'switcher', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_STATUS','false', '2', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TEST_MODE','false', '3', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE','2|3|4|5|6|7|8|9|10|11|12', '4', 'text' , now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MINIMUM_ORDER_AMOUNT', '1998', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B','true', '6', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE', '', '7', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION','true' , '8', 'switcher' , now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOWED', '', '9', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_ZONE', '0', '10', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE','false', '11' ,'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT', '', '12', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ORDER_STATUS', '2', '13', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SORT_ORDER', '10', '14', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO', '', '15', now());"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code, true); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_BASIC_REQ', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MINIMUM_ORDER_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_instantbank.php b/includes/modules/payment/novalnet_instantbank.php new file mode 100644 index 0000000..d457577 --- /dev/null +++ b/includes/modules/payment/novalnet_instantbank.php @@ -0,0 +1,245 @@ +code = 'novalnet_instantbank'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_INSTANTBANK_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_INSTANTBANK_TEXT_TITLE : ''); + $this->info = ((defined('MODULE_PAYMENT_NOVALNET_INSTANTBANK_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_INSTANTBANK_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_INSTANTBANK_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_INSTANTBANK_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_INSTANTBANK_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_INSTANTBANK_STATUS') && MODULE_PAYMENT_NOVALNET_INSTANTBANK_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_INSTANTBANK_TEST_MODE') && MODULE_PAYMENT_NOVALNET_INSTANTBANK_TEST_MODE == 'true') ? true : false); + $this->tmpOrders = true; + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_INSTANTBANK_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_INSTANTBANK_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + return false; + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + $post = $_REQUEST; + if (isset($post['tid'])) { + $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID']; + if ($post['status'] == 'SUCCESS') { // Success + if (NovalnetHelper::validateCheckSum($post)) { // Checksum success + NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code); + } else { // Checksum fail + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { // Failure + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post); + } + } + } + + /** + * Core Function : payment_action() + */ + function payment_action() { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $response = NovalnetHelper::getRedirectData($insert_id, $this->code); + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + xtc_redirect($response['result']['redirect_url']); + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Core Function : after_process() + * + */ + function after_process() { + global $order, $insert_id; + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_ORDER_STATUS', '2', '6', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_SORT_ORDER', '12', '7', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_ENDCUSTOMER_INFO', '', '8', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_invoice.php b/includes/modules/payment/novalnet_invoice.php new file mode 100644 index 0000000..514bc12 --- /dev/null +++ b/includes/modules/payment/novalnet_invoice.php @@ -0,0 +1,293 @@ +code = 'novalnet_invoice'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TITLE : ''); + $this->info = (defined('MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO') ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_INVOICE_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE') && MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE == 'true') ? true : false); + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_INVOICE_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_INVOICE_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { + unset($_SESSION['payment']); + } + return false; + } + + if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS == 'true') { + if ($this->proceedToGuranteePayment()) { + $proceedToInvoice = false; + } elseif (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE == 'true') { + $proceedToInvoice = true; + } + } else { + $proceedToInvoice = true; + } + + if ($proceedToInvoice) { + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + return false; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + global $order; + if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') { + $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2))); + } else { + $_SESSION['novalnet']['payment_amount'] = $order->info['total']; + } + + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function before_process(){ + global $order; + $merchant_data = NovalnetHelper::getMerchantData(); + $customer_data = NovalnetHelper::getCustomerData(); + $transaction_data = NovalnetHelper::getTransactionData(); + $custom_data = NovalnetHelper::getCustomData(); + $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName('novalnet_invoice'); + $due_date_in_days = defined('MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE') ? MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE : ''; + if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) { + $transaction_data['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days); + } + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + if ((defined('MODULE_PAYMENT_NOVALNET_INVOICE_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_INVOICE_AUTHENTICATE == 'true') + && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT : ''))) { // Authorize transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize')); + } else { // Captue transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + } + if ($response['result']['status'] == 'SUCCESS') { // Success + $_SESSION['response'] = $response; + } else { // Failure + $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : ''); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false)); + } + unset($_SESSION['novalnet']['payment_amount']); + $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']); + } + /** + * Core Function : after_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function after_process() { + global $order, $insert_id; + $order->info['comments'] .= PHP_EOL. MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT .PHP_EOL; + $order->info['comments'] .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 1, ('TID ' . $_SESSION['response']['transaction']['tid'])) . PHP_EOL; + $order->info['comments'] .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, ('BNR-' . MODULE_PAYMENT_NOVALNET_PROJECT_ID . '-' . $insert_id)) . PHP_EOL; + NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code); + NovalnetHelper::sendTransactionUpdate($insert_id); + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_VISIBILITY_BY_AMOUNT', '', '5', now());"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE', '', '6', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_AUTHENTICATE','false', '7' ,'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT', '', '8', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_ORDER_STATUS', '1', '9', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_CALLBACK_ORDER_STATUS', '2', '10', 'order-status', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER', '5', '11', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO', '', '12', now());"); + + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code, true); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE', + 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_AUTHENTICATE', + 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT', + 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_CALLBACK_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO', + ); + } + + /** + * To Proceed and validate Guarantee payment basic requirements in checkout + * + * @return boolean + */ + function proceedToGuranteePayment() { + global $order; + $b2b = defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B : ''; + $minimum_amount_gurantee = trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT) != '' ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT : '999'; + if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS == 'true') { + $country_check = NovalnetHelper::checkGuaranteeCountries(strtoupper($order->billing['country']['iso_code_2']),$b2b, $order->billing['company']); + if (NovalnetHelper::getOrderAmount($order->info['total']) >= $minimum_amount_gurantee && $country_check + && $order->info['currency'] == 'EUR' && NovalnetHelper::isBillingShippingsame($order)) { + return true; + } + return false; + } + } +} + +?> diff --git a/includes/modules/payment/novalnet_multibanco.php b/includes/modules/payment/novalnet_multibanco.php new file mode 100644 index 0000000..b136b84 --- /dev/null +++ b/includes/modules/payment/novalnet_multibanco.php @@ -0,0 +1,237 @@ +code = 'novalnet_multibanco'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_MULTIBANCO_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_MULTIBANCO_TEXT_TITLE : ''); + $this->info = ((defined('MODULE_PAYMENT_NOVALNET_MULTIBANCO_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_MULTIBANCO_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_MULTIBANCO_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_MULTIBANCO_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_MULTIBANCO_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_MULTIBANCO_STATUS') && MODULE_PAYMENT_NOVALNET_MULTIBANCO_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_MULTIBANCO_TEST_MODE') && MODULE_PAYMENT_NOVALNET_MULTIBANCO_TEST_MODE == 'true') ? true : false); + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_MULTIBANCO_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_MULTIBANCO_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { + unset($_SESSION['payment']); + } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + global $order; + if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') { + $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2))); + } else { + $_SESSION['novalnet']['payment_amount'] = $order->info['total']; + } + } + + /** + * Core Function : process_button() + * + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + global $order; + $merchant_data = NovalnetHelper::getMerchantData(); + $customer_data = NovalnetHelper::getCustomerData(); + $transaction_data = NovalnetHelper::getTransactionData(); + $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code); + $custom_data = NovalnetHelper::getCustomData(); + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + if ($response['result']['status'] == 'SUCCESS') { + $_SESSION['response'] = $response; + } else { + $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : ''); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false)); + } + unset($_SESSION['novalnet']['payment_amount']); + $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']); + } + + /** + * Core Function : after_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function after_process() { + global $order, $insert_id; + NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code); + NovalnetHelper::sendTransactionUpdate($insert_id); + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_ORDER_STATUS', '1', '6', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_CALLBACK_ORDER_STATUS', '2', '7', 'order-status', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_SORT_ORDER', '21', '8', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_ENDCUSTOMER_INFO', '', '9', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_CALLBACK_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_online_bank_transfer.php b/includes/modules/payment/novalnet_online_bank_transfer.php new file mode 100644 index 0000000..e377110 --- /dev/null +++ b/includes/modules/payment/novalnet_online_bank_transfer.php @@ -0,0 +1,245 @@ +code = 'novalnet_online_bank_transfer'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_TEXT_TITLE : ''); + $this->info = (defined('MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ENDCUSTOMER_INFO') ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_STATUS') && MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_TEST_MODE') && MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_TEST_MODE == 'true') ? true : false); + $this->tmpOrders = true; + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + return false; + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + $post = $_REQUEST; + if (isset($post['tid'])) { + $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID']; + if ($post['status'] == 'SUCCESS') { // Success + if (NovalnetHelper::validateCheckSum($post)) { // Checksum success + NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code); + } else { // Checksum fail + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { // Failure + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post); + } + } + } + + /** + * Core Function : payment_action() + */ + function payment_action() { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $response = NovalnetHelper::getRedirectData($insert_id, $this->code); + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + xtc_redirect($response['result']['redirect_url']); + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Core Function : after_process() + * + */ + function after_process() { + global $order, $insert_id; + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ORDER_STATUS', '2', '6', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_SORT_ORDER', '22', '7', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ENDCUSTOMER_INFO', '', '8', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_paypal.php b/includes/modules/payment/novalnet_paypal.php new file mode 100644 index 0000000..271abc9 --- /dev/null +++ b/includes/modules/payment/novalnet_paypal.php @@ -0,0 +1,309 @@ +code = 'novalnet_paypal'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_TITLE : ''); + $this->info = (defined('MODULE_PAYMENT_NOVALNET_PAYPAL_ENDCUSTOMER_INFO') ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_PAYPAL_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS') && MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE') && MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE == 'true') ? true : false); + $this->tmpOrders = true; + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_PAYPAL_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_PAYPAL_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . '' . $this->info.'', + ]; + return $selection; + } + + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + return false; + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + global $order; + $post = $_REQUEST; + if (isset($post['tid'])) { + $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID']; + if ($post['status'] == 'SUCCESS') { // Success + if (NovalnetHelper::validateCheckSum($post)) { // Checksum success + NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code); + } else { // Checksum fail + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { // Failure + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post); + } + } + } + + /** + * Core Function : payment_action() + */ + function payment_action() { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $merchant_data = NovalnetHelper::getMerchantData(); + $customer_data = NovalnetHelper::getCustomerData(); + $transaction_data = NovalnetHelper::getTransactionData(); + $paypal_sheet_details = $this->paypal_sheet_details(); + $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code); + $custom_data = NovalnetHelper::getCustomData(); + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data, $paypal_sheet_details); + $params['transaction']['return_url'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']; + $params['transaction']['error_return_url'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']; + $params['transaction']['order_no' ] = $insert_id; + if ((defined('MODULE_PAYMENT_NOVALNET_PAYPAL_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_PAYPAL_AUTHENTICATE == 'true') + && NovalnetHelper::getOrderAmount($order->info['total']) >= (defined('MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT : '')) { // Authorize transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize')); + } else { // Captue transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + } + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + xtc_redirect($response['result']['redirect_url']); + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Core Function : after_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function after_process() { + return false; + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_AUTHENTICATE','false', '7' ,'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT', '', '8', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_ORDER_STATUS', '2', '9', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER', '17', '10', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_ENDCUSTOMER_INFO', '', '11', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code, true); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_AUTHENTICATE', + 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT', + 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_ENDCUSTOMER_INFO', + ); + } + + /** + * Paypal sheet details + * + * @return $data + */ + function paypal_sheet_details() { + global $order; + foreach ($order->products as $products){ + foreach ($products['attributes'] as $attr => $value) { + $attributes[] = ', ' . $value['option'] . ':' . $value['value']; + } + if ($products['product_type'] == 1) { + $product_type = 'physical'; + } else { + $product_type = 'digital'; + } + $productId = str_split($products['id']); + $product_desc = xtc_db_fetch_array(xtc_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id = '" . $_SESSION['languages_id'] . "' and products_id = '" . $productId[0] . "'")); + $data['cart_info']['line_items'][] = array( + 'name' => $products['name']. ' x ' .$products['qty'] . $attributes, + 'price' => (string) (round((float) $products['price'] * 100)), + 'quantity' => $products['qty'], + 'description' => !empty($product_desc['products_description']) ? $product_desc['products_description'] : '', + 'category' => $product_type, + ); + + } + $order_total = xtc_db_fetch_array(xtc_db_query("SELECT value FROM " . TABLE_ORDERS_TOTAL . " where class = 'ot_discount' AND orders_id = " . $_SESSION['tmp_oID'])); + if (!empty($order_total)) { + $discount_amount = (string) (round((float) $order_total['value'] * 100)); + $data['cart_info']['line_items'][] = array( + 'name' => 'Discount', + 'price' => $discount_amount, + 'quantity' => 1, + 'description' => '', + 'category' => '', + ); + } + $data['cart_info']['items_tax_price'] = (string) (round((float) $order->info['tax'] * 100)); + $data['cart_info']['items_shipping_price'] = (string) (round((float) $order->info['shipping_cost'] * 100)); + return $data; + } +} + diff --git a/includes/modules/payment/novalnet_postfinance.php b/includes/modules/payment/novalnet_postfinance.php new file mode 100644 index 0000000..5b4b2ba --- /dev/null +++ b/includes/modules/payment/novalnet_postfinance.php @@ -0,0 +1,245 @@ +code = 'novalnet_postfinance'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_POSTFINANCE_TEXT_TITLE : ''); + $this->info = (defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_ENDCUSTOMER_INFO') ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_POSTFINANCE_ENDCUSTOMER_INFO)) : ''); + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_POSTFINANCE_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_POSTFINANCE_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_STATUS') && MODULE_PAYMENT_NOVALNET_POSTFINANCE_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_TEST_MODE') && MODULE_PAYMENT_NOVALNET_POSTFINANCE_TEST_MODE == 'true') ? true : false); + $this->tmpOrders = true; + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_POSTFINANCE_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_POSTFINANCE_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + return false; + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + $post = $_REQUEST; + if (isset($post['tid'])) { + $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID']; + if ($post['status'] == 'SUCCESS') { // Success + if (NovalnetHelper::validateCheckSum($post)) { // Checksum success + NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code); + } else { // Checksum fail + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { // Failure + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post); + } + } + } + + /** + * Core Function : payment_action() + */ + function payment_action() { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $response = NovalnetHelper::getRedirectData($insert_id, $this->code); + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + xtc_redirect($response['result']['redirect_url']); + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Core Function : after_process() + * + */ + function after_process() { + global $order, $insert_id; + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_ORDER_STATUS', '2', '6', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_SORT_ORDER', '19', '7', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_ENDCUSTOMER_INFO', '', '8', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_postfinance_card.php b/includes/modules/payment/novalnet_postfinance_card.php new file mode 100644 index 0000000..af64ff7 --- /dev/null +++ b/includes/modules/payment/novalnet_postfinance_card.php @@ -0,0 +1,244 @@ +code = 'novalnet_postfinance_card'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_TEXT_TITLE : ''); + $this->info = (defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ENDCUSTOMER_INFO)) : ''; + $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_STATUS') && MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_TEST_MODE') && MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_TEST_MODE == 'true') ? true : false); + $this->tmpOrders = true; + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + return false; + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + $post = $_REQUEST; + if (isset($post['tid'])) { + $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID']; + if ($post['status'] == 'SUCCESS') { // Success + if (NovalnetHelper::validateCheckSum($post)) { // Checksum success + NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code); + } else { // Checksum fail + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { // Failure + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post); + } + } + } + + /** + * Core Function : payment_action() + */ + function payment_action() { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $response = NovalnetHelper::getRedirectData($insert_id, $this->code); + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + xtc_redirect($response['result']['redirect_url']); + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Core Function : after_process() + * + */ + function after_process() { + global $order, $insert_id; + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ORDER_STATUS', '2', '6', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_SORT_ORDER', '18', '7', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ENDCUSTOMER_INFO', '', '8', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_prepayment.php b/includes/modules/payment/novalnet_prepayment.php new file mode 100644 index 0000000..77b0d27 --- /dev/null +++ b/includes/modules/payment/novalnet_prepayment.php @@ -0,0 +1,248 @@ +code = 'novalnet_prepayment'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TITLE : ''); + $this->info = (defined('MODULE_PAYMENT_NOVALNET_PREPAYMENT_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_PREPAYMENT_ENDCUSTOMER_INFO)) : ''; + $this->sort_order = (defined('MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER) != '') ? trim(MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS') && MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE') && MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE == 'true') ? true : false); + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_PREPAYMENT_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_PREPAYMENT_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { + unset($_SESSION['payment']); + } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + global $order; + if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') { + $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2))); + } else { + $_SESSION['novalnet']['payment_amount'] = $order->info['total']; + } + } + + /** + * Core Function : process_button() + * + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function before_process() { + global $order; + $merchant_data = NovalnetHelper::getMerchantData(); + $customer_data = NovalnetHelper::getCustomerData(); + $transaction_data = NovalnetHelper::getTransactionData(); + $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code); + $due_date_in_days = defined('MODULE_PAYMENT_NOVALNET_PREPAYMENT_DUE_DATE') ? MODULE_PAYMENT_NOVALNET_PREPAYMENT_DUE_DATE : ''; + if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) { + $transaction_data['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days); + } + $custom_data = NovalnetHelper::getCustomData(); + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + if ($response['result']['status'] == 'SUCCESS') { + $_SESSION['response'] = $response; + } else { + $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : ''); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false)); + } + unset($_SESSION['novalnet']['payment_amount']); + $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']); + } + + /** + * Core Function : after_process() + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function after_process() { + global $order, $insert_id; + $order->info['comments'] .= PHP_EOL. MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT .PHP_EOL; + $order->info['comments'] .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 1, ('TID ' . $_SESSION['response']['transaction']['tid'])) . PHP_EOL; + $order->info['comments'] .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, ('BNR-' . MODULE_PAYMENT_NOVALNET_PROJECT_ID . '-' . $insert_id)) . PHP_EOL; + NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code); + NovalnetHelper::sendTransactionUpdate($insert_id); + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_DUE_DATE', '', '6', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_ORDER_STATUS', '1', '7', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_CALLBACK_ORDER_STATUS', '2', '8', 'order-status', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER', '6', '9', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_ENDCUSTOMER_INFO', '', '10', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_DUE_DATE', + 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_CALLBACK_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_przelewy24.php b/includes/modules/payment/novalnet_przelewy24.php new file mode 100644 index 0000000..bdd1324 --- /dev/null +++ b/includes/modules/payment/novalnet_przelewy24.php @@ -0,0 +1,246 @@ +code = 'novalnet_przelewy24'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_PRZELEWY24_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_PRZELEWY24_TEXT_TITLE : ''); + $this->info = (defined('MODULE_PAYMENT_NOVALNET_PRZELEWY24_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_PRZELEWY24_ENDCUSTOMER_INFO)) : ''; + $this->sort_order = (defined('MODULE_PAYMENT_NOVALNET_PRZELEWY24_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_PRZELEWY24_SORT_ORDER) != '') ? trim(MODULE_PAYMENT_NOVALNET_PRZELEWY24_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_PRZELEWY24_STATUS') && MODULE_PAYMENT_NOVALNET_PRZELEWY24_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_PRZELEWY24_TEST_MODE') && MODULE_PAYMENT_NOVALNET_PRZELEWY24_TEST_MODE == 'true') ? true : false); + $this->tmpOrders = true; + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_PRZELEWY24_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_PRZELEWY24_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { + unset($_SESSION['payment']); + } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + return false; + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + $post = $_REQUEST; + if (isset($post['tid'])) { + $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID']; + if ($post['status'] == 'SUCCESS') { // Success + if (NovalnetHelper::validateCheckSum($post)) { // Checksum success + NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code); + } else { // Checksum fail + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { // Failure + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post); + } + } + } + + /** + * Core Function : payment_action() + */ + function payment_action() { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $response = NovalnetHelper::getRedirectData($insert_id, $this->code); + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + xtc_redirect($response['result']['redirect_url']); + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Core Function : after_process() + */ + function after_process() { + global $order, $insert_id; + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_ORDER_STATUS', '2', '6', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_SORT_ORDER', '15', '7', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_ENDCUSTOMER_INFO', '', '8', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_sepa.php b/includes/modules/payment/novalnet_sepa.php new file mode 100644 index 0000000..11529a7 --- /dev/null +++ b/includes/modules/payment/novalnet_sepa.php @@ -0,0 +1,404 @@ +code = 'novalnet_sepa'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_SEPA_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_SEPA_TEXT_TITLE : ''); + $this->info = (defined('MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO)) : ''; + $this->sort_order = (defined('MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER) != '') ? trim(MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_SEPA_STATUS == 'true') ? true : false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE') && MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE == 'true') ? true : false); + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation () + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection () + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { + unset($_SESSION['payment']); + } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => '' . NovalnetHelper::showSepaDescription($this->code) . $this->info + .'' + .'', + ]; + $bic_field = ['title' => '' + ]; + $payment_details = xtc_db_query("SELECT payment_details, id FROM novalnet_transaction_detail WHERE customer_id='" . xtc_db_input($_SESSION['customer_id']) . "' AND payment_details !='' AND payment_type in ('DIRECT_DEBIT_SEPA', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'INSTALMENT_DIRECT_DEBIT_SEPA') AND status IN ('CONFIRMED', 'ON_HOLD') ORDER BY id DESC LIMIT 10"); + $saved_card_details = []; + $count = 0; + while ($payment_detail = xtc_db_fetch_array($payment_details)) { + $decode_details = json_decode($payment_detail['payment_details'], true); + if (empty($decode_details['iban'])) { + continue; + } + $decode_details['id'] = $payment_detail['id']; + $saved_card_details[$count] = $decode_details; + $count++; + }; + unset($_SESSION['saved_card_details']); + if (defined('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION == 'true') { + if (!empty($saved_card_details)) { + $payment_data = []; + foreach ($saved_card_details as $key => $value) { + if (empty($value['iban']) || in_array($value['iban'], $payment_data)) { + continue; + } + if (empty($value)) { + continue; + } + if(!empty($_SESSION['saved_card_details']) || !empty($saved_card_details)){ + unset($_SESSION['saved_card_details']); + $_SESSION['saved_card_details'] = $saved_card_details; + } + $oneclick = (!empty($saved_card_details)) ? ''.sprintf(('IBAN %s'),$value['iban']) . '  Delete' : ''; + if(!empty($value['iban'])){ + $selection['fields'][] = [ 'title' => $oneclick ]; + } + array_push($payment_data, $value['iban']); + } + $selection['fields'][] = [ 'title' => ''.MODULE_PAYMENT_NOVALNET_SEPA_NEW_ACCOUNT_DETAILS.'']; + $selection['fields'][] = ['title' => ''. xtc_draw_input_field('novalnet_sepa_iban', '', 'id="novalnet_sepa_iban_field" style="display:none;" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');"'), + ]; + $selection['fields'][] = $bic_field; + $selection['fields'][] = [ + 'title' => '', + ]; + } + }else{ + $selection['fields'][] = [ + 'title' => MODULE_PAYMENT_NOVALNET_SEPA_IBAN. xtc_draw_input_field('novalnet_sepa_iban', '', 'id="novalnet_sepa_iban_field" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');"'), + ]; + $selection['fields'][] = $bic_field; + } + if ((defined('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION == 'true') && empty($saved_card_details)) { + $selection['fields'][] = [ + 'title' => MODULE_PAYMENT_NOVALNET_SEPA_IBAN. xtc_draw_input_field('novalnet_sepa_iban', '', 'id="novalnet_sepa_iban_field" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');"'), + ]; + $selection['fields'][] = $bic_field; + $selection['fields'][] = [ + 'title' => '
'.xtc_draw_checkbox_field('nn_sepa_checkbox', 1 , false, 'id="novalnet_sepa_onclick"')." ".MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS.'
', + ]; + } + + if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS == 'true') { + if ($this->proceedToGuranteePayment()) { + $proceed_to_sepa = false; + } elseif (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE == 'true') { + $proceed_to_sepa = true; + } + } else { + $proceed_to_sepa = true; + } + + if ($proceed_to_sepa) { + return $selection; + } + + return false; + } + + /** + * Core Function : pre_confirmation_check () + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + if(isset($_REQUEST['novalnet_sepa']) && $_REQUEST['novalnet_sepa'] == 'new' || !empty($_SESSION['novalnet_sepa'])){ + unset($_SESSION['novalnet_sepa']); + $_SESSION['novalnet_sepa'] = $_REQUEST['novalnet_sepa']; + } + if (!empty($_SESSION['novalnet_sepa_token']) || !empty($_SESSION['novalnet_sepa_create_token'])) { + unset($_SESSION['novalnet_sepa_token']); + unset($_SESSION['novalnet_sepa_create_token']); + } + + if (!empty($_REQUEST['novalnet_sepa']) && $_REQUEST['novalnet_sepa'] != 'new' && (defined('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION == 'true')) { + $_SESSION['novalnet_sepa_token'] = $_REQUEST['novalnet_sepa']; + } + else if (!empty($_REQUEST['novalnet_sepa_iban'])) { + $_SESSION['novalnet_sepa_iban'] = $_REQUEST['novalnet_sepa_iban']; + $_SESSION['novalnet_sepa_bic'] = !empty($_REQUEST['novalnet_sepa_bic']) ? $_REQUEST['novalnet_sepa_bic'] : ''; + if ((defined('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION == 'true') && !empty($_REQUEST['nn_sepa_checkbox'])) { + $_SESSION['novalnet_sepa_create_token'] = $_REQUEST['nn_sepa_checkbox']; + } + } else { + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' .MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR, 'SSL', true, false)); + } + } + + /** + * Core Function : confirmation () + * + * Displays confirmation page + */ + function confirmation() { + global $order; + if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') { + $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2))); + } else { + $_SESSION['novalnet']['payment_amount'] = $order->info['total']; + } + } + + /** + * Core Function : process_button () + * + * Payments redirects from shop to payment site (Note : if the payment is redirect) + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process () + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function before_process() { + global $order; + $merchant_data = NovalnetHelper::getMerchantData(); + $customer_data = NovalnetHelper::getCustomerData(); + $due_date_in_days = MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE; + $custom_data = NovalnetHelper::getCustomData(); + $transaction_data = NovalnetHelper::getTransactionData(); + $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code); + // Add token data if it's enabled + if((defined('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION == 'true')){ + if (!empty($_SESSION['saved_card_details']) && empty($_SESSION['novalnet_sepa'])) { + NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + $params['transaction']['payment_data']['token'] = $transaction_data['transaction']['payment_data']['token']; + }else if ((isset($_SESSION['novalnet_sepa']) && $_SESSION['novalnet_sepa'] == 'new')) { + NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); + $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data']; + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + } else { + NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); + $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data']; + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + } + } else { + NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); + $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data']; + $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data); + } + if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) { + $params['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days); + } + + if (!empty($params['transaction']['create_token'])) { + $params['custom']['input1'] = 'store_payment_data'; + $params['custom']['inputval1'] = 1; + } + if ((defined('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE == 'authorize') + && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT : ''))) { // Authorize transaction + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize')); + } else { // Captue or Zero-amount transaction + if (defined('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE == 'zero_amount') { + $params['transaction']['amount'] = 0; + $params['transaction']['create_token'] = 1; + } + $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment')); + } + if ($response['result']['status'] == 'SUCCESS') { + $_SESSION['response'] = $response; + } else { + $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : ''); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false)); + } + unset($_SESSION['novalnet']['payment_amount']); + $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']); + unset($_SESSION['novalnet_sepa_iban']); + unset($_SESSION['novalnet_sepa_token']); + unset($_SESSION['novalnet_sepa_create_token']); + unset($_SESSION['novalnet_sepa_bic']); + unset($_SESSION['novalnet_sepa']); + unset($_SESSION['saved_card_details']); + } + + /** + * Core Function : after_process () + * + * Send params to Novalnet server (Note : if the payment uses curl request) + */ + function after_process() { + global $order, $insert_id; + NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code); + NovalnetHelper::sendTransactionUpdate($insert_id); + } + + /** + * Core Function : get_error () + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check () + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install () + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION', 'true' , '6', 'switcher' , now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE', '', '7', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT', '', '8', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE', '', '9', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_ORDER_STATUS', '2', '10', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER', '1', '11', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO', '', '12', now())"); + } + + /** + * Core Function : remove () + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys () + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code, true); + $lang = (isset($_SESSION['language_code'])) ? strtoupper($_SESSION['language_code']) : 'DE'; + echo ''; + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION', + 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE', + 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT', + 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE', + 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO', + ); + } + + /** + * To Proceed and validate Guarantee payment basic requirements in checkout + * + * @return boolean + */ + function proceedToGuranteePayment() { + global $order; + $minimum_amount_gurantee = trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT) != '' ? MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT : '999'; + $country_check = NovalnetHelper::checkGuaranteeCountries(strtoupper($order->billing['country']['iso_code_2']),MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B, $order->billing['company']); + if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS == 'true') { + if (NovalnetHelper::getOrderAmount($order->info['total']) >= $minimum_amount_gurantee && $country_check + && $order->info['currency'] == 'EUR' && NovalnetHelper::isBillingShippingsame()) { + return true; + } + return false; + } + } +} + diff --git a/includes/modules/payment/novalnet_trustly.php b/includes/modules/payment/novalnet_trustly.php new file mode 100644 index 0000000..c5f2a0f --- /dev/null +++ b/includes/modules/payment/novalnet_trustly.php @@ -0,0 +1,245 @@ +code = 'novalnet_trustly'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_TRUSTLY_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_TRUSTLY_TEXT_TITLE : ''); + $this->info = (defined('MODULE_PAYMENT_NOVALNET_TRUSTLY_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_TRUSTLY_ENDCUSTOMER_INFO)) : ''; + $this->sort_order = (defined('MODULE_PAYMENT_NOVALNET_TRUSTLY_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_TRUSTLY_SORT_ORDER) != '') ?trim(MODULE_PAYMENT_NOVALNET_TRUSTLY_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_TRUSTLY_STATUS') && MODULE_PAYMENT_NOVALNET_TRUSTLY_STATUS == 'true') ? true :false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_TRUSTLY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_TRUSTLY_TEST_MODE == 'true') ?true : false); + $this->tmpOrders = true; + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_TRUSTLY_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_TRUSTLY_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } + elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + return false; + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + $post = $_REQUEST; + if (isset($post['tid'])) { + $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID']; + if ($post['status'] == 'SUCCESS') { // Success + if (NovalnetHelper::validateCheckSum($post)) { // Checksum success + NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code); + } else { // Checksum fail + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { // Failure + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post); + } + } + } + + /** + * Core Function : payment_action() + */ + function payment_action() { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $response = NovalnetHelper::getRedirectData($insert_id, $this->code); + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + xtc_redirect($response['result']['redirect_url']); + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Core Function : after_process() + * + */ + function after_process() { + global $order, $insert_id; + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_ORDER_STATUS', '2', '6', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_SORT_ORDER', '25', '7', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_ENDCUSTOMER_INFO', '', '8', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * @return array keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/includes/modules/payment/novalnet_wechatpay.php b/includes/modules/payment/novalnet_wechatpay.php new file mode 100644 index 0000000..0337db7 --- /dev/null +++ b/includes/modules/payment/novalnet_wechatpay.php @@ -0,0 +1,245 @@ +code = 'novalnet_wechatpay'; + $this->title = ((defined('MODULE_PAYMENT_NOVALNET_WECHATPAY_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_WECHATPAY_TEXT_TITLE : ''); + $this->info = (defined('MODULE_PAYMENT_NOVALNET_WECHATPAY_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_WECHATPAY_ENDCUSTOMER_INFO)) : ''; + $this->sort_order = (defined('MODULE_PAYMENT_NOVALNET_WECHATPAY_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_WECHATPAY_SORT_ORDER) != '') ?trim(MODULE_PAYMENT_NOVALNET_WECHATPAY_SORT_ORDER) : 0; + $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_WECHATPAY_STATUS') && MODULE_PAYMENT_NOVALNET_WECHATPAY_STATUS == 'true') ? true :false); + $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_WECHATPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_WECHATPAY_TEST_MODE == 'true') ? true : false); + $this->tmpOrders = true; + if (is_object($order)) { + $this->update_status(); + } + } + + /** + * Core Function : update_status() + * + * check if zone is allowed to see module + */ + function update_status() { + global $order; + if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_WECHATPAY_PAYMENT_ZONE > 0)) { + $check_flag = false; + $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_WECHATPAY_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id"); + while ($check = xtc_db_fetch_array($check_query)) { + if ($check['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check['zone_id'] == $order->delivery['zone_id']) { + $check_flag = true; + break; + } + } + if ($check_flag == false) { + $this->enabled = false; + } + } + return false; + } + + /** + * Core Function : javascript_validation() + * + * Javascript validation takes place + * @return boolean + */ + function javascript_validation() { + return false; + } + + /** + * Core Function : selection() + * + * Display checkout form in chekout payment page + * @return array + */ + function selection() { + if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false + || !NovalnetHelper::hidePaymentVisibility($this->code)) { + if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); } + return false; + } + $selection = [ + 'id' => $this->code, + 'module' => $this->title, + 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info, + ]; + return $selection; + } + + /** + * Core Function : pre_confirmation_check() + * + * Perform validations for post values + * @return boolean + */ + function pre_confirmation_check() { + return false; + } + + /** + * Core Function : confirmation() + * + * Displays confirmation page + * @return boolean + */ + function confirmation() { + return false; + } + + /** + * Core Function : process_button() + * + * Payments redirects from shop to payment site + */ + function process_button() { + return false; + } + + /** + * Core Function : before_process() + */ + function before_process() { + $post = $_REQUEST; + if (isset($post['tid'])) { + $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID']; + if ($post['status'] == 'SUCCESS') { // Success + if (NovalnetHelper::validateCheckSum($post)) { // Checksum success + NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code); + } else { // Checksum fail + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG); + } + } else { // Failure + NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post); + } + } + } + + /** + * Core Function : payment_action() + */ + function payment_action() { + global $insert_id; + if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) { + unset($_SESSION['nn_txn_secret']); + unset($_SESSION['nn_tempOID']); + } + $response = NovalnetHelper::getRedirectData($insert_id, $this->code); + if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) { + $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret']; + $_SESSION['nn_tempOID'] = $insert_id; + xtc_redirect($response['result']['redirect_url']); + } else { + NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response); + } + } + + /** + * Core Function : after_process() + * + */ + function after_process() { + global $order, $insert_id; + } + + /** + * Core Function : get_error() + * + * Show validation / error message + * @return array + */ + function get_error() { + if ($_GET['error']) { + $error = [ + 'title' => $this->code, + 'error' => stripslashes(urldecode($_GET['error'])) + ]; + return $error; + } + } + + /** + * Core Function : check() + * + * Checks for payment installation status + * @return boolean + */ + function check() { + if (!isset ($this->_check)) { + $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_STATUS'"); + $this->_check = xtc_db_num_rows($check_query); + } + return $this->_check; + } + + /** + * Core Function : install() + * + * Payment module installation + */ + function install() { + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_STATUS','false', '1', 'switcher',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_TEST_MODE','false', '2', 'switcher', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_ALLOWED', '', '3', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_PAYMENT_ZONE', '0', '4', 'geo-zone',now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_VISIBILITY_BY_AMOUNT', '', '5', now())"); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_ORDER_STATUS', '2', '6', 'order-status', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_SORT_ORDER', '24', '7', now()) "); + xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_ENDCUSTOMER_INFO', '', '8', now())"); + } + + /** + * Core Function : remove() + * + * Payment module uninstallation + */ + function remove() { + xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')"); + } + + /** + * Core Function : keys() + * + * Return keys to display in payment configuration (Backend) + */ + function keys() { + NovalnetHelper::includeAdminJS($this->code); + return array( + 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_TEST_MODE', + 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_ALLOWED', + 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_PAYMENT_ZONE', + 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_VISIBILITY_BY_AMOUNT', + 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_ORDER_STATUS', + 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_SORT_ORDER', + 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_ENDCUSTOMER_INFO', + ); + } +} + diff --git a/lang/english/modules/payment/novalnet.php b/lang/english/modules/payment/novalnet.php new file mode 100644 index 0000000..f6df01f --- /dev/null +++ b/lang/english/modules/payment/novalnet.php @@ -0,0 +1,133 @@ +I hereby grant the mandate for the SEPA direct debit (electronic transmission) and confirm that the given bank details are correct!'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ABOUT_MANDATE_TEXT','

I authorise (A) Novalnet AG to send instructions to my bank to debit my account and (B) my bank to debit my account in accordance with the instructions from Novalnet AG.
Creditor identifier: DE53ZZZ00000004253
Note:
You are entitled to a refund from your bank under the terms and conditions of your agreement with bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited.
'); +define('MODULE_PAYMENT_NOVALNET_AMOUNT_TRANSFER_NOTE_DUE_DATE', 'Please transfer the amount of %1$s to the following account on or before %2$s'); +define('MODULE_PAYMENT_NOVALNET_AMOUNT_TRANSFER_NOTE', 'Please transfer the amount of %s to the following account.'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_TRANSFER_NOTE_DUE_DATE', 'Please transfer the instalment cycle amount of %1$s to the following account on or before %2$s'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_TRANSFER_NOTE', 'Please transfer the instalment cycle amount of %1$s to the following account.'); +define('MODULE_PAYMENT_NOVALNET_MULTIBANCO_NOTE', 'Please use the following payment reference details to pay the amount of %s at a Multibanco ATM or through your internet banking.'); +define('MODULE_PAYMENT_NOVALNET_BANK_NAME', ' Bank: '); +define('MODULE_PAYMENT_NOVALNET_IBAN','IBAN: '); +define('MODULE_PAYMENT_NOVALNET_BIC', ' BIC: '); +define('MODULE_PAYMENT_NOVALNET_ACCOUNT_HOLDER','Account holder: '); +define('MODULE_PAYMENT_NOVALNET_AMOUNT', ' Amount: '); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_MODE', 'Test order'); +define('MODULE_PAYMENT_NOVALNET_BANK_PLACE', 'Place: '); +define('MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR', 'Your account details are invalid'); +define('MODULE_PAYMENT_NOVALNET_TRANSACTION_ID', 'Novalnet transaction ID: '); +define('MODULE_PAYMENT_NOVALNET_TRANS_SLIP_EXPIRY_DATE', 'Slip expiry date : '); +define('MODULE_PAYMENT_NOVALNET_NEAREST_STORE_DETAILS', 'Store(s) near to you: '); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT', 'Please use any of the following payment references when transferring the amount. This is necessary to match it with your corresponding order'); +define('MODULE_PAYMENT_NOVALNET_CONFIRM_TEXT','Confirm'); +define('MODULE_PAYMENT_NOVALNET_REFUND_TEXT','Refund'); +define('MODULE_PAYMENT_NOVALNET_CANCEL_TEXT','Cancel'); +define('MODULE_PAYMENT_NOVALNET_TRANSACTION_ERROR', 'Payment was not successful. An error occured.'); +define('MODULE_PAYMENT_NOVALNET_SELECT_STATUS_OPTION', '--Select--'); +define('MODULE_PAYMENT_NOVALNET_TRANS_CONFIRM_SUCCESSFUL_MESSAGE', 'The transaction has been confirmed on %1$s'); +define('MODULE_PAYMENT_NOVALNET_TRANS_DEACTIVATED_MESSAGE', 'The transaction has been cancelled on %1$s'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCELED_MESSAGE', 'The transaction has been cancelled for the %1$s on %2$s %3$s'); +define('MODULE_PAYMENT_NOVALNET_AMOUNT_EX', ' (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'); +define('MODULE_PAYMENT_NOVALNET_REFUND_PARENT_TID_MSG', 'Refund has been initiated for the TID: %1$s with the amount of %2$s.'); +define('MODULE_PAYMENT_NOVALNET_REFUND_CHILD_TID_MSG', 'New TID:%s for the refunded amount'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_TEXT', ' (Net loan amount: )'); +define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_CYCLES_FRONTEND', 'INSTALMENT CYCLES  '); +define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_AMOUNT_FRONTEND', 'INSTALMENT AMOUNT'); +define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_PER_MONTH_FRONTEND', 'per month'); +define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_PER_MONTH_CYCLE', '%s Cycles/'); +define('MODULE_PAYMENT_GUARANTEE_PAYMENT_DOB_EMPTY_ERROR_MESSAGE', 'Please enter your date of birth'); +define('MODULE_PAYMENT_GUARANTEE_PAYMENT_AGE_ERROR_MESSAGE', 'You need to be at least 18 years old'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SUMMARY_BACKEND', 'Instalment summary'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCEL_ADMIN_TEXT','Instalment cancel'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_BACKEND', 'Amount'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_DATE_BACKEND', 'Date'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_BACKEND', 'Status'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_REFERENCE_BACKEND', 'Novalnet Transaction ID'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCEL_TEXT', 'Cancel'); +define('MODULE_PAYMENT_NOVALNET_MENTION_GUARANTEE_PAYMENT_PENDING_TEXT', 'Your order is under verification and we will soon update you with the order status. Please note that this may take upto 24 hours.'); +define('MODULE_PAYMENT_NOVALNET_VALID_MERCHANT_CREDENTIALS_ERROR','Please fill in the required fields'); +define('MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_TITLE','Novalnet API Configuration (V_12.0.3)'); +define('MODULE_PAYMENT_GUARANTEE_DOB_FIELD','Your date of birth *'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_FORMAT','DD.MM.YYYY'); +define('MODULE_PAYMENT_NOVALNET_TESTMODE','Test mode'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE', 'Payment Reference %1$s: %2$s'); +define('NOVALNET_WEBHOOK_CREDIT_NOTE','Credit has been successfully received for the TID: %1$s with amount %2$s on %3$s. Please refer PAID order details in our Novalnet Admin Portal for the TID: %4$s'); +define('NOVALNET_WEBHOOK_CHARGEBACK_NOTE','Chargeback executed successfully for the TID: %1$s amount: %2$s on %3$s %4$s . The subsequent TID: %5$s'); +define('NOVALNET_WEBHOOK_NEW_INSTALMENT_NOTE','A new instalment has been received for the Transaction ID: %1$s with amount %2$s on %3$s. The new instalment transaction ID is: %4$s'); +define('NOVALNET_WEBHOOK_INSTALMENT_CANCEL_NOTE','Instalment has been cancelled for the TID: %1$s on %2$s'); +define('NOVALNET_WEBHOOK_TRANSACTION_UPDATE_NOTE_DUE_DATE','Transaction updated successfully for the TID: %1$s with amount %2$s and due date %3$s.'); +define('NOVALNET_WEBHOOK_TRANSACTION_UPDATE_NOTE','Transaction updated successfully for the TID: %1$s with amount %2$s.'); +define('NOVALNET_PAYMENT_REMINDER_NOTE','Payment Reminder %1$s has been sent to the customer.'); +define('NOVALNET_COLLECTION_SUBMISSION_NOTE','The transaction has been submitted to the collection agency. Collection Reference: %1$s'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE', 'Enter your date of birth'); + +define('MODULE_PAYMENT_NOVALNET_PARTNER_PAYMENT_REFERENCE', 'Partner Payment Reference: %s'); +define('MODULE_PAYMENT_NOVALNET_ERROR_MSG', 'Check hash failed'); +define('MODULE_PAYMENT_NOVALNET_TRANS_CONFIRM_TITLE','Manage Transaction'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_CAPTURE_CONFIRM','Are you sure you want to capture the payment?'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_VOID_CONFIRM','Are you sure you want to cancel the payment?'); +define('MODULE_PAYMENT_NOVALNET_SELECT_STATUS_TEXT', 'Please select status'); +define('MODULE_PAYMENT_NOVALNET_BACK_TEXT', 'Back'); +define('MODULE_PAYMENT_NOVALNET_REFUND_TITLE', 'Refund process'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_REFUND_CONFIRM', 'Are you sure you want to refund the amount'); +define('MODULE_PAYMENT_NOVALNET_REFUND_REFERENCE_TEXT', 'Refund reference'); +define('MODULE_PAYMENT_NOVALNET_REFUND_AMT_TITLE', 'Please enter the refund amound'); +define('MODULE_PAYMENT_NOVALNET_REFUND_REASON_TITLE', 'Reason for refund (optional)'); +define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_FRONTEND', 'Instalment'); +define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_TEXT', 'Choose your installment plan (Net loan amount: %s )'); +define('SUCCESS_ORDER_UPDATED', 'Success'); + +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INSTALMENTS_INFO','Instalment information'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_PROCESSED_INSTALMENTS','Processed instalments: '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_DUE_INSTALMENTS','Due instalments: '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_INSTALMENT_AMOUNT','Next instalment amount: '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_INSTALMENT_DATE','Next instalment date: '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_PAY_DATE_BACKEND','Paid date'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_DATE_BACKEND','Next instalment date'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_PAID_DATE_BACKEND','Paid on'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_PAID','Paid'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_PENDING','Pending'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_REFUNDED','Refunded'); +define('WARNING_ORDER_NOT_UPDATED', 'Warning'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_ERROR_MSG','Enter valid date of birth'); +define('MODULE_PAYMENT_NOVALNET_ORDER_MAIL_SUBJECT', 'Your Order %s, %s, %s'); +define('MODULE_PAYMENT_NOVALNET_ORDER_CAPTURE_MAIL_SUBJECT', 'Order Confirmation - Your Order %s with Gambio has been confirmed!'); + +define('MODULE_PAYMENT_GUARANTEE_PAYMENT_MAIL_SUBJECT','Order Confirmation - Your Order %s with %s has been confirmed!'); +define( +'MODULE_PAYMENT_NOVALNET_SEPA_MANDATE_NOTICE', +'

I authorise (A) die Novalnet AG, meiner Bank die Weisung zu erteilen, mein Konto zu belasten und (B) meine Bank, mein Konto entsprechend der Weisung der Novalnet AG zu belasten.
Gläubiger-Identifikator: DE53ZZZ00000004253
Note:Sie haben Anspruch auf eine Erstattung durch Ihre Bank gemäß den Bedingungen Ihres Vertrags mit der Bank. Eine Erstattung muss innerhalb von 8 Wochen ab dem Datum der Abbuchung von Ihrem Konto beantragt werden.

' +); +define('MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS', 'Save for future purchase'); +define('MODULE_PAYMENT_NOVALNET_SEPA_NEW_ACCOUNT_DETAILS', 'Use a new payment method'); +define('MODULE_PAYMENT_NOVALNET_SEPA_IBAN', 'IBAN *'); +define('MODULE_PAYMENT_NOVALNET_BOOK_TITLE','Book transaction'); +define('MODULE_PAYMENT_NOVALNET_BOOK_AMT_TITLE','Transaction booking amount'); +define('MODULE_PAYMENT_NOVALNET_TRANS_BOOKED_MESSAGE','Your order has been booked with the amount of %s. Your new TID for the booked amount: %s'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_ZERO_AMOUNT_BOOK_CONFIRM','Are you sure you want to book the order amount?'); +define('MODULE_PAYMENT_NOVALNET_AMOUNT_ERROR_MESSAGE','The amount is invalid'); +define('MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_MESSAGE','This order processed as a zero amount booking'); + +define('MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_TEXT','

This order will be processed as zero amount booking which store your payment data for further online purchases.'); +?> + diff --git a/lang/english/modules/payment/novalnet_alipay.php b/lang/english/modules/payment/novalnet_alipay.php new file mode 100644 index 0000000..1d38830 --- /dev/null +++ b/lang/english/modules/payment/novalnet_alipay.php @@ -0,0 +1,21 @@ + diff --git a/lang/english/modules/payment/novalnet_applepay.php b/lang/english/modules/payment/novalnet_applepay.php new file mode 100644 index 0000000..47abbc7 --- /dev/null +++ b/lang/english/modules/payment/novalnet_applepay.php @@ -0,0 +1,41 @@ +
Authorize'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_MANUAL_CHECK_LIMIT_DESC','In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_TYPE_TITLE','

Button Design

Style for Apple pay button
Button Type'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_THEME_TITLE','Button Theme'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_HEIGHT_TITLE','Button Height'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_HEIGHT_DESC','Range from 30 to 64 pixels'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS_TITLE','Button Corner Radius'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS_DESC','Range from 1 to 10 pixels'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY_TITLE','Display the Apple Pay Button on'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY_DESC','The selected pages will display the Apple pay button to pay instantly as an express checkout button'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ALLOWED_TITLE','Allowed zone(-s)'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ALLOWED_DESC','This payment method will be allowed for the mentioned zone(-s). Enter the zone(-s) in the following format E.g: DE, AT, CH. In case if the field is empty, all the zones will be allowed.'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_PAYMENT_ZONE_TITLE','Payment zone'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_PAYMENT_ZONE_DESC','If a zone is selected, only enable this payment method for that zone.'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO_TITLE','Notification for the buyer'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_TEXT_INFO','Amount will be booked from your card after successful authentication'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_PUBLIC_TITLE', xtc_image(DIR_WS_ICONS.'novalnet/novalnet_applepay.png', 'Applepay')); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Minimum order amount'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'); +define('ERROR_CHECKOUT_SHIPPING_NO_MODULE','No shipping'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME_TITLE','Business name'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME_DESC','The business name is rendered in the Apple Pay payment sheet, and this text will appear as PAY "BUSINESS NAME" so that the customer knows where he is paying to'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Minimum order amount'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'); +?> diff --git a/lang/english/modules/payment/novalnet_bancontact.php b/lang/english/modules/payment/novalnet_bancontact.php new file mode 100644 index 0000000..93ec9fd --- /dev/null +++ b/lang/english/modules/payment/novalnet_bancontact.php @@ -0,0 +1,21 @@ + diff --git a/lang/english/modules/payment/novalnet_cashpayment.php b/lang/english/modules/payment/novalnet_cashpayment.php new file mode 100644 index 0000000..112369d --- /dev/null +++ b/lang/english/modules/payment/novalnet_cashpayment.php @@ -0,0 +1,25 @@ + diff --git a/lang/english/modules/payment/novalnet_cc.php b/lang/english/modules/payment/novalnet_cc.php new file mode 100644 index 0000000..78c2df1 --- /dev/null +++ b/lang/english/modules/payment/novalnet_cc.php @@ -0,0 +1,54 @@ +
Label'); +define('MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_INPUT_TITLE','Input'); +define('MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_INPUT_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_CC_CSS_TEXT_TITLE','CSS Text'); +define('MODULE_PAYMENT_NOVALNET_CC_CSS_TEXT_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE_TITLE','Payment action'); +define('MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE_DESC','Choose whether or not the payment should be charged immediately.'); +define('MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization'); +define('MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).'); +define('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION_TITLE','One click shopping'); +define('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION_DESC','Payment details stored during the checkout process can be used for future payments'); +define('MODULE_PAYMENT_NOVALNET_CC_SAVE_CARD_DETAILS', 'Save for future purchase'); +define('MODULE_PAYMENT_NOVALNET_CC_NEW_ACCOUNT_DETAILS', 'Use a new payment method'); +define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_ERROR', 'Your credit card details are invalid'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_HOLDER','Card holder name'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_NO','Card number'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_VALID_DATE','Expiry date'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_CVC','CVC/CVV/CID'); +define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_HOLDER_INPUT_TEXT','Name on card'); +define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_NUMBER_INPUT_TEXT','XXXX XXXX XXXX XXXX'); +define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_CVC_INPUT_TEXT','XXX'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_HOLDER_ERROR','Please enter the valid card holder name'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_NO_ERROR','Please enter the valid card number'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_VALID_DATE_ERROR','Please enter the valid expiry month / year in the given format'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_CVC_ERROR','Please enter the valid CVC/CVV/CID'); +define('MODULE_PAYMENT_NOVALNET_CC_TOKEN_TEXT','%1$s ending in %2$s ( expires %3$s/%4$s )'); +?> diff --git a/lang/english/modules/payment/novalnet_config.php b/lang/english/modules/payment/novalnet_config.php new file mode 100644 index 0000000..746e3a8 --- /dev/null +++ b/lang/english/modules/payment/novalnet_config.php @@ -0,0 +1,24 @@ + +Please read the Installation Guide before you start and login to the Novalnet Admin Portal using your merchant account. To get a merchant account, mail to sales@novalnet.de or call +49 (089) 923068320

'); +define('MODULE_PAYMENT_NOVALNET_SIGNATURE_TITLE', 'Product activation key'); +define('MODULE_PAYMENT_NOVALNET_SIGNATURE_DESC', 'Get your Product activation key from the Novalnet Admin Portal Project > Choose your project > API credentials >API Signature (Product activation key)'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY_TITLE', 'Payment access key'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY_DESC', 'Get your Payment access key from the Novalnet Admin Portal Project > Choose your project > API credentials >Payment access key'); +define('MODULE_PAYMENT_NOVALNET_TARIFF_ID_TITLE', 'Select Tariff ID'); +define('MODULE_PAYMENT_NOVALNET_TARIFF_ID_DESC', 'Select a Tariff ID to match the preferred tariff plan you created at the Novalnet Admin Portal for this project'); +define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE_TITLE', '

Order status management for on-hold transactions

Onhold order status'); +define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE_DESC', 'Status to be used for on-hold orders until the transaction is confirmed or canceled'); +define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED_TITLE', 'Canceled order status'); +define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED_DESC', 'Status to be used when order is canceled or fully refunded'); +define('MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE_TITLE', '

Notification / Webhook URL Setup


Allow manual testing of the Notification / Webhook URL'); +define('MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE_DESC', 'Enable this to test the Novalnet Notification / Webhook URL manually. Disable this before setting your shop live to block unauthorized calls from external parties'); +define('MODULE_PAYMENT_NOVALNET_CALLBACK_URL_TITLE', 'Notification / Webhook URL'); +define('MODULE_PAYMENT_NOVALNET_CALLBACK_URL_DESC', 'You must configure the webhook endpoint in your Novalnet Admin Portal. This will allow you to receive notifications about the transaction'); +define('MODULE_PAYMENT_NOVALNET_CLIENT_KEY_TITLE', 'Client key'); +define('MODULE_PAYMENT_NOVALNET_PROJECT_ID_TITLE', 'Project ID'); +define('MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO_TITLE', '
Send e-mail to'); +define('MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO_DESC', 'Notification / Webhook URL execution messages will be sent to this e-mail'); +?> diff --git a/lang/english/modules/payment/novalnet_eps.php b/lang/english/modules/payment/novalnet_eps.php new file mode 100644 index 0000000..3254fec --- /dev/null +++ b/lang/english/modules/payment/novalnet_eps.php @@ -0,0 +1,21 @@ + diff --git a/lang/english/modules/payment/novalnet_giropay.php b/lang/english/modules/payment/novalnet_giropay.php new file mode 100644 index 0000000..a626cb3 --- /dev/null +++ b/lang/english/modules/payment/novalnet_giropay.php @@ -0,0 +1,21 @@ + diff --git a/lang/english/modules/payment/novalnet_googlepay.php b/lang/english/modules/payment/novalnet_googlepay.php new file mode 100644 index 0000000..73376d1 --- /dev/null +++ b/lang/english/modules/payment/novalnet_googlepay.php @@ -0,0 +1,42 @@ +
Authorize'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT_DESC','In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE_TITLE','

Button Design

Style for Google pay button
Button Type'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_THEME_TITLE','Button Theme'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT_TITLE','Button Height'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT_DESC','Range from 30 to 64 pixels'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY_TITLE','Display the Google Pay Button on'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY_DESC','The selected pages will display the Google pay button to pay instantly as an express checkout button'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ALLOWED_TITLE','Allowed zone(-s)'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ALLOWED_DESC','This payment method will be allowed for the mentioned zone(-s). Enter the zone(-s) in the following format E.g: DE, AT, CH. In case if the field is empty, all the zones will be allowed.'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE_TITLE','Payment zone'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE_DESC','If a zone is selected, only enable this payment method for that zone.'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEXT_INFO','Amount will be booked from your card after successful authentication'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PUBLIC_TITLE', xtc_image(DIR_WS_ICONS.'novalnet/novalnet_googlepay.png', "Googlepay ")); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Minimum order amount'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO_TITLE','Notification for the buyer'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME_TITLE','Business name'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME_DESC','The business name is rendered in the Google Pay payment sheet, and this text will appear as PAY "BUSINESS NAME" so that the customer knows where he is paying to'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE_TITLE','Enforce 3D secure payment outside EU'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE_DESC','By enabling this option, all payments from cards issued outside the EU will be authenticated via 3DS 2.0 SCA.'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID_TITLE','Google Merchant ID'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID_DESC','Please note that Google merchant identifier is required for processing the payment method in the live environment. Google merchant identifier is issued after registration with the Google Pay and Wallet Console. See Request production access for more information about the approval process and obtaining a Google merchant identifier. The registration also involves submitting the integration with sufficient screen-shots, so collect this information by enabling the payment method in test mode. To suppress the validation of this field while saving the configuration, use this test identifier BCR2DN4XXXTN7FSI for testing and submission of your integration to Google.'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Minimum order amount'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'); +?> diff --git a/lang/english/modules/payment/novalnet_guarantee_invoice.php b/lang/english/modules/payment/novalnet_guarantee_invoice.php new file mode 100644 index 0000000..ea95436 --- /dev/null +++ b/lang/english/modules/payment/novalnet_guarantee_invoice.php @@ -0,0 +1,30 @@ +Payment guarantee configuration

Basic requirements:

Allowed B2C countries: Germany, Austria, Switzerland
Allowed B2B countries: European Union
Allowed currency: €
Minimum order amount: 9,99 € or more
Age limit: 18 years or more
The billing address must be the same as the shipping address'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT_TITLE','Minimum order amount'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE_TITLE','Force Non-guarantee payment'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO_TITLE','Notification for the buyer'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE_DESC','Even if payment guarantee is enabled, payments will still be processed as non-guarantee payments if the payment guarantee requirements are not met. Review the requirements under "Enable Payment Guarantee" in the Installation Guide.'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B_TITLE','Allow B2B Customers'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B_DESC','Allow B2B customers to place order'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE_TITLE','Payment action'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE_DESC','Choose whether or not the payment should be charged immediately. Authorize verifies payment details and reserves funds to capture it later, giving time for the merchant to decide on the order.

Authorize'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).'); +?> diff --git a/lang/english/modules/payment/novalnet_guarantee_sepa.php b/lang/english/modules/payment/novalnet_guarantee_sepa.php new file mode 100644 index 0000000..b3d9fa3 --- /dev/null +++ b/lang/english/modules/payment/novalnet_guarantee_sepa.php @@ -0,0 +1,39 @@ +Payment guarantee configuration

Basic requirements:

Allowed B2C countries: Germany, Austria, Switzerland
Allowed B2B countries: European Union
Allowed currency: €
Minimum order amount: 9,99 € or more
Age limit: 18 years or more
The billing address must be the same as the shipping address'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT_TITLE','Minimum order amount'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE_TITLE','Force Non-guarantee payment'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE_DESC','Even if payment guarantee is enabled, payments will still be processed as non-guarantee payments if the payment guarantee requirements are not met. Review the requirements under "Enable Payment Guarantee" in the Installation Guide.'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B_TITLE','Allow B2B Customers'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B_DESC','Allow B2B customers to place order'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE_TITLE','Payment action'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE_DESC','Choose whether or not the payment should be charged immediately. Authorize verifies payment details and reserves funds to capture it later, giving time for the merchant to decide on the order.

Authorize'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION_TITLE','One click shopping'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION_DESC','Payment details stored during the checkout process can be used for future payments'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SAVE_CARD_DETAILS', 'Save for future purchase'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_NEW_ACCOUNT_DETAILS', 'Use a new payment method'); +define('MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR', 'Your account details are invalid'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE', 'Enter your date of birth'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE_TITLE', 'Payment due date'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE_DESC', 'Number of days after which the payment is debited (must be between 2 and 14 days)'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_FORMAT', 'DD-MM-YYYY'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO_TITLE','Notification for the buyer'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page'); +?> diff --git a/lang/english/modules/payment/novalnet_ideal.php b/lang/english/modules/payment/novalnet_ideal.php new file mode 100644 index 0000000..51cea01 --- /dev/null +++ b/lang/english/modules/payment/novalnet_ideal.php @@ -0,0 +1,21 @@ + diff --git a/lang/english/modules/payment/novalnet_instalment_invoice.php b/lang/english/modules/payment/novalnet_instalment_invoice.php new file mode 100644 index 0000000..c412788 --- /dev/null +++ b/lang/english/modules/payment/novalnet_instalment_invoice.php @@ -0,0 +1,31 @@ +Basic requirements:Allowed B2B countries: European Union
Allowed B2C countries: Germany, Austria, Switzerland
Allowed currency: €
Minimum order amount: 19,98 € or more
Please note that the instalment cycle amount has to be a minimum of 9.99 EUR and the instalment cycles which do not meet this criteria will not be displayed in the instalment plan
Age limit: 18 years or more
The billing address must be the same as the shipping address'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_BASIC_REQ_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MINIMUM_ORDER_AMOUNT_TITLE','Minimum order amount'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MINIMUM_ORDER_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B_TITLE','Allow B2B Customers'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B_DESC','Allow B2B customers to place order'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO_TITLE','Notification for the buyer'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE_TITLE','Payment action'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE_DESC','Choose whether or not the payment should be charged immediately. Authorize verifies payment details and reserves funds to capture it later, giving time for the merchant to decide on the order.

Authorize'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE_TITLE', 'Instalment cycles'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE_DESC', 'Select the instalment cycles that can be availed in the instalment plan'); +?> diff --git a/lang/english/modules/payment/novalnet_instalment_sepa.php b/lang/english/modules/payment/novalnet_instalment_sepa.php new file mode 100644 index 0000000..18fb17e --- /dev/null +++ b/lang/english/modules/payment/novalnet_instalment_sepa.php @@ -0,0 +1,37 @@ +Basic requirements:Allowed B2B countries: European Union
Allowed B2C countries: Germany, Austria, Switzerland
Allowed currency: €
Minimum order amount: 19,98 € or more
Please note that the instalment cycle amount has to be a minimum of 9.99 EUR and the instalment cycles which do not meet this criteria will not be displayed in the instalment plan
Age limit: 18 years or more
The billing address must be the same as the shipping address'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_BASIC_REQ_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MINIMUM_ORDER_AMOUNT_TITLE','Minimum order amount'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MINIMUM_ORDER_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B_TITLE','Allow B2B Customers'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B_DESC','Allow B2B customers to place order'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE_TITLE','Payment action'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE_DESC','Choose whether or not the payment should be charged immediately. Authorize verifies payment details and reserves funds to capture it later, giving time for the merchant to decide on the order.

Authorize'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE_TITLE', 'Instalment cycles'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE_DESC', 'Select the instalment cycles that can be availed in the instalment plan'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE_TITLE', 'Payment due date (in days)'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE_DESC', 'Number of days after which the payment is debited (must be between 2 and 14 days)'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION_TITLE', 'One click shopping'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION_DESC', 'Payment details stored during the checkout process can be used for future payments'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SAVE_CARD_DETAILS', 'Save for future purchase'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_NEW_ACCOUNT_DETAILS', 'Use a new payment method'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO_TITLE','Notification for the buyer'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page'); +?> diff --git a/lang/english/modules/payment/novalnet_instantbank.php b/lang/english/modules/payment/novalnet_instantbank.php new file mode 100644 index 0000000..b1d50f2 --- /dev/null +++ b/lang/english/modules/payment/novalnet_instantbank.php @@ -0,0 +1,21 @@ + diff --git a/lang/english/modules/payment/novalnet_invoice.php b/lang/english/modules/payment/novalnet_invoice.php new file mode 100644 index 0000000..2eda178 --- /dev/null +++ b/lang/english/modules/payment/novalnet_invoice.php @@ -0,0 +1,29 @@ +
Authorize'); +define('MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization'); +define('MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).'); +define('MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO_TITLE','Notification for the buyer'); +define('MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page'); +?> diff --git a/lang/english/modules/payment/novalnet_multibanco.php b/lang/english/modules/payment/novalnet_multibanco.php new file mode 100644 index 0000000..42d64de --- /dev/null +++ b/lang/english/modules/payment/novalnet_multibanco.php @@ -0,0 +1,23 @@ + diff --git a/lang/english/modules/payment/novalnet_online_bank_transfer.php b/lang/english/modules/payment/novalnet_online_bank_transfer.php new file mode 100644 index 0000000..95e6e53 --- /dev/null +++ b/lang/english/modules/payment/novalnet_online_bank_transfer.php @@ -0,0 +1,21 @@ + diff --git a/lang/english/modules/payment/novalnet_paypal.php b/lang/english/modules/payment/novalnet_paypal.php new file mode 100644 index 0000000..200f1cf --- /dev/null +++ b/lang/english/modules/payment/novalnet_paypal.php @@ -0,0 +1,25 @@ +
Authorize'); +define('MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization'); +define('MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).'); +?> diff --git a/lang/english/modules/payment/novalnet_postfinance.php b/lang/english/modules/payment/novalnet_postfinance.php new file mode 100644 index 0000000..02566d6 --- /dev/null +++ b/lang/english/modules/payment/novalnet_postfinance.php @@ -0,0 +1,21 @@ + diff --git a/lang/english/modules/payment/novalnet_postfinance_card.php b/lang/english/modules/payment/novalnet_postfinance_card.php new file mode 100644 index 0000000..cc08a0c --- /dev/null +++ b/lang/english/modules/payment/novalnet_postfinance_card.php @@ -0,0 +1,21 @@ + diff --git a/lang/english/modules/payment/novalnet_prepayment.php b/lang/english/modules/payment/novalnet_prepayment.php new file mode 100644 index 0000000..972677a --- /dev/null +++ b/lang/english/modules/payment/novalnet_prepayment.php @@ -0,0 +1,25 @@ + diff --git a/lang/english/modules/payment/novalnet_przelewy24.php b/lang/english/modules/payment/novalnet_przelewy24.php new file mode 100644 index 0000000..10c7d3c --- /dev/null +++ b/lang/english/modules/payment/novalnet_przelewy24.php @@ -0,0 +1,21 @@ + diff --git a/lang/english/modules/payment/novalnet_sepa.php b/lang/english/modules/payment/novalnet_sepa.php new file mode 100644 index 0000000..e6f4404 --- /dev/null +++ b/lang/english/modules/payment/novalnet_sepa.php @@ -0,0 +1,32 @@ +
'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ALLOWED_TITLE','Allowed zone(-s)'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ALLOWED_DESC','This payment method will be allowed for the mentioned zone(-s). Enter the zone(-s) in the following format E.g: DE, AT, CH. In case if the field is empty, all the zones will be allowed.'); +define('MODULE_PAYMENT_NOVALNET_SEPA_STATUS_TITLE','Enable payment method'); +define('MODULE_PAYMENT_NOVALNET_SEPA_STATUS_DESC','Do you want to accept sepa payment?'); +define('MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE_TITLE','Enable test mode'); +define('MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE_DESC','The payment will be processed in the test mode therefore amount for this transaction will not be charged'); +define('MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE_TITLE','Payment due date (in days)'); +define('MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE_DESC',' +Number of days after which the payment is debited (must be between 2 and 14 days)'); +define('MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER_TITLE','Display Sort Order'); +define('MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER_DESC','Display sort order; the lowest value is displayed first.'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ORDER_STATUS_TITLE','Completed order status'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ORDER_STATUS_DESC','Status to be used for successful orders'); +define('MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE_TITLE','Payment zone'); +define('MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE_DESC','When a zone is selected, this payment method will be enabled for that zone only.'); +define('MODULE_PAYMENT_NOVALNET_SEPA_IBAN','IBAN'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ACCOUNT_HOLDER','Account Holder'); +define('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE_TITLE','Payment action'); +define('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE_DESC','Choose whether or not the payment should be charged immediately.'); +define('MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization'); +define('MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).'); +define('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION_TITLE','One click shopping'); +define('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION_DESC','Payment details stored during the checkout process can be used for future payments'); +define('MODULE_PAYMENT_NOVALNET_SEPA_VISIBILITY_BY_AMOUNT_TITLE','Minimum order amount.'); +define('MODULE_PAYMENT_NOVALNET_SEPA_VISIBILITY_BY_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO_TITLE','Notification for the buyer.'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page.'); +?> diff --git a/lang/english/modules/payment/novalnet_trustly.php b/lang/english/modules/payment/novalnet_trustly.php new file mode 100644 index 0000000..5bf48a7 --- /dev/null +++ b/lang/english/modules/payment/novalnet_trustly.php @@ -0,0 +1,22 @@ + diff --git a/lang/english/modules/payment/novalnet_wechatpay.php b/lang/english/modules/payment/novalnet_wechatpay.php new file mode 100644 index 0000000..b1410b0 --- /dev/null +++ b/lang/english/modules/payment/novalnet_wechatpay.php @@ -0,0 +1,21 @@ + diff --git a/lang/german/modules/payment/novalnet.php b/lang/german/modules/payment/novalnet.php new file mode 100644 index 0000000..35473e6 --- /dev/null +++ b/lang/german/modules/payment/novalnet.php @@ -0,0 +1,133 @@ +Ich erteile hiermit das SEPA-Lastschriftmandat (elektronische Übermittlung) und bestätige, dass die Bankverbindung korrekt ist'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ABOUT_MANDATE_TEXT','

Ich ermächtige den Zahlungsempfänger, Zahlungen von meinem Konto mittels Lastschrift einzuziehen. Zugleich weise ich mein Kreditinstitut an, die von dem Zahlungsempfänger auf mein Konto gezogenen Lastschriften einzulösen.
Gläubiger-Identifikator: DE53ZZZ00000004253
Hinweis:
Ich kann innerhalb von acht Wochen, beginnend mit dem Belastungsdatum, die Erstattung des belasteten Betrages verlangen. Es gelten dabei die mit meinem Kreditinstitut vereinbarten Bedingungen.
'); + +define('MODULE_PAYMENT_NOVALNET_AMOUNT_TRANSFER_NOTE_DUE_DATE', 'Bitte überweisen Sie den Betrag von %1$s spätestens bis zum %2$s auf das folgende Konto'); +define('MODULE_PAYMENT_NOVALNET_AMOUNT_TRANSFER_NOTE', 'Bitte überweisen Sie den Betrag %s auf das folgende Konto.'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_TRANSFER_NOTE_DUE_DATE', 'Bitte überweisen Sie den anzahl der raten von %1$s spätestens bis zum %2$s auf das folgende Konto'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_TRANSFER_NOTE', 'Bitte überweisen Sie den anzahl der raten %1$s auf das folgende Konto.'); +define('MODULE_PAYMENT_NOVALNET_MULTIBANCO_NOTE', 'Bitte verwenden Sie die folgende Zahlungsreferenz, um den Betrag von %s an einem Multibanco-Geldautomaten oder über Ihr Onlinebanking zu bezahlen.'); +define('MODULE_PAYMENT_NOVALNET_BANK_NAME', 'Bank: '); +define('MODULE_PAYMENT_NOVALNET_IBAN','IBAN: '); +define('MODULE_PAYMENT_NOVALNET_BIC', ' BIC: '); +define('MODULE_PAYMENT_NOVALNET_ACCOUNT_HOLDER','Kontoinhaber: '); +define('MODULE_PAYMENT_NOVALNET_AMOUNT', ' Betrag: '); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_MODE', 'Testbestellung'); +define('MODULE_PAYMENT_NOVALNET_BANK_PLACE', 'Ort: '); +define('MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR', 'Ihre Kontodaten sind ungültig.'); +define('MODULE_PAYMENT_NOVALNET_TRANSACTION_ID', 'Novalnet-Transaktions-ID: '); +define('MODULE_PAYMENT_NOVALNET_TRANS_SLIP_EXPIRY_DATE', 'Verfallsdatum des Zahlscheins: '); +define('MODULE_PAYMENT_NOVALNET_NEAREST_STORE_DETAILS', 'Barzahlen-Partnerfilialen in Ihrer Nähe: '); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT', 'Bitte verwenden Sie einen der unten angegebenen Verwendungszwecke für die Überweisung. Nur so kann Ihr Geldeingang Ihrer Bestellung zugeordnet werden'); +define('MODULE_PAYMENT_NOVALNET_CONFIRM_TEXT','Bestätigen'); +define('MODULE_PAYMENT_NOVALNET_REFUND_TEXT','Rückerstattung'); +define('MODULE_PAYMENT_NOVALNET_CANCEL_TEXT','Stornieren'); +define('MODULE_PAYMENT_NOVALNET_TRANSACTION_ERROR', 'Die Zahlung war nicht erfolgreich. Ein Fehler ist aufgetreten.'); +define('MODULE_PAYMENT_NOVALNET_SELECT_STATUS_OPTION', '--Auswählen--'); +define('MODULE_PAYMENT_NOVALNET_TRANS_CONFIRM_SUCCESSFUL_MESSAGE','Die Buchung wurde am %1$s Uhr bestätigt'); +define('MODULE_PAYMENT_NOVALNET_TRANS_DEACTIVATED_MESSAGE', 'Die Transaktion wurde am %1$s Uhr storniert'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCELED_MESSAGE', 'Die Transaktion wurde storniert für die %1$s auf %2$s %3$s'); +define('MODULE_PAYMENT_NOVALNET_AMOUNT_EX', ' (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)'); +define('MODULE_PAYMENT_NOVALNET_REFUND_PARENT_TID_MSG', 'Die Rückerstattung für die TID: %1$s mit dem Betrag %2$s wurde veranlasst.'); +define('MODULE_PAYMENT_NOVALNET_REFUND_CHILD_TID_MSG', ' Die neue TID: %s für den erstatteten Betrag'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_TEXT', ' (Netto-Kreditbetrag : )'); +define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_CYCLES_FRONTEND', 'ANZAHL DER RATEN '); +define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_AMOUNT_FRONTEND', 'RATENBETRAG'); +define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_PER_MONTH_FRONTEND', 'pro Monat'); +define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_PER_MONTH_CYCLE', '%s Raten/'); +define('MODULE_PAYMENT_GUARANTEE_PAYMENT_DOB_EMPTY_ERROR_MESSAGE', 'Geben Sie bitte Ihr Geburtsdatum ein'); +define('MODULE_PAYMENT_GUARANTEE_PAYMENT_AGE_ERROR_MESSAGE','Sie müssen mindestens 18 Jahre alt sein'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SUMMARY_BACKEND', 'Zusammenfassung der Ratenzahlung'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCEL_ADMIN_TEXT','Raten stornier'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_BACKEND', 'Betrag'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_DATE_BACKEND', 'Datum'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_BACKEND', 'Status'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_REFERENCE_BACKEND', 'Novalnet-Transaktions-ID'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCEL_TEXT', 'Stornieren'); +define('MODULE_PAYMENT_NOVALNET_MENTION_GUARANTEE_PAYMENT_PENDING_TEXT', 'Ihre Bestellung wird derzeit überprüft. Wir werden Sie in Kürze über den Bestellstatus informieren. Bitte beachten Sie, dass dies bis zu 24 Stunden dauern kann.'); +define('MODULE_PAYMENT_NOVALNET_VALID_MERCHANT_CREDENTIALS_ERROR', 'Bitte füllen Sie die erforderlichen Felder aus'); +define('MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_TITLE','Novalnet API-Konfiguration (V_12.0.3)'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_FORMAT','TT.MM.JJJJ'); +define('MODULE_PAYMENT_GUARANTEE_DOB_FIELD', 'Ihr Geburtsdatum *'); +define('MODULE_PAYMENT_NOVALNET_TESTMODE','Testmodus'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE', 'Verwendungszweck %1$s: %2$s'); +define('NOVALNET_WEBHOOK_CREDIT_NOTE','Die Gutschrift für die TID ist erfolgreich eingegangen: %1$s mit Betrag %2$s am %3$s. Bitte entnehmen Sie die TID den Einzelheiten der Bestellung bei BEZAHLT in unserem Novalnet Adminportal: %4$s'); +define('NOVALNET_WEBHOOK_CHARGEBACK_NOTE','Chargeback erfolgreich importiert für die TID: %1$s Betrag: %2$s am %3$s um %4$s Uhr. TID der Folgebuchung: %5$s'); +define('NOVALNET_WEBHOOK_NEW_INSTALMENT_NOTE','Für die Transaktions-ID ist eine neue Rate eingegangen: %1$s mit Betrag %2$s am %3$s. Die Transaktions-ID der neuen Rate lautet: %4$s'); +define('NOVALNET_WEBHOOK_INSTALMENT_CANCEL_NOTE','Die Ratenzahlung für die TID wurde gekündigt: %1$s am %2$s'); +define('NOVALNET_WEBHOOK_TRANSACTION_UPDATE_NOTE_DUE_DATE','Transaktion mit TID %1$s und Betrag %2$s und neues Fälligkeitsdatum: %3$s.'); +define('NOVALNET_WEBHOOK_TRANSACTION_UPDATE_NOTE','Transaktion mit TID %1$s und Betrag %2$s wurde am um erfolgreich.'); +define('NOVALNET_PAYMENT_REMINDER_NOTE','Zahlungserinnerung %1$s wurde an den Kunden gesendet.'); +define('NOVALNET_COLLECTION_SUBMISSION_NOTE','Die Transaktion wurde an das Inkassobüro übergeben. Inkasso-Referenz: %1$s'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE', 'Geben Sie Ihr Geburtsdatum ein'); + +define('MODULE_PAYMENT_NOVALNET_PARTNER_PAYMENT_REFERENCE', 'Partner-Zahlungsreferenz: %s'); +define('MODULE_PAYMENT_NOVALNET_ERROR_MSG', 'Prüfung des Hashes fehlgeschlagen'); +define('MODULE_PAYMENT_NOVALNET_TRANS_CONFIRM_TITLE','Transaktion verwalten'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_CAPTURE_CONFIRM','Sind Sie sicher, dass Sie die Zahlung erfassen wollen?'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_VOID_CONFIRM','Sind Sie sicher, dass Sie die Zahlung stornieren möchten?'); +define('MODULE_PAYMENT_NOVALNET_SELECT_STATUS_TEXT', 'Bitte Status auswählen'); +define('MODULE_PAYMENT_NOVALNET_BACK_TEXT', 'Zurück'); +define('MODULE_PAYMENT_NOVALNET_REFUND_TITLE', 'Erstattungsverfahren'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_REFUND_CONFIRM', 'Sind Sie sicher, dass Sie den Betrag erstatten wollen?'); +define('MODULE_PAYMENT_NOVALNET_REFUND_REFERENCE_TEXT', 'Referenz für die Erstattung'); +define('MODULE_PAYMENT_NOVALNET_REFUND_AMT_TITLE', 'Bitte geben Sie den Erstattungsbetrag ein'); +define('MODULE_PAYMENT_NOVALNET_REFUND_REASON_TITLE', 'Grund für die Rückerstattung (optional)'); +define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_FRONTEND', 'Ratenzahlung'); +define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_TEXT', 'Wählen Sie Ihren Ratenzahlungsplan (Netto-Kreditbetrag: %s )'); +define('SUCCESS_ORDER_UPDATED', 'Erfolg'); + +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INSTALMENTS_INFO','Informationen zur Ratenzahlung'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_PROCESSED_INSTALMENTS','Bearbeitete Raten: '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_DUE_INSTALMENTS','Fällige Raten: '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_INSTALMENT_AMOUNT','Nächster Ratenbetrag: '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_INSTALMENT_DATE','Datum der nächsten Ratenzahlung: '); + +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_PAY_DATE_BACKEND', 'Bezahltes Datum'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_DATE_BACKEND', 'Nächstes Ratenzahlungsdatum'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_PAID_DATE_BACKEND','Bezahlt am'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_PAID','Bezahlt'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_PENDING','Ausstehend'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_REFUNDED','Rückerstattet'); +define('WARNING_ORDER_NOT_UPDATED', 'Warnung'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_ERROR_MSG','Gültiges Geburtsdatum eingeben'); +define('MODULE_PAYMENT_NOVALNET_ORDER_MAIL_SUBJECT', 'Ihre Bestellung %s, am %s, %s'); +define('MODULE_PAYMENT_NOVALNET_ORDER_CAPTURE_MAIL_SUBJECT', 'Bestellbestätigung – Ihre Bestellung %s bei Gambio wurde bestätigt!'); +define('MODULE_PAYMENT_GUARANTEE_PAYMENT_MAIL_SUBJECT','Bestellbestätigung – Ihre Bestellung %s bei %s wurde bestätigt!'); +define( +'MODULE_PAYMENT_NOVALNET_SEPA_MANDATE_NOTICE', +'

I authorise (A) die Novalnet AG, meiner Bank die Weisung zu erteilen, mein Konto zu belasten und (B) meine Bank, mein Konto entsprechend der Weisung der Novalnet AG zu belasten.
Gläubiger-Identifikator: DE53ZZZ00000004253
Note:Sie haben Anspruch auf eine Erstattung durch Ihre Bank gemäß den Bedingungen Ihres Vertrags mit der Bank. Eine Erstattung muss innerhalb von 8 Wochen ab dem Datum der Abbuchung von Ihrem Konto beantragt werden.

' +); +define('MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS', 'Sparen für zukünftige Käufe'); +define('MODULE_PAYMENT_NOVALNET_SEPA_NEW_ACCOUNT_DETAILS', 'Verwenden Sie eine neue Zahlungsmethode'); +define('MODULE_PAYMENT_NOVALNET_SEPA_IBAN', 'IBAN *'); +define('MODULE_PAYMENT_NOVALNET_BOOK_TITLE','Transaktion durchführen'); +define('MODULE_PAYMENT_NOVALNET_BOOK_AMT_TITLE','Buchungsbetrag der Transaktion'); +define('MODULE_PAYMENT_NOVALNET_TRANS_BOOKED_MESSAGE','Ihre Bestellung wurde mit einem Betrag von %s gebucht. Ihre neue TID für den gebuchten Betrag: %s'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_ZERO_AMOUNT_BOOK_CONFIRM','Sind Sie sich sicher, dass Sie den Bestellbetrag buchen wollen?'); +define('MODULE_PAYMENT_NOVALNET_AMOUNT_ERROR_MESSAGE','Ungültiger Betrag'); +define('MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_MESSAGE','Diese Transaktion wird mit Nullbuchung bearbeitet'); + +define('MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_TEXT','

Diese Bestellung wird als Nullbuchung verarbeitet. Ihre Zahlungsdaten werden für zukünftige Online-Einkäufe gespeichert.'); +?> diff --git a/lang/german/modules/payment/novalnet_alipay.php b/lang/german/modules/payment/novalnet_alipay.php new file mode 100644 index 0000000..7782344 --- /dev/null +++ b/lang/german/modules/payment/novalnet_alipay.php @@ -0,0 +1,22 @@ + + diff --git a/lang/german/modules/payment/novalnet_applepay.php b/lang/german/modules/payment/novalnet_applepay.php new file mode 100644 index 0000000..12bf5ac --- /dev/null +++ b/lang/german/modules/payment/novalnet_applepay.php @@ -0,0 +1,41 @@ +
Zahlung autorisieren'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_MANUAL_CHECK_LIMIT_DESC','Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_TYPE_TITLE','

Schaltfläche Gestaltung

Stil für Apple Pay schaltfläche
Schaltfläche Typ'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_THEME_TITLE','Schaltfläche Thema'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_HEIGHT_TITLE','Schaltfläche Höhe'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_HEIGHT_DESC','Bereich von 30 bis 64 Pixel'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS_TITLE','Schaltfläche Eckenradius'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS_DESC','Bereich von 1 bis 10 Pixel'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY_TITLE','Zeigen Sie den Apple Pay Button an'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY_DESC','Auf den ausgewählten Seiten wird die Apple-Pay-Schaltfläche zur sofortigen Bezahlung als Express-Checkout-Schaltfläche angezeigt'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ALLOWED_TITLE','Erlaubte Zone(n)'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ALLOWED_DESC','Diese Zahlungsmethode ist nur für die angegebene(n) Zone(n) zulässig. Geben Sie die Zone(n) in folgendem Format ein, z.B: DE, AT, CH. Wenn das Feld leer ist, werden alle Zonen zugelassen.'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_PAYMENT_ZONE_TITLE','Zahlungsbereich'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_PAYMENT_ZONE_DESC','Wenn eine Zone ausgewählt ist, aktivieren Sie diese Zahlungsmethode nur für diese Zone.'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_TEXT_INFO','Der Betrag wird nach erfolgreicher Authentifizierung von Ihrer Karte abgebucht'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_PUBLIC_TITLE', xtc_image(DIR_WS_ICONS.'novalnet/novalnet_applepay.png', "Applepay ")); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Mindestbestellbetrag'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)'); +define('ERROR_CHECKOUT_SHIPPING_NO_MODULE','Kein Versand'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME_TITLE','Name des Geschäfts'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME_DESC','Der Name des Geschäfts wird in den Zahlungsbeleg von Apple Pay eingefügt und der Text wird als PAY Name des Geschäfts angezeigt, so dass der Endkunde weiß, an wen er zahlt.'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Mindestbestellbetrag'); +define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)'); +?> diff --git a/lang/german/modules/payment/novalnet_bancontact.php b/lang/german/modules/payment/novalnet_bancontact.php new file mode 100644 index 0000000..ce0f609 --- /dev/null +++ b/lang/german/modules/payment/novalnet_bancontact.php @@ -0,0 +1,22 @@ + + diff --git a/lang/german/modules/payment/novalnet_cashpayment.php b/lang/german/modules/payment/novalnet_cashpayment.php new file mode 100644 index 0000000..8c19ad1 --- /dev/null +++ b/lang/german/modules/payment/novalnet_cashpayment.php @@ -0,0 +1,25 @@ + diff --git a/lang/german/modules/payment/novalnet_cc.php b/lang/german/modules/payment/novalnet_cc.php new file mode 100644 index 0000000..7492d00 --- /dev/null +++ b/lang/german/modules/payment/novalnet_cc.php @@ -0,0 +1,54 @@ +
Beschriftung'); +define('MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_INPUT_TITLE','Eingabe'); +define('MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_INPUT_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_CC_CSS_TEXT_TITLE','Text für das CSS'); +define('MODULE_PAYMENT_NOVALNET_CC_CSS_TEXT_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION_TITLE','Kauf mit einem Klick'); +define('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION_DESC','Zahlungsdaten, die während des Bestellvorgangs gespeichert werden, können für zukünftige Zahlungen verwendet werden'); +define('MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE_TITLE','Aktion für vom Besteller autorisierte Zahlungen.'); +define('MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE_DESC','Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht.'); +define('MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung'); +define('MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).'); +define('MODULE_PAYMENT_NOVALNET_CC_SAVE_CARD_DETAILS', 'Sparen für zukünftige Käufe'); +define('MODULE_PAYMENT_NOVALNET_CC_NEW_ACCOUNT_DETAILS', 'Verwenden Sie eine neue Zahlungsmethode'); +define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_ERROR', 'Ihre Kreditkartendaten sind ungültig'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_HOLDER','Name des Karteninhabers'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_NO','Kartennummer'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_VALID_DATE','Ablaufdatum'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_CVC','CVC/CVV/CID'); +define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_HOLDER_INPUT_TEXT','Name auf der Karte'); +define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_NUMBER_INPUT_TEXT','XXXX XXXX XXXX XXXX'); +define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_CVC_INPUT_TEXT','XXX'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_HOLDER_ERROR','Bitte geben Sie den gültigen Namen des Karteninhabers ein'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_NO_ERROR','Bitte geben Sie die gültige Kartennummer ein'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_VALID_DATE_ERROR','Bitte geben Sie den gültigen Verfallsmonat / das Verfallsjahr im angegebenen Format ein'); +define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_CVC_ERROR','Bitte geben Sie die gültige CVC/CVV/CID ein'); +define('MODULE_PAYMENT_NOVALNET_CC_TOKEN_TEXT','%1$s mit Endziffern %2$s ( gültig bis %3$s/%4$s )'); +?> diff --git a/lang/german/modules/payment/novalnet_config.php b/lang/german/modules/payment/novalnet_config.php new file mode 100644 index 0000000..7a2592b --- /dev/null +++ b/lang/german/modules/payment/novalnet_config.php @@ -0,0 +1,23 @@ + Bevor Sie beginnen, lesen Sie bitte die Installationsanleitung und melden Sie sich mit Ihrem Händlerkonto im Novalnet Admin-Portal an. Um ein Händlerkonto zu erhalten, senden Sie bitte eine E-Mail an sales@novalnet.de oder rufen Sie uns unter +49 89 923068320 an

'); +define('MODULE_PAYMENT_NOVALNET_SIGNATURE_TITLE', 'Aktivierungsschlüssel des Produkts'); +define('MODULE_PAYMENT_NOVALNET_SIGNATURE_DESC', 'Ihren Produktaktivierungsschlüssel finden Sie im Novalnet Admin-Portal Projekt > Wählen Sie Ihr Projekt > API-Anmeldeinformationen > API-Signatur (Produktaktivierungsschlüssel)'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY_TITLE', 'Zahlungs-Zugriffsschlüssel'); +define('MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY_DESC', 'Ihren Paymentzugriffsschlüssel finden Sie im Novalnet Admin-Portal Projekt > Wählen Sie Ihr Projekt > API-Anmeldeinformationen > Paymentzugriffsschlüssel'); +define('MODULE_PAYMENT_NOVALNET_TARIFF_ID_TITLE', 'Tarif-ID auswählen'); +define('MODULE_PAYMENT_NOVALNET_TARIFF_ID_DESC', 'Wählen Sie eine Tarif-ID, die dem bevorzugten Tarifplan entspricht, den Sie im Novalnet Admin-Portal für dieses Projekt erstellt haben'); +define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE_TITLE', '

Verwaltung des Bestellstatus für ausgesetzte Zahlungen

On-hold-Bestellstatus'); +define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE_DESC', 'Wählen Sie, welcher Status für On-hold-Bestellungen verwendet wird, solange diese nicht bestätigt oder storniert worden sind'); +define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED_TITLE', 'Status für stornierte Bestellungen'); +define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED_DESC', 'Wählen Sie, welcher Status für stornierte oder voll erstattete Bestellungen verwendet wird'); +define('MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE_TITLE', '

Benachrichtigungs- / Webhook-URL festlegen


Manuelles Testen der Benachrichtigungs / Webhook-URL erlauben'); +define('MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE_DESC', 'Aktivieren Sie diese Option, um die Novalnet-Benachrichtigungs-/Webhook-URL manuell zu testen. Deaktivieren Sie die Option, bevor Sie Ihren Shop liveschalten, um unautorisierte Zugriffe von Dritten zu blockieren'); +define('MODULE_PAYMENT_NOVALNET_CALLBACK_URL_TITLE', 'Benachrichtigung / Webhook-URL im Novalnet-Verwaltungsportal'); +define('MODULE_PAYMENT_NOVALNET_CALLBACK_URL_DESC', 'Sie müssen die folgende Webhook-URL im Novalnet Admin-Portal hinzufügen. Dadurch können Sie Benachrichtigungen über den Transaktionsstatus erhalten'); +define('MODULE_PAYMENT_NOVALNET_CLIENT_KEY_TITLE', 'Client-Schlüssel'); +define('MODULE_PAYMENT_NOVALNET_PROJECT_ID_TITLE', 'Projekt-ID'); +define('MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO_TITLE', '
E-Mails senden an'); +define('MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO_DESC', 'E-Mail-Benachrichtigungen werden an diese E-Mail-Adresse gesendet'); +?> diff --git a/lang/german/modules/payment/novalnet_eps.php b/lang/german/modules/payment/novalnet_eps.php new file mode 100644 index 0000000..70d3dc3 --- /dev/null +++ b/lang/german/modules/payment/novalnet_eps.php @@ -0,0 +1,21 @@ + diff --git a/lang/german/modules/payment/novalnet_giropay.php b/lang/german/modules/payment/novalnet_giropay.php new file mode 100644 index 0000000..9806fcf --- /dev/null +++ b/lang/german/modules/payment/novalnet_giropay.php @@ -0,0 +1,21 @@ + diff --git a/lang/german/modules/payment/novalnet_googlepay.php b/lang/german/modules/payment/novalnet_googlepay.php new file mode 100644 index 0000000..8bc33f6 --- /dev/null +++ b/lang/german/modules/payment/novalnet_googlepay.php @@ -0,0 +1,42 @@ +
Zahlung autorisieren'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT_DESC','Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE_TITLE','

Schaltfläche Gestaltung

Stil für Google Pay schaltfläche
Schaltfläche Typ'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_THEME_TITLE','Schaltfläche Thema'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT_TITLE','Schaltfläche Höhe'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT_DESC','Bereich von 30 bis 64 Pixel'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY_TITLE','Zeigen Sie den Google Pay Button an'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY_DESC','Auf den ausgewählten Seiten wird die Google-Pay-Schaltfläche zur sofortigen Bezahlung als Express-Checkout-Schaltfläche angezeigt'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ALLOWED_TITLE','Erlaubte Zone(n)'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ALLOWED_DESC','Diese Zahlungsmethode ist nur für die angegebene(n) Zone(n) zulässig. Geben Sie die Zone(n) in folgendem Format ein, z.B: DE, AT, CH. Wenn das Feld leer ist, werden alle Zonen zugelassen.'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE_TITLE','Zahlungsbereich'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE_DESC','Wenn eine Zone ausgewählt ist, aktivieren Sie diese Zahlungsmethode nur für diese Zone.'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEXT_INFO','Der Betrag wird nach erfolgreicher Authentifizierung von Ihrer Karte abgebucht'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PUBLIC_TITLE', xtc_image(DIR_WS_ICONS.'novalnet/novalnet_googlepay.png', "Googlepay ")); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Mindestbestellbetrag'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME_TITLE','Name des Geschäfts'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME_DESC','Der Name des Geschäfts wird in den Zahlungsbeleg von Google Pay eingefügt und der Text wird als PAY Name des Geschäfts angezeigt, so dass der Endkunde weiß, an wen er zahlt.'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE_TITLE','3D-Secure-Zahlungen außerhalb der EU erzwingen'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE_DESC','Wenn Sie diese Option aktivieren, werden alle Zahlungen mit Karten, die außerhalb der EU ausgegeben wurden, mit der starken Kundenauthentifizierung (Strong Customer Authentication, SCA) von 3D-Secure 2.0 authentifiziert.'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID_TITLE','Google-Händler-ID'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID_DESC','Beachten Sie bitte, dass die Händler-ID von Google für die Ausführung dieser Zahlungsart in der Live-Umgebung benötigt wird. Die Händler-ID wird nach der Registrierung bei Google Pay und der Wallet-Konsole vergeben. Siehe auch: Anfrage für Produktiv-Zugang stellen, falls Sie mehr Informationen zum Genehmigungsverfahren benötigen und dazu, wie Sie eine Google Händler-ID erhalten. Die Registrierung beinhaltet auch, dass Sie Ihre Anbindung mit ausreichenden Screenshots einreichen, deshalb sammeln Sie diese Informationen, indem Sie die Zahlungsmethode im Testmodus aktivieren. Um die Validierung dieses Feldes zu überspringen, während Sie die Konfiguration speichern, verwenden Sie diese Test-ID, BCR2DN4XXXTN7FSI , zum Testen und Einreichen Ihrer Anbindung bei Google.'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Mindestbestellbetrag'); +define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)'); +?> diff --git a/lang/german/modules/payment/novalnet_guarantee_invoice.php b/lang/german/modules/payment/novalnet_guarantee_invoice.php new file mode 100644 index 0000000..6578e49 --- /dev/null +++ b/lang/german/modules/payment/novalnet_guarantee_invoice.php @@ -0,0 +1,30 @@ + Einstellungen für die Zahlungsgarantie

Grundanforderungen:

Erlaubte B2C-Länder: Deutschland, Österreich, Schweiz
Erlaubte B2B-Länder: Europäische Union
Erlaubte Währung: €
Mindestbestellwert: 9,99 € oder mehr
Altersgrenze: 18 Jahre oder mehr
Die Rechnungsadresse muss die gleiche sein wie die Lieferadresse'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT_TITLE',' Mindestbestellbetrag'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE_TITLE',' Zahlung ohne Zahlungsgarantie erzwingen'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE_DESC','Falls die Zahlungsgarantie zwar aktiviert ist, jedoch die Voraussetzungen für Zahlungsgarantie nicht erfüllt sind, wird die Zahlung ohne Zahlungsgarantie verarbeitet. Die Voraussetzungen finden Sie in der Installationsanleitung unter "Zahlungsgarantie aktivieren"'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B_TITLE','B2B-Kunden erlauben'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B_DESC','B2B-Kunden erlauben, Bestellungen aufzugeben'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE_TITLE','Aktion für vom Besteller autorisierte Zahlungen'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE_DESC','Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht. Authorize prüft die Zahlungsdetails und reserviert Mittel, um sie später zu erfassen, damit der Händler Zeit hat, über die Bestellung zu entscheiden.

Zahlung autorisieren'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).'); +?> diff --git a/lang/german/modules/payment/novalnet_guarantee_sepa.php b/lang/german/modules/payment/novalnet_guarantee_sepa.php new file mode 100644 index 0000000..91e3eb2 --- /dev/null +++ b/lang/german/modules/payment/novalnet_guarantee_sepa.php @@ -0,0 +1,39 @@ + Einstellungen für die Zahlungsgarantie

Grundanforderungen:

Erlaubte B2C-Länder: Deutschland, Österreich, Schweiz
Erlaubte B2B-Länder: Europäische Union
Erlaubte Währung: €
Mindestbestellwert: 9,99 € oder mehr
Altersgrenze: 18 Jahre oder mehr
Die Rechnungsadresse muss die gleiche sein wie die Lieferadresse'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT_TITLE',' Mindestbestellbetrag'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE_TITLE',' Zahlung ohne Zahlungsgarantie erzwingen'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE_DESC','Falls die Zahlungsgarantie zwar aktiviert ist, jedoch die Voraussetzungen für Zahlungsgarantie nicht erfüllt sind, wird die Zahlung ohne Zahlungsgarantie verarbeitet. Die Voraussetzungen finden Sie in der Installationsanleitung unter "Zahlungsgarantie aktivieren"'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B_TITLE','B2B-Kunden erlauben'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B_DESC','B2B-Kunden erlauben, Bestellungen aufzugeben'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE_TITLE','Aktion für vom Besteller autorisierte Zahlungen.'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE_DESC','Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht. Authorize prüft die Zahlungsdetails und reserviert Mittel, um sie später zu erfassen, damit der Händler Zeit hat, über die Bestellung zu entscheiden.

Zahlung autorisieren'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION_TITLE','Kauf mit einem Klick'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION_DESC','Zahlungsdaten, die während des Bestellvorgangs gespeichert werden, können für zukünftige Zahlungen verwendet werden'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SAVE_CARD_DETAILS', 'Sparen für zukünftige Käufe'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_NEW_ACCOUNT_DETAILS', 'Verwenden Sie eine neue Zahlungsmethode'); +define('MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR', 'Ihre Kontodaten sind ungültig'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE', 'Geben Sie Ihr Geburtsdatum ein'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE_TITLE', 'Fälligkeitsdatum der Zahlung'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE_DESC', 'Geben Sie die Anzahl der Tage ein, nach denen der Zahlungsbetrag eingezogen werden soll (muss zwischen 2 und 14 Tagen liegen) '); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_FORMAT', 'TT-MM-JJJJ'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers'); +define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt'); +?> diff --git a/lang/german/modules/payment/novalnet_ideal.php b/lang/german/modules/payment/novalnet_ideal.php new file mode 100644 index 0000000..0a71ff5 --- /dev/null +++ b/lang/german/modules/payment/novalnet_ideal.php @@ -0,0 +1,21 @@ + diff --git a/lang/german/modules/payment/novalnet_instalment_invoice.php b/lang/german/modules/payment/novalnet_instalment_invoice.php new file mode 100644 index 0000000..7509375 --- /dev/null +++ b/lang/german/modules/payment/novalnet_instalment_invoice.php @@ -0,0 +1,31 @@ + Grundanforderungen: Erlaubte B2C-Länder: Deutschland, Österreich, Schweiz
Erlaubte B2B-Länder: Europäische Union
Erlaubte Währung: €
Mindestbestellwert: 19,98 €
Bitte beachten Sie, dass der Betrag einer Rate mindestens 9.99 EUR betragen muss und Raten, die diese Kriterien nicht erfüllen, nicht im Ratenplan angezeigt werden
Mindestalter: 18 Jahre oder mehr
Rechnungsadresse und Lieferadresse müssen übereinstimmen'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_BASIC_REQ_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MINIMUM_ORDER_AMOUNT_TITLE',' Mindestbestellbetrag'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MINIMUM_ORDER_AMOUNT_DESC','Mindestbestellbetrag zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B_TITLE','B2B-Kunden erlauben'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B_DESC','B2B-Kunden erlauben, Bestellungen aufzugeben'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE_TITLE','Aktion für vom Besteller autorisierte Zahlungen.'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE_DESC','Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht. Authorize prüft die Zahlungsdetails und reserviert Mittel, um sie später zu erfassen, damit der Händler Zeit hat, über die Bestellung zu entscheiden.

Zahlung autorisieren'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE_TITLE', 'Anzahl der Raten'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE_DESC', 'Wählen Sie die zeitliche Abfolge der Raten für den Ratenzahlungsplan'); +?> diff --git a/lang/german/modules/payment/novalnet_instalment_sepa.php b/lang/german/modules/payment/novalnet_instalment_sepa.php new file mode 100644 index 0000000..1fb939d --- /dev/null +++ b/lang/german/modules/payment/novalnet_instalment_sepa.php @@ -0,0 +1,37 @@ + Grundanforderungen: Erlaubte B2C-Länder: Deutschland, Österreich, Schweiz
Erlaubte B2B-Länder: Europäische Union
Erlaubte Währung: €
Mindestbestellwert: 19,98 €
Bitte beachten Sie, dass der Betrag einer Rate mindestens 9.99 EUR betragen muss und Raten, die diese Kriterien nicht erfüllen, nicht im Ratenplan angezeigt werden
Mindestalter: 18 Jahre oder mehr
Rechnungsadresse und Lieferadresse müssen übereinstimmen'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_BASIC_REQ_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MINIMUM_ORDER_AMOUNT_TITLE','Mindestbestellbetrag'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MINIMUM_ORDER_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_DESC',' '); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B_TITLE','B2B-Kunden erlauben'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B_DESC','B2B-Kunden erlauben, Bestellungen aufzugeben'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE_TITLE','Aktion für vom Besteller autorisierte Zahlungen.'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE_DESC','Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht. Authorize prüft die Zahlungsdetails und reserviert Mittel, um sie später zu erfassen, damit der Händler Zeit hat, über die Bestellung zu entscheiden.

Zahlung autorisieren'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE_TITLE', 'Anzahl der Raten'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE_DESC', 'Wählen Sie die zeitliche Abfolge der Raten für den Ratenzahlungsplan'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE_TITLE', 'Fälligkeitsdatum (in Tagen)'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE_DESC', 'Anzahl der Tage, nach denen die Zahlung abgebucht wird (muss zwischen 2 und 14 Tagen liegen)'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION_TITLE', 'Kauf mit einem Klick'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION_DESC', 'Zahlungsdaten, die während des Bestellvorgangs gespeichert werden, können für zukünftige Zahlungen verwendet werden'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SAVE_CARD_DETAILS', 'Sparen für zukünftige Käufe'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_NEW_ACCOUNT_DETAILS', 'Verwenden Sie eine neue Zahlungsmethode'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers'); +define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt'); +?> diff --git a/lang/german/modules/payment/novalnet_instantbank.php b/lang/german/modules/payment/novalnet_instantbank.php new file mode 100644 index 0000000..633a6e8 --- /dev/null +++ b/lang/german/modules/payment/novalnet_instantbank.php @@ -0,0 +1,21 @@ + diff --git a/lang/german/modules/payment/novalnet_invoice.php b/lang/german/modules/payment/novalnet_invoice.php new file mode 100644 index 0000000..e499f91 --- /dev/null +++ b/lang/german/modules/payment/novalnet_invoice.php @@ -0,0 +1,30 @@ +
Zahlung autorisieren'); +define('MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung'); +define('MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).'); +define('MODULE_PAYMENT_NOVALNET_INVOICE_VISIBILITY_BY_AMOUNT_TITLE','Mindestbestellbetrag'); +define('MODULE_PAYMENT_NOVALNET_INVOICE_VISIBILITY_BY_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)'); +define('MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers'); +define('MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt'); +?> diff --git a/lang/german/modules/payment/novalnet_multibanco.php b/lang/german/modules/payment/novalnet_multibanco.php new file mode 100644 index 0000000..7061377 --- /dev/null +++ b/lang/german/modules/payment/novalnet_multibanco.php @@ -0,0 +1,23 @@ + diff --git a/lang/german/modules/payment/novalnet_online_bank_transfer.php b/lang/german/modules/payment/novalnet_online_bank_transfer.php new file mode 100644 index 0000000..3eb1f76 --- /dev/null +++ b/lang/german/modules/payment/novalnet_online_bank_transfer.php @@ -0,0 +1,21 @@ + diff --git a/lang/german/modules/payment/novalnet_paypal.php b/lang/german/modules/payment/novalnet_paypal.php new file mode 100644 index 0000000..006c14c --- /dev/null +++ b/lang/german/modules/payment/novalnet_paypal.php @@ -0,0 +1,25 @@ +
Zahlung autorisieren'); +define('MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung'); +define('MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).'); +?> diff --git a/lang/german/modules/payment/novalnet_postfinance.php b/lang/german/modules/payment/novalnet_postfinance.php new file mode 100644 index 0000000..db6fe7b --- /dev/null +++ b/lang/german/modules/payment/novalnet_postfinance.php @@ -0,0 +1,21 @@ + diff --git a/lang/german/modules/payment/novalnet_postfinance_card.php b/lang/german/modules/payment/novalnet_postfinance_card.php new file mode 100644 index 0000000..ef24413 --- /dev/null +++ b/lang/german/modules/payment/novalnet_postfinance_card.php @@ -0,0 +1,21 @@ + diff --git a/lang/german/modules/payment/novalnet_prepayment.php b/lang/german/modules/payment/novalnet_prepayment.php new file mode 100644 index 0000000..3496860 --- /dev/null +++ b/lang/german/modules/payment/novalnet_prepayment.php @@ -0,0 +1,25 @@ + diff --git a/lang/german/modules/payment/novalnet_przelewy24.php b/lang/german/modules/payment/novalnet_przelewy24.php new file mode 100644 index 0000000..3d8b44f --- /dev/null +++ b/lang/german/modules/payment/novalnet_przelewy24.php @@ -0,0 +1,21 @@ + diff --git a/lang/german/modules/payment/novalnet_sepa.php b/lang/german/modules/payment/novalnet_sepa.php new file mode 100644 index 0000000..649e140 --- /dev/null +++ b/lang/german/modules/payment/novalnet_sepa.php @@ -0,0 +1,31 @@ +
'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ALLOWED_TITLE','Erlaubte Zone(n)'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ALLOWED_DESC','Diese Zahlungsmethode ist nur für die angegebene(n) Zone(n) zulässig. Geben Sie die Zone(n) in folgendem Format ein, z.B: DE, AT, CH. Wenn das Feld leer ist, werden alle Zonen zugelassen..'); +define('MODULE_PAYMENT_NOVALNET_SEPA_STATUS_TITLE','Zahlungsart aktivieren'); +define('MODULE_PAYMENT_NOVALNET_SEPA_STATUS_DESC','Möchten Sie Sepa-Zahlungen akzeptieren?'); +define('MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE_TITLE','Testmodus aktivieren'); +define('MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE_DESC','Die Zahlung wird im Testmodus durchgeführt, daher wird der Betrag für diese Transaktion nicht eingezogen.'); +define('MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE_TITLE','Fälligkeitsdatum (in Tagen)'); +define('MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE_DESC','Geben Sie die Anzahl der Tage ein, nach denen der Zahlungsbetrag eingezogen werden soll (muss zwischen 2 und 14 Tagen liegen) '); +define('MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER_TITLE','Sortierreihenfolge anzeigen'); +define('MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER_DESC','Sortierreihenfolge anzeigen; der niedrigste Wert wird zuerst angezeigt.'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ORDER_STATUS_TITLE','Status für erfolgreichen Auftragsabschluss'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ORDER_STATUS_DESC','Status, der für erfolgreiche Bestellungen zu verwenden ist'); +define('MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE_TITLE','Zahlungsbereich'); +define('MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE_DESC','Wenn eine Zone ausgewählt wird, wird diese Zahlungsmethode nur für diese Zone aktiviert.'); +define('MODULE_PAYMENT_NOVALNET_SEPA_IBAN','IBAN'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ACCOUNT_HOLDER','Kontoinhaber'); +define('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE_TITLE','Aktion für vom Besteller autorisierte Zahlungen.'); +define('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE_DESC','Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht.'); +define('MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung'); +define('MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).'); +define('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION_TITLE','Kauf mit einem Klick'); +define('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION_DESC','Zahlungsdaten, die während des Bestellvorgangs gespeichert werden, können für zukünftige Zahlungen verwendet werden'); +define('MODULE_PAYMENT_NOVALNET_SEPA_VISIBILITY_BY_AMOUNT_TITLE','Mindestbestellbetrag'); +define('MODULE_PAYMENT_NOVALNET_SEPA_VISIBILITY_BY_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers.'); +define('MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt.'); +?> diff --git a/lang/german/modules/payment/novalnet_trustly.php b/lang/german/modules/payment/novalnet_trustly.php new file mode 100644 index 0000000..92452c8 --- /dev/null +++ b/lang/german/modules/payment/novalnet_trustly.php @@ -0,0 +1,22 @@ + + diff --git a/lang/german/modules/payment/novalnet_wechatpay.php b/lang/german/modules/payment/novalnet_wechatpay.php new file mode 100644 index 0000000..700f3d9 --- /dev/null +++ b/lang/german/modules/payment/novalnet_wechatpay.php @@ -0,0 +1,22 @@ + + diff --git a/novalnet_auto_config.php b/novalnet_auto_config.php new file mode 100644 index 0000000..2f59c79 --- /dev/null +++ b/novalnet_auto_config.php @@ -0,0 +1,71 @@ + $signature, + ]; + $data['custom'] = [ + 'lang' => strtoupper($_REQUEST['lang']) + ]; + if($action == 'merchant') { // For merchant credentials + $endpoint = 'https://payport.novalnet.de/v2/merchant/details'; + } elseif($action == 'webhook') { // For webhook + $endpoint = 'https://payport.novalnet.de/v2/webhook/configure'; + $data['webhook'] = [ + 'url' => $_REQUEST['webhook_url'] + ]; + } + $json_data = json_encode($data); + $response = send_request($json_data, $endpoint, $access_key); // Sending request to Novalnet + echo $response; + exit(); + +} + +/** + * cURL call + * + * @param $data + * @param $url + * + * @return $result + */ +function send_request($data, $url, $access_key) { + $encoded_data = base64_encode($access_key); + $headers = [ + 'Content-Type:application/json', + 'Charset:utf-8', + 'Accept:application/json', + 'X-NN-Access-Key:' . $encoded_data, + ]; + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + $result = curl_exec($curl); + if (curl_errno($curl)) { + echo 'Request Error:' . curl_error($curl); + return $result; + } + curl_close($curl); + return $result; +} +?> diff --git a/novalnet_token_delete.php b/novalnet_token_delete.php new file mode 100644 index 0000000..4e88b55 --- /dev/null +++ b/novalnet_token_delete.php @@ -0,0 +1,21 @@ + $payment_data['token'], + 'zero_amount_booking' => $payment_data['zero_amount_booking'] + ); + $cardDetails = json_encode($cardDetails); + } + xtc_db_query("UPDATE novalnet_transaction_detail SET payment_details = '$cardDetails' WHERE (status = 'CONFIRMED' or status = 'ON_HOLD' or status = 'PENDING') and id='" . $_REQUEST['id'] . "'"); + unset($_SESSION['saved_card_details']); + $json_data = json_encode($data); + echo $json_data; + exit; +} +?> diff --git a/novalnet_wallet_payment_process.php b/novalnet_wallet_payment_process.php new file mode 100644 index 0000000..14566e3 --- /dev/null +++ b/novalnet_wallet_payment_process.php @@ -0,0 +1,405 @@ +before_process(); + $payment_modules->after_process(); + + require_once (DIR_FS_CATALOG. 'system/classes/orders/SendOrderProcess.inc.php'); + $coo_send_order_process = MainFactory::create_object('SendOrderProcess'); + $coo_send_order_process->set_('order_id',$_SESSION['tmp_oID']); + $coo_send_order_process->proceed(); + + // BOF GM_MOD GX-Customizer + require(DIR_FS_CATALOG . 'gm/modules/gm_gprint_order.php'); + + // Reset shopping cart + $_SESSION['cart']->reset(true); + xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL')); +} +if (empty($_SESSION['nn_order'])) { + require_once('includes/classes/order.php'); + $order = new order(); +} else { + $order = $_SESSION['nn_order']; +} + +if (!isset($_SESSION['customer_id']) || empty($_SESSION['customer_id'])) { + $country_query = xtc_db_fetch_array(xtc_db_query("SELECT countries_id FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $response['variable_name']['response']['order']['billing']['contact']['countryCode']."'")); + $stateParam = (($response['payment_name'] == 'novalnet_googlepay' && !empty($response['variable_name']['response']['order']['billing']['contact']['administrativeArea'])) ? $response['variable_name']['response']['order']['billing']['contact']['administrativeArea'] : $response['variable_name']['response']['order']['billing']['countryCode']); + if (empty($stateParam)) { + $state_query = xtc_db_fetch_array(xtc_db_query("SELECT zone_id FROM " . TABLE_ZONES . " WHERE zone_country_id = '".$country_query['countries_id']."' limit 1")); + } + else { + $state_query = xtc_db_fetch_array(xtc_db_query("SELECT zone_id FROM " . TABLE_ZONES . " WHERE zone_code = '$stateParam' and zone_country_id = '".$country_query['countries_id']."'")); + } + + $customer_array = array( + 'firstname' => empty($response['variable_name']['response']['order']['shipping']['contact']['firstName']) ? $response['variable_name']['response']['order']['billing']['contact']['firstName'] : $response['variable_name']['response']['order']['shipping']['contact']['firstName'] , + 'lastname' => empty($response['variable_name']['response']['order']['shipping']['contact']['lastName']) ? $response['variable_name']['response']['order']['billing']['contact']['lastName'] : $response['variable_name']['response']['order']['shipping']['contact']['lastName'] , + 'street_address' => $response['variable_name']['response']['order']['billing']['contact']['addressLines'] , + 'company' => '', + 'vat' => '', + 'telephone' => '', + 'fax' => '', + 'city' => $response['variable_name']['response']['order']['billing']['contact']['locality'], + 'state' => $state_query['zone_id'], + 'postcode' => $response['variable_name']['response']['order']['billing']['contact']['postalCode'] , + 'country' => $country_query['countries_id'], + 'email_address' => ($response['payment_name'] == 'novalnet_googlepay') ? $response['variable_name']['response']['order']['billing']['contact']['email'] : $response['variable_name']['response']['order']['shipping']['contact']['email'], + ); + +$inputTransformer = MainFactory::create('CustomerInputToCollectionTransformer'); + +/** * @var CountryService $countryService */ +$countryService = StaticGXCoreLoader::getService('Country'); + +$customerCollection = $inputTransformer->getRegistreeCollectionFromInputArray($customer_array, $countryService); + +$createAccountProcess = MainFactory::create('CreateAccountProcess', + StaticGXCoreLoader::getService('CustomerWrite'), + $countryService); + + $createAccountProcess->proceedRegistree($customerCollection, + MainFactory::create('GMLogoManager', 'gm_logo_mail')); + +} +if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') { + $discount_price = round($xtPrice->xtcFormat($_SESSION['nn_order']->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2); +} +$received_address = $response['variable_name']['response']; +$_SESSION['shipping']['id'] = $received_address['order']['shipping']['method']['identifier']; +$_SESSION['received_data'] = $response['variable_name']['response']; +$_SESSION['token'] = $response['variable_name']['response']['transaction']['token']; +$order->info['shipping_method'] = $received_address['order']['shipping']['method']['label']; +$order->info['shipping_class'] = $received_address['order']['shipping']['method']['identifier']; +$order->info['shipping_cost'] = number_format($received_address['order']['shipping']['method']['amount']/100, 2); +$order->info['payment_method'] = $_SESSION['payment']; +$order->info['payment_class'] = $_SESSION['payment']; +$order->info['total'] = ($order->info['subtotal'] + $order->info['shipping_cost']) - round($discount_price, 2); + +$payment_modules->before_process(); + +require_once('includes/classes/order_total.php'); +$order_total_modules = new order_total(); + +$order_totals = $order_total_modules->process(); + +// Check if tmp order need to be created when cart page or product page load +if (${$_SESSION['payment']}->tmpOrders) { + $tmp = true; + $orders_status_id = ${$_SESSION['payment']}->tmpStatus; +} else { + $orders_status_id = constant('MODULE_PAYMENT_'.strtoupper($response['payment_name']).'_ORDER_STATUS'); +} + +if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == 1) { + $discount = $_SESSION['customers_status']['customers_status_ot_discount']; +} else { + $discount = '0.00'; +} +if (!empty($response['variable_name']['response']['order']['billing']['contact']['countryCode'])) { + $billing_countryQuery = xtc_db_fetch_array(xtc_db_query("SELECT countries_name FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $response['variable_name']['response']['order']['billing']['contact']['countryCode']."'")); +} +if (!empty($response['variable_name']['response']['order']['shipping']['contact']['countryCode'])) { + $delivery_countryQuery = xtc_db_fetch_array(xtc_db_query("SELECT countries_name FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $response['variable_name']['response']['order']['shipping']['contact']['countryCode']."'")); +} + +$sql_data_array = array( + 'customers_id' => $_SESSION['customer_id'], + 'customers_name' => ($received_address['order']['billing']['contact']['firstName'] . ' ' . $received_address['order']['billing']['contact']['lastName']), + 'customers_firstname' => $received_address['order']['shipping']['contact']['firstName'] , + 'customers_lastname' => $received_address['order']['shipping']['contact']['lastName'] , + 'customers_gender' => !empty($order->customer['gender']) ? $order->customer['gender'] : 'o', + 'customers_status' => $_SESSION['customers_status']['customers_status_id'], + 'customers_status_name' => $_SESSION['customers_status']['customers_status_name'], + 'customers_status_image' => $_SESSION['customers_status']['customers_status_image'], + 'customers_status_discount' => $discount, + 'customers_street_address' => $received_address['order']['billing']['contact']['addressLines'] , + 'customers_suburb' => $order->customer['suburb'], + 'customers_city' => $received_address['order']['billing']['contact']['locality'], + 'customers_postcode' => $received_address['order']['billing']['contact']['postalCode'] , + 'customers_country' => $received_address['order']['billing']['contact']['country'] , + 'customers_email_address' => ($response['payment_name'] == 'novalnet_googlepay') ? $received_address['order']['billing']['contact']['email'] : $received_address['order']['shipping']['contact']['email'], + 'customers_address_format_id' => $order->customer['format_id'], + 'delivery_name' => (empty($received_address['order']['shipping']['contact']['firstName']) ? $received_address['order']['billing']['contact']['firstName'] . ' ' . $received_address['order']['billing']['contact']['lastName'] : $received_address['order']['shipping']['contact']['firstName'] . ' ' . $received_address['order']['shipping']['contact']['lastName']), + 'delivery_firstname' => (empty($received_address['order']['shipping']['contact']['firstName']) ? $received_address['order']['billing']['contact']['firstName'] : $received_address['order']['shipping']['contact']['firstName']), + 'delivery_lastname' => (empty($received_address['order']['shipping']['contact']['lastName']) ? $received_address['order']['shipping']['contact']['lastName'] : $received_address['order']['shipping']['contact']['lastName']), + 'delivery_street_address' => (empty($received_address['order']['shipping']['contact']['addressLines']) ? $received_address['order']['billing']['contact']['addressLines'] : $received_address['order']['shipping']['contact']['addressLines']), + 'delivery_city' => (empty($received_address['order']['shipping']['contact']['locality']) ? $received_address['order']['billing']['contact']['locality'] : $received_address['order']['shipping']['contact']['locality']), + 'delivery_postcode' => (empty($received_address['order']['shipping']['contact']['postalCode']) ? $received_address['order']['billing']['contact']['postalCode'] : $received_address['order']['shipping']['contact']['postalCode']), + 'delivery_country' => (empty($received_address['order']['shipping']['contact']['countryCode']) ? $billing_countryQuery['countries_name'] : $delivery_countryQuery['countries_name']), + 'delivery_country_iso_code_2' => (empty($received_address['order']['shipping']['contact']['countryCode']) ? $received_address['order']['billing']['contact']['countryCode'] : $received_address['order']['shipping']['contact']['countryCode']), + 'delivery_address_format_id' => !empty($order->delivery['format_id']) ? $order->delivery['format_id'] : '5', + 'billing_name' => $received_address['order']['billing']['contact']['firstName'] . ' ' . $received_address['order']['billing']['contact']['lastName'], + 'billing_firstname' => $received_address['order']['billing']['contact']['firstName'], + 'billing_lastname' => $received_address['order']['billing']['contact']['lastName'], + 'billing_street_address' => $received_address['order']['billing']['contact']['addressLines'], + 'billing_city' => $received_address['order']['billing']['contact']['locality'], + 'billing_postcode' => $received_address['order']['billing']['contact']['postalCode'], + 'billing_country' => $billing_countryQuery['countries_name'], + 'billing_country_iso_code_2' => $received_address['order']['billing']['contact']['countryCode'], + 'billing_address_format_id' => !empty($order->delivery['format_id']) ? $order->delivery['format_id'] : '5', + 'payment_method' => $order->info['payment_method'], + 'payment_class' => ${$_SESSION['payment']}->title, + 'shipping_method' => $received_address['order']['shipping']['method']['label'], + 'shipping_class' => $received_address['order']['shipping']['method']['identifier'], + 'date_purchased' => 'now()', + 'orders_status' => $orders_status_id, + 'currency' => $order->info['currency'], + 'currency_value' => $order->info['currency_value'], + 'account_type' => $_SESSION['account_type'], + 'conversion_type' => 1, + 'customers_ip' => $_SERVER['REMOTE_ADDR'], + 'language' => $_SESSION['language'], +); + +// refID +$refID = ''; +if (isset($_SESSION['tracking']['refID'])) { + $refID = $_SESSION['tracking']['refID']; +} else { + $campaign_query = xtc_db_query("SELECT cp.campaigns_refID FROM " . TABLE_CUSTOMERS . " c JOIN " . TABLE_CAMPAIGNS . " cp ON cp.campaigns_id = c.refferers_id WHERE c.customers_id = '" . (int)$_SESSION['customer_id']."'"); + $campaign = xtc_db_fetch_array($campaign_query); + $refID = $campaign['campaigns_refID']; +} +if ($refID != '') { + $sql_data_array['campaign'] = $refID; +} +// Check if late or direct sale +$customers_logon_query = xtc_db_query("SELECT customers_info_number_of_logons FROM " . TABLE_CUSTOMERS_INFO . " WHERE customers_info_id = '" . (int)$_SESSION['customer_id'] . "'"); $customers_logon = xtc_db_fetch_array($customers_logon_query); +if ($customers_logon['customers_info_number_of_logons'] > 1) { + $sql_data_array['conversion_type'] = 2; +} +xtc_db_perform(TABLE_ORDERS, $sql_data_array); +$insert_id = xtc_db_insert_id(); +$_SESSION['tmp_oID'] = $insert_id; + +for ($i = 0, $n = sizeof($order_totals); $i < $n; $i ++) { + $sql_data_array = array( + 'orders_id' => $insert_id, + 'title' => $order_totals[$i]['title'], + 'text' => $order_totals[$i]['text'], + 'value' => $order_totals[$i]['value'], + 'class' => $order_totals[$i]['code'], + 'sort_order' => $order_totals[$i]['sort_order'] + ); + xtc_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); +} +/* magnalister v1.0.1 */ +if (function_exists('magnaExecute')) magnaExecute('magnaInsertOrderDetails', array('oID' => $insert_id), array('order_details.php')); +if (function_exists('magnaExecute')) magnaExecute('magnaInventoryUpdate', array('action' => 'inventoryUpdateOrder'), array('inventoryUpdate.php')); +/* END magnalister */ +$customer_notification = (SEND_EMAILS == 'true') ? '1' : '0'; +$sql_data_array = array( + 'orders_id' => $insert_id, + 'orders_status_id' => $orders_status_id, + 'date_added' => 'now()', + 'customer_notified' => $customer_notification, + 'comments' => xtc_db_prepare_input($order->info['comments']) +); + +xtc_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); +$_SESSION['disable_products'] = array(); +for ($i = 0, $n = sizeof($order->products); $i < $n; $i ++) { + // Stock update + $stock_set = ''; + if (STOCK_LIMITED == 'true') { + if (DOWNLOAD_ENABLED == 'true') { + $add_stock_query_raw = ''; + $products_attributes = $order->products[$i]['attributes']; + if (is_array($products_attributes)) { + $add_stock_query_raw .= " AND pa.options_id = '".$products_attributes[0]['option_id']."' AND pa.options_values_id = '".$products_attributes[0]['value_id']."'"; + } + $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES." pa ON p.products_id = pa.products_id " . $add_stock_query_raw . " LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id = pad.products_attributes_id WHERE p.products_id = '" . xtc_get_prid($order->products[$i]['id']) . "'"; + // Will work with only one option for downloadable products + // otherwise, we have to build the query dynamically with a loop + $stock_query = xtc_db_query($stock_query_raw); + } else { + $stock_query = xtc_db_query("SELECT products_quantity FROM " . TABLE_PRODUCTS . " WHERE products_id = '" . xtc_get_prid($order->products[$i]['id']) . "'"); + } + if (xtc_db_num_rows($stock_query) > 0) { + $stock_values = xtc_db_fetch_array($stock_query); + // Do not decrement quantities if products_attributes_filename exists + if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) { + $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty']; + } else { + $stock_left = $stock_values['products_quantity']; + } + $stock_set = " products_quantity = '".$stock_left."', "; + if (($stock_left < 1) && (STOCK_CHECKOUT_UPDATE_PRODUCTS_STATUS == 'true')) { + $_SESSION['disable_products'][] = xtc_get_prid($order->products[$i]['id']); + } + } + } + // Update product + xtc_db_query("UPDATE " . TABLE_PRODUCTS . " SET " . $stock_set . "products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " WHERE products_id = '" .xtc_get_prid($order->products[$i]['id']) . "'"); + $sql_data_array = array( + 'orders_id' => $insert_id, + 'products_id' => xtc_get_prid($order->products[$i]['id']), + 'products_model' => $order->products[$i]['model'], + 'products_name' => $order->products[$i]['name'], + 'products_price' => $order->products[$i]['price'], + 'products_shipping_time' => strip_tags($order->products[$i]['shipping_time']), + 'products_discount_made' => $order->products[$i]['discount_allowed'], + 'final_price' => $order->products[$i]['final_price'], + 'products_tax' => $order->products[$i]['tax'], + 'products_quantity' => $order->products[$i]['qty'], + 'allow_tax' => $_SESSION['customers_status']['customers_status_show_price_tax'], + ); + + foreach(auto_include(DIR_FS_CATALOG.'includes/extra/checkout/checkout_process_products/', 'php') as $file) require ($file); + xtc_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); + $order_products_id = xtc_db_insert_id(); + // update specials quantity + $specials_query = xtc_db_query("SELECT `products_id`, `specials_quantity` FROM `". TABLE_SPECIALS ."` WHERE `products_id` = '" . xtc_get_prid($order->products[$i]['id']) . "'" .`SPECIALS_CONDITIONS`); + if (xtc_db_num_rows($specials_query)) { + $specials = xtc_db_fetch_array($specials_query); + if ($specials['specials_quantity'] != 0) { + $specials_quantity = ($specials['specials_quantity'] - $order->products[$i]['qty']); + $stock_set = ''; + if ($specials_quantity < 1) { + $stock_set = " status = '0', "; + } + xtc_db_query("UPDATE `" . TABLE_SPECIALS . "` SET " . $stock_set . "`specials_quantity` = '" . $specials_quantity . "' WHERE `products_id` = '" . xtc_get_prid($order->products[$i]['id']) . "' "); + } + } + $order_total_modules->update_credit_account($i); // GV Code ICW ADDED FOR CREDIT CLASS SYSTEM + if (isset($order->products[$i]['attributes'])) { + $order->products[$i]['attributes'] = array_values($order->products[$i]['attributes']); // reset keys for $j + for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j ++) { + // Update attribute stock + $update_attr_stock = false; + if (STOCK_LIMITED == 'true' && isset($order->products[$i]['attributes'][$j]['value_id']) && isset($order->products[$i]['attributes'][$j]['option_id'])) { + $update_attr_stock = true; + if (DOWNLOAD_ENABLED == 'true') { + $attr_stock_query = xtc_db_query("SELECT pad.products_attributes_filename FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id = pad.products_attributes_id WHERE pa.products_id = '" . xtc_get_prid($order->products[$i]['id']) . "' AND pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' AND pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'"); + $update_attr_stock = ((xtc_db_num_rows($attr_stock_query) > 0) ? false : true); + } + } + // Update attribute stock + if ($update_attr_stock === true) { + xtc_db_query("UPDATE " . TABLE_PRODUCTS_ATTRIBUTES . " SET attributes_stock = attributes_stock - '" . $order->products[$i]['qty'] . "' WHERE products_id = '" . xtc_get_prid($order->products[$i]['id']) . "' AND options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' AND options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'"); + } + // Attributes + $sql_data_array = array( + 'orders_id' => $insert_id, + 'orders_products_id' => $order_products_id, + 'products_options' => $order->products[$i]['attributes'][$j]['option'], + 'products_options_values' => $order->products[$i]['attributes'][$j]['value'], + 'options_values_price' => $order->products[$i]['attributes'][$j]['price'], + 'price_prefix' => $order->products[$i]['attributes'][$j]['prefix'], + 'options_id' => $order->products[$i]['attributes'][$j]['option_id'], + 'options_values_id' => $order->products[$i]['attributes'][$j]['value_id'], + ); + foreach(auto_include(DIR_FS_CATALOG.'includes/extra/checkout/checkout_process_attributes/','php') as $file) require ($file); + xtc_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array); + // Attributes download + if (DOWNLOAD_ENABLED == 'true') { + $attributes_dl_query = xtc_db_query("SELECT pad.products_attributes_maxdays, pad.products_attributes_maxcount, pad.products_attributes_filename FROM " . TABLE_PRODUCTS_ATTRIBUTES." pa LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id = pad.products_attributes_id WHERE pa.products_id = '" .$order->products[$i]['id'] . "' AND pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' AND pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'"); + $attributes_dl_array = xtc_db_fetch_array($attributes_dl_query); + if (isset($attributes_dl_array['products_attributes_filename']) && xtc_not_null($attributes_dl_array['products_attributes_filename'])) { + $sql_data_array = array( + 'orders_id' => $insert_id, + 'orders_products_id' => $order_products_id, + 'orders_products_filename' => $attributes_dl_array['products_attributes_filename'], + 'download_maxdays' => $attributes_dl_array['products_attributes_maxdays'], + 'download_count' => $attributes_dl_array['products_attributes_maxcount'], + ); + foreach(auto_include(DIR_FS_CATALOG.'includes/extra/checkout/checkout_process_download/','php') as $file) require ($file); + xtc_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array); + } + } + } + } +} + +foreach(auto_include(DIR_FS_CATALOG.'includes/extra/checkout/checkout_process_order/', 'php') as $file) require ($file); + +if ($tmp == true) { + $payment_modules->payment_action(); + $response = json_encode(['redirect_url' => $_SESSION['nn_redirect_url'], 'isRedirect'=>1], true); + echo $response; + exit; +} +$payment_modules->after_process(); +require_once (DIR_FS_CATALOG. 'system/classes/orders/SendOrderProcess.inc.php'); +$coo_send_order_process = MainFactory::create_object('SendOrderProcess'); +$coo_send_order_process->set_('order_id', $insert_id); +$coo_send_order_process->proceed(); + +// BOF GM_MOD GX-Customizer +require(DIR_FS_CATALOG . 'gm/modules/gm_gprint_order.php'); + +// Reset shopping cart +$_SESSION['cart']->reset(true); + +foreach(auto_include(DIR_FS_CATALOG.'includes/extra/checkout/checkout_process_end/', 'php') as $file) require ($file); +unset($_SESSION['nn_order']); +unset($_SESSION['initial_shipping_amount']); +unset($_SESSION['method_update_shipping_amount']); + +// unregister session variables used during checkout +unset($_SESSION['sendto']); +unset($_SESSION['delivery_zone']); +unset($_SESSION['billto']); +unset($_SESSION['shipping']); +unset($_SESSION['payment']); +unset($_SESSION['comments']); +unset($_SESSION['last_order']); +unset($_SESSION['tmp_oID']); +unset($_SESSION['cc']); +unset($_SESSION['disable_products']); +// GV Code Start +if (isset($_SESSION['credit_covers'])) { + unset($_SESSION['credit_covers']); +} +$return_url = xtc_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'); +$response = json_encode(['return_url' => $return_url], true); +echo $response; +exit; +function auto_include($dir, $ext = 'php', $expr = '*', $flags = 0) { + $dir = rtrim($dir, '/'); + $files = glob("{$dir}/$expr." . $ext, $flags); + $files = ((false !== $files) ? $files : array()); + natcasesort($files); + if (function_exists('debugMessage')) { + debugMessage('auto_include',$files); + } + return $files; +} + +?> diff --git a/novalnet_wallet_shipping_data_update_process.php b/novalnet_wallet_shipping_data_update_process.php new file mode 100644 index 0000000..fcc6efb --- /dev/null +++ b/novalnet_wallet_shipping_data_update_process.php @@ -0,0 +1,407 @@ +get_available_combis_ids_by_values($post['products_id'], $post['variant_info']); + if(empty($_SESSION['cart'])) { + $_SESSION['cart'] = new shoppingCart(); + $cart_object = $_SESSION['cart']; + } + $amount = 0; + if($combi_id) { + $variant_data = $coo_properties_control->get_properties_combis_details($combi_id[0], 1); + foreach ($variant_data as $key => $value) { + $amount += $value['value_price']; + } + } + $response = json_encode(['amount' => (string)($amount * 100)], true); + echo $response; + exit; +} + + +if ($post['action'] == 'add_virtual_product_in_cart') { + if (isset($post['products_id']) && isset($post['products_qty'])) { // Add product to cart in product page + if(empty($_SESSION['cart'])) { + $_SESSION['cart'] = new shoppingCart(); + $cart_object = $_SESSION['cart']; + } + + if (isset($post['products_id']) && is_numeric($post['products_id']) && isset($post['products_qty']) && $post['products_qty'] > 0) { + $cart_quantity = (xtc_remove_non_numeric($post['products_qty']) + $cart_object->get_quantity(xtc_get_uprid($post['products_id'], $post['attribute_info']))); + $cart_object->add_cart((int)$post['products_id'], $cart_quantity, $post['attribute_info']); + + } + } + $order = new order(); + $virtual_articleDetails = []; + if ($post['get_article_details'] == 1) { + foreach($order->products as $products) { + $virtual_articleDetails[] = array( + 'label'=> $products['name']. ' x ' .$products['qty'], + 'amount' => (string)(($products['qty'] * $products['price'])*100), + 'type' => 'SUBTOTAL', + ); + } + // Price incl tax + if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0' && ($order->info['tax'] != 0)) { + $virtual_articleDetails[] = array( + 'label' => 'Incl.Tax', + 'amount' => (string)((round($order->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } else if($order->info['tax'] != 0){ // Price excl tax + $virtual_articleDetails[] = array( + 'label' => 'Excl.Tax', + 'amount' => (string)((round($order->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } + if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') { + $discount_price = round($xtPrice->xtcFormat($order->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2); + $virtual_articleDetails[] = array( + 'label' => $_SESSION['customers_status']['customers_status_discount']. '%' . 'Discount', + 'amount' => (string) (round($discount_price, 2) *100), + 'type' => 'SUBTOTAL' + ); + } + } + if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0') { + $amount = (string)($order->info['total'] * 100) - (string) (round($discount_price, 2) *100); + } else { + $amount = (string)($order->info['total'] * 100) + (string)((round($order->info['tax'], 2))*100) - (string) (round($discount_price, 2) *100); + } + $data = json_encode(['amount' => $amount, 'article_details' => $virtual_articleDetails], true); + echo $data; + exit; +} + +if ($post['action'] == 'updated_amount') { + require_once(DIR_WS_CLASSES.'order.php'); + $order = new order(); + $articleDetails = []; + if ($post['get_article_details'] == 1) { + foreach($order->products as $products) { + $articleDetails[] = array( + 'label'=> $products['name']. ' x ' .$products['qty'], + 'amount' => (string)(($products['qty'] * $products['price'])*100), + 'type' => 'SUBTOTAL', + ); + } + // Price incl tax + if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0' && ($order->info['tax'] != 0)) { + $articleDetails[] = array( + 'label' => 'Incl.Tax', + 'amount' => (string)((round($order->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } else if($order->info['tax'] != 0){ // Price excl tax + $articleDetails[] = array( + 'label' => 'Excl.Tax', + 'amount' => (string)((round($order->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } + if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') { + $discount_price = round($xtPrice->xtcFormat($order->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2); + $articleDetails[] = array( + 'label' => $_SESSION['customers_status']['customers_status_discount']. '%' . 'Discount', + 'amount' => (string) (round($discount_price, 2) *100), + 'type' => 'SUBTOTAL' + ); + } + } + if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0') { + $amount = (string)($order->info['total'] * 100) - (string) (round($discount_price, 2) *100); + } else { + $amount = (string)($order->info['total'] * 100) + (string)((round($order->info['tax'], 2))*100) - (string) (round($discount_price, 2) *100); + } + $response = json_encode(['amount' => $amount, 'article_details' => $articleDetails], true); + echo $response; + exit; +} + +// Shipping address change +if ($post['action'] == 'novalnet_shipping_address_update') { + $response = $post['shippingInfo']; + $received_address = json_decode($response, true); + $coo_properties_control = MainFactory::create_object('PropertiesControl'); + $combi_id = $coo_properties_control->get_available_combis_ids_by_values($post['products_id'], $post['variant_info']); + if (isset($post['products_id']) && isset($post['products_qty'])) { // Add product to cart in product page + $_SESSION['cart'] = new shoppingCart(); + $cart_object = $_SESSION['cart']; + if (isset($post['products_id']) && is_numeric($post['products_id']) && isset($post['products_qty']) && $post['products_qty'] > 0) { + + $cart_quantity = (xtc_remove_non_numeric($post['products_qty']) + $cart_object->get_quantity(xtc_get_uprid($post['products_id'], isset($post['id']) ? $post['id'] : ''))); + + if ($cart_quantity > MAX_PRODUCTS_QTY) { + $cart_quantity = MAX_PRODUCTS_QTY; + $messageStack->add_session('global', sprintf(MAX_PROD_QTY_EXCEEDED, xtc_get_products_name($post['products_id']))); + } + + $cart_object->add_cart((int)$post['products_id'], $cart_quantity, '', true, $combi_id[0]); + + } + } + $order = new order(); + + $delivery_zone_query = xtc_db_fetch_array(xtc_db_query("SELECT countries_id, countries_iso_code_3 FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $received_address['address']['countryCode']."'")); + $order->delivery['country']['id'] = $delivery_zone_query['countries_id']; + $order->delivery['country']['iso_code_2'] = $received_address['address']['countryCode'];// assign country code in order object + $order->delivery['country']['iso_code_3'] = $delivery_zone_query['countries_iso_code_3']; + $order->delivery['country_id'] = $delivery_zone_query['countries_id']; + $order->delivery['country']['title'] = ''; + $order->delivery['zone_id'] = 0; + $zone_query = xtc_db_fetch_array(xtc_db_query("SELECT zone_id FROM " . TABLE_ZONES. " WHERE zone_country_id = '".$delivery_zone_query['countries_id']."' and zone_code = '" . $received_address['address']['administrativeArea']."'")); + + $_SESSION['delivery_zone'] = $received_address['address']['countryCode']; + $articleDetails = []; + if (!empty($order->products)) { + $order->info['subtotal'] = 0; + $order->info['total'] = 0; + $order->info['tax'] = 0; + $order->info['tax_groups'] =[]; + } + if (MODULE_ORDER_TOTAL_SHIPPING_STATUS == 'true') { + require_once ('includes/classes/shipping.php'); + $shipping_obj = new shipping(); + // Load all enabled shipping modules + $quotes = $shipping_obj->quote(); + foreach ($order->products as $key => $products) { + $tax_removed_amount = $xtPrice->xtcRemoveTax($order->products[$key]['price'], $order->products[$key]['tax']); + + $tax_rate = xtc_get_tax_rate($order->products[$key]['tax_class_id'], $delivery_zone_query['countries_id'], $zone_query['zone_id']); + $products_price = $xtPrice->xtcAddTax($tax_removed_amount, $tax_rate, false); + if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0') { + if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') { + $discount_price = ($xtPrice->calcTax($order->products[$key]['price'], $tax_rate) * round($_SESSION['customers_status']['customers_status_ot_discount']))/100; + $tax_value = (($xtPrice->calcTax($order->products[$key]['price'], $tax_rate)) - $discount_price) * $order->products[$key]['qty']; + } else { + $tax_value = ($products_price- $tax_removed_amount) * $order->products[$key]['qty']; + } + $products = array( + 'tax_class_id' => $products['tax_class_id'], + 'tax' => xtc_get_tax_rate($products['tax_class_id'], $delivery_zone_query['countries_id'], $zone_query['zone_id']), + 'tax_description' => xtc_get_tax_description($products['tax_class_id'], $delivery_zone_query['countries_id'], $zone_query['zone_id']), + 'price' => $products_price, + 'price_formated' => $xtPrice->xtcFormat($products_price, true), + 'final_price' => $products_price * $products['qty'], + 'final_price_formated' => $xtPrice->xtcFormat($products_price * $products['qty'], true), + ); + } else { + if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') { + $discount_price = ($xtPrice->calcTax($order->products[$key]['price'], $tax_rate) * round($_SESSION['customers_status']['customers_status_ot_discount']))/100; + $tax_value = (($xtPrice->calcTax($order->products[$key]['price'], $tax_rate)) - $discount_price) * $order->products[$key]['qty']; + } else { + $tax_value = ($xtPrice->calcTax($order->products[$key]['price'], $tax_rate)) * $order->products[$key]['qty']; + } + $products = array( + 'tax_class_id' => $products['tax_class_id'], + 'tax' => xtc_get_tax_rate($products['tax_class_id'], $delivery_zone_query['countries_id'], $zone_query['zone_id']), + 'tax_description' => xtc_get_tax_description($products['tax_class_id'], $delivery_zone_query['countries_id'], $zone_query['zone_id']), + 'price' => $order->products[$key]['price'], + 'price_formated' => $xtPrice->xtcFormat($order->products[$key]['price'], true), + 'final_price' => $order->products[$key]['price'] * $products['qty'], + 'final_price_formated' => $xtPrice->xtcFormat($order->products[$key]['price'] * $products['qty'], true), + ); + } + $order->products[$key]['tax_class_id'] = $products['tax_class_id']; + $order->products[$key]['tax'] = $products['tax']; + $order->products[$key]['tax_description'] = $products['tax_description']; + $order->products[$key]['price'] = $products['price']; + $order->products[$key]['price_formated'] = $products['price_formated']; + $order->products[$key]['final_price'] = $products['final_price']; + $order->products[$key]['final_price_formated'] = $products['final_price_formated']; + if ($tax_rate != 0) { + $order->products[$key]['tax_value'] = $tax_value; + } + // tax information needed in OrderTaxInformation class for storing orders_tax_sum_items data + $_SESSION['customer_cart_tax_info'] = [ + $products['tax_description'] => [ + 'tax_class_id' => $products['tax_class_id'], + 'country_id' => $delivery_zone_query['countries_id'], + 'zone_id' => $zone_query['zone_id'] + ] + ]; + + $order->info['subtotal'] += $order->products[$key]['final_price']; + if ($tax_rate != 0) { + $order->info['tax'] += $order->products[$key]['tax_value']; + } + $products_tax_description = $products['tax_description']; + + // Price incl tax + if ($_SESSION['customers_status']['customers_status_show_price_tax'] == '1') { + $order->info['tax_groups'][TAX_ADD_TAX . "$products_tax_description"] += (string)((round($order->products[$key]['tax_value'], 2))); + } else { // Price excl tax + $order->info['tax_groups'][TAX_NO_TAX . "$products_tax_description"] += (string)((round($order->products[$key]['tax_value'], 2))); + } + // Price incl tax + if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0' && ($order->info['tax'] != 0)) { + $articleDetails[] = array( + 'label' => 'Incl.Tax', + 'amount' => (string)((round($order->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } else if ($order->info['tax'] != 0){ // Price excl tax + $articleDetails[] = array( + 'label' => 'Excl.Tax', + 'amount' => (string)((round($order->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } + } + foreach ($order->products as $products) { + $articleDetails[] = array( + 'label' => $products['name']. 'x' .$products['qty'], + 'amount' => (string)(($products['qty'] * $products['price'])*100), + 'type' => 'SUBTOTAL' + ); + if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') { + $discount_price = round($xtPrice->xtcFormat($order->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2); + $articleDetails[] = array( + 'label' => $_SESSION['customers_status']['customers_status_discount']. '%' . 'Discount', + 'amount' => (string) (round($discount_price, 2) *100), + 'type' => 'SUBTOTAL' + ); + } + if($_SESSION['customers_status']['customers_status_show_price_tax'] != '0') { + $total += ($products['qty'] * $products['price']) - (round($discount_price, 2)); + } else { + $total += (($products['qty'] * $products['price'])) + (round($order->info['tax'], 2)) - round($discount_price, 2); + } + } + if(!empty($_SESSION['initial_shipping_amount'])) { + unset($_SESSION['initial_shipping_amount']); + } + $shipping_content = array (); + $count = 1; + for ($i = 0, $n = sizeof($quotes); $i < $n; $i ++) { + $value = 0; + $title = $quotes[$i]['module']; + if (!isset($quotes[$i]['error'])) { + for ($j = 0, $n2 = sizeof($quotes[$i]['methods']); $j < $n2; $j ++) { + if (!defined('SHOW_SHIPPING_MODULE_TITLE') || SHOW_SHIPPING_MODULE_TITLE == 'shipping_default') { + $title .= ' - ' . $quotes[$i]['methods'][$j]['title']; + } + if (isset($quotes[$i]['methods'][$j]['cost']) && $quotes[$i]['methods'][$j]['cost'] > 0) { + if (isset($quotes[$i]['tax']) && $quotes[$i]['tax'] > 0) { + $value = ($quotes[$i]['methods'][$j]['cost'] * $quotes['tax']); + } else { + $value = ($quotes[$i]['methods'][$j]['cost']); + } + } + $shipping_content[] = array( + 'label' => $title, + 'amount' => (string)($value * 100), + 'identifier' => $quotes[$i]['id'].'_'.$quotes[$i]['methods'][$j]['id'], + 'detail' => '' + ); + if ($count == 1) { + $articleDetails[] = array( + 'label' => $quotes[$i]['module'], + 'amount' => (string)($value * 100), + 'type' => 'SUBTOTAL' + ); + $total += $value; + } + $count++; + } + } + $order->info['total'] = $order->info['subtotal'] + ($xtPrice->xtcFormat($quotes[$i]['methods'][$j]['cost'], false, 0, true)) - (round($discount_price, 2) *100); + } + $_SESSION['nn_order'] = $order; + $shipping_address_change = array( + 'amount' => (string)($total*100), + 'shipping_address' => $shipping_content, + 'article_details' => $articleDetails + ); + $_SESSION['initial_shipping_amount'] = $shipping_content['amount']; + $response = json_encode($shipping_address_change, true); + echo $response; + exit; + } +} + +// Shpping method change +if($post['action'] == 'novalnet_shipping_method_update') { + $order = new order(); + $received_shipping_method = json_decode($post['shippingInfo'], true); + if(!empty($_SESSION['method_update_shipping_amount'])) { + unset($_SESSION['method_update_shipping_amount']); + } + $articleDetails = []; + foreach($_SESSION['nn_order']->products as $products) { + $articleDetails[] = array( + 'label' => $products['name']. 'x' .$products['qty'], + 'amount' => (string)(($products['qty'] * $products['price'])*100), + 'type' => 'SUBTOTAL' + ); + } + // Price incl tax + + if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0' && ($_SESSION['nn_order']->info['tax'] != 0)) { + $articleDetails[] = array( + 'label' => 'Incl.Tax', + 'amount' => (string)((round($_SESSION['nn_order']->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } else if($_SESSION['nn_order']->info['tax'] != 0){ // Price excl tax + $articleDetails[] = array( + 'label' => 'Excl.Tax', + 'amount' => (string)((round($_SESSION['nn_order']->info['tax'], 2))*100), + 'type' => 'SUBTOTAL' + ); + } + if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') { + $discount_price = round($xtPrice->xtcFormat($_SESSION['nn_order']->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2); + $articleDetails[] = array( + 'label' => $_SESSION['customers_status']['customers_status_discount']. '%' . 'Discount', + 'amount' => (string) (round($discount_price, 2) *100), + 'type' => 'SUBTOTAL' + ); + } + if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0' && ($_SESSION['nn_order']->info['tax'] != 0)) { + $total = (($_SESSION['nn_order']->info['subtotal'] * 100) - round($discount_price, 2) *100) + ($received_shipping_method['shippingMethod']['amount']*100); + } else if(($_SESSION['nn_order']->info['tax'] != 0)){ + $total = (($_SESSION['nn_order']->info['subtotal'] * 100) - round($discount_price, 2) *100) + (string)((round($_SESSION['nn_order']->info['tax'], 2))*100) + ($received_shipping_method['shippingMethod']['amount']*100); + } else { + $total = (($_SESSION['nn_order']->info['subtotal'] * 100) - round($discount_price, 2) *100) + ($received_shipping_method['shippingMethod']['amount']*100); + } + + $_SESSION['method_update_shipping_amount'] = (string)($received_shipping_method['shippingMethod']['amount']*100); + $articleDetails[] = array( + 'label' => $received_shipping_method['shippingMethod']['label'], + 'amount' => (string)($received_shipping_method['shippingMethod']['amount']*100), + 'type' => 'SUBTOTAL'); + $shipping_method_change = array( + 'article_details' => $articleDetails, + 'amount' => (string)$total); + $result = json_encode($shipping_method_change, true); + echo $result; + exit; +} +?>