public function __construct(SoapAbstractRequest $request, $data)
 {
     parent::__construct($request, $data);
     // Convert the SOAP Response (stdClass containing a stdClass) to an array.
     $responseName = $request->responseName;
     $this->data = json_decode(json_encode($data->{$responseName}), true);
 }
 public function __construct(RequestInterface $request, $data)
 {
     if (!is_array($data)) {
         parse_str($data, $data);
     }
     parent::__construct($request, $data);
 }
예제 #3
0
 public function redirect()
 {
     if (!headers_sent()) {
         header('Content-Type: text/html; charset=UTF-8');
     }
     return parent::redirect();
 }
 /**
  * {@inheritDoc}
  *
  * @throws InvalidResponseException If error status is missing
  */
 public function __construct(RequestInterface $request, $data)
 {
     parent::__construct($request, $data);
     if (!isset($data['errorstatus']) || '' === $data['errorstatus']) {
         throw new InvalidResponseException('Invalid response from payment gateway');
     }
 }
 public function __construct(RequestInterface $request, $response)
 {
     $body = $response->getBody(true);
     if (0 === strpos($body, 'OK:RESULT=0')) {
         $this->successful = true;
     }
     parent::__construct($request, $body);
 }
 /**
  * {@inheritdoc}
  */
 public function __construct(RequestInterface $request, $data)
 {
     parent::__construct($request, $data);
     if (isset($this->data->error)) {
         $this->code = (string) $this->data->error->code;
         $this->data = (string) $this->data->error->message;
     }
 }
예제 #7
0
 /**
  * {@inheritdoc}
  */
 public function __construct(RequestInterface $request, $data)
 {
     parent::__construct($request, $data);
     if (false !== preg_match('/^([A-Z0-9]{6})(.*)$/', $this->data, $matches)) {
         $this->code = trim($matches[1]);
         $this->data = trim($matches[2]);
     }
 }
예제 #8
0
 public function __construct(RequestInterface $request, $data)
 {
     $responseDom = new DOMDocument();
     $responseDom->loadXML((string) $data);
     $returnData = simplexml_import_dom($responseDom->documentElement->firstChild->firstChild);
     $returnNodeName = preg_replace('/Response$/', 'Return', $returnData->getName());
     parse_str(str_replace('?', '', (string) $returnData->{$returnNodeName}), $parsed);
     parent::__construct($request, $parsed);
 }
 /**
  * @param  Omnipay\Common\Message\RequestInterface $request
  * @param  array $data
  * @param  stdClass $responseError
  * @return void
  */
 public function __construct(RequestInterface $request, $data, $responseError)
 {
     parent::__construct($request, $data);
     $this->request = $request;
     $this->responseError = $responseError;
     if (isset($data['objPmNotify']['action'])) {
         $this->action = $data['objPmNotify']['action'];
     }
 }
 public function __construct(RequestInterface $request, $data)
 {
     parent::__construct($request, $data);
     if ($this->getResult() !== 'VERIFIED') {
         throw new InvalidResponseException('Not verified');
     }
     if ($this->request->getTestMode() !== $this->getTestMode()) {
         throw new InvalidResponseException('Invalid test mode');
     }
 }
 public function __construct(RequestInterface $request, $data)
 {
     parent::__construct($request, $data);
     $requestParams = $request->getParameters();
     $secureKey = $requestParams['secureKey'];
     $hashedSignature = GopayHelper::hash(GopayHelper::concatPaymentStatus($data, $secureKey));
     $decryptedHash = GopayHelper::decrypt($data->encryptedSignature, $secureKey);
     if ($decryptedHash != $hashedSignature) {
         throw new InvalidResponseException("Invalid response signature");
     }
 }
 public function __construct(RequestInterface $request, $data)
 {
     parent::__construct($request, $data);
     $transactions = array();
     if ($this->isSuccessful()) {
         foreach ($this->getData()['transactions']['transaction'] as $transaction) {
             $transactions[] = $this->xml2array($transaction);
         }
     }
     $this->data['transactions'] = $transactions;
 }
 /**
  * {@inheritdoc}
  */
 public function __construct(RequestInterface $request, $data)
 {
     parent::__construct($request, $data);
     $signKey = $this->request->getTestMode() ? $this->request->getTestKey() : $this->request->getSignKey();
     $signExpected = $this->request->calculateSign($this->data, $signKey);
     if ($this->getSign() !== $signExpected) {
         throw new InvalidResponseException('Failed to validate signature: ' . $signExpected);
     }
     if ($this->getState() !== 'success') {
         throw new InvalidResponseException('The payment was not success');
     }
 }
 public function __construct(RequestInterface $request, $data)
 {
     $parsedData = [];
     $responseArr = explode('|', (string) $data);
     foreach ($responseArr as $pair) {
         if (strlen(trim($pair)) == 0) {
             continue;
         }
         $tmp = explode('~', $pair);
         $parsedData[$tmp[0]] = $tmp[1];
     }
     parent::__construct($request, $parsedData);
 }
