write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "-transactionID={$transactionID}" . " ---------- TRANSACTION INFO ------------\n" . print_r($transaction_data, 1)); $payment_modules = new payment($transaction_data[0][4]); // load the before_process function from the payment modules //$payment_modules->before_process(); $QUERY = "SELECT id, credit, lastname, firstname, address, city, state, country, zipcode, phone, email, fax, currency " . "FROM cc_agent WHERE id = '" . $transaction_data[0][1] . "'"; $resmax = $DBHandle_max->Execute($QUERY); if ($resmax) { $numrow = $resmax->RecordCount(); } else { write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "-transactionID={$transactionID}" . " ERROR NO SUCH CUSTOMER EXISTS, CUSTOMER ID = " . $transaction_data[0][1]); exit(gettext("No Such Customer exists.")); } $customer_info = $resmax->fetchRow(); $nowDate = date("Y-m-d H:i:s"); $pmodule = $transaction_data[0][4]; $orderStatus = $payment_modules->get_OrderStatus(); $Query = "INSERT INTO cc_payments_agent ( agent_id, agent_name, agent_email_address, item_name, item_id, item_quantity, payment_method, cc_type, cc_owner, cc_number, " . " cc_expires, orders_status, last_modified, date_purchased, orders_date_finished, orders_amount, currency, currency_value) values (" . " '" . $transaction_data[0][1] . "', '" . $customer_info[3] . " " . $customer_info[2] . "', '" . $customer_info["email"] . "', 'balance', '" . $customer_info[0] . "', 1, '{$pmodule}', '" . $_SESSION["p_cardtype"] . "', '" . $transaction_data[0][5] . "', '" . $transaction_data[0][6] . "', '" . $transaction_data[0][7] . "', {$orderStatus}, '" . $nowDate . "', '" . $nowDate . "', '" . $nowDate . "', " . $amount_paid . ", '" . $currCurrency . "', '" . $currencyObject->get_value($currCurrency) . "' )"; $result = $DBHandle_max->Execute($Query); //************************UPDATE THE CREDIT IN THE CARD*********************** $id = $customer_info[0]; if ($id > 0) { $addcredit = $transaction_data[0][2]; $instance_table = new Table("cc_agent", ""); $param_update .= " credit = credit + '" . $amount_without_vat . "'"; $FG_EDITION_CLAUSE = " id='{$id}'"; $instance_table->Update_table($DBHandle, $param_update, $FG_EDITION_CLAUSE, $func_table = null); write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "-transactionID={$transactionID}" . " Update_table cc_card : {$param_update} - CLAUSE : {$FG_EDITION_CLAUSE}"); $field_insert = "date, credit, agent_id, description"; $value_insert = "'{$nowDate}', '" . $amount_without_vat . "', '{$id}', '" . $transaction_data[0][4] . "'"; $instance_sub_table = new Table("cc_logrefill_agent", $field_insert); $id_logrefill = $instance_sub_table->Add_table($DBHandle, $value_insert, null, null, 'id');