Skip to content

Commit

Permalink
1.24.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dyd committed Mar 27, 2024
1 parent 8a41505 commit d144384
Show file tree
Hide file tree
Showing 71 changed files with 2,027 additions and 343 deletions.
2 changes: 1 addition & 1 deletion .phpmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<rule ref="rulesets/naming.xml/LongVariable">
<properties>
<property name="maximum" value="30" />
<property name="maximum" value="55" />
</properties>
</rule>

Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
1.24.5
-----
**Features**:

* Added Billing Transactions API support
* Added TRL bank code for Online Banking payment method
* Added Purpose of Payment parameters support to the following transaction requests:
* `Financial\Cards\Credit`
* `Financial\Cards\Payout`
* Improved PHP 8 compatibility and code styles
* Added Merchant Website parameter support to eZeeWallet transaction request

1.24.4
-----
**Fixes**:
Expand Down
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,47 @@ git clone http://github.com/GenesisGateway/genesis_php genesis_php && cd genesis
Getting Started
------------------

### Configuration

A sample configuration file settings_sample.ini is provided. The configuration file can be loaded via:
```php
\Genesis\Config::loadSettings('/path/to/config.ini');
```
Or the configuration settings can be set manually:
```php
\Genesis\Config::setEndpoint(\Genesis\API\Constants\Endpoints::EMERCHANTPAY);
\Genesis\Config::setEnvironment(\Genesis\API\Constants\Environments::STAGING);
\Genesis\Config::setUsername('<enter_your_username>');
\Genesis\Config::setPassword('<enter_your_password>');
\Genesis\Config::setToken('<enter_your_token>');
```

```php
# Supported values: sandbox or production
environment = sandbox

# Supported values: test, testing, staging or live, prod, production
endpoint = ENTER_YOUR_ENDPOINT

# Credentials
username = ENTER_YOUR_USERNAME
password = ENTER_YOUR_PASSWORD

# Optional for WPF requests
token = ENTER_YOUR_TOKEN

# Smart Router endpoint for Financial Transactions
# Doesn't require token
force_smart_routing = off

# Optional token for Billing Transactions API requests
billing_api_token = ENTER_YOUR_TOKEN

[Interfaces]
# Supported values: curl or stream
network = curl
```

### Transactions

```php
Expand Down Expand Up @@ -1371,6 +1412,9 @@ NonFinancial\TokenizationApi\UpdateToken
NonFinancial\TokenizationApi\ValidateToken
NonFinancial\TokenizationApi\DeleteToken
NonFinancial\TokenizationApi\GetCard
// Billing Transactions API
NonFinancial\BillingApi\Transaction
```

