From a913464e49121cc7a72736d0b87b1e7f207aebdf Mon Sep 17 00:00:00 2001 From: Toby Evans Date: Fri, 31 Mar 2023 11:37:13 +1300 Subject: [PATCH 1/2] Added a couple of geters/setters For EmailAddress and Timeout parameters --- src/Message/PxPayAuthorizeRequest.php | 63 ++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/src/Message/PxPayAuthorizeRequest.php b/src/Message/PxPayAuthorizeRequest.php index 8b3d67f..447f429 100644 --- a/src/Message/PxPayAuthorizeRequest.php +++ b/src/Message/PxPayAuthorizeRequest.php @@ -2,8 +2,8 @@ namespace Omnipay\PaymentExpress\Message; -use SimpleXMLElement; use Omnipay\Common\Message\AbstractRequest; +use SimpleXMLElement; /** * PaymentExpress PxPay Authorize Request @@ -102,6 +102,59 @@ public function getEndpoint() return $this->getTestMode() === true ? $this->testEndpoint : $this->liveEndpoint; } + /** + * Get the PxPay EmailAddress + * + * Optional: The EmailAddress field can be used to store a customer's email address and will be returned in the + * transaction response. The response data along with the email address can then be used by the merchant + * to generate a notification/receipt email for the customer. + * + * @return mixed + */ + public function getEmailAddress() + { + return $this->getParameter('emailAddress'); + } + + /** + * Set the PxPay EmailAddress + * + * @param string $value Max 255 bytes + * @return $this + */ + public function setEmailAddress($value) + { + return $this->setParameter('emailAddress', $value); + } + + /** + * A timeout (TO) can be set for the hosted payments page, after which the payment page will + * timeout and no longer allow a payment to be taken. Note: The default timeout of the created hosted + * payment page session is 72 hours. A specific timeout timestamp can also be specified via the request in + * Coordinated Universal Time (UTC). The value must be in the format "TO=yymmddHHmm" + * e.g.“TO=1010142221” for 2010 October 14th 10:21pm. + * The merchant should submit the timeout value of when the payment page should timeout. One approach + * is to find the time (UTC) from when the GenerateRequest input XML document is generated and add on + * how much time you wish to give the customer before the payment page times out. + * + * @param string $value Max 255 bytes + * @return $this + */ + public function setTimeout($value) + { + return $this->setParameter('timeout', $value); + } + + /** + * Get the PxPay Timeout + * + * @return string + */ + public function getTimeout() + { + return $this->getParameter('timeout'); + } + /** * Get the PxPay TxnData1 * @@ -245,6 +298,14 @@ public function getData() $data->UrlSuccess = $this->getReturnUrl(); $data->UrlFail = $this->getCancelUrl() ?: $this->getReturnUrl(); + if ($this->getEmailAddress()) { + $data->EmailAddress = $this->getEmailAddress(); + } + + if ($this->getTimeout()) { + $data->Timeout = $this->getTimeout(); + } + if ($this->getDescription()) { $data->MerchantReference = $this->getDescription(); } From cfca1968f5b2c972cb9aa6ab1bf9aac37e6201a9 Mon Sep 17 00:00:00 2001 From: Toby Evans Date: Fri, 31 Mar 2023 11:38:50 +1300 Subject: [PATCH 2/2] Added the callbackUrl --- src/Message/PxPayAuthorizeRequest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Message/PxPayAuthorizeRequest.php b/src/Message/PxPayAuthorizeRequest.php index 447f429..2422b64 100644 --- a/src/Message/PxPayAuthorizeRequest.php +++ b/src/Message/PxPayAuthorizeRequest.php @@ -306,6 +306,10 @@ public function getData() $data->Timeout = $this->getTimeout(); } + if ($this->getNotifyUrl()) { + $data->UrlCallback = $this->getNotifyUrl(); + } + if ($this->getDescription()) { $data->MerchantReference = $this->getDescription(); }