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


PHP Checkout::get方法代码示例

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


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

示例1: getData

 public function getData(Order $order)
 {
     $data = array();
     $gateway = Checkout::get($order)->getSelectedPaymentMethod();
     //provide valid dummy credit card data
     if ($gateway === "Dummy") {
         $data = array_merge(array('name' => 'Joe Bloggs', 'number' => '4242424242424242', 'cvv' => 123), $data);
     }
     return $data;
 }
开发者ID:NobrainerWeb,项目名称:silverstripe-shop,代码行数:10,代码来源:OnsitePaymentCheckoutComponent.php

示例2: getGateway

 /**
  * @param Order $order
  *
  * @return \Omnipay\Common\AbstractGateway|\Omnipay\Braintree\Gateway
  */
 protected function getGateway($order)
 {
     if (!isset($this->gateway)) {
         $tempPayment = new Payment(['Gateway' => Checkout::get($order)->getSelectedPaymentMethod(false)]);
         $service = PurchaseService::create($tempPayment);
         $this->gateway = $service->oGateway();
         $this->isBraintree = $this->gateway instanceof \Omnipay\Braintree\Gateway;
     }
     return $this->gateway;
 }
开发者ID:markguinn,项目名称:silvershop-braintree,代码行数:15,代码来源:BraintreePaymentCheckoutComponent.php

示例3: submitpayment

 /**
  * Behaviour can be overwritten by creating a processPaymentResponse method
  * on the controller owning this form. It takes a Symfony\Component\HttpFoundation\Response argument,
  * and expects an SS_HTTPResponse in return.
  */
 public function submitpayment($data, $form)
 {
     $data = $form->getData();
     if ($this->getSuccessLink()) {
         $data['returnUrl'] = $this->getSuccessLink();
     }
     $data['cancelUrl'] = $this->getFailureLink() ? $this->getFailureLink() : $this->controller->Link();
     $order = $this->config->getOrder();
     //final recalculation, before making payment
     $order->calculate();
     //handle cases where order total is 0. Note that the order will appear
     //as "paid", but without a Payment record attached.
     if ($order->GrandTotal() == 0 && Order::config()->allow_zero_order_total) {
         if (!$this->orderProcessor->placeOrder()) {
             $form->sessionMessage($this->orderProcessor->getError());
             return $this->controller->redirectBack();
         }
         return $this->controller->redirect($this->getSuccessLink());
     }
     //try to place order before payment, if configured
     if (Order::config()->place_before_payment) {
         if (!$this->orderProcessor->placeOrder()) {
             $form->sessionMessage($this->orderProcessor->getError());
             return $this->controller->redirectBack();
         }
         $data['cancelUrl'] = $this->orderProcessor->getReturnUrl();
     }
     $paymentResponse = $this->orderProcessor->makePayment(Checkout::get($order)->getSelectedPaymentMethod(false), $data);
     $response = null;
     if ($paymentResponse) {
         if ($this->controller->hasMethod('processPaymentResponse')) {
             $response = $this->controller->processPaymentResponse($paymentResponse, $form);
         } else {
             if ($paymentResponse->isRedirect() || $paymentResponse->isSuccessful()) {
                 $response = $paymentResponse->redirect();
             } else {
                 $form->sessionMessage($paymentResponse->getMessage(), 'bad');
                 $response = $this->controller->redirectBack();
             }
         }
     } else {
         $form->sessionMessage($this->orderProcessor->getError(), 'bad');
         $response = $this->controller->redirectBack();
     }
     return $response;
 }
开发者ID:helpfulrobot,项目名称:silvershop-core,代码行数:51,代码来源:PaymentForm.php

示例4: setData

 public function setData(Order $order, array $data)
 {
     if (isset($data['PaymentMethod'])) {
         Checkout::get($order)->setPaymentMethod($data['PaymentMethod']);
     }
 }
开发者ID:burnbright,项目名称:silverstripe-shop,代码行数:6,代码来源:PaymentCheckoutComponent.php

示例5: SelectedPaymentMethod

 public function SelectedPaymentMethod()
 {
     return Checkout::get($this->owner->Cart())->getSelectedPaymentMethod(true);
 }
开发者ID:burnbright,项目名称:silverstripe-shop,代码行数:4,代码来源:CheckoutStep_PaymentMethod.php

