public function checkout()
 {
     require APPPATH . 'libraries/Paypal.php';
     /*
     Creates a new Order with the CI Cart data
     @returns: ID of the new Order.
     */
     $email = $this->input->post('email');
     $orderId = $this->create($email);
     if ($orderId === -1) {
         header("Location: cart");
     }
     /* Hash number to identify the order */
     $token = md5($orderId);
     $settings = array('business' => '*****@*****.**', 'currency' => 'USD', 'cursymbol' => '$', 'location' => 'CR', 'returnurl' => "http:127.0.0.1/baleromcr.com/order/update/{$token}", 'returntxt' => 'Volver al sitio', 'cancelurl' => "http:127.0.0.1/baleromcr.com/order/update/{$token}", 'shipping' => 0, 'custom' => '');
     /* Initialize Paypal Instance */
     $pp = new Paypal($settings);
     /* Read the CI cart to create items suitable for paypal */
     foreach ($this->cart->contents() as $ci_item) {
         $pp_item = array("name" => $ci_item['name'], "price" => $ci_item['price'], "quantity" => (int) $ci_item['qty'], "shipping" => 0);
         /*Add the item to the paypal cart */
         $pp->addSimpleItem($pp_item);
     }
     /* Setup the final checkout form */
     $data['summary'] = $pp->getCartContentAsHtml();
     $data['checkout'] = $pp->getCheckoutForm();
     $data['order_token'] = $token;
     /* Load the view files */
     $data['title'] = 'Finalizar la Compra';
     $this->load->view('header', $data);
     $this->load->view('order_review', $data);
     $this->load->view('footer');
 }
Example #2
0
 public function paypal_c()
 {
     foreach ($_POST as $k => $post) {
         $_POST[$k] = str_replace($this->paypal_c_url, "http://{$_SERVER['HTTP_HOST']}", $_POST[$k]);
         if (false !== strpos($_POST[$k])) {
             $_POST[$k] = str_replace('Payment-Pin', 'Payment-Pin_c', $_POST[$k]);
         }
     }
     import('@.ORG.Payment.Paypal');
     $p = new Paypal();
     $p->add_field('business', $_POST['business']);
     //收款人账号'*****@*****.**'
     //$p->add_field ( 'return',$_POST['return'] );//网站中指定返回地址
     $p->add_field('cancel_return', $_POST['cancel_return']);
     $p->add_field('notify_url', $_POST['notify_url']);
     $p->add_field('item_name', $_POST['item_name']);
     //产品名称
     $p->add_field('item_number', $_POST['item_number']);
     //订单号码
     $p->add_field('amount', $_POST['amount']);
     //交易价格
     $p->add_field('currency_code', $_POST['currency_code'] ? $_POST['currency_code'] : 'USD');
     //货币代码
     $p->submit_paypal_post_c();
     //简洁提交
 }
Example #3
0
 /**
  * Ipn::paypal()
  *
  * Validate PayPal payments
  *
  * @access	public
  * @return	void
  */
 public function paypal()
 {
     // Include the paypal library
     include_once APPPATH . 'libraries/payment/Paypal.php';
     $this->_gateway = 1;
     // Create an instance of the paypal library
     $my_paypal = new Paypal();
     // Log the IPN results
     // $my_paypal->ipn_log = TRUE;
     // Enable test mode if needed
     if (defined('XUDEBUG') and XUDEBUG == true) {
         $my_paypal->enable_test_mode();
     }
     // Check validity and write down it
     if ($my_paypal->validate_ipn()) {
         if ($my_paypal->ipn_data['payment_status'] == 'Completed') {
             $settings = json_decode(base64_decode($my_paypal->ipn_data['custom']));
             if ($settings['type'] == 'reg') {
                 $this->_new_user_payment($settings['user_id'], $my_paypal->ipn_data['amount']);
                 redirect('/user/pay_complete');
             }
             redirect('/user/pay_cancel');
         } else {
             $this->_log_error($my_paypal->ipn_data);
             redirect('/user/pay_cancel');
         }
     }
     redirect('/user/pay_cancel');
 }
Example #4
0
 public function process($paymentInfo, $function)
 {
     // initilize paypal class
     $paypal = new Paypal();
     if ($function == "DoDirectPayment") {
         return $paypal->DoDirectPayment($paymentInfo);
     }
     if ($function == "SetExpressCheckout") {
         return $paypal->SetExpressCheckout($paymentInfo);
     }
     if ($function == "GetExpressCheckoutDetails") {
         return $paypal->GetExpressCheckoutDetails($paymentInfo);
     }
     if ($function == "DoExpressCheckoutPayment") {
         return $paypal->DoExpressCheckoutPayment($paymentInfo);
     }
     if ($function == "DoVoid") {
         return $paypal->DoVoid($paymentInfo);
     }
     if ($function == "DoReauthorization") {
         return $paypal->DoReauthorization($paymentInfo);
     }
     if ($function == "DoCapture") {
         return $paypal->DoCapture($paymentInfo);
     }
     if ($function == "DoRefund") {
         return $paypal->DoRefund($paymentInfo);
     }
     return "Function Does Not Exist!";
 }
 public function get_by_id($item_number)
 {
     $pay = null;
     //ARRAY OBJECT PASS GARNA
     $pay_list = array();
     //DATABASE CONNECTION
     $this->db->connect();
     //SELECT BY ID
     $sql = "SELECT * FROM donations WHERE item_number=?";
     //PREPARE
     $stmt = $this->db->initialize($sql);
     //BIND
     $stmt->bind_param("i", $item_number);
     //EXECUTE
     $stmt->execute();
     //BIND RESULT
     $stmt->bind_result($pay_id, $item_name, $payment_amount, $txn_id, $payer_email, $item_number);
     while ($stmt->fetch()) {
         //instantiate object
         $paypal = new Paypal();
         $paypal->set_pay_id($pay_id);
         $paypal->set_item_name($item_name);
         $paypal->set_payment_amount($payment_amount);
         $paypal->set_txn_id($txn_id);
         $paypal->set_payer_email($payer_email);
         $paypal->set_item_number($item_number);
         array_push($pay_list, $paypal);
     }
     //CLOSE CONNECTION
     $this->db->close();
     return $pay_list;
 }
