@chargehive/types 2.1.29 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chargehive.d.ts +58 -31
- package/package.json +1 -1
package/chargehive.d.ts
CHANGED
|
@@ -8,13 +8,12 @@ import {FieldValidation} from '@pci-bridge/types/validation';
|
|
|
8
8
|
import {Address, Person} from './address';
|
|
9
9
|
import ApplePayPaymentToken = ApplePayJS.ApplePayPaymentToken;
|
|
10
10
|
|
|
11
|
+
type EmptyObject = Record<string, never>;
|
|
12
|
+
|
|
11
13
|
declare global
|
|
12
14
|
{
|
|
13
|
-
/* eslint-disable no-var */
|
|
14
|
-
// @ts-ignore
|
|
15
15
|
// noinspection ES6ConvertVarToLetConst
|
|
16
|
-
var ChargeHive: ChargeHiveType;
|
|
17
|
-
/* eslint-enable no-var */
|
|
16
|
+
var ChargeHive: ChargeHiveType; // eslint-disable-line no-var
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
declare type FieldName = PCIBFieldName;
|
|
@@ -66,6 +65,30 @@ export interface ChargeHiveType extends ChargeType, ChargeHiveEventTarget
|
|
|
66
65
|
setPaymentMethod<T extends PaymentMethodType>(type: T, data?: object | PaymentMethodDataTypes[T]): void;
|
|
67
66
|
}
|
|
68
67
|
|
|
68
|
+
export interface WalletOptions
|
|
69
|
+
{
|
|
70
|
+
/**
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
requireEmail?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* @default true
|
|
76
|
+
*/
|
|
77
|
+
requireBillingAddress?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
requireBillingPhone?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
requireShippingAddress?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* @default false
|
|
88
|
+
*/
|
|
89
|
+
requireShippingPhone?: boolean;
|
|
90
|
+
}
|
|
91
|
+
|
|
69
92
|
export interface ChargeHiveInitOptions
|
|
70
93
|
{
|
|
71
94
|
projectId: string;
|
|
@@ -75,6 +98,7 @@ export interface ChargeHiveInitOptions
|
|
|
75
98
|
country: string;
|
|
76
99
|
currency: string;
|
|
77
100
|
environment?: ChargeEnvironment;
|
|
101
|
+
walletOptions?: WalletOptions;
|
|
78
102
|
}
|
|
79
103
|
|
|
80
104
|
export interface InitResponse
|
|
@@ -104,7 +128,7 @@ export type PaymentMethodDataTypes = {
|
|
|
104
128
|
token: string;
|
|
105
129
|
}
|
|
106
130
|
PLACEMENT_CAPABILITY_CARD_FORM: PCIBridgeTokenizeResponse
|
|
107
|
-
PLACEMENT_CAPABILITY_PAYPAL:
|
|
131
|
+
PLACEMENT_CAPABILITY_PAYPAL: EmptyObject
|
|
108
132
|
PLACEMENT_CAPABILITY_APPLE_PAY: {
|
|
109
133
|
initiativeContext?: string;
|
|
110
134
|
sessionUrl?: string;
|
|
@@ -126,27 +150,27 @@ export type PaymentMethodDataTypes = {
|
|
|
126
150
|
};
|
|
127
151
|
|
|
128
152
|
export type PaymentMethodEphemeralDataTypes = {
|
|
129
|
-
PLACEMENT_CAPABILITY_TOKEN:
|
|
153
|
+
PLACEMENT_CAPABILITY_TOKEN: EmptyObject
|
|
130
154
|
PLACEMENT_CAPABILITY_CARD_FORM: PCIBridgeTokenizeEphemeralResponse
|
|
131
|
-
PLACEMENT_CAPABILITY_PAYPAL:
|
|
132
|
-
PLACEMENT_CAPABILITY_APPLE_PAY:
|
|
133
|
-
PLACEMENT_CAPABILITY_GOOGLE_PAY:
|
|
134
|
-
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM:
|
|
155
|
+
PLACEMENT_CAPABILITY_PAYPAL: EmptyObject
|
|
156
|
+
PLACEMENT_CAPABILITY_APPLE_PAY: EmptyObject
|
|
157
|
+
PLACEMENT_CAPABILITY_GOOGLE_PAY: EmptyObject
|
|
158
|
+
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM: EmptyObject
|
|
135
159
|
};
|
|
136
160
|
|
|
137
161
|
export type PaymentMethodEphemeralTokenizationConfig = {
|
|
138
|
-
PLACEMENT_CAPABILITY_TOKEN:
|
|
139
|
-
PLACEMENT_CAPABILITY_CARD_FORM:
|
|
140
|
-
PLACEMENT_CAPABILITY_PAYPAL:
|
|
141
|
-
PLACEMENT_CAPABILITY_APPLE_PAY:
|
|
142
|
-
PLACEMENT_CAPABILITY_GOOGLE_PAY:
|
|
143
|
-
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM:
|
|
162
|
+
PLACEMENT_CAPABILITY_TOKEN: EmptyObject
|
|
163
|
+
PLACEMENT_CAPABILITY_CARD_FORM: EmptyObject
|
|
164
|
+
PLACEMENT_CAPABILITY_PAYPAL: EmptyObject
|
|
165
|
+
PLACEMENT_CAPABILITY_APPLE_PAY: EmptyObject
|
|
166
|
+
PLACEMENT_CAPABILITY_GOOGLE_PAY: EmptyObject
|
|
167
|
+
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM: EmptyObject
|
|
144
168
|
};
|
|
145
169
|
|
|
146
170
|
export type PaymentMethodTokenizationConfig = {
|
|
147
|
-
PLACEMENT_CAPABILITY_TOKEN:
|
|
148
|
-
PLACEMENT_CAPABILITY_PAYPAL:
|
|
149
|
-
PLACEMENT_CAPABILITY_CARD_FORM:
|
|
171
|
+
PLACEMENT_CAPABILITY_TOKEN: EmptyObject
|
|
172
|
+
PLACEMENT_CAPABILITY_PAYPAL: EmptyObject
|
|
173
|
+
PLACEMENT_CAPABILITY_CARD_FORM: EmptyObject
|
|
150
174
|
PLACEMENT_CAPABILITY_APPLE_PAY: {
|
|
151
175
|
Session?: string;
|
|
152
176
|
InitiativeContext?: string;
|
|
@@ -157,7 +181,7 @@ export type PaymentMethodTokenizationConfig = {
|
|
|
157
181
|
googlePayConfig?: google.payments.api.PaymentDataRequest | string;
|
|
158
182
|
token?: string;
|
|
159
183
|
}
|
|
160
|
-
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM:
|
|
184
|
+
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM: EmptyObject
|
|
161
185
|
}
|
|
162
186
|
|
|
163
187
|
export type PaymentMethodAuthenticationTypes = {
|
|
@@ -223,10 +247,10 @@ export interface OrderItem
|
|
|
223
247
|
productType: number;
|
|
224
248
|
skuType: number;
|
|
225
249
|
deliveryType: number;
|
|
226
|
-
quantity
|
|
250
|
+
quantity?: number;
|
|
227
251
|
unitPrice: number;
|
|
228
|
-
taxAmount
|
|
229
|
-
discountAmount
|
|
252
|
+
taxAmount?: number;
|
|
253
|
+
discountAmount?: number;
|
|
230
254
|
name: string;
|
|
231
255
|
description: string;
|
|
232
256
|
productCode: string;
|
|
@@ -238,6 +262,7 @@ export interface OrderItem
|
|
|
238
262
|
export type EventName = PCIBEventName
|
|
239
263
|
| 'init'
|
|
240
264
|
| 'token'
|
|
265
|
+
| 'token-config'
|
|
241
266
|
| 'success'
|
|
242
267
|
| 'declined'
|
|
243
268
|
| 'error'
|
|
@@ -248,7 +273,7 @@ export type EventName = PCIBEventName
|
|
|
248
273
|
| 'method-type-changed'
|
|
249
274
|
| 'charge-id';
|
|
250
275
|
|
|
251
|
-
export type ChargeHiveEventType = Extract<EventName, 'token' | 'success' | 'declined' | 'authentication'>
|
|
276
|
+
export type ChargeHiveEventType = Extract<EventName, 'token' | 'success' | 'declined' | 'authentication' | 'error' | 'token-config'>
|
|
252
277
|
|
|
253
278
|
export type TransactionResponse = {
|
|
254
279
|
responseCode: string;
|
|
@@ -283,11 +308,11 @@ export type ChargeHiveEventData = {
|
|
|
283
308
|
responseBreakdown: TransactionResponse;
|
|
284
309
|
}
|
|
285
310
|
declined: {
|
|
286
|
-
chargeId: string
|
|
287
|
-
message: string
|
|
288
|
-
responseCode: string
|
|
289
|
-
paymentScheme: string
|
|
290
|
-
responseBreakdown: TransactionResponse
|
|
311
|
+
chargeId: string;
|
|
312
|
+
message: string;
|
|
313
|
+
responseCode: string;
|
|
314
|
+
paymentScheme: string;
|
|
315
|
+
responseBreakdown: TransactionResponse;
|
|
291
316
|
}
|
|
292
317
|
authentication: {
|
|
293
318
|
environment: string;
|
|
@@ -296,6 +321,8 @@ export type ChargeHiveEventData = {
|
|
|
296
321
|
connectorData: Dictionary;
|
|
297
322
|
paymentType: string;
|
|
298
323
|
}
|
|
324
|
+
error: object;
|
|
325
|
+
'token-config': PaymentMethodTokenizationConfig[PaymentMethodType];
|
|
299
326
|
}
|
|
300
327
|
|
|
301
328
|
export type Dictionary = { [key: string]: string };
|
|
@@ -306,10 +333,10 @@ export interface AuthorizeResponse
|
|
|
306
333
|
message: string;
|
|
307
334
|
continuationId: string;
|
|
308
335
|
chargeId: string;
|
|
309
|
-
events: ChargeHiveEvent[];
|
|
336
|
+
events: ChargeHiveEvent<ChargeHiveEventType>[];
|
|
310
337
|
}
|
|
311
338
|
|
|
312
|
-
export interface ChargeHiveEvent<T extends ChargeHiveEventType
|
|
339
|
+
export interface ChargeHiveEvent<T extends ChargeHiveEventType>
|
|
313
340
|
{
|
|
314
341
|
type: T;
|
|
315
342
|
data: ChargeHiveEventData[T];
|
package/package.json
CHANGED