Пример #1
0
function authenticate()
{
    if (getSubscriptionId() == null || getCustomerId() == null) {
        return false;
    }
    return true;
}
function _recollect_data($order)
{
    global $todopagoTransaccion;
    $config = getTpConfig();
    $order_id = $order->fields['orders_id'];
    if (empty($config)) {
        return $config;
    }
    if ($order_id !== null && $todopagoTransaccion->_getStep($order_id) == TodopagoTransaccion::SECOND_STEP) {
        $config['order_id'] = $order_id;
        $logger = loggerFactory::createLogger(true, $config['ambiente'], getCustomerId($order), $order_id);
        $logger->info("second step");
        $logger->debug('todoPagoConfig: ' . json_encode($config));
        if (empty($config['ambiente'])) {
            $logger->error("FALTA CONFIGURAR PLUGIN TODOPAGO");
            showError();
        }
        $modo = $config["ambiente"] . "_";
        $http_header = json_decode($config["authorization"], 1);
        $http_header["user_agent"] = 'PHPSoapClient';
        $security_code = isset($config[$modo . "security"]) ? $config[$modo . "security"] : '';
        $merchant = isset($config[$modo . "merchant"]) ? $config[$modo . "merchant"] : '';
        $connector = new Sdk($http_header, $config["ambiente"] == 'test' ? 'test' : 'prod');
        $optionsGS = array('MERCHANT' => $config[$modo . "merchant"], 'OPERATIONID' => $order_id);
        $transaction = $todopagoTransaccion->getTransaction($order_id);
        $requestKey = $transaction['request_key'];
        $answerKey = $_GET['Answer'];
        $optionsGAA = array('Security' => $security_code, 'Merchant' => $merchant, 'RequestKey' => $requestKey, 'AnswerKey' => $answerKey);
        return compact('connector', 'optionsGS', 'optionsGAA', 'logger', 'config');
    }
    $logger->warn("No se puede entrar al second step porque ya se ha registrado una entrada exitosa en la tabla todopago_transaccion o el Order id no ha llegado correctamente");
    showError();
}
Пример #3
0
 function fetchAndConvert($username, $password, $uri, $callback, $watermark_uri)
 {
     $customerId = getCustomerId($username, $password);
     if (!$customerId || empty($uri)) {
         return false;
     }
     $id = addProcessEvent(PROCESS_FETCH, $customerId, $uri);
     $params['callback'] = $callback;
     $params['watermark'] = $watermark_uri;
     $endId = addProcessEvent(PROCESS_CONVERT_TO_DEFAULT, $customerId, $id, $params);
     return $endId;
 }
Пример #4
0
        $success = updateTable('customers', $_REQUEST, 'CustomerId');
        $success ? $_SESSION["message"] = "Update Successful!" : ($_SESSION["message"] = "Update Failed!");
        $success ? $_SESSION["lastpage"] = "index.php" : ($_SESSION["lastpage"] = "edit.php");
        $success ? $_SESSION["userfirstname"] = $_POST['CustFirstName'] : $_POST['CustFirstName'];
        $success ? $_SESSION["userlastname"] = $_POST['CustLastName'] : $_POST['CustLastName'];
        print "<br /><br /><br /><br />";
        print $success;
        header("Location: messages.php");
        break;
        //submits the users account to the database and sets session variables.
    //submits the users account to the database and sets session variables.
    case 'Register':
        $customer = new Customer("null", $_REQUEST["CustFirstName"], $_REQUEST["CustLastName"], $_REQUEST["CustAddress"], $_REQUEST["CustCity"], $_REQUEST["CustProv"], $_REQUEST["CustPostal"], $_REQUEST["CustCountry"], $_REQUEST["CustHomePhone"], $_REQUEST["CustBusPhone"], $_REQUEST["CustEmail"], 0, $_REQUEST["CustUsername"], $_REQUEST["CustPassword"]);
        if ($customer->customerAdd()) {
            #The user will be redirected to the index page if they've been added to the database.
            $_SESSION["loggedin"] = "TRUE";
            $_SESSION["userfirstname"] = $customer->getFirstName();
            $_SESSION["userlastname"] = $customer->getLastName();
            $_SESSION["userid"] = getCustomerId($customer->getUsername());
            $_SESSION["message"] = "Account Successfully Created!";
            header("Location: messages.php");
        } else {
            #The user will be redirected to the register page if they haven't been added to the database.
            $_SESSION["message"] = "Registration failed!";
            header("Location: register.php");
        }
        break;
    default:
        header("Location: index.php");
        break;
}
Пример #5
0
 $childshare = 0.5;
 //$room_no=$_POST['room'];
 $tp = $_POST['room_type'];
 $des = $_POST['room_description'];
 $totalamnt = $_POST['total-amount'];
 $payment = $_POST['amount'];
 $code = $_POST['code'];
 $payid = getPayment();
 $fname = $_POST['fname'];
 $mname = "";
 $lname = $_POST['lname'];
 $email = $_POST['email'];
 $tel = $_POST['phone'];
 $meal = $_POST['meal'];
 $description = $_POST['description'];
 $cust_id = getCustomerId();
 $date = date_create($from);
 $from = date_format($date, "Y-m-d 11:00:00");
 $date = date_create($to);
 $to = date_format($date, "Y-m-d 14:00:00");
 $date_issue = date('Y-m-d');
 //insert into customer
 $query = "insert into customer values ('" . $cust_id . "','" . $fname . "','" . $mname . "','" . $lname . "','" . $email . "','" . $tel . "')";
 update($query);
 //insert into invoice
 $invoice_no = getInvoiceId();
 $query = "insert into invoice (invoice_number, amount, status,date_issued,section_id,cust_id,user_id) values ('" . $invoice_no . "','" . $totalamnt . "','Pending','" . $date_issue . "','5','" . $cust_id . "','" . $_SESSION["user_id"] . "')";
 update($query);
 //insert amount paid into payment
 $query = "insert into payment (pay_id, amount, code, section_id,cust_id) values ('" . $payid . "','" . $payment . "','" . $code . "','5','" . $cust_id . "')";
 update($query);
