/
realtimedecision.go
991 lines (870 loc) · 49.9 KB
/
realtimedecision.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
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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package increase
import (
"context"
"fmt"
"net/http"
"time"
"github.com/increase/increase-go/internal/apijson"
"github.com/increase/increase-go/internal/param"
"github.com/increase/increase-go/internal/requestconfig"
"github.com/increase/increase-go/option"
)
// RealTimeDecisionService contains methods and other services that help with
// interacting with the increase 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 [NewRealTimeDecisionService] method
// instead.
type RealTimeDecisionService struct {
Options []option.RequestOption
}
// NewRealTimeDecisionService 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 NewRealTimeDecisionService(opts ...option.RequestOption) (r *RealTimeDecisionService) {
r = &RealTimeDecisionService{}
r.Options = opts
return
}
// Retrieve a Real-Time Decision
func (r *RealTimeDecisionService) Get(ctx context.Context, realTimeDecisionID string, opts ...option.RequestOption) (res *RealTimeDecision, err error) {
opts = append(r.Options[:], opts...)
path := fmt.Sprintf("real_time_decisions/%s", realTimeDecisionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// Action a Real-Time Decision
func (r *RealTimeDecisionService) Action(ctx context.Context, realTimeDecisionID string, body RealTimeDecisionActionParams, opts ...option.RequestOption) (res *RealTimeDecision, err error) {
opts = append(r.Options[:], opts...)
path := fmt.Sprintf("real_time_decisions/%s/action", realTimeDecisionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Real Time Decisions are created when your application needs to take action in
// real-time to some event such as a card authorization. For more information, see
// our
// [Real-Time Decisions guide](https://increase.com/documentation/real-time-decisions).
type RealTimeDecision struct {
// The Real-Time Decision identifier.
ID string `json:"id,required"`
// Fields related to a card authorization.
CardAuthorization RealTimeDecisionCardAuthorization `json:"card_authorization,required,nullable"`
// The category of the Real-Time Decision.
Category RealTimeDecisionCategory `json:"category,required"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
// the Real-Time Decision was created.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Fields related to a digital wallet authentication attempt.
DigitalWalletAuthentication RealTimeDecisionDigitalWalletAuthentication `json:"digital_wallet_authentication,required,nullable"`
// Fields related to a digital wallet token provisioning attempt.
DigitalWalletToken RealTimeDecisionDigitalWalletToken `json:"digital_wallet_token,required,nullable"`
// The status of the Real-Time Decision.
Status RealTimeDecisionStatus `json:"status,required"`
// The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which
// your application can no longer respond to the Real-Time Decision.
TimeoutAt time.Time `json:"timeout_at,required" format:"date-time"`
// A constant representing the object's type. For this resource it will always be
// `real_time_decision`.
Type RealTimeDecisionType `json:"type,required"`
JSON realTimeDecisionJSON `json:"-"`
}
// realTimeDecisionJSON contains the JSON metadata for the struct
// [RealTimeDecision]
type realTimeDecisionJSON struct {
ID apijson.Field
CardAuthorization apijson.Field
Category apijson.Field
CreatedAt apijson.Field
DigitalWalletAuthentication apijson.Field
DigitalWalletToken apijson.Field
Status apijson.Field
TimeoutAt apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RealTimeDecision) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r realTimeDecisionJSON) RawJSON() string {
return r.raw
}
// Fields related to a card authorization.
type RealTimeDecisionCardAuthorization struct {
// The identifier of the Account the authorization will debit.
AccountID string `json:"account_id,required"`
// The identifier of the Card that is being authorized.
CardID string `json:"card_id,required"`
// Whether or not the authorization was approved.
Decision RealTimeDecisionCardAuthorizationDecision `json:"decision,required,nullable"`
// If the authorization was made via a Digital Wallet Token (such as an Apple Pay
// purchase), the identifier of the token that was used.
DigitalWalletTokenID string `json:"digital_wallet_token_id,required,nullable"`
// The merchant identifier (commonly abbreviated as MID) of the merchant the card
// is transacting with.
MerchantAcceptorID string `json:"merchant_acceptor_id,required"`
// The Merchant Category Code (commonly abbreviated as MCC) of the merchant the
// card is transacting with.
MerchantCategoryCode string `json:"merchant_category_code,required,nullable"`
// The city the merchant resides in.
MerchantCity string `json:"merchant_city,required,nullable"`
// The country the merchant resides in.
MerchantCountry string `json:"merchant_country,required,nullable"`
// The merchant descriptor of the merchant the card is transacting with.
MerchantDescriptor string `json:"merchant_descriptor,required"`
// Fields specific to the `network`.
NetworkDetails RealTimeDecisionCardAuthorizationNetworkDetails `json:"network_details,required"`
// Network-specific identifiers for a specific request or transaction.
NetworkIdentifiers RealTimeDecisionCardAuthorizationNetworkIdentifiers `json:"network_identifiers,required"`
// The risk score generated by the card network. For Visa this is the Visa Advanced
// Authorization risk score, from 0 to 99, where 99 is the riskiest.
NetworkRiskScore int64 `json:"network_risk_score,required,nullable"`
// If the authorization was made in-person with a physical card, the Physical Card
// that was used.
PhysicalCardID string `json:"physical_card_id,required,nullable"`
// The amount of the attempted authorization in the currency the card user sees at
// the time of purchase, in the minor unit of that currency. For dollars, for
// example, this is cents.
PresentmentAmount int64 `json:"presentment_amount,required"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the currency the
// user sees at the time of purchase.
PresentmentCurrency string `json:"presentment_currency,required"`
// The processing category describes the intent behind the authorization, such as
// whether it was used for bill payments or an automatic fuel dispenser.
ProcessingCategory RealTimeDecisionCardAuthorizationProcessingCategory `json:"processing_category,required"`
// Fields specific to the type of request, such as an incremental authorization.
RequestDetails RealTimeDecisionCardAuthorizationRequestDetails `json:"request_details,required"`
// The amount of the attempted authorization in the currency it will be settled in.
// This currency is the same as that of the Account the card belongs to.
SettlementAmount int64 `json:"settlement_amount,required"`
// The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the currency the
// transaction will be settled in.
SettlementCurrency string `json:"settlement_currency,required"`
// Fields related to verification of cardholder-provided values.
Verification RealTimeDecisionCardAuthorizationVerification `json:"verification,required"`
JSON realTimeDecisionCardAuthorizationJSON `json:"-"`
}
// realTimeDecisionCardAuthorizationJSON contains the JSON metadata for the struct
// [RealTimeDecisionCardAuthorization]
type realTimeDecisionCardAuthorizationJSON struct {
AccountID apijson.Field
CardID apijson.Field
Decision apijson.Field
DigitalWalletTokenID apijson.Field
MerchantAcceptorID apijson.Field
MerchantCategoryCode apijson.Field
MerchantCity apijson.Field
MerchantCountry apijson.Field
MerchantDescriptor apijson.Field
NetworkDetails apijson.Field
NetworkIdentifiers apijson.Field
NetworkRiskScore apijson.Field
PhysicalCardID apijson.Field
PresentmentAmount apijson.Field
PresentmentCurrency apijson.Field
ProcessingCategory apijson.Field
RequestDetails apijson.Field
SettlementAmount apijson.Field
SettlementCurrency apijson.Field
Verification apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RealTimeDecisionCardAuthorization) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r realTimeDecisionCardAuthorizationJSON) RawJSON() string {
return r.raw
}
// Whether or not the authorization was approved.
type RealTimeDecisionCardAuthorizationDecision string
const (
// Approve the authorization.
RealTimeDecisionCardAuthorizationDecisionApprove RealTimeDecisionCardAuthorizationDecision = "approve"
// Decline the authorization.
RealTimeDecisionCardAuthorizationDecisionDecline RealTimeDecisionCardAuthorizationDecision = "decline"
)
func (r RealTimeDecisionCardAuthorizationDecision) IsKnown() bool {
switch r {
case RealTimeDecisionCardAuthorizationDecisionApprove, RealTimeDecisionCardAuthorizationDecisionDecline:
return true
}
return false
}
// Fields specific to the `network`.
type RealTimeDecisionCardAuthorizationNetworkDetails struct {
// The payment network used to process this card authorization.
Category RealTimeDecisionCardAuthorizationNetworkDetailsCategory `json:"category,required"`
// Fields specific to the `visa` network.
Visa RealTimeDecisionCardAuthorizationNetworkDetailsVisa `json:"visa,required,nullable"`
JSON realTimeDecisionCardAuthorizationNetworkDetailsJSON `json:"-"`
}
// realTimeDecisionCardAuthorizationNetworkDetailsJSON contains the JSON metadata
// for the struct [RealTimeDecisionCardAuthorizationNetworkDetails]
type realTimeDecisionCardAuthorizationNetworkDetailsJSON struct {
Category apijson.Field
Visa apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RealTimeDecisionCardAuthorizationNetworkDetails) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r realTimeDecisionCardAuthorizationNetworkDetailsJSON) RawJSON() string {
return r.raw
}
// The payment network used to process this card authorization.
type RealTimeDecisionCardAuthorizationNetworkDetailsCategory string
const (
// Visa
RealTimeDecisionCardAuthorizationNetworkDetailsCategoryVisa RealTimeDecisionCardAuthorizationNetworkDetailsCategory = "visa"
)
func (r RealTimeDecisionCardAuthorizationNetworkDetailsCategory) IsKnown() bool {
switch r {
case RealTimeDecisionCardAuthorizationNetworkDetailsCategoryVisa:
return true
}
return false
}
// Fields specific to the `visa` network.
type RealTimeDecisionCardAuthorizationNetworkDetailsVisa struct {
// For electronic commerce transactions, this identifies the level of security used
// in obtaining the customer's payment credential. For mail or telephone order
// transactions, identifies the type of mail or telephone order.
ElectronicCommerceIndicator RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicator `json:"electronic_commerce_indicator,required,nullable"`
// The method used to enter the cardholder's primary account number and card
// expiration date.
PointOfServiceEntryMode RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode `json:"point_of_service_entry_mode,required,nullable"`
JSON realTimeDecisionCardAuthorizationNetworkDetailsVisaJSON `json:"-"`
}
// realTimeDecisionCardAuthorizationNetworkDetailsVisaJSON contains the JSON
// metadata for the struct [RealTimeDecisionCardAuthorizationNetworkDetailsVisa]
type realTimeDecisionCardAuthorizationNetworkDetailsVisaJSON struct {
ElectronicCommerceIndicator apijson.Field
PointOfServiceEntryMode apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RealTimeDecisionCardAuthorizationNetworkDetailsVisa) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r realTimeDecisionCardAuthorizationNetworkDetailsVisaJSON) RawJSON() string {
return r.raw
}
// For electronic commerce transactions, this identifies the level of security used
// in obtaining the customer's payment credential. For mail or telephone order
// transactions, identifies the type of mail or telephone order.
type RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicator string
const (
// Single transaction of a mail/phone order: Use to indicate that the transaction
// is a mail/phone order purchase, not a recurring transaction or installment
// payment. For domestic transactions in the US region, this value may also
// indicate one bill payment transaction in the card-present or card-absent
// environments.
RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorMailPhoneOrder RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicator = "mail_phone_order"
// Recurring transaction: Payment indicator used to indicate a recurring
// transaction that originates from an acquirer in the US region.
RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorRecurring RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicator = "recurring"
// Installment payment: Payment indicator used to indicate one purchase of goods or
// services that is billed to the account in multiple charges over a period of time
// agreed upon by the cardholder and merchant from transactions that originate from
// an acquirer in the US region.
RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorInstallment RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicator = "installment"
// Unknown classification: other mail order: Use to indicate that the type of
// mail/telephone order is unknown.
RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorUnknownMailPhoneOrder RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicator = "unknown_mail_phone_order"
// Secure electronic commerce transaction: Use to indicate that the electronic
// commerce transaction has been authenticated using e.g., 3-D Secure
RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorSecureElectronicCommerce RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicator = "secure_electronic_commerce"
// Non-authenticated security transaction at a 3-D Secure-capable merchant, and
// merchant attempted to authenticate the cardholder using 3-D Secure: Use to
// identify an electronic commerce transaction where the merchant attempted to
// authenticate the cardholder using 3-D Secure, but was unable to complete the
// authentication because the issuer or cardholder does not participate in the 3-D
// Secure program.
RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorNonAuthenticatedSecurityTransactionAt3DSCapableMerchant RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicator = "non_authenticated_security_transaction_at_3ds_capable_merchant"
// Non-authenticated security transaction: Use to identify an electronic commerce
// transaction that uses data encryption for security however , cardholder
// authentication is not performed using 3-D Secure.
RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorNonAuthenticatedSecurityTransaction RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicator = "non_authenticated_security_transaction"
// Non-secure transaction: Use to identify an electronic commerce transaction that
// has no data protection.
RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorNonSecureTransaction RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicator = "non_secure_transaction"
)
func (r RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicator) IsKnown() bool {
switch r {
case RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorMailPhoneOrder, RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorRecurring, RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorInstallment, RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorUnknownMailPhoneOrder, RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorSecureElectronicCommerce, RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorNonAuthenticatedSecurityTransactionAt3DSCapableMerchant, RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorNonAuthenticatedSecurityTransaction, RealTimeDecisionCardAuthorizationNetworkDetailsVisaElectronicCommerceIndicatorNonSecureTransaction:
return true
}
return false
}
// The method used to enter the cardholder's primary account number and card
// expiration date.
type RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode string
const (
// Unknown
RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeUnknown RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode = "unknown"
// Manual key entry
RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeManual RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode = "manual"
// Magnetic stripe read, without card verification value
RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeMagneticStripeNoCvv RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode = "magnetic_stripe_no_cvv"
// Optical code
RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeOpticalCode RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode = "optical_code"
// Contact chip card
RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeIntegratedCircuitCard RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode = "integrated_circuit_card"
// Contactless read of chip card
RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeContactless RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode = "contactless"
// Transaction initiated using a credential that has previously been stored on file
RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeCredentialOnFile RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode = "credential_on_file"
// Magnetic stripe read
RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeMagneticStripe RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode = "magnetic_stripe"
// Contactless read of magnetic stripe data
RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeContactlessMagneticStripe RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode = "contactless_magnetic_stripe"
// Contact chip card, without card verification value
RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeIntegratedCircuitCardNoCvv RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode = "integrated_circuit_card_no_cvv"
)
func (r RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryMode) IsKnown() bool {
switch r {
case RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeUnknown, RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeManual, RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeMagneticStripeNoCvv, RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeOpticalCode, RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeIntegratedCircuitCard, RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeContactless, RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeCredentialOnFile, RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeMagneticStripe, RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeContactlessMagneticStripe, RealTimeDecisionCardAuthorizationNetworkDetailsVisaPointOfServiceEntryModeIntegratedCircuitCardNoCvv:
return true
}
return false
}
// Network-specific identifiers for a specific request or transaction.
type RealTimeDecisionCardAuthorizationNetworkIdentifiers struct {
// A life-cycle identifier used across e.g., an authorization and a reversal.
// Expected to be unique per acquirer within a window of time. For some card
// networks the retrieval reference number includes the trace counter.
RetrievalReferenceNumber string `json:"retrieval_reference_number,required,nullable"`
// A counter used to verify an individual authorization. Expected to be unique per
// acquirer within a window of time.
TraceNumber string `json:"trace_number,required,nullable"`
// A globally unique transaction identifier provided by the card network, used
// across multiple life-cycle requests.
TransactionID string `json:"transaction_id,required,nullable"`
JSON realTimeDecisionCardAuthorizationNetworkIdentifiersJSON `json:"-"`
}
// realTimeDecisionCardAuthorizationNetworkIdentifiersJSON contains the JSON
// metadata for the struct [RealTimeDecisionCardAuthorizationNetworkIdentifiers]
type realTimeDecisionCardAuthorizationNetworkIdentifiersJSON struct {
RetrievalReferenceNumber apijson.Field
TraceNumber apijson.Field
TransactionID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RealTimeDecisionCardAuthorizationNetworkIdentifiers) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r realTimeDecisionCardAuthorizationNetworkIdentifiersJSON) RawJSON() string {
return r.raw
}
// The processing category describes the intent behind the authorization, such as
// whether it was used for bill payments or an automatic fuel dispenser.
type RealTimeDecisionCardAuthorizationProcessingCategory string
const (
// Account funding transactions are transactions used to e.g., fund an account or
// transfer funds between accounts.
RealTimeDecisionCardAuthorizationProcessingCategoryAccountFunding RealTimeDecisionCardAuthorizationProcessingCategory = "account_funding"
// Automatic fuel dispenser authorizations occur when a card is used at a gas pump,
// prior to the actual transaction amount being known. They are followed by an
// advice message that updates the amount of the pending transaction.
RealTimeDecisionCardAuthorizationProcessingCategoryAutomaticFuelDispenser RealTimeDecisionCardAuthorizationProcessingCategory = "automatic_fuel_dispenser"
// A transaction used to pay a bill.
RealTimeDecisionCardAuthorizationProcessingCategoryBillPayment RealTimeDecisionCardAuthorizationProcessingCategory = "bill_payment"
// A regular purchase.
RealTimeDecisionCardAuthorizationProcessingCategoryPurchase RealTimeDecisionCardAuthorizationProcessingCategory = "purchase"
// Quasi-cash transactions represent purchases of items which may be convertible to
// cash.
RealTimeDecisionCardAuthorizationProcessingCategoryQuasiCash RealTimeDecisionCardAuthorizationProcessingCategory = "quasi_cash"
// A refund card authorization, sometimes referred to as a credit voucher
// authorization, where funds are credited to the cardholder.
RealTimeDecisionCardAuthorizationProcessingCategoryRefund RealTimeDecisionCardAuthorizationProcessingCategory = "refund"
)
func (r RealTimeDecisionCardAuthorizationProcessingCategory) IsKnown() bool {
switch r {
case RealTimeDecisionCardAuthorizationProcessingCategoryAccountFunding, RealTimeDecisionCardAuthorizationProcessingCategoryAutomaticFuelDispenser, RealTimeDecisionCardAuthorizationProcessingCategoryBillPayment, RealTimeDecisionCardAuthorizationProcessingCategoryPurchase, RealTimeDecisionCardAuthorizationProcessingCategoryQuasiCash, RealTimeDecisionCardAuthorizationProcessingCategoryRefund:
return true
}
return false
}
// Fields specific to the type of request, such as an incremental authorization.
type RealTimeDecisionCardAuthorizationRequestDetails struct {
// The type of this request (e.g., an initial authorization or an incremental
// authorization).
Category RealTimeDecisionCardAuthorizationRequestDetailsCategory `json:"category,required"`
// Fields specific to the category `incremental_authorization`.
IncrementalAuthorization RealTimeDecisionCardAuthorizationRequestDetailsIncrementalAuthorization `json:"incremental_authorization,required,nullable"`
// Fields specific to the category `initial_authorization`.
InitialAuthorization interface{} `json:"initial_authorization,required,nullable"`
JSON realTimeDecisionCardAuthorizationRequestDetailsJSON `json:"-"`
}
// realTimeDecisionCardAuthorizationRequestDetailsJSON contains the JSON metadata
// for the struct [RealTimeDecisionCardAuthorizationRequestDetails]
type realTimeDecisionCardAuthorizationRequestDetailsJSON struct {
Category apijson.Field
IncrementalAuthorization apijson.Field
InitialAuthorization apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RealTimeDecisionCardAuthorizationRequestDetails) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r realTimeDecisionCardAuthorizationRequestDetailsJSON) RawJSON() string {
return r.raw
}
// The type of this request (e.g., an initial authorization or an incremental
// authorization).
type RealTimeDecisionCardAuthorizationRequestDetailsCategory string
const (
// A regular, standalone authorization.
RealTimeDecisionCardAuthorizationRequestDetailsCategoryInitialAuthorization RealTimeDecisionCardAuthorizationRequestDetailsCategory = "initial_authorization"
// An incremental request to increase the amount of an existing authorization.
RealTimeDecisionCardAuthorizationRequestDetailsCategoryIncrementalAuthorization RealTimeDecisionCardAuthorizationRequestDetailsCategory = "incremental_authorization"
)
func (r RealTimeDecisionCardAuthorizationRequestDetailsCategory) IsKnown() bool {
switch r {
case RealTimeDecisionCardAuthorizationRequestDetailsCategoryInitialAuthorization, RealTimeDecisionCardAuthorizationRequestDetailsCategoryIncrementalAuthorization:
return true
}
return false
}
// Fields specific to the category `incremental_authorization`.
type RealTimeDecisionCardAuthorizationRequestDetailsIncrementalAuthorization struct {
// The card payment for this authorization and increment.
CardPaymentID string `json:"card_payment_id,required"`
// The identifier of the card authorization this request is attempting to
// increment.
OriginalCardAuthorizationID string `json:"original_card_authorization_id,required"`
JSON realTimeDecisionCardAuthorizationRequestDetailsIncrementalAuthorizationJSON `json:"-"`
}
// realTimeDecisionCardAuthorizationRequestDetailsIncrementalAuthorizationJSON
// contains the JSON metadata for the struct
// [RealTimeDecisionCardAuthorizationRequestDetailsIncrementalAuthorization]
type realTimeDecisionCardAuthorizationRequestDetailsIncrementalAuthorizationJSON struct {
CardPaymentID apijson.Field
OriginalCardAuthorizationID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RealTimeDecisionCardAuthorizationRequestDetailsIncrementalAuthorization) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r realTimeDecisionCardAuthorizationRequestDetailsIncrementalAuthorizationJSON) RawJSON() string {
return r.raw
}
// Fields related to verification of cardholder-provided values.
type RealTimeDecisionCardAuthorizationVerification struct {
// Fields related to verification of the Card Verification Code, a 3-digit code on
// the back of the card.
CardVerificationCode RealTimeDecisionCardAuthorizationVerificationCardVerificationCode `json:"card_verification_code,required"`
// Cardholder address provided in the authorization request and the address on file
// we verified it against.
CardholderAddress RealTimeDecisionCardAuthorizationVerificationCardholderAddress `json:"cardholder_address,required"`
JSON realTimeDecisionCardAuthorizationVerificationJSON `json:"-"`
}
// realTimeDecisionCardAuthorizationVerificationJSON contains the JSON metadata for
// the struct [RealTimeDecisionCardAuthorizationVerification]
type realTimeDecisionCardAuthorizationVerificationJSON struct {
CardVerificationCode apijson.Field
CardholderAddress apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RealTimeDecisionCardAuthorizationVerification) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r realTimeDecisionCardAuthorizationVerificationJSON) RawJSON() string {
return r.raw
}
// Fields related to verification of the Card Verification Code, a 3-digit code on
// the back of the card.
type RealTimeDecisionCardAuthorizationVerificationCardVerificationCode struct {
// The result of verifying the Card Verification Code.
Result RealTimeDecisionCardAuthorizationVerificationCardVerificationCodeResult `json:"result,required"`
JSON realTimeDecisionCardAuthorizationVerificationCardVerificationCodeJSON `json:"-"`
}
// realTimeDecisionCardAuthorizationVerificationCardVerificationCodeJSON contains
// the JSON metadata for the struct
// [RealTimeDecisionCardAuthorizationVerificationCardVerificationCode]
type realTimeDecisionCardAuthorizationVerificationCardVerificationCodeJSON struct {
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RealTimeDecisionCardAuthorizationVerificationCardVerificationCode) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r realTimeDecisionCardAuthorizationVerificationCardVerificationCodeJSON) RawJSON() string {
return r.raw
}
// The result of verifying the Card Verification Code.
type RealTimeDecisionCardAuthorizationVerificationCardVerificationCodeResult string
const (
// No card verification code was provided in the authorization request.
RealTimeDecisionCardAuthorizationVerificationCardVerificationCodeResultNotChecked RealTimeDecisionCardAuthorizationVerificationCardVerificationCodeResult = "not_checked"
// The card verification code matched the one on file.
RealTimeDecisionCardAuthorizationVerificationCardVerificationCodeResultMatch RealTimeDecisionCardAuthorizationVerificationCardVerificationCodeResult = "match"
// The card verification code did not match the one on file.
RealTimeDecisionCardAuthorizationVerificationCardVerificationCodeResultNoMatch RealTimeDecisionCardAuthorizationVerificationCardVerificationCodeResult = "no_match"
)
func (r RealTimeDecisionCardAuthorizationVerificationCardVerificationCodeResult) IsKnown() bool {
switch r {
case RealTimeDecisionCardAuthorizationVerificationCardVerificationCodeResultNotChecked, RealTimeDecisionCardAuthorizationVerificationCardVerificationCodeResultMatch, RealTimeDecisionCardAuthorizationVerificationCardVerificationCodeResultNoMatch:
return true
}
return false
}
// Cardholder address provided in the authorization request and the address on file
// we verified it against.
type RealTimeDecisionCardAuthorizationVerificationCardholderAddress struct {
// Line 1 of the address on file for the cardholder.
ActualLine1 string `json:"actual_line1,required,nullable"`
// The postal code of the address on file for the cardholder.
ActualPostalCode string `json:"actual_postal_code,required,nullable"`
// The cardholder address line 1 provided for verification in the authorization
// request.
ProvidedLine1 string `json:"provided_line1,required,nullable"`
// The postal code provided for verification in the authorization request.
ProvidedPostalCode string `json:"provided_postal_code,required,nullable"`
// The address verification result returned to the card network.
Result RealTimeDecisionCardAuthorizationVerificationCardholderAddressResult `json:"result,required"`
JSON realTimeDecisionCardAuthorizationVerificationCardholderAddressJSON `json:"-"`
}
// realTimeDecisionCardAuthorizationVerificationCardholderAddressJSON contains the
// JSON metadata for the struct
// [RealTimeDecisionCardAuthorizationVerificationCardholderAddress]
type realTimeDecisionCardAuthorizationVerificationCardholderAddressJSON struct {
ActualLine1 apijson.Field
ActualPostalCode apijson.Field
ProvidedLine1 apijson.Field
ProvidedPostalCode apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RealTimeDecisionCardAuthorizationVerificationCardholderAddress) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r realTimeDecisionCardAuthorizationVerificationCardholderAddressJSON) RawJSON() string {
return r.raw
}
// The address verification result returned to the card network.
type RealTimeDecisionCardAuthorizationVerificationCardholderAddressResult string
const (
// No adress was provided in the authorization request.
RealTimeDecisionCardAuthorizationVerificationCardholderAddressResultNotChecked RealTimeDecisionCardAuthorizationVerificationCardholderAddressResult = "not_checked"
// Postal code matches, but the street address was not verified.
RealTimeDecisionCardAuthorizationVerificationCardholderAddressResultPostalCodeMatchAddressNotChecked RealTimeDecisionCardAuthorizationVerificationCardholderAddressResult = "postal_code_match_address_not_checked"
// Postal code matches, but the street address does not match.
RealTimeDecisionCardAuthorizationVerificationCardholderAddressResultPostalCodeMatchAddressNoMatch RealTimeDecisionCardAuthorizationVerificationCardholderAddressResult = "postal_code_match_address_no_match"
// Postal code does not match, but the street address matches.
RealTimeDecisionCardAuthorizationVerificationCardholderAddressResultPostalCodeNoMatchAddressMatch RealTimeDecisionCardAuthorizationVerificationCardholderAddressResult = "postal_code_no_match_address_match"
// Postal code and street address match.
RealTimeDecisionCardAuthorizationVerificationCardholderAddressResultMatch RealTimeDecisionCardAuthorizationVerificationCardholderAddressResult = "match"
// Postal code and street address do not match.
RealTimeDecisionCardAuthorizationVerificationCardholderAddressResultNoMatch RealTimeDecisionCardAuthorizationVerificationCardholderAddressResult = "no_match"
)
func (r RealTimeDecisionCardAuthorizationVerificationCardholderAddressResult) IsKnown() bool {
switch r {
case RealTimeDecisionCardAuthorizationVerificationCardholderAddressResultNotChecked, RealTimeDecisionCardAuthorizationVerificationCardholderAddressResultPostalCodeMatchAddressNotChecked, RealTimeDecisionCardAuthorizationVerificationCardholderAddressResultPostalCodeMatchAddressNoMatch, RealTimeDecisionCardAuthorizationVerificationCardholderAddressResultPostalCodeNoMatchAddressMatch, RealTimeDecisionCardAuthorizationVerificationCardholderAddressResultMatch, RealTimeDecisionCardAuthorizationVerificationCardholderAddressResultNoMatch:
return true
}
return false
}
// The category of the Real-Time Decision.
type RealTimeDecisionCategory string
const (
// A card is being authorized.
RealTimeDecisionCategoryCardAuthorizationRequested RealTimeDecisionCategory = "card_authorization_requested"
// A card is being loaded into a digital wallet.
RealTimeDecisionCategoryDigitalWalletTokenRequested RealTimeDecisionCategory = "digital_wallet_token_requested"
// A card is being loaded into a digital wallet and requires cardholder
// authentication.
RealTimeDecisionCategoryDigitalWalletAuthenticationRequested RealTimeDecisionCategory = "digital_wallet_authentication_requested"
)
func (r RealTimeDecisionCategory) IsKnown() bool {
switch r {
case RealTimeDecisionCategoryCardAuthorizationRequested, RealTimeDecisionCategoryDigitalWalletTokenRequested, RealTimeDecisionCategoryDigitalWalletAuthenticationRequested:
return true
}
return false
}
// Fields related to a digital wallet authentication attempt.
type RealTimeDecisionDigitalWalletAuthentication struct {
// The identifier of the Card that is being tokenized.
CardID string `json:"card_id,required"`
// The channel to send the card user their one-time passcode.
Channel RealTimeDecisionDigitalWalletAuthenticationChannel `json:"channel,required"`
// The digital wallet app being used.
DigitalWallet RealTimeDecisionDigitalWalletAuthenticationDigitalWallet `json:"digital_wallet,required"`
// The email to send the one-time passcode to if `channel` is equal to `email`.
Email string `json:"email,required,nullable"`
// The one-time passcode to send the card user.
OneTimePasscode string `json:"one_time_passcode,required"`
// The phone number to send the one-time passcode to if `channel` is equal to
// `sms`.
Phone string `json:"phone,required,nullable"`
// Whether your application successfully delivered the one-time passcode.
Result RealTimeDecisionDigitalWalletAuthenticationResult `json:"result,required,nullable"`
JSON realTimeDecisionDigitalWalletAuthenticationJSON `json:"-"`
}
// realTimeDecisionDigitalWalletAuthenticationJSON contains the JSON metadata for
// the struct [RealTimeDecisionDigitalWalletAuthentication]
type realTimeDecisionDigitalWalletAuthenticationJSON struct {
CardID apijson.Field
Channel apijson.Field
DigitalWallet apijson.Field
Email apijson.Field
OneTimePasscode apijson.Field
Phone apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RealTimeDecisionDigitalWalletAuthentication) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r realTimeDecisionDigitalWalletAuthenticationJSON) RawJSON() string {
return r.raw
}
// The channel to send the card user their one-time passcode.
type RealTimeDecisionDigitalWalletAuthenticationChannel string
const (
// Send one-time passcodes over SMS.
RealTimeDecisionDigitalWalletAuthenticationChannelSMS RealTimeDecisionDigitalWalletAuthenticationChannel = "sms"
// Send one-time passcodes over email.
RealTimeDecisionDigitalWalletAuthenticationChannelEmail RealTimeDecisionDigitalWalletAuthenticationChannel = "email"
)
func (r RealTimeDecisionDigitalWalletAuthenticationChannel) IsKnown() bool {
switch r {
case RealTimeDecisionDigitalWalletAuthenticationChannelSMS, RealTimeDecisionDigitalWalletAuthenticationChannelEmail:
return true
}
return false
}
// The digital wallet app being used.
type RealTimeDecisionDigitalWalletAuthenticationDigitalWallet string
const (
// Apple Pay
RealTimeDecisionDigitalWalletAuthenticationDigitalWalletApplePay RealTimeDecisionDigitalWalletAuthenticationDigitalWallet = "apple_pay"
// Google Pay
RealTimeDecisionDigitalWalletAuthenticationDigitalWalletGooglePay RealTimeDecisionDigitalWalletAuthenticationDigitalWallet = "google_pay"
// Unknown
RealTimeDecisionDigitalWalletAuthenticationDigitalWalletUnknown RealTimeDecisionDigitalWalletAuthenticationDigitalWallet = "unknown"
)
func (r RealTimeDecisionDigitalWalletAuthenticationDigitalWallet) IsKnown() bool {
switch r {
case RealTimeDecisionDigitalWalletAuthenticationDigitalWalletApplePay, RealTimeDecisionDigitalWalletAuthenticationDigitalWalletGooglePay, RealTimeDecisionDigitalWalletAuthenticationDigitalWalletUnknown:
return true
}
return false
}
// Whether your application successfully delivered the one-time passcode.
type RealTimeDecisionDigitalWalletAuthenticationResult string
const (
// Your application successfully delivered the one-time passcode to the cardholder.
RealTimeDecisionDigitalWalletAuthenticationResultSuccess RealTimeDecisionDigitalWalletAuthenticationResult = "success"
// Your application failed to deliver the one-time passcode to the cardholder.
RealTimeDecisionDigitalWalletAuthenticationResultFailure RealTimeDecisionDigitalWalletAuthenticationResult = "failure"
)
func (r RealTimeDecisionDigitalWalletAuthenticationResult) IsKnown() bool {
switch r {
case RealTimeDecisionDigitalWalletAuthenticationResultSuccess, RealTimeDecisionDigitalWalletAuthenticationResultFailure:
return true
}
return false
}
// Fields related to a digital wallet token provisioning attempt.
type RealTimeDecisionDigitalWalletToken struct {
// The identifier of the Card that is being tokenized.
CardID string `json:"card_id,required"`
// The identifier of the Card Profile that was set via the real time decision. This
// will be null until the real time decision is responded to or if the real time
// decision did not set a card profile.
CardProfileID string `json:"card_profile_id,required,nullable"`
// Whether or not the provisioning request was approved. This will be null until
// the real time decision is responded to.
Decision RealTimeDecisionDigitalWalletTokenDecision `json:"decision,required,nullable"`
// The digital wallet app being used.
DigitalWallet RealTimeDecisionDigitalWalletTokenDigitalWallet `json:"digital_wallet,required"`
JSON realTimeDecisionDigitalWalletTokenJSON `json:"-"`
}
// realTimeDecisionDigitalWalletTokenJSON contains the JSON metadata for the struct
// [RealTimeDecisionDigitalWalletToken]
type realTimeDecisionDigitalWalletTokenJSON struct {
CardID apijson.Field
CardProfileID apijson.Field
Decision apijson.Field
DigitalWallet apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *RealTimeDecisionDigitalWalletToken) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r realTimeDecisionDigitalWalletTokenJSON) RawJSON() string {
return r.raw
}
// Whether or not the provisioning request was approved. This will be null until
// the real time decision is responded to.
type RealTimeDecisionDigitalWalletTokenDecision string
const (
// Approve the provisioning request.
RealTimeDecisionDigitalWalletTokenDecisionApprove RealTimeDecisionDigitalWalletTokenDecision = "approve"
// Decline the provisioning request.
RealTimeDecisionDigitalWalletTokenDecisionDecline RealTimeDecisionDigitalWalletTokenDecision = "decline"
)
func (r RealTimeDecisionDigitalWalletTokenDecision) IsKnown() bool {
switch r {
case RealTimeDecisionDigitalWalletTokenDecisionApprove, RealTimeDecisionDigitalWalletTokenDecisionDecline:
return true
}
return false
}
// The digital wallet app being used.
type RealTimeDecisionDigitalWalletTokenDigitalWallet string
const (
// Apple Pay
RealTimeDecisionDigitalWalletTokenDigitalWalletApplePay RealTimeDecisionDigitalWalletTokenDigitalWallet = "apple_pay"
// Google Pay
RealTimeDecisionDigitalWalletTokenDigitalWalletGooglePay RealTimeDecisionDigitalWalletTokenDigitalWallet = "google_pay"
// Unknown
RealTimeDecisionDigitalWalletTokenDigitalWalletUnknown RealTimeDecisionDigitalWalletTokenDigitalWallet = "unknown"
)
func (r RealTimeDecisionDigitalWalletTokenDigitalWallet) IsKnown() bool {
switch r {
case RealTimeDecisionDigitalWalletTokenDigitalWalletApplePay, RealTimeDecisionDigitalWalletTokenDigitalWalletGooglePay, RealTimeDecisionDigitalWalletTokenDigitalWalletUnknown:
return true
}
return false
}
// The status of the Real-Time Decision.
type RealTimeDecisionStatus string
const (
// The decision is pending action via real-time webhook.
RealTimeDecisionStatusPending RealTimeDecisionStatus = "pending"
// Your webhook actioned the real-time decision.
RealTimeDecisionStatusResponded RealTimeDecisionStatus = "responded"
// Your webhook failed to respond to the authorization in time.
RealTimeDecisionStatusTimedOut RealTimeDecisionStatus = "timed_out"
)
func (r RealTimeDecisionStatus) IsKnown() bool {
switch r {
case RealTimeDecisionStatusPending, RealTimeDecisionStatusResponded, RealTimeDecisionStatusTimedOut:
return true
}
return false
}
// A constant representing the object's type. For this resource it will always be
// `real_time_decision`.
type RealTimeDecisionType string
const (
RealTimeDecisionTypeRealTimeDecision RealTimeDecisionType = "real_time_decision"
)
func (r RealTimeDecisionType) IsKnown() bool {
switch r {
case RealTimeDecisionTypeRealTimeDecision:
return true
}
return false
}
type RealTimeDecisionActionParams struct {
// If the Real-Time Decision relates to a card authorization attempt, this object
// contains your response to the authorization.
CardAuthorization param.Field[RealTimeDecisionActionParamsCardAuthorization] `json:"card_authorization"`
// If the Real-Time Decision relates to a digital wallet authentication attempt,
// this object contains your response to the authentication.
DigitalWalletAuthentication param.Field[RealTimeDecisionActionParamsDigitalWalletAuthentication] `json:"digital_wallet_authentication"`
// If the Real-Time Decision relates to a digital wallet token provisioning
// attempt, this object contains your response to the attempt.
DigitalWalletToken param.Field[RealTimeDecisionActionParamsDigitalWalletToken] `json:"digital_wallet_token"`
}
func (r RealTimeDecisionActionParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// If the Real-Time Decision relates to a card authorization attempt, this object
// contains your response to the authorization.
type RealTimeDecisionActionParamsCardAuthorization struct {
// Whether the card authorization should be approved or declined.
Decision param.Field[RealTimeDecisionActionParamsCardAuthorizationDecision] `json:"decision,required"`
}
func (r RealTimeDecisionActionParamsCardAuthorization) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Whether the card authorization should be approved or declined.
type RealTimeDecisionActionParamsCardAuthorizationDecision string
const (
// Approve the authorization.
RealTimeDecisionActionParamsCardAuthorizationDecisionApprove RealTimeDecisionActionParamsCardAuthorizationDecision = "approve"
// Decline the authorization.
RealTimeDecisionActionParamsCardAuthorizationDecisionDecline RealTimeDecisionActionParamsCardAuthorizationDecision = "decline"
)
func (r RealTimeDecisionActionParamsCardAuthorizationDecision) IsKnown() bool {
switch r {
case RealTimeDecisionActionParamsCardAuthorizationDecisionApprove, RealTimeDecisionActionParamsCardAuthorizationDecisionDecline:
return true
}
return false
}
// If the Real-Time Decision relates to a digital wallet authentication attempt,
// this object contains your response to the authentication.
type RealTimeDecisionActionParamsDigitalWalletAuthentication struct {
// Whether your application was able to deliver the one-time passcode.
Result param.Field[RealTimeDecisionActionParamsDigitalWalletAuthenticationResult] `json:"result,required"`
}
func (r RealTimeDecisionActionParamsDigitalWalletAuthentication) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Whether your application was able to deliver the one-time passcode.
type RealTimeDecisionActionParamsDigitalWalletAuthenticationResult string
const (
// Your application successfully delivered the one-time passcode to the cardholder.
RealTimeDecisionActionParamsDigitalWalletAuthenticationResultSuccess RealTimeDecisionActionParamsDigitalWalletAuthenticationResult = "success"
// Your application failed to deliver the one-time passcode to the cardholder.
RealTimeDecisionActionParamsDigitalWalletAuthenticationResultFailure RealTimeDecisionActionParamsDigitalWalletAuthenticationResult = "failure"
)
func (r RealTimeDecisionActionParamsDigitalWalletAuthenticationResult) IsKnown() bool {
switch r {
case RealTimeDecisionActionParamsDigitalWalletAuthenticationResultSuccess, RealTimeDecisionActionParamsDigitalWalletAuthenticationResultFailure:
return true
}
return false
}
// If the Real-Time Decision relates to a digital wallet token provisioning
// attempt, this object contains your response to the attempt.
type RealTimeDecisionActionParamsDigitalWalletToken struct {
// If your application approves the provisioning attempt, this contains metadata
// about the digital wallet token that will be generated.
Approval param.Field[RealTimeDecisionActionParamsDigitalWalletTokenApproval] `json:"approval"`
// If your application declines the provisioning attempt, this contains details
// about the decline.
Decline param.Field[RealTimeDecisionActionParamsDigitalWalletTokenDecline] `json:"decline"`
}
func (r RealTimeDecisionActionParamsDigitalWalletToken) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// If your application approves the provisioning attempt, this contains metadata
// about the digital wallet token that will be generated.
type RealTimeDecisionActionParamsDigitalWalletTokenApproval struct {
// An email address that can be used to verify the cardholder via one-time
// passcode.
Email param.Field[string] `json:"email"`
// A phone number that can be used to verify the cardholder via one-time passcode
// over SMS.
Phone param.Field[string] `json:"phone"`
}
func (r RealTimeDecisionActionParamsDigitalWalletTokenApproval) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// If your application declines the provisioning attempt, this contains details
// about the decline.
type RealTimeDecisionActionParamsDigitalWalletTokenDecline struct {
// Why the tokenization attempt was declined. This is for logging purposes only and
// is not displayed to the end-user.
Reason param.Field[string] `json:"reason"`
}
func (r RealTimeDecisionActionParamsDigitalWalletTokenDecline) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}