forked from tomaj/omnipay-tatra
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.php
67 lines (50 loc) · 1.61 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
use Omnipay\Omnipay;
require_once __DIR__ . '/vendor/autoload.php';
// $gateway = Omnipay::create('ComfortPay');
$gateway = Omnipay::create('TatraPay');
// $gateway = Omnipay::create('CardPay');
$gateway->setMid(1111);
// $gateway->setSharedSecret('11111111');
// $gateway->setSharedSecret('1111111111111111111111111111111111111111111111111111111111111111');
$gateway->setSharedSecret('11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111');
// $gateway->setTerminalId(1232);
// $gateway->setWs(12323);
// var_dump($gateway->getTerminalId()); die();
$gateway->setTestMode(true);
$response = $gateway->purchase([
'amount' => '10.00',
'currency' => 'EUR',
// 'ipc' => 'a',
// 'name' => 'ahoj',
'VS' => '123456',
'CS' => '0321',
'rurl' => 'http://localhost:4444/testserver.php',
])->send();
// $response = $gateway->checkCard([
// 'cardId' => '122',
// ])->send();
// $response = $gateway->listOfExpirePerId([
// 'cardIds' => ['122', '123421', '2354234'],
// ])->send();
// $response = $gateway->charge([
// 'transactionId' => '555555',
// 'cid' => '123',
// 'amount' => '10.00',
// 'currency' => 'EUR',
// 'VS' => '123455',
// 'CS' => '1234214',
// ])->send();
if ($response->isSuccessful()) {
// Payment was successful
// print_r($response);
echo "OK\n";
} elseif ($response->isRedirect()) {
// Redirect to offsite payment gateway
echo($response->getRedirectUrl() . "\n");
//$response->redirect();
} else {
echo "ERROR\n";
// Payment failed
echo $response->getMessage();
}