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


PHP Paypal::enableTestMode方法代码示例

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


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

 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;
//.........这里部分代码省略.........
开发者ID:hukumonline,项目名称:pmg,代码行数:101,代码来源:PaymentController.php

示例5: Paypal

<?php

// Include the paypal library
include_once 'Paypal.php';
// Create an instance of the paypal library
$myPaypal = new Paypal();
// Specify your paypal email
$myPaypal->addField('business', 'YOUR_PAYPAL_EMAIL');
// Specify the currency
$myPaypal->addField('currency_code', 'USD');
// Specify the url where paypal will send the user on success/failure
$myPaypal->addField('return', 'http://YOUR_HOST/payment/paypal_success.php');
$myPaypal->addField('cancel_return', 'http://YOUR_HOST/payment/paypal_failure.php');
// Specify the url where paypal will send the IPN
$myPaypal->addField('notify_url', 'http://YOUR_HOST/payment/paypal_ipn.php');
// Specify the product information
$myPaypal->addField('item_name', 'T-Shirt');
$myPaypal->addField('amount', '9.99');
$myPaypal->addField('item_number', '001');
// Specify any custom value
$myPaypal->addField('custom', 'muri-khao');
// Enable test mode if needed
$myPaypal->enableTestMode();
// Let's start the train!
$myPaypal->submitPayment();
开发者ID:fevenor,项目名称:Dockerfile,代码行数:25,代码来源:paypal_start.php

示例6: pay_new

 public function pay_new($id = '', $gate_id = '')
 {
     if (intval($id) == 0 or intval($gate_id) == 0) {
         show_404();
     }
     $user = $this->db->get_where('users', array('id' => $id))->row();
     if (!$user or $user->status != 0) {
         show_404();
     }
     $group = $this->db->get_where('groups', array('id' => $user->group))->row();
     if (!$group) {
         show_404();
     }
     $gate = $this->db->get_where('gateways', array('id' => $gate_id))->row();
     if (!$gate) {
         show_404();
     }
     // get payment gateway settings
     $gate_conf = unserialize($gate->settings);
     // load payment libs
     include_once APPPATH . 'libraries/payment/PaymentGateway.php';
     // which payment system to use?
     if ($gate->name == 'paypal') {
         // Include the paypal library
         include_once APPPATH . 'libraries/payment/Paypal.php';
         // Create an instance of the paypal library
         $myPaypal = new Paypal();
         // Specify your paypal email
         $myPaypal->addField('business', $gate_conf['email']);
         // Specify the currency
         $myPaypal->addField('currency_code', $gate_conf['currency']);
         // Specify the url where paypal will send the user on success/failure
         $myPaypal->addField('return', site_url('user/pay_complete'));
         $myPaypal->addField('cancel_return', site_url('user/pay_cancel'));
         // Specify the url where paypal will send the IPN
         $myPaypal->addField('notify_url', site_url('payment/ipn/paypal'));
         // Specify the product information
         $myPaypal->addField('item_name', $this->startup->site_config['sitename'] . ' ' . $this->lang->line('user_controller_14'));
         $myPaypal->addField('amount', $group->price);
         $myPaypal->addField('item_number', rand(1, 1000) . '-' . $user->id);
         // Specify any custom value
         $myPaypal->addField('custom', base64_encode(serialize(array('user_id' => $user->id, 'type' => 'reg'))));
         // Enable test mode if needed
         if (defined('XUDEBUG') and XUDEBUG == true) {
             $myPaypal->enableTestMode();
         }
         // Let's start the train!
         $data['form'] = $myPaypal->submitPayment($this->lang->line('user_controller_paypal_submitpayment'));
     } else {
         if ($gate->name == 'authorize') {
             // Include the paypal library
             include_once APPPATH . 'libraries/payment/Authorize.php';
             // Create an instance of the authorize.net library
             $myAuthorize = new Authorize();
             // Specify your authorize.net login and secret
             $myAuthorize->setUserInfo($gate_conf['login'], $gate_conf['secret']);
             // Specify the url where authorize.net will send the user on success/failure
             $myAuthorize->addField('x_Receipt_Link_URL', site_url('user/pay_complete'));
             // Specify the url where authorize.net will send the IPN
             $myAuthorize->addField('x_Relay_URL', site_url('payment/ipn/authorize'));
             // Specify the product information
             $myAuthorize->addField('x_Description', $this->startup->site_config['sitename'] . ' ' . $this->lang->line('user_controller_14'));
             $myAuthorize->addField('x_Amount', $group->price);
             $myAuthorize->addField('x_Invoice_num', rand(1, 1000) . '-' . $user->id);
             $myAuthorize->addField('x_Cust_ID', base64_encode(serialize(array('user_id' => $user->id, 'type' => 'reg'))));
             // Enable test mode if needed
             if (defined('XUDEBUG') and XUDEBUG == true) {
                 $myAuthorize->enableTestMode();
             }
             // Let's start the train!
             $data['form'] = $myAuthorize->submitPayment($this->lang->line('user_controller_paypal_submitpayment'));
         } else {
             if ($gate->name = '2co') {
                 // Include the paypal library
                 include_once APPPATH . 'libraries/payment/TwoCo.php';
                 // Create an instance of the authorize.net library
                 $my2CO = new TwoCo();
                 // Specify your 2CheckOut vendor id
                 $my2CO->addField('sid', $gate_conf['vendor_id']);
                 // Specify the order information
                 $my2CO->addField('cart_order_id', rand(1, 1000) . '-' . $user->id);
                 $my2CO->addField('total', $group->price);
                 // Specify the url where authorize.net will send the IPN
                 $my2CO->addField('x_Receipt_Link_URL', site_url('payment/ipn/two_checkout'));
                 $my2CO->addField('tco_currency', $gate_conf['currency']);
                 $my2CO->addField('custom', base64_encode(serialize(array('user_id' => $user->id, 'type' => 'reg'))));
                 // Enable test mode if needed
                 if (defined('XUDEBUG') and XUDEBUG == true) {
                     $my2CO->enableTestMode();
                 }
                 // Let's start the train!
                 $data['form'] = $my2CO->submitPayment($this->lang->line('user_controller_paypal_submitpayment'));
             }
         }
     }
     $this->load->view($this->startup->skin . '/header', array('headerTitle' => $this->lang->line('user_controller_15')));
     $this->load->view($this->startup->skin . '/user/register/pay_new', array('ammount' => $group, 'user' => $id, 'form' => $data['form']));
     $this->load->view($this->startup->skin . '/footer');
 }
