public function getInputErrors(array $data)
 {
     $errors = parent::getInputErrors($data);
     if (empty($data['securesubmit_token'])) {
         $errors[] = \XLite\Core\Translation::lbl('Payment processed with errors. Please, try again or ask administrator');
     }
     return $errors;
 }
Exemplo n.º 2
0
 public function getInputErrors(array $data)
 {
     $errors = parent::getInputErrors($data);
     error_log(print_r($data, true));
     if (!isset($data['securesubmit_use_stored_card']) && empty($data['securesubmit_token']) || empty($data['securesubmit_token']) && $data['securesubmit_use_stored_card'] === 'new') {
         $errors[] = \XLite\Core\Translation::lbl('Payment processed with errors. Please, try again or ask administrator');
     }
     return $errors;
 }
Exemplo n.º 3
0
 /**
  * Process callback
  *
  * @param \XLite\Model\Payment\Transaction $transaction Callback-owner transaction
  *
  * @return void
  */
 public function processCallback(\XLite\Model\Payment\Transaction $transaction)
 {
     parent::processCallback($transaction);
     $this->includeStripeLibrary();
     try {
         $event = \Stripe_Event::retrieve($this->eventId);
         if ($event) {
             $name = 'processEvent' . \XLite\Core\Converter::convertToCamelCase(str_replace('.', '_', $event->type));
             if (method_exists($this, $name)) {
                 // $name assembled from 'processEvent' + event type
                 $this->{$name}($event);
                 \XLite\Core\Database::getEM()->flush();
             }
             \XLite\Logger::getInstance()->logCustom('stripe', 'Event handled: ' . $event->type . ' # ' . $this->eventId . PHP_EOL . 'Processed: ' . (method_exists($this, $name) ? 'Yes' : 'No'));
         }
     } catch (\Exception $e) {
     }
 }