public function createPayment($gateway)
    {
        if (!GatewayInfo::isSupported($gateway)) {
            $this->error(
                _t(
                    __CLASS__ . ".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(Security::getCurrentUser())) {
            $this->error(_t(__CLASS__ . ".CantPay", "Order can't be paid for."));
            return false;
        }
        $payment = Payment::create()->init(
            $gateway,
            $this->order->TotalOutstanding(true),
            ShopConfigExtension::config()->base_currency
        );
        $this->order->Payments()->add($payment);
        return $payment;
    }
public function createPayment($gateway)
    {
        if (!GatewayInfo::isSupported($gateway)) {
            $this->error(
                _t(
                    __CLASS__ . ".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(Security::getCurrentUser())) {
            $this->error(_t(__CLASS__ . ".CantPay", "Order can't be paid for."));
            return false;
        }
        $payment = Payment::create()->init(
            $gateway,
            $this->order->TotalOutstanding(true),
            ShopConfigExtension::config()->base_currency
        );
        $this->order->Payments()->add($payment);
        return $payment;
    }
public function createPayment ( $ gateway ) { if ( ! GatewayInfo :: isSupported ( $ gateway ) ) { $ this -> error ( _t ( __CLASS__ . ".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 ( Security :: getCurrentUser ( ) ) ) { $ this -> error ( _t ( __CLASS__ . ".CantPay" , "Order can't be paid for." ) ) ; return false ; } $ payment = Payment :: create ( ) -> init ( $ gateway , $ this -> order -> TotalOutstanding ( true ) , ShopConfigExtension :: config ( ) -> base_currency ) ; $ this -> order -> Payments ( ) -> add ( $ payment ) ; return $ payment ; }
Create a new payment for an order
Create a new payment for an order