示例#1
0
 /**
  * @param Response\ReturnTransaction $response
  */
 public function returnTransactionResponse(Response\ReturnTransaction $response)
 {
     $response->setSuccess($response->getApiResponse('FinalStatus') === 'success');
     if ($response->getSuccess()) {
         $response->setReferenceNumber($response->getApiResponse('orderID'));
     }
     $response->getTransaction()->setApiResponse($response->getApiResponse());
 }
示例#2
0
 /**
  * @param Helper\Transaction $transaction
  * @param callable $success
  * @param callable $failure
  *
  * @throws \Exception
  * @return Response\ReturnTransaction
  */
 public final function returnTransaction(Helper\Transaction $transaction, callable $success, callable $failure)
 {
     $this->apiCheck(__FUNCTION__);
     try {
         $this->parentTransactionCheck($transaction);
     } catch (\Exception $e) {
         $transaction->setStatus(Enum\Status::INCOMPLETE);
         $transaction->setApiResponse(json_encode(['message' => $e->getMessage()]));
         throw $e;
     }
     $response = new Response\ReturnTransaction($this->getApi());
     $response->setTransaction($transaction);
     $this->execute($response, __FUNCTION__, $success, $failure);
     return $response;
 }