开发者ID:KasaiDot,项目名称:XtraUpload,代码行数:99,代码来源:user.php

示例7: 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

示例8: 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

示例9: espresso_display_paypal

function espresso_display_paypal($payment_data)
{
    extract($payment_data);
    global $wpdb;
    include_once 'Paypal.php';
    $myPaypal = new Paypal();
    echo '<!-- Event Espresso PayPal Gateway Version ' . $myPaypal->gateway_version . '-->';
    global $org_options;
    $paypal_settings = get_option('event_espresso_paypal_settings');
    $paypal_id = empty($paypal_settings['paypal_id']) ? '' : $paypal_settings['paypal_id'];
    $paypal_cur = empty($paypal_settings['currency_format']) ? '' : $paypal_settings['currency_format'];
    $no_shipping = isset($paypal_settings['no_shipping']) ? $paypal_settings['no_shipping'] : '0';
    $use_sandbox = $paypal_settings['use_sandbox'];
    if ($use_sandbox) {
        $myPaypal->enableTestMode();
    }
    $myPaypal->addField('business', $paypal_id);
    $myPaypal->addField('return', home_url() . '/?page_id=' . $org_options['return_url'] . '&id=' . $attendee_id);
    $myPaypal->addField('cancel_return', home_url() . '/?page_id=' . $org_options['cancel_return']);
    $myPaypal->addField('notify_url', home_url() . '/?page_id=' . $org_options['notify_url'] . '&id=' . $attendee_id . '&event_id=' . $event_id . '&attendee_action=post_payment&form_action=payment');
    $event_name = $wpdb->get_var('SELECT event_name FROM ' . EVENTS_DETAIL_TABLE . " WHERE id='" . $event_id . "'");
    $myPaypal->addField('cmd', '_cart');
    $myPaypal->addField('upload', '1');
    $i = 1;
    $sql = "SELECT attendee_session FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id='" . $attendee_id . "'";
    $session_id = $wpdb->get_var($sql);
    $sql = "SELECT amount_pd FROM " . EVENTS_ATTENDEE_TABLE . " WHERE attendee_session='" . $session_id . "'";
    $amount_pds = $wpdb->get_col($sql);
    $cost = 0;
    foreach ($amount_pds as $amount_pd) {
        $cost += $amount_pd;
    }
    $myPaypal->addField('item_name_' . $i, $event_name);
    $myPaypal->addField('amount_' . $i, $cost);
    $myPaypal->addField('quantity_' . $i, '1');
    $myPaypal->addField('currency_code', $paypal_cur);
    $myPaypal->addField('image_url', empty($paypal_settings['image_url']) ? '' : $paypal_settings['image_url']);
    $myPaypal->addField('no_shipping ', $no_shipping);
    $myPaypal->addField('first_name', $fname);
    $myPaypal->addField('last_name', $lname);
    $myPaypal->addField('email', $attendee_email);
    $myPaypal->addField('address1', $address);
    $myPaypal->addField('city', $city);
    $myPaypal->addField('state', $state);
    $myPaypal->addField('zip', $zip);
    if (!empty($paypal_settings['bypass_payment_page']) && $paypal_settings['bypass_payment_page'] == 'Y') {
        $myPaypal->submitPayment();
    } else {
        if (empty($paypal_settings['button_url'])) {
            if (file_exists(EVENT_ESPRESSO_GATEWAY_DIR . "/paypal/btn_stdCheckout2.gif")) {
                $button_url = EVENT_ESPRESSO_GATEWAY_DIR . "/paypal/btn_stdCheckout2.gif";
            } else {
                $button_url = EVENT_ESPRESSO_PLUGINFULLURL . "gateways/paypal/btn_stdCheckout2.gif";
            }
        } elseif (file_exists($paypal_settings['button_url'])) {
            $button_url = $paypal_settings['button_url'];
        } else {
            $button_url = EVENT_ESPRESSO_PLUGINFULLURL . "gateways/paypal/btn_stdCheckout2.gif";
        }
        $myPaypal->submitButton($button_url, 'paypal');
    }
    if ($use_sandbox) {
        echo '<h3 style="color:#ff0000;" title="Payments will not be processed">' . __('Paypal Debug Mode Is Turned On', 'event_espresso') . '</h3>';
        $myPaypal->dump_fields();
    }
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:66,代码来源:paypal_vars.php

示例10: paypal_form

 /**
  * Shows the paypal button after new post
  *
  * @param type $type
  * @param type $post_id
  * @param type $pack_id
  * @param type $display
  * @return type
  */
 public function paypal_form($type = 'post', $post_id = 0, $pack_id = 0, $display = false)
 {
     // Include the paypal library
     include_once dirname(__FILE__) . '/lib/payment/Paypal.php';
     //var_dump( $type, $post_id, $pack_id ); exit;
     $email = get_option('wpuf_sub_paypal_mail');
     $curreny = get_option('wpuf_sub_currency');
     $amount = 0;
     if ($type == 'post') {
         $post = get_post($post_id);
         $amount = get_option('wpuf_sub_amount');
         $item_name = $post->post_title;
         $item_number = get_post_meta($post_id, 'wpuf_order_id', true);
         $custom = 'post';
         $cbt = sprintf(__('Click here to complete the pack on %s', 'wpuf'), get_bloginfo('name'));
     }
     if ($type == 'pack') {
         $pack = $this->get_subscription($pack_id);
         if ($pack) {
             $amount = $pack->cost;
             $item_name = $pack->name;
             $item_number = $pack->id;
             $custom = 'pack';
             $cbt = sprintf(__('Click here to complete the pack on %s', 'wpuf'), get_bloginfo('name'));
         }
     }
     // Create an instance of the paypal library
     $myPaypal = new Paypal();
     // Specify your paypal email
     $myPaypal->addField('business', $email);
     // Specify the currency
     $myPaypal->addField('currency_code', $curreny);
     // Specify the url where paypal will send the user on success/failure
     $myPaypal->addField('return', get_bloginfo('home') . '/?action=wpuf_pay_success');
     $myPaypal->addField('cancel_return', get_bloginfo('home'));
     // Specify the url where paypal will send the IPN
     $myPaypal->addField('notify_url', get_bloginfo('home') . '/?action=wpuf_pay_success');
     // Specify the product information
     $myPaypal->addField('item_name', $item_name);
     $myPaypal->addField('amount', $amount);
     $myPaypal->addField('item_number', $item_number);
     // Specify any custom value
     $myPaypal->addField('custom', $custom);
     $myPaypal->addField('cbt', $cbt);
     // Enable test mode if needed
     if (get_option('wpuf_sub_paypal_sandbox') == 'yes') {
         $myPaypal->enableTestMode();
     }
     // Let's start the train!
     $form = $myPaypal->submitPayment();
     return $form;
 }
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:61,代码来源:wpuf-subscription.php

示例11: 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

示例12: submit_to_paypal


//.........这里部分代码省略.........
    foreach ($_SESSION['eStore_cart'] as $item) {
        $rounded_price = round($item['price'], 2);
        $rounded_price = apply_filters('eStore_change_price_before_payment_filter', $rounded_price);
        $myPaypal->addField("item_name_{$count}", htmlspecialchars($item['name']));
        $myPaypal->addField("amount_{$count}", $rounded_price);
        $myPaypal->addField("quantity_{$count}", $item['quantity']);
        $myPaypal->addField("item_number_{$count}", $item['item_number']);
        //Check to see if this is a tax free item and set the tax accordingly so that the profile based PayPal tax can work nicely
        if ($item['tax'] == "0") {
            $myPaypal->addField("tax_{$count}", $item['tax']);
        }
        $id = $item['item_number'];
        $ret_product = $wpdb->get_row("SELECT * FROM {$products_table_name} WHERE id = '{$id}'", OBJECT);
        if (!empty($ret_product->weight)) {
            $weight += $ret_product->weight * $item['quantity'];
        }
        if (empty($item['digital_flag'])) {
            $all_items_digital = false;
        }
        $count++;
    }
    $total_items_in_cart = count($_SESSION['eStore_cart']);
    if ($total_items_in_cart == 1 && !empty($ret_product->return_url)) {
        $myPaypal->addField('return', $ret_product->return_url);
    } else {
        if (!empty($eStore_return_url)) {
            $myPaypal->addField('return', $eStore_return_url);
        }
    }
    if (!get_option('eStore_paypal_profile_shipping')) {
        //Not Using paypal's profile based shipping so include shipping otherwise ignore shipping here as it will be calculated on paypal's site
        $shipping = round($_SESSION['eStore_cart_postage_cost'], 2);
        if (!empty($shipping)) {
            $shipping = apply_filters('eStore_change_shipping_before_payment_filter', $shipping);
            //change tax amount before submitting if converting currency to another type
            $myPaypal->addField('no_shipping', '2');
            $myPaypal->addField('handling_cart', $shipping);
            //$myPaypal->addField('shipping_1', $shipping);
        } else {
            //If you do not want to collect address for checkout that has no shipping cost then uncomment the following line of code.
            //$myPaypal->addField('no_shipping', '1');
        }
    } else {
        //Include the weight for profile based shipping calc
        $myPaypal->addField('weight_cart', round($weight, 2));
        $myPaypal->addField('weight_unit', 'lbs');
        if ($all_items_digital) {
            //All the items in the cart are digital items so set the shipping flag to 0 so no shipping is charged
            $total_items = count($_SESSION['eStore_cart']);
            for ($i = 1; $i <= $total_items; $i++) {
                $myPaypal->addField('shipping_' . $i, '0');
            }
        } else {
            if (isset($_SESSION['eStore_cart_postage_cost']) && $_SESSION['eStore_cart_postage_cost'] == 0) {
                //Free shipping discount applied. send 0 shipping to override profile based shipping
                if (empty($weight)) {
                    //Add $0 shipping override
                    $myPaypal->addField('shipping_1', '0');
                }
            }
        }
    }
    if (!empty($_SESSION['eStore_cart_total_tax'])) {
        $cart_total_tax = round($_SESSION['eStore_cart_total_tax'], 2);
        $cart_total_tax = apply_filters('eStore_change_tax_before_payment_filter', $cart_total_tax);
        //change tax amount before submitting if converting currency to another type
        $myPaypal->addField('tax_cart', $cart_total_tax);
    }
    if (get_option('eStore_display_tx_result')) {
        $myPaypal->addField('rm', '1');
    }
    if (defined('WP_ESTORE_FORCE_LANGUAGE_OF_PAYPAL_PAGE') && WP_ESTORE_FORCE_LANGUAGE_OF_PAYPAL_PAGE !== '0') {
        //Set the country/region preference by force.
        $myPaypal->addField('lc', WP_ESTORE_FORCE_LANGUAGE_OF_PAYPAL_PAGE);
    }
    $myPaypal->addField('cmd', '_cart');
    $myPaypal->addField('upload', '1');
    $custom_field_val = eStore_get_custom_field_value();
    $myPaypal->addField('custom', $custom_field_val);
    $myPaypal->addField('mrb', '3FWGC6LFTMTUG');
    $page_style_name = get_option('eStore_paypal_co_page_style');
    if (!empty($page_style_name)) {
        $myPaypal->addField('page_style', $page_style_name);
    }
    $returnButtonText = get_option('eStore_paypal_return_button_text');
    if (!empty($returnButtonText)) {
        $myPaypal->addField('cbt', $returnButtonText);
    }
    // Enable sandbox mode if needed
    if ($eStore_sandbox_enabled) {
        $myPaypal->enableTestMode();
    }
    // Lets clear the cart if automatic redirection is not being used otherwise we will empty the cart after the redirection
    $PDT_auth_token = get_option('eStore_paypal_pdt_token');
    if (empty($PDT_auth_token)) {
        reset_eStore_cart();
    }
    // submit the payment!
    $myPaypal->submitPayment2(WP_ESTORE_CLICK_HERE);
}
开发者ID:scttrgd,项目名称:scottish-piping,代码行数:101,代码来源:eStore_payment_submission.php


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