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


PHP Paypal::process方法代码示例

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


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

示例1: confirm

 public function confirm()
 {
     access::verify_csrf();
     $form = $this->getCheckoutForm();
     $valid = $form->validate();
     if ($valid) {
         $basket = Session_Basket::get();
         if (!isset($basket->contents) || count($basket->contents) == 0) {
             self::view_basket();
             return;
         }
         /* changed order for nl_NL */
         $basket->title = $form->contact->title->value;
         $basket->initials = $form->contact->initials->value;
         $basket->insertion = $form->contact->insertion->value;
         $basket->name = $form->contact->fullname->value;
         $basket->street = $form->contact->street->value;
         $basket->house = $form->contact->house->value;
         $basket->postcode = $form->contact->postcode->value;
         $basket->town = $form->contact->town->value;
         $basket->suburb = $form->contact->suburb->value;
         $basket->email = $form->contact->email->value;
         $basket->phone = $form->contact->phone->value;
         $basket->childname = $form->contact->childname->value;
         $basket->childgroup = $form->contact->childgroup->value;
         $basket->comments = $form->contact->comments->value;
         $basket->agreeterms = $form->contact->agreeterms->value;
         $paypal = $form->contact->paypal->value == "true";
         $template = new Theme_View("page.html", "basket");
         // NOT USED ===============================
         if ($paypal) {
             // create a prelimary order
             $order = basket::createOrder($basket, Order_Model::PAYMENT_PAYPAL);
             $paypal = new Paypal();
             // create the order first
             $view = new View("paypal_redirect.html");
             $view->form = $paypal->process($basket, url::site("basket/paypal_complete/{$order->id}", "http"), url::site("basket/paypal_cancel/{$order->id}", "http"), url::site("basket/paypal_ipn/{$order->id}", "http"));
             $template->content = $view;
             print $template;
             // redirect to paypal
             // NOT USED END ===============================
         } else {
             $form = new Forge("basket/complete", "", "post", array("id" => "confirm", "name" => "confirm"));
             $view = new View("confirm_order.html");
             $view->basket = $basket;
             $template->content = $view;
             $view->form = $form;
             print $template;
         }
     } else {
         die("Invalid confirmation!");
     }
 }
开发者ID:rledisez,项目名称:gallery3-contrib,代码行数:53,代码来源:basket.php

示例2: complete

 public function complete()
 {
     access::verify_csrf();
     $basket = Session_Basket::get();
     if (!isset($basket->contents) || count($basket->contents) == 0) {
         self::view_basket();
         return;
     }
     $paypal = $basket->paypal;
     if ($paypal) {
         //paypal payment
         $template = new Theme_View("page.html", "basket", "confirm");
         // create a preliminary order
         $order = basket_plus::createOrder($basket, Bp_Order_Model::PAYMENT_PAYPAL);
         bp_order_log::log($order, Bp_Order_Log_Model::ORDERED);
         // send e-mails to customer and internal order handling
         basket_plus::send_order($order);
         // paypal stuff
         $paypal_payment = new Paypal();
         $view = new View("paypal_redirect.html");
         // here the functions to call after paypal processing are defined;
         // function 'process' redirects to the PayPal site (see library Paypal)
         $view->form = $paypal_payment->process($basket, url::site("basket_plus/paypal_complete/{$order->id}", "http"), url::site("basket_plus/paypal_cancel/{$order->id}", "http"), url::site("basket_plus/paypal_ipn/{$order->id}", "http"));
         $template->content = $view;
         print $template;
     } else {
         //offline payment
         // create order
         $order = basket_plus::createOrder($basket, Bp_Order_Model::PAYMENT_OFFLINE);
         bp_order_log::log($order, Bp_Order_Log_Model::ORDERED);
         $basket->clear();
         // send e-mails to customer and internal order handling
         basket_plus::send_order($order);
         // show page Order completed
         $this->_complete($order);
     }
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:37,代码来源:basket_plus.php


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