/**
  * Given a paymillTransaction response, as an array, prform desired operations
  *
  * @param array             $autWS
  * @param PagosonlineMethod $paymentMethod Payment method
  *
  * @return PagosonlineManager Self object
  *
  * @throws PaymentException
  */
 private function processTransaction($autWS, PagosonlineMethod $paymentMethod)
 {
     /**
      * Payment paid done
      *
      * Paid process has ended ( No matters result )
      */
     $this->paymentEventDispatcher->notifyPaymentOrderDone($this->paymentBridge, $paymentMethod);
     $this->logger->addInfo($paymentMethod->getPaymentName() . 'processTransaction', get_object_vars($autWS));
     /**
      * if pagosonline return code 15 o 9994 the order status is pending
      */
     if (in_array($autWS->codigoRespuesta, array('15', '9994'))) {
         //payment is still pending nothing to do
     } elseif ($autWS->codigoRespuesta == 1) {
         $this->paymentEventDispatcher->notifyPaymentOrderSuccess($this->paymentBridge, $paymentMethod);
     } else {
         $this->paymentEventDispatcher->notifyPaymentOrderFail($this->paymentBridge, $paymentMethod);
         throw new PaymentException();
     }
     /**
      * Log the response of gateway
      */
     return $this;
 }
 public function checkTransactionStatus($transactionId)
 {
     //All information of transaction response
     $statusTransactionWS = $this->pagosonlineComm->consultarEstadoTransaccion($this->accountId, $transactionId);
     $paymentMethod = new PagosonlineGatewayMethod();
     $paymentMethod->setPagosonlineGatewayTransactionId($statusTransactionWS->transaccionId);
     $paymentMethod->setStatus($statusTransactionWS->estadoId);
     $paymentMethod->setReference($statusTransactionWS->referencia);
     $paymentMethod->setAmount($statusTransactionWS->valor);
     $this->logger->addInfo($paymentMethod->getPaymentName() . 'processTransactionCheck', get_object_vars($statusTransactionWS));
     /**
      * if pagosonline return code 15 o 9994 the order status is pending
      */
     $this->paymentEventDispatcher->notifyPaymentOrderLoad($this->paymentBridge, $paymentMethod);
     if ($statusTransactionWS->codigoRespuesta == 1) {
         $this->paymentEventDispatcher->notifyPaymentOrderSuccess($this->paymentBridge, $paymentMethod);
     } elseif (!in_array($statusTransactionWS->codigoRespuesta, array(15, 9994))) {
         //status 15 or 9994 payment is still in pending nothing to do
         $this->paymentEventDispatcher->notifyPaymentOrderFail($this->paymentBridge, $paymentMethod);
     }
 }
Example #3
0
 /**
  * Given a Dineromail response, as a SimpleXMLElement, perform desired operations
  *
  * @param  SimpleXMLElement  $xml Dineromail response
  * @return DineromailManager Self object
  */
 public function processTransaction($xml)
 {
     $paymentMethod = new DineromailMethod();
     $this->logger->addInfo($paymentMethod->getPaymentName() . 'processTransaction: ' . $xml->asXML());
     switch ($status = $xml->ESTADO) {
         case self::STATUS_PENDING:
             break;
         case self::STATUS_ACCEPTED:
         case self::STATUS_DENIED:
             $paymentMethod->setDineromailTransactionId($xml->ID);
             $paymentMethod->setAmount($xml->MONTO);
             $this->paymentEventDispatcher->notifyPaymentOrderLoad($this->paymentBridge, $paymentMethod);
             break;
         default:
     }
     if ($status == self::STATUS_ACCEPTED) {
         $this->paymentEventDispatcher->notifyPaymentOrderSuccess($this->paymentBridge, $paymentMethod);
     }
     if ($status == self::STATUS_DENIED) {
         $this->paymentEventDispatcher->notifyPaymentOrderFail($this->paymentBridge, $paymentMethod);
     }
     return $this;
 }
 /**
  *
  * @param $result \soap response
  * @param DineromailApiMethod $paymentMethod Payment method
  *
  * @throws \PaymentSuite\PaymentCoreBundle\Exception\PaymentException
  * @return DineromailApiMethod                                        Self object
  *
  */
 private function processTransaction($result, DineromailApiMethod $paymentMethod)
 {
     $this->logger->addInfo($paymentMethod->getPaymentName() . 'processTransaction Result', get_object_vars($result));
     $paymentMethod->setDineromailApiReference($result->MerchantTransactionId);
     $paymentMethod->setDineromailApiTransactionId($result->TransactionId);
     /**
      * Payment paid done
      *
      * Paid process has ended ( No matters result )
      */
     $this->paymentEventDispatcher->notifyPaymentOrderDone($this->paymentBridge, $paymentMethod);
     switch ($result->Status) {
         case 'OK':
         case 'COMPLETED':
             $this->paymentEventDispatcher->notifyPaymentOrderSuccess($this->paymentBridge, $paymentMethod);
             break;
         case 'PENDING':
             break;
         default:
             $this->paymentEventDispatcher->notifyPaymentOrderFail($this->paymentBridge, $paymentMethod);
             throw new PaymentException();
     }
     return $this;
 }