Skip to content

Commit

Permalink
Release 1.4.1 (#26)
Browse files Browse the repository at this point in the history
* Add Apple Pay/ Google Pay Tokenization
  • Loading branch information
can-nguyen authored Aug 4, 2022
1 parent 5581c82 commit 3ccc174
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

All notable changes will be documented in this file
## 1.4.1
- Support Apple Pay/ Google Pay Tokenization

## 1.4.0
- Update PHP SDK - 3DS 2.0 - Add new error code support
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eway/eway-rapid-php",
"description": "eWAY Rapid PHP library",
"version": "1.4.0",
"version": "1.4.1",
"keywords": [
"eway",
"rapid",
Expand Down
17 changes: 13 additions & 4 deletions src/Rapid/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ public function setEndpoint($endpoint)
}

/**
* @inheritdoc
*/
* @inheritdoc
*/
public function setVersion($version)
{
$this->version = $version;
Expand Down Expand Up @@ -444,6 +444,8 @@ private function doQueryInvoiceReference($invoiceReference)
*/
private function doCreateCustomer($apiMethod, $customer)
{
$paymentInstrument = $customer['PaymentInstrument'] ?? null;

/** @var Customer $customer */
$customer = ClassValidator::getInstance('Eway\Rapid\Model\Customer', $customer);

Expand All @@ -452,8 +454,15 @@ private function doCreateCustomer($apiMethod, $customer)
$transaction = $this->customerToTransaction($customer);
$transaction->Method = PaymentMethod::CREATE_TOKEN_CUSTOMER;

if ($apiMethod == ApiMethod::WALLET && $paymentInstrument) {
$transaction->PaymentInstrument = $paymentInstrument;
$transaction->Payment = ['TotalAmount' => 0];
}

switch ($apiMethod) {
case ApiMethod::DIRECT:
case ApiMethod::WALLET:

return $this->getHttpService()->postTransaction($transaction->toArray());

case ApiMethod::RESPONSIVE_SHARED:
Expand Down Expand Up @@ -694,8 +703,8 @@ public function validateEndpoint()
{
$this->removeError(self::ERROR_INVALID_ENDPOINT);
if (empty($this->endpoint)
|| strpos($this->endpoint, 'https') !== 0
|| substr($this->endpoint, -1) != '/') {
|| strpos($this->endpoint, 'https') !== 0
|| substr($this->endpoint, -1) != '/') {
$this->log('error', "Missing or invalid endpoint");
$this->addError(self::ERROR_INVALID_ENDPOINT, false);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Rapid/Contract/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface Client
/**
* Rapid SDK Version.
*/
const VERSION = '1.4.0';
const VERSION = '1.4.1';

/**
* Sandbox mode.
Expand Down

0 comments on commit 3ccc174

Please sign in to comment.