-
Notifications
You must be signed in to change notification settings - Fork 0
/
applePayHelperTypes.d.ts
195 lines (173 loc) · 3.97 KB
/
applePayHelperTypes.d.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
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
/**
* Configuration object for ApplePayHelper.
*/
export interface ApplePayConfig {
/**
* Your Apple Merchant ID.
*/
merchantId: string;
/**
* The display name for your merchant.
*/
displayName: string;
/**
* The initiative context (usually your domain).
*/
initiativeContext: string;
/**
* The initiative for the payment, typically "web" for web-based payments.
*/
initiative: string;
/**
* The payment processor's private key PEM file content.
*/
paymentProcessorPrivateKeyPem: string;
/**
* The merchant certificate only PEM file content.
*/
merchantCertOnlyPem: string;
/**
* The merchant private key only PEM file content.
*/
merchantKeyOnlyPem: string;
/**
* Validate the expiration date of the token and also verifies the certificate chain
* Defaults to true.
*/
isValidateExpirationDate?: boolean;
/**
* Token expiration window in milliseconds.
* Defaults to 5 minutes.
*/
tokenExpirationWindow?: number;
}
export interface StartSessionResponseFromApple {
epochTimestamp: number;
expiresAt: number;
merchantSessionIdentifier: string;
nonce: string;
merchantIdentifier: string;
domainName: string;
displayName: string;
signature: string;
operationalAnalyticsIdentifier: string;
retries: number;
pspId: string;
}
export interface ApplePaymentResponse extends PaymentResponse {
requestId: string;
methodName: string;
details: ApplePaymentResponse_Details;
shippingAddress: null;
shippingOption: null;
payerName: null;
payerEmail: null;
payerPhone: null;
}
export interface ApplePaymentResponse_Token {
paymentData: ApplePaymentResponse_PaymentData;
paymentMethod: ApplePaymentResponse_PaymentMethod;
transactionIdentifier: string;
}
export interface ApplePaymentResponse_PaymentData {
data: string;
signature: string;
header: ApplePaymentResponse_Header;
version: string;
}
// extend ApplePaymentResponse_PaymentData and add 'metadata' property
export interface ApplePaymentResponse_PaymentDataWithMetadata
extends ApplePaymentResponse_PaymentData {
metadata: WebhookMetaData;
}
export interface ApplePaymentResponse_Header {
publicKeyHash: string;
ephemeralPublicKey: string;
transactionId: string;
}
export interface ApplePaymentResponse_PaymentMethod {
displayName: string;
network: string;
type: string;
}
// decryption interfaces
export interface DecryptedTokenRaw {
applicationPrimaryAccountNumber: string;
applicationExpirationDate: string;
currencyCode: string;
transactionAmount: number;
deviceManufacturerIdentifier: string;
paymentDataType: string;
paymentData: DecryptedTokenRaw_PaymentData;
}
export interface DecryptedTokenRaw_PaymentData {
onlinePaymentCryptogram: string;
}
/**
* Decrypted token returned after decrypting an Apple Pay token.
*/
export interface PayCOMDecryptedToken {
/**
* The source data of the decrypted token.
*/
source_data: SourceData;
/**
* The amount associated with the token.
*/
amount: number;
/**
* The currency used in the token.
*/
currency: string;
}
/**
* Source data for the decrypted token.
*/
export interface SourceData {
/**
* The type of the source data.
*/
type: string;
/**
* The network token information.
*/
network_token: NetworkToken;
}
/**
* Network token information for the decrypted token's source data.
*/
export interface NetworkToken {
/**
* The token value.
*/
token: string;
/**
* The type of the token.
*/
token_type: string;
/**
* The expiration month of the token.
*/
expiry_month: string;
/**
* The expiration year of the token.
*/
expiry_year: string;
/**
* ThreeDS data for the token (3D Secure).
*/
three_ds: ThreeDs;
}
/**
* ThreeDS data for the decrypted token's network token.
*/
export interface ThreeDs {
/**
* The Electronic Commerce Indicator for the token.
*/
eci: string;
/**
* The cryptogram associated with the token.
*/
cryptogram: string;
}