Example #1
0
 public function remove()
 {
     $paymentmodules = PaymentModules::find_by_module_key($this->module_key);
     $paymentmodules->enabled = 'N';
     $payment_module_id = $paymentmodules->id;
     $paymentmodules->save();
     PaymentConfig::delete_payment_config($this->module_key);
 }
}
$module_key = $_REQUEST['payment'];
$id = (int) $_REQUEST['id'];
if (isset($_POST['bt_update'])) {
    foreach ($_POST['payment_array'] as $key => $data) {
        $sql = "UPDATE " . TBL_PAYMENT_CONFIG . " SET config_value='" . $data . "' WHERE id={$key}";
        $db->query($sql);
    }
    redirect_to(BASE_URL . "admin/payment_edit.php?payment=" . $module_key);
    die;
}
$smarty->assign('page_title', 'Edit Payment Module: ' . $module_key);
$paymentconfig = PaymentConfig::find_by_module_key($module_key);
$i = 1;
$manage_lists = array();
foreach ($paymentconfig as $row) {
    $manage_lists[$i]['id'] = $row->id;
    $manage_lists[$i]['title'] = $row->config_title;
    $manage_lists[$i]['configuration_key'] = $row->config_key;
    $manage_lists[$i]['configuration_value'] = $row->config_value;
    $manage_lists[$i]['configuration_description'] = $row->config_desc;
    $manage_lists[$i]['input'] = PaymentConfig::setting_value($row);
    $i++;
}
$smarty->assign('payment_editmodules', $manage_lists);
$html_title = SITE_NAME . " - Edit Payment Module " . $module_name;
$smarty->assign('lang', $lang);
$smarty->assign('message', $message);
$smarty->assign('rendered_page', $smarty->fetch('admin/payment_editmodules.tpl'));
$smarty->display('admin/index.tpl');
unset($_SESSION['message']);
<?php

if (!defined('SITE_ROOT')) {
    include_once "../../initialise_file_location.php";
}
$paymentconfig = PaymentConfig::find_by_module_key('paypal');
foreach ($paymentconfig as $confitem) {
    $paymod_data[$confitem->config_key] = $confitem->config_value;
}
unset($confdata);
$paypal_email = $paymod_data['MODULE_PAYMENT_PAYPAL_ID'];
// change these to your paypal settings
//$paypal_email = MODULE_PAYMENT_PAYPAL_ID;//PAYPAL_EMAIL;
$paypal_currency = CURRENCY_NAME;
//CURRENCY;
//$shipping = "0";//SHIPPING_FEE;
function processing($payment_status, $params)
{
    global $paypal_email, $paypal_currency;
    $invoice_id = $params['item_number'];
    $invoice = PackageInvoice::find_by_id($invoice_id);
    switch ($payment_status) {
        case "Canceled_Reversal":
            $invoice->package_status = 'Canceled_Reversal';
            $invoice->update_package_status();
            break;
        case "Completed":
            if ($paypal_email == $params['receiver_email'] && $paypal_currency == $params['mc_currency'] && $invoice->amount == $params['mc_gross'] && $invoice->package_status != "Completed") {
                $param['payment_status'] = "Completed";
                //what is the status of the payment
                $param['amount'] = $params['mc_gross'];