diff --git a/CHANGELOG.md b/CHANGELOG.md index 65ceca21..938177ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ ## Latest Version #### Bug Fixes: +- Portico/Heartland: fix 'withStartDate()' reporting method + +#### Enhancements: +- Portico/Heartland: improvements to GooglePay and ApplePay token handling +- Portico/Heartland: simple GooglePay example added + +## v6.1.5 (02/28/2023) +#### Bug Fixes: - TSYS/Merchantware: correction to service endpoints ## v6.1.4 (02/21/2023) diff --git a/examples/portico/google-pay/charge.php b/examples/portico/google-pay/charge.php new file mode 100644 index 00000000..22cf5333 --- /dev/null +++ b/examples/portico/google-pay/charge.php @@ -0,0 +1,30 @@ +secretApiKey = 'skapi_cert_MVq4BQC5n3AAgd4M1Cvph2ud3CGaIclCgC7H_KxZaQ'; // 777703754644 +ServicesContainer::configureService($config); + +$card = new CreditCardData(); +$card->token = $_POST['paymentReference']; +$card->paymentSource = PaymentDataSourceType::GOOGLEPAYWEB; + +try { + $response = $card->charge(15) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + + echo "

Success!

" . PHP_EOL; + + echo "Your transaction Id is: " . $response->transactionId; +} catch (Exception $e) { + echo 'Failure: ' . $e->getMessage(); + exit; +} \ No newline at end of file diff --git a/examples/portico/google-pay/index.html b/examples/portico/google-pay/index.html new file mode 100644 index 00000000..b82ab793 --- /dev/null +++ b/examples/portico/google-pay/index.html @@ -0,0 +1,290 @@ + + + + + + + End-to-End Payment Example + + + + +
+
+

End-to-End Example

+
+ +
+ + +
+ + +
+
+ + + + + + + + + \ No newline at end of file diff --git a/metadata.xml b/metadata.xml index a0a7c5f8..1727ba43 100644 --- a/metadata.xml +++ b/metadata.xml @@ -1,3 +1,3 @@ - 6.1.5 + 6.1.6 \ No newline at end of file diff --git a/src/Builders/TransactionReportBuilder.php b/src/Builders/TransactionReportBuilder.php index 9717f4f8..5da5eace 100644 --- a/src/Builders/TransactionReportBuilder.php +++ b/src/Builders/TransactionReportBuilder.php @@ -181,6 +181,17 @@ public function withEndDate($value) return $this; } + /** + * + * @param mixed $value + * @return $this + */ + public function withStartDate($value) + { + $this->searchBuilder->startDate = $value; + return $this; + } + /** * Sets the payment type. * diff --git a/src/Gateways/PorticoConnector.php b/src/Gateways/PorticoConnector.php index a85bbe9a..912c86fd 100644 --- a/src/Gateways/PorticoConnector.php +++ b/src/Gateways/PorticoConnector.php @@ -2359,8 +2359,9 @@ private function hydrateWalletData(DOMDocument $xml, BaseBuilder $builder, $bloc $walletData->appendChild($xml->createElement('PaymentSource', $builder->paymentMethod->paymentSource)); } if (!empty($builder->paymentMethod->token)) { - $token = $this->toFormatToken($builder->paymentMethod->token); - $walletData->appendChild($xml->createElement('DigitalPaymentToken', $token)); + $token = $builder->paymentMethod->token; + $dpt = $walletData->appendChild($xml->createElement('DigitalPaymentToken')); + $dpt->appendChild($xml->createCDATASection($token)); $block1->removeChild($cardData); } diff --git a/test/Integration/Gateways/PorticoConnector/PorticoReportingTests.php b/test/Integration/Gateways/PorticoConnector/PorticoReportingTests.php index 19c61776..fafd8967 100644 --- a/test/Integration/Gateways/PorticoConnector/PorticoReportingTests.php +++ b/test/Integration/Gateways/PorticoConnector/PorticoReportingTests.php @@ -53,7 +53,7 @@ protected function getConfig() return $config; } - public function testReportActivity() + public function testFindTransactions() { date_default_timezone_set("UTC"); $dateFormat = 'Y-m-d\TH:i:s.00\Z'; @@ -62,7 +62,7 @@ public function testReportActivity() $dateMinus10Utc = gmdate($dateFormat, $dateMinus15days->Format('U')); $nowUtc = gmdate($dateFormat); - $response = $this->reportingService->activity() + $response = $this->reportingService->findTransactions() ->withStartDate($dateMinus10Utc) ->withEndDate($nowUtc) ->execute(); @@ -79,7 +79,7 @@ public function testReportActivityByDays() $dateMinus10Utc = gmdate($dateFormat, $dateMinus5days->Format('U')); $nowUtc = gmdate($dateFormat); - $response = $this->reportingService->activity() + $response = $this->reportingService->findTransactions() ->withStartDate($dateMinus10Utc) ->withEndDate($nowUtc) ->execute();