diff --git a/composer.json b/composer.json index 053ac57..ab00b23 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,8 @@ "omnipay/common": "~3.0" }, "require-dev": { - "omnipay/tests": "~3.0" + "omnipay/tests": "~3.0", + "squizlabs/php_codesniffer": "^3.2" }, "extra": { "branch-alias": { diff --git a/src/Message/PxPayAuthorizeRequest.php b/src/Message/PxPayAuthorizeRequest.php index a9f44d5..0d9f7fa 100644 --- a/src/Message/PxPayAuthorizeRequest.php +++ b/src/Message/PxPayAuthorizeRequest.php @@ -177,6 +177,30 @@ public function setTransactionData3($value) return $this->setParameter('transactionData3', $value); } + /** + * Get the PxPay BillingId where this is used instead of the DpsBillingId + * for storing or retrieving a saved card profile. + * + * @see getCardReference() for DpsBillingId + * @return mixed + */ + public function getBillingId() + { + return $this->getParameter('billingId'); + } + + /** + * Set a BillingId for use of a stored card with a local reference as an + * alternative to using cardReference (which uses DPS' generated reference instead) + * + * @param string $value Max 32 bytes + * @return $this + */ + public function setBillingId($value) + { + return $this->setParameter('billingId', $value); + } + /** * Get the transaction data * @@ -217,6 +241,8 @@ public function getData() if ($this->getCardReference()) { $data->DpsBillingId = $this->getCardReference(); + } elseif ($this->getBillingId()) { + $data->BillingId = $this->getBillingId(); } return $data; @@ -230,7 +256,7 @@ public function getData() */ public function sendData($data) { - $httpResponse = $this->httpClient->request('POST' ,$this->getEndpoint(), [], $data->asXML()); + $httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], $data->asXML()); return $this->createResponse($httpResponse->getBody()->getContents()); } diff --git a/src/Message/PxPostAuthorizeRequest.php b/src/Message/PxPostAuthorizeRequest.php index 7ef9397..1514bdd 100644 --- a/src/Message/PxPostAuthorizeRequest.php +++ b/src/Message/PxPostAuthorizeRequest.php @@ -132,6 +132,30 @@ public function setTransactionData3($value) return $this->setParameter('transactionData3', $value); } + /** + * Get the PxPost BillingId where this is used instead of the DpsBillingId + * for storing or retrieving a saved card profile. + * + * @see getCardReference() for DpsBillingId + * @return mixed + */ + public function getBillingId() + { + return $this->getParameter('billingId'); + } + + /** + * Set a BillingId for use of a stored card with a local reference as an + * alternative to using cardReference (which uses DPS' generated reference instead) + * + * @param string $value Max 32 bytes + * @return $this + */ + public function setBillingId($value) + { + return $this->setParameter('billingId', $value); + } + protected function getBaseData() { $data = new \SimpleXMLElement(''); @@ -172,6 +196,8 @@ public function getData() if ($this->getCardReference()) { $data->DpsBillingId = $this->getCardReference(); + } elseif ($this->getBillingId()) { + $data->BillingId = $this->getBillingId(); } elseif ($this->getCard()) { $this->getCard()->validate(); $data->CardNumber = $this->getCard()->getNumber();