当前位置: 首页>>代码示例>>PHP>>正文


PHP Paypal::validateIpn方法代码示例

本文整理汇总了PHP中Paypal::validateIpn方法的典型用法代码示例。如果您正苦于以下问题:PHP Paypal::validateIpn方法的具体用法?PHP Paypal::validateIpn怎么用?PHP Paypal::validateIpn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Paypal的用法示例。


在下文中一共展示了Paypal::validateIpn方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: paypal

 /**
  * IPN->paypal()
  *
  * Validate PayPal payments
  *
  * @access	public
  * @return	none
  */
 public function paypal()
 {
     // Include the paypal library
     include_once APPPATH . 'libraries/payment/Paypal.php';
     $this->gateway = '1';
     // Create an instance of the paypal library
     $myPaypal = new Paypal();
     // Log the IPN results
     // $myPaypal->ipnLog = TRUE;
     // Enable test mode if needed
     if (defined('XUDEBUG') and XUDEBUG == true) {
         $myPaypal->enableTestMode();
     }
     // Check validity and write down it
     if ($myPaypal->validateIpn()) {
         if ($myPaypal->ipnData['payment_status'] == 'Completed') {
             $settings = unserialize(base64_decode($myPaypal->ipnData['custom']));
             if ($settings['type'] == 'reg') {
                 $this->_newUserPayment($settings['user_id'], $myPaypal->ipnData['amount']);
                 redirect('/user/pay_complete');
             }
             redirect('/user/pay_cancel');
         } else {
             $this->_logError($myPaypal->ipnData);
             redirect('/user/pay_cancel');
         }
     }
     redirect('/user/pay_cancel');
 }
开发者ID:rexcarnation,项目名称:XtraUpload,代码行数:37,代码来源:ipn.php

示例2: espresso_process_paypal

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;
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:47,代码来源:paypal_ipn.php

示例3: verificationAction

 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;
 }
开发者ID:hukumonline,项目名称:quart80,代码行数:52,代码来源:PaymentController.php

示例4: dirname

<?php

