1
+ // noinspection JSUnusedGlobalSymbols
2
+
1
3
import { defaultElementIds , ElementTypes , MERCHANT_FEE , SERVICE_FEE } from './data' ;
2
4
3
5
export enum ResponseMessageTypes {
@@ -10,43 +12,43 @@ export enum ResponseMessageTypes {
10
12
READY = 'READY' ,
11
13
}
12
14
13
- export type AddressObject = {
15
+ export interface AddressObject {
14
16
line1 ?: string ;
15
17
line2 ?: string ;
16
18
city ?: string ;
17
19
region ?: string ;
18
20
postal_code ?: string ;
19
21
country ?: string ;
20
- } ;
22
+ }
21
23
22
- export type PayorInfo = {
24
+ export interface PayorInfo {
23
25
first_name ?: string ;
24
26
last_name ?: string ;
25
27
email ?: string ;
26
28
phone ?: string ;
27
29
personal_address ?: AddressObject ;
28
- } ;
30
+ }
29
31
30
- export type BillingInfo = {
32
+ export interface BillingInfo {
31
33
name ?: string ;
32
34
address ?: AddressObject ;
33
- } ;
35
+ }
34
36
35
- export type ConfirmationObject = {
37
+ export interface ConfirmationObject {
36
38
first_six : string ;
37
39
last_four : string ;
38
40
brand : string ;
39
41
receipt_number : string ;
40
42
amount : number ;
41
43
service_fee : number ;
42
- } ;
44
+ }
43
45
44
- export type ConfirmationResponse = {
46
+ export interface ConfirmationResponse {
45
47
type : ResponseMessageTypes . CONFIRMATION ;
46
48
body : ConfirmationObject ;
47
- } ;
49
+ }
48
50
49
- export type SuccessfulTransactionObject = {
51
+ export interface SuccessfulTransactionObject {
50
52
receipt_number : string ;
51
53
last_four : string ;
52
54
brand : string ;
@@ -55,23 +57,23 @@ export type SuccessfulTransactionObject = {
55
57
service_fee : number ;
56
58
state : string ;
57
59
// Keeping tags in the response for backwards compatibility
58
- tags : { [ keys : string | number ] : string | number | boolean } ;
59
- metadata : { [ keys : string | number ] : string | number | boolean } ;
60
+ tags : Record < string | number , string | number | boolean > ;
61
+ metadata : Record < string | number , string | number | boolean > ;
60
62
payor_id : string ;
61
63
payment_method_id : string ;
62
- } ;
64
+ }
63
65
64
- export type SuccessfulTransactionResponse = {
66
+ export interface SuccessfulTransactionResponse {
65
67
type : ResponseMessageTypes . SUCCESS ;
66
68
body : SuccessfulTransactionObject ;
67
- } ;
69
+ }
68
70
69
- export type ReadyResponse = {
71
+ export interface ReadyResponse {
70
72
type : ResponseMessageTypes . READY ;
71
73
body : true ;
72
- } ;
74
+ }
73
75
74
- export type FailedTransactionObject = {
76
+ export interface FailedTransactionObject {
75
77
receipt_number : string ;
76
78
last_four : string ;
77
79
brand : string ;
@@ -82,37 +84,37 @@ export type FailedTransactionObject = {
82
84
failure_code : string ;
83
85
failure_text : string ;
84
86
} ;
85
- } ;
87
+ }
86
88
87
- export type FailedTransactionResponse = {
89
+ export interface FailedTransactionResponse {
88
90
type : ResponseMessageTypes . FAILED ;
89
91
body : FailedTransactionObject ;
90
- } ;
92
+ }
91
93
92
- export type CashBarcodeObject = {
94
+ export interface CashBarcodeObject {
93
95
barcodeUrl : string ;
94
96
mapUrl : string ;
95
- } ;
97
+ }
96
98
97
- export type CashBarcodeResponse = {
99
+ export interface CashBarcodeResponse {
98
100
type : ResponseMessageTypes . CASH ;
99
101
body : CashBarcodeObject ;
100
- } ;
102
+ }
101
103
102
- export type TokenizedPaymentMethodObject = {
104
+ export interface TokenizedPaymentMethodObject {
103
105
payment_method_id : string ;
104
106
payor_id : string ;
105
107
last_four : string ;
106
108
brand : string ;
107
109
expiration : string ;
108
110
payment_type : 'card' | 'ach' ;
109
111
metadata : { [ keys : string | number ] : string | number | boolean } ;
110
- } ;
112
+ }
111
113
112
- export type TokenizedPaymentMethodResponse = {
114
+ export interface TokenizedPaymentMethodResponse {
113
115
type : ResponseMessageTypes . TOKENIZED ;
114
116
body : TokenizedPaymentMethodObject ;
115
- } ;
117
+ }
116
118
117
119
// Error Types
118
120
export enum ErrorType {
@@ -130,20 +132,20 @@ export enum ErrorType {
130
132
NOT_READY = 'NOT_READY' ,
131
133
}
132
134
133
- export type ErrorResponse = {
135
+ export interface ErrorResponse {
134
136
type : ResponseMessageTypes . ERROR ;
135
137
error : string ;
136
- } ;
138
+ }
137
139
138
140
// Function Prop Types
139
- export type TokenizeProps = {
141
+ export interface TokenizeProps {
140
142
payorInfo ?: PayorInfo ;
141
143
payorId ?: string ;
142
144
metadata ?: { [ keys : string | number ] : string | number | boolean } ;
143
145
billingInfo ?: BillingInfo ;
144
- } ;
146
+ }
145
147
146
- export type TransactProps = {
148
+ export interface TransactProps {
147
149
amount : number ;
148
150
payorInfo ?: PayorInfo ;
149
151
billingInfo ?: BillingInfo ;
@@ -161,18 +163,18 @@ export type TransactProps = {
161
163
recurringId ?: string ;
162
164
healthExpenseType ?: HealthExpenseType ;
163
165
level3DataSummary ?: Level3DataSummary ;
164
- } ;
166
+ }
165
167
166
- export type PayTheoryPaymentFieldsInput = {
168
+ export interface PayTheoryPaymentFieldsInput {
167
169
apiKey : string ;
168
170
styles ?: StyleObject ;
169
- metadata ?: { [ key : string | number ] : string | number | boolean } ;
171
+ metadata ?: Record < string | number , string | number | boolean > ;
170
172
placeholders ?: PlaceholderObject ;
171
173
elementIds ?: typeof defaultElementIds ;
172
174
session ?: string ; // This is used for internal use to connect a button and qr code to a hosted checkout page
173
175
feeMode ?: typeof MERCHANT_FEE | typeof SERVICE_FEE ;
174
176
amount ?: number ;
175
- } ;
177
+ }
176
178
177
179
export enum AcceptedPaymentMethods {
178
180
ALL = 'ALL' ,
@@ -198,41 +200,41 @@ export enum ButtonColor {
198
200
GREY = 'GREY' ,
199
201
}
200
202
201
- export type CheckoutDetails = {
203
+ export interface CheckoutDetails {
202
204
amount : number ;
203
205
paymentName : string ;
204
206
paymentDescription ?: string ;
205
207
requirePhone ?: boolean ;
206
208
callToAction ?: CallToAction ;
207
209
acceptedPaymentMethods ?: AcceptedPaymentMethods ;
208
210
payorId ?: string ;
209
- metadata ?: { [ keys : string | number ] : string | number | boolean } ;
211
+ metadata ?: Record < string | number , string | number | boolean > ;
210
212
feeMode ?: typeof MERCHANT_FEE | typeof SERVICE_FEE ;
211
213
accountCode ?: string ;
212
214
paymentParameters ?: string ;
213
215
invoiceId ?: string ;
214
216
recurringId ?: string ;
215
217
healthExpenseType ?: HealthExpenseType ;
216
218
level3DataSummary ?: Level3DataSummary ;
217
- } ;
219
+ }
218
220
219
- export type PayTheoryQRInput = {
221
+ export interface PayTheoryQRInput {
220
222
apiKey : string ;
221
223
checkoutDetails : CheckoutDetails ;
222
224
size : number ;
223
225
onReady : ( ready : true ) => void ;
224
226
onError : ( error : string ) => void ;
225
227
onSuccess : ( result : SuccessfulTransactionObject ) => void ;
226
- } ;
228
+ }
227
229
228
- export type ButtonStyle = {
230
+ export interface ButtonStyle {
229
231
color : ButtonColor ;
230
232
callToAction : CallToAction ;
231
233
pill : boolean ;
232
234
height : number ;
233
- } ;
235
+ }
234
236
235
- export type PayTheoryButtonInput = {
237
+ export interface PayTheoryButtonInput {
236
238
apiKey : string ;
237
239
checkoutDetails : CheckoutDetails ;
238
240
style ?: ButtonStyle ;
@@ -242,20 +244,20 @@ export type PayTheoryButtonInput = {
242
244
onCancel ?: ( ) => void ;
243
245
onSuccess ?: ( result : SuccessfulTransactionObject ) => void ;
244
246
onBarcode ?: ( result : CashBarcodeObject ) => void ;
245
- } ;
247
+ }
246
248
247
- export type FieldState = {
249
+ export interface FieldState {
248
250
isFocused : boolean ;
249
251
isDirty : boolean ;
250
252
errorMessages : string [ ] ;
251
- } ;
253
+ }
252
254
253
255
export type StateObject = Record < ElementTypes , FieldState > &
254
256
Record < 'service_fee' , { amount ?: number ; ach_fee ?: number ; card_fee ?: number } > ;
255
257
256
258
export type PlaceholderObject = Partial < Record < ElementTypes , string > > ;
257
259
258
- export type StyleObject = {
260
+ export interface StyleObject {
259
261
default : object ;
260
262
success : object ;
261
263
error : object ;
@@ -269,7 +271,7 @@ export type StyleObject = {
269
271
} ;
270
272
} ;
271
273
hidePlaceholder ?: boolean ;
272
- } ;
274
+ }
273
275
274
276
export interface Level3DataSummary {
275
277
tax_amt : number ;
0 commit comments