Skip to content

Commit d144384

Browse files
committed
1.24.5
1 parent 8a41505 commit d144384

File tree

71 files changed

+2027
-343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2027
-343
lines changed

.phpmd.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
<rule ref="rulesets/naming.xml/LongVariable">
5656
<properties>
57-
<property name="maximum" value="30" />
57+
<property name="maximum" value="55" />
5858
</properties>
5959
</rule>
6060

CHANGELOG

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
1.24.5
2+
-----
3+
**Features**:
4+
5+
* Added Billing Transactions API support
6+
* Added TRL bank code for Online Banking payment method
7+
* Added Purpose of Payment parameters support to the following transaction requests:
8+
* `Financial\Cards\Credit`
9+
* `Financial\Cards\Payout`
10+
* Improved PHP 8 compatibility and code styles
11+
* Added Merchant Website parameter support to eZeeWallet transaction request
12+
113
1.24.4
214
-----
315
**Fixes**:

README.md

+44
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,47 @@ git clone http://github.com/GenesisGateway/genesis_php genesis_php && cd genesis
5353
Getting Started
5454
------------------
5555

56+
### Configuration
57+
58+
A sample configuration file settings_sample.ini is provided. The configuration file can be loaded via:
59+
```php
60+
\Genesis\Config::loadSettings('/path/to/config.ini');
61+
```
62+
Or the configuration settings can be set manually:
63+
```php
64+
\Genesis\Config::setEndpoint(\Genesis\API\Constants\Endpoints::EMERCHANTPAY);
65+
\Genesis\Config::setEnvironment(\Genesis\API\Constants\Environments::STAGING);
66+
\Genesis\Config::setUsername('<enter_your_username>');
67+
\Genesis\Config::setPassword('<enter_your_password>');
68+
\Genesis\Config::setToken('<enter_your_token>');
69+
```
70+
71+
```php
72+
# Supported values: sandbox or production
73+
environment = sandbox
74+
75+
# Supported values: test, testing, staging or live, prod, production
76+
endpoint = ENTER_YOUR_ENDPOINT
77+
78+
# Credentials
79+
username = ENTER_YOUR_USERNAME
80+
password = ENTER_YOUR_PASSWORD
81+
82+
# Optional for WPF requests
83+
token = ENTER_YOUR_TOKEN
84+
85+
# Smart Router endpoint for Financial Transactions
86+
# Doesn't require token
87+
force_smart_routing = off
88+
89+
# Optional token for Billing Transactions API requests
90+
billing_api_token = ENTER_YOUR_TOKEN
91+
92+
[Interfaces]
93+
# Supported values: curl or stream
94+
network = curl
95+
```
96+
5697
### Transactions
5798

5899
```php
@@ -1371,6 +1412,9 @@ NonFinancial\TokenizationApi\UpdateToken
13711412
NonFinancial\TokenizationApi\ValidateToken
13721413
NonFinancial\TokenizationApi\DeleteToken
13731414
NonFinancial\TokenizationApi\GetCard
1415+
1416+
// Billing Transactions API
1417+
NonFinancial\BillingApi\Transaction
13741418
```
13751419

