From 6d37b46d6feb572bbc3ea1a9104c8acddcadf6c0 Mon Sep 17 00:00:00 2001 From: Jason Judge Date: Thu, 18 Aug 2016 12:43:11 +0100 Subject: [PATCH] Client interface - access the form URL through the Response message. --- README.md | 2 +- src/Message/ShopClientAuthorizeResponse.php | 5 +++-- src/Message/ShopClientCardCheckResponse.php | 19 ++++++++++++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index feb3f10..12e4461 100644 --- a/README.md +++ b/README.md @@ -642,7 +642,7 @@ This provides the following data to feed into your client: ~~~php // The endpoint used to check the card details - GET or POST can be used. -$endpoint = $request->getEndpoint(); +$endpoint = $response->getRedirectUrl(); // The additional data that must be included with the card data. // This will be an array that can be JSON encoded for the client JavaScript to use: diff --git a/src/Message/ShopClientAuthorizeResponse.php b/src/Message/ShopClientAuthorizeResponse.php index b98d041..5335cea 100644 --- a/src/Message/ShopClientAuthorizeResponse.php +++ b/src/Message/ShopClientAuthorizeResponse.php @@ -40,12 +40,13 @@ public function isRedirect() } /** - * The URL the form will POST to. + * The URL the form data will POST to. */ public function getRedirectUrl() { - return $this->postUrl; + return $this->request->getEndpoint(); } + public function getRedirectMethod() { return 'POST'; diff --git a/src/Message/ShopClientCardCheckResponse.php b/src/Message/ShopClientCardCheckResponse.php index 8875dbd..14e7d0f 100644 --- a/src/Message/ShopClientCardCheckResponse.php +++ b/src/Message/ShopClientCardCheckResponse.php @@ -9,7 +9,7 @@ use Omnipay\Common\Message\RedirectResponseInterface; -class ShopClientCardCheckResponse extends AbstractResponse +class ShopClientCardCheckResponse extends AbstractResponse implements RedirectResponseInterface { public function isSuccessful() { @@ -37,4 +37,21 @@ public function getRedirectData() { return $this->getData(); } + + /** + * Actually either POST or GET will work. + * This is over a secure connection, so GET won't be cached. + */ + public function getRedirectMethod() + { + return 'POST'; + } + + /** + * The URL the form data will POST to. + */ + public function getRedirectUrl() + { + return $this->request->getEndpoint(); + } }