More information about each one of the request types can be found in the Genesis API Documentation and the Wiki
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.24.4
1.24.5
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.4",
"version": "1.24.5",
"license": "MIT",
"keywords": [
"3ds_v2",
Expand Down
2 changes: 2 additions & 0 deletions settings_sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ token = ENTER_YOUR_TOKEN
# Smart Router endpoint for Financial Transactions
# Doesn't require token
force_smart_routing = off
# Optional for Billing API requests
billing_api_token = ENTER_YOUR_TOKEN

[Interfaces]
# Options:
Expand Down
63 changes: 63 additions & 0 deletions spec/Genesis/API/Request/Base/GraphQLRequestSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

namespace spec\Genesis\API\Request\Base;

use Genesis\API\Constants\Endpoints;
use Genesis\Config;
use spec\Genesis\API\Stubs\Base\Request\GraphQLRequestStub;

class GraphQLRequestSpec extends \PhpSpec\ObjectBehavior
{
public function let()
{
$this->beAnInstanceOf(GraphQLRequestStub::class);
}

public function it_should_set_version_correctly()
{
$this->shouldNotThrow()->during(
'setVersion',
['v1']
);
}

public function it_should_fail_if_version_is_invalid()
{
$this->shouldThrow()->during(
'setVersion',
['v100']
);
}

public function it_should_init_proper_configuration()
{
Config::setEndpoint(Endpoints::EMERCHANTPAY);
$this->setVersion('v1');

$this->getApiConfig('url')->shouldBe(
"https://staging.api.emerchantpay.net:443/test/v1/graphql"
);
}

public function it_should_have_proper_request_type()
{
$this->getRequestType()->shouldBe('json');
}

public function it_should_create_proper_graphql_element()
{
$this->publicGenerateGraphQLCode(
['element' => 'value', 'element2' => 'value2'],
'test',
', ',
'%s: %s'
)->shouldBe('test: { element: value, element2: value2 }');
}

public function it_should_populate_proper_transaction_structure()
{
$this->getDocument()->shouldContain('query');
$this->getDocument()->shouldContain('filter');
$this->getDocument()->shouldContain('items');
}
}
12 changes: 3 additions & 9 deletions spec/Genesis/API/Request/Financial/Cards/CreditSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
namespace spec\Genesis\API\Request\Financial\Cards;

use Genesis\API\Request\Financial\Cards\Credit;
use Genesis\Utils\Currency;
use PhpSpec\ObjectBehavior;
use spec\SharedExamples\Faker;
use spec\SharedExamples\Genesis\API\Request\Financial\Cards\CustomerIdentificationExamples;
use spec\SharedExamples\Genesis\API\Request\Financial\SourceOfFundsAttributesExamples;
use spec\SharedExamples\Genesis\API\Request\RequestExamples;
use spec\SharedExamples\Genesis\API\Request\Financial\AccountOwnerAttributesExamples;
use spec\SharedExamples\Genesis\API\Request\Financial\PurposeOfPaymentAttributesExamples;

class CreditSpec extends ObjectBehavior
{
use RequestExamples, SourceOfFundsAttributesExamples,
CustomerIdentificationExamples, AccountOwnerAttributesExamples;
CustomerIdentificationExamples, AccountOwnerAttributesExamples, PurposeOfPaymentAttributesExamples;

public function it_is_initializable()
{
Expand All @@ -24,19 +24,13 @@ public function it_is_initializable()
public function it_should_fail_when_missing_required_params()
{
$this->testMissingRequiredParameters([
'amount',
'currency'
'amount'
]);
}

protected function setRequestParameters()
{
$this->setTransactionId(Faker::getInstance()->numberBetween(1, PHP_INT_MAX));
$this->setCurrency(
Faker::getInstance()->randomElement(
Currency::getList()
)
);
$this->setAmount(Faker::getInstance()->numberBetween(1, PHP_INT_MAX));
$this->setUsage('Genesis PHP Client Automated Request');
$this->setRemoteIp(Faker::getInstance()->ipv4);
Expand Down
4 changes: 3 additions & 1 deletion spec/Genesis/API/Request/Financial/Cards/PayoutSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Genesis\API\Constants\Transaction\Parameters\Payout\MoneyTransferTypes;
use Genesis\API\Request\Financial\Cards\Payout;
use Genesis\API\Traits\Request\Financial\PurposeOfPaymentAttributes;
use PhpSpec\ObjectBehavior;
use spec\SharedExamples\Genesis\API\Request\Financial\Cards\CustomerIdentificationExamples;
use spec\SharedExamples\Genesis\API\Request\Financial\CredentialOnFileAttributesExamples;
Expand All @@ -15,13 +16,14 @@
use spec\SharedExamples\Genesis\API\Request\RequestExamples;
use spec\SharedExamples\Genesis\API\Traits\Request\DocumentAttributesExample;
use spec\SharedExamples\Genesis\API\Request\Financial\AccountOwnerAttributesExamples;
use spec\SharedExamples\Genesis\API\Request\Financial\PurposeOfPaymentAttributesExamples;

class PayoutSpec extends ObjectBehavior
{
use RequestExamples, FxRateAttributesExamples, SourceOfFundsAttributesExamples,
DescriptorAttributesExample, TokenizationAttributesExamples, CredentialOnFileAttributesExamples,
CreditCardAttributesExamples, DocumentAttributesExample, CustomerIdentificationExamples,
AccountOwnerAttributesExamples;
AccountOwnerAttributesExamples, PurposeOfPaymentAttributesExamples;

public function it_is_initializable()
{
Expand Down
57 changes: 43 additions & 14 deletions spec/Genesis/API/Request/Financial/Wallets/eZeeWalletSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace spec\Genesis\API\Request\Financial\Wallets;

use Genesis\API\Request\Financial\Wallets\eZeeWallet;
use PhpSpec\ObjectBehavior;
use Genesis\API\Request\Financial\Wallets\eZeeWallet;
use Genesis\Exceptions\InvalidArgument;
use spec\SharedExamples\Faker;
use spec\SharedExamples\Genesis\API\Request\RequestExamples;

// @codingStandardsIgnoreStart
Expand Down Expand Up @@ -48,24 +50,31 @@ public function it_should_pass_the_password_correctly_if_previously_encoded()
$this->getDocument()->shouldContain($password);
}

protected function setRequestParameters()
public function it_should_accept_valid_url_for_merchant_website()
{
$faker = $this->getFaker();

$this->setTransactionId($faker->numberBetween(1, PHP_INT_MAX));
$this->shouldNotThrow()->during('setMerchantWebsite',
[Faker::getInstance()->url()]
);
}

$this->setUsage('Genesis Automated PHP Request');
$this->setRemoteIp($faker->ipv4);
public function it_should_fail_with_invalid_url_for_merchant_website()
{
$this->shouldThrow(InvalidArgument::class)->during('setMerchantWebsite',
[Faker::getInstance()->word()]
);
}

$this->setCurrency('USD');
$this->setAmount($faker->numberBetween(1, PHP_INT_MAX));
public function it_should_not_fail_with_null_value_for_merchant_website()
{
$this->shouldNotThrow()->during('setMerchantWebsite', [null]);
}

$this->setSourceWalletId($faker->uuid);
$this->setSourceWalletPwd($faker->streetName);
public function it_should_contain_merchant_website()
{
$this->setRequestParameters();

$this->setReturnSuccessUrl($faker->url);
$this->setReturnFailureUrl($faker->url);
$this->setNotificationUrl($faker->url);
$this->setMerchantWebsite(Faker::getInstance()->url);
$this->getDocument()->shouldContain('<merchant_website>');
}

public function getMatchers(): array
Expand All @@ -82,4 +91,24 @@ public function getMatchers(): array
},
);
}

protected function setRequestParameters()
{
$faker = $this->getFaker();

$this->setTransactionId($faker->numberBetween(1, PHP_INT_MAX));

$this->setUsage('Genesis Automated PHP Request');
$this->setRemoteIp($faker->ipv4);

$this->setCurrency('USD');
$this->setAmount($faker->numberBetween(1, PHP_INT_MAX));

$this->setSourceWalletId($faker->uuid);
$this->setSourceWalletPwd($faker->streetName);

$this->setReturnSuccessUrl($faker->url);
$this->setReturnFailureUrl($faker->url);
$this->setNotificationUrl($faker->url);
}
}
Loading

0 comments on commit d144384

Please sign in to comment.