@chargehive/types 2.4.16 → 2.5.0
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 +95 -73
- package/package.json +1 -1
package/chargehive.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ type EmptyObject = Record<string, never>;
|
|
|
12
12
|
declare global
|
|
13
13
|
{
|
|
14
14
|
// noinspection ES6ConvertVarToLetConst
|
|
15
|
-
var ChargeHive: ChargeHiveType;
|
|
15
|
+
var ChargeHive: ChargeHiveType;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
declare type FieldName = PCIBFieldName;
|
|
@@ -29,7 +29,7 @@ export interface ChargeHiveEventTarget extends Omit<EventTarget, 'dispatchEvent'
|
|
|
29
29
|
options?: EventListenerOptions | boolean,
|
|
30
30
|
): void;
|
|
31
31
|
|
|
32
|
-
triggerEvent<E extends
|
|
32
|
+
triggerEvent<E extends EventName>(type: E, data?: ChargeHiveEventData[E]): void;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export interface ChargeHiveType extends ChargeType, ChargeHiveEventTarget
|
|
@@ -124,7 +124,7 @@ export interface InitResponse
|
|
|
124
124
|
capabilities: PaymentMethodType[];
|
|
125
125
|
defaultPaymentType: PaymentMethodType;
|
|
126
126
|
walletOptions: WalletOptionsResponse;
|
|
127
|
-
riskCheckers: { [key: string]: RiskChecker };
|
|
127
|
+
riskCheckers: { [key: string]: RiskChecker; };
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
export type RiskChecker = {
|
|
@@ -142,63 +142,65 @@ export type PaymentMethodType =
|
|
|
142
142
|
export type PaymentMethodDataTypes = {
|
|
143
143
|
PLACEMENT_CAPABILITY_TOKEN: {
|
|
144
144
|
token: string;
|
|
145
|
-
}
|
|
146
|
-
PLACEMENT_CAPABILITY_CARD_FORM: PCIBridgeTokenizeResponse
|
|
147
|
-
PLACEMENT_CAPABILITY_PAYPAL: EmptyObject
|
|
145
|
+
};
|
|
146
|
+
PLACEMENT_CAPABILITY_CARD_FORM: PCIBridgeTokenizeResponse;
|
|
147
|
+
PLACEMENT_CAPABILITY_PAYPAL: EmptyObject;
|
|
148
148
|
PLACEMENT_CAPABILITY_APPLE_PAY:
|
|
149
|
-
{ token: ApplePayJS.ApplePayPaymentToken } |
|
|
149
|
+
{ token: ApplePayJS.ApplePayPaymentToken; } |
|
|
150
150
|
{
|
|
151
151
|
initiativeContext: string;
|
|
152
152
|
sessionUrl: string;
|
|
153
|
-
}
|
|
154
|
-
PLACEMENT_CAPABILITY_GOOGLE_PAY: google.payments.api.PaymentData
|
|
153
|
+
};
|
|
154
|
+
PLACEMENT_CAPABILITY_GOOGLE_PAY: google.payments.api.PaymentData;
|
|
155
155
|
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM: {
|
|
156
156
|
accountName: string;
|
|
157
157
|
accountNum: string;
|
|
158
158
|
sortCode: string;
|
|
159
159
|
payerReference: string;
|
|
160
|
-
}
|
|
160
|
+
};
|
|
161
161
|
};
|
|
162
162
|
|
|
163
163
|
export type PaymentMethodEphemeralDataTypes = {
|
|
164
|
-
PLACEMENT_CAPABILITY_TOKEN: EmptyObject
|
|
165
|
-
PLACEMENT_CAPABILITY_CARD_FORM: PCIBridgeTokenizeEphemeralResponse
|
|
166
|
-
PLACEMENT_CAPABILITY_PAYPAL: EmptyObject
|
|
167
|
-
PLACEMENT_CAPABILITY_APPLE_PAY: EmptyObject
|
|
168
|
-
PLACEMENT_CAPABILITY_GOOGLE_PAY: EmptyObject
|
|
169
|
-
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM: EmptyObject
|
|
164
|
+
PLACEMENT_CAPABILITY_TOKEN: EmptyObject;
|
|
165
|
+
PLACEMENT_CAPABILITY_CARD_FORM: PCIBridgeTokenizeEphemeralResponse;
|
|
166
|
+
PLACEMENT_CAPABILITY_PAYPAL: EmptyObject;
|
|
167
|
+
PLACEMENT_CAPABILITY_APPLE_PAY: EmptyObject;
|
|
168
|
+
PLACEMENT_CAPABILITY_GOOGLE_PAY: EmptyObject;
|
|
169
|
+
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM: EmptyObject;
|
|
170
170
|
};
|
|
171
171
|
|
|
172
172
|
export type PaymentMethodEphemeralTokenizationConfig = {
|
|
173
|
-
PLACEMENT_CAPABILITY_TOKEN: EmptyObject
|
|
174
|
-
PLACEMENT_CAPABILITY_CARD_FORM: EmptyObject
|
|
175
|
-
PLACEMENT_CAPABILITY_PAYPAL: EmptyObject
|
|
176
|
-
PLACEMENT_CAPABILITY_APPLE_PAY: EmptyObject
|
|
177
|
-
PLACEMENT_CAPABILITY_GOOGLE_PAY: EmptyObject
|
|
178
|
-
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM: EmptyObject
|
|
173
|
+
PLACEMENT_CAPABILITY_TOKEN: EmptyObject;
|
|
174
|
+
PLACEMENT_CAPABILITY_CARD_FORM: EmptyObject;
|
|
175
|
+
PLACEMENT_CAPABILITY_PAYPAL: EmptyObject;
|
|
176
|
+
PLACEMENT_CAPABILITY_APPLE_PAY: EmptyObject;
|
|
177
|
+
PLACEMENT_CAPABILITY_GOOGLE_PAY: EmptyObject;
|
|
178
|
+
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM: EmptyObject;
|
|
179
179
|
};
|
|
180
180
|
|
|
181
181
|
export type PaymentMethodTokenizationConfig = {
|
|
182
|
-
PLACEMENT_CAPABILITY_TOKEN: EmptyObject
|
|
183
|
-
PLACEMENT_CAPABILITY_PAYPAL: EmptyObject
|
|
184
|
-
PLACEMENT_CAPABILITY_CARD_FORM: EmptyObject
|
|
182
|
+
PLACEMENT_CAPABILITY_TOKEN: EmptyObject;
|
|
183
|
+
PLACEMENT_CAPABILITY_PAYPAL: EmptyObject;
|
|
184
|
+
PLACEMENT_CAPABILITY_CARD_FORM: EmptyObject;
|
|
185
185
|
PLACEMENT_CAPABILITY_APPLE_PAY: {
|
|
186
186
|
Session?: string;
|
|
187
187
|
InitiativeContext?: string;
|
|
188
188
|
SessionUrl?: string;
|
|
189
|
-
}
|
|
189
|
+
};
|
|
190
190
|
PLACEMENT_CAPABILITY_GOOGLE_PAY: {
|
|
191
191
|
environment?: string;
|
|
192
192
|
googlePayConfig?: google.payments.api.PaymentDataRequest | string;
|
|
193
193
|
token?: string;
|
|
194
|
-
}
|
|
195
|
-
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM: EmptyObject
|
|
194
|
+
};
|
|
195
|
+
PLACEMENT_CAPABILITY_DIRECTDEBIT_FORM: EmptyObject;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
export type PaymentMethodAuthenticationTypes = {
|
|
199
199
|
cvv: string;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
export type ChallengeWindowSize = '01' | '02' | '03' | '04' | '05';
|
|
203
|
+
|
|
202
204
|
export type ChargeEnvironment =
|
|
203
205
|
| 'CHARGE_ENVIRONMENT_RETAIL'
|
|
204
206
|
| 'CHARGE_ENVIRONMENT_ECOMMERCE'
|
|
@@ -223,7 +225,7 @@ export interface ChargeData
|
|
|
223
225
|
language?: string;
|
|
224
226
|
meta?: ChargeMeta;
|
|
225
227
|
connectorId?: string;
|
|
226
|
-
challengeWindowSize?:
|
|
228
|
+
challengeWindowSize?: ChallengeWindowSize;
|
|
227
229
|
}
|
|
228
230
|
|
|
229
231
|
export interface ChargeType
|
|
@@ -251,24 +253,24 @@ export interface ChargeType
|
|
|
251
253
|
|
|
252
254
|
export interface OrderItem
|
|
253
255
|
{
|
|
254
|
-
subscriptionId
|
|
255
|
-
renewalNumber
|
|
256
|
-
duration
|
|
257
|
-
startDate
|
|
258
|
-
endDate
|
|
259
|
-
productType
|
|
260
|
-
skuType
|
|
261
|
-
deliveryType
|
|
256
|
+
subscriptionId?: string;
|
|
257
|
+
renewalNumber?: number;
|
|
258
|
+
duration?: number;
|
|
259
|
+
startDate?: number;
|
|
260
|
+
endDate?: number;
|
|
261
|
+
productType?: number;
|
|
262
|
+
skuType?: number;
|
|
263
|
+
deliveryType?: number;
|
|
262
264
|
quantity?: number;
|
|
263
265
|
unitPrice: number;
|
|
264
266
|
taxAmount?: number;
|
|
265
267
|
discountAmount?: number;
|
|
266
268
|
name: string;
|
|
267
|
-
description
|
|
268
|
-
productCode
|
|
269
|
-
skuCode
|
|
270
|
-
termType
|
|
271
|
-
termUnits
|
|
269
|
+
description?: string;
|
|
270
|
+
productCode?: string;
|
|
271
|
+
skuCode?: string;
|
|
272
|
+
termType?: number;
|
|
273
|
+
termUnits?: number;
|
|
272
274
|
}
|
|
273
275
|
|
|
274
276
|
export type EventName = PCIBEventName
|
|
@@ -281,36 +283,43 @@ export type EventName = PCIBEventName
|
|
|
281
283
|
| 'cancel'
|
|
282
284
|
| 'authentication'
|
|
283
285
|
| 'ready'
|
|
284
|
-
| 'paste'
|
|
285
286
|
| 'method-type-changed'
|
|
286
287
|
| 'charge-id'
|
|
287
288
|
| 'capability'
|
|
288
289
|
| 'google-pay-ready';
|
|
289
290
|
|
|
290
|
-
export type
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
responseCode: string;
|
|
294
|
-
responseMessage: string;
|
|
295
|
-
merchantMessage: string;
|
|
296
|
-
failureType: string;
|
|
297
|
-
category: string;
|
|
298
|
-
errorType: string;
|
|
299
|
-
errorProperties: Dictionary;
|
|
300
|
-
originatingCode: string;
|
|
301
|
-
specificErrors: TransactionResponse[];
|
|
291
|
+
export type ChargeHiveEvent<T extends EventName = EventName> = {
|
|
292
|
+
type: T;
|
|
293
|
+
data: ChargeHiveEventData[T];
|
|
302
294
|
}
|
|
303
295
|
|
|
304
|
-
export type ChargeHiveEventData = {
|
|
305
|
-
'token': ChargehiveTokenEvent;
|
|
306
|
-
'success': ChargehiveSuccessEvent;
|
|
307
|
-
'declined': ChargehiveDeclinedEvent;
|
|
308
|
-
'authentication': AuthenticationEvent;
|
|
309
|
-
'error': object;
|
|
310
|
-
'token-config': PaymentMethodTokenizationConfig[PaymentMethodType];
|
|
311
|
-
'capability': ChargehiveCapabilityEvent;
|
|
312
|
-
'method-type-changed': ChargehiveMethodTypeChangedEvent;
|
|
313
|
-
'charge-id': string;
|
|
296
|
+
export type ChargeHiveEventData = {
|
|
297
|
+
readonly 'token': ChargehiveTokenEvent;
|
|
298
|
+
readonly 'success': ChargehiveSuccessEvent;
|
|
299
|
+
readonly 'declined': ChargehiveDeclinedEvent;
|
|
300
|
+
readonly 'authentication': AuthenticationEvent;
|
|
301
|
+
readonly 'error': object;
|
|
302
|
+
readonly 'token-config': PaymentMethodTokenizationConfig[PaymentMethodType];
|
|
303
|
+
readonly 'capability': ChargehiveCapabilityEvent;
|
|
304
|
+
readonly 'method-type-changed': ChargehiveMethodTypeChangedEvent;
|
|
305
|
+
readonly 'charge-id': string;
|
|
306
|
+
|
|
307
|
+
readonly 'init': InitResponse;
|
|
308
|
+
readonly 'cancel': undefined;
|
|
309
|
+
readonly 'ready': undefined;
|
|
310
|
+
readonly 'google-pay-ready': undefined;
|
|
311
|
+
|
|
312
|
+
/* pcib */
|
|
313
|
+
readonly 'focus': unknown;
|
|
314
|
+
readonly 'focusin': unknown;
|
|
315
|
+
readonly 'focusout': unknown;
|
|
316
|
+
readonly 'blur': unknown;
|
|
317
|
+
readonly 'paste': unknown;
|
|
318
|
+
readonly 'field-ready': unknown;
|
|
319
|
+
readonly 'tokenize': unknown;
|
|
320
|
+
readonly 'tokenize-ephemeral': unknown;
|
|
321
|
+
readonly 'field-validation': unknown;
|
|
322
|
+
readonly 'field-changed': unknown;
|
|
314
323
|
}
|
|
315
324
|
|
|
316
325
|
export type ChargehiveTokenEvent = TokenizeResponse
|
|
@@ -360,7 +369,7 @@ interface AuthenticationEvent
|
|
|
360
369
|
paymentType: string;
|
|
361
370
|
}
|
|
362
371
|
|
|
363
|
-
export type Dictionary = { [key: string]:
|
|
372
|
+
export type Dictionary = { [key: string]: unknown; };
|
|
364
373
|
|
|
365
374
|
export interface AuthorizeResponse
|
|
366
375
|
{
|
|
@@ -368,13 +377,19 @@ export interface AuthorizeResponse
|
|
|
368
377
|
message: string;
|
|
369
378
|
continuationId: string;
|
|
370
379
|
chargeId: string;
|
|
371
|
-
events: ChargeHiveEvent
|
|
380
|
+
events: ChargeHiveEvent[];
|
|
372
381
|
}
|
|
373
382
|
|
|
374
|
-
export
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
383
|
+
export type TransactionResponse = {
|
|
384
|
+
responseCode: string;
|
|
385
|
+
responseMessage: string;
|
|
386
|
+
merchantMessage: string;
|
|
387
|
+
failureType: string;
|
|
388
|
+
category: string;
|
|
389
|
+
errorType: string;
|
|
390
|
+
errorProperties: Dictionary;
|
|
391
|
+
originatingCode: string;
|
|
392
|
+
specificErrors: TransactionResponse[];
|
|
378
393
|
}
|
|
379
394
|
|
|
380
395
|
export interface TokenizeResponse
|
|
@@ -435,8 +450,8 @@ export interface WalletOptionsResponse
|
|
|
435
450
|
|
|
436
451
|
allowedCardNetworks?: string[];
|
|
437
452
|
|
|
438
|
-
parameters: Dictionary
|
|
439
|
-
}]
|
|
453
|
+
parameters: Dictionary;
|
|
454
|
+
}];
|
|
440
455
|
};
|
|
441
456
|
|
|
442
457
|
applePay: {
|
|
@@ -455,4 +470,11 @@ export interface WalletOptionsResponse
|
|
|
455
470
|
supportedNetworks: string[];
|
|
456
471
|
merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
|
|
457
472
|
};
|
|
473
|
+
|
|
474
|
+
paypal: {
|
|
475
|
+
connectorId: string;
|
|
476
|
+
connectorLibrary: string;
|
|
477
|
+
clientId: string;
|
|
478
|
+
merchantId: string;
|
|
479
|
+
};
|
|
458
480
|
}
|
package/package.json
CHANGED