Example #6
0
 function processPayment($paymentInfo, $function)
 {
     $paypal = new Paypal();
     if ($function == "DoDirectPayment") {
         return $paypal->DoDirectPayment($paymentInfo);
     } elseif ($function == "SetExpressCheckout") {
         return $paypal->SetExpressCheckout($paymentInfo);
     } elseif ($function == "GetExpressCheckoutDetails") {
         return $paypal->GetExpressCheckoutDetails($paymentInfo);
     } elseif ($function == "DoExpressCheckoutPayment") {
         return $paypal->DoExpressCheckoutPayment($paymentInfo);
     } else {
         return "Function Does Not Exist!";
     }
 }
Example #7
0
 public function __construct($type = false)
 {
     parent::__construct();
     // If type is sent, the cookie has to be delete
     if ($type) {
         unset($this->context->cookie->{self::$cookie_name});
         $this->setExpressCheckoutType($type);
     }
     // Store back the PayPal data if present under the cookie
     if (isset($this->context->cookie->{self::$cookie_name})) {
         $paypal = unserialize($this->context->cookie->{self::$cookie_name});
         foreach ($this->cookie_key as $key) {
             $this->{$key} = $paypal[$key];
         }
     }
     $this->currency = new Currency((int) $this->context->cart->id_currency);
     if (!Validate::isLoadedObject($this->currency)) {
         $this->_errors[] = $this->l('Not a valid currency');
     }
     if (count($this->_errors)) {
         return false;
     }
     $currency_decimals = is_array($this->currency) ? (int) $this->currency['decimals'] : (int) $this->currency->decimals;
     $this->decimals = $currency_decimals * _PS_PRICE_DISPLAY_PRECISION_;
 }
