-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathv2.ts
More file actions
3717 lines (3336 loc) · 122 KB
/
Copy pathv2.ts
File metadata and controls
3717 lines (3336 loc) · 122 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
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../../core/resource';
import * as V2API from './v2';
import * as BacktestsAPI from './backtests';
import {
BacktestCreateParams,
BacktestCreateResponse,
BacktestResults,
BacktestRetrieveParams,
Backtests,
} from './backtests';
import { APIPromise } from '../../../core/api-promise';
import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination';
import { RequestOptions } from '../../../internal/request-options';
import { path } from '../../../internal/utils/path';
export class V2 extends APIResource {
backtests: BacktestsAPI.Backtests = new BacktestsAPI.Backtests(this._client);
/**
* Creates a new V2 Auth rule in draft mode
*/
create(body: V2CreateParams, options?: RequestOptions): APIPromise<AuthRule> {
return this._client.post('/v2/auth_rules', { body, ...options });
}
/**
* Fetches a V2 Auth rule by its token
*/
retrieve(authRuleToken: string, options?: RequestOptions): APIPromise<AuthRule> {
return this._client.get(path`/v2/auth_rules/${authRuleToken}`, options);
}
/**
* Updates a V2 Auth rule's properties
*
* If `account_tokens`, `card_tokens`, `program_level`, `excluded_card_tokens`,
* `excluded_account_tokens`, or `excluded_business_account_tokens` is provided,
* this will replace existing associations with the provided list of entities.
*/
update(authRuleToken: string, body: V2UpdateParams, options?: RequestOptions): APIPromise<AuthRule> {
return this._client.patch(path`/v2/auth_rules/${authRuleToken}`, { body, ...options });
}
/**
* Lists V2 Auth rules
*/
list(
query: V2ListParams | null | undefined = {},
options?: RequestOptions,
): PagePromise<AuthRulesCursorPage, AuthRule> {
return this._client.getAPIList('/v2/auth_rules', CursorPage<AuthRule>, { query, ...options });
}
/**
* Deletes a V2 Auth rule
*/
delete(authRuleToken: string, options?: RequestOptions): APIPromise<void> {
return this._client.delete(path`/v2/auth_rules/${authRuleToken}`, options);
}
/**
* Creates a new draft version of a rule that will be ran in shadow mode.
*
* This can also be utilized to reset the draft parameters, causing a draft version
* to no longer be ran in shadow mode.
*/
draft(authRuleToken: string, body: V2DraftParams, options?: RequestOptions): APIPromise<AuthRule> {
return this._client.post(path`/v2/auth_rules/${authRuleToken}/draft`, { body, ...options });
}
/**
* Lists Auth Rule evaluation results.
*
* **Limitations:**
*
* - Results are available for the past 3 months only
* - At least one filter (`event_token` or `auth_rule_token`) must be provided
* - When filtering by `event_token`, pagination is not supported
*/
listResults(
query: V2ListResultsParams | null | undefined = {},
options?: RequestOptions,
): PagePromise<V2ListResultsResponsesCursorPage, V2ListResultsResponse> {
return this._client.getAPIList('/v2/auth_rules/results', CursorPage<V2ListResultsResponse>, {
query,
...options,
});
}
/**
* Returns all versions of an auth rule, sorted by version number descending
* (newest first).
*/
listVersions(authRuleToken: string, options?: RequestOptions): APIPromise<V2ListVersionsResponse> {
return this._client.get(path`/v2/auth_rules/${authRuleToken}/versions`, options);
}
/**
* Promotes the draft version of an Auth rule to the currently active version such
* that it is enforced in the respective stream.
*/
promote(authRuleToken: string, options?: RequestOptions): APIPromise<AuthRule> {
return this._client.post(path`/v2/auth_rules/${authRuleToken}/promote`, options);
}
/**
* Fetches the current calculated Feature values for the given Auth Rule
*
* This only calculates the features for the active version.
*
* - VelocityLimit Rules calculates the current Velocity Feature data. This
* requires a `card_token` or `account_token` matching what the rule is Scoped
* to.
* - ConditionalBlock Rules calculates the CARD*TRANSACTION_COUNT*\* attributes on
* the rule. This requires a `card_token`
*/
retrieveFeatures(
authRuleToken: string,
query: V2RetrieveFeaturesParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<V2RetrieveFeaturesResponse> {
return this._client.get(path`/v2/auth_rules/${authRuleToken}/features`, { query, ...options });
}
/**
* Retrieves a performance report for an Auth rule containing daily statistics and
* evaluation outcomes.
*
* **Time Range Limitations:**
*
* - Reports are supported for the past 3 months only
* - Maximum interval length is 1 month
* - Report data is available only through the previous day in UTC (current day
* data is not available)
*
* The report provides daily statistics for both current and draft versions of the
* Auth rule, including approval, decline, and challenge counts along with sample
* events.
*/
retrieveReport(
authRuleToken: string,
query: V2RetrieveReportParams,
options?: RequestOptions,
): APIPromise<V2RetrieveReportResponse> {
return this._client.get(path`/v2/auth_rules/${authRuleToken}/report`, { query, ...options });
}
}
export type AuthRulesCursorPage = CursorPage<AuthRule>;
export type V2ListResultsResponsesCursorPage = CursorPage<V2ListResultsResponse>;
export type ACHPaymentUpdateAction =
| ACHPaymentUpdateAction.TagAction
| ACHPaymentUpdateAction.CreateCaseAction;
export namespace ACHPaymentUpdateAction {
export interface TagAction {
/**
* The key of the tag to apply to the payment
*/
key: string;
/**
* Tag the payment with key-value metadata
*/
type: 'TAG';
/**
* The value of the tag to apply to the payment
*/
value: string;
}
export interface CreateCaseAction {
/**
* The token of the queue to create the case in
*/
queue_token: string;
/**
* The scope of the case to create
*/
scope: 'FINANCIAL_ACCOUNT';
/**
* Create a case for the payment
*/
type: 'CREATE_CASE';
}
}
export interface AuthRule {
/**
* Auth Rule Token
*/
token: string;
/**
* Account tokens to which the Auth Rule applies.
*/
account_tokens: Array<string>;
/**
* Business Account tokens to which the Auth Rule applies.
*/
business_account_tokens: Array<string>;
/**
* Card tokens to which the Auth Rule applies.
*/
card_tokens: Array<string>;
current_version: AuthRule.CurrentVersion | null;
draft_version: AuthRule.DraftVersion | null;
/**
* The event stream during which the rule will be evaluated.
*/
event_stream: EventStream;
/**
* Indicates whether this auth rule is managed by Lithic. If true, the rule cannot
* be modified or deleted by the user
*/
lithic_managed: boolean;
/**
* Auth Rule Name
*/
name: string | null;
/**
* Whether the Auth Rule applies to all authorizations on the card program.
*/
program_level: boolean;
/**
* The state of the Auth Rule
*/
state: 'ACTIVE' | 'INACTIVE';
/**
* The type of Auth Rule. For certain rule types, this determines the event stream
* during which it will be evaluated. For rules that can be applied to one of
* several event streams, the effective one is defined by the separate
* `event_stream` field.
*
* - `CONDITIONAL_BLOCK`: Deprecated. Use `CONDITIONAL_ACTION` instead.
* AUTHORIZATION event stream.
* - `VELOCITY_LIMIT`: AUTHORIZATION event stream.
* - `MERCHANT_LOCK`: AUTHORIZATION event stream.
* - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
* ACH_CREDIT_RECEIPT, ACH_DEBIT_RECEIPT, CARD_TRANSACTION_UPDATE, or
* ACH_PAYMENT_UPDATE event stream.
* - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
* ACH_CREDIT_RECEIPT, ACH_DEBIT_RECEIPT, CARD_TRANSACTION_UPDATE, or
* ACH_PAYMENT_UPDATE event stream.
*/
type: 'CONDITIONAL_BLOCK' | 'VELOCITY_LIMIT' | 'MERCHANT_LOCK' | 'CONDITIONAL_ACTION' | 'TYPESCRIPT_CODE';
/**
* Account tokens to which the Auth Rule does not apply.
*/
excluded_account_tokens?: Array<string>;
/**
* Business account tokens to which the Auth Rule does not apply.
*/
excluded_business_account_tokens?: Array<string>;
/**
* Card tokens to which the Auth Rule does not apply.
*/
excluded_card_tokens?: Array<string>;
}
export namespace AuthRule {
export interface CurrentVersion {
/**
* Parameters for the Auth Rule
*/
parameters:
| V2API.ConditionalBlockParameters
| V2API.VelocityLimitParams
| V2API.MerchantLockParameters
| V2API.Conditional3DSActionParameters
| V2API.ConditionalAuthorizationActionParameters
| V2API.ConditionalACHActionParameters
| V2API.ConditionalTokenizationActionParameters
| V2API.ConditionalCardTransactionUpdateActionParameters
| V2API.ConditionalACHPaymentUpdateActionParameters
| V2API.TypescriptCodeParameters
| V2API.ConditionalAuthorizationAdjustmentParameters;
/**
* The version of the rule, this is incremented whenever the rule's parameters
* change.
*/
version: number;
}
export interface DraftVersion {
/**
* An error message if the draft version failed compilation. Populated when `state`
* is `ERROR`, `null` otherwise.
*/
error: string | null;
/**
* Parameters for the Auth Rule
*/
parameters:
| V2API.ConditionalBlockParameters
| V2API.VelocityLimitParams
| V2API.MerchantLockParameters
| V2API.Conditional3DSActionParameters
| V2API.ConditionalAuthorizationActionParameters
| V2API.ConditionalACHActionParameters
| V2API.ConditionalTokenizationActionParameters
| V2API.ConditionalCardTransactionUpdateActionParameters
| V2API.ConditionalACHPaymentUpdateActionParameters
| V2API.TypescriptCodeParameters
| V2API.ConditionalAuthorizationAdjustmentParameters;
/**
* The state of the draft version. Most rules are created synchronously and the
* state is immediately `SHADOWING`. Rules backed by TypeScript code are compiled
* asynchronously — the state starts as `PENDING` and transitions to `SHADOWING` on
* success or `ERROR` on failure.
*
* - `PENDING`: Compilation of the rule is in progress (TypeScript rules only).
* - `SHADOWING`: The draft version is ready and evaluating in shadow mode
* alongside the current active version. It can be promoted to the active
* version.
* - `ERROR`: Compilation of the rule failed. Check the `error` field for details.
*/
state: 'PENDING' | 'SHADOWING' | 'ERROR';
/**
* The version of the rule, this is incremented whenever the rule's parameters
* change.
*/
version: number;
}
}
export interface AuthRuleCondition {
/**
* The attribute to target.
*
* The following attributes may be targeted:
*
* - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a
* business by the types of goods or services it provides.
* - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all
* ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for
* Netherlands Antilles.
* - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of
* the transaction.
* - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor
* (merchant).
* - `DESCRIPTOR`: Short description of card acceptor.
* - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer
* applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or
* `TOKEN_AUTHENTICATED`.
* - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number
* (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`,
* `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`,
* `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`,
* `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`.
* - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer
* fee field in the settlement/cardholder billing currency. This is the amount
* the issuer should authorize against unless the issuer is paying the acquirer
* fee on behalf of the cardholder.
* - `RISK_SCORE`: Network-provided score assessing risk level associated with a
* given authorization. Scores are on a range of 0-999, with 0 representing the
* lowest risk and 999 representing the highest risk. For Visa transactions,
* where the raw score has a range of 0-99, Lithic will normalize the score by
* multiplying the raw score by 10x.
* - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the
* trailing 15 minutes before the authorization.
* - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the
* trailing hour up and until the authorization.
* - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the
* trailing 24 hours up and until the authorization.
* - `CARD_STATE`: The current state of the card associated with the transaction.
* Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`,
* `PENDING_FULFILLMENT`.
* - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction.
* Valid values are `TRUE`, `FALSE`.
* - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`,
* `OK`, `BLOCKED`.
* - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the
* source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`,
* `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`.
* - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address
* data with the cardholder KYC data if it exists. Valid values are `MATCH`,
* `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`.
*/
attribute: ConditionalAttribute;
/**
* The operation to apply to the attribute
*/
operation: ConditionalOperation;
/**
* A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
*/
value: ConditionalValue;
}
export interface AuthRuleVersion {
/**
* Timestamp of when this version was created.
*/
created: string;
/**
* Parameters for the Auth Rule
*/
parameters:
| ConditionalBlockParameters
| VelocityLimitParams
| MerchantLockParameters
| Conditional3DSActionParameters
| ConditionalAuthorizationActionParameters
| ConditionalACHActionParameters
| ConditionalTokenizationActionParameters
| ConditionalCardTransactionUpdateActionParameters
| ConditionalACHPaymentUpdateActionParameters
| TypescriptCodeParameters
| ConditionalAuthorizationAdjustmentParameters;
/**
* The current state of this version.
*/
state: 'ACTIVE' | 'SHADOW' | 'INACTIVE';
/**
* The version of the rule, this is incremented whenever the rule's parameters
* change.
*/
version: number;
}
export interface BacktestStats {
/**
* The total number of historical transactions approved by this rule during the
* backtest period, or the number of transactions that would have been approved if
* the rule was evaluated in shadow mode.
*/
approved?: number;
/**
* The total number of historical transactions challenged by this rule during the
* backtest period, or the number of transactions that would have been challenged
* if the rule was evaluated in shadow mode. Currently applicable only for 3DS Auth
* Rules.
*/
challenged?: number;
/**
* The total number of historical transactions declined by this rule during the
* backtest period, or the number of transactions that would have been declined if
* the rule was evaluated in shadow mode.
*/
declined?: number;
/**
* Example events and their outcomes.
*/
examples?: Array<BacktestStats.Example>;
/**
* The version of the rule, this is incremented whenever the rule's parameters
* change.
*/
version?: number;
}
export namespace BacktestStats {
export interface Example {
/**
* The decision made by the rule for this event.
*/
decision?: 'APPROVED' | 'DECLINED' | 'CHALLENGED';
/**
* The event token.
*/
event_token?: string;
/**
* The timestamp of the event.
*/
timestamp?: string;
/**
* The token of the transaction associated with the event
*/
transaction_token?: string | null;
}
}
export type CardTransactionUpdateAction =
| CardTransactionUpdateAction.TagAction
| CardTransactionUpdateAction.CreateCaseAction;
export namespace CardTransactionUpdateAction {
export interface TagAction {
/**
* The key of the tag to apply to the transaction
*/
key: string;
/**
* Tag the transaction with key-value metadata
*/
type: 'TAG';
/**
* The value of the tag to apply to the transaction
*/
value: string;
}
export interface CreateCaseAction {
/**
* The token of the queue to create the case in
*/
queue_token: string;
/**
* The scope of the case to create
*/
scope: 'CARD' | 'ACCOUNT';
/**
* Create a case for the transaction
*/
type: 'CREATE_CASE';
}
}
export interface Conditional3DSActionParameters {
/**
* The action to take if the conditions are met.
*/
action: 'DECLINE' | 'CHALLENGE';
conditions: Array<Conditional3DSActionParameters.Condition>;
}
export namespace Conditional3DSActionParameters {
export interface Condition {
/**
* The attribute to target.
*
* The following attributes may be targeted:
*
* - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a
* business by the types of goods or services it provides.
* - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all
* ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for
* Netherlands Antilles.
* - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of
* the transaction.
* - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor
* (merchant).
* - `DESCRIPTOR`: Short description of card acceptor.
* - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer
* fee field in the settlement/cardholder billing currency. This is the amount
* the issuer should authorize against unless the issuer is paying the acquirer
* fee on behalf of the cardholder. Use an integer value.
* - `RISK_SCORE`: Mastercard only: Assessment by the network of the authentication
* risk level, with a higher value indicating a higher amount of risk. Use an
* integer value.
* - `MESSAGE_CATEGORY`: The category of the authentication being processed.
* - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address
* data with the cardholder KYC data if it exists. Valid values are `MATCH`,
* `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`.
*/
attribute:
| 'MCC'
| 'COUNTRY'
| 'CURRENCY'
| 'MERCHANT_ID'
| 'DESCRIPTOR'
| 'TRANSACTION_AMOUNT'
| 'RISK_SCORE'
| 'MESSAGE_CATEGORY'
| 'ADDRESS_MATCH';
/**
* The operation to apply to the attribute
*/
operation: V2API.ConditionalOperation;
/**
* A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
*/
value: V2API.ConditionalValue;
}
}
export interface ConditionalACHActionParameters {
/**
* The action to take if the conditions are met.
*/
action: ConditionalACHActionParameters.ApproveActionACH | ConditionalACHActionParameters.ReturnAction;
conditions: Array<ConditionalACHActionParameters.Condition>;
}
export namespace ConditionalACHActionParameters {
export interface ApproveActionACH {
/**
* Approve the ACH transaction
*/
type: 'APPROVE';
}
export interface ReturnAction {
/**
* NACHA return code to use when returning the transaction. Note that the list of
* available return codes is subject to an allowlist configured at the program
* level
*/
code:
| 'R01'
| 'R02'
| 'R03'
| 'R04'
| 'R05'
| 'R06'
| 'R07'
| 'R08'
| 'R09'
| 'R10'
| 'R11'
| 'R12'
| 'R13'
| 'R14'
| 'R15'
| 'R16'
| 'R17'
| 'R18'
| 'R19'
| 'R20'
| 'R21'
| 'R22'
| 'R23'
| 'R24'
| 'R25'
| 'R26'
| 'R27'
| 'R28'
| 'R29'
| 'R30'
| 'R31'
| 'R32'
| 'R33'
| 'R34'
| 'R35'
| 'R36'
| 'R37'
| 'R38'
| 'R39'
| 'R40'
| 'R41'
| 'R42'
| 'R43'
| 'R44'
| 'R45'
| 'R46'
| 'R47'
| 'R50'
| 'R51'
| 'R52'
| 'R53'
| 'R61'
| 'R62'
| 'R67'
| 'R68'
| 'R69'
| 'R70'
| 'R71'
| 'R72'
| 'R73'
| 'R74'
| 'R75'
| 'R76'
| 'R77'
| 'R80'
| 'R81'
| 'R82'
| 'R83'
| 'R84'
| 'R85';
/**
* Return the ACH transaction
*/
type: 'RETURN';
}
export interface Condition {
/**
* The attribute to target.
*
* The following attributes may be targeted:
*
* - `COMPANY_NAME`: The name of the company initiating the ACH transaction.
* - `COMPANY_ID`: The company ID (also known as Standard Entry Class (SEC) Company
* ID) of the entity initiating the ACH transaction.
* - `TIMESTAMP`: The timestamp of the ACH transaction in ISO 8601 format.
* - `TRANSACTION_AMOUNT`: The amount of the ACH transaction in minor units
* (cents). Use an integer value.
* - `SEC_CODE`: Standard Entry Class code indicating the type of ACH transaction.
* Valid values include PPD (Prearranged Payment and Deposit Entry), CCD
* (Corporate Credit or Debit Entry), WEB (Internet-Initiated/Mobile Entry), TEL
* (Telephone-Initiated Entry), and others.
* - `MEMO`: Optional memo or description field included with the ACH transaction.
*/
attribute: 'COMPANY_NAME' | 'COMPANY_ID' | 'TIMESTAMP' | 'TRANSACTION_AMOUNT' | 'SEC_CODE' | 'MEMO';
/**
* The operation to apply to the attribute
*/
operation: V2API.ConditionalOperation;
/**
* A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
*/
value: V2API.ConditionalValue;
}
}
export interface ConditionalACHPaymentUpdateActionParameters {
/**
* The action to take if the conditions are met.
*/
action: ACHPaymentUpdateAction;
conditions: Array<ConditionalACHPaymentUpdateActionParameters.Condition>;
}
export namespace ConditionalACHPaymentUpdateActionParameters {
export interface Condition {
/**
* The attribute to target.
*
* The following attributes may be targeted:
*
* - `TRANSACTION_AMOUNT`: The total amount of the ACH payment in minor units
* (cents), calculated as the sum of the settled and pending amounts. Use an
* integer value.
* - `SEC_CODE`: Standard Entry Class code indicating the type of ACH transaction.
* Valid values include PPD (Prearranged Payment and Deposit Entry), CCD
* (Corporate Credit or Debit Entry), WEB (Internet-Initiated/Mobile Entry), TEL
* (Telephone-Initiated Entry), and others.
* - `RETURN_REASON_CODE`: NACHA return reason code associated with the payment
* (for example, `R01`).
* - `ACCOUNT_AGE`: The age of the account in seconds at the time of the payment.
* Use an integer value. For programs where Lithic does not manage or retain
* account holder data, this attribute does not evaluate.
* - `EXTERNAL_BANK_ACCOUNT_AGE`: The age of the external bank account in seconds
* at the time of the payment. Use an integer value.
* - `EXTERNAL_BANK_ACCOUNT_VERIFICATION_METHOD`: The method used to verify the
* external bank account. Valid values are `MANUAL`, `MICRO_DEPOSIT`, `PRENOTE`,
* `EXTERNALLY_VERIFIED`, or `UNVERIFIED`.
* - `EXTERNAL_BANK_ACCOUNT_VERIFICATION_STATE`: The verification state of the
* external bank account. Valid values are `PENDING`, `ENABLED`,
* `FAILED_VERIFICATION`, or `INSUFFICIENT_FUNDS`.
* - `EXTERNAL_BANK_ACCOUNT_OWNER_TYPE`: The owner type of the external bank
* account. Valid values are `INDIVIDUAL` or `BUSINESS`.
* - `ACH_EVENT_TYPE`: The type of ACH payment event being evaluated. Valid values
* include `ACH_ORIGINATION_INITIATED`, `ACH_ORIGINATION_REVIEWED`,
* `ACH_ORIGINATION_CANCELLED`, `ACH_ORIGINATION_PROCESSED`,
* `ACH_ORIGINATION_SETTLED`, `ACH_ORIGINATION_RELEASED`,
* `ACH_ORIGINATION_REJECTED`, `ACH_RECEIPT_PROCESSED`, `ACH_RECEIPT_SETTLED`,
* `ACH_RECEIPT_RELEASED`, `ACH_RECEIPT_RELEASED_EARLY`, `ACH_RETURN_INITIATED`,
* `ACH_RETURN_PROCESSED`, `ACH_RETURN_SETTLED`, and `ACH_RETURN_REJECTED`.
*/
attribute:
| 'TRANSACTION_AMOUNT'
| 'SEC_CODE'
| 'RETURN_REASON_CODE'
| 'ACCOUNT_AGE'
| 'EXTERNAL_BANK_ACCOUNT_AGE'
| 'EXTERNAL_BANK_ACCOUNT_VERIFICATION_METHOD'
| 'EXTERNAL_BANK_ACCOUNT_VERIFICATION_STATE'
| 'EXTERNAL_BANK_ACCOUNT_OWNER_TYPE'
| 'ACH_EVENT_TYPE';
/**
* The operation to apply to the attribute
*/
operation: V2API.ConditionalOperation;
/**
* A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
*/
value: V2API.ConditionalValue;
}
}
/**
* The attribute to target.
*
* The following attributes may be targeted:
*
* - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a
* business by the types of goods or services it provides.
* - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all
* ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for
* Netherlands Antilles.
* - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of
* the transaction.
* - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor
* (merchant).
* - `DESCRIPTOR`: Short description of card acceptor.
* - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer
* applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or
* `TOKEN_AUTHENTICATED`.
* - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number
* (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`,
* `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`,
* `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`,
* `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`.
* - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer
* fee field in the settlement/cardholder billing currency. This is the amount
* the issuer should authorize against unless the issuer is paying the acquirer
* fee on behalf of the cardholder.
* - `RISK_SCORE`: Network-provided score assessing risk level associated with a
* given authorization. Scores are on a range of 0-999, with 0 representing the
* lowest risk and 999 representing the highest risk. For Visa transactions,
* where the raw score has a range of 0-99, Lithic will normalize the score by
* multiplying the raw score by 10x.
* - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the
* trailing 15 minutes before the authorization.
* - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the
* trailing hour up and until the authorization.
* - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the
* trailing 24 hours up and until the authorization.
* - `CARD_STATE`: The current state of the card associated with the transaction.
* Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`,
* `PENDING_FULFILLMENT`.
* - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction.
* Valid values are `TRUE`, `FALSE`.
* - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`,
* `OK`, `BLOCKED`.
* - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the
* source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`,
* `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`.
* - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address
* data with the cardholder KYC data if it exists. Valid values are `MATCH`,
* `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`.
*/
export type ConditionalAttribute =
| 'MCC'
| 'COUNTRY'
| 'CURRENCY'
| 'MERCHANT_ID'
| 'DESCRIPTOR'
| 'LIABILITY_SHIFT'
| 'PAN_ENTRY_MODE'
| 'TRANSACTION_AMOUNT'
| 'RISK_SCORE'
| 'CARD_TRANSACTION_COUNT_15M'
| 'CARD_TRANSACTION_COUNT_1H'
| 'CARD_TRANSACTION_COUNT_24H'
| 'CARD_STATE'
| 'PIN_ENTERED'
| 'PIN_STATUS'
| 'WALLET_TYPE'
| 'ADDRESS_MATCH';
export interface ConditionalAuthorizationActionParameters {
/**
* The action to take if the conditions are met.
*/
action: 'DECLINE' | 'CHALLENGE';
conditions: Array<ConditionalAuthorizationActionParameters.Condition>;
}
export namespace ConditionalAuthorizationActionParameters {
export interface Condition {
/**
* The attribute to target.
*
* The following attributes may be targeted:
*
* - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a
* business by the types of goods or services it provides.
* - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all
* ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for
* Netherlands Antilles.
* - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of
* the transaction.
* - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor
* (merchant).
* - `DESCRIPTOR`: Short description of card acceptor.
* - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer
* applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or
* `TOKEN_AUTHENTICATED`.
* - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number
* (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`,
* `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`,
* `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`,
* `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`.
* - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer
* fee field in the settlement/cardholder billing currency. This is the amount
* the issuer should authorize against unless the issuer is paying the acquirer
* fee on behalf of the cardholder. Use an integer value.
* - `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). This
* represents the amount of cash being withdrawn or advanced. Use an integer
* value.
* - `RISK_SCORE`: Network-provided score assessing risk level associated with a
* given authorization. Scores are on a range of 0-999, with 0 representing the
* lowest risk and 999 representing the highest risk. For Visa transactions,
* where the raw score has a range of 0-99, Lithic will normalize the score by
* multiplying the raw score by 10x. Use an integer value.
* - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the
* trailing 15 minutes before the authorization. Use an integer value.
* - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the
* trailing hour up and until the authorization. Use an integer value.
* - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the
* trailing 24 hours up and until the authorization. Use an integer value.
* - `CARD_DECLINE_COUNT_15M`: The number of declined transactions on the card in
* the trailing 15 minutes before the authorization. Use an integer value.
* - `CARD_DECLINE_COUNT_1H`: The number of declined transactions on the card in
* the trailing hour up and until the authorization. Use an integer value.
* - `CARD_DECLINE_COUNT_24H`: The number of declined transactions on the card in
* the trailing 24 hours up and until the authorization. Use an integer value.
* - `CARD_STATE`: The current state of the card associated with the transaction.
* Valid values are `CLOSED`, `OPEN`, `PAUSED`, `PENDING_ACTIVATION`,
* `PENDING_FULFILLMENT`.
* - `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction.
* Valid values are `TRUE`, `FALSE`.
* - `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`,
* `OK`, `BLOCKED`.
* - `WALLET_TYPE`: For transactions using a digital wallet token, indicates the
* source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`,
* `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`.
* - `TRANSACTION_INITIATOR`: The entity that initiated the transaction indicates
* the source of the token. Valid values are `CARDHOLDER`, `MERCHANT`, `UNKNOWN`.
* - `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address
* data with the cardholder KYC data if it exists. Valid values are `MATCH`,
* `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`.
* - `SERVICE_LOCATION_STATE`: The state/province code (ISO 3166-2) where the
* cardholder received the service, e.g. "NY". When a service location is present
* in the network data, the service location state is used. Otherwise, falls back
* to the card acceptor state.
* - `SERVICE_LOCATION_POSTAL_CODE`: The postal code where the cardholder received
* the service, e.g. "10001". When a service location is present in the network
* data, the service location postal code is used. Otherwise, falls back to the
* card acceptor postal code.
* - `CARD_AGE`: The age of the card in seconds at the time of the authorization.
* Use an integer value.
* - `ACCOUNT_AGE`: The age of the account holder's account in seconds at the time
* of the authorization. Use an integer value. For programs where Lithic does not
* manage or retain account holder data, this attribute does not evaluate.
* - `AMOUNT_Z_SCORE`: The z-score of the transaction amount relative to the
* entity's transaction history. Null if fewer than 30 approved transactions in
* the specified window. Requires `parameters.scope` and `parameters.interval`.
* Use a decimal value.
* - `AVG_TRANSACTION_AMOUNT`: The average approved transaction amount for the
* entity over the specified window, in cents. Requires `parameters.scope` and
* `parameters.interval`. Use a decimal value.
* - `STDEV_TRANSACTION_AMOUNT`: The standard deviation of approved transaction
* amounts for the entity over the specified window, in cents. Null if fewer than
* 30 approved transactions in the specified window. Requires `parameters.scope`
* and `parameters.interval`. Use a decimal value.
* - `IS_NEW_COUNTRY`: Whether the transaction's merchant country has not been seen
* in the entity's transaction history. Valid values are `TRUE`, `FALSE`.
* Requires `parameters.scope`.
* - `IS_NEW_MCC`: Whether the transaction's MCC has not been seen in the entity's
* transaction history. Valid values are `TRUE`, `FALSE`. Requires
* `parameters.scope`.
* - `IS_FIRST_TRANSACTION`: Whether this is the first transaction for the entity.
* Valid values are `TRUE`, `FALSE`. Requires `parameters.scope`.
* - `CONSECUTIVE_DECLINES`: The number of consecutive declined transactions for
* the entity over the last 30 days (rolling). Requires `parameters.scope`. Not
* supported for `BUSINESS_ACCOUNT` scope. Use an integer value.
* - `TIME_SINCE_LAST_TRANSACTION`: The number of days since the last approved
* transaction for the entity, rounded to the nearest whole day. Requires
* `parameters.scope`. Use an integer value.
* - `DISTINCT_COUNTRY_COUNT`: The number of distinct merchant countries seen in
* the entity's transaction history. Requires `parameters.scope`. Use an integer
* value.
* - `IS_NEW_MERCHANT`: Whether the card acceptor ID has not been seen in the
* card's approved transaction history (capped at the 1000 most recently seen
* merchants). Valid values are `TRUE`, `FALSE`. Card-scoped only; no