예제 #15
0
 public function __construct(AbstractRequest $request, $data)
 {
     // Strip out the xmlns junk so that PHP can parse the XML
     $xml = preg_replace('/<createTransactionResponse[^>]+>/', '<createTransactionResponse>', (string) $data);
     try {
         $xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOWARNING);
     } catch (\Exception $e) {
         throw new InvalidResponseException();
     }
     if (!$xml) {
         throw new InvalidResponseException();
     }
     parent::__construct($request, $xml);
 }
 public function __construct(RequestInterface $request, $dataStr)
 {
     // Parse string into parameters
     parse_str($dataStr, $data);
     if (!isset($data['pesapal_response_data'])) {
         $status = 'ERROR';
         $message = (string) $dataStr;
     } else {
         $status = $data['pesapal_response_data'];
         if (strpos($status, ',') !== false) {
             list($transaction_reference, $payment_method, $status, $transaction_id) = str_getcsv($status);
         }
     }
     $data = compact('status', 'transaction_id', 'payment_method', 'transaction_reference', 'message');
     parent::__construct($request, $data);
 }
 public function __construct(RequestInterface $request, $response)
 {
     $body = $response->getBody(true);
     if (0 === strpos($body, 'OK:')) {
         $response->setBody(substr($body, 3));
         $data = $response->xml();
         $result = (string) $data->attributes()->RESULT;
         if ('0' == $result) {
             $this->successful = true;
         }
     }
     if (!$this->successful) {
         $data = $body;
     }
     parent::__construct($request, $data);
 }
예제 #18
0
 public function __construct(RequestInterface $request, $data)
 {
     // Check if this is an error response
     $isError = strpos((string) $data, '<ErrorResponse');
     $xmlRootElement = $isError !== false ? 'ErrorResponse' : $this->responseType;
     // Strip out the xmlns junk so that PHP can parse the XML
     $xml = preg_replace('/<' . $xmlRootElement . '[^>]+>/', '<' . $xmlRootElement . '>', (string) $data);
     try {
         $xml = simplexml_load_string($xml);
     } catch (\Exception $e) {
         throw new InvalidResponseException();
     }
     if (!$xml) {
         throw new InvalidResponseException();
     }
     $data = $this->xml2array($xml);
     parent::__construct($request, $data);
 }
 /**
  * Create a redirect or a response.
  * This should be called when the application is ready to redirect!
  *
  * If the response is a redirect, the redirect takes precedence.
  * Next, the HTTP response will be returned (if set) and lastly
  * a redirect response to the  @see getTargetUrl.
  *
  * If none of these parameters are given, this method will return null
  *
  * @return \SS_HTTPResponse
  */
 public function redirectOrRespond()
 {
     if ($this->isRedirect()) {
         $redirectResponse = $this->omnipayResponse->getRedirectResponse();
         if ($redirectResponse instanceof \Symfony\Component\HttpFoundation\RedirectResponse) {
             $this->targetUrl = $redirectResponse->getTargetUrl();
             return \Controller::curr()->redirect($this->targetUrl);
         } else {
             return new \SS_HTTPResponse((string) $redirectResponse->getContent(), 200);
         }
     }
     if ($this->httpResponse) {
         return $this->httpResponse;
     }
     if ($this->targetUrl) {
         return \Controller::curr()->redirect($this->targetUrl);
     }
     // return some default HTTP responses
     return $this->isError() ? new \SS_HTTPResponse("NOK", 500) : new \SS_HTTPResponse("OK", 200);
 }
 /**
  * Get a service response from the given Omnipay response
  * @param AbstractResponse $omnipayResponse
  * @param bool $isNotification whether or not this response is a response to a notification
  * @return ServiceResponse
  */
 protected function wrapOmnipayResponse(AbstractResponse $omnipayResponse, $isNotification = false)
 {
     if ($isNotification) {
         $flags = ServiceResponse::SERVICE_NOTIFICATION;
         if (!$omnipayResponse->isSuccessful()) {
             $flags |= ServiceResponse::SERVICE_ERROR;
         }
         return $this->generateServiceResponse($flags, $omnipayResponse);
     }
     $isAsync = GatewayInfo::shouldUseAsyncNotifications($this->payment->Gateway);
     $flags = $isAsync ? ServiceResponse::SERVICE_PENDING : 0;
     if (!$omnipayResponse->isSuccessful() && !$omnipayResponse->isRedirect() && !$isAsync) {
         $flags |= ServiceResponse::SERVICE_ERROR;
     }
     return $this->generateServiceResponse($flags, $omnipayResponse);
 }
예제 #21
0
 /**
  * Get a code describing the status of this response
  * 
  * @return string
  */
 public function getCode()
 {
     return $this->isSuccessful() ? $this->data["Transaction"]->Response->ReasonCode : parent::getCode();
     //$this->data["Transaction"]->AuthCode
 }
 public function __construct(PeriodicAbstractRequest $request, $data)
 {
     // The resposnse comes in as a stream. Convert it to a string, and turn into a
     // SimpleXML object.
     return parent::__construct($request, new \SimpleXMLElement((string) $data));
 }
 public function getMessage()
 {
     if (!$this->isRedirect()) {
         return (string) parent::getMessage();
     }
 }
예제 #24
0
 public function __construct(RequestInterface $request, $data, $redirectUrl)
 {
     parent::__construct($request, $data);
     $this->redirectUrl = $redirectUrl;
     $this->data = $data;
 }
예제 #25
0
 public function __construct(RequestInterface $request, $data)
 {
     parent::__construct($request, $data);
 }
 public function __construct(RequestInterface $request, $data, $transactionReference)
 {
     parent::__construct($request, $data);
     $this->transactionReference = $transactionReference;
 }
예제 #27
0
 /**
  * Create a new Response instance.
  *
  * @param RequestInterface $request
  * @param                  $data
  */
 public function __construct(RequestInterface $request, $data)
 {
     parent::__construct($request, $data);
     $this->request = $request;
     $this->data = $data;
 }
예제 #28
0
 public function __construct(RequestInterface $request, $data, $statusCode = 200)
 {
     parent::__construct($request, $data);
     $this->statusCode = $statusCode;
 }
예제 #29
0
 public function __construct(RequestInterface $request, $response)
 {
     parent::__construct($request, $response);
     $this->data = $response->xml();
 }
예제 #30
0
 public function __construct(PurchaseRequest $request, $data)
 {
     parent::__construct($request, $data);
 }