13761420
More information about each one of the request types can be found in the Genesis API Documentation and the Wiki

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.24.4
1+
1.24.5

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "genesisgateway/genesis_php",
33
"description": "PHP Client for Genesis Payment Processing Gateway",
4-
"version": "1.24.4",
4+
"version": "1.24.5",
55
"license": "MIT",
66
"keywords": [
77
"3ds_v2",

settings_sample.ini

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ token = ENTER_YOUR_TOKEN
1111
# Smart Router endpoint for Financial Transactions
1212
# Doesn't require token
1313
force_smart_routing = off
14+
# Optional for Billing API requests
15+
billing_api_token = ENTER_YOUR_TOKEN
1416

1517
[Interfaces]
1618
# Options:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
namespace spec\Genesis\API\Request\Base;
4+
5+
use Genesis\API\Constants\Endpoints;
6+
use Genesis\Config;
7+
use spec\Genesis\API\Stubs\Base\Request\GraphQLRequestStub;
8+
9+
class GraphQLRequestSpec extends \PhpSpec\ObjectBehavior
10+
{
11+
public function let()
12+
{
13+
$this->beAnInstanceOf(GraphQLRequestStub::class);
14+
}
15+
16+
public function it_should_set_version_correctly()
17+
{
18+
$this->shouldNotThrow()->during(
19+
'setVersion',
20+
['v1']
21+
);
22+
}
23+
24+
public function it_should_fail_if_version_is_invalid()
25+
{
26+
$this->shouldThrow()->during(
27+
'setVersion',
28+
['v100']
29+
);
30+
}
31+
32+
public function it_should_init_proper_configuration()
33+
{
34+
Config::setEndpoint(Endpoints::EMERCHANTPAY);
35+
$this->setVersion('v1');
36+
37+
$this->getApiConfig('url')->shouldBe(
38+
"https://staging.api.emerchantpay.net:443/test/v1/graphql"
39+
);
40+
}
41+
42+
public function it_should_have_proper_request_type()
43+
{
44+
$this->getRequestType()->shouldBe('json');
45+
}
46+
47+
public function it_should_create_proper_graphql_element()
48+
{
49+
$this->publicGenerateGraphQLCode(
50+
['element' => 'value', 'element2' => 'value2'],
51+
'test',
52+
', ',
53+
'%s: %s'
54+
)->shouldBe('test: { element: value, element2: value2 }');
55+
}
56+
57+
public function it_should_populate_proper_transaction_structure()
58+
{
59+
$this->getDocument()->shouldContain('query');
60+
$this->getDocument()->shouldContain('filter');
61+
$this->getDocument()->shouldContain('items');
62+
}
63+
}

spec/Genesis/API/Request/Financial/Cards/CreditSpec.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
namespace spec\Genesis\API\Request\Financial\Cards;
44

55
use Genesis\API\Request\Financial\Cards\Credit;
6-
use Genesis\Utils\Currency;
76
use PhpSpec\ObjectBehavior;
87
use spec\SharedExamples\Faker;
98
use spec\SharedExamples\Genesis\API\Request\Financial\Cards\CustomerIdentificationExamples;
109
use spec\SharedExamples\Genesis\API\Request\Financial\SourceOfFundsAttributesExamples;
1110
use spec\SharedExamples\Genesis\API\Request\RequestExamples;
1211
use spec\SharedExamples\Genesis\API\Request\Financial\AccountOwnerAttributesExamples;
12+
use spec\SharedExamples\Genesis\API\Request\Financial\PurposeOfPaymentAttributesExamples;
1313

1414
class CreditSpec extends ObjectBehavior
1515
{
1616
use RequestExamples, SourceOfFundsAttributesExamples,
17-
CustomerIdentificationExamples, AccountOwnerAttributesExamples;
17+
CustomerIdentificationExamples, AccountOwnerAttributesExamples, PurposeOfPaymentAttributesExamples;
1818

1919
public function it_is_initializable()
2020
{
@@ -24,19 +24,13 @@ public function it_is_initializable()
2424
public function it_should_fail_when_missing_required_params()
2525
{
2626
$this->testMissingRequiredParameters([
27-
'amount',
28-
'currency'
27+
'amount'
2928
]);
3029
}
3130

3231
protected function setRequestParameters()
3332
{
3433
$this->setTransactionId(Faker::getInstance()->numberBetween(1, PHP_INT_MAX));
35-
$this->setCurrency(
36-
Faker::getInstance()->randomElement(
37-
Currency::getList()
38-
)
39-
);
4034
$this->setAmount(Faker::getInstance()->numberBetween(1, PHP_INT_MAX));
4135
$this->setUsage('Genesis PHP Client Automated Request');
4236
$this->setRemoteIp(Faker::getInstance()->ipv4);

spec/Genesis/API/Request/Financial/Cards/PayoutSpec.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Genesis\API\Constants\Transaction\Parameters\Payout\MoneyTransferTypes;
66
use Genesis\API\Request\Financial\Cards\Payout;
7+
use Genesis\API\Traits\Request\Financial\PurposeOfPaymentAttributes;
78
use PhpSpec\ObjectBehavior;
89
use spec\SharedExamples\Genesis\API\Request\Financial\Cards\CustomerIdentificationExamples;
910
use spec\SharedExamples\Genesis\API\Request\Financial\CredentialOnFileAttributesExamples;
@@ -15,13 +16,14 @@
1516
use spec\SharedExamples\Genesis\API\Request\RequestExamples;
1617
use spec\SharedExamples\Genesis\API\Traits\Request\DocumentAttributesExample;
1718
use spec\SharedExamples\Genesis\API\Request\Financial\AccountOwnerAttributesExamples;
19+
use spec\SharedExamples\Genesis\API\Request\Financial\PurposeOfPaymentAttributesExamples;
1820

1921
class PayoutSpec extends ObjectBehavior
2022
{
2123
use RequestExamples, FxRateAttributesExamples, SourceOfFundsAttributesExamples,
2224
DescriptorAttributesExample, TokenizationAttributesExamples, CredentialOnFileAttributesExamples,
2325
CreditCardAttributesExamples, DocumentAttributesExample, CustomerIdentificationExamples,
24-
AccountOwnerAttributesExamples;
26+
AccountOwnerAttributesExamples, PurposeOfPaymentAttributesExamples;
2527

2628
public function it_is_initializable()
2729
{

spec/Genesis/API/Request/Financial/Wallets/eZeeWalletSpec.php

+43-14
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

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

5-
use Genesis\API\Request\Financial\Wallets\eZeeWallet;
65
use PhpSpec\ObjectBehavior;
6+
use Genesis\API\Request\Financial\Wallets\eZeeWallet;
7+
use Genesis\Exceptions\InvalidArgument;
8+
use spec\SharedExamples\Faker;
79
use spec\SharedExamples\Genesis\API\Request\RequestExamples;
810

911
// @codingStandardsIgnoreStart
@@ -48,24 +50,31 @@ public function it_should_pass_the_password_correctly_if_previously_encoded()
4850
$this->getDocument()->shouldContain($password);
4951
}
5052

51-
protected function setRequestParameters()
53+
public function it_should_accept_valid_url_for_merchant_website()
5254
{
53-
$faker = $this->getFaker();
54-
55-
$this->setTransactionId($faker->numberBetween(1, PHP_INT_MAX));
55+
$this->shouldNotThrow()->during('setMerchantWebsite',
56+
[Faker::getInstance()->url()]
57+
);
58+
}
5659

57-
$this->setUsage('Genesis Automated PHP Request');
58-
$this->setRemoteIp($faker->ipv4);
60+
public function it_should_fail_with_invalid_url_for_merchant_website()
61+
{
62+
$this->shouldThrow(InvalidArgument::class)->during('setMerchantWebsite',
63+
[Faker::getInstance()->word()]
64+
);
65+
}
5966

60-
$this->setCurrency('USD');
61-
$this->setAmount($faker->numberBetween(1, PHP_INT_MAX));
67+
public function it_should_not_fail_with_null_value_for_merchant_website()
68+
{
69+
$this->shouldNotThrow()->during('setMerchantWebsite', [null]);
70+
}
6271

63-
$this->setSourceWalletId($faker->uuid);
64-
$this->setSourceWalletPwd($faker->streetName);
72+
public function it_should_contain_merchant_website()
73+
{
74+
$this->setRequestParameters();
6575

66-
$this->setReturnSuccessUrl($faker->url);
67-
$this->setReturnFailureUrl($faker->url);
68-
$this->setNotificationUrl($faker->url);
76+
$this->setMerchantWebsite(Faker::getInstance()->url);
77+
$this->getDocument()->shouldContain('<merchant_website>');
6978
}
7079

7180
public function getMatchers(): array
@@ -82,4 +91,24 @@ public function getMatchers(): array
8291
},
8392
);
8493
}
94+
95+
protected function setRequestParameters()
96+
{
97+
$faker = $this->getFaker();
98+
99+
$this->setTransactionId($faker->numberBetween(1, PHP_INT_MAX));
100+
101+
$this->setUsage('Genesis Automated PHP Request');
102+
$this->setRemoteIp($faker->ipv4);
103+
104+
$this->setCurrency('USD');
105+
$this->setAmount($faker->numberBetween(1, PHP_INT_MAX));
106+
107+
$this->setSourceWalletId($faker->uuid);
108+
$this->setSourceWalletPwd($faker->streetName);
109+
110+
$this->setReturnSuccessUrl($faker->url);
111+
$this->setReturnFailureUrl($faker->url);
112+
$this->setNotificationUrl($faker->url);
113+
}
85114
}

0 commit comments

Comments
 (0)