define("IN_KEKE", true);
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'app_comm.php';
require "Paypal.php";
$myPaypal = new Paypal();
$myPaypal->logIpn = TRUE;
$valid = $myPaypal->validateIpn();
list($_, $charge_type, $uid, $obj_id, $order_id, $model_id) = explode('-', $myPaypal->ipnData['custom'], 6);
$fac_obj = new pay_return_fac_class($charge_type, $model_id, $uid, $obj_id, $order_id, $myPaypal->ipnData['mc_gross'], 'paypal', $myPaypal->ipnData['custom']);
if ($valid) {
    $total_fee = $myPaypal->ipnData['mc_fee'];
    if ($myPaypal->ipnData['payment_status'] == 'Completed') {
        $response = $fac_obj->load();
        if ($charge_type == 'user_charge') {
            $show_url = 'index.php?do=recharge&cash=' . $total_fee . '&status=1';
        } elseif ($charge_type == 'payitem_charge') {
            if (!in_array($model_id, array(6, 7))) {
                $show_url = 'index.php?do=task&id=' . $obj_id;
            } else {
                $show_url = 'index.php?do=goods&id=' . $obj_id;
            }
        } else {
            if (!in_array($model_id, array(6, 7))) {
                $arrOrderDetail = keke_order_class::get_order_detail($order_id);
                if ($arrOrderDetail[0]['obj_type'] == 'hosted') {
                    $show_url = 'index.php?do=task&id=' . $obj_id;
                } else {
                    $show_url = 'index.php?do=pay&type=task&id=' . $obj_id . '&status=1';
                }
            } else {
开发者ID:huangbinzd,项目名称:kppwGit,代码行数:31,代码来源:return.php

示例5: gateway_ipn

 public function gateway_ipn($config)
 {
     $cancel = $this->EE->input->get('cancel', TRUE);
     $ipn_valid = FALSE;
     if ($cancel != '') {
         $this->EE->product_model->cart_update_status(session_id(), 0);
         $this->EE->functions->redirect($this->EE->functions->create_url($this->_config["store"][$this->site_id]["cart_url"]));
         exit;
     }
     // Create an instance of the paypal library
     $myPaypal = new Paypal();
     if ($config["sandbox"] == "TRUE") {
         $myPaypal->enableTestMode();
     }
     # Debug file_put_contents(APPPATH.'cache/brilliant_retail/paypal_'.time().'.txt', 'SUCCESS\n\n'.json_encode($_POST));
     // Check validity and write down it
     if ($myPaypal->validateIpn()) {
         $ipn_valid = TRUE;
     }
     // Update BR
     if ($myPaypal->ipnData['payment_status'] == 'Completed' || $myPaypal->ipnData['payment_status'] == 'Pending') {
         if ($ipn_valid == TRUE) {
             $status['Pending'] = 2;
             $status['Completed'] = 3;
             $new_status = $status[$myPaypal->ipnData['payment_status']];
         } else {
             $new_status = 1;
         }
         // The ipn_create_order funtion is a core
         // function that will 'create' the order
         // based on the merchant_id value stored in the br_order_table.
         // Function handles both creating and updating from pending to complete
         // just pass the merchant_id. For paypal standard it is in the custom field.
         $this->ipn_create_order($myPaypal->ipnData['custom'], $new_status);
     }
     @header("HTTP/1.0 200 OK");
     @header("HTTP/1.1 200 OK");
     exit('Success');
 }
开发者ID:ebeauchamps,项目名称:brilliantretail,代码行数:39,代码来源:gateway.paypal_standard.php

示例6: verificationAction

 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', 'admin');
             $this->paypalsave('SUCCESS', $data);
         } else {
             $data = $myPaypal->ipnData;
             $this->Mailer($data['custom'], 'admin-paypal', 'admin');
             $this->Mailer($data['custom'], 'user-paypal', 'admin');
             $this->paypalsave('FAILED', $data);
             /*$this->paypalsave('FAILED');
             	 $this->Mailer($data['orderId'], 'admin-paypal', 'admin');
             	 $this->Mailer($data['orderId'], 'user-paypal', 'admin');*/
         }
     } 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
     }
     $_SESSION['jCart'] = '';
     die;
 }
开发者ID:psykomo,项目名称:kutump-enhanced,代码行数:45,代码来源:PaymentController.php

示例7: actionIpn

 public function actionIpn()
 {
     Yii::import('application.modules.shop.components.payment.Paypal');
     $paypal = new Paypal();
     Shop::log('Paypal payment attempt');
     // Log the IPN results
     $paypal->ipnLog = TRUE;
     if (Shop::module()->payPalTestMode) {
         $paypal->enableTestMode();
     }
     // Check validity and write down it
     if ($paypal->validateIpn()) {
         if ($paypal->ipnData['payment_status'] == 'Completed') {
             Shop::log('Paypal payment arrived :' . var_dump($paypal));
         } else {
             Shop::log('Paypal payment raised an error :' . var_dump($paypal));
         }
     }
 }
开发者ID:rinodung,项目名称:yii-shop,代码行数:19,代码来源:OrderController.php

示例8: Paypal

<?php

// Include the paypal library
include_once 'Paypal.php';
// Create an instance of the paypal library
$myPaypal = new Paypal();
// Log the IPN results
$myPaypal->ipnLog = TRUE;
// Enable test mode if needed
$myPaypal->enableTestMode();
// Check validity and write down it
if ($myPaypal->validateIpn()) {
    if ($myPaypal->ipnData['payment_status'] == 'Completed') {
        file_put_contents('paypal.txt', 'SUCCESS');
    } else {
        file_put_contents('paypal.txt', "FAILURE\n\n" . $myPaypal->ipnData);
    }
}
开发者ID:fevenor,项目名称:Dockerfile,代码行数:18,代码来源:paypal_ipn.php


注:本文中的Paypal::validateIpn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。