Repository navigation
Expand file tree
/
Copy pathTestTransaction.php
More file actions
86 lines (75 loc) · 2.19 KB
/
Copy pathTestTransaction.php
File metadata and controls
86 lines (75 loc) · 2.19 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
use Opay\Result\Response;
require_once('../Initialize.php');
require_once('../Config.php');
require_once('./Transaction.php');
class TestTransaction
{
private $transaction;
public function __construct()
{
$this->transaction = new Transaction();
}
public function test()
{
$count = 0;
/**
* One of three options
*
* $response = $this->transaction->initByBankaccount();
* $response = $this->transaction->initByBankcard();
* $response = $this->transaction->initByToken();
*/
$response = $this->transaction->initByBankaccount();
START:
if ($response->getCode() == '00000') {
switch ($response->getData()->getStatus()) {
case 'INITIAL':
case 'PENDING':
{
$response = $this->transaction->getStatus();
goto START;
}
case 'INPUT-PIN':
{
$response = $this->transaction->setPin();
goto START;
}
case 'INPUT-OTP':
{
$response = $this->transaction->setOtp();
goto START;
}
case 'INPUT-PHONE':
{
$response = $this->transaction->setPhone();
goto START;
}
case 'INPUT-DOB':
{
$response = $this->transaction->setDob();
goto START;
}
case '3DSECURE'://有次数限制
{
if ($count >= 10) {
break;
}
$response = $this->transaction->getStatus();
$count++;
goto START;
}
case 'FAIL':
case 'CLOSE':
case 'SUCCESS':
{
break;
}
}
dump($response);
} else {
dump($response->getMessage());
}
}
}
(new TestTransaction())->test();