Ejemplo n.º 1
0
 public function checkoutSubmit($data, $form)
 {
     // form validation has passed by this point, so we can save data
     $this->config->setData($form->getData());
     $order = $this->config->getOrder();
     $gateway = Checkout::get($order)->getSelectedPaymentMethod(false);
     if (GatewayInfo::isOffsite($gateway) || GatewayInfo::isManual($gateway) || $this->config->getComponentByType('OnsitePaymentCheckoutComponent')) {
         return $this->submitpayment($data, $form);
     }
     return $this->controller->redirect($this->controller->Link('payment'));
 }
 public function php($data)
 {
     // Check if we should do a payment
     if (Form::current_action() == 'dopayment' && !empty($data['PaymentMethod'])) {
         $gateway = $data['PaymentMethod'];
         // If the gateway isn't manual and not offsite, Check for credit-card fields!
         if (!GatewayInfo::isManual($gateway) && !GatewayInfo::isOffsite($gateway)) {
             // Merge the required fields and the Credit-Card fields that are required for the gateway
             $this->required = array_merge($this->required, array_intersect(array('type', 'name', 'number', 'startMonth', 'startYear', 'expiryMonth', 'expiryYear', 'cvv', 'issueNumber'), GatewayInfo::requiredFields($gateway)));
         }
     }
     return parent::php($data);
 }