-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy paththree-ds.ts
More file actions
705 lines (615 loc) · 21.7 KB
/
Copy paththree-ds.ts
File metadata and controls
705 lines (615 loc) · 21.7 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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as AuthenticationAPI from './authentication';
import {
Authentication,
AuthenticationSimulateOtpEntryParams,
AuthenticationSimulateParams,
AuthenticationSimulateResponse,
} from './authentication';
import * as DecisioningAPI from './decisioning';
import {
ChallengeResponse,
ChallengeResult,
Decisioning,
DecisioningChallengeResponseParams,
DecisioningRetrieveSecretResponse,
} from './decisioning';
export class ThreeDS extends APIResource {
authentication: AuthenticationAPI.Authentication = new AuthenticationAPI.Authentication(this._client);
decisioning: DecisioningAPI.Decisioning = new DecisioningAPI.Decisioning(this._client);
}
/**
* Represents a 3DS authentication
*/
export interface ThreeDSAuthentication {
/**
* Globally unique identifier for the 3DS authentication. Permitted values:
* 36-digit version 4 UUID (including hyphens).
*/
token: string;
/**
* Type of account/card that is being used for the transaction. Maps to EMV 3DS
* field `acctType`.
*/
account_type: 'CREDIT' | 'DEBIT' | 'NOT_APPLICABLE' | null;
/**
* Indicates the outcome of the 3DS authentication process.
*/
authentication_result: 'DECLINE' | 'SUCCESS' | 'PENDING_CHALLENGE' | 'PENDING_DECISION';
/**
* Indicates whether the expiration date provided by the cardholder during checkout
* matches Lithic's record of the card's expiration date.
*/
card_expiry_check: 'MATCH' | 'MISMATCH' | 'NOT_PRESENT';
/**
* Globally unique identifier for the card on which the 3DS authentication has
* occurred. Permitted values: 36-digit version 4 UUID (including hyphens).
*/
card_token: string;
/**
* Object containing data about the cardholder provided during the transaction.
*/
cardholder: ThreeDSAuthentication.Cardholder;
/**
* Channel in which the authentication occurs. Maps to EMV 3DS field
* `deviceChannel`.
*/
channel: 'APP_BASED' | 'BROWSER' | 'THREE_DS_REQUESTOR_INITIATED';
/**
* Date and time when the authentication was created in Lithic's system. Permitted
* values: Date string in the ISO 8601 format yyyy-MM-dd'T'hh:mm:ssZ.
*/
created: string;
/**
* Object containing data about the merchant involved in the e-commerce
* transaction.
*/
merchant: ThreeDSAuthentication.Merchant;
/**
* Either PAYMENT_AUTHENTICATION or NON_PAYMENT_AUTHENTICATION. For
* NON_PAYMENT_AUTHENTICATION, additional_data and transaction fields are not
* populated.
*/
message_category: 'NON_PAYMENT_AUTHENTICATION' | 'PAYMENT_AUTHENTICATION';
/**
* Indicates whether a challenge is requested for this transaction
*
* - `NO_PREFERENCE` - No Preference
* - `NO_CHALLENGE_REQUESTED` - No Challenge Requested
* - `CHALLENGE_PREFERENCE` - Challenge requested (3DS Requestor preference)
* - `CHALLENGE_MANDATE` - Challenge requested (Mandate)
* - `NO_CHALLENGE_RISK_ALREADY_ASSESSED` - No Challenge requested (Transactional
* risk analysis is already performed)
* - `DATA_SHARE_ONLY` - No Challenge requested (Data Share Only)
* - `OTHER` - Other indicators not captured by above. These are rarely used
*/
three_ds_requestor_challenge_indicator:
| 'NO_PREFERENCE'
| 'NO_CHALLENGE_REQUESTED'
| 'CHALLENGE_PREFERENCE'
| 'CHALLENGE_MANDATE'
| 'NO_CHALLENGE_RISK_ALREADY_ASSESSED'
| 'DATA_SHARE_ONLY'
| 'OTHER';
/**
* Object containing additional data about the 3DS request that is beyond the EMV
* 3DS standard spec (e.g., specific fields that only certain card networks send
* but are not required across all 3DS requests).
*/
additional_data?: ThreeDSAuthentication.AdditionalData | null;
/**
* Object containing data about the app used in the e-commerce transaction. Present
* if the channel is 'APP_BASED'.
*/
app?: ThreeDSAuthentication.App | null;
/**
* Type of authentication request - i.e., the type of transaction or interaction is
* causing the merchant to request an authentication. Maps to EMV 3DS field
* `threeDSRequestorAuthenticationInd`.
*/
authentication_request_type?:
| 'ADD_CARD'
| 'BILLING_AGREEMENT'
| 'DELAYED_SHIPMENT'
| 'EMV_TOKEN_CARDHOLDER_VERIFICATION'
| 'INSTALLMENT_TRANSACTION'
| 'MAINTAIN_CARD'
| 'PAYMENT_TRANSACTION'
| 'RECURRING_TRANSACTION'
| 'SPLIT_PAYMENT'
| 'SPLIT_SHIPMENT'
| null;
/**
* Object containing data about the browser used in the e-commerce transaction.
* Present if the channel is 'BROWSER'.
*/
browser?: ThreeDSAuthentication.Browser | null;
/**
* Metadata about the challenge method and delivery. Only present when a challenge
* is triggered.
*/
challenge_metadata?: ThreeDSAuthentication.ChallengeMetadata | null;
/**
* Entity that orchestrates the challenge. This won't be set for authentications
* for which a decision has not yet been made (e.g. in-flight customer decisioning
* request).
*/
challenge_orchestrated_by?: 'LITHIC' | 'CUSTOMER' | 'NO_CHALLENGE' | null;
/**
* Entity that made the authentication decision. This won't be set for
* authentications for which a decision has not yet been made (e.g. in-flight
* customer decisioning request).
*/
decision_made_by?:
| 'LITHIC_RULES'
| 'LITHIC_DEFAULT'
| 'CUSTOMER_RULES'
| 'CUSTOMER_ENDPOINT'
| 'NETWORK'
| 'UNKNOWN'
| null;
/**
* Type of 3DS Requestor Initiated (3RI) request — i.e., a 3DS authentication that
* takes place at the initiation of the merchant rather than the cardholder. The
* most common example of this is where a merchant is authenticating before billing
* for a recurring transaction such as a pay TV subscription or a utility bill.
* Maps to EMV 3DS field `threeRIInd`.
*/
three_ri_request_type?:
| 'ACCOUNT_VERIFICATION'
| 'ADD_CARD'
| 'BILLING_AGREEMENT'
| 'CARD_SECURITY_CODE_STATUS_CHECK'
| 'DELAYED_SHIPMENT'
| 'DEVICE_BINDING_STATUS_CHECK'
| 'INSTALLMENT_TRANSACTION'
| 'MAIL_ORDER'
| 'MAINTAIN_CARD_INFO'
| 'OTHER_PAYMENT'
| 'RECURRING_TRANSACTION'
| 'SPLIT_PAYMENT'
| 'SPLIT_SHIPMENT'
| 'TELEPHONE_ORDER'
| 'TOP_UP'
| 'TRUST_LIST_STATUS_CHECK'
| null;
/**
* Object containing data about the e-commerce transaction for which the merchant
* is requesting authentication.
*/
transaction?: ThreeDSAuthentication.Transaction | null;
}
export namespace ThreeDSAuthentication {
/**
* Object containing data about the cardholder provided during the transaction.
*/
export interface Cardholder {
/**
* Indicates whether the shipping address and billing address provided by the
* cardholder are the same. This value - and assessment of whether the addresses
* match - is provided directly in the 3DS request and is not determined by Lithic.
* Maps to EMV 3DS field `addrMatch`.
*/
address_match?: boolean | null;
/**
* Lithic's evaluation result comparing the transaction's address data with the
* cardholder KYC data if it exists. In the event Lithic does not have any
* Cardholder KYC data, or the transaction does not contain any address data,
* NOT_PRESENT will be returned
*/
address_on_file_match?: 'MATCH' | 'MATCH_ADDRESS_ONLY' | 'MATCH_ZIP_ONLY' | 'MISMATCH' | 'NOT_PRESENT';
/**
* Object containing data on the billing address provided during the transaction.
*/
billing_address?: Cardholder.BillingAddress;
/**
* Email address that is either provided by the cardholder or is on file with the
* merchant in a 3RI request. Maps to EMV 3DS field `email`.
*/
email?: string | null;
/**
* Name of the cardholder. Maps to EMV 3DS field `cardholderName`.
*/
name?: string | null;
/**
* Home phone number in E.164 format provided by the cardholder. Maps to EMV 3DS
* fields `homePhone.cc` and `homePhone.subscriber`.
*/
phone_number_home?: string | null;
/**
* Mobile/cell phone number in E.164 format provided by the cardholder. Maps to EMV
* 3DS fields `mobilePhone.cc` and `mobilePhone.subscriber`.
*/
phone_number_mobile?: string | null;
/**
* Work phone number in E.164 format provided by the cardholder. Maps to EMV 3DS
* fields `workPhone.cc` and `workPhone.subscriber`.
*/
phone_number_work?: string | null;
/**
* Object containing data on the shipping address provided during the transaction.
*/
shipping_address?: Cardholder.ShippingAddress;
}
export namespace Cardholder {
/**
* Object containing data on the billing address provided during the transaction.
*/
export interface BillingAddress {
/**
* First line of the street address provided by the cardholder.
*/
address1?: string | null;
/**
* Second line of the street address provided by the cardholder.
*/
address2?: string | null;
/**
* Third line of the street address provided by the cardholder.
*/
address3?: string | null;
/**
* City of the address provided by the cardholder.
*/
city?: string | null;
/**
* Country of the address provided by the cardholder in ISO 3166-1 alpha-3 format
* (e.g. USA)
*/
country?: string | null;
/**
* Postal code (e.g., ZIP code) of the address provided by the cardholder
*/
postal_code?: string | null;
}
/**
* Object containing data on the shipping address provided during the transaction.
*/
export interface ShippingAddress {
/**
* First line of the street address provided by the cardholder.
*/
address1?: string | null;
/**
* Second line of the street address provided by the cardholder.
*/
address2?: string | null;
/**
* Third line of the street address provided by the cardholder.
*/
address3?: string | null;
/**
* City of the address provided by the cardholder.
*/
city?: string | null;
/**
* Country of the address provided by the cardholder in ISO 3166-1 alpha-3 format
* (e.g. USA)
*/
country?: string | null;
/**
* Postal code (e.g., ZIP code) of the address provided by the cardholder
*/
postal_code?: string | null;
}
}
/**
* Object containing data about the merchant involved in the e-commerce
* transaction.
*/
export interface Merchant {
/**
* Object containing additional data indicating additional risk factors related to
* the e-commerce transaction.
*/
risk_indicator: Merchant.RiskIndicator;
/**
* Merchant identifier as assigned by the acquirer. Maps to EMV 3DS field
* `acquirerMerchantId`. May not be present for non-payment authentications.
*/
id?: string | null;
/**
* Country code of the merchant requesting 3DS authentication. Maps to EMV 3DS
* field `merchantCountryCode`. Permitted values: ISO 3166-1 alpha-3 country code
* (e.g., USA). May not be present for non-payment authentications.
*/
country?: string | null;
/**
* Merchant category code assigned to the merchant that describes its business
* activity type. Maps to EMV 3DS field `mcc`. May not be present for non-payment
* authentications.
*/
mcc?: string | null;
/**
* Name of the merchant. Maps to EMV 3DS field `merchantName`. May not be present
* for non-payment authentications.
*/
name?: string | null;
}
export namespace Merchant {
/**
* Object containing additional data indicating additional risk factors related to
* the e-commerce transaction.
*/
export interface RiskIndicator {
/**
* In transactions with electronic delivery, email address to which merchandise is
* delivered. Maps to EMV 3DS field `deliveryEmailAddress`.
*/
delivery_email_address?: string | null;
/**
* The delivery time frame for the merchandise. Maps to EMV 3DS field
* `deliveryTimeframe`.
*/
delivery_time_frame?:
| 'ELECTRONIC_DELIVERY'
| 'OVERNIGHT_SHIPPING'
| 'SAME_DAY_SHIPPING'
| 'TWO_DAY_OR_MORE_SHIPPING'
| null;
/**
* In prepaid or gift card purchase transactions, purchase amount total in major
* units (e.g., a purchase of USD $205.10 would be 205). Maps to EMV 3DS field
* `giftCardAmount`.
*/
gift_card_amount?: number | null;
/**
* In prepaid or gift card purchase transactions, count of individual prepaid or
* gift cards/codes purchased. Maps to EMV 3DS field `giftCardCount`.
*/
gift_card_count?: number | null;
/**
* In prepaid or gift card purchase transactions, currency code of the gift card.
* Maps to EMV 3DS field `giftCardCurr`. Permitted values: ISO 4217 three-character
* currency code (e.g., USD).
*/
gift_card_currency?: string | null;
/**
* Indicates whether the purchase is for merchandise that is available now or at a
* future date. Maps to EMV 3DS field `preOrderPurchaseInd`.
*/
order_availability?: 'FUTURE_AVAILABILITY' | 'MERCHANDISE_AVAILABLE' | null;
/**
* In pre-order purchase transactions, the expected date that the merchandise will
* be available. Maps to EMV 3DS field `preOrderDate`. Permitted values: Date
* string in the ISO 8601 format yyyy-MM-dd'T'hh:mm:ssZ
*/
pre_order_available_date?: string | null;
/**
* Indicates whether the cardholder is reordering previously purchased merchandise.
* Maps to EMV 3DS field `reorderItemsInd`.
*/
reorder_items?: 'FIRST_TIME_ORDERED' | 'REORDERED' | null;
/**
* Shipping method that the cardholder chose for the transaction. If purchase
* includes one or more item, this indicator is used for the physical goods; if the
* purchase only includes digital goods, this indicator is used to describe the
* most expensive item purchased. Maps to EMV 3DS field `shipIndicator`.
*/
shipping_method?:
| 'DIGITAL_GOODS'
| 'LOCKER_DELIVERY'
| 'OTHER'
| 'PICK_UP_AND_GO_DELIVERY'
| 'SHIP_TO_BILLING_ADDRESS'
| 'SHIP_TO_NON_BILLING_ADDRESS'
| 'SHIP_TO_OTHER_VERIFIED_ADDRESS'
| 'SHIP_TO_STORE'
| 'TRAVEL_AND_EVENT_TICKETS'
| null;
}
}
/**
* Object containing additional data about the 3DS request that is beyond the EMV
* 3DS standard spec (e.g., specific fields that only certain card networks send
* but are not required across all 3DS requests).
*/
export interface AdditionalData {
/**
* Mastercard only: Indicates whether the network would have considered the
* authentication request to be low risk or not.
*/
network_decision?: 'LOW_RISK' | 'NOT_LOW_RISK' | null;
/**
* Mastercard only: Assessment by the network of the authentication risk level,
* with a higher value indicating a higher amount of risk. Permitted values:
* Integer between 0-950, in increments of 50.
*/
network_risk_score?: number | null;
}
/**
* Object containing data about the app used in the e-commerce transaction. Present
* if the channel is 'APP_BASED'.
*/
export interface App {
/**
* Device model: e.g. "Apple iPhone 16".
*/
device?: string | null;
/**
* Raw device information - base64-encoded JSON object. Maps to EMV 3DS field
* `deviceInfo`.
*/
device_info?: string | null;
/**
* IP address of the device.
*/
ip?: string;
/**
* Latitude coordinate of current device location.
*/
latitude?: number | null;
/**
* Device locale: e.g. "en-US".
*/
locale?: string | null;
/**
* Longitude coordinate of current device location.
*/
longitude?: number | null;
/**
* Operating System: e.g. "Android 12", "iOS 17.1".
*/
os?: string | null;
/**
* Device platform: Android, iOS, Windows, etc.
*/
platform?: string | null;
/**
* Screen height in pixels.
*/
screen_height?: number | null;
/**
* Screen width in pixels.
*/
screen_width?: number | null;
/**
* Time zone offset in minutes between UTC and device local time.
*/
time_zone?: string | null;
}
/**
* Object containing data about the browser used in the e-commerce transaction.
* Present if the channel is 'BROWSER'.
*/
export interface Browser {
/**
* Content of the HTTP accept headers as sent from the cardholder's browser to the
* 3DS requestor (e.g., merchant or digital wallet).
*/
accept_header?: string | null;
/**
* IP address of the browser as returned by the HTTP headers to the 3DS requestor
* (e.g., merchant or digital wallet). Maps to EMV 3DS field `browserIP`.
*/
ip?: string | null;
/**
* Indicates whether the cardholder's browser has the ability to execute Java. Maps
* to EMV 3DS field `browserJavaEnabled`.
*/
java_enabled?: boolean | null;
/**
* Indicates whether the cardholder's browser has the ability to execute
* JavaScript. Maps to EMV 3DS field `browserJavascriptEnabled`.
*/
javascript_enabled?: boolean | null;
/**
* Language of the cardholder's browser as defined in IETF BCP47. Maps to EMV 3DS
* field `browserLanguage`.
*/
language?: string | null;
/**
* Time zone offset in minutes between UTC and browser local time. Maps to EMV 3DS
* field `browserTz`.
*/
time_zone?: string | null;
/**
* Content of the HTTP user-agent header. Maps to EMV 3DS field `browserUserAgent`.
*/
user_agent?: string | null;
}
/**
* Metadata about the challenge method and delivery. Only present when a challenge
* is triggered.
*/
export interface ChallengeMetadata {
/**
* The type of challenge method used for authentication.
*/
method_type: 'SMS_OTP' | 'OUT_OF_BAND';
/**
* Indicates the status of the challenge
*
* - SUCCESS - Cardholder completed the challenge successfully
* - PENDING - Challenge was issued to the cardholder and was not completed yet
* - SMS_DELIVERY_FAILED - Lithic confirmed undeliverability of the SMS to the
* provided phone number. Relevant only for SMS_OTP method
* - CARDHOLDER_TIMEOUT - Cardholder failed to complete the challenge within the
* given challenge TTL
* - CANCELED_VIA_CHALLENGE_UI - Cardholder canceled the challenge by selecting
* "cancel" on the challenge UI
* - CANCELED_OOB - Cardholder canceled the challenge out of band
* - ATTEMPTS_EXCEEDED - Cardholder failed the challenge by either entering an
* incorrect OTP more than the allowed number of times or requesting a new OTP
* more than the allowed number of times
* - ABORTED - Merchant aborted authentication after a challenge was requested
* - ERROR - The challenge failed for a reason different than those documented
*/
status:
| 'SUCCESS'
| 'PENDING'
| 'SMS_DELIVERY_FAILED'
| 'CARDHOLDER_TIMEOUT'
| 'CANCELED_VIA_CHALLENGE_UI'
| 'CANCELED_OOB'
| 'ATTEMPTS_EXCEEDED'
| 'ABORTED'
| 'ERROR';
/**
* The phone number used for delivering the OTP. Relevant only for SMS_OTP method.
*/
phone_number?: string | null;
}
/**
* Object containing data about the e-commerce transaction for which the merchant
* is requesting authentication.
*/
export interface Transaction {
/**
* Amount of the purchase in minor units of currency with all punctuation removed.
* Maps to EMV 3DS field `purchaseAmount`.
*/
amount: number;
/**
* Approximate amount of the purchase in minor units of cardholder currency.
* Derived from `amount` using a daily conversion rate.
*/
cardholder_amount: number | null;
/**
* Currency of the purchase. Maps to EMV 3DS field `purchaseCurrency`. Permitted
* values: ISO 4217 three-character currency code (e.g., USD).
*/
currency: string;
/**
* Minor units of currency, as specified in ISO 4217 currency exponent. Maps to EMV
* 3DS field `purchaseExponent`.
*/
currency_exponent: number;
/**
* Date and time when the authentication was generated by the merchant/acquirer's
* 3DS server. Maps to EMV 3DS field `purchaseDate`. Permitted values: Date string
* in the ISO 8601 format yyyy-MM-dd'T'hh:mm:ssZ.
*/
date_time: string;
/**
* Type of the transaction for which a 3DS authentication request is occurring.
* Maps to EMV 3DS field `transType`.
*/
type:
| 'ACCOUNT_FUNDING'
| 'CHECK_ACCEPTANCE'
| 'GOODS_SERVICE_PURCHASE'
| 'PREPAID_ACTIVATION_AND_LOAD'
| 'QUASI_CASH_TRANSACTION'
| null;
}
}
ThreeDS.Authentication = Authentication;
ThreeDS.Decisioning = Decisioning;
export declare namespace ThreeDS {
export { type ThreeDSAuthentication as ThreeDSAuthentication };
export {
Authentication as Authentication,
type AuthenticationSimulateResponse as AuthenticationSimulateResponse,
type AuthenticationSimulateParams as AuthenticationSimulateParams,
type AuthenticationSimulateOtpEntryParams as AuthenticationSimulateOtpEntryParams,
};
export {
Decisioning as Decisioning,
type ChallengeResponse as ChallengeResponse,
type ChallengeResult as ChallengeResult,
type DecisioningRetrieveSecretResponse as DecisioningRetrieveSecretResponse,
type DecisioningChallengeResponseParams as DecisioningChallengeResponseParams,
};
}