Skip to content

Commit

Permalink
2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dyd committed Nov 28, 2024
1 parent 0dec0c1 commit 264cea4
Show file tree
Hide file tree
Showing 35 changed files with 1,057 additions and 1,024 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
2.0.4
-----
**Features**

* Added **POLI** Bank code to Online banking PayIn
* Added support for **UCOF** parameters to Online Banking PayOut request
* Added **KYC** background check filter parameters
* Added support for **Dynamic descriptor geo coordinates**
* Improved **PHP-8.1** compatibility
* Updated **MyBank** allowed currencies
* Updated **KYC** verification params
* Updated **funding parameters** support for VISA transaction
* Updated Klarna UpdateItems API request attributes

**Fixes**

* Fixed canRefund allowed transaction types in Types utility class


2.0.3
-----
**Features**
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.3
2.0.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": "2.0.3",
"version": "2.0.4",
"license": "MIT",
"keywords": [
"3ds_v2",
Expand Down
355 changes: 178 additions & 177 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion spec/Genesis/Api/Constants/Transaction/TypesSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function it_should_be_true_for_refundable_types()
$typesObject::INIT_RECURRING_SALE,
$typesObject::INIT_RECURRING_SALE_3D,
$typesObject::ITAU,
$typesObject::INVOICE,
$typesObject::INVOICE_CAPTURE,
$typesObject::MY_BANK,
$typesObject::MY_BANK,
$typesObject::NEOSURF,
Expand Down
23 changes: 23 additions & 0 deletions spec/Genesis/Api/Request/Financial/Alternatives/PproSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class PproSpec extends ObjectBehavior
use PendingPaymentAttributesExamples;
use RequestExamples;

private $allowedCountries = ['IT', 'BE', 'PT', 'ES'];

public function it_is_initializable()
{
$this->shouldHaveType(Ppro::class);
Expand Down Expand Up @@ -109,6 +111,27 @@ public function it_should_fail_with_trustpay_payment_method()
$this->shouldThrow(ErrorParameter::class)->during('getDocument');
}

public function it_should_not_fail_with_valid_country()
{
$this->setRequestParameters();
$this->setPaymentType(Methods::MYBANK);

foreach ($this->allowedCountries as $country) {
$this->setBillingCountry($country);

$this->shouldNotThrow()->during('getDocument');
}
}

public function it_should_throw_with_unsupported_country()
{
$this->setRequestParameters();
$this->setPaymentType(Methods::MYBANK);

$this->setBillingCountry('AU');
$this->shouldThrow()->during('getDocument');
}

protected function setRequestParameters()
{
$faker = $this->getFaker();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MyBankSpec extends ObjectBehavior
use PendingPaymentAttributesExamples;
use RequestExamples;

private $allowedCountries = ['IT'];
private $allowedCountries = ['IT', 'BE', 'PT', 'ES'];

public function it_is_initializable()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Genesis\Api\Constants\BankAccountTypes;
use Genesis\Api\Constants\DateTimeFormat;
use Genesis\Api\Constants\Transaction\Parameters\OnlineBanking\PayoutBankCodeParameters;
use Genesis\Api\Constants\Transaction\Parameters\OnlineBanking\PayoutBankParameters;
use Genesis\Api\Constants\Transaction\Parameters\OnlineBanking\PayoutPaymentTypesParameters;
use Genesis\Api\Request\Financial\OnlineBankingPayments\OnlineBanking\Payout;
Expand All @@ -14,6 +13,7 @@
use PhpSpec\ObjectBehavior;
use spec\SharedExamples\Faker;
use spec\SharedExamples\Genesis\Api\Request\Financial\NeighborhoodAttributesExamples;
use spec\SharedExamples\Genesis\Api\Request\Financial\UcofAttributesExamples;
use spec\SharedExamples\Genesis\Api\Request\RequestExamples;
use spec\SharedExamples\Genesis\Api\Traits\Request\Financial\BirthDateAttributesExample;

Expand All @@ -22,6 +22,7 @@ class PayoutSpec extends ObjectBehavior
use BirthDateAttributesExample;
use NeighborhoodAttributesExamples;
use RequestExamples;
use UcofAttributesExamples;

public function it_is_initializable()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

namespace spec\Genesis\Api\Request\NonFinancial\Alternatives\Klarna;

use Genesis\Api\Request\Financial\Alternatives\Klarna\Item as KlarnaItem;
use Genesis\Api\Request\Financial\Alternatives\Klarna\Items as KlarnaItems;
use Genesis\Api\Request\Financial\Alternatives\Transaction\Items as KlarnaItems;
use Genesis\Api\Request\NonFinancial\Alternatives\Klarna\UpdateItems;
use Genesis\Builder;
use Genesis\Exceptions\ErrorParameter;
use Genesis\Exceptions\InvalidArgument;
use PhpSpec\ObjectBehavior;
use spec\SharedExamples\Genesis\Api\Request\RequestExamples;
use spec\SharedExamples\Genesis\Api\Request\Financial\Alternatives\Transaction\ItemsExample;

/**
* Class UpdateItemsSpec
Expand All @@ -17,6 +18,9 @@
class UpdateItemsSpec extends ObjectBehavior
{
use RequestExamples;
use ItemsExample;

private $currency = 'EUR';

public function it_is_initializable()
{
Expand Down Expand Up @@ -49,26 +53,22 @@ public function it_should_fail_when_missing_required_params()
]);
}

/**
* @throws InvalidArgument
* @throws ErrorParameter
*/
protected function setRequestParameters()
{
$faker = $this->getFaker();

$item = new KlarnaItem(
$faker->name,
KlarnaItem::ITEM_TYPE_PHYSICAL,
1,
10,
25
);

$items = new KlarnaItems();
$items->addItem($item);

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

$this->setAmount($items->getAmount());
$this->setCurrency('');
$items = new KlarnaItems();
$items->setCurrency($this->currency);

$this->setItems($items);
$item = $this->setItem();
$item->setTotalDiscountAmount('0.09');
$this->addItem($item);
$this->setAmount('9.81');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public function it_is_initializable()
public function it_should_fail_when_missing_required_parameters()
{
$this->testMissingRequiredParameters([
'email',
'redirect_url'
'email'
]);
}

Expand Down Expand Up @@ -76,14 +75,6 @@ public function it_should_return_correct_string_when_check_duplicate_request()
$this->getFaceCheckDuplicateRequest()->shouldNotEqual(true);
}

public function it_should_fail_without_document_types()
{
$this->setEmail($this->getFaker()->email());
$this->setRedirectUrl('https://example.com');

$this->shouldThrow(ErrorParameter::class)->during('getDocument');
}

public function it_should_fail_when_wrong_document_verification_type()
{
$this->shouldThrow(InvalidArgument::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace spec\Genesis\Api\Traits\Request\NonFinancial;

use Genesis\Api\Constants\NonFinancial\Kyc\VerificationAmlFilters;
use Genesis\Exceptions\InvalidArgument;
use PhpSpec\ObjectBehavior;
use spec\Genesis\Api\Stubs\Traits\Request\NonFinancial\KycBackgroundChecksVerificationsStub;
use spec\SharedExamples\Faker;
Expand Down Expand Up @@ -71,4 +73,52 @@ public function it_should_set_async_update_correctly()
[1]
);
}

public function it_should_fail_when_set_wrong_aml_filters()
{
$this->shouldThrow(InvalidArgument::class)
->during('setBackgroundChecksFilters', [['wrong_value']]);
}

public function it_should_fail_when_add_wrong_aml_filters()
{
$this->shouldThrow(InvalidArgument::class)
->during('addBackgroundChecksFilters', ['wrong_value']);
}
public function it_should_set_valid_aml_filters()
{
$faker = Faker::getInstance();
$filter = [$faker->randomElement(VerificationAmlFilters::getAll())];
$this->shouldNotThrow()
->during('setBackgroundChecksFilters', [$filter]);
}

public function it_should_add_valid_aml_filters()
{
$faker = Faker::getInstance();
$filter = $faker->randomElement(VerificationAmlFilters::getAll());
$this->shouldNotThrow()
->during('addBackgroundChecksFilters', [$filter]);
}

public function it_should_set_valid_match_score()
{
$this->shouldNotThrow()->during(
'setBackgroundChecksMatchScore',
[Faker::getInstance()->randomNumber(3)]
);
}

public function it_should_fail_when_incorrect_match_score()
{
$this->shouldThrow(InvalidArgument::class)->during(
'setBackgroundChecksMatchScore',
[-124]
);

$this->shouldThrow(InvalidArgument::class)->during(
'setBackgroundChecksMatchScore',
['string']
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace spec\SharedExamples\Genesis\Api\Request\Financial;

use Genesis\Exceptions\InvalidArgument;
use spec\SharedExamples\Faker;

trait DescriptorAttributesExample
Expand Down Expand Up @@ -42,4 +43,36 @@ public function it_should_not_contain_optional_dynamic_descriptor_params()

$this->getDocument()->shouldNotContain("<dynamic_descriptor_params>");
}

public function it_should_contain_dynamic_descriptor_merchant_geo_coordinates()
{
$this->setRequestParameters();
$this->setDynamicMerchantGeoCoordinates('40.73061,-73.93524');
$this->getDocument()->shouldContain('merchant_geo_coordinates');
}

public function it_should_contain_dynamic_descriptor_merchant_service_geo_coordinates()
{
$this->setRequestParameters();
$this->setDynamicMerchantServiceGeoCoordinates('40.73061,-73.93524');
$this->getDocument()->shouldContain('merchant_service_geo_coordinates');
}

public function it_should_throw_when_dynamic_descriptor_merchant_geo_coordinates_is_invalid()
{
$this->setRequestParameters();
$this->shouldThrow(InvalidArgument::class)->during(
'setDynamicMerchantGeoCoordinates',
['12345678901234567890123']
);
}

public function it_should_throw_when_dynamic_descriptor_merchant_service_geo_coordinates_is_invalid()
{
$this->setRequestParameters();
$this->shouldThrow(InvalidArgument::class)->during(
'setDynamicMerchantServiceGeoCoordinates',
['12345678901234567890123']
);
}
}
Loading

0 comments on commit 264cea4

Please sign in to comment.