Skip to content

Commit cec828d

Browse files
committed
1.9.0
1 parent 606b0d6 commit cec828d

File tree

16 files changed

+666
-23
lines changed

16 files changed

+666
-23
lines changed

CHANGELOG

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
1.9.0
2+
-----
3+
* Added Support for new Gift Cards Transaction Types
4+
- TCS
5+
- Fashioncheque
6+
- Intersolve
7+
18
1.8.3
29
-----
310
* Fixed bug with missing iDebit Payin transaction type for Web Payment Form.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ Financial\Cards\Recurring\InitRecurringSale
201201
Financial\Cards\Recurring\InitRecurringSale3D
202202
Financial\Cards\Recurring\RecurringSale
203203
204+
// Gift Cards transactions
205+
Financial\GiftCards\Intersolve
206+
Financial\GiftCards\Fashioncheque
207+
Financial\GiftCards\TCS
208+
204209
//Sepa Direct Debit transactions
205210
Financial\SCT\Payout
206211
Financial\SDD\Sale

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8.3
1+
1.9.0

composer.json

Lines changed: 5 additions & 2 deletions
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.8.3",
4+
"version": "1.9.0",
55
"license": "MIT",
66
"keywords": [
77
"genesis",
@@ -66,7 +66,10 @@
6666
"tc40",
6767
"fraud",
6868
"chargeback",
69-
"wechat"
69+
"wechat",
70+
"container_store",
71+
"fashioncheque",
72+
"intersolve"
7073
],
7174
"require": {
7275
"php": ">=5.5.9",

spec/Genesis/API/Constants/Transaction/TypesSpec.php

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@ public function it_is_initializable()
1515

1616
public function it_can_validate_transaction_types()
1717
{
18-
$this->isValidTransactionType(
19-
Types::SALE
20-
)->shouldReturn(true);
21-
22-
$this->isValidTransactionType(
23-
'non-existing-trx-type'
24-
)->shouldReturn(false);
18+
$this->isValidTransactionType(Types::SALE)->shouldReturn(true);
19+
$this->isValidTransactionType('non-existing-trx-type')->shouldReturn(false);
2520
}
2621

2722
public function it_can_detect_supported_wpf_trx_types()
@@ -37,15 +32,15 @@ public function it_can_detect_not_supported_wpf_trx_types()
3732

3833
public function it_can_validate_pay_by_voucher_transaction_types()
3934
{
40-
$this->isPayByVoucher(
41-
Types::PAYBYVOUCHER_YEEPAY
42-
)->shouldReturn(true);
43-
$this->isPayByVoucher(
44-
Types::PAYBYVOUCHER_SALE
45-
)->shouldReturn(true);
46-
47-
$this->isPayByVoucher(
48-
Types::EARTHPORT
49-
)->shouldReturn(false);
35+
$this->isPayByVoucher(Types::PAYBYVOUCHER_YEEPAY)->shouldReturn(true);
36+
$this->isPayByVoucher(Types::PAYBYVOUCHER_SALE)->shouldReturn(true);
37+
$this->isPayByVoucher(Types::EARTHPORT)->shouldReturn(false);
38+
}
39+
40+
public function it_can_detect_3d_transaction_types()
41+
{
42+
$this->is3D(Types::SALE_3D)->shouldReturn(true);
43+
$this->is3D(Types::SALE)->shouldReturn(false);
44+
$this->is3D('test_3d_fake')->shouldReturn(false);
5045
}
5146
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
3+
namespace spec\Genesis\API\Request\Financial\GiftCards;
4+
5+
use PhpSpec\ObjectBehavior;
6+
7+
class FashionchequeSpec extends ObjectBehavior
8+
{
9+
public function it_is_initializable()
10+
{
11+
$this->shouldHaveType('Genesis\API\Request\Financial\GiftCards\Fashioncheque');
12+
}
13+
14+
public function it_can_build_structure()
15+
{
16+
$this->setRequestParameters();
17+
$this->getDocument()->shouldNotBeEmpty();
18+
}
19+
20+
public function it_fails_when_no_parameters()
21+
{
22+
$this->shouldThrow('\Genesis\Exceptions\ErrorParameter')->during('getDocument');
23+
}
24+
25+
public function it_fails_when_missing_required_parameters()
26+
{
27+
$this->setRequestParameters();
28+
$this->setCardNumber(null);
29+
$this->shouldThrow()->during('getDocument');
30+
}
31+
32+
public function it_fails_when_card_number_is_not_only_digits()
33+
{
34+
$this->setRequestParameters();
35+
$this->setCardNumber(str_repeat('A', 22));
36+
37+
$this->shouldThrow(
38+
$this->getExpectedFieldValueException('card_number')
39+
)->during('getDocument');
40+
}
41+
42+
public function it_fails_when_invalid_currency_parameter()
43+
{
44+
$this->setRequestParameters();
45+
$this->setCurrency('ABC');
46+
47+
$this->shouldThrow()->during('getDocument');
48+
}
49+
50+
public function it_fails_when_unsupported_currency_parameter()
51+
{
52+
$this->setRequestParameters();
53+
$this->setCurrency('CNY');
54+
55+
$this->shouldThrow()->during('getDocument');
56+
}
57+
58+
protected function setRequestParameters()
59+
{
60+
$faker = \Faker\Factory::create();
61+
62+
$faker->addProvider(new \Faker\Provider\Payment($faker));
63+
$faker->addProvider(new \Faker\Provider\Internet($faker));
64+
65+
$this->setTransactionId($faker->numberBetween(1, PHP_INT_MAX));
66+
$this->setCurrency('EUR');
67+
$this->setAmount($faker->numberBetween(1, PHP_INT_MAX));
68+
$this->setUsage('Genesis PHP Client Automated Request');
69+
$this->setRemoteIp($faker->ipv4);
70+
$this->setCardNumber('6046425117120757123');
71+
$this->setCvv(sprintf("%06s", $faker->numberBetween(100000, 999999)));
72+
}
73+
74+
protected function getExpectedFieldValueException($field)
75+
{
76+
return new \Genesis\Exceptions\InvalidArgument(
77+
"Please check input data for errors. '{$field}' has invalid format"
78+
);
79+
}
80+
81+
public function getMatchers()
82+
{
83+
return array(
84+
'beEmpty' => function ($subject) {
85+
return empty($subject);
86+
},
87+
);
88+
}
89+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
3+
namespace spec\Genesis\API\Request\Financial\GiftCards;
4+
5+
use PhpSpec\ObjectBehavior;
6+
7+
class IntersolveSpec extends ObjectBehavior
8+
{
9+
public function it_is_initializable()
10+
{
11+
$this->shouldHaveType('Genesis\API\Request\Financial\GiftCards\Intersolve');
12+
}
13+
14+
public function it_can_build_structure()
15+
{
16+
$this->setRequestParameters();
17+
$this->getDocument()->shouldNotBeEmpty();
18+
}
19+
20+
public function it_fails_when_no_parameters()
21+
{
22+
$this->shouldThrow('\Genesis\Exceptions\ErrorParameter')->during('getDocument');
23+
}
24+
25+
public function it_fails_when_missing_required_parameters()
26+
{
27+
$this->setRequestParameters();
28+
$this->setCardNumber(null);
29+
$this->shouldThrow()->during('getDocument');
30+
}
31+
32+
public function it_fails_when_card_number_is_not_only_digits()
33+
{
34+
$this->setRequestParameters();
35+
$this->setCardNumber(str_repeat('A', 22));
36+
37+
$this->shouldThrow(
38+
$this->getExpectedFieldValueException('card_number')
39+
)->during('getDocument');
40+
}
41+
42+
public function it_fails_when_invalid_currency_parameter()
43+
{
44+
$this->setRequestParameters();
45+
$this->setCurrency('ABC');
46+
47+
$this->shouldThrow()->during('getDocument');
48+
}
49+
50+
public function it_fails_when_unsupported_currency_parameter()
51+
{
52+
$this->setRequestParameters();
53+
$this->setCurrency('CNY');
54+
55+
$this->shouldThrow()->during('getDocument');
56+
}
57+
58+
protected function setRequestParameters()
59+
{
60+
$faker = \Faker\Factory::create();
61+
62+
$faker->addProvider(new \Faker\Provider\Payment($faker));
63+
$faker->addProvider(new \Faker\Provider\Internet($faker));
64+
65+
$this->setTransactionId($faker->numberBetween(1, PHP_INT_MAX));
66+
$this->setCurrency('EUR');
67+
$this->setAmount($faker->numberBetween(1, PHP_INT_MAX));
68+
$this->setUsage('Genesis PHP Client Automated Request');
69+
$this->setRemoteIp($faker->ipv4);
70+
$this->setCardNumber('7000001117376816512');
71+
$this->setCvv(sprintf("%06s", $faker->numberBetween(100000, 999999)));
72+
}
73+
74+
protected function getExpectedFieldValueException($field)
75+
{
76+
return new \Genesis\Exceptions\InvalidArgument(
77+
"Please check input data for errors. '{$field}' has invalid format"
78+
);
79+
}
80+
81+
public function getMatchers()
82+
{
83+
return array(
84+
'beEmpty' => function ($subject) {
85+
return empty($subject);
86+
},
87+
);
88+
}
89+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
3+
namespace spec\Genesis\API\Request\Financial\GiftCards;
4+
5+
use PhpSpec\ObjectBehavior;
6+
7+
class TcsSpec extends ObjectBehavior
8+
{
9+
public function it_is_initializable()
10+
{
11+
$this->shouldHaveType('Genesis\API\Request\Financial\GiftCards\Tcs');
12+
}
13+
14+
public function it_can_build_structure()
15+
{
16+
$this->setRequestParameters();
17+
$this->getDocument()->shouldNotBeEmpty();
18+
}
19+
20+
public function it_fails_when_no_parameters()
21+
{
22+
$this->shouldThrow('\Genesis\Exceptions\ErrorParameter')->during('getDocument');
23+
}
24+
25+
public function it_fails_when_missing_required_parameters()
26+
{
27+
$this->setRequestParameters();
28+
$this->setCardNumber(null);
29+
$this->shouldThrow()->during('getDocument');
30+
}
31+
32+
public function it_fails_when_card_number_is_not_only_digits()
33+
{
34+
$this->setRequestParameters();
35+
$this->setCardNumber(str_repeat('A', 22));
36+
37+
$this->shouldThrow(
38+
$this->getExpectedFieldValueException('card_number')
39+
)->during('getDocument');
40+
}
41+
42+
public function it_fails_when_invalid_currency_parameter()
43+
{
44+
$this->setRequestParameters();
45+
$this->setCurrency('ABC');
46+
47+
$this->shouldThrow()->during('getDocument');
48+
}
49+
50+
public function it_fails_when_unsupported_currency_parameter()
51+
{
52+
$this->setRequestParameters();
53+
$this->setCurrency('CNY');
54+
55+
$this->shouldThrow()->during('getDocument');
56+
}
57+
58+
protected function setRequestParameters()
59+
{
60+
$faker = \Faker\Factory::create();
61+
62+
$faker->addProvider(new \Faker\Provider\Payment($faker));
63+
$faker->addProvider(new \Faker\Provider\Internet($faker));
64+
65+
$this->setTransactionId($faker->numberBetween(1, PHP_INT_MAX));
66+
$this->setCurrency('EUR');
67+
$this->setAmount($faker->numberBetween(1, PHP_INT_MAX));
68+
$this->setUsage('Genesis PHP Client Automated Request');
69+
$this->setRemoteIp($faker->ipv4);
70+
$this->setCardNumber('6051460092247044443');
71+
$this->setCvv(sprintf("%06s", $faker->numberBetween(100000, 999999)));
72+
}
73+
74+
protected function getExpectedFieldValueException($field)
75+
{
76+
return new \Genesis\Exceptions\InvalidArgument(
77+
"Please check input data for errors. '{$field}' has invalid format"
78+
);
79+
}
80+
81+
public function getMatchers()
82+
{
83+
return array(
84+
'beEmpty' => function ($subject) {
85+
return empty($subject);
86+
},
87+
);
88+
}
89+
}

0 commit comments

Comments
 (0)