Esempio n. 1
0
                    $ap_timeunit = "Month";
                } elseif (strtolower($products['duration_unit']) == "y") {
                    $ap_timeunit = "Year";
                }
                $ap_periodlength = $products['duration'];
                include 'payment/alertpay-subscribe.php';
            } elseif ($payment_gateway == "moneybookers") {
                $notify_url = CFG_SITE_URL . '/payment/moneybookers.ipn.php';
                $moneybookers_email = $gateway_data['payment_gateway_account'];
                include 'payment/moneybookers.php';
            }
        }
    } else {
        ShowFormRegister();
    }
}
/***********************************************************************************************
Main
***********************************************************************************************/
if ($banned->BanIp() || $banned->BanCountry()) {
    header("Location: ban_confirm.php");
}
if (empty($pf)) {
    GetPaymentCurrency();
    GetPaymentGateway();
    ShowFormRegister();
} elseif ($pf == 'reg') {
    GetPaymentCurrency();
    GetPaymentGateway();
    ProcessFormRegister();
}
Esempio n. 2
0
function ProcessIPN($account, $business, $amount, $product_id, $username, $password, $firstname, $lastname, $email, $log, $payment_date, $payment_gateway, $invoice_id, $coupon_code = '', $date_order)
{
    global $user, $order, $product, $mail, $coupon, $currency_code, $inv_class;
    $product_data = $product->GetProduct($product_id);
    $coupon_code_valid = false;
    if ($coupon_code != "") {
        $discount_data = $coupon->CheckProductDiscount($coupon_code, $product_id);
        if (!$discount_data) {
        } else {
            $percentage = strrpos($discount_data['coupon_value'], "%");
            if ($percentage) {
                $percent = str_replace("%", "", $discount_data['coupon_value']);
                $coupon_value_type = "percentage";
                $percentage_coupon_value = $percent;
                $net_price = $discount_data['price'] - $discount_data['price'] * ($percent / 100);
            } else {
                $coupon_value_type = "price";
                $price_coupon_value = $discount_data['coupon_value'];
                $net_price = $discount_data['price'] - $discount_data['coupon_value'];
            }
            $price = $net_price;
            if ($price < 0) {
                $price = 0;
            }
            $coupon_code_valid = true;
        }
    } else {
        $price = $product_data['price'];
    }
    if ($account == $business) {
        if (round($price, 3) == round($amount, 3)) {
            /*add user*/
            GetPaymentCurrency();
            $user_exist = $user->CheckUserActive($username);
            if ($user_exist['user_id'] == "") {
                $user_id = $user->Add($username, $password, $password, $firstname, $lastname, $email);
            } else {
                $user_id = $user_exist['user_id'];
            }
            /*add order*/
            $order_id = $order->AddOrder($user_id, $product_id, $date_order);
            $order_data = $order->GetOrder($order_id);
            $invoice_date = time();
            $due_date = time();
            $invoice_to = $firstname;
            $service = $order_data['name'];
            $description = $order_data['description'];
            $discount_price = $order_data['price'] - $amount;
            $total_price = $amount;
            $comment = "Payment is success";
            $paid = $amount;
            $paid_date = time();
            $product_name = $order_data['name'];
            $product_desc = $order_data['description'];
            $product_price = $currency_code . ". " . $price;
            $product_expire = date("Y-m-d", $order_data['date_expire']);
            $from_email = CFG_NOTIFY_EMAIL;
            $from_name = CFG_NOTIFY_FROM;
            $order->AddPayment($order_id, $amount, $currency_code, $payment_date, $payment_gateway, $log, $invoice_id);
            $inv_class->AddInvoice($invoice_id, $invoice_date, $due_date, $invoice_to, $service, $description, $order_data['price'], $discount_price, $total_price, $currency_code, $comment, $paid, $paid_date, $payment_gateway, $email);
            if ($coupon_code_valid) {
                $coupon->AddUsageCount($coupon_code);
            }
            $mail->ConfirmOrderEmail(CFG_SITE_NAME, $firstname, $lastname, $from_email, $from_name, $product_name, $product_desc, $product_price, $product_expire, $email);
            $mail->ReceivedOrderEmail(CFG_SITE_NAME, $firstname, $lastname, $from_email, $from_name, $product_name, $product_desc, $product_price, $date_order, $product_expire, CFG_SITE_MAIL);
        }
    }
}