Esempio n. 1
0
 public function pay($iid, $returnURL = "order/index.php")
 {
     global $dbh, $postvar, $getvar, $instance;
     require_once INC . "/paypal/paypal.class.php";
     $paypal = new paypal_class();
     $invoices_data = $dbh->select("invoices", array("id", "=", $iid));
     if ($_SESSION['cuser'] == $invoices_data['uid']) {
         if ($dbh->config("paypalmode") == "sandbox") {
             $paypal->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
             $paypal->add_field('business', $dbh->config('paypalsandemail'));
         } else {
             $paypal->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';
             $paypal->add_field('business', $dbh->config('paypalemail'));
         }
         $paypal->add_field('return', $dbh->config('url') . "client/index.php?page=invoices");
         $paypal->add_field('cancel_return', $dbh->config('url') . "client/index.php?page=invoices");
         $paypal->add_field('notify_url', $dbh->config('url') . "client/index.php?page=invoices&invoiceID=" . $iid);
         $paypal->add_field('item_name', 'THT Order: ' . $invoices_data['notes']);
         $paypal->add_field('amount', $invoices_data['pay_now']);
         $paypal->add_field('currency_code', $dbh->config("currency"));
         $paypal->submit_paypal_post();
     } else {
         echo "You don't seem to be the person who owns that invoice!";
         exit;
     }
 }
Esempio n. 2
0
 public function pay($iid, $returnURL = "order/index.php")
 {
     global $db;
     require_once "paypal/paypal.class.php";
     $paypal = new paypal_class();
     $query = $db->query("SELECT * FROM `<PRE>invoices` WHERE `id` = '{$iid}'");
     $array = $db->fetch_array($query);
     if ($_SESSION['cuser'] == $array['uid']) {
         $paypal->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';
         $paypal->add_field('business', $db->config('paypalemail'));
         $paypal->add_field('return', $db->config('url') . "client/index.php?page=invoices&invoiceID=" . $iid . "&paypalcsrf=" . csrf_get_tokens());
         $paypal->add_field('cancel_return', $db->config('url') . "client/index.php?page=invoices&invoiceID=" . $iid . "&paypalcsrf=" . rawurlencode(csrf_get_tokens()));
         $paypal->add_field('notify_url', $db->config('url') . "client/index.php?page=invoices&invoiceID=" . $iid . "&paypalcsrf=" . rawurlencode(csrf_get_tokens()));
         $paypal->add_field('item_name', $db->config('name') . ': ' . $array['notes']);
         $paypal->add_field('amount', $array['amount']);
         $paypal->add_field('currency_code', $db->config("currency"));
         $paypal->submit_paypal_post();
         // submit the fields to paypal
     } else {
         echo "You don't seem to be the person who owns that invoice!";
     }
 }
Esempio n. 3
0
 // $user=mysql_query("SELECT * FROM user WHERE id='$user_id'");
 // $username=mysql_fetch_array($user);
 // $nickname=$username['nickname'];
 $subject = "Hi {$nickname} You have successfully Posted Your Ad {$title} in Trade My Deals";
 $txt = "http://bluewhalesolutions.com/D/trademydeals/ads.php";
 $headers = "From: kumarioffshore@gmail.com";
 //$message=mysql_query("INSERT INTO `messages` (`messages`,`user_id`,`receiver_email`,`receiver_id`,`time`,`date`) VALUES('You have login Sucessfully in Trade my deals','200','*****@*****.**','$user_id',now(),now())");
 mail($city_your, $subject, $txt, $headers);
 $sql = "INSERT INTO `ads`(`user_id`,`ads_title`, `company_name`, `description`, `country`, `state`, `city_ad`, `postalcode_ad`, `city_your`, `postalcode_your`, `websitelink`, `youtube`, `images`, `publish_plan`, `promote_ads`,`promote_ads1`,`promote_ads2`,`promote_ads3`,`promote_ads4`, `promote_high`, `promote_top`, `promote_sider`, `promote_slider`, `promote_home`, `date_time`,`ads_images`) VALUES  ('{$user_id}','{$title}','{$company}','{$description}','{$country}','{$state}','{$city_ads}','{$postal_ads}','{$city_your}','{$postal_your}','{$website}','{$youtube}','{$temp1}','{$text}','{$promote_ads}','{$promote_ads1}','{$promote_ads2}','{$promote_ads3}','{$promote_ads4}','{$promote_high}','{$promote_top}','{$promote_sider}','{$promote_slider}','{$promote_home}', now(),'{$temp2}')";
 $srini = mysql_query($sql);
 $total = $_POST['total'];
 if ($total == 0) {
     header("location:../index.php");
 }
 $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
 $p->add_field('business', PAYPAL_EMAIL_ADD);
 // Call the facilitator eaccount
 $p->add_field('cmd', $_POST["cmd"]);
 // cmd should be _cart for cart checkout
 $p->add_field('upload', '1');
 $p->add_field('return', $this_script . '?action=success');
 // return URL after the transaction got over
 $p->add_field('cancel_return', $this_script . '?action=cancel');
 // cancel URL if the trasaction was cancelled during half of the transaction
 $p->add_field('notify_url', $this_script . '?action=ipn');
 // Notify URL which received IPN (Instant Payment Notification)
 $p->add_field('currency_code', $_POST["currency_code"]);
 $p->add_field('invoice', $_POST["invoice"]);
 $p->add_field('item_name_1', $_POST["title"]);
 //$p->add_field('item_number_1', $_POST["product_id"]);
 $p->add_field('quantity_1', 1);
Esempio n. 4
0
 function dealPayment($data, $total, $ids)
 {
     $customsettings = array('cpp_header_image' => WEBSITE_IMG_URL . "logo2.jpg", 'page_style' => "paypal", 'cbt' => __("To complete your order Go Back to " . Configure::read('Site.title')));
     // pr($customsettings); die;
     $nvpArray = array_merge($customsettings);
     //$nvp = http_build_query($nvpArray);
     foreach ($nvpArray as $param => $value) {
         $paramsJoined[] = "{$param}={$value}";
     }
     $nvp = implode('&', $paramsJoined);
     $p = new paypal_class();
     if (Configure::read('Payment.paypal_sandbox')) {
         $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr/' . $nvp;
     } else {
         $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr/' . $nvp;
     }
     $this_script = Router::url(array('plugin' => 'invoice', 'controller' => 'invoices', 'action' => 'paypal_response'), true);
     $paypal_success = Router::url(array('plugin' => 'invoice', 'controller' => 'invoices', 'action' => 'paypal_response'), true);
     $paypal_cancle = Router::url(array('plugin' => 'invoice', 'controller' => 'invoices', 'action' => 'paypal_response'), true);
     $i = 1;
     // $p->add_field('cmd','_xclick');//type cart
     $p->add_field('cmd', '_cart');
     //type cart
     $p->add_field('upload', '1');
     // multiple orders
     $p->add_field('username', Configure::read('Payment.PaypalUsername'));
     //$_POST['paypalemail']
     $p->add_field('business', Configure::read('Payment.paypal_email'));
     //$owner_paypal_email
     $p->add_field('return', $paypal_success);
     $p->add_field('cancel_return', $paypal_cancle);
     $p->add_field('notify_url', $this_script . '?action=ipn');
     $p->add_field('currency_code', PAYPAL_CURRENCY_CODE);
     $p->add_field('os0', PAYPAL_CURRENCY_CODE);
     foreach ($data as $key => $value) {
         $p->add_field('item_name_' . ($key + 1), $value['title']);
         $p->add_field('amount_' . ($key + 1), $value['amount']);
         $p->add_field('shipping_' . ($key + 1), $value['shipping_cost']);
         $p->add_field('quantity_' . ($key + 1), $value['qty']);
     }
     $p->add_field('custom', $ids["id"]);
     $p->submit_paypal_post();
     exit;
 }
