Esempio n. 1
0
 private function newTransaction(PaymentSources &$paymentSource, $params = array())
 {
     if ($paymentSource->hasPaymentProcessor()) {
         $processor = PaymentProcessors::findFirstById($paymentSource->payment_processor_id);
     } else {
         $processor = PaymentProcessors::findFirst();
     }
     if (!$processor) {
         throw new \Phalcon\Exception('You do not have any payment processors.');
     }
     $transaction = $processor->createTransaction($params);
     $transaction->payment_source_id = $paymentSource->id;
     return $transaction;
 }