public function GatewayForm()
    {
        // If no estimate found, generate error
        if (!$this->hasEstimate()) {
            return $this->redirect($this->Link("noestimate"));
        }

        $actions = FieldList::create();

        try {
            // Get available payment methods and setup payment
            $payment_methods = GatewayInfo::getSupportedGateways();
            $reverse = array_reverse($payment_methods);
            $gateway = $this->getPaymentMethod();

            $payment_field = OptionsetField::create(
                'PaymentMethodID',
                _t('SilverCommerce\Checkout.PaymentSelection', 'Please choose how you would like to pay'),
                $payment_methods
            )->setValue($gateway);

            $actions
                ->add(FormAction::create(
                    'doUpdatePayment',
                    _t('SilverCommerce\Checkout.ChangeGateway', 'Change Payment Type')
                )->addExtraClass('checkout-action-next'));
        } catch (Exception $e) {
            $payment_field = ReadonlyField::create(
                "PaymentMethodID",
                _t('SilverCommerce\Checkout.PaymentSelection', 'Please choose how you would like to pay'),
                $e->getMessage()
            );
        } 

        $form = Form::create(
            $this,
            "GatewayForm",
            FieldList::create($payment_field),
            $actions,
            RequiredFields::create(array(
                "PaymentMethodID"
            ))
        );

        $this->extend("updateGatewayForm", $form);

        return $form;
    }
public function GatewayForm()
    {
        // If no estimate found, generate error
        if (!$this->hasEstimate()) {
            return $this->redirect($this->Link("noestimate"));
        }

        $actions = FieldList::create();

        try {
            // Get available payment methods and setup payment
            $payment_methods = GatewayInfo::getSupportedGateways();
            $reverse = array_reverse($payment_methods);
            $gateway = $this->getPaymentMethod();

            $payment_field = OptionsetField::create(
                'PaymentMethodID',
                _t('SilverCommerce\Checkout.PaymentSelection', 'Please choose how you would like to pay'),
                $payment_methods
            )->setValue($gateway);

            $actions
                ->add(FormAction::create(
                    'doUpdatePayment',
                    _t('SilverCommerce\Checkout.ChangeGateway', 'Change Payment Type')
                )->addExtraClass('checkout-action-next'));
        } catch (Exception $e) {
            $payment_field = ReadonlyField::create(
                "PaymentMethodID",
                _t('SilverCommerce\Checkout.PaymentSelection', 'Please choose how you would like to pay'),
                $e->getMessage()
            );
        } 

        $form = Form::create(
            $this,
            "GatewayForm",
            FieldList::create($payment_field),
            $actions,
            RequiredFields::create(array(
                "PaymentMethodID"
            ))
        );

        $this->extend("updateGatewayForm", $form);

        return $form;
    }
public function GatewayForm ( ) { // If no estimate found, generate error if ( ! $ this -> hasEstimate ( ) ) { return $ this -> redirect ( $ this -> Link ( "noestimate" ) ) ; } $ actions = FieldList :: create ( ) ; try { // Get available payment methods and setup payment $ payment_methods = GatewayInfo :: getSupportedGateways ( ) ; $ reverse = array_reverse ( $ payment_methods ) ; $ gateway = $ this -> getPaymentMethod ( ) ; $ payment_field = OptionsetField :: create ( 'PaymentMethodID' , _t ( 'SilverCommerce\Checkout.PaymentSelection' , 'Please choose how you would like to pay' ) , $ payment_methods ) -> setValue ( $ gateway ) ; $ actions -> add ( FormAction :: create ( 'doUpdatePayment' , _t ( 'SilverCommerce\Checkout.ChangeGateway' , 'Change Payment Type' ) ) -> addExtraClass ( 'checkout-action-next' ) ) ; } catch ( Exception $ e ) { $ payment_field = ReadonlyField :: create ( "PaymentMethodID" , _t ( 'SilverCommerce\Checkout.PaymentSelection' , 'Please choose how you would like to pay' ) , $ e -> getMessage ( ) ) ; } $ form = Form :: create ( $ this , "GatewayForm" , FieldList :: create ( $ payment_field ) , $ actions , RequiredFields :: create ( array ( "PaymentMethodID" ) ) ) ; $ this -> extend ( "updateGatewayForm" , $ form ) ; return $ form ; }
Generate a gateway form to select available gateways

@return Form
Generate a gateway form to select available gateways