Total Complexity | 12 |
Total Lines | 77 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class TransactionManager |
||
6 | { |
||
7 | protected $driver; |
||
8 | protected $amount; |
||
9 | protected $orderId; |
||
10 | protected $callbackUrl; |
||
11 | protected $detail; |
||
12 | protected $config; |
||
13 | protected $transaction; |
||
14 | protected $request; |
||
15 | |||
16 | public function __construct() |
||
17 | { |
||
18 | $this->config = config('gateway'); |
||
19 | } |
||
20 | |||
21 | public function pay() |
||
22 | { |
||
23 | $object = $this->fireDriver(); |
||
24 | return $object->init($this->amount, $this->orderId, $this->callbackUrl, $this->detail); |
||
25 | } |
||
26 | |||
27 | public function verify() |
||
31 | } |
||
32 | |||
33 | public function getDriver() |
||
34 | { |
||
35 | (is_null($this->driver)) |
||
36 | ? $driver = $this->config['default'] |
||
37 | : $driver = $this->driver; |
||
38 | return $driver; |
||
39 | } |
||
40 | |||
41 | public function fireDriver() |
||
45 | } |
||
46 | |||
47 | // Has parameter |
||
48 | public function driver($driver = null) |
||
49 | { |
||
50 | $this->driver = $driver; |
||
51 | return $this; |
||
52 | } |
||
53 | |||
54 | public function amount($amount) |
||
55 | { |
||
56 | $this->amount = (int) $amount; |
||
57 | return $this; |
||
58 | } |
||
59 | |||
60 | public function orderId($orderId) |
||
61 | { |
||
62 | $this->orderId = $orderId; |
||
63 | return $this; |
||
64 | } |
||
65 | |||
66 | public function callbackUrl($callbackUrl) |
||
70 | } |
||
71 | |||
72 | public function request($request) |
||
73 | { |
||
74 | $this->request = $request; |
||
75 | return $this; |
||
76 | } |
||
77 | |||
78 | public function detail($detail = []) |
||
82 | } |
||
83 | } |
||
84 |