-
Notifications
You must be signed in to change notification settings - Fork 1
/
authrule.go
917 lines (810 loc) · 46.8 KB
/
authrule.go
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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package lithic
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"reflect"
"github.com/lithic-com/lithic-go/internal/apijson"
"github.com/lithic-com/lithic-go/internal/apiquery"
"github.com/lithic-com/lithic-go/internal/param"
"github.com/lithic-com/lithic-go/internal/requestconfig"
"github.com/lithic-com/lithic-go/option"
"github.com/lithic-com/lithic-go/packages/pagination"
"github.com/lithic-com/lithic-go/shared"
"github.com/tidwall/gjson"
)
// AuthRuleService contains methods and other services that help with interacting
// with the lithic API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewAuthRuleService] method instead.
type AuthRuleService struct {
Options []option.RequestOption
V2 *AuthRuleV2Service
}
// NewAuthRuleService generates a new service that applies the given options to
// each request. These options are applied after the parent client's options (if
// there is one), and before any request-specific options.
func NewAuthRuleService(opts ...option.RequestOption) (r *AuthRuleService) {
r = &AuthRuleService{}
r.Options = opts
r.V2 = NewAuthRuleV2Service(opts...)
return
}
// Creates an authorization rule (Auth Rule) and applies it at the program,
// account, or card level.
func (r *AuthRuleService) New(ctx context.Context, body AuthRuleNewParams, opts ...option.RequestOption) (res *shared.AuthRule, err error) {
opts = append(r.Options[:], opts...)
path := "v1/auth_rules"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Detail the properties and entities (program, accounts, and cards) associated
// with an existing authorization rule (Auth Rule).
func (r *AuthRuleService) Get(ctx context.Context, authRuleToken string, opts ...option.RequestOption) (res *AuthRuleGetResponse, err error) {
opts = append(r.Options[:], opts...)
if authRuleToken == "" {
err = errors.New("missing required auth_rule_token parameter")
return
}
path := fmt.Sprintf("v1/auth_rules/%s", authRuleToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// Update the properties associated with an existing authorization rule (Auth
// Rule).
func (r *AuthRuleService) Update(ctx context.Context, authRuleToken string, body AuthRuleUpdateParams, opts ...option.RequestOption) (res *shared.AuthRule, err error) {
opts = append(r.Options[:], opts...)
if authRuleToken == "" {
err = errors.New("missing required auth_rule_token parameter")
return
}
path := fmt.Sprintf("v1/auth_rules/%s", authRuleToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...)
return
}
// Return all of the Auth Rules under the program.
func (r *AuthRuleService) List(ctx context.Context, query AuthRuleListParams, opts ...option.RequestOption) (res *pagination.CursorPage[shared.AuthRule], err error) {
var raw *http.Response
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "v1/auth_rules"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
}
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}
// Return all of the Auth Rules under the program.
func (r *AuthRuleService) ListAutoPaging(ctx context.Context, query AuthRuleListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[shared.AuthRule] {
return pagination.NewCursorPageAutoPager(r.List(ctx, query, opts...))
}
// Applies an existing authorization rule (Auth Rule) to an program, account, or
// card level.
func (r *AuthRuleService) Apply(ctx context.Context, authRuleToken string, body AuthRuleApplyParams, opts ...option.RequestOption) (res *shared.AuthRule, err error) {
opts = append(r.Options[:], opts...)
if authRuleToken == "" {
err = errors.New("missing required auth_rule_token parameter")
return
}
path := fmt.Sprintf("v1/auth_rules/%s/apply", authRuleToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Migrates an existing V1 authorization rule to a V2 authorization rule. Depending
// on the configuration of the V1 Auth Rule, this will yield one or two V2
// authorization rules. This endpoint will alter the internal structure of the Auth
// Rule such that the resulting rules become a V2 Authorization Rule that can be
// operated on through the /v2/auth_rules endpoints.
//
// After a V1 Auth Rule has been migrated, it can no longer be operated on through
// the /v1/auth_rules/\* endpoints. Eventually, Lithic will deprecate the
// /v1/auth_rules endpoints and migrate all existing V1 Auth Rules to V2 Auth
// Rules.
func (r *AuthRuleService) MigrateV1ToV2(ctx context.Context, authRuleToken string, opts ...option.RequestOption) (res *[]AuthRuleMigrateV1ToV2Response, err error) {
opts = append(r.Options[:], opts...)
if authRuleToken == "" {
err = errors.New("missing required auth_rule_token parameter")
return
}
path := fmt.Sprintf("v1/auth_rules/%s/migrate", authRuleToken)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return
}
// Remove an existing authorization rule (Auth Rule) from an program, account, or
// card-level.
func (r *AuthRuleService) Remove(ctx context.Context, body AuthRuleRemoveParams, opts ...option.RequestOption) (res *AuthRuleRemoveResponse, err error) {
opts = append(r.Options[:], opts...)
path := "v1/auth_rules/remove"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &res, opts...)
return
}
type AuthRuleGetResponse struct {
Data []shared.AuthRule `json:"data"`
JSON authRuleGetResponseJSON `json:"-"`
}
// authRuleGetResponseJSON contains the JSON metadata for the struct
// [AuthRuleGetResponse]
type authRuleGetResponseJSON struct {
Data apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *AuthRuleGetResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r authRuleGetResponseJSON) RawJSON() string {
return r.raw
}
type AuthRuleMigrateV1ToV2Response struct {
Token string `json:"token,required" format:"uuid"`
// Account tokens to which the Auth Rule applies.
AccountTokens []string `json:"account_tokens,required" format:"uuid"`
// Card tokens to which the Auth Rule applies.
CardTokens []string `json:"card_tokens,required" format:"uuid"`
CurrentVersion AuthRuleMigrateV1ToV2ResponseCurrentVersion `json:"current_version,required,nullable"`
DraftVersion AuthRuleMigrateV1ToV2ResponseDraftVersion `json:"draft_version,required,nullable"`
// Whether the Auth Rule applies to all authorizations on the card program.
ProgramLevel bool `json:"program_level,required"`
// The state of the Auth Rule
State AuthRuleMigrateV1ToV2ResponseState `json:"state,required"`
// The type of Auth Rule
Type AuthRuleMigrateV1ToV2ResponseType `json:"type,required"`
JSON authRuleMigrateV1ToV2ResponseJSON `json:"-"`
}
// authRuleMigrateV1ToV2ResponseJSON contains the JSON metadata for the struct
// [AuthRuleMigrateV1ToV2Response]
type authRuleMigrateV1ToV2ResponseJSON struct {
Token apijson.Field
AccountTokens apijson.Field
CardTokens apijson.Field
CurrentVersion apijson.Field
DraftVersion apijson.Field
ProgramLevel apijson.Field
State apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *AuthRuleMigrateV1ToV2Response) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r authRuleMigrateV1ToV2ResponseJSON) RawJSON() string {
return r.raw
}
type AuthRuleMigrateV1ToV2ResponseCurrentVersion struct {
// Parameters for the current version of the Auth Rule
Parameters AuthRuleMigrateV1ToV2ResponseCurrentVersionParameters `json:"parameters,required"`
// The version of the rule, this is incremented whenever the rule's parameters
// change.
Version int64 `json:"version,required"`
JSON authRuleMigrateV1ToV2ResponseCurrentVersionJSON `json:"-"`
}
// authRuleMigrateV1ToV2ResponseCurrentVersionJSON contains the JSON metadata for
// the struct [AuthRuleMigrateV1ToV2ResponseCurrentVersion]
type authRuleMigrateV1ToV2ResponseCurrentVersionJSON struct {
Parameters apijson.Field
Version apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *AuthRuleMigrateV1ToV2ResponseCurrentVersion) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r authRuleMigrateV1ToV2ResponseCurrentVersionJSON) RawJSON() string {
return r.raw
}
// Parameters for the current version of the Auth Rule
type AuthRuleMigrateV1ToV2ResponseCurrentVersionParameters struct {
// This field can have the runtime type of
// [[]AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersCondition].
Conditions interface{} `json:"conditions,required"`
Scope AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersScope `json:"scope"`
// This field can have the runtime type of [shared.VelocityLimitParamsPeriodUnion].
Period interface{} `json:"period,required"`
// This field can have the runtime type of [shared.VelocityLimitParamsFilters].
Filters interface{} `json:"filters,required"`
// The maximum amount of spend velocity allowed in the period in minor units (the
// smallest unit of a currency, e.g. cents for USD). Transactions exceeding this
// limit will be declined.
LimitAmount float64 `json:"limit_amount,nullable"`
// The number of spend velocity impacting transactions may not exceed this limit in
// the period. Transactions exceeding this limit will be declined. A spend velocity
// impacting transaction is a transaction that has been authorized, and optionally
// settled, or a force post (a transaction that settled without prior
// authorization).
LimitCount float64 `json:"limit_count,nullable"`
JSON authRuleMigrateV1ToV2ResponseCurrentVersionParametersJSON `json:"-"`
union AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersUnion
}
// authRuleMigrateV1ToV2ResponseCurrentVersionParametersJSON contains the JSON
// metadata for the struct [AuthRuleMigrateV1ToV2ResponseCurrentVersionParameters]
type authRuleMigrateV1ToV2ResponseCurrentVersionParametersJSON struct {
Conditions apijson.Field
Scope apijson.Field
Period apijson.Field
Filters apijson.Field
LimitAmount apijson.Field
LimitCount apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r authRuleMigrateV1ToV2ResponseCurrentVersionParametersJSON) RawJSON() string {
return r.raw
}
func (r *AuthRuleMigrateV1ToV2ResponseCurrentVersionParameters) UnmarshalJSON(data []byte) (err error) {
*r = AuthRuleMigrateV1ToV2ResponseCurrentVersionParameters{}
err = apijson.UnmarshalRoot(data, &r.union)
if err != nil {
return err
}
return apijson.Port(r.union, &r)
}
// AsUnion returns a [AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersUnion]
// interface which you can cast to the specific types for more type safety.
//
// Possible runtime types of the union are
// [AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParameters],
// [shared.VelocityLimitParams].
func (r AuthRuleMigrateV1ToV2ResponseCurrentVersionParameters) AsUnion() AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersUnion {
return r.union
}
// Parameters for the current version of the Auth Rule
//
// Union satisfied by
// [AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParameters]
// or [shared.VelocityLimitParams].
type AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersUnion interface {
ImplementsAuthRuleMigrateV1ToV2ResponseCurrentVersionParameters()
}
func init() {
apijson.RegisterUnion(
reflect.TypeOf((*AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParameters{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(shared.VelocityLimitParams{}),
},
)
}
type AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParameters struct {
Conditions []AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersCondition `json:"conditions,required"`
JSON authRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersJSON `json:"-"`
}
// authRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersJSON
// contains the JSON metadata for the struct
// [AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParameters]
type authRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersJSON struct {
Conditions apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParameters) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r authRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersJSON) RawJSON() string {
return r.raw
}
func (r AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParameters) ImplementsAuthRuleMigrateV1ToV2ResponseCurrentVersionParameters() {
}
type AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersCondition struct {
// The attribute to target
Attribute AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttribute `json:"attribute"`
// The operation to apply to the attribute
Operation AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperation `json:"operation"`
// A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
Value AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsValueUnion `json:"value"`
JSON authRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionJSON `json:"-"`
}
// authRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionJSON
// contains the JSON metadata for the struct
// [AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersCondition]
type authRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionJSON struct {
Attribute apijson.Field
Operation apijson.Field
Value apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersCondition) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r authRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionJSON) RawJSON() string {
return r.raw
}
// The attribute to target
type AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttribute string
const (
// 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.
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeMcc AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttribute = "MCC"
// 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.
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeCountry AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttribute = "COUNTRY"
// 3-digit alphabetic ISO 4217 code for the merchant currency of the transaction.
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeCurrency AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttribute = "CURRENCY"
// Unique alphanumeric identifier for the payment card acceptor (merchant).
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeMerchantID AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttribute = "MERCHANT_ID"
// Short description of card acceptor.
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeDescriptor AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttribute = "DESCRIPTOR"
// Indicates whether chargeback liability shift to the issuer applies to the
// transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or
// `TOKEN_AUTHENTICATED`.
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeLiabilityShift AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttribute = "LIABILITY_SHIFT"
// 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`.
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributePanEntryMode AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttribute = "PAN_ENTRY_MODE"
// 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.
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeTransactionAmount AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttribute = "TRANSACTION_AMOUNT"
// 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.
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeRiskScore AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttribute = "RISK_SCORE"
)
func (r AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttribute) IsKnown() bool {
switch r {
case AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeMcc, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeCountry, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeCurrency, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeMerchantID, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeDescriptor, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeLiabilityShift, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributePanEntryMode, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeTransactionAmount, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsAttributeRiskScore:
return true
}
return false
}
// The operation to apply to the attribute
type AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperation string
const (
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperationIsOneOf AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperation = "IS_ONE_OF"
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperationIsNotOneOf AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperation = "IS_NOT_ONE_OF"
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperationMatches AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperation = "MATCHES"
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperationDoesNotMatch AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperation = "DOES_NOT_MATCH"
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperationIsGreaterThan AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperation = "IS_GREATER_THAN"
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperationIsLessThan AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperation = "IS_LESS_THAN"
)
func (r AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperation) IsKnown() bool {
switch r {
case AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperationIsOneOf, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperationIsNotOneOf, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperationMatches, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperationDoesNotMatch, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperationIsGreaterThan, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsOperationIsLessThan:
return true
}
return false
}
// A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
//
// Union satisfied by [shared.UnionString], [shared.UnionFloat] or
// [AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsValueArray].
type AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsValueUnion interface {
ImplementsAuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsValueUnion()
}
func init() {
apijson.RegisterUnion(
reflect.TypeOf((*AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsValueUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.String,
Type: reflect.TypeOf(shared.UnionString("")),
},
apijson.UnionVariant{
TypeFilter: gjson.Number,
Type: reflect.TypeOf(shared.UnionFloat(0)),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsValueArray{}),
},
)
}
type AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsValueArray []string
func (r AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsValueArray) ImplementsAuthRuleMigrateV1ToV2ResponseCurrentVersionParametersConditionalBlockParametersConditionsValueUnion() {
}
type AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersScope string
const (
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersScopeCard AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersScope = "CARD"
AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersScopeAccount AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersScope = "ACCOUNT"
)
func (r AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersScope) IsKnown() bool {
switch r {
case AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersScopeCard, AuthRuleMigrateV1ToV2ResponseCurrentVersionParametersScopeAccount:
return true
}
return false
}
type AuthRuleMigrateV1ToV2ResponseDraftVersion struct {
// Parameters for the current version of the Auth Rule
Parameters AuthRuleMigrateV1ToV2ResponseDraftVersionParameters `json:"parameters,required"`
// The version of the rule, this is incremented whenever the rule's parameters
// change.
Version int64 `json:"version,required"`
JSON authRuleMigrateV1ToV2ResponseDraftVersionJSON `json:"-"`
}
// authRuleMigrateV1ToV2ResponseDraftVersionJSON contains the JSON metadata for the
// struct [AuthRuleMigrateV1ToV2ResponseDraftVersion]
type authRuleMigrateV1ToV2ResponseDraftVersionJSON struct {
Parameters apijson.Field
Version apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *AuthRuleMigrateV1ToV2ResponseDraftVersion) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r authRuleMigrateV1ToV2ResponseDraftVersionJSON) RawJSON() string {
return r.raw
}
// Parameters for the current version of the Auth Rule
type AuthRuleMigrateV1ToV2ResponseDraftVersionParameters struct {
// This field can have the runtime type of
// [[]AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersCondition].
Conditions interface{} `json:"conditions,required"`
Scope AuthRuleMigrateV1ToV2ResponseDraftVersionParametersScope `json:"scope"`
// This field can have the runtime type of [shared.VelocityLimitParamsPeriodUnion].
Period interface{} `json:"period,required"`
// This field can have the runtime type of [shared.VelocityLimitParamsFilters].
Filters interface{} `json:"filters,required"`
// The maximum amount of spend velocity allowed in the period in minor units (the
// smallest unit of a currency, e.g. cents for USD). Transactions exceeding this
// limit will be declined.
LimitAmount float64 `json:"limit_amount,nullable"`
// The number of spend velocity impacting transactions may not exceed this limit in
// the period. Transactions exceeding this limit will be declined. A spend velocity
// impacting transaction is a transaction that has been authorized, and optionally
// settled, or a force post (a transaction that settled without prior
// authorization).
LimitCount float64 `json:"limit_count,nullable"`
JSON authRuleMigrateV1ToV2ResponseDraftVersionParametersJSON `json:"-"`
union AuthRuleMigrateV1ToV2ResponseDraftVersionParametersUnion
}
// authRuleMigrateV1ToV2ResponseDraftVersionParametersJSON contains the JSON
// metadata for the struct [AuthRuleMigrateV1ToV2ResponseDraftVersionParameters]
type authRuleMigrateV1ToV2ResponseDraftVersionParametersJSON struct {
Conditions apijson.Field
Scope apijson.Field
Period apijson.Field
Filters apijson.Field
LimitAmount apijson.Field
LimitCount apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r authRuleMigrateV1ToV2ResponseDraftVersionParametersJSON) RawJSON() string {
return r.raw
}
func (r *AuthRuleMigrateV1ToV2ResponseDraftVersionParameters) UnmarshalJSON(data []byte) (err error) {
*r = AuthRuleMigrateV1ToV2ResponseDraftVersionParameters{}
err = apijson.UnmarshalRoot(data, &r.union)
if err != nil {
return err
}
return apijson.Port(r.union, &r)
}
// AsUnion returns a [AuthRuleMigrateV1ToV2ResponseDraftVersionParametersUnion]
// interface which you can cast to the specific types for more type safety.
//
// Possible runtime types of the union are
// [AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParameters],
// [shared.VelocityLimitParams].
func (r AuthRuleMigrateV1ToV2ResponseDraftVersionParameters) AsUnion() AuthRuleMigrateV1ToV2ResponseDraftVersionParametersUnion {
return r.union
}
// Parameters for the current version of the Auth Rule
//
// Union satisfied by
// [AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParameters]
// or [shared.VelocityLimitParams].
type AuthRuleMigrateV1ToV2ResponseDraftVersionParametersUnion interface {
ImplementsAuthRuleMigrateV1ToV2ResponseDraftVersionParameters()
}
func init() {
apijson.RegisterUnion(
reflect.TypeOf((*AuthRuleMigrateV1ToV2ResponseDraftVersionParametersUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParameters{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(shared.VelocityLimitParams{}),
},
)
}
type AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParameters struct {
Conditions []AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersCondition `json:"conditions,required"`
JSON authRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersJSON `json:"-"`
}
// authRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersJSON
// contains the JSON metadata for the struct
// [AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParameters]
type authRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersJSON struct {
Conditions apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParameters) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r authRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersJSON) RawJSON() string {
return r.raw
}
func (r AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParameters) ImplementsAuthRuleMigrateV1ToV2ResponseDraftVersionParameters() {
}
type AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersCondition struct {
// The attribute to target
Attribute AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttribute `json:"attribute"`
// The operation to apply to the attribute
Operation AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperation `json:"operation"`
// A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
Value AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsValueUnion `json:"value"`
JSON authRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionJSON `json:"-"`
}
// authRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionJSON
// contains the JSON metadata for the struct
// [AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersCondition]
type authRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionJSON struct {
Attribute apijson.Field
Operation apijson.Field
Value apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersCondition) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r authRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionJSON) RawJSON() string {
return r.raw
}
// The attribute to target
type AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttribute string
const (
// 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.
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeMcc AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttribute = "MCC"
// 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.
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeCountry AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttribute = "COUNTRY"
// 3-digit alphabetic ISO 4217 code for the merchant currency of the transaction.
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeCurrency AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttribute = "CURRENCY"
// Unique alphanumeric identifier for the payment card acceptor (merchant).
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeMerchantID AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttribute = "MERCHANT_ID"
// Short description of card acceptor.
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeDescriptor AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttribute = "DESCRIPTOR"
// Indicates whether chargeback liability shift to the issuer applies to the
// transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or
// `TOKEN_AUTHENTICATED`.
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeLiabilityShift AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttribute = "LIABILITY_SHIFT"
// 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`.
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributePanEntryMode AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttribute = "PAN_ENTRY_MODE"
// 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.
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeTransactionAmount AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttribute = "TRANSACTION_AMOUNT"
// 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.
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeRiskScore AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttribute = "RISK_SCORE"
)
func (r AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttribute) IsKnown() bool {
switch r {
case AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeMcc, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeCountry, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeCurrency, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeMerchantID, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeDescriptor, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeLiabilityShift, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributePanEntryMode, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeTransactionAmount, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsAttributeRiskScore:
return true
}
return false
}
// The operation to apply to the attribute
type AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperation string
const (
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperationIsOneOf AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperation = "IS_ONE_OF"
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperationIsNotOneOf AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperation = "IS_NOT_ONE_OF"
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperationMatches AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperation = "MATCHES"
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperationDoesNotMatch AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperation = "DOES_NOT_MATCH"
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperationIsGreaterThan AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperation = "IS_GREATER_THAN"
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperationIsLessThan AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperation = "IS_LESS_THAN"
)
func (r AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperation) IsKnown() bool {
switch r {
case AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperationIsOneOf, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperationIsNotOneOf, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperationMatches, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperationDoesNotMatch, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperationIsGreaterThan, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsOperationIsLessThan:
return true
}
return false
}
// A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
//
// Union satisfied by [shared.UnionString], [shared.UnionFloat] or
// [AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsValueArray].
type AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsValueUnion interface {
ImplementsAuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsValueUnion()
}
func init() {
apijson.RegisterUnion(
reflect.TypeOf((*AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsValueUnion)(nil)).Elem(),
"",
apijson.UnionVariant{
TypeFilter: gjson.String,
Type: reflect.TypeOf(shared.UnionString("")),
},
apijson.UnionVariant{
TypeFilter: gjson.Number,
Type: reflect.TypeOf(shared.UnionFloat(0)),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsValueArray{}),
},
)
}
type AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsValueArray []string
func (r AuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsValueArray) ImplementsAuthRuleMigrateV1ToV2ResponseDraftVersionParametersConditionalBlockParametersConditionsValueUnion() {
}
type AuthRuleMigrateV1ToV2ResponseDraftVersionParametersScope string
const (
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersScopeCard AuthRuleMigrateV1ToV2ResponseDraftVersionParametersScope = "CARD"
AuthRuleMigrateV1ToV2ResponseDraftVersionParametersScopeAccount AuthRuleMigrateV1ToV2ResponseDraftVersionParametersScope = "ACCOUNT"
)
func (r AuthRuleMigrateV1ToV2ResponseDraftVersionParametersScope) IsKnown() bool {
switch r {
case AuthRuleMigrateV1ToV2ResponseDraftVersionParametersScopeCard, AuthRuleMigrateV1ToV2ResponseDraftVersionParametersScopeAccount:
return true
}
return false
}
// The state of the Auth Rule
type AuthRuleMigrateV1ToV2ResponseState string
const (
AuthRuleMigrateV1ToV2ResponseStateActive AuthRuleMigrateV1ToV2ResponseState = "ACTIVE"
AuthRuleMigrateV1ToV2ResponseStateInactive AuthRuleMigrateV1ToV2ResponseState = "INACTIVE"
)
func (r AuthRuleMigrateV1ToV2ResponseState) IsKnown() bool {
switch r {
case AuthRuleMigrateV1ToV2ResponseStateActive, AuthRuleMigrateV1ToV2ResponseStateInactive:
return true
}
return false
}
// The type of Auth Rule
type AuthRuleMigrateV1ToV2ResponseType string
const (
AuthRuleMigrateV1ToV2ResponseTypeConditionalBlock AuthRuleMigrateV1ToV2ResponseType = "CONDITIONAL_BLOCK"
AuthRuleMigrateV1ToV2ResponseTypeVelocityLimit AuthRuleMigrateV1ToV2ResponseType = "VELOCITY_LIMIT"
)
func (r AuthRuleMigrateV1ToV2ResponseType) IsKnown() bool {
switch r {
case AuthRuleMigrateV1ToV2ResponseTypeConditionalBlock, AuthRuleMigrateV1ToV2ResponseTypeVelocityLimit:
return true
}
return false
}
type AuthRuleRemoveResponse struct {
AccountTokens []string `json:"account_tokens"`
CardTokens []string `json:"card_tokens"`
ProgramLevel bool `json:"program_level"`
JSON authRuleRemoveResponseJSON `json:"-"`
}
// authRuleRemoveResponseJSON contains the JSON metadata for the struct
// [AuthRuleRemoveResponse]
type authRuleRemoveResponseJSON struct {
AccountTokens apijson.Field
CardTokens apijson.Field
ProgramLevel apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *AuthRuleRemoveResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r authRuleRemoveResponseJSON) RawJSON() string {
return r.raw
}
type AuthRuleNewParams struct {
// Array of account_token(s) identifying the accounts that the Auth Rule applies
// to. Note that only this field or `card_tokens` can be provided for a given Auth
// Rule.
AccountTokens param.Field[[]string] `json:"account_tokens"`
// Countries in which the Auth Rule permits transactions. Note that Lithic
// maintains a list of countries in which all transactions are blocked; "allowing"
// those countries in an Auth Rule does not override the Lithic-wide restrictions.
AllowedCountries param.Field[[]string] `json:"allowed_countries"`
// Merchant category codes for which the Auth Rule permits transactions.
AllowedMcc param.Field[[]string] `json:"allowed_mcc"`
// Countries in which the Auth Rule automatically declines transactions.
BlockedCountries param.Field[[]string] `json:"blocked_countries"`
// Merchant category codes for which the Auth Rule automatically declines
// transactions.
BlockedMcc param.Field[[]string] `json:"blocked_mcc"`
// Array of card_token(s) identifying the cards that the Auth Rule applies to. Note
// that only this field or `account_tokens` can be provided for a given Auth Rule.
CardTokens param.Field[[]string] `json:"card_tokens"`
// Boolean indicating whether the Auth Rule is applied at the program level.
ProgramLevel param.Field[bool] `json:"program_level"`
}
func (r AuthRuleNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type AuthRuleUpdateParams struct {
// Array of country codes for which the Auth Rule will permit transactions. Note
// that only this field or `blocked_countries` can be used for a given Auth Rule.
AllowedCountries param.Field[[]string] `json:"allowed_countries"`
// Array of merchant category codes for which the Auth Rule will permit
// transactions. Note that only this field or `blocked_mcc` can be used for a given
// Auth Rule.
AllowedMcc param.Field[[]string] `json:"allowed_mcc"`
// Array of country codes for which the Auth Rule will automatically decline
// transactions. Note that only this field or `allowed_countries` can be used for a
// given Auth Rule.
BlockedCountries param.Field[[]string] `json:"blocked_countries"`
// Array of merchant category codes for which the Auth Rule will automatically
// decline transactions. Note that only this field or `allowed_mcc` can be used for
// a given Auth Rule.
BlockedMcc param.Field[[]string] `json:"blocked_mcc"`
}
func (r AuthRuleUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type AuthRuleListParams struct {
// A cursor representing an item's token before which a page of results should end.
// Used to retrieve the previous page of results before this item.
EndingBefore param.Field[string] `query:"ending_before"`
// Page size (for pagination).
PageSize param.Field[int64] `query:"page_size"`
// A cursor representing an item's token after which a page of results should
// begin. Used to retrieve the next page of results after this item.
StartingAfter param.Field[string] `query:"starting_after"`
}
// URLQuery serializes [AuthRuleListParams]'s query parameters as `url.Values`.
func (r AuthRuleListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
type AuthRuleApplyParams struct {
// Array of account_token(s) identifying the accounts that the Auth Rule applies
// to. Note that only this field or `card_tokens` can be provided for a given Auth
// Rule.
AccountTokens param.Field[[]string] `json:"account_tokens"`
// Array of card_token(s) identifying the cards that the Auth Rule applies to. Note
// that only this field or `account_tokens` can be provided for a given Auth Rule.
CardTokens param.Field[[]string] `json:"card_tokens"`
// Boolean indicating whether the Auth Rule is applied at the program level.
ProgramLevel param.Field[bool] `json:"program_level"`
}
func (r AuthRuleApplyParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type AuthRuleRemoveParams struct {
// Array of account_token(s) identifying the accounts that the Auth Rule applies
// to. Note that only this field or `card_tokens` can be provided for a given Auth
// Rule.
AccountTokens param.Field[[]string] `json:"account_tokens"`
// Array of card_token(s) identifying the cards that the Auth Rule applies to. Note
// that only this field or `account_tokens` can be provided for a given Auth Rule.
CardTokens param.Field[[]string] `json:"card_tokens"`
// Boolean indicating whether the Auth Rule is applied at the program level.
ProgramLevel param.Field[bool] `json:"program_level"`
}
func (r AuthRuleRemoveParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}