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


PHP Order::canPay方法代码示例

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


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

示例1: __construct

 public function __construct($controller, $name, Order $order)
 {
     $this->order = $order;
     $fields = FieldList::create(HiddenField::create('OrderID', '', $order->ID));
     $actions = FieldList::create();
     //payment
     if (self::config()->allow_paying && $order->canPay()) {
         $gateways = GatewayInfo::get_supported_gateways();
         //remove manual gateways
         foreach ($gateways as $gateway => $gatewayname) {
             if (GatewayInfo::is_manual($gateway)) {
                 unset($gateways[$gateway]);
             }
         }
         if (!empty($gateways)) {
             $fields->push(HeaderField::create("MakePaymentHeader", _t("OrderActionsForm.MAKEPAYMENT", "Make Payment")));
             $outstandingfield = Currency::create();
             $outstandingfield->setValue($order->TotalOutstanding());
             $fields->push(LiteralField::create("Outstanding", sprintf(_t("OrderActionsForm.OUTSTANDING", "Outstanding: %s"), $outstandingfield->Nice())));
             $fields->push(OptionsetField::create('PaymentMethod', _t("OrderActionsForm.PAYMENTMETHOD", "Payment Method"), $gateways, key($gateways)));
             $actions->push(FormAction::create('dopayment', _t('OrderActionsForm.PAYORDER', 'Pay outstanding balance')));
         }
     }
     //cancelling
     if (self::config()->allow_cancelling && $order->canCancel()) {
         $actions->push(FormAction::create('docancel', _t('OrderActionsForm.CANCELORDER', 'Cancel this order')));
     }
     parent::__construct($controller, $name, $fields, $actions);
     $this->extend("updateForm", $order);
 }
开发者ID:NobrainerWeb,项目名称:silverstripe-shop,代码行数:30,代码来源:OrderActionsForm.php

示例2: createPayment

 /**
  * Create a new payment for an order
  */
 public function createPayment($gateway)
 {
     if (!GatewayInfo::isSupported($gateway)) {
         $this->error(_t("PaymentProcessor.InvalidGateway", "`{gateway}` isn't a valid payment gateway.", 'gateway is the name of the payment gateway', array('gateway' => $gateway)));
         return false;
     }
     if (!$this->order->canPay(Member::currentUser())) {
         $this->error(_t("PaymentProcessor.CantPay", "Order can't be paid for."));
         return false;
     }
     $payment = Payment::create()->init($gateway, $this->order->TotalOutstanding(true), ShopConfig::get_base_currency());
     $this->order->Payments()->add($payment);
     return $payment;
 }
开发者ID:burnbright,项目名称:silverstripe-shop,代码行数:17,代码来源:OrderProcessor.php

示例3: createPayment

 /**
  * Create a new payment for an order
  */
 public function createPayment($gateway)
 {
     if (!GatewayInfo::is_supported($gateway)) {
         $this->error(_t("PaymentProcessor.INVALIDGATEWAY", "`{$gateway}` isn't a valid payment gateway."));
         return false;
     }
     if (!$this->order->canPay(Member::currentUser())) {
         $this->error(_t("PaymentProcessor.CANTPAY", "Order can't be paid for."));
         return false;
     }
     $payment = Payment::create()->init($gateway, $this->order->TotalOutstanding(), ShopConfig::get_base_currency());
     $this->order->Payments()->add($payment);
     return $payment;
 }
开发者ID:helpfulrobot,项目名称:silvershop-core,代码行数:17,代码来源:OrderProcessor.php

示例4: PaymentForm

 /**
  * @return Form (OrderForm_Payment) | Array
  **/
 function PaymentForm()
 {
     if ($this->currentOrder) {
         if ($this->currentOrder->canPay()) {
             Requirements::javascript("ecommerce/javascript/EcomPayment.js");
             return OrderForm_Payment::create($this, 'PaymentForm', $this->currentOrder, $this->Link("thankyou"));
         } else {
             $this->errorMessage = _t("EcommercePaymentController.CANNOTMAKEPAYMENT", "You can not make a payment for this order.");
         }
     } else {
         $this->errorMessage = _t("EcommercePaymentController.ORDERCANNOTBEFOUND", "Order can not be found.");
     }
     return array();
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:17,代码来源:EcommercePaymentController.php

示例5: __construct

 public function __construct($controller, $name, Order $order)
 {
     $this->order = $order;
     $fields = FieldList::create(HiddenField::create('OrderID', '', $order->ID));
     $actions = FieldList::create();
     //payment
     if (self::config()->allow_paying && $order->canPay()) {
         $gateways = GatewayInfo::getSupportedGateways();
         //remove manual gateways
         foreach ($gateways as $gateway => $gatewayname) {
             if (GatewayInfo::isManual($gateway)) {
                 unset($gateways[$gateway]);
             }
         }
         if (!empty($gateways)) {
             $fields->push(HeaderField::create("MakePaymentHeader", _t("OrderActionsForm.MakePayment", "Make Payment")));
             $outstandingfield = Currency::create();
             $outstandingfield->setValue($order->TotalOutstanding(true));
             $fields->push(LiteralField::create("Outstanding", _t('Order.OutstandingWithAmount', 'Outstanding: {Amount}', '', array('Amount' => $outstandingfield->Nice()))));
             $fields->push(OptionsetField::create('PaymentMethod', _t("OrderActionsForm.PaymentMethod", "Payment Method"), $gateways, key($gateways)));
             if ($ccFields = $this->getCCFields($gateways)) {
                 if ($this->config()->include_jquery) {
                     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.min.js');
                 }
                 Requirements::javascript(SHOP_DIR . '/javascript/OrderActionsForm.js');
                 $fields->push($ccFields);
             }
             $actions->push(FormAction::create('dopayment', _t('OrderActionsForm.PayOrder', 'Pay outstanding balance')));
         }
     }
     //cancelling
     if (self::config()->allow_cancelling && $order->canCancel()) {
         $actions->push(FormAction::create('docancel', _t('OrderActionsForm.CancelOrder', 'Cancel this order')));
     }
     parent::__construct($controller, $name, $fields, $actions, OrderActionsForm_Validator::create(array('PaymentMethod')));
     $this->extend("updateForm", $order);
 }
开发者ID:burnbright,项目名称:silverstripe-shop,代码行数:37,代码来源:OrderActionsForm.php


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