diff --git a/samples/threeDSecurePay.php b/samples/threeDSecurePay.php index 2e5b161..2d52600 100644 --- a/samples/threeDSecurePay.php +++ b/samples/threeDSecurePay.php @@ -28,7 +28,7 @@ try { $result = new \Sportakal\Garantipos\Results\ThreeDSecurePayResult($options); // ddd($result->getOrder(), $result->getTransaction()); - ddd($result->getMdStatus(), $result->getResponseMessage(), $result->getErrorMessage()); + ddd($result->getMdStatus(), $result->getMdStatusCode(), $result->getResponseMessage(), $result->getErrorMessage()); } catch (Exception $e) { ddd($e->getMessage()); } @@ -36,7 +36,7 @@ $card = new Card(); -$card->setNumber('5549608789641500'); //5406697543211173 //5549608789641500 +$card->setNumber('5549608789641501'); //5406697543211173 //5549608789641500 $card->setExpireDate('0323'); //0323 //0323 $card->setCVV2('712'); //465 //712 @@ -83,9 +83,10 @@ $request->setErrorurl((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); $response = new ThreeDSecurePay($request); -$response = $response->getResult(); +$result = $response->getResult(); -echo $response->getHtml(); + +echo $result->getHtml(); //echo '
';
 //dd($response->getRawBody());
 //echo '
'; diff --git a/src/Results/Constructors/PostResult.php b/src/Results/Constructors/PostResult.php index 5693744..b7a8dc9 100644 --- a/src/Results/Constructors/PostResult.php +++ b/src/Results/Constructors/PostResult.php @@ -44,12 +44,12 @@ public function __construct(Options $options, array $postFields = []) $this->options = $options; $this->setMdStatus(in_array((int)$this->postResultModel->mdstatus, [1, 2, 3, 4], true)); - $this->setMdStatusCode((int)$this->postResultModel->mdstatus); - $this->setMdErrorMessage($this->postResultModel->mderrormessage); - $this->setResponseMessage($this->postResultModel->response); - $this->setErrorMessage($this->postResultModel->errmsg); - $this->setHostMessage($this->postResultModel->hostmsg); - $this->setReferenceNumber($this->postResultModel->hostrefnum); + $this->setMdStatusCode((int)($this->postResultModel->mdstatus ?? 0)); + $this->setMdErrorMessage($this->postResultModel->mderrormessage ?? ''); + $this->setResponseMessage($this->postResultModel->response ?? ''); + $this->setErrorMessage($this->postResultModel->errmsg ?? ''); + $this->setHostMessage($this->postResultModel->hostmsg ?? ''); + $this->setReferenceNumber($this->postResultModel->hostrefnum ?? ''); $this->setRequest(); if ($this->getHashData() !== $this->postResultModel->secure3dhash) { diff --git a/src/Results/InitializeThreeDSecureResult.php b/src/Results/InitializeThreeDSecureResult.php index d5fe2e6..dfe42ff 100644 --- a/src/Results/InitializeThreeDSecureResult.php +++ b/src/Results/InitializeThreeDSecureResult.php @@ -40,4 +40,9 @@ public function getHtml(): string { return $this->response->getRawBody(); } + + public function getData(): array + { + return [$this->response->getRawBody()]; + } }