-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathSdkConfig.php
More file actions
317 lines (279 loc) · 7.46 KB
/
SdkConfig.php
File metadata and controls
317 lines (279 loc) · 7.46 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<?php
declare(strict_types=1);
namespace Yoti\DocScan\Session\Create;
use Yoti\DocScan\Exception\DocScanException;
use Yoti\Util\Json;
class SdkConfig implements \JsonSerializable
{
/**
* @var string|null
*/
private $allowedCaptureMethods;
/**
* @var string|null
*/
private $primaryColour;
/**
* @var string|null
*/
private $secondaryColour;
/**
* @var string|null
*/
private $fontColour;
/**
* @var string|null
*/
private $locale;
/**
* @var string|null
*/
private $presetIssuingCountry;
/**
* @var string|null
*/
private $successUrl;
/**
* @var string|null
*/
private $errorUrl;
/**
* @var string|null
*/
private $privacyPolicyUrl;
/**
* @var bool|null
*/
private $allowHandoff;
/**
* @var bool|null
*/
private $enforceHandoff;
/**
* @var AttemptsConfiguration|null
*/
private $attemptsConfiguration;
/**
* @var string|null
*/
private $biometricConsentFlow;
/**
* @var string|null
*/
private $darkMode;
/**
* @var string|null
*/
private $primaryColourDarkMode;
/**
* @var string|null
*/
private $brandId;
/**
* @param string|null $allowedCaptureMethods
* @param string|null $primaryColour
* @param string|null $secondaryColour
* @param string|null $fontColour
* @param string|null $locale
* @param string|null $presetIssuingCountry
* @param string|null $successUrl
* @param string|null $errorUrl
* @param string|null $privacyPolicyUrl
* @param bool|null $allowHandoff
* @param bool|null $enforceHandoff
* @param array<string, int>|null $idDocumentTextDataExtractionRetriesConfig
* @param string|null $biometricConsentFlow
* @param string|null $darkMode
* @param string|null $primaryColourDarkMode
* @param string|null $brandId
*/
public function __construct(
?string $allowedCaptureMethods,
?string $primaryColour,
?string $secondaryColour,
?string $fontColour,
?string $locale,
?string $presetIssuingCountry,
?string $successUrl,
?string $errorUrl,
?string $privacyPolicyUrl = null,
?bool $allowHandoff = null,
?bool $enforceHandoff = null,
?array $idDocumentTextDataExtractionRetriesConfig = null,
?string $biometricConsentFlow = null,
?string $darkMode = null,
?string $primaryColourDarkMode = null,
?string $brandId = null
) {
$this->allowedCaptureMethods = $allowedCaptureMethods;
$this->primaryColour = $primaryColour;
$this->secondaryColour = $secondaryColour;
$this->fontColour = $fontColour;
$this->locale = $locale;
$this->presetIssuingCountry = $presetIssuingCountry;
$this->successUrl = $successUrl;
$this->errorUrl = $errorUrl;
$this->privacyPolicyUrl = $privacyPolicyUrl;
$this->allowHandoff = $allowHandoff;
$this->validateEnforceHandoff($allowHandoff, $enforceHandoff);
$this->enforceHandoff = $enforceHandoff;
if (!is_null($idDocumentTextDataExtractionRetriesConfig)) {
$this->attemptsConfiguration = new AttemptsConfiguration($idDocumentTextDataExtractionRetriesConfig);
}
$this->biometricConsentFlow = $biometricConsentFlow;
$this->darkMode = $darkMode;
$this->primaryColourDarkMode = $primaryColourDarkMode;
$this->brandId = $brandId;
}
/**
* @return \stdClass
*/
public function jsonSerialize(): \stdClass
{
return (object)Json::withoutNullValues([
'allowed_capture_methods' => $this->getAllowedCaptureMethods(),
'primary_colour' => $this->getPrimaryColour(),
'secondary_colour' => $this->getSecondaryColour(),
'font_colour' => $this->getFontColour(),
'locale' => $this->getLocale(),
'preset_issuing_country' => $this->getPresetIssuingCountry(),
'success_url' => $this->getSuccessUrl(),
'error_url' => $this->getErrorUrl(),
'privacy_policy_url' => $this->getPrivacyPolicyUrl(),
'allow_handoff' => $this->getAllowHandoff(),
'enforce_handoff' => $this->getEnforceHandoff(),
'attempts_configuration' => $this->getAttemptsConfiguration(),
'biometric_consent_flow' => $this->getBiometricConsentFlow(),
'dark_mode' => $this->getDarkMode(),
'primary_colour_dark_mode' => $this->getPrimaryColourDarkMode(),
'brand_id' => $this->getBrandId()
]);
}
/**
* Validates that enforce_handoff cannot be true when allow_handoff is false
*
* @param bool|null $allowHandoff
* @param bool|null $enforceHandoff
* @throws DocScanException
*/
private function validateEnforceHandoff(?bool $allowHandoff, ?bool $enforceHandoff): void
{
if ($enforceHandoff === true && $allowHandoff === false) {
throw new DocScanException(
'enforce_handoff cannot be set to true when allow_handoff is false'
);
}
}
/**
* @return string|null
*/
public function getAllowedCaptureMethods(): ?string
{
return $this->allowedCaptureMethods;
}
/**
* @return string|null
*/
public function getPrimaryColour(): ?string
{
return $this->primaryColour;
}
/**
* @return string|null
*/
public function getSecondaryColour(): ?string
{
return $this->secondaryColour;
}
/**
* @return string|null
*/
public function getFontColour(): ?string
{
return $this->fontColour;
}
/**
* @return string|null
*/
public function getLocale(): ?string
{
return $this->locale;
}
/**
* @return string|null
*/
public function getPresetIssuingCountry(): ?string
{
return $this->presetIssuingCountry;
}
/**
* @return string|null
*/
public function getSuccessUrl(): ?string
{
return $this->successUrl;
}
/**
* @return string|null
*/
public function getErrorUrl(): ?string
{
return $this->errorUrl;
}
/**
* @return string|null
*/
public function getPrivacyPolicyUrl(): ?string
{
return $this->privacyPolicyUrl;
}
/**
* @return bool|null
*/
public function getAllowHandoff(): ?bool
{
return $this->allowHandoff;
}
/**
* @return bool|null
*/
public function getEnforceHandoff(): ?bool
{
return $this->enforceHandoff;
}
/**
* @return AttemptsConfiguration|null
*/
public function getAttemptsConfiguration(): ?AttemptsConfiguration
{
return $this->attemptsConfiguration;
}
/**
* @return string|null
*/
public function getBiometricConsentFlow(): ?string
{
return $this->biometricConsentFlow;
}
/**
* @return string|null
*/
public function getDarkMode(): ?string
{
return $this->darkMode;
}
/**
* @return string|null
*/
public function getPrimaryColourDarkMode(): ?string
{
return $this->primaryColourDarkMode;
}
/**
* @return string|null
*/
public function getBrandId(): ?string
{
return $this->brandId;
}
}