Esempio n. 5
0
 function pay($code)
 {
     ini_set('display_errors', 'On');
     $this->load->library('paypal_class');
     $invoice = $this->commonmodel->getByPk($code, 'invoice_new', 'invoice_code');
     $applicant = $this->commonmodel->getByPk(arrIndex($invoice, 'applicant_id'), 'applicants', 'applicant_id');
     $p = new paypal_class();
     // initiate an instance of the class
     $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     // testing paypal url
     //$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';     // paypal url
     $this_script = createUrl('invoice/pay/' . $code);
     $ipn_url = 'http://landlord.webnseo.co.uk/paypal';
     if (empty($_GET['action'])) {
         $_GET['action'] = 'process';
     }
     switch ($_GET['action']) {
         case 'process':
             // Process and order...
             //                e($invoice);
             $paypal_id = getConfig('PAYPAL_MERCHENT_EMAIL');
             $p->add_field('business', '*****@*****.**');
             $p->add_field('return', $this_script . '?action=success');
             $p->add_field('cancel_return', $this_script . '?action=cancel');
             $p->add_field('notify_url', $ipn_url . '?action=ipn&invoice_id=' . $code);
             //$p->add_field('ipn_notification_url', $ipn_url);
             $p->add_field('item_name', 'Paypal Test Transaction');
             $p->add_field('amount', arrIndex($invoice, 'total_amount'));
             $p->add_field('currency_code', 'GBP');
             $p->add_field('custom', $code);
             $p->add_field('invoice_code', $code);
             $p->submit_paypal_post();
             // submit the fields to paypal
             //$p->dump_fields();      // for debugging, output a table of all the fields
             break;
         case 'success':
             // Order was successful...
             $page = array();
             $page['content'] = $this->load->view('thankyou', array(), true);
             $this->load->view($this->default, $page);
             //                foreach ($_POST as $key => $value) {
             //                    echo "$key: $value<br>";
             //                }
             break;
         case 'cancel':
             // Order was canceled...
             // The order was canceled before being completed.
             echo "<html><head><title>Canceled</title></head><body><h3>The order was canceled.</h3>";
             echo "</body></html>";
             break;
         case 'ipn':
             // Paypal is calling page for IPN validation...
             //error_log(json_encode($_REQUEST));
             if ($p->validate_ipn()) {
                 $in_code = $this->input->get('invoice_id', TRUE);
                 $this->db->insert('test', array('value' => json_encode($_REQUEST), 'status' => 1));
             } else {
                 // $this->db->insert('test', array('value' => json_encode($_REQUEST)));
             }
             break;
     }
 }
Esempio n. 6
0
 case 'process':
     // Process and order...
     // There should be no output at this point.  To process the POST data,
     // the submit_paypal_post() function will output all the HTML tags which
     // contains a FORM which is submited instantaneously using the BODY onload
     // attribute.  In other words, don't echo or printf anything when you're
     // going to be calling the submit_paypal_post() function.
     // This is where you would have your form validation  and all that jazz.
     // You would take your POST vars and load them into the class like below,
     // only using the POST values instead of constant string expressions.
     // For example, after ensureing all the POST variables from your custom
     // order form are valid, you might have:
     //
     // $p->add_field('first_name', $_POST['first_name']);
     // $p->add_field('last_name', $_POST['last_name']);
     $p->add_field('business', $paypal_email);
     //Give here your email id
     $p->add_field('currency_code', 'CAD');
     $p->add_field('return', $this_script . '?action=success');
     $p->add_field('cancel_return', $this_script . '?action=cancel');
     $p->add_field('notify_url', $this_script . '?action=ipn&loginid=' . $loginid . '&points=' . $points);
     $p->add_field('item_name', "Item Name: " . $pack);
     $p->add_field('amount', $amount);
     //Amount for Signup
     $p->submit_paypal_post();
     // submit the fields to paypal
     //$p->dump_fields();      // for debugging, output a table of all the fields
     break;
 case 'success':
     // Order was successful...
     // This is where you would probably want to thank the user for their order
