Exemple #1
0
 /**
  * Get payment response.
  *
  * @param array $responseData Response data from bank
  * @param bool  $success      Signature validated?
  *
  * @return \RKD\Banklink\Response\PaymentResponse
  */
 protected function handlePaymentResponse(array $responseData, $success)
 {
     $status = PaymentResponse::STATUS_ERROR;
     if ($success && $responseData['respcode'] === self::PAYMENT_RESPONSE_SUCCESS) {
         $status = PaymentResponse::STATUS_SUCCESS;
     }
     $response = new PaymentResponse($status, $responseData);
     $response->setOrderId($responseData['ecuno']);
     if (PaymentResponse::STATUS_SUCCESS === $status) {
         $response->setSum(round($responseData['eamount'] / 100, 2));
         $response->setCurrency($responseData['cur']);
         $response->setTransactionId($responseData['receipt_no']);
         $datetime = new \Datetime($responseData['datetime']);
         $response->setTransactionDate($datetime->format('Y-m-d\\TH:i:s'));
     }
     return $response;
 }
Exemple #2
0
 /**
  * Get payment response.
  *
  * @param array $responseData Response data from bank
  * @param bool  $success      Signature validated?
  *
  * @return \RKD\Banklink\Response\PaymentResponse
  */
 protected function handlePaymentResponse(array $responseData, $success)
 {
     $status = PaymentResponse::STATUS_ERROR;
     if ($success && $responseData['VK_SERVICE'] === Services::PAYMENT_RESPONSE_SUCCESS) {
         $status = PaymentResponse::STATUS_SUCCESS;
     }
     $response = new PaymentResponse($status, $responseData);
     $response->setOrderId($responseData['VK_STAMP']);
     if (isset($responseData['VK_LANG'])) {
         $response->setLanguage($responseData['VK_LANG']);
     }
     if (PaymentResponse::STATUS_SUCCESS === $status) {
         $response->setSum($responseData['VK_AMOUNT']);
         $response->setCurrency($responseData['VK_CURR']);
         $response->setSender($responseData['VK_SND_NAME'], $responseData['VK_SND_ACC']);
         $response->setReceiver($responseData['VK_REC_NAME'], $responseData['VK_REC_ACC']);
         $response->setTransactionId($responseData['VK_T_NO']);
         $response->setTransactionDate($responseData['VK_T_DATETIME']);
     }
     return $response;
 }