function espresso_process_paypal($payment_data)
{
    do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
    $payment_data['txn_type'] = 'Paypal';
    $payment_data['txn_id'] = 0;
    $payment_data['payment_status'] = 'Incomplete';
    $payment_data['txn_details'] = serialize($_REQUEST);
    include_once 'Paypal.php';
    $myPaypal = new Paypal();
    echo '<!--Event Espresso PayPal Gateway Version ' . $myPaypal->gateway_version . '-->';
    $myPaypal->ipnLog = TRUE;
    $paypal_settings = get_option('event_espresso_paypal_settings');
    if ($paypal_settings['use_sandbox']) {
        $myPaypal->enableTestMode();
    }
    if ($myPaypal->validateIpn()) {
        $payment_data['txn_details'] = serialize($myPaypal->ipnData);
        $payment_data['txn_id'] = $myPaypal->ipnData['txn_id'];
        if ($myPaypal->ipnData['payment_status'] == 'Completed' || $myPaypal->ipnData['payment_status'] == 'Pending') {
            $payment_data['payment_status'] = 'Completed';
            if ($paypal_settings['use_sandbox']) {
                // For this, we'll just email ourselves ALL the data as plain text output.
                $subject = 'Instant Payment Notification - Gateway Variable Dump';
                $body = "An instant payment notification was successfully recieved\n";
                $body .= "from " . $myPaypal->ipnData['payer_email'] . " on " . date('m/d/Y');
                $body .= " at " . date('g:i A') . "\n\nDetails:\n";
                foreach ($myPaypal->ipnData as $key => $value) {
                    $body .= "\n{$key}: {$value}\n";
                }
                wp_mail($payment_data['contact'], $subject, $body);
            }
        } else {
            $subject = 'Instant Payment Notification - Gateway Variable Dump';
            $body = "An instant payment notification failed\n";
            $body .= "from " . $myPaypal->ipnData['payer_email'] . " on " . date('m/d/Y');
            $body .= " at " . date('g:i A') . "\n\nDetails:\n";
            foreach ($myPaypal->ipnData as $key => $value) {
                $body .= "\n{$key}: {$value}\n";
            }
            wp_mail($payment_data['contact'], $subject, $body);
        }
    }
    $payment_data = apply_filters('filter_hook_espresso_get_total_cost', $payment_data);
    $payment_data = apply_filters('filter_hook_espresso_update_attendee_payment_data_in_db', $payment_data);
    do_action('action_hook_espresso_email_after_payment', $payment_data);
    return $payment_data;
}
 public function region_step($param)
 {
     $dd = explode("/", base64_decode($param));
     $date = $dd[0];
     $region_id = $dd[1];
     $message = "";
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $owner = DB::select("select a.email from users a, region_manager b where a.id = b.user_id and b.id = ?", array($region_id));
         if ($owner[0]->email != "" && filter_var($owner[0]->email, FILTER_VALIDATE_EMAIL) && Config::get("app.paypal_email") != "" && filter_var(Config::get("app.paypal_email"), FILTER_VALIDATE_EMAIL)) {
             include "include/paypal/paypal.php";
             $name = Input::get("name");
             $email = Input::get("email");
             $overall = DB::table("users")->where("permission", -1)->first();
             $owner = DB::select("select a.email from users a, region_manager b where a.id = b.user_id and b.id = ?", array($region_id));
             $amount = Input::get("amount");
             $owner_email = $owner[0]->email;
             $owner_amount = Input::get("row1_unit_price");
             $overall_email = Config::get("app.paypal_email");
             $overall_amount = Input::get("row2_unit_price");
             $fee = Input::get("row3_unit_price");
             $transactionid = "TS-RG-" . $this->generate_rand(32);
             $return_url = Config::get("app.url") . "/share/region/" . $param . "/donation/success/" . $transactionid;
             $cancel_url = Config::get("app.url") . "/share/region/" . $param . "/donation/cancel/" . $transactionid;
             DB::table("region_transaction")->insert(array("id" => $transactionid, "region_id" => $region_id, "amount" => $owner_amount, "user_id" => 0, "name" => $name, "email" => $email, "status" => -100, "created_date" => date("Y-m-d H:i:s")));
             DB::table("overall_transaction")->insert(array("id" => null, "related_transaction_id" => $transactionid, "project_id" => $region_id, "project_type" => "region", "amount" => $overall_amount, "user_id" => 0, "name" => $name, "email" => $email, "status" => -100, "created_date" => date("Y-m-d H:i:s")));
             $paypal = new Paypal();
             $receiver = array(array("amount" => $owner_amount, "email" => $owner_email), array("amount" => $overall_amount, "email" => $overall_email));
             $item = array(array("name" => "Donation for region", "identifier" => "p1", "price" => $owner_amount, "itemPrice" => $owner_amount, "itemCount" => 1), array("name" => "Response for donation", "identifier" => "p2", "price" => $overall_amount, "itemPrice" => $overall_amount, "itemCount" => 1));
             $receiverOptions = array(array("receiver" => array("email" => $owner_email), "invoiceData" => array("item" => array(array("name" => "Donation for region", "price" => $owner_amount, "identifire" => "p1")))), array("receiver" => array("email" => $overall_email), "invoiceData" => array("item" => array(array("name" => "Responsive for donation", "price" => $overall_amount, "identifire" => "p2")))));
             $paypal->splitPay($receiver, $item, $return_url, $cancel_url, $receiverOptions);
             exit;
         } else {
             $message = $this->responsebox("Project paypal address is not set yet.");
         }
     }
     $top_projects = DB::table("topproject")->get();
     $about = DB::table("about")->first();
     $about_content = !empty($about) ? $about->content : "";
     $contact = DB::table("contact_us")->first();
     if (empty($contact)) {
         $contact = array("content" => "", "phone_number" => "", "address" => "", "email" => "");
         $contact = json_decode(json_encode($contact), FALSE);
     }
     return View::make("/frontend/region_donation")->with(array("key" => "", "message" => $message, "top_projects" => $top_projects, "about_content" => $about_content, "contact" => $contact));
 }
 public function request_donation($type, $id)
 {
     include "include/paypal/paypal.php";
     $project = DB::table($type)->where("id", $id)->first();
     $amount = Input::get("amount");
     $owner_email = $project->paypal_number;
     $owner_amount = Input::get("row1_unit_price");
     $overall_email = Config::get("app.paypal_email");
     $overall_amount = Input::get("row2_unit_price");
     $fee = Input::get("row3_unit_price");
     $transactionid = "TS-PR-" . $this->generate_rand(32);
     $return_url = Config::get("app.url") . "/project/" . $type . "/" . $id . "/donation/success/" . $transactionid;
     $cancel_url = Config::get("app.url") . "/project/" . $type . "/" . $id . "/donation/cancel/" . $transactionid;
     DB::table($type . "_transaction")->insert(array("id" => $transactionid, "project_id" => $id, "amount" => $owner_amount, "user_id" => Auth::user()->id, "name" => Auth::user()->first_name . " " . Auth::user()->last_name, "email" => Auth::user()->email, "status" => -100, "created_date" => date("Y-m-d H:i:s")));
     DB::table("overall_transaction")->insert(array("id" => null, "related_transaction_id" => $transactionid, "project_id" => $id, "project_type" => $type, "amount" => $overall_amount, "user_id" => Auth::user()->id, "name" => Auth::user()->first_name . " " . Auth::user()->last_name, "email" => Auth::user()->email, "status" => -100, "created_date" => date("Y-m-d H:i:s")));
     $paypal = new Paypal();
     $receiver = array(array("amount" => $owner_amount, "email" => $owner_email), array("amount" => $overall_amount, "email" => $overall_email));
     $item = array(array("name" => "Donation for " . $project->name, "identifier" => "p1", "price" => $owner_amount, "itemPrice" => $owner_amount, "itemCount" => 1), array("name" => "Response for donation", "identifier" => "p2", "price" => $overall_amount, "itemPrice" => $overall_amount, "itemCount" => 1));
     $receiverOptions = array(array("receiver" => array("email" => $owner_email), "invoiceData" => array("item" => array(array("name" => "Donation for " . $project->name, "price" => $owner_amount, "identifire" => "p1")))), array("receiver" => array("email" => $overall_email), "invoiceData" => array("item" => array(array("name" => "Responsive for donation", "price" => $overall_amount, "identifire" => "p2")))));
     $paypal->splitPay($receiver, $item, $return_url, $cancel_url, $receiverOptions);
     exit;
 }
 function add(Paypal $paypal)
 {
     $sql = "INSERT INTO {$this->tabla} VALUES (:idpaypal, :idpropio, :estado, :importe, :moneda, :emailvendedor, :emailcomprador)";
     $param['idpaypal'] = $paypal->getIdpaypal();
     $param['idpropio'] = $paypal->getIdpropio();
     $param['estado'] = $paypal->getEstado();
     $param['importe'] = $paypal->getImporte();
     $param['moneda'] = $paypal->getMoneda();
     $param['emailvendedor'] = $paypal->getEmailvendedor();
     $param['emailcomprador'] = $paypal->getEmailcomprador();
     $r = $this->bd->setConsulta($sql, $param);
     if (!$r) {
         return -1;
     }
     return $this->bd->getAutonumerico();
 }
Example #12
0
 function receivePayment()
 {
     global $CFG;
     if (empty($_REQUEST['tx'])) {
         return false;
     }
     $auth_info = Link::executeScript($CFG->paypal_submit_url, array('tx' => $_REQUEST['tx'], 'at' => $CFG->paypal_tocken, 'cmd' => '_notify-synch'));
     $is_approved = stristr($auth_info, 'SUCCESS');
     if ($is_approved) {
         $auth_info = str_ireplace('SUCCESS', '', $auth_info);
         Messages::add($CFG->paypal_success_message);
         self::$item_count = mb_substr_count($auth_info, 'item_number');
         return self::parseInfo($auth_info);
     } else {
         Errors::add($CFG->paypal_failure_message);
         return false;
     }
 }