Esempio n. 7
0
// define any notification email
define('PAYPAL_EMAIL_ADD', '*****@*****.**');
// facilitator email which will receive payments change this email to a live paypal account id when the site goes live
require_once "paypal_class.php";
$p = new paypal_class();
// paypal class
$p->admin_mail = EMAIL_ADD;
// set notification email
$action = $_REQUEST["action"];
switch ($action) {
    case "process":
        // case process insert the form data in DB and process to the paypal
        $add = $_POST['payer_add1'] . $_POST['payer_add2'];
        mysql_query("INSERT INTO `purchases` (`invoice`, `company` , `product_id`, `product_name`, `product_quantity`, `product_amount`, `payer_fname`, `payer_lname`, `payer_address`, `payer_city`, `payer_state`, `payer_zip`, `payer_country`, `payer_email`, `payment_status`, `posted_date`, `phone`, `mobile`, `fax`) VALUES \n\t\t('" . $_POST["invoice"] . "', '" . $_POST["company"] . "','" . $_POST["product_id"] . "', '" . $_POST["product_name"] . "', '" . $_POST["quantity"] . "', '" . $_POST["product_amount"] . "', '" . $_POST["payer_fname"] . "', '" . $_POST["payer_lname"] . "', '" . $add . "', '" . $_POST["payer_city"] . "', '" . $_POST["payer_state"] . "', '" . $_POST["payer_zip"] . "', '" . $_POST["payer_country"] . "', '" . $_POST["payer_email"] . "', 'pending', NOW(), '" . $_POST["phone"] . "', '" . $_POST["mobile"] . "', '" . $_POST["fax"] . "')");
        $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
        $p->add_field('business', PAYPAL_EMAIL_ADD);
        // Call the facilitator eaccount
        $p->add_field('cmd', $_POST["cmd"]);
        // cmd should be _cart for cart checkout
        $p->add_field('upload', '1');
        $p->add_field('return', $this_script . '?action=success');
        // return URL after the transaction got over
        $p->add_field('cancel_return', $this_script . '?action=cancel');
        // cancel URL if the trasaction was cancelled during half of the transaction
        $p->add_field('notify_url', $this_script . '?action=ipn');
        // Notify URL which received IPN (Instant Payment Notification)
        $p->add_field('currency_code', $_POST["currency_code"]);
        $p->add_field('invoice', $_POST["invoice"]);
        $p->add_field('item_name_1', $_POST["product_name"]);
        $p->add_field('item_number_1', $_POST["sku"]);
        $p->add_field('quantity_1', $_POST["quantity"]);
Esempio n. 8
0
     // contains a FORM which is submited instantaneously using the BODY onload
     // attribute.  In other words, don't echo or printf anything when you're
     // going to be calling the submit_paypal_post() function.
     // This is where you would have your form validation  and all that jazz.
     // You would take your POST vars and load them into the class like below,
     // only using the POST values instead of constant string expressions.
     // For example, after ensureing all the POST variables from your custom
     // order form are valid, you might have:
     //
     // $p->add_field('first_name', $_POST['first_name']);
     // $p->add_field('last_name', $_POST['last_name']);
     $CatDescription = $_REQUEST['CatDescription'];
     $payment = $_REQUEST['payment'];
     $id = $_REQUEST['id'];
     $key = $_REQUEST['key'];
     $p->add_field('business', $seller_account_email);
     // <<-- PAYPAL SELLER ACCOUNT ID
     $p->add_field('return', $this_script . '?action=success');
     $p->add_field('cancel_return', $this_script . '?action=cancel');
     $p->add_field('notify_url', $this_script . '?action=ipn');
     $p->add_field('item_name', $CatDescription);
     $p->add_field('amount', $payment);
     $p->add_field('key', $key);
     $p->add_field('item_number', $id);
     //$p->add_field('COUNTRYCODE', 'PL');
     $p->add_field('currency_code', 'PLN');
     $p->submit_paypal_post();
     // submit the fields to paypal
     //$p->dump_fields();      // for debugging, output a table of all the fields
     break;
 case 'success':
Esempio n. 9
0
// set notification email
$action = $_REQUEST["action"];
switch ($action) {
    case "process":
        // case process insert the form data in DB and process to the paypal
        mysql_query("INSERT INTO `treatment_purchases` (`product_id`,`treatment_name`, `treatment_price`, `booking_date`, `booking_time`, `customer_email`, `customer_name`,`customer_area`,`customer_phone`,`customer_address`,`customer_postcode`,`customer_promo`,`customer_comment`,`payment_status`, `order_date`) VALUES ('" . $_POST["product_id"] . "','" . $list . "', '" . $_POST["product_amount"] . "','" . $date . "','" . $time . "','" . $cust_email . "','" . $name . "','" . $area . "','" . $phone . "','" . $address . "','" . $postcode . "','" . $promo . "','" . $comments . "','pending', NOW())");
        if ($promo != '') {
            $result = mysql_query("SELECT voucher_code FROM voucher_purchases where voucher_code='" . $_POST["promo"] . "'");
            if ($result > 0) {
                echo 'Coupon code found!';
            } else {
                echo 'Coupon code not found!';
            }
        }
        $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
        $p->add_field('business', PAYPAL_EMAIL_ADD);
        // Call the facilitator eaccount
        $p->add_field('cmd', $_POST["cmd"]);
        // cmd should be _cart for cart checkout
        $p->add_field('upload', '1');
        $p->add_field('return', $this_script . '?action=success&product_id=' . $_SESSION["pid"] . '');
        // return URL after the transaction got over
        $p->add_field('cancel_return', $this_script . '?action=cancel&product_id=' . $_SESSION["pid"] . '');
        // cancel URL if the trasaction was cancelled during half of the transaction
        $p->add_field('notify_url', $this_script . '?action=ipn');
        // Notify URL which received IPN (Instant Payment Notification)
        $p->add_field('currency_code', $_POST["currency_code"]);
        $p->add_field('invoice', $invoice);
        $p->add_field('item_number_1', $_POST["product_id"]);
        $p->add_field('item_name_1', $_POST["product_name"]);
        $p->add_field('quantity_1', 1);
Esempio n. 10
0
 function CallOrder()
 {
     global $USER, $CONF, $UNI;
     $this->amount = HTTP::_GP('amount', 0);
     $this->cost = HTTP::_GP('cost', 0);
     if (!array_key_exists($this->amount, $this->pattern)) {
         message('NOT VALID VALUE', '?page=overview', 3);
         exit;
     }
     $this->cost = $this->pattern[$this->amount];
     $validationKey = md5(uniqid('2m'));
     $GLOBALS['DATABASE']->query("INSERT INTO `uni1_paypal` (`id`, `player`, `amount`, `timestamp`, `price`) VALUES (NULL, '" . $USER['id'] . "', '" . $this->amount . "', '" . TIMESTAMP . "', '" . $this->cost . "');");
     //SendSimpleMessage ( $USER['id'], $USER['id'], TIMESTAMP, 1, 'Payment Bot', 'To do', 'After the payment has been processed, if you didnt received your DM please send an ticket or an Private Message to "Admin"');
     $this_p = new paypal_class();
     $ID = $GLOBALS['DATABASE']->uniquequery("SELECT `id` FROM `uni1_paypal` WHERE `player` = '" . $USER['id'] . "' AND `amount` = '" . $this->amount . "' AND `timestamp` = '" . TIMESTAMP . "'");
     $this_p->add_field('business', $this::MAIL);
     $this_p->add_field('return', 'https://' . $_SERVER['HTTP_HOST'] . '/game.php?page=paypal&i=' . $validationKey . '');
     $this_p->add_field('cancel_return', 'https://' . $_SERVER['HTTP_HOST'] . '/ipn.php');
     $this_p->add_field('notify_url', 'https://' . $_SERVER['HTTP_HOST'] . '/ipn.php');
     $this_p->add_field('item_name', $this->amount . ' Credit-User(' . $USER['username'] . ').');
     $this_p->add_field('item_number', $this->amount . '_credits');
     $this_p->add_field('amount', $this->cost);
     //$this_p->add_field('action', $action); ?
     $this_p->add_field('currency_code', 'EUR');
     $this_p->add_field('custom', $USER['id'] . ',' . $validationKey);
     $this_p->add_field('rm', '2');
     //$this_p->dump_fields();
     foreach ($this_p->fields as $name => $value) {
         $field[] = array('text' => '<input type="hidden" name="' . $name . '" value="' . $value . '">');
     }
     $this->tplObj->assign_vars(array('fields' => $field));
     $this->display('paypal_class.tpl');
 }
<?php

require "config.php";
$show_form = 1;
$mess = "";
// Para en envío de la forma
if (!empty($_POST["process"]) && $_POST["process"] == "yes") {
    if (!empty($_POST["amount"]) && is_numeric($_POST["amount"])) {
        $amount = !empty($_POST["amount"]) ? strip_tags(str_replace("'", "", $_POST["amount"])) : '';
        $show_form = 0;
        require_once 'paypal.class.php';
        $paypal = new paypal_class();
        $paypal->add_field('business', $store_email);
        $paypal->add_field('return', $script_location . '?action=success');
        $paypal->add_field('cancel_return', $script_location . '?action=cancel');
        $paypal->add_field('notify_url', $script_location . '?action=ipn');
        $paypal->add_field('item_name_1', strip_tags(str_replace("'", "", $_POST["description"])));
        $paypal->add_field('amount_1', $amount);
        $paypal->add_field('item_number_1', $item_id);
        $paypal->add_field('quantity_1', '1');
        $paypal->add_field('custom', $_SERVER['REMOTE_ADDR']);
        $paypal->add_field('upload', 1);
        $paypal->add_field('cmd', '_cart');
        $paypal->add_field('txn_type', 'cart');
        $paypal->add_field('num_cart_items', 1);
        $paypal->add_field('payment_gross', $amount);
        $paypal->add_field('currency_code', strip_tags(str_replace("'", "", $_POST["currency"])));
        $paypal->submit_paypal_post();
        // submit the fields to paypal
        $show_form = 0;
    } elseif (!is_numeric($_POST["amount"]) || empty($_POST["amount"])) {
Esempio n. 12
0
// if there is not action variable, set the default action of 'process'
if (empty($_GET['action'])) {
    $_GET['action'] = 'process';
}
switch ($_GET['action']) {
    case 'process':
        // Process and order...
        //Generate hash
        $hash = md5($_SESSION['user_profile']['id'] . time() . "EsEHPayPaLdame1leuro");
        $secure = md5($hash . PAYPAL_SECRET_HASH);
        $amount_b = $_GET['amount_c'];
        $amount = round($_GET['amount_c'] * PAYPAL_FARE_PER, 2) + PAYPAL_FARE_FIX;
        $currency = $_GET['currency'];
        $to_user_id = $_GET['to_user_id'];
        $insert_paypal = mysql_query("INSERT INTO  `paypal_payments` (`id` ,`hash` ,`amount` ,`user_id` ,`status` ,`date`,`currency`)VALUES (\nNULL ,  '" . $hash . "',  '" . $amount_b . "',  '" . $_SESSION['user_profile']['id'] . "',  '0', CURRENT_TIMESTAMP,'" . $currency . "');");
        $p->add_field('business', $account_pay);
        $p->add_field('return', $this_script . '?action=success&secure=' . $secure . '&hash=' . $hash . '&to_user_id=' . $to_user_id);
        $p->add_field('cancel_return', $this_script . '?action=cancel&hash=' . $hash . '&to_user_id=' . $to_user_id);
        $p->add_field('notify_url', $this_script . '?action=ipn');
        $p->add_field('item_name', 'Add cash to tuitflow account ');
        $p->add_field('currency_code', $currency);
        $p->add_field('amount', $amount);
        $p->submit_paypal_post();
        // submit the fields to paypal
        //$p->dump_fields();      // for debugging, output a table of all the fields
        break;
    case 'success':
        //Pago correcto
        //Fin
        //Comprobar que no sea la ultima participacion
        //
Esempio n. 13
0
      // contains a FORM which is submited instantaneously using the BODY onload
      // attribute.  In other words, don't echo or printf anything when you're
      // going to be calling the submit_paypal_post() function.
 
      // This is where you would have your form validation  and all that jazz.
      // You would take your POST vars and load them into the class like below,
      // only using the POST values instead of constant string expressions.
 
      // For example, after ensureing all the POST variables from your custom
      // order form are valid, you might have:
      //
      // $p->add_field('first_name', $_POST['first_name']);
      // $p->add_field('last_name', $_POST['last_name']);
      
//<<<<<<< HEAD
      $p->add_field('business', '*****@*****.**');
//=======
   //   $p->add_field('business', '*****@*****.**');
//>>>>>>> 138574e84bc534d318323a195aa51d9e9198c9fa
      $p->add_field('return', $this_script.'?action=success');
      $p->add_field('cancel_return', $this_script.'?action=cancel');
      $p->add_field('notify_url', $this_script.'?action=ipn');
      $p->add_field('item_name', 'Paypal Test Transaction');
      $p->add_field('amount', '1.99');
//<<<<<<< HEAD
     $p->add_field('currency_code', 'USD');
//=======
//>>>>>>> 138574e84bc534d318323a195aa51d9e9198c9fa

      $p->submit_paypal_post(); // submit the fields to paypal
      //$p->dump_fields();      // for debugging, output a table of all the fields
Esempio n. 14
0
function jg_front_end_paypal($atts)
{
    if (session_id() == '' || !isset($_SESSION)) {
        // session isn't started
        session_start();
    }
    ob_start();
    global $current_user;
    global $wp_roles;
    global $wpdb;
    global $error;
    global $js_shortcode_on_front;
    extract(shortcode_atts(array('redirectPaid' => 0, 'display' => true, 'template' => ''), $atts));
    /*
       if ( trim($_SESSION['userEnc']) == '' ){
           $redirectLink = trim(home_url());
           if (intval($redirectLink) != 0)
               $redirectLink = get_permalink($redirectLink);
           else{
               if (!jg_check_missing_http($redirectLink)) $redirectLink = 'http://'. $redirectLink;
           }
           wp_redirect( $redirectLink ); exit;
       }
    */
    $wpjg_generalSettings = get_option('jg_general_settings');
    $result = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}jgusers WHERE `userEnc`='" . trim($_SESSION['userEnc']) . "';", ARRAY_A);
    if (isset($result['paidaccess']) && $wpjg_generalSettings['paidaccess'] == 1 && $result['paidaccess'] == 1) {
        $redirectLink = trim($redirectPaid);
        if (intval($redirectLink) != 0) {
            $redirectLink = get_permalink($redirectLink);
        } else {
            if (!jg_check_missing_http($redirectLink)) {
                $redirectLink = 'http://' . $redirectLink;
            }
        }
        wp_redirect($redirectLink);
        exit;
    }
    if (isset($_REQUEST["action"])) {
        require_once JG_PLUGIN_DIR . "/paypal/paypal_class.php";
        $p = new paypal_class();
        // paypal class
        $p->admin_mail = $wpjg_generalSettings['paypal_email'];
        // set notification email
        $action = $_REQUEST["action"];
        switch ($action) {
            case "process":
                // case process insert the form data in DB and process to the paypal
                $wpdb->update($wpdb->prefix . "jgusers", array('paytoken' => $_POST["invoice"]), array('userEnc' => trim($_SESSION['userEnc'])));
                $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
                $p->add_field('business', $wpjg_generalSettings['paypal_femail']);
                // Call the facilitator eaccount
                $p->add_field('cmd', $_POST["cmd"]);
                // cmd should be _cart for cart checkout
                $p->add_field('upload', '1');
                $p->add_field('return', $this_script . '?action=success');
                // return URL after the transaction got over
                $p->add_field('cancel_return', $this_script . '?action=cancel');
                // cancel URL if the trasaction was cancelled during half of the transaction
                $p->add_field('notify_url', $this_script . '?action=ipn');
                // Notify URL which received IPN (Instant Payment Notification)
                $p->add_field('currency_code', $_POST["currency_code"]);
                $p->add_field('invoice', $_POST["invoice"]);
                $p->add_field('item_name_1', $_POST["product_name"]);
                $p->add_field('item_number_1', $_POST["product_id"]);
                $p->add_field('quantity_1', $_POST["product_quantity"]);
                $p->add_field('amount_1', $wpjg_generalSettings['payamount']);
                $p->add_field('first_name', $_POST["payer_fname"]);
                $p->add_field('last_name', $_POST["payer_lname"]);
                $p->add_field('address1', $_POST["payer_address"]);
                $p->add_field('city', $_POST["payer_city"]);
                $p->add_field('state', $_POST["payer_state"]);
                $p->add_field('country', $_POST["payer_country"]);
                $p->add_field('zip', $_POST["payer_zip"]);
                $p->add_field('email', $_POST["payer_email"]);
                $p->submit_paypal_post();
                // POST it to paypal
                break;
            case "success":
                $redirectLink = trim($redirectPaid);
                if (intval($redirectLink) != 0) {
                    $redirectLink = get_permalink($redirectLink);
                } else {
                    if (!jg_check_missing_http($redirectLink)) {
                        $redirectLink = 'http://' . $redirectLink;
                    }
                }
                wp_redirect($redirectLink);
                exit;
                break;
            case "ipn":
                if ($p->validate_ipn()) {
                    $wpdb->update($wpdb->prefix . "jgusers", array('paidaccess' => 1, 'txn_id' => $_POST["txn_id"]), array('paytoken' => trim($_POST["invoice"])));
                }
                break;
        }
    }
    require_once JG_PLUGIN_DIR . '/lib/Smarty.class.php';
    $smarty = new Smarty();
    $smarty->template_dir = JG_PLUGIN_DIR . '/smarty/templates/';
    $smarty->compile_dir = JG_PLUGIN_DIR . '/smarty/templates_c/';
    $smarty->config_dir = JG_PLUGIN_DIR . '/smarty/configs/';
    $smarty->cache_dir = JG_PLUGIN_DIR . '/smarty/cache/';
    $smarty->assign('formurl', jg_curpageurl());
    $smarty->assign('Errors', $errors);
    $smarty->assign('Settings', $wpjg_generalSettings);
    $invoice = array('productid' => rand(1111, 99999), 'invoiceid' => date("His") . rand(1234, 9632));
    $smarty->assign('Get', $_GET);
    $smarty->assign('Post', $_POST);
    $smarty->assign('User', $_SESSION);
    $smarty->assign('Invoice', $invoice);
    if ($template != '') {
        $smarty->display($template);
    } else {
        $smarty->display('paypal.html');
    }
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Esempio n. 15
0
 case 'process':
     // Process and order...
     // There should be no output at this point.  To process the POST data,
     // the submit_paypal_post() function will output all the HTML tags which
     // contains a FORM which is submited instantaneously using the BODY onload
     // attribute.  In other words, don't echo or printf anything when you're
     // going to be calling the submit_paypal_post() function.
     // This is where you would have your form validation  and all that jazz.
     // You would take your POST vars and load them into the class like below,
     // only using the POST values instead of constant string expressions.
     // For example, after ensureing all the POST variables from your custom
     // order form are valid, you might have:
     //
     // $p->add_field('first_name', $_POST['first_name']);
     // $p->add_field('last_name', $_POST['last_name']);
     $p->add_field('business', '*****@*****.**');
     $p->add_field('return', $this_script . '?action=success');
     $p->add_field('cancel_return', $this_script . '?action=cancel');
     $p->add_field('notify_url', $this_script . '?action=ipn');
     $p->add_field('item_name', 'Paypal Test Transaction');
     $p->add_field('amount', '1.99');
     $p->submit_paypal_post();
     // submit the fields to paypal
     //$p->dump_fields();      // for debugging, output a table of all the fields
     break;
 case 'success':
     // Order was successful...
     // This is where you would probably want to thank the user for their order
     // or what have you.  The order information at this point is in POST
     // variables.  However, you don't want to "process" the order until you
     // get validation from the IPN.  That's where you would have the code to
Esempio n. 16
0
 public function paypal()
 {
     $p = new paypal_class();
     // initiate an instance of the class
     $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     // testing paypal url
     //$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';     // paypal url
     // setup a variable for this script (ie: 'http://www.micahcarrick.com/paypal.php')
     $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
     $string = $_SERVER['HTTP_HOST'];
     $toptal_pos = strpos($string, 'toptals');
     if ($toptal_pos > 0) {
         $first_dot = strpos($string, '.');
         $subdomain = substr($string, 0, $first_dot);
         $organization_query = mysql_query("SELECT * FROM `organization` WHERE `subdomain`='{$subdomain}'");
         $organization = mysql_fetch_array($organization_query);
         $organization_id = $organization['id'];
     }
     // if there is not action variable, set the default action of 'process'
     if (empty($_GET['action'])) {
         $_GET['action'] = 'process';
     }
     switch ($_GET['action']) {
         case 'process':
             // Process and order...
             // There should be no output at this point.  To process the POST data,
             // the submit_paypal_post() function will output all the HTML tags which
             // contains a FORM which is submited instantaneously using the BODY onload
             // attribute.  In other words, don't echo or printf anything when you're
             // going to be calling the submit_paypal_post() function.
             // This is where you would have your form validation  and all that jazz.
             // You would take your POST vars and load them into the class like below,
             // only using the POST values instead of constant string expressions.
             // For example, after ensureing all the POST variables from your custom
             // order form are valid, you might have:
             //
             // $p->add_field('first_name', $_POST['first_name']);
             // $p->add_field('last_name', $_POST['last_name']);
             echo "Please wait while we are redirecting you to the paypal website...";
             $CatDescription = $_REQUEST['CatDescription'];
             $payment = $_REQUEST['payment'];
             $id = $_REQUEST['id'];
             $key = $_REQUEST['key'];
             $p->add_field('business', '*****@*****.**');
             //put the paypal email id where you want to receive payment
             $p->add_field('return', $this_script . '?action=success&organization_id=' . $organization_id);
             $p->add_field('cancel_return', $this_script . '?action=cancel');
             $p->add_field('notify_url', $this_script . '?action=ipn');
             $p->add_field('item_name', $CatDescription);
             $p->add_field('amount', $payment);
             $p->add_field('key', $key);
             $p->add_field('item_number', $id);
             $p->submit_paypal_post();
             // submit the fields to paypal
             //$p->dump_fields();      // for debugging, output a table of all the fields
             break;
         case 'success':
             // Order was successful...
             // This is where you would probably want to thank the user for their order
             // or what have you.  The order information at this point is in POST
             // variables.  However, you don't want to "process" the order until you
             // get validation from the IPN.  That's where you would have the code to
             // email an admin, update the database with payment status, activate a
             // membership, etc.
             $payment_insert_data = array('organization_id' => $_GET['organization_id'], 'owner_email' => $_POST['payer_email'], 'fisrtname' => $_POST['first_name'], 'lastname' => $_POST['last_name'], 'amount' => $_POST['payment_gross'], 'time_stamp' => $_POST['payment_date'], 'correlation_id' => '', 'ack' => 'Success', 'version' => $_POST['notify_version'], 'build' => '', 'avs_code' => 'X', 'ccv_match' => 'M', 'transacton_id' => $_POST['txn_id'], 'date_added' => date('Y-m-d h:i:s'));
             $this->db->insert("credit_card_payment", $payment_insert_data);
             $this->checkout_model->after_payment_insert($_GET['organization_id'], $_POST['payment_gross'], '', 'paypal');
             $this->checkout_model->after_payment_session_insert($_GET['organization_id'], $_POST['payment_gross'], '');
             header('location:http://' . $_SERVER['HTTP_HOST'] . '/index.php/checkout/successForm/' . $_POST['txn_id'] . '/' . $_POST['payment_status']);
             //foreach ($_POST as $key => $value) { $data[$key] .= $value; }
             // You could also simply re-direct them to another page, or your own
             // order status page which presents the user with the status of their
             // order based on a database (which can be modified with the IPN code
             // below).
             break;
         case 'cancel':
             // Order was canceled...
             // The order was canceled before being completed.
             echo "<br/><p><b>The order was canceled!</b></p><br /> Please return to the <a href=\"http://" . $_SERVER['HTTP_HOST'] . "/plan\">plan's page</a>";
             foreach ($_POST as $key => $value) {
                 echo "{$key}: {$value}<br>";
             }
             break;
         case 'ipn':
             // Paypal is calling page for IPN validation...
             // It's important to remember that paypal calling this script.  There
             // is no output here.  This is where you validate the IPN data and if it's
             // valid, update your database to signify that the user has payed.  If
             // you try and use an echo or printf function here it's not going to do you
             // a bit of good.  This is on the "backend".  That is why, by default, the
             // class logs all IPN data to a text file.
             if ($p->validate_ipn()) {
                 // Payment has been recieved and IPN is verified.  This is where you
                 // update your database to activate or process the order, or setup
                 // the database with the user's order details, email an administrator,
                 // etc.  You can access a slew of information via the ipn_data() array.
                 // Check the paypal documentation for specifics on what information
                 // is available in the IPN POST variables.  Basically, all the POST vars
                 // which paypal sends, which we send back for validation, are now stored
                 // in the ipn_data() array.
                 // For this example, we'll just email ourselves ALL the data.
                 $dated = date("D, d M Y H:i:s", time());
                 $subject = 'Instant Payment Notification - Recieved Payment';
                 $to = '*****@*****.**';
                 //  your email
                 $body = "An instant payment notification was successfully recieved\n";
                 $body .= "from " . $p->ipn_data['payer_email'] . " on " . date('m/d/Y');
                 $body .= " at " . date('g:i A') . "\n\nDetails:\n";
                 $headers = "";
                 $headers .= "From: Test Paypal \r\n";
                 $headers .= "Date: {$dated} \r\n";
                 $PaymentStatus = $p->ipn_data['payment_status'];
                 $Email = $p->ipn_data['payer_email'];
                 $id = $p->ipn_data['item_number'];
                 if ($PaymentStatus == 'Completed' or $PaymentStatus == 'Pending') {
                     $PaymentStatus = '2';
                 } else {
                     $PaymentStatus = '1';
                 }
                 /*                                                                           
                  *
                  * 
                  *
                  *      Here you write your quries to make payment received or pending etc. 
                  * 
                  *  
                  * 
                  */
                 foreach ($p->ipn_data as $key => $value) {
                     $body .= "\n{$key}: {$value}";
                 }
                 //fopen("http://www.virtualphoneline.com/admins/TestHMS.php?to=".urlencode($to)."&subject=".urlencode($subject)."&message=".urlencode($body)."&headers=".urlencode($headers)."","r");
             }
             break;
     }
 }
Esempio n. 17
0
 function paypal()
 {
     require_once 'paypal.class.php';
     // include the class file
     if (isset($_POST['sub'])) {
         $plan = explode('##', $_POST['plan']);
         $amt = $plan[0];
         $p_id = $plan[1];
         $this->load->model('Plan_Model');
         $query = $this->Plan_Model->plan($p_id);
         $desc = $query[0]->plan_desc;
         $p = new paypal_class();
         // initiate an instance of the class
         $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
         // testing paypal url
         //$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';     // paypal url
         $total_amt = $this->uri->segment(3);
         $total_amt = $this->uri->segment(3);
         $this_script = $this->config->item('base_url');
         if (empty($_GET['action'])) {
             $_GET['action'] = 'process';
         }
         switch ($_GET['action']) {
             case 'process':
                 // Process and order...
                 $p->add_field('business', '*****@*****.**');
                 $p->add_field('return', $this_script . 'payment/thanks');
                 $p->add_field('cancel_return', $this_script . 'payment/cancel');
                 $p->add_field('notify_url', $this_script . 'action=ipn');
                 $p->add_field('item_name', $desc);
                 $p->add_field('custom', '24');
                 $p->add_field('amount', $amt);
                 $p->add_field('currency_code', 'USD');
                 $p->submit_paypal_post();
                 // submit the fields to paypal
                 //$p->dump_fields();      // for debugging, output a table of all the fields
                 break;
             case 'success':
                 // Order was successful...
                 $response = $_POST;
                 echo "<html><head><title>Success</title></head><body><h3>Thank you for your order.</h3>";
                 foreach ($_POST as $key => $value) {
                     print_r($value);
                 }
                 //echo "$key: $value<br>"; }
                 echo "</body></html>";
                 die;
                 break;
             case 'cancel':
                 // Order was canceled...
                 // The order was canceled before being completed.
                 echo "<html><head><title>Canceled</title></head><body><h3>The order was canceled.</h3>";
                 echo "</body></html>";
                 break;
             case 'ipn':
                 // Paypal is calling page for IPN validation...
                 if ($p->validate_ipn()) {
                     $subject = 'Instant Payment Notification - Recieved Payment';
                     $to = '*****@*****.**';
                     //  your email
                     $body = "An instant payment notification was successfully recieved\n";
                     $body .= "from " . $p->ipn_data['payer_email'] . " on " . date('m/d/Y');
                     $body .= " at " . date('g:i A') . "\n\nDetails:\n";
                     foreach ($p->ipn_data as $key => $value) {
                         $body .= "\n{$key}: {$value}";
                     }
                     mail($to, $subject, $body);
                 }
                 break;
         }
     }
     die;
 }
Esempio n. 18
0
			$a = mysql_fetch_object($q);
			$aname = str_replace(':', '_', $a->userName);
		} elseif ($_GET['forID'] == 'ad' OR $_GET['forID'] == '"ad"') {
			$ad = true;
			$q = mysql_query("SELECT u.alliance,a.name FROM UserDetails u,alliances a WHERE a.id=u.alliance AND u.id={$_SESSION[isLogined]}") or die(mysql_error());
			$a = mysql_fetch_object($q);
			$allid = $a->alliance;
			if ($allid == 0) {
				header("Location: $this_script?strErr=You do not belong to an alliance!");
				exit;
			}
		} else {
			header("Location: $this_script?strErr=No User ID Specified!");
			exit;
		}
		$p->add_field('business', $conf['admin_email']); //my email
		$p->add_field('return', $this_script . '?action=success');
		$p->add_field('cancel_return', $this_script . '?action=cancel');
		$p->add_field('notify_url', $this_script . '?action=ipn');
		if ($ad) {
			$p->add_field('item_name', "Supporter: AID($allid:{$a->name})");
		} else {
			$p->add_field('item_name', "Supporter: ID($uid:{$aname})");
		}
		$p->add_field('no_shipping', '1');
		$p->add_field('currency_code', 'USD');
		$p->add_field('no_note', '1');
		//$p->add_field('amount', '1.99');
		$p->submit_paypal_post(); // submit the fields to paypal
		//$p->dump_fields();      // for debugging, output a table of all the fields
		
$bid = projectTheme_get_winner_bid($pid);
$paypal_email = get_user_meta($bid->uid, 'paypal_email', true);
if (empty($paypal_email)) {
    die('ERROR-DEBUG-> Missing Paypal Email of user.');
    exit;
}
if (empty($action)) {
    $action = 'process';
}
switch ($action) {
    case 'process':
        // Process and order...
        $bid = projectTheme_get_winner_bid($pid);
        $total = $bid->bid;
        //------------------------------------------------------
        $p->add_field('business', $paypal_email);
        $p->add_field('currency_code', get_option('ProjectTheme_currency'));
        $p->add_field('return', $this_script . '?action=success');
        $p->add_field('cancel_return', $this_script . '&action=cancel');
        $p->add_field('notify_url', $this_script . '&action=ipn');
        $p->add_field('item_name', $post->post_title);
        $p->add_field('custom', $pid . '|' . current_time('timestamp', 0));
        $p->add_field('amount', ProjectTheme_formats($total, 2));
        $p->submit_paypal_post();
        // submit the fields to paypal
        break;
    case 'success':
        // Order was successful...
    // Order was successful...
    case 'ipn':
        if (isset($_POST['custom'])) {
Esempio n. 20
0
$invoice = time();
$p = new paypal_class();
// initiate an instance of the class
//$p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';   // testing paypal url
$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';
// paypal url
// setup a variable for this script (ie: 'http://www.micahcarrick.com/paypal.php')
$this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// if there is not action variable, set the default action of 'process'
if (empty($_GET['action'])) {
    $_GET['action'] = 'process';
}
switch ($_GET['action']) {
    case 'process':
        // Process and order...
        $p->add_field('business', $paymentGatewayDetails['pp']['account']);
        $p->add_field('return', $this_script . '?action=success');
        $p->add_field('cancel_return', $this_script . '?action=cancel');
        $p->add_field('notify_url', $this_script . '?action=ipn');
        $p->add_field('item_name', $bsiCore->config['conf_hotel_name']);
        $p->add_field('invoice', $_POST['invoice']);
        $p->add_field('currency_code', $bsiCore->config['conf_currency_code']);
        $p->add_field('amount', $_POST['amount']);
        $p->submit_paypal_post();
        // submit the fields to paypal
        //$p->dump_fields();      // for debugging, output a table of all the fields
        break;
    case 'success':
        // Order was successful...
        header("location:booking-confirm.php?success_code=1");
        break;
Esempio n. 21
0
if (isset($_SESSION[formdata])) {
    $action = $_SESSION[formdata]["action"];
} else {
    if (isset($_POST)) {
        $action = 'success';
    }
}
if ($_GET['action'] == 'cancel') {
    $action = 'cancel';
}
switch ($action) {
    case "process":
        // case process insert the form data in DB and process to the paypal
        mysql_query("INSERT INTO `customers` (`invoice`,`quantity`,`amount`,`payment_status`,`posted_date`,`time`) VALUES ( '" . $_SESSION[formdata][invoice] . "','" . $_SESSION[formdata][no_shipping] . "','" . $_SESSION[formdata][shipping] . "','pending', NOW() ,'" . time() . "')");
        $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
        $p->add_field('business', PAYPAL_EMAIL_ADD);
        // Call the facilitator eaccount
        $p->add_field('cmd', '_xclick');
        // cmd should be _cart for cart checkout
        $p->add_field('upload', '1');
        $p->add_field('return', WEB_URL . '?action=success');
        // return URL after the transaction got over
        $p->add_field('cancel_return', WEB_URL . '?action=cancel');
        // cancel URL if the trasaction was cancelled during half of the transaction
        $p->add_field('notify_url', WEB_URL . '?action=ipn');
        // Notify URL which received IPN (Instant Payment Notification)
        //$p->add_field('notify_url', $this_script."/ipn.php?cart=".$_POST["invoice"]);
        $p->add_field('currency_code', $_SESSION[formdata]["currency_code"]);
        $p->add_field('invoice', $_SESSION[formdata]["invoice"]);
        /*$p->add_field('item_name_1', $_POST["product_name"]);
        		$p->add_field('item_number_1', $_POST["product_id"]);*/
Esempio n. 22
0
 default:
     // Process and order...
     // There should be no output at this point.  To process the POST data,
     // the submit_paypal_post() function will output all the HTML tags which
     // contains a FORM which is submited instantaneously using the BODY onload
     // attribute.  In other words, don't echo or printf anything when you're
     // going to be calling the submit_paypal_post() function.
     // adds or edits a "$p->add_field(key, value);" in following, which is what will be
     // sent to paypal as POST variables. Refer to PayPal HTML Variables:
     // https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables
     // This is where you would have your form validation  and all that jazz.
     // You would take your POST vars and load them into the class like below,
     // only using the POST values instead of constant string expressions.
     // setup a current URL variable for this script
     $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
     $p->add_field('business', PAYPAL_EMAIL_ADD);
     //don't need add this item, if your set the $p -> paypal_mail.
     $p->add_field('return', $this_script . '?action=success');
     $p->add_field('cancel_return', $this_script . '?action=cancel');
     $p->add_field('notify_url', $this_script . '?action=ipn');
     $p->add_field('item_name', 'Paypal Test Transaction');
     $p->add_field('cmd', '_donations');
     $p->add_field('rm', '2');
     // Return method = POST
     $p->submit_paypal_post();
     // submit the fields to paypal
     $p->dump_fields();
     // for debugging, output a table of all the fields
     break;
 case 'success':
     // Order was successful...
Esempio n. 23
0
 function pay($code)
 {
     //        echo '<pre>';
     //        print_r($_POST);
     //        exit;
     //        echo base_url() . 'classes/pay/' . $code . '?action=ipn';
     //            exit;
     ini_set('display_errors', 'On');
     $this->load->model('classesmodel');
     $event = $this->classesmodel->getOneEvent($code);
     $this->load->library('paypal_class');
     $desc = $this->input->post('desc', TRUE);
     $p = new paypal_class();
     // initiate an instance of the class
     //$p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';   // testing paypal url
     $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';
     // paypal url
     $this_script = createUrl('classes/pay/' . $code);
     $ipn_url = 'http://www.sew2it.co.uk/classes/pay/' . $code;
     $qty = gParam('qty');
     if (empty($_GET['action'])) {
         $_GET['action'] = 'process';
     }
     switch ($_GET['action']) {
         case 'process':
             // Process and order...
             //                e($invoice);
             //                $paypal_id = getConfig('PAYPAL_MERCHENT_EMAIL');
             $paypal_id = getConfig('PAYPAL_ID');
             $p->add_field('business', $paypal_id);
             $p->add_field('return', $this_script . '?action=success');
             $p->add_field('cancel_return', $this_script . '?action=cancel');
             $p->add_field('notify_url', base_url() . 'classes/pay/' . $code . '?action=ipn&qty=' . $qty . '&user_id=' . curUsrId() . '&id=' . $code);
             //  $p->add_field('ipn_notification_url', $ipn_url);
             $p->add_field('amount', $event['price']);
             $p->add_field('item_name', $desc);
             $p->add_field('quantity', $qty);
             $p->add_field('currency_code', 'GBP');
             $p->add_field('custom', $code);
             $p->add_field('event_id', $event['id']);
             //                echo '<pre>';
             //                print_r($p);
             //                exit;
             $p->submit_paypal_post();
             // submit the fields to paypal
             //$p->dump_fields();      // for debugging, output a table of all the fields
             break;
         case 'success':
             // Order was successful...
             $shell = array();
             $shell['contents'] = $this->load->view('classes-index', array(), true);
             $this->load->view("themes/" . THEME . "/templates/subpage", $shell);
             //                foreach ($_POST as $key => $value) {
             //                    echo "$key: $value<br>";
             //                }
             break;
         case 'cancel':
             // Order was canceled...
             // The order was canceled before being completed.
             // echo "This is Cancelled";
             redirect(base_url() . "booking-cancelled");
             exit;
             //header("Location:http://wwww.sew2it.co.uk/booking-cancelled");
             //                echo "<html><head><title>Canceled</title></head><body><h3>The order was canceled.</h3>";
             //                echo "</body></html>";
             break;
         case 'ipn':
             // Paypal is calling page for IPN validation...
             //error_log(json_encode($_REQUEST),3,'mytest.log');
             if ($p->validate_ipn()) {
                 //                    mail('*****@*****.**', 'subject', 'this is message');
                 $in_code = $this->input->get('id', TRUE);
                 $user_id = $this->input->get('user_id', TRUE);
                 $qty = $this->input->get('qty', TRUE);
                 $this->db->insert('order', array('response' => json_encode($_REQUEST), 'status' => 'Active', 'event_id' => $in_code, 'user_id' => $user_id, 'qty' => $qty));
                 //   echo $this->db->last_query();
             } else {
                 // $this->db->insert('test', array('value' => json_encode($_REQUEST)));
             }
             break;
     }
 }
Esempio n. 24
0
 case 'process':
     // Process and order...
     $prc = get_option('PricerrTheme_new_job_feat_listing_fee');
     $price = $prc;
     if (get_post_meta($pid, 'featured', true) != "1") {
         $price = 0;
     }
     $PricerrTheme_new_job_listing_fee = get_option('PricerrTheme_new_job_listing_fee');
     $price += $PricerrTheme_new_job_listing_fee;
     $job_title = get_post_meta($pid, 'job_title', true);
     if (empty($job_title)) {
         $job_title = $post->post_title;
     }
     //---------------------------------------------------
     //$p->add_field('business', '*****@*****.**');
     $p->add_field('business', trim($busi));
     $p->add_field('currency_code', get_option('PricerrTheme_currency'));
     $p->add_field('return', $this_script . '&action=success');
     $p->add_field('cancel_return', $this_script . '&action=cancel');
     $p->add_field('notify_url', get_bloginfo('siteurl') . '/?payment_response_listing=paypal');
     $p->add_field('item_name', sprintf(__("Listing Fee: %s", 'PricerrTheme'), $job_title));
     $p->add_field('custom', $pid . '|' . $uid . '|' . $tm);
     $p->add_field('amount', PricerrTheme_formats_special($price, 2));
     $p->submit_paypal_post();
     // submit the fields to paypal
     break;
 case 'success':
     // Order was successful...
     wp_redirect(get_permalink(get_option('PricerrTheme_my_account_page_id')));
     break;
 case 'cancel':
Esempio n. 25
0
            // Payment has been recieved and IPN is verified.  This is where you
            // For this example, we'll just email ourselves ALL the data.
            $subject = 'Instant Payment Notification - Recieved Payment';
            $to = $paypal_email;
            //  your email
            $body = "An instant payment notification was successfully recieved\n";
            $body .= "from " . $p->ipn_data['payer_email'] . " (GET = " . $_GET['id'] . ")(USER = "******") on " . date('m/d/Y');
            $body .= " at " . date('g:i A') . "\n\nDetails:\n";
            foreach ($p->ipn_data as $key => $value) {
                $body .= "\n{$key}: {$value}";
            }
            mail($to, $subject, $body);
            $payer_email = $p->ipn_data['payer_email'];
            $newrow = "UPDATE {{table}} SET `matter`=`matter` + '" . intval($_GET['amount']) . "' WHERE `id` = '" . intval($_GET['id']) . "' LIMIT 1 ;" . "\n";
            doquery($newrow, 'users') or logerror_mr(time(), mysql_error(), $newrow, __FILE__ . "," . __LINE__);
        }
        break;
    default:
        // Process and order...
        $p->add_field('business', $paypal_email);
        $p->add_field('return', $this_script . '&action=success&id=' . $user['id'] . '&amount=' . $amount);
        $p->add_field('cancel_return', $this_script . '&action=cancel');
        $p->add_field('notify_url', $this_script . '&action=ipn&id=' . $user['id'] . '&amount=' . $amount);
        $p->add_field('item_name', pretty_number($amount) . ' Dark Matter Units for account ' . $user['username'] . ' in Universe ' . UNIVERSE);
        $p->add_field('item_number', $amount . '_DARKMATTER');
        $p->add_field('amount', $cost);
        $p->submit_paypal_post();
        // submit the fields to paypal
        //$p->dump_fields();	  // for debugging, output a table of all the fields
        break;
}
Esempio n. 26
0
require_once 'paypal.class.php';
$p = new paypal_class();
$p->paypal_url = $paypalPaymentGateway->getUrl();
// 'https://www.sandbox.paypal.com/cgi-bin/webscr';   // testing paypal url
// 'https://www.paypal.com/cgi-bin/webscr';     // paypal url
// setup a variable for this script (ie: 'http://www.micahcarrick.com/paypal.php')
$this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// if there is not action variable, set the default action of 'process'
if (empty($_GET['action'])) {
    $_GET['action'] = 'process';
}
switch ($_GET['action']) {
    case 'process':
        // Process and order...
        $logger->LogInfo("Procesisng request  for payment to PayPal ...");
        $p->add_field('business', $paypalPaymentGateway->account);
        $p->add_field('return', $this_script . '?action=success');
        $p->add_field('cancel_return', $this_script . '?action=cancel');
        $p->add_field('notify_url', $this_script . '?action=ipn');
        $p->add_field('item_name', $systemConfiguration->getHotelDetails()->getHotelName());
        $p->add_field('invoice', $_POST['invoice']);
        $p->add_field('currency_code', $systemConfiguration->getCurrencyCode());
        $p->add_field('amount', $_POST['amount']);
        $p->submit_paypal_post();
        // submit the fields to paypal
        //$p->dump_fields();      // for debugging, output a table of all the fields
        break;
    case 'success':
        // Order was successful...
        $logger->LogInfo("Successful order was processed!");
        header("location:booking-confirm.php");
Esempio n. 27
0
 $to_contact_array = $_POST["to_contact_array"];
 $to_contact_values = explode(",", $to_contact_array);
 //$voucher_quantity_array = $_POST["voucher_quantity_array"];
 for ($i = 0; $i < sizeof($size_id); $i++) {
     if ($to_email_array[$i] == "") {
         $to_email_array[$i] = "None";
     }
     if ($to_contact_array[$i] == "") {
         $to_contact_array[$i] = "None";
     }
     mysql_query("INSERT INTO `voucher_purchases` (`invoice`, `product_id`, `product_name`, `voucher_code`, `voucher_value`, `voucher_quantity`, `payer_name`, `payer_email`,`sender_name`, `sender_email`, `voucher_message`,`payment_status`, `order_date`, `posted_date`) VALUES ('" . $invoice . "', '" . $_POST["product_id"] . "', '" . $_POST["product_name"] . "','" . $size_id[$i] . "','" . $values[$i] . "', '1', '" . $_POST["payer_fname"] . "', '" . $_POST["payer_email"] . "', '" . $to_values[$i] . "', '" . $to_email_values[$i] . "','" . $_POST["sender_message"] . "','pending','" . $date_today . "', NOW())");
 }
 $p->admin_mail = $_POST["payer_email"];
 // set notification email
 $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
 $p->add_field('business', PAYPAL_EMAIL_ADD);
 // Call the facilitator eaccount
 $p->add_field('cmd', $_POST["cmd"]);
 // cmd should be _cart for cart checkout
 $p->add_field('upload', '1');
 $p->add_field('return', $this_script . '?action=success&type=' . $action . '&sender_email=' . $_POST["payer_email"] . '&sender_name=' . $_POST["payer_fname"] . '&product_id=' . $_POST["voucher_id_array"]);
 // return URL after the transaction got over
 //$p->add_field('cpp_header_image', $_POST["cpp_header_image"]);
 $p->add_field('cancel_return', $this_script . '?action=cancel&product_id=' . $_POST["voucher_id_array"]);
 // cancel URL if the trasaction was cancelled during half of the transaction
 $p->add_field('notify_url', $this_script . '?action=ipn');
 // Notify URL which received IPN (Instant Payment Notification)
 $p->add_field('currency_code', $_POST["currency_code"]);
 $p->add_field('invoice', $invoice);
 $p->add_field('item_number_1', $_POST["product_id"]);
 $p->add_field('item_name_1', $_POST["product_name"]);
Esempio n. 28
0
} else {
	$p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
}
$componentdir = 'components/com_docmanpaypal';
// if there is not action variable, set the default action of 'process'
$request_action = JRequest::getVar('action');
if (empty($request_action)) $request_action = 'process'; 

switch ($request_action) {
    
   case 'process':      // Process and order...
   		if (is_numeric(JRequest::getVar('id')) and JRequest::getVar('id') > 0) { //SINGLE
   			$item = $dm->getItem(JRequest::getVar('id'));
   			$price = $item->price;
			$name = $item->dmname;
	 		$p->add_field('return', JURI::base() . "index.php?option=com_docmanpaypal&task=doc_download&mode=" . JRequest::getVar('mode') . "&gid=" . (int)JRequest::getVar('id') . "&order_id=$order_id&key=$key&Itemid=" . (int)JRequest::getVar('Itemid'));
			$p->add_field('cancel_return', JURI::base() . "index.php?option=com_docmanpaypal&task=order_canceled");
			//$p->add_field('notify_url', JURI::base() ."index.php?option=com_docmanpaypal&task=ipn&mode=single&action=ipn&merchant=PayPal");
			$p->add_field('notify_url', JURI::base() ."index.php?option=com_docmanpaypal&task=ipn&mode=single&action=ipn&Itemid=" . (int)JRequest::getVar('Itemid'));
			$p->add_field('item_name', $name);
			$p->add_field('item_number', $order_id);
			$p->add_field('amount', $price);
			//$p->add_field('upload',1);//fix when added cart
			$p->add_field('custom', base64_encode(serialize(array('my_id' => $my->id,'doc_id' => (int)JRequest::getVar('id'), 'order_id' => $order_id, 'key' => $key))));
			if ($cfg['useVat'] > 0) {
				$p->add_field('tax', $dm->vatCalc($price));
			}
			if ($item->vendor_id == 0) {
				$p->add_field('business', $cfg['paypalemail']);
			} else {
				$p->add_field('business', $item->paypalemail);
Esempio n. 29
0
     foreach ($payment_arr as $payment_item) {
         if ($payment_item['amount'] > 0) {
             $my_total += $payment_item['amount'];
         }
     }
     $my_total = apply_filters('ProjectTheme_filter_payment_total', $my_total, $pid);
     //----------------------------------------------
     $additional_paypal = 0;
     $additional_paypal = apply_filters('ProjectTheme_filter_paypal_listing_additional', $additional_paypal, $pid);
     //$ProjectTheme_get_show_price = ProjectTheme_get_show_price($pid);
     $total = $my_total + $additional_paypal;
     $title_post = $post->post_title;
     $title_post = apply_filters('ProjectTheme_filter_paypal_listing_title', $title_post, $pid);
     //---------------------------------------------
     //$p->add_field('business', '*****@*****.**');
     $p->add_field('business', $business);
     $p->add_field('currency_code', get_option('ProjectTheme_currency'));
     $p->add_field('return', $this_script . '&action=success');
     $p->add_field('cancel_return', $this_script . '&action=cancel');
     $p->add_field('notify_url', $this_script . '&action=ipn');
     $p->add_field('item_name', $title_post);
     $p->add_field('custom', $pid . '|' . $uid . '|' . current_time('timestamp', 0));
     $p->add_field('amount', ProjectTheme_formats_special($total, 2));
     $p->add_field('bn', 'SiteMile_SP');
     $p->submit_paypal_post();
     // submit the fields to paypal
     break;
 case 'success':
     // Order was successful...
 // Order was successful...
 case 'ipn':
Esempio n. 30
0
     if (count($extras)) {
         foreach ($extras as $myitem) {
             if (!empty($myitem)) {
                 $extra_price = get_post_meta($pid, 'extra' . $myitem . '_price', true);
                 $extr_ttl += $extra_price;
                 $xtra_stuff .= '|' . $myitem;
             }
         }
     }
     $shipping = get_post_meta($pid, 'shipping', true);
     if (empty($shipping)) {
         $shipping = 0;
     }
     //---------------------------------------------------
     //$p->add_field('business', '*****@*****.**');
     $p->add_field('business', trim($busi));
     $p->add_field('currency_code', get_option('PricerrTheme_currency'));
     $p->add_field('return', $this_script . '&action=success');
     $p->add_field('cancel_return', $this_script . '&action=cancel');
     $p->add_field('notify_url', get_bloginfo('siteurl') . '/?payment_response=paypal_response');
     $p->add_field('item_name', $job_title);
     $p->add_field('custom', $pid . '|' . $uid . '|' . $tm . $xtra_stuff);
     $p->add_field('amount', PricerrTheme_formats_special($price + $extr_ttl + $shipping, 2));
     $p->submit_paypal_post();
     // submit the fields to paypal
     break;
 case 'success':
     // Order was successful...
     wp_redirect(get_permalink(get_option('PricerrTheme_my_account_shopping_page_id')));
     //('siteurl')."/my-account/shopping/");
     break;