Skip to content

Commit

Permalink
Merge pull request #59 from TransactPRO/A2A_transactions_added_to_lib
Browse files Browse the repository at this point in the history
A2A transactions added to lib
  • Loading branch information
pashira authored Jul 23, 2020
2 parents 43fa976 + 669fdbb commit a64d98f
Show file tree
Hide file tree
Showing 9 changed files with 227 additions and 20 deletions.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,43 @@ $response = $gateClient->doCredit(array(
));
```


#### Init A2A transactions
```php
$response = $gateClient->initA2A(array(
'rs' => 'AAAA',
'merchant_transaction_id' => microtime(true),
'user_ip' => '127.0.0.1',
'description' => 'Test description',
'amount' => '100',
'currency' => 'LVL',
'name_on_card' => 'Vasyly Pupkin',
'street' => 'Main street 1',
'zip' => 'LV-0000',
'city' => 'Riga',
'country' => 'LV',
'state' => 'NA',
'email' => '[email protected]',
'phone' => '+371 11111111',
'card_bin' => '511111',
'bin_name' => 'BANK',
'bin_phone' => '+371 11111111',
'merchant_site_url' => 'http://www.example.com',
'save_card' => '1',
'cardname' => 'John Doe',
'client_birth_date' => '29061988',
));
```

#### Do A2A transactions
```php
$response = $gateClient->doA2A(array(
'f_extended' => '5',
'init_transaction_id' => '13hpf5rp1e0ss72dypjnhalzn1wmrkfmsjtwzocg',
'cc_2' => '5111111111111111',
));
```

#### Init store card for further SMS transactions without card
```php
$response = $gateClient->initStoreCardSms(array(
Expand Down Expand Up @@ -383,6 +420,9 @@ For P2P recurrent use:
For Credit recurrent use:
- initRecurrentP2P

For Credit recurrent use:
- initRecurrentA2A

``Fields in these requests are same, read documetation for details.``

Example:
Expand All @@ -405,6 +445,9 @@ For P2P recurrent use:
For Credit recurrent use:
- doRecurrentP2P

For A2A recurrent use:
- doRecurrentA2A

Example:
```php
$response = $gateClient->chargeRecurrent(array(
Expand Down
23 changes: 23 additions & 0 deletions lib/TransactPRO/Gate/Builders/DoA2ADataBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace TransactPRO\Gate\Builders;

class DoA2ADataBuilder extends ChargeDataBuilder
{
public function build()
{
return array(
'cc_2' => $this->getField('cc_2'),
'init_transaction_id' => $this->getField('init_transaction_id'),
'f_extended' => $this->getField('f_extended', 5),
'expire2' => $this->getField('expire2'),
'merchant_referring_url' => $this->getField('merchant_referring_url'),
);
}

protected function checkData()
{
$this->checkMandatoryField('cc_2');
$this->checkMandatoryField('init_transaction_id');
}
}
7 changes: 7 additions & 0 deletions lib/TransactPRO/Gate/Builders/DoRecurrentA2ADataBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace TransactPRO\Gate\Builders;

class DoRecurrentA2ADataBuilder extends ChargeRecurrentDataBuilder
{
}
44 changes: 44 additions & 0 deletions lib/TransactPRO/Gate/Builders/InitA2ADataBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace TransactPRO\Gate\Builders;

class InitA2ADataBuilder extends InitDataBuilder
{
public function build()
{
return array(
'rs' => $this->getField('rs'),
'merchant_transaction_id' => $this->getField('merchant_transaction_id'),
'user_ip' => $this->getField('user_ip', $this->getRemoteAddress()),
'description' => $this->getField('description'),
'amount' => $this->getField('amount'),
'currency' => $this->getField('currency'),
'name_on_card' => $this->getField('name_on_card'),
'street' => $this->getField('street'),
'zip' => $this->getField('zip'),
'city' => $this->getField('city'),
'country' => $this->getField('country'),
'state' => $this->getField('state', 'NA'),
'email' => $this->getField('email'),
'phone' => $this->getField('phone'),
'card_bin' => $this->getField('card_bin'),
'bin_name' => $this->getField('bin_name'),
'bin_phone' => $this->getField('bin_phone'),
'merchant_site_url' => $this->getField('merchant_site_url'),
'save_card' => $this->getField('save_card'),
'cardname' => $this->getField('cardname'),
'recipient_name' => $this->getField('recipient_name'),
'client_birth_date' => $this->getField('client_birth_date'),
);
}

protected function checkData()
{
$this->checkMandatoryField('rs');
$this->checkMandatoryField('merchant_transaction_id');
$this->checkMandatoryField('amount');
$this->checkMandatoryField('currency');
$this->checkMandatoryField('name_on_card');
$this->checkMandatoryField('client_birth_date');
}
}
7 changes: 7 additions & 0 deletions lib/TransactPRO/Gate/Builders/InitRecurrentA2ADataBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace TransactPRO\Gate\Builders;

class InitRecurrentA2ADataBuilder extends InitRecurrentDataBuilder
{
}
Loading

0 comments on commit a64d98f

Please sign in to comment.