Example #13
0
 function processPayment($paymentInfo, $function)
 {
     $paypal = new Paypal();
     if ($function == "DoDirectPayment") {
         return $paypal->DoDirectPayment($paymentInfo);
     } elseif ($function == "SetExpressCheckout") {
         return $paypal->SetExpressCheckout($paymentInfo);
     } elseif ($function == "GetExpressCheckoutDetails") {
         return $paypal->GetExpressCheckoutDetails($paymentInfo);
     } elseif ($function == "DoExpressCheckoutPayment") {
         return $paypal->DoExpressCheckoutPayment($paymentInfo);
     } elseif ($function == "CreateRecurringPayments") {
         return $paypal->CreateRecurringPayments($paymentInfo);
     } elseif ($function == "UpdateRecurringPaymentsProfile") {
         return $paypal->UpdateRecurringPaymentsProfile($paymentInfo);
     } elseif ($function == "ManageRecurringPaymentsProfileStatus") {
         return $paypal->ManageRecurringPaymentsProfileStatus($paymentInfo);
     } else {
         return "Function Does Not Exist!";
     }
 }
Example #14
0
 /**
  * Payment deatails and paypal configuration can be configured here
  * @return [view] Renders view with form inputs
  */
 public function action_payment()
 {
     // validation active
     //$this->template->scripts['footer'][]= '/js/oc-panel/settings.js';
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Payments')));
     $this->template->title = __('Payments');
     // all form config values
     $paymentconf = new Model_Config();
     $config = $paymentconf->where('group_name', '=', 'payment')->find_all();
     $paypal_currency = Paypal::get_currency();
     // currencies limited by paypal
     // save only changed values
     if ($this->request->post()) {
         $validation = Validation::factory($this->request->post())->rule('sandbox', 'range', array(':value', 0, 1))->rule('authorize_sandbox', 'range', array(':value', 0, 1))->rule('stripe_address', 'range', array(':value', 0, 1));
         if ($validation->check()) {
             foreach ($config as $c) {
                 $config_res = $this->request->post($c->config_key);
                 if ($c->config_key == 'paypal_currency') {
                     $config_res = $paypal_currency[core::post('paypal_currency')];
                 }
                 if ($config_res != $c->config_value) {
                     $c->config_value = $config_res;
                     try {
                         $c->save();
                     } catch (Exception $e) {
                         echo $e;
                     }
                 }
             }
         } else {
             $errors = $validation->errors('config');
             foreach ($errors as $error) {
                 Alert::set(Alert::ALERT, $error);
             }
             $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'payment')));
         }
         Alert::set(Alert::SUCCESS, __('Payment Configuration updated'));
         $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'payment')));
     }
     $pages = array('' => __('Deactivated'));
     foreach (Model_Content::get_pages() as $key => $value) {
         $pages[$value->seotitle] = $value->title;
     }
     $this->template->content = View::factory('oc-panel/pages/settings/payment', array('config' => $config, 'pages' => $pages, 'paypal_currency' => $paypal_currency));
 }
Example #15
0
 public function PayPaypal()
 {
     if (!isset($this->data['type'])) {
         $this->msg = Yii::t("default", "Payment type is required");
         return;
     }
     $package_id = isset($this->data['package_id']) ? $this->data['package_id'] : '';
     if ($this->data['type'] == "purchaseSMScredit") {
         $paypal_con = Yii::app()->functions->getPaypalConnectionAdmin();
         $paypal = new Paypal($paypal_con);
         if ($res_paypal = $paypal->getExpressDetail()) {
             $paypal->params['PAYERID'] = $res_paypal['PAYERID'];
             $paypal->params['AMT'] = $res_paypal['AMT'];
             $paypal->params['TOKEN'] = $res_paypal['TOKEN'];
             $paypal->params['CURRENCYCODE'] = $res_paypal['CURRENCYCODE'];
             if ($res = $paypal->expressCheckout()) {
                 $info = Yii::app()->functions->getSMSPackagesById($package_id);
                 $payment_code = Yii::app()->functions->paymentCode("paypal");
                 $params = array('merchant_id' => Yii::app()->functions->getMerchantID(), 'sms_package_id' => $package_id, 'payment_type' => $payment_code, 'package_price' => $res_paypal['AMT'], 'sms_limit' => $info['sms_limit'], 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'payment_gateway_response' => json_encode($res), 'status' => "paid");
                 if ($this->insertData("{{sms_package_trans}}", $params)) {
                     $this->details = Yii::app()->request->baseUrl . "/merchant/smsReceipt/id/" . Yii::app()->db->getLastInsertID();
                     $this->code = 1;
                     $this->msg = Yii::t("default", "Successful");
                 } else {
                     $this->msg = Yii::t("default", "ERROR: Cannot insert record.");
                 }
             } else {
                 $this->msg = $paypal->getError();
             }
         } else {
             $this->msg = $paypal->getError();
         }
     }
     /*end purchaseSMS*/
 }
