コード例 #1
0
 private function savePaymentData(OrderInterface $order)
 {
     $payment = $this->getPaymentFromOrder($order);
     $result = $this->pluginController->approveAndDeposit($payment->getId(), $this->request->getPrice());
     if (Result::STATUS_PENDING === $result->getStatus()) {
         $this->logger->info('Payment for order is pending', array('orderId' => $order->getId(), 'requestId' => $this->request->getId()));
         throw $result->getPluginException();
     } elseif (Result::STATUS_SUCCESS !== $result->getStatus()) {
         throw new PaymentException();
     }
 }
コード例 #2
0
 /**
  * Processes the payment
  *
  * @param PaymentInstruction $instruction the PaymentInstruction to handle
  * @param array              $data        the decrypted response data
  *
  * @return Result
  */
 public function handle($instruction, $data)
 {
     if (null === ($pendingTransaction = $instruction->getPendingTransaction())) {
         $payment = $this->pluginController->createPayment($instruction->getId(), $instruction->getAmount() - $instruction->getDepositedAmount());
     } else {
         $payment = $pendingTransaction->getPayment();
     }
     foreach ($data as $key => $val) {
         $instruction->getExtendedData()->set($key, $val);
     }
     $result = $this->pluginController->approveAndDeposit($payment->getId(), $payment->getTargetAmount());
     return $result;
 }