-
Notifications
You must be signed in to change notification settings - Fork 181
/
PSD2.ts
95 lines (83 loc) · 1.98 KB
/
PSD2.ts
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
import { PSD2Parameters } from '../types';
import { VerifyWorkflows, VerifyLanguages } from '../enums';
/**
* Represents parameters for a PSD2 (Payment Services Directive 2) verification
* request.
*/
export class PSD2 implements PSD2Parameters {
/**
* The phone number to be verified.
*/
number: string;
/**
* The payee's name or identifier for the payment confirmation.
*/
payee: string;
/**
* The decimal amount of the payment to be confirmed, in Euros.
*/
amount: number;
/**
* The country code associated with the phone number (optional).
*/
country?: string;
/**
* The desired length of the verification code (optional).
*/
codeLength?: number;
/**
* @deprecated This property is deprecated. Use `lg` instead.
*/
language?: string;
/**
* The language for sending verification messages (optional).
*/
lg?: VerifyLanguages;
/**
* The duration in seconds for which the verification code will be valid.
*/
pinExpiry?: number;
/**
* The duration in seconds to wait before sending the next verification event.
*/
nextEventWait?: number;
/**
* The workflow ID for customizing the verification process (optional).
*/
workflowId?: VerifyWorkflows;
constructor(
phoneNumber: string,
payee: string,
amount: number,
country?: string,
codeLength?: number,
language?: VerifyLanguages,
lg?: VerifyLanguages,
pinExpiry?: number,
nextEventWait?: number,
workflowId?: VerifyWorkflows,
) {
this.number = phoneNumber;
this.amount = amount;
this.payee = payee;
if (country) {
this.country = country;
}
if (codeLength) {
this.codeLength = codeLength;
}
if (language) {
this.lg = language;
this.language = language;
}
if (pinExpiry) {
this.pinExpiry = pinExpiry;
}
if (nextEventWait) {
this.nextEventWait = nextEventWait;
}
if (workflowId) {
this.workflowId = workflowId;
}
}
}