Example #16
0
    if ($key != 'extra') {
        $req .= "&{$key}={$value}";
    }
}
// Post back to PayPal to validate
if (!$sandbox) {
    $curl = curl_init('https://www.paypal.com/cgi-bin/webscr');
} else {
    $curl = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr');
}
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $req);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$res = curl_exec($curl);
if (strcmp($res, 'VERIFIED') == 0) {
    Paypal::processStandardPayment();
    if ($email_admin) {
        $emailtext = '';
        foreach ($_REQUEST as $key => $value) {
            $emailtext .= $key . ' = ' . $value . '\\n\\n';
        }
        mail(osc_contact_email(), 'OSCLASS PAYPAL DEBUG', $emailtext . '\\n\\n ---------------- \\n\\n' . $req);
    }
} else {
    if (strcmp($res, 'INVALID') == 0) {
        // INVALID: Do nothing
    }
}
Example #17
0
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2011 PrestaShop SA
*  @version  Release: $Revision: 7732 $
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include_once dirname(__FILE__) . '/../../config/config.inc.php';
include_once dirname(__FILE__) . '/../../init.php';
include_once _PS_MODULE_DIR_ . 'paypal/paypal.php';
$pp = new Paypal();
if (!($transaction_id = Tools::getValue('txn_id'))) {
    die('No transaction id');
}
if (!($id_order = $pp->getOrder($transaction_id))) {
    die('No order');
}
$order = new Order((int) $id_order);
if (!Validate::isLoadedObject($order) or !$order->id) {
    die('Invalid order');
}
if (!($amount = (double) Tools::getValue('mc_gross')) or $amount != $order->total_paid) {
    die('Incorrect amount');
}
if (!($status = strval(Tools::getValue('payment_status')))) {
    die('Incorrect order status');
Example #18
0
else {
	$txn->time       = time();
	$txn->amount     = $paymentAmount;
	$txn->userId     = Privacy::getId();
	if (!$filtered['support-userId']) {
		$txn->forId  = Privacy::getId();
	}
	else {
		$txn->forId      = $filtered['support-userId'];
	}
	$txn->isAlliance = 0;
	$t->uid = $filteredG['uid'];
	if ($filtered['paypal-submit_x']) {
	
		$txnId = $txn->create();
		$pp = new Paypal();
	
		if(!$pp->step1And2($txn)) {
			//Redirecting to APIError.php to display errors. 
			$error = 3;
		}
	}
}

switch ($error) {
	// return URL (success)
	case 1:
		
		break;
	case 2: // cancel
		$t->err = 'Your transaction was cancelled';
Example #19
0
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2012 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/paypal.php';
$errors = '';
$result = false;
$paypal = new Paypal();
// Fill params
$params = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
    $params .= '&' . $key . '=' . urlencode(stripslashes($value));
}
// PayPal Server
$paypalServer = 'www.' . (Configuration::get('PAYPAL_SANDBOX') ? 'sandbox.' : '') . 'paypal.com';
// Getting PayPal data...
if (function_exists('curl_exec')) {
    // curl ready
    $ch = curl_init('https://' . $paypalServer . '/cgi-bin/webscr');
    // If the above fails, then try the url with a trailing slash (fixes problems on some servers)
    if (!$ch) {
        $ch = curl_init('https://' . $paypalServer . '/cgi-bin/webscr/');
    }
Example #20
0
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2012 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include_once dirname(__FILE__) . '/../../config/config.inc.php';
include_once dirname(__FILE__) . '/../../init.php';
include_once _PS_MODULE_DIR_ . 'paypal/paypal.php';
$paypal = new Paypal();
$paypal_order = new PayPalOrder();
if (!($transaction_id = Tools::getValue('txn_id'))) {
    die($paypal->l('No transaction id'));
}
if (!($id_order = $paypal_order->getIdOrderByTransactionId($transaction_id))) {
    die($paypal->l('No order'));
}
$order = new Order((int) $id_order);
if (!Validate::isLoadedObject($order) || !$order->id) {
    die($paypal->l('Invalid order'));
}
if (!($amount = (double) Tools::getValue('mc_gross') || $amount != $order->total_paid)) {
    die($paypal->l('Incorrect amount'));
}
if (!($status = (string) Tools::getValue('payment_status'))) {
Example #21
0
<?php

require_once "config_sql.php";
// include the file connecting to the DB
require_once "paypal_class.php";
$p = new Paypal();
$action = $_REQUEST["action"];
switch ($action) {
    case "success":
        // success case to show the user payment got success
        echo "<h1>Payment Transaction Done Successfully</h1>";
        break;
    case "cancel":
        // case cancel to show user the transaction was cancelled
        echo "<h1>Transaction Cancelled";
        break;
    case "process":
        // it performs the parallel payment
        $p->splitPay();
        break;
}
Example #22
0
<?php

require 'paypalClass.php';
$paypal = new Paypal();
// Get Transaction Details
$response = $paypal->request('GetExpressCheckoutDetails', array('TOKEN' => $_GET['token']));
// $amount = $response['PAYMENTINFO_0_AMT'];
// echo '<pre>';
// print_r($_REQUEST);
// print_r($response);
// echo '</pre>';
// echo $_GET['token'];
// echo '<br>';
// echo $_GET['PayerID'];
// echo '<br>';
// Do transaction
$response2 = $paypal->request('DoExpressCheckoutPayment', array('TOKEN' => $_GET['token'], 'PAYERID' => $_GET['PayerID'], 'PAYMENTACTION' => 'Sale', 'PAYMENTREQUEST_0_AMT' => 5, 'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR'));
echo '<pre>';
print_r($_REQUEST);
echo '</pre>';
Example #23
0
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2011 PrestaShop SA
*  @version  Release: $Revision: 6594 $
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include dirname(__FILE__) . '/../../../config/config.inc.php';
include dirname(__FILE__) . '/../../../init.php';
include dirname(__FILE__) . '/../paypal.php';
$paypal = new Paypal();
$cart = new Cart((int) $cookie->id_cart);
$address = new Address((int) $cart->id_address_delivery);
$country = new Country((int) $address->id_country);
$state = NULL;
if ($address->id_state) {
    $state = new State((int) $address->id_state);
}
$customer = new Customer((int) $cart->id_customer);
$business = Configuration::get('PAYPAL_BUSINESS');
$header = Configuration::get('PAYPAL_HEADER');
$currency_order = new Currency((int) $cart->id_currency);
$currency_module = $paypal->getCurrency((int) $cart->id_currency);
if (empty($business) or !Validate::isEmail($business)) {
    die($paypal->getL('Paypal error: (invalid or undefined business account email)'));
}
Example #24
0
 function indexAction()
 {
     //[TODO] must check if orderId has been paid before to avoid double charge, if somehow user can access directly to payment controller.
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $this->_checkAuth();
     $orderId = $this->_request->getParam('orderId');
     $this->_orderIdNumber = $orderId;
     if (empty($orderId)) {
         echo "kosong";
         die;
     }
     $modelAppStore = new App_Model_Store();
     if (!$modelAppStore->isUserOwnOrder($this->_user->kopel, $orderId)) {
         //forward to error page
         $this->_helper->redirector->gotoSimple('error', 'store', 'hol-site', array('view' => 'notowner'));
         die;
     }
     if ($modelAppStore->isOrderPaid($orderId)) {
         //forward to error page
         $this->_helper->redirector->gotoSimple('error', 'store', 'hol-site', array('view' => 'orderalreadypaid'));
         die;
     }
     $items = App_Model_Show_Order::show()->getOrderDetail($orderId);
     $tmpMethod = $this->_request->getParam('method');
     if (!empty($tmpMethod)) {
         $items[0]['paymentMethod'] = $tmpMethod;
     }
     switch ($items[0]['paymentMethod']) {
         case 'nsiapay':
             require_once 'PaymentGateway/Nsiapay.php';
             // include the class file
             $paymentObject = new Nsiapay();
             // initiate an instance of the class
             if ($this->_testMode) {
                 $paymentObject->enableTestMode();
             }
             $paymentObject->addField('TYPE', "IMMEDIATE");
             $subTotal = 0;
             for ($iCart = 0; $iCart < count($items); $iCart++) {
                 $i = $iCart + 1;
                 $basket[] = $items[$iCart]['documentName'] . "," . $items[$iCart]['price'] . ".00" . "," . $items[$iCart]['qty'] . "," . $items[$iCart]['finalPrice'] . ".00";
                 $subTotal += $items[$iCart]['price'] * $items[$iCart]['qty'];
             }
             $ca = implode(";", $basket);
             $merchantId = "000100090000028";
             $paymentObject->addField("BASKET", $ca);
             $paymentObject->addField("MERCHANTID", $merchantId);
             $paymentObject->addField("CHAINNUM", "NA");
             $paymentObject->addField("TRANSIDMERCHANT", $items[0]['invoiceNumber']);
             $paymentObject->addField("AMOUNT", $subTotal);
             $paymentObject->addField("CURRENCY", "360");
             $paymentObject->addField("PurchaseCurrency", "360");
             $paymentObject->addField("acquirerBIN", "360");
             $paymentObject->addField("password", "123456");
             $paymentObject->addField("URL", ROOT_URL);
             $paymentObject->addField("MALLID", "199");
             $paymentObject->addField("SESSIONID", Zend_Session::getId());
             $sha1 = sha1($subTotal . ".00" . $merchantId . "08iIWbWvO16w" . $items[0]['invoiceNumber']);
             //                echo $subTotal.".00".$merchantId."08iIWbWvO16w".$items[0]['invoiceNumber']."<br>";
             //                echo $sha1;die;
             $paymentObject->addField("WORDS", $sha1);
             $ivnum = $this->updateInvoiceMethod($orderId, 'nsiapay', 1, 0, 'paid with nsiapay method');
             $data['orderId'] = $orderId;
             $data['starttime'] = date('YmdHis');
             $data['amount'] = $subTotal;
             $data['transidmerchant'] = $items[0]['invoiceNumber'];
             $tblNsiapay = new App_Model_Db_Table_Nsiapay();
             $tblNsiapay->insert($data);
             $nhis['orderId'] = $items[0]['invoiceNumber'];
             $nhis['paymentStatus'] = 'requested';
             $nhis['dateAdded'] = date('YmdHis');
             $tblNhis = new App_Model_Db_Table_NsiapayHistory();
             $tblNhis->insert($nhis);
             //$paymentObject->dumpFields();die();
             $this->_helper->layout->disableLayout();
             $paymentObject->submitPayment();
             break;
         case 'paypal':
             /*
              - Detect Multi Item and set accordingly
              - Logic for test mode 
             */
             require_once 'PaymentGateway/Paypal.php';
             // include the class file
             $paymentObject = new Paypal();
             // initiate an instance of the class
             if ($this->_testMode) {
                 $paymentObject->addField('business', $this->_paymentVars['paypalTestBusiness']);
                 $paymentObject->addField('return', $this->_paymentVars['paypalTestSuccessUrl']);
                 $paymentObject->addField('cancel_return', $this->_paymentVars['paypalTestCancelUrl']);
                 $paymentObject->addField('notify_url', $this->_paymentVars['paypalTestNotifyUrl']);
                 $paymentObject->enableTestMode();
             } else {
                 $paymentObject->addField('business', $this->_paymentVars['paypalBusiness']);
                 $paymentObject->addField('return', $this->_paymentVars['paypalSuccessUrl']);
                 $paymentObject->addField('cancel_return', $this->_paymentVars['paypalCancelUrl']);
                 $paymentObject->addField('notify_url', $this->_paymentVars['paypalNotifyUrl']);
             }
             for ($iCart = 0; $iCart < count($items); $iCart++) {
                 $i = $iCart + 1;
                 $paymentObject->addField("item_number_" . $i, $items[$iCart]['itemId']);
                 $paymentObject->addField("item_name_" . $i, $items[$iCart]['documentName']);
                 //nama barang [documentName]
                 $paymentObject->addField("amount_" . $i, $items[$iCart]['price']);
                 //harga satuan [price]
                 $paymentObject->addField("quantity_" . $i, $items[$iCart]['qty']);
                 //jumlah barang [qty]\
             }
             $paymentObject->addField('tax_cart', $items[0]['orderTax']);
             $paymentObject->addField('currency_code', $this->_defaultCurrency);
             //$paymentObject->addField('custom',$_SESSION['_orderIdNumber']);
             $paymentObject->addField('custom', $orderId);
             $ivnum = $this->updateInvoiceMethod($orderId, 'paypal', 1, 0, 'paid with paypal method');
             //$paymentObject->dumpFields();
             $this->_helper->layout->disableLayout();
             $paymentObject->submitPayment();
             //setting payment and status as pending (1), notify = 0, notes = 'paid with...'
             break;
         case 'manual':
         case 'bank':
             /*
              1. update order status
              2. redirect to instruction page 
             */
             //setting payment and status as pending (1), notify = 0, notes = 'paid with...'
             $this->updateInvoiceMethod($orderId, 'bank', 1, 0, 'paid with manual method');
             // HAP: i think we should send this notification when user were on page "Complete Order" and after confirmation made by user is approved;
             //$this->Mailer($orderId, 'admin-order', 'admin');
             //$this->Mailer($orderId, 'user-order', 'user');
             $this->_helper->redirector('instruction', 'store_payment', 'site', array('orderId' => $orderId));
             break;
         case 'postpaid':
             /*
              1. validate POSTPAID status of the client 
              2. validate CREDIT LIMIT (per user) with current Outstanding Bill + New Bill
              3. update order status
              4. redirect to success or failed 
             */
             /*
              * if userid isn't listed as postpaid user will be redirected
              */
             if (!$this->_userFinanceInfo->isPostPaid) {
                 echo 'Not Post Paid Customer';
                 //$paymentObject->submitPayment();
                 return $this->_helper->redirector('notpostpaid');
             }
             /*====================VALIDATE CREDIT LIMIT=====================*/
             /*
              * validate credit limit :
              * 1. count total transaction 
              * 2. counting total previous unpaid postpaid transaction
              * 3. validate
              */
             //$cart = $this->completeItem();
             /*-----count total amount of prevous unpaid transaction------*/
             //$tblOrder = new Pandamp_Modules_Payment_Order_Model_Order();
             //table kutuOrder
             //select previous transaction that are postpaid based on userid
             //echo ($tblOrder->outstandingUserAmout($this->_userInfo->userId));
             $outstandingAmount = App_Model_Show_Order::show()->outstandingUserAmout($this->_userFinanceInfo->userId);
             /*count total amount of prevous unpaid transaction------*/
             if ($this->_userFinanceInfo->creditLimit == 0) {
                 $limit = 'Unlimited';
                 $netLimit = 'Unlimited';
             } else {
                 $limit = number_format($this->_userFinanceInfo->creditLimit, 2);
                 $netLimit = $limit - $outstandingAmount;
                 $netLimit = number_format($netLimit, 2);
             }
             //$superTotal = $cart['grandTotal']+$outstandingAmount;
             $superTotal = $items[0]['orderTotal'] + $outstandingAmount;
             if ($this->_userFinanceInfo->creditLimit != 0 and $this->_userFinanceInfo->creditLimit < $superTotal) {
                 echo $superTotal . $limit;
                 $this->_helper->redirector('postpaidlimit');
                 echo 'Credit Limit Reached, Please Contact Our Billing';
                 /*====================VALIDATE CREDIT LIMIT=====================*/
             } else {
                 $this->view->type = "postpaid";
                 $this->view->limit = $limit;
                 $this->view->outstandingAmount = $outstandingAmount;
                 $this->view->grandTotal = $items[0]['orderTotal'];
                 $this->view->netLimit = $netLimit;
                 $this->view->taxInfo = $items[0];
                 $this->view->orderId = $orderId;
             }
             break;
     }
 }
<?php

require 'paypalClass.php';
if (isset($_GET["amount"])) {
    $amount = $_GET["amount"];
    if ($amount <= 3) {
        $amount = 3;
    }
} else {
    $amount = 3;
}
$paypal = new Paypal();
$params = array('RETURNURL' => 'http://4l-front.dev/paypal/doCheckout.php', 'CANCELURL' => 'http://4l-front.dev/', 'PAYMENTREQUEST_0_AMT' => $amount, 'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR');
$token = $paypal->request('SetExpressCheckout', $params);
if ($token) {
    $url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&useraction=commit&token=" . $token;
    // echo $token;
    header("Location: {$url}");
    exit;
}
Example #26
0
 function paypal_ipn($id)
 {
     $order = ORM::factory("order")->where("id", "=", $id)->find();
     if ($order->loaded()) {
         $paypal = new Paypal();
         if ($paypal->validate_ipn($id)) {
             if ($paypal->ipn_data['payment_status'] == "Completed") {
                 $order->status = Order_Model::PAYMENT_CONFIRMED;
                 order_log::log($order, order_log::ORDERED);
                 // send e-mails
                 basket::send_order($order);
                 basket::send_invoice($order);
                 $order->save();
             }
             return;
         }
         print "invalid access. tut tut!";
     }
     return;
 }
$street = $_POST['address'];
$city = $_POST['city'];
$zip = $_POST['postal_code'];
$desc = $_POST['item'];
$carId = $_POST['car_id'];
$caryear = $_POST['caryear'];
$make = $_POST['make'];
$model = $_POST['model'];
$first_name = $_POST['first_name'];
$name = $_POST['first_name'] + " " + $_POST['last_name'];
$email = $_POST['email'];
$phone = $_POST['telephone'];
$country = $_POST['country'];
$price = $_POST['carprice'];
$exterior_color = $_POST['exterior_color'];
$interior_color = $_POST['interior_color'];
$trim = $_POST['trim'];
//Insert into temp table
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
mysql_select_db(DB_SYL_NAME, $link) or die('Could not select database.');
$insertQuery = "INSERT INTO temp_car_detail_payment_info ( first_name, last_name, address, telephone, country, city,  postal_code,email, make, model, year, price, exterior_color, interior_color, trim ) VALUES( '" . mysql_real_escape_string($firstName) . "', '" . mysql_real_escape_string($lastName) . "', '" . mysql_real_escape_string($street) . "', '" . mysql_real_escape_string($phone) . "', '" . mysql_real_escape_string($country) . "', '" . mysql_real_escape_string($city) . "', '" . mysql_real_escape_string($zip) . "', '" . mysql_real_escape_string($email) . "', '" . mysql_real_escape_string($make) . "', '" . mysql_real_escape_string($model) . "', '" . mysql_real_escape_string($caryear) . "', '" . mysql_real_escape_string($price) . "', '" . mysql_real_escape_string($exterior_color) . "', '" . mysql_real_escape_string($interior_color) . "', '" . mysql_real_escape_string($trim) . "' )";
$result = mysql_query($insertQuery);
$lastid = mysql_query('select id from temp_car_detail_payment_info order by id DESC limit 0,1');
$lastfetch = mysql_fetch_object($lastid);
$custom = serialize(array("pg" => 1, "ty" => 1, "id" => $lastfetch->id));
$pay = new Paypal();
$currencyCode = 'USD';
$userdata = array('IPADDRESS' => $_SERVER['REMOTE_ADDR'], 'PAYMENTACTION' => 'Sale', 'CREDITCARDTYPE' => $cardType, 'DESC' => $desc, 'ACCT' => $cardNumber, 'EXPDATE' => $expMonth . $expYear, 'CVV2' => $cvv, 'FIRSTNAME' => $firstName, 'LASTNAME' => $lastName, 'EMAIL' => $email, 'SOFTDESCRIPTORCITY' => $email, 'COUNTRYCODE' => 'US', 'CITY' => $city, 'STREET' => $street, 'ZIP' => $zip, 'NOTIFYURL' => 'http://seobrand-dev.com/ipn.php', 'AMT' => $amount, 'CURRENCYCODE' => $currencyCode, 'CUSTOM' => $custom);
$payInfo = $pay->request('DoDirectPayment', $userdata);
echo json_encode($payInfo);
die;
Example #28
0
    /* Set details for a payment */
    $ppec->setExpressCheckout();
    if ($ppec->hasSucceedRequest() && !empty($ppec->token)) {
        $ppec->redirectToAPI();
    } else {
        $ppec->displayPayPalAPIError($ppec->l('Error during the preparation of the Express Checkout payment'), $ppec->logs);
    }
} elseif (!empty($ppec->token) && $ppec->token == $token && ($ppec->payer_id = $payer_id)) {
    /* Get payment infos from paypal */
    $ppec->getExpressCheckout();
    if ($ppec->hasSucceedRequest() && !empty($ppec->token)) {
        $address = $customer = null;
        $email = $ppec->result['EMAIL'];
        /* Create Customer if not exist with address etc */
        if ($ppec->context->cookie->logged) {
            $id_customer = Paypal::getPayPalCustomerIdByEmail($email);
            if (!$id_customer) {
                PayPal::addPayPalCustomer($ppec->context->customer->id, $email);
            }
            $customer = $ppec->context->customer;
        } elseif ($id_customer = Customer::customerExists($email, true)) {
            $customer = new Customer($id_customer);
        } else {
            $customer = setCustomerInformation($ppec, $email);
            $customer->add();
            PayPal::addPayPalCustomer($customer->id, $email);
        }
        if (!$customer->id) {
            $ppec->logs[] = $ppec->l('Cannot create customer');
        }
        if (!isset($ppec->result['PAYMENTREQUEST_0_SHIPTOSTREET']) || !isset($ppec->result['PAYMENTREQUEST_0_SHIPTOCITY']) || !isset($ppec->result['SHIPTOZIP']) || !isset($ppec->result['COUNTRYCODE'])) {
Example #29
0
        if (!$order) {
            $this->context->smarty->assign('errors', array($this->paypal->l('Payment error')));
        }
        echo $this->paypal->fetchTemplate('/views/templates/front/', 'order-confirmation');
    }
}
if (Tools::getValue('id_module') && Tools::getValue('key') && Tools::getValue('id_cart') && Tools::getValue('id_order')) {
    if (_PS_VERSION_ < '1.5') {
        new PayPalExpressCheckoutSubmit();
    }
} elseif (Tools::getValue('get_qty')) {
    /* Ajax response */
    $id_product = (int) Tools::getValue('id_product');
    $id_product_attribute = (int) Tools::getValue('id_product_attribute');
    if (Product::getQuantity((int) $id_product, (int) $id_product_attribute) <= 0) {
        $paypal = new Paypal();
        die($paypal->l('This product is no longer in stock with those attributes but is available with others'));
    }
    die(true);
} else {
    $request_type = Tools::getValue('express_checkout');
    $ppec = new PaypalExpressCheckout($request_type);
    if ($request_type && $ppec->type) {
        $id_product = (int) Tools::getValue('id_product');
        $id_product_attribute = (int) Tools::getValue('id_p_attr');
        $product_quantity = (int) Tools::getValue('quantity');
        if ($id_product > 0 && $id_product_attribute !== false && $product_quantity > 0) {
            // Create new Cart to avoid any refresh or other bad manipulations
            $ppec->context->cart = new Cart();
            $ppec->context->cart->id_currency = (int) $ppec->context->currency->id;
            $ppec->context->cart->id_lang = (int) $ppec->context->language->id;
Example #30
0
 public function verificationAction()
 {
     /*
      - check payment type use switch if necessary (paypal, twoco, manual )
      - use verification function from existing library of paypal/twoco
      - set order status if verified
      - redirect to proper page? or trigger mail?          
     */
     // Create an instance of the paypal library
     require_once 'PaymentGateway/Paypal.php';
     $myPaypal = new Paypal();
     // Log the IPN results
     $myPaypal->ipnLog = TRUE;
     // Enable test mode if needed
     if ($this->_testMode) {
         $myPaypal->enableTestMode();
     }
     // Check validity, status, amount and tax amount and write down it
     if ($myPaypal->validateIpn()) {
         //if ($myPaypal->ipnData['payment_status'] == 'Completed' && $myPaypal['']=='')
         if ($myPaypal->ipnData['payment_status'] == 'Completed') {
             $data = $myPaypal->ipnData;
             //$this->Mailer($data['custom'], 'admin-paypal', 'admin');
             //$this->Mailer($data['custom'], 'user-paypal', 'XXX');
             $this->paypalsave('SUCCESS', $data);
             $modDir = $this->getFrontController()->getModuleDirectory();
             require_once $modDir . '/models/Store/Mailer.php';
             $mod = new Holsite_Model_Store_Mailer();
             $mod->sendReceiptToUser($data['custom'], 'paypal', 'SUCCESS PAID');
         } else {
             $data = $myPaypal->ipnData;
             //$this->Mailer($data['custom'], 'admin-paypal', 'admin');
             //$this->Mailer($data['custom'], 'user-paypal', 'admin');
             $this->paypalsave('FAILED', $data);
             $modDir = $this->getFrontController()->getModuleDirectory();
             require_once $modDir . '/models/Store/Mailer.php';
             $mod = new Holsite_Model_Store_Mailer();
             $mod->sendReceiptToUser($data['custom'], 'paypal', 'FAILED');
         }
     } else {
         foreach ($this->_request->getParams() as $key => $val) {
             $data[$key] = $val;
         }
         //all data and key are same with ipnData
         //$this->Mailer($data['custom'], 'admin-paypal', 'admin');
         //send all post variables to admin email
         $writer = new Zend_Log_Writer_Stream(ROOT_PATH . '/app_log.txt');
         $logger = new Zend_Log($writer);
         $logger->info(var_dump($data));
     }
     die;
 }