16
16
*/
17
17
class Config extends \Magento \Payment \Gateway \Config \Config
18
18
{
19
- const METHOD = 'authorizenet_acceptjs ' ;
20
- const KEY_LOGIN_ID = 'login ' ;
21
- const KEY_TRANSACTION_KEY = 'trans_key ' ;
22
- const KEY_ENVIRONMENT = 'environment ' ;
23
- const KEY_LEGACY_TRANSACTION_HASH = 'trans_md5 ' ;
24
- const KEY_SIGNATURE_KEY = 'trans_signature_key ' ;
25
- const KEY_PAYMENT_ACTION = 'payment_action ' ;
26
- const KEY_SHOULD_EMAIL_CUSTOMER = 'email_customer ' ;
27
- const KEY_ADDITIONAL_INFO_KEYS = 'paymentInfoKeys ' ;
28
- const KEY_CLIENT_KEY = 'public_client_key ' ;
29
- const KEY_CVV_ENABLED = 'cvv_enabled ' ;
30
- const KEY_TRANSACTION_SYNC_KEYS = 'transactionSyncKeys ' ;
31
- const ENDPOINT_URL_SANDBOX = 'https://apitest.authorize.net/xml/v1/request.api ' ;
32
- const ENDPOINT_URL_PRODUCTION = 'https://api.authorize.net/xml/v1/request.api ' ;
33
- const SOLUTION_ID_SANDBOX = 'AAA102993 ' ;
34
- const SOLUTION_ID_PRODUCTION = 'AAA175350 ' ;
19
+ /**
20
+ * @var string
21
+ */
22
+ private static $ keyLoginId = 'login ' ;
23
+
24
+ /**
25
+ * @var string
26
+ */
27
+ private static $ keyTransactionKey = 'trans_key ' ;
28
+
29
+ /**
30
+ * @var string
31
+ */
32
+ private static $ keyEnvironment = 'environment ' ;
33
+
34
+ /**
35
+ * @var string
36
+ */
37
+ private static $ keyLegacyTransactionHash = 'trans_md5 ' ;
38
+
39
+ /**
40
+ * @var string
41
+ */
42
+ private static $ keySignatureKey = 'trans_signature_key ' ;
43
+
44
+ /**
45
+ * @var string
46
+ */
47
+ private static $ keyPaymentAction = 'payment_action ' ;
48
+
49
+ /**
50
+ * @var string
51
+ */
52
+ private static $ keyShouldEmailCustomer = 'email_customer ' ;
53
+
54
+ /**
55
+ * @var string
56
+ */
57
+ private static $ keyAdditionalInfoKeys = 'paymentInfoKeys ' ;
58
+
59
+ /**
60
+ * @var string
61
+ */
62
+ private static $ keyClientKey = 'public_client_key ' ;
63
+
64
+ /**
65
+ * @var string
66
+ */
67
+ private static $ keyCvvEnabled = 'cvv_enabled ' ;
68
+
69
+ /**
70
+ * @var string
71
+ */
72
+ private static $ keyTransactionSyncKeys = 'transactionSyncKeys ' ;
73
+
74
+ /**
75
+ * @var string
76
+ */
77
+ private static $ endpointUrlSandbox = 'https://apitest.authorize.net/xml/v1/request.api ' ;
78
+
79
+ /**
80
+ * @var string
81
+ */
82
+ private static $ endpointUrlProduction = 'https://api.authorize.net/xml/v1/request.api ' ;
83
+
84
+ /**
85
+ * @var string
86
+ */
87
+ private static $ solutionIdSandbox = 'AAA102993 ' ;
88
+
89
+ /**
90
+ * @var string
91
+ */
92
+ private static $ solutionIdProduction = 'AAA175350 ' ;
93
+
94
+ /**
95
+ * @var string
96
+ */
97
+ private static $ environmentSandbox = 'sandbox ' ;
35
98
36
99
/**
37
100
* Gets the login id
@@ -41,7 +104,7 @@ class Config extends \Magento\Payment\Gateway\Config\Config
41
104
*/
42
105
public function getLoginId ($ storeId = null )
43
106
{
44
- return $ this ->getValue (Config::KEY_LOGIN_ID , $ storeId );
107
+ return $ this ->getValue (Config::$ keyLoginId , $ storeId );
45
108
}
46
109
47
110
/**
@@ -52,7 +115,7 @@ public function getLoginId($storeId = null)
52
115
*/
53
116
public function getEnvironment ($ storeId = null ): string
54
117
{
55
- return $ this ->getValue (Config::KEY_ENVIRONMENT , $ storeId );
118
+ return $ this ->getValue (Config::$ keyEnvironment , $ storeId );
56
119
}
57
120
58
121
/**
@@ -63,7 +126,7 @@ public function getEnvironment($storeId = null): string
63
126
*/
64
127
public function getTransactionKey ($ storeId = null )
65
128
{
66
- return $ this ->getValue (Config::KEY_TRANSACTION_KEY , $ storeId );
129
+ return $ this ->getValue (Config::$ keyTransactionKey , $ storeId );
67
130
}
68
131
69
132
/**
@@ -74,11 +137,11 @@ public function getTransactionKey($storeId = null)
74
137
*/
75
138
public function getApiUrl ($ storeId = null ): string
76
139
{
77
- $ environment = $ this ->getValue (Config::KEY_ENVIRONMENT , $ storeId );
140
+ $ environment = $ this ->getValue (Config::$ keyEnvironment , $ storeId );
78
141
79
- return $ environment === Environment:: ENVIRONMENT_SANDBOX
80
- ? self ::ENDPOINT_URL_SANDBOX
81
- : self ::ENDPOINT_URL_PRODUCTION ;
142
+ return $ environment === self :: $ environmentSandbox
143
+ ? self ::$ endpointUrlSandbox
144
+ : self ::$ endpointUrlProduction ;
82
145
}
83
146
84
147
/**
@@ -89,7 +152,7 @@ public function getApiUrl($storeId = null): string
89
152
*/
90
153
public function getTransactionSignatureKey ($ storeId = null )
91
154
{
92
- return $ this ->getValue (Config::KEY_SIGNATURE_KEY , $ storeId );
155
+ return $ this ->getValue (Config::$ keySignatureKey , $ storeId );
93
156
}
94
157
95
158
/**
@@ -100,7 +163,7 @@ public function getTransactionSignatureKey($storeId = null)
100
163
*/
101
164
public function getLegacyTransactionHash ($ storeId = null )
102
165
{
103
- return $ this ->getValue (Config::KEY_LEGACY_TRANSACTION_HASH , $ storeId );
166
+ return $ this ->getValue (Config::$ keyLegacyTransactionHash , $ storeId );
104
167
}
105
168
106
169
/**
@@ -111,7 +174,7 @@ public function getLegacyTransactionHash($storeId = null)
111
174
*/
112
175
public function getPaymentAction ($ storeId = null )
113
176
{
114
- return $ this ->getValue (Config::KEY_PAYMENT_ACTION , $ storeId );
177
+ return $ this ->getValue (Config::$ keyPaymentAction , $ storeId );
115
178
}
116
179
117
180
/**
@@ -122,7 +185,7 @@ public function getPaymentAction($storeId = null)
122
185
*/
123
186
public function getClientKey ($ storeId = null )
124
187
{
125
- return $ this ->getValue (Config::KEY_CLIENT_KEY , $ storeId );
188
+ return $ this ->getValue (Config::$ keyClientKey , $ storeId );
126
189
}
127
190
128
191
/**
@@ -133,7 +196,7 @@ public function getClientKey($storeId = null)
133
196
*/
134
197
public function shouldEmailCustomer ($ storeId = null ): bool
135
198
{
136
- return (bool )$ this ->getValue (Config::KEY_SHOULD_EMAIL_CUSTOMER , $ storeId );
199
+ return (bool )$ this ->getValue (Config::$ keyShouldEmailCustomer , $ storeId );
137
200
}
138
201
139
202
/**
@@ -144,7 +207,7 @@ public function shouldEmailCustomer($storeId = null): bool
144
207
*/
145
208
public function isCvvEnabled ($ storeId = null ): bool
146
209
{
147
- return (bool )$ this ->getValue (Config::KEY_CVV_ENABLED , $ storeId );
210
+ return (bool )$ this ->getValue (Config::$ keyCvvEnabled , $ storeId );
148
211
}
149
212
150
213
/**
@@ -155,11 +218,11 @@ public function isCvvEnabled($storeId = null): bool
155
218
*/
156
219
public function getSolutionId ($ storeId = null )
157
220
{
158
- $ environment = $ this ->getValue (Config::KEY_ENVIRONMENT , $ storeId );
221
+ $ environment = $ this ->getValue (Config::$ keyEnvironment , $ storeId );
159
222
160
- return $ environment === Environment:: ENVIRONMENT_SANDBOX
161
- ? self ::SOLUTION_ID_SANDBOX
162
- : self ::SOLUTION_ID_PRODUCTION ;
223
+ return $ environment === self :: $ environmentSandbox
224
+ ? self ::$ solutionIdSandbox
225
+ : self ::$ solutionIdProduction ;
163
226
}
164
227
165
228
/**
@@ -170,7 +233,7 @@ public function getSolutionId($storeId = null)
170
233
*/
171
234
public function getAdditionalInfoKeys ($ storeId = null ): array
172
235
{
173
- return explode (', ' , $ this ->getValue (Config::KEY_ADDITIONAL_INFO_KEYS , $ storeId ) ?? '' );
236
+ return explode (', ' , $ this ->getValue (Config::$ keyAdditionalInfoKeys , $ storeId ) ?? '' );
174
237
}
175
238
176
239
/**
@@ -181,6 +244,6 @@ public function getAdditionalInfoKeys($storeId = null): array
181
244
*/
182
245
public function getTransactionInfoSyncKeys ($ storeId = null ): array
183
246
{
184
- return explode (', ' , $ this ->getValue (Config::KEY_TRANSACTION_SYNC_KEYS , $ storeId ) ?? '' );
247
+ return explode (', ' , $ this ->getValue (Config::$ keyTransactionSyncKeys , $ storeId ) ?? '' );
185
248
}
186
249
}
0 commit comments