示例6: submitpayment

 /**
  * Behaviour can be overwritten by creating a processPaymentResponse method
  * on the controller owning this form. It takes a Symfony\Component\HttpFoundation\Response argument,
  * and expects an SS_HTTPResponse in return.
  */
 public function submitpayment($data, $form)
 {
     $data = $form->getData();
     $cancelUrl = $this->getFailureLink() ? $this->getFailureLink() : $this->controller->Link();
     $order = $this->config->getOrder();
     // final recalculation, before making payment
     $order->calculate();
     // handle cases where order total is 0. Note that the order will appear
     // as "paid", but without a Payment record attached.
     if ($order->GrandTotal() == 0 && Order::config()->allow_zero_order_total) {
         if (!$this->orderProcessor->placeOrder()) {
             $form->sessionMessage($this->orderProcessor->getError());
             return $this->controller->redirectBack();
         }
         return $this->controller->redirect($this->getSuccessLink());
     }
     // try to place order before payment, if configured
     if (Order::config()->place_before_payment) {
         if (!$this->orderProcessor->placeOrder()) {
             $form->sessionMessage($this->orderProcessor->getError());
             return $this->controller->redirectBack();
         }
         $cancelUrl = $this->orderProcessor->getReturnUrl();
     }
     // if we got here from checkoutSubmit and there's a namespaced OnsitePaymentCheckoutComponent
     // in there, we need to strip the inputs down to only the checkout component.
     $components = $this->config->getComponents();
     if ($components->first() instanceof CheckoutComponent_Namespaced) {
         foreach ($components as $component) {
             if ($component->Proxy() instanceof OnsitePaymentCheckoutComponent) {
                 $data = array_merge($data, $component->unnamespaceData($data));
             }
         }
     }
     // This is where the payment is actually attempted
     $paymentResponse = $this->orderProcessor->makePayment(Checkout::get($order)->getSelectedPaymentMethod(false), $data, $this->getSuccessLink(), $cancelUrl);
     $response = null;
     if ($this->controller->hasMethod('processPaymentResponse')) {
         $response = $this->controller->processPaymentResponse($paymentResponse, $form);
     } else {
         if ($paymentResponse && !$paymentResponse->isError()) {
             $response = $paymentResponse->redirectOrRespond();
         } else {
             $form->sessionMessage($this->orderProcessor->getError(), 'bad');
             $response = $this->controller->redirectBack();
         }
     }
     return $response;
 }
开发者ID:burnbright,项目名称:silverstripe-shop,代码行数:54,代码来源:PaymentForm.php

示例7: testSummary

 public function testSummary()
 {
     $this->checkout->summary();
     $form = $this->checkout->ConfirmationForm();
     $data = array('Notes' => 'Leave it around the back', 'ReadTermsAndConditions' => 1);
     $member = $this->objFromFixture("Member", "joebloggs");
     $member->logIn();
     //log in member before processing
     Checkout::get($this->cart)->setPaymentMethod("Dummy");
     //a selected payment method is required
     $form->loadDataFrom($data);
     $this->assertTrue($form->validate(), "Checkout data is valid");
     $response = $this->post('/checkout/ConfirmationForm', $data);
     $this->assertEquals('Cart', $this->cart->Status, "Order is still in cart");
     $order = Order::get()->byID($this->cart->ID);
     $this->assertEquals("Leave it around the back", $order->Notes);
     //redirect to make payment
     $this->assertEquals(302, $response->getStatusCode());
     $this->assertEquals(Director::baseURL() . "checkout/payment", $response->getHeader('Location'));
 }
开发者ID:renskorswagen,项目名称:silverstripe-shop,代码行数:20,代码来源:SteppedCheckoutTest.php

示例8: Checkout

*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Checkout a guest
* 
* calendar
* 
* @since 2004-01-22
* @author Christian Ehret <chris@ehret.name> 
*/
$smartyType = "www";
include_once "../includes/default.inc.php";
$auth->is_authenticated();
include_once 'checkoutclass.inc.php';
if ($request->GetVar('list', 'get') == 'true') {
    $smarty->assign("tpl_title", "Anwesenheitsliste");
    $smarty->assign('tpl_nav', 'lists');
    $smarty->assign('tpl_subnav', 'checkout');
    $smarty->assign('tpl_checkout', 'false');
} else {
    $smarty->assign("tpl_title", "Checkout");
    $smarty->assign('tpl_nav', 'calendar');
    $smarty->assign('tpl_subnav', 'checkout');
    $smarty->assign('tpl_checkout', 'true');
}
$checkout = new Checkout();
$smarty->assign('tpl_guests', $checkout->get());
$smarty->display('checkoutlist.tpl');
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:31,代码来源:checkoutlist.php


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