Пример #6
0
<?php

require_once dirname(__FILE__) . '/../php_src/Config.php';
require_once dirname(__FILE__) . '/../php_src/Util.php';
$subscriptionId = null;
$customerId = null;
if (authenticate()) {
    $subscriptionId = getSubscriptionId();
    $customerId = getCustomerId();
} else {
    header("Location: /ssp-php/");
    return;
}
?>
<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <title>Self Service Portal - ChargeBee</title>
        <link href="/assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="all">
        <link href="/assets/css/ssp-core.css" rel="stylesheet" type="text/css">

        <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js"></script>
        <script type="text/javascript" src="http://malsup.github.io/jquery.form.js"></script>
        <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js"></script>
        <!--[if lt IE 9]>
        <script src="//html5sshiv.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <!--script src="../chargebee/respond.min.js"></script-->
function updateBillingInfo()
{
    header('Content-Type: application/json');
    validateParameters($_POST);
    $customerId = getCustomerId();
    $billingAddrParams = $_POST['billing_address'];
    try {
        $result = ChargeBee_Customer::updateBillingInfo($customerId, array("billing_address" => $billingAddrParams));
        $jsonResponse = array("forward" => "/ssp-php/subscription");
        print json_encode($jsonResponse, true);
    } catch (ChargeBee_InvalidRequestException $e) {
        handleInvalidRequestErrors($e);
    } catch (Exception $e) {
        handleGeneralErrors($e);
    }
}
Пример #8
0
    unset($_SESSION['err']);
}
require_once "./functions/database_functions.php";
// print out header here
$title = "Purchase Process";
require "./template/header.php";
// connect database
$conn = db_connect();
extract($_SESSION['ship']);
// validate post section
$card_number = $_POST['card_number'];
$card_PID = $_POST['card_PID'];
$card_expire = strtotime($_POST['card_expire']);
$card_owner = $_POST['card_owner'];
// find customer
$customerid = getCustomerId($name, $address, $city, $zip_code, $country);
if ($customerid == null) {
    // insert customer into database and return customerid
    $customerid = setCustomerId($name, $address, $city, $zip_code, $country);
}
$date = date("Y-m-d H:i:s");
insertIntoOrder($conn, $customerid, $_SESSION['total_price'], $date, $name, $address, $city, $zip_code, $country);
// take orderid from order to insert order items
$orderid = getOrderId($conn, $customerid);
foreach ($_SESSION['cart'] as $isbn => $qty) {
    $bookprice = getbookprice($isbn);
    $query = "INSERT INTO order_items VALUES \n\t\t('{$orderid}', '{$isbn}', '{$bookprice}', '{$qty}')";
    $result = mysqli_query($conn, $query);
    if (!$result) {
        echo "Insert value false!" . mysqli_error($conn2);
        exit;