-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathquery_by_uid.php
49 lines (35 loc) · 1.49 KB
/
query_by_uid.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
<?php
require_once __DIR__ . '/../BeGateway.php';
require_once __DIR__ . '/test_shop_data.php';
BeGateway\Logger::getInstance()->setLogLevel(BeGateway\Logger::DEBUG);
$transaction = new BeGateway\PaymentOperation;
$amount = rand(1, 100);
$transaction->money->setAmount($amount);
$transaction->money->setCurrency('EUR');
$transaction->setDescription('test');
$transaction->setTrackingId('my_custom_variable');
$transaction->setTestMode(true);
$transaction->card->setCardNumber('4200000000000000');
$transaction->card->setCardHolder('JOHN DOE');
$transaction->card->setCardExpMonth('01');
$transaction->card->setCardExpYear(2030);
$transaction->card->setCardCvc('123');
$transaction->customer->setFirstName('John');
$transaction->customer->setLastName('Doe');
$transaction->customer->setCountry('LV');
$transaction->customer->setAddress('Demo str 12');
$transaction->customer->setCity('Riga');
$transaction->customer->setZip('LV-1082');
$transaction->customer->setIp('127.0.0.1');
$transaction->customer->setEmail('[email protected]');
$response = $transaction->submit();
echo 'Transaction message: ' . $response->getMessage() . PHP_EOL;
echo 'Transaction status: ' . $response->getStatus() . PHP_EOL;
if ($response->isSuccess()) {
echo 'Transaction UID: ' . $response->getUid() . PHP_EOL;
echo 'Trying to Query by UID ' . $response->getUid() . PHP_EOL;
$query = new BeGateway\QueryByUid;
$query->setUid($response->getUid());
$query_response = $query->submit();
print_r($query_response);
}