Skip to content

Commit

Permalink
1.24.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dyd committed Feb 23, 2024
1 parent 8e5ad1d commit 8a41505
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.24.4
-----
**Fixes**:

* Fixed Apple Pay token parsing of optional elements

1.24.3
-----
**Features**:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.24.3
1.24.4
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "genesisgateway/genesis_php",
"description": "PHP Client for Genesis Payment Processing Gateway",
"version": "1.24.3",
"version": "1.24.4",
"license": "MIT",
"keywords": [
"3ds_v2",
Expand Down
10 changes: 10 additions & 0 deletions spec/Genesis/API/Request/Financial/Mobile/ApplePaySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ public function it_should_contain_token_attributes_when_set_token()
$this->getDocument()->shouldContain('wrappedKey');
}

public function it_should_not_contain_empty_token_elements()
{
$this->setRequestParameters();
$this->setTokenApplicationData('');
$this->setTokenWrappedKey('');

$this->getDocument()->shouldNotContain('applicationData');
$this->getDocument()->shouldNotContain('wrappedKey');
}

protected function setRequestParameters()
{
$faker = $this->getFaker();
Expand Down
10 changes: 10 additions & 0 deletions spec/Genesis/API/Traits/Request/Mobile/ApplePayAttributesSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,22 @@ public function it_should_be_valid_json()

public function it_should_return_proper_structure_for_payment_token()
{
$this->setTokenApplicationData('data');
$this->setTokenVersion('1.1');
$this->setTokenEphemeralPublicKey('key');
$this->setTokenDisplayName('name');

$this->getPaymentTokenStructure()->shouldContain('paymentData');
$this->getPaymentTokenStructure()->shouldContain('version');
$this->getPaymentTokenStructure()->shouldContain('ephemeralPublicKey');
$this->getPaymentTokenStructure()->shouldContain('displayName');
}

public function it_should_return_empty_structure_without_attributes()
{
$this->getPaymentTokenStructure()->shouldBe('[]');
}

public function it_should_not_throw_with_valid_parameter()
{
$this->shouldNotThrow()->during('setTokenPublicKeyHash', [Faker::getInstance()->sha256]);
Expand Down
10 changes: 8 additions & 2 deletions src/Genesis/API/Traits/Request/Mobile/ApplePayAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

namespace Genesis\API\Traits\Request\Mobile;

use Genesis\Utils\Common as CommonUtils;

/**
* @method $this setPaymentSubtype($value) Sets payment type which is of authorize and recurring
* @method $this setTokenVersion($value) Sets version information about the payment token
Expand Down Expand Up @@ -144,7 +146,8 @@ trait ApplePayAttributes

public function getPaymentTokenStructure()
{
return json_encode([
$structure = CommonUtils::emptyValueRecursiveRemoval(
[
'paymentData' => [
'version' => $this->token_version,
'data' => $this->token_data,
Expand All @@ -163,6 +166,9 @@ public function getPaymentTokenStructure()
'type' => $this->token_type
],
'transactionIdentifier' => $this->token_transaction_identifier
], JSON_UNESCAPED_UNICODE);
]
);

return json_encode($structure, JSON_UNESCAPED_UNICODE);
}
}
2 changes: 1 addition & 1 deletion src/Genesis/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class Config
/**
* Library Version
*/
const VERSION = '1.24.3';
const VERSION = '1.24.4';

/**
* Core configuration settings
Expand Down

0 comments on commit 8a41505

Please sign in to comment.