1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Config |
4
|
|
|
* |
5
|
|
|
* @author Pronamic <[email protected]> |
6
|
|
|
* @copyright 2005-2020 Pronamic |
7
|
|
|
* @license GPL-3.0-or-later |
8
|
|
|
* @package Pronamic\WordPress\Pay\Gateways\Payvision |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\Payvision; |
12
|
|
|
|
13
|
|
|
use Pronamic\WordPress\Pay\Core\GatewayConfig; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Config |
17
|
|
|
* |
18
|
|
|
* @author Remco Tolsma |
19
|
|
|
* @version 1.1.1 |
20
|
|
|
* @since 1.0.0 |
21
|
|
|
*/ |
22
|
|
|
class Config extends GatewayConfig implements \JsonSerializable { |
23
|
|
|
/** |
24
|
|
|
* Business Id. |
25
|
|
|
* |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
private $business_id; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* User. |
32
|
|
|
* |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
private $username; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Password. |
39
|
|
|
* |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
private $password; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Store ID. |
46
|
|
|
* |
47
|
|
|
* @var string |
48
|
|
|
*/ |
49
|
|
|
private $store_id; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Construct config object. |
53
|
|
|
* |
54
|
|
|
* @param string $mode Mode. |
55
|
|
|
* @param string $business_id Business Id. |
56
|
|
|
* @param string $username Username. |
57
|
|
|
* @param string $password Password. |
58
|
|
|
* @param string $store_id Store ID. |
59
|
|
|
*/ |
60
|
11 |
|
public function __construct( $mode, $business_id, $username, $password, $store_id ) { |
61
|
11 |
|
$this->mode = $mode; |
62
|
11 |
|
$this->business_id = $business_id; |
63
|
11 |
|
$this->username = $username; |
64
|
11 |
|
$this->password = $password; |
65
|
11 |
|
$this->store_id = $store_id; |
66
|
11 |
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Get business ID. |
70
|
|
|
* |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
3 |
|
public function get_business_id() { |
74
|
3 |
|
return $this->business_id; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Get username. |
79
|
|
|
* |
80
|
|
|
* @return string |
81
|
|
|
*/ |
82
|
6 |
|
public function get_username() { |
83
|
6 |
|
return $this->username; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Get password. |
88
|
|
|
* |
89
|
|
|
* @return string |
90
|
|
|
*/ |
91
|
6 |
|
public function get_password() { |
92
|
6 |
|
return $this->password; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Get store ID. |
97
|
|
|
* |
98
|
|
|
* @return string |
99
|
|
|
*/ |
100
|
3 |
|
public function get_store_id() { |
101
|
3 |
|
return $this->store_id; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Get endpoint URL. |
106
|
|
|
* |
107
|
|
|
* @link https://developers.acehubpaymentservices.com/docs/service-endpoints-and-headers |
108
|
|
|
* @param string $path Path. |
109
|
|
|
* @return string |
110
|
|
|
*/ |
111
|
8 |
|
public function get_endpoint_url( $path ) { |
112
|
8 |
|
if ( Gateway::MODE_TEST === $this->mode ) { |
113
|
7 |
|
return SystemAddress::STAGING_SYSTEM . $path; |
114
|
|
|
} |
115
|
|
|
|
116
|
1 |
|
return SystemAddress::LIVE_SYSTEM . $path; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* JSON serialize. |
121
|
|
|
* |
122
|
|
|
* @return object |
123
|
|
|
*/ |
124
|
2 |
|
public function jsonSerialize() { |
125
|
|
|
return (object) array( |
126
|
2 |
|
'mode' => $this->mode, |
127
|
2 |
|
'business_id' => $this->business_id, |
128
|
2 |
|
'username' => $this->username, |
129
|
2 |
|
'password' => $this->password, |
130
|
2 |
|
'store_id' => $this->store_id, |
131
|
|
|
); |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
|