Skip to content

Commit a64d98f

Browse files
authored
Merge pull request #59 from TransactPRO/A2A_transactions_added_to_lib
A2A transactions added to lib
2 parents 43fa976 + 669fdbb commit a64d98f

9 files changed

Lines changed: 227 additions & 20 deletions

File tree

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,43 @@ $response = $gateClient->doCredit(array(
287287
));
288288
```
289289

290+
291+
#### Init A2A transactions
292+
```php
293+
$response = $gateClient->initA2A(array(
294+
'rs' => 'AAAA',
295+
'merchant_transaction_id' => microtime(true),
296+
'user_ip' => '127.0.0.1',
297+
'description' => 'Test description',
298+
'amount' => '100',
299+
'currency' => 'LVL',
300+
'name_on_card' => 'Vasyly Pupkin',
301+
'street' => 'Main street 1',
302+
'zip' => 'LV-0000',
303+
'city' => 'Riga',
304+
'country' => 'LV',
305+
'state' => 'NA',
306+
'email' => 'email@example.lv',
307+
'phone' => '+371 11111111',
308+
'card_bin' => '511111',
309+
'bin_name' => 'BANK',
310+
'bin_phone' => '+371 11111111',
311+
'merchant_site_url' => 'http://www.example.com',
312+
'save_card' => '1',
313+
'cardname' => 'John Doe',
314+
'client_birth_date' => '29061988',
315+
));
316+
```
317+
318+
#### Do A2A transactions
319+
```php
320+
$response = $gateClient->doA2A(array(
321+
'f_extended' => '5',
322+
'init_transaction_id' => '13hpf5rp1e0ss72dypjnhalzn1wmrkfmsjtwzocg',
323+
'cc_2' => '5111111111111111',
324+
));
325+
```
326+
290327
#### Init store card for further SMS transactions without card
291328
```php
292329
$response = $gateClient->initStoreCardSms(array(
@@ -383,6 +420,9 @@ For P2P recurrent use:
383420
For Credit recurrent use:
384421
- initRecurrentP2P
385422

423+
For Credit recurrent use:
424+
- initRecurrentA2A
425+
386426
``Fields in these requests are same, read documetation for details.``
387427

388428
Example:
@@ -405,6 +445,9 @@ For P2P recurrent use:
405445
For Credit recurrent use:
406446
- doRecurrentP2P
407447

448+
For A2A recurrent use:
449+
- doRecurrentA2A
450+
408451
Example:
409452
```php
410453
$response = $gateClient->chargeRecurrent(array(
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace TransactPRO\Gate\Builders;
4+
5+
class DoA2ADataBuilder extends ChargeDataBuilder
6+
{
7+
public function build()
8+
{
9+
return array(
10+
'cc_2' => $this->getField('cc_2'),
11+
'init_transaction_id' => $this->getField('init_transaction_id'),
12+
'f_extended' => $this->getField('f_extended', 5),
13+
'expire2' => $this->getField('expire2'),
14+
'merchant_referring_url' => $this->getField('merchant_referring_url'),
15+
);
16+
}
17+
18+
protected function checkData()
19+
{
20+
$this->checkMandatoryField('cc_2');
21+
$this->checkMandatoryField('init_transaction_id');
22+
}
23+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace TransactPRO\Gate\Builders;
4+
5+
class DoRecurrentA2ADataBuilder extends ChargeRecurrentDataBuilder
6+
{
7+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace TransactPRO\Gate\Builders;
4+
5+
class InitA2ADataBuilder extends InitDataBuilder
6+
{
7+
public function build()
8+
{
9+
return array(
10+
'rs' => $this->getField('rs'),
11+
'merchant_transaction_id' => $this->getField('merchant_transaction_id'),
12+
'user_ip' => $this->getField('user_ip', $this->getRemoteAddress()),
13+
'description' => $this->getField('description'),
14+
'amount' => $this->getField('amount'),
15+
'currency' => $this->getField('currency'),
16+
'name_on_card' => $this->getField('name_on_card'),
17+
'street' => $this->getField('street'),
18+
'zip' => $this->getField('zip'),
19+
'city' => $this->getField('city'),
20+
'country' => $this->getField('country'),
21+
'state' => $this->getField('state', 'NA'),
22+
'email' => $this->getField('email'),
23+
'phone' => $this->getField('phone'),
24+
'card_bin' => $this->getField('card_bin'),
25+
'bin_name' => $this->getField('bin_name'),
26+
'bin_phone' => $this->getField('bin_phone'),
27+
'merchant_site_url' => $this->getField('merchant_site_url'),
28+
'save_card' => $this->getField('save_card'),
29+
'cardname' => $this->getField('cardname'),
30+
'recipient_name' => $this->getField('recipient_name'),
31+
'client_birth_date' => $this->getField('client_birth_date'),
32+
);
33+
}
34+
35+
protected function checkData()
36+
{
37+
$this->checkMandatoryField('rs');
38+
$this->checkMandatoryField('merchant_transaction_id');
39+
$this->checkMandatoryField('amount');
40+
$this->checkMandatoryField('currency');
41+
$this->checkMandatoryField('name_on_card');
42+
$this->checkMandatoryField('client_birth_date');
43+
}
44+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace TransactPRO\Gate\Builders;
4+
5+
class InitRecurrentA2ADataBuilder extends InitRecurrentDataBuilder
6+
{
7+
}

0 commit comments

Comments
 (0)