@tagadapay/plugin-sdk 3.1.11 → 3.1.22
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/README.md +1129 -1129
- package/build-cdn.js +231 -228
- package/dist/data/iso3166.d.ts +23 -33
- package/dist/data/iso3166.js +134 -198
- package/dist/data/languages.d.ts +5 -64
- package/dist/data/languages.js +23 -143
- package/dist/external-tracker.js +968 -102
- package/dist/external-tracker.min.js +2 -2
- package/dist/external-tracker.min.js.map +4 -4
- package/dist/react/hooks/useISOData.js +1 -1
- package/dist/react/hooks/usePaymentPolling.d.ts +3 -3
- package/dist/react/hooks/useShippingRates.d.ts +6 -0
- package/dist/react/hooks/useShippingRates.js +38 -0
- package/dist/react/providers/TagadaProvider.js +5 -5
- package/dist/react/services/apiService.d.ts +21 -0
- package/dist/react/services/apiService.js +10 -0
- package/dist/tagada-sdk.js +2079 -179
- package/dist/tagada-sdk.min.js +4 -2
- package/dist/tagada-sdk.min.js.map +4 -4
- package/dist/v2/core/client.d.ts +4 -2
- package/dist/v2/core/client.js +4 -3
- package/dist/v2/core/errors.d.ts +75 -0
- package/dist/v2/core/errors.js +104 -0
- package/dist/v2/core/funnelClient.d.ts +16 -15
- package/dist/v2/core/funnelClient.js +1 -1
- package/dist/v2/core/index.d.ts +1 -0
- package/dist/v2/core/index.js +2 -0
- package/dist/v2/core/pixelMapping.d.ts +49 -0
- package/dist/v2/core/pixelMapping.js +325 -0
- package/dist/v2/core/resources/apiClient.d.ts +2 -0
- package/dist/v2/core/resources/apiClient.js +52 -9
- package/dist/v2/core/resources/checkout.d.ts +89 -30
- package/dist/v2/core/resources/checkout.js +8 -0
- package/dist/v2/core/resources/customer.d.ts +20 -19
- package/dist/v2/core/resources/funnel.d.ts +17 -17
- package/dist/v2/core/resources/payments.d.ts +84 -13
- package/dist/v2/core/resources/payments.js +26 -9
- package/dist/v2/core/resources/shippingRates.d.ts +15 -0
- package/dist/v2/core/resources/shippingRates.js +11 -0
- package/dist/v2/core/types.d.ts +50 -12
- package/dist/v2/core/types.js +0 -3
- package/dist/v2/core/utils/checkout.d.ts +2 -2
- package/dist/v2/core/utils/checkout.js +7 -2
- package/dist/v2/core/utils/order.d.ts +11 -9
- package/dist/v2/core/utils/previewModeIndicator.js +101 -101
- package/dist/v2/index.d.ts +4 -2
- package/dist/v2/index.js +1 -1
- package/dist/v2/react/components/ApplePayButton.js +13 -4
- package/dist/v2/react/components/FunnelScriptInjector.js +51 -30
- package/dist/v2/react/components/WhopCheckout.d.ts +24 -0
- package/dist/v2/react/components/WhopCheckout.js +231 -0
- package/dist/v2/react/hooks/__examples__/FunnelContextExample.js +1 -1
- package/dist/v2/react/hooks/payment-actions/useAirwallexRadarAction.d.ts +14 -0
- package/dist/v2/react/hooks/payment-actions/useAirwallexRadarAction.js +181 -0
- package/dist/v2/react/hooks/payment-actions/useErrorAction.d.ts +9 -0
- package/dist/v2/react/hooks/payment-actions/useErrorAction.js +21 -0
- package/dist/v2/react/hooks/payment-actions/useFinixRadarAction.d.ts +14 -0
- package/dist/v2/react/hooks/payment-actions/useFinixRadarAction.js +187 -0
- package/dist/v2/react/hooks/payment-actions/useKessPayAction.d.ts +11 -0
- package/dist/v2/react/hooks/payment-actions/useKessPayAction.js +91 -0
- package/dist/v2/react/hooks/payment-actions/useMasterCardAction.d.ts +24 -0
- package/dist/v2/react/hooks/payment-actions/useMasterCardAction.js +221 -0
- package/dist/v2/react/hooks/payment-actions/usePaymentActionHandler.d.ts +15 -0
- package/dist/v2/react/hooks/payment-actions/usePaymentActionHandler.js +142 -0
- package/dist/v2/react/hooks/payment-actions/useProcessorAuthAction.d.ts +3 -0
- package/dist/v2/react/hooks/payment-actions/useProcessorAuthAction.js +13 -0
- package/dist/v2/react/hooks/payment-actions/useRedirectAction.d.ts +10 -0
- package/dist/v2/react/hooks/payment-actions/useRedirectAction.js +35 -0
- package/dist/v2/react/hooks/payment-actions/useStripeRadarAction.d.ts +14 -0
- package/dist/v2/react/hooks/payment-actions/useStripeRadarAction.js +192 -0
- package/dist/v2/react/hooks/payment-actions/useThreedsAuthAction.d.ts +14 -0
- package/dist/v2/react/hooks/payment-actions/useThreedsAuthAction.js +81 -0
- package/dist/v2/react/hooks/payment-actions/useTrustFlowAction.d.ts +11 -0
- package/dist/v2/react/hooks/payment-actions/useTrustFlowAction.js +84 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentInstruments.d.ts +14 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentInstruments.js +36 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentProcessors.d.ts +31 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentProcessors.js +212 -0
- package/dist/v2/react/hooks/payment-redirect/useAirwallex3dsReturn.d.ts +14 -0
- package/dist/v2/react/hooks/payment-redirect/useAirwallex3dsReturn.js +207 -0
- package/dist/v2/react/hooks/payment-redirect/useGenericPaymentReturn.d.ts +12 -0
- package/dist/v2/react/hooks/payment-redirect/useGenericPaymentReturn.js +101 -0
- package/dist/v2/react/hooks/useCheckoutQuery.d.ts +6 -0
- package/dist/v2/react/hooks/useCheckoutQuery.js +45 -0
- package/dist/v2/react/hooks/useFunnel.d.ts +1 -2
- package/dist/v2/react/hooks/useGeoLocation.d.ts +2 -1
- package/dist/v2/react/hooks/useGeoLocation.js +4 -2
- package/dist/v2/react/hooks/useGoogleAutocomplete.js +82 -33
- package/dist/v2/react/hooks/useISOData.js +1 -1
- package/dist/v2/react/hooks/usePaymentPolling.d.ts +3 -3
- package/dist/v2/react/hooks/usePaymentQuery.d.ts +18 -5
- package/dist/v2/react/hooks/usePaymentQuery.js +63 -1015
- package/dist/v2/react/hooks/usePaymentRetrieve.d.ts +3 -2
- package/dist/v2/react/hooks/usePaymentRetrieve.js +3 -1
- package/dist/v2/react/hooks/usePixelTracking.d.ts +5 -43
- package/dist/v2/react/hooks/usePixelTracking.js +213 -407
- package/dist/v2/react/hooks/useShippingRatesQuery.d.ts +6 -0
- package/dist/v2/react/hooks/useShippingRatesQuery.js +47 -4
- package/dist/v2/react/hooks/useStepConfig.d.ts +2 -8
- package/dist/v2/react/hooks/useStepConfig.js +1 -1
- package/dist/v2/react/hooks/useWhopPaymentPolling.d.ts +30 -0
- package/dist/v2/react/hooks/useWhopPaymentPolling.js +61 -0
- package/dist/v2/react/index.d.ts +7 -0
- package/dist/v2/react/index.js +4 -0
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.d.ts +2 -1
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +3 -1
- package/dist/v2/react/providers/TagadaProvider.js +76 -7
- package/dist/v2/standalone/external-tracker.d.ts +52 -46
- package/dist/v2/standalone/external-tracker.js +205 -98
- package/dist/v2/standalone/index.d.ts +22 -0
- package/dist/v2/standalone/index.js +125 -0
- package/package.json +112 -112
- package/dist/react/utils/__tests__/urlUtils.test.d.ts +0 -1
- package/dist/react/utils/__tests__/urlUtils.test.js +0 -189
- package/dist/v2/core/__tests__/pathRemapping.test.d.ts +0 -11
- package/dist/v2/core/__tests__/pathRemapping.test.js +0 -776
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* const paymentFlowId = stepConfig.paymentFlowId;
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
import { FunnelState, GTMTrackingConfig,
|
|
22
|
+
import { FunnelState, GTMTrackingConfig, PixelTrackingConfig, RuntimeStepConfig, SnapchatTrackingConfig, TrackingProvider } from '../../core/funnelClient';
|
|
23
23
|
import { FunnelAction, FunnelNavigationResult, SimpleFunnelContext } from '../../core/resources/funnel';
|
|
24
24
|
/**
|
|
25
25
|
* Step configuration from HTML injection (for current step/variant)
|
|
@@ -52,7 +52,6 @@ export interface StepConfigValue {
|
|
|
52
52
|
[TrackingProvider.FACEBOOK]?: PixelTrackingConfig[];
|
|
53
53
|
[TrackingProvider.TIKTOK]?: PixelTrackingConfig[];
|
|
54
54
|
[TrackingProvider.SNAPCHAT]?: SnapchatTrackingConfig[];
|
|
55
|
-
[TrackingProvider.META_CONVERSION]?: MetaConversionTrackingConfig[];
|
|
56
55
|
[TrackingProvider.GTM]?: GTMTrackingConfig[];
|
|
57
56
|
};
|
|
58
57
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TagadaError } from '../../core/errors';
|
|
1
2
|
export interface GeoLocationData {
|
|
2
3
|
ip_address?: string | null;
|
|
3
4
|
city?: string | null;
|
|
@@ -82,7 +83,7 @@ export interface UseGeoLocationReturn {
|
|
|
82
83
|
/**
|
|
83
84
|
* Any error that occurred during the request
|
|
84
85
|
*/
|
|
85
|
-
error:
|
|
86
|
+
error: TagadaError | null;
|
|
86
87
|
/**
|
|
87
88
|
* Function to manually fetch geolocation data
|
|
88
89
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { useTagadaContext } from '../providers/TagadaProvider';
|
|
4
|
+
import { TagadaError, TagadaErrorCode } from '../../core/errors';
|
|
4
5
|
/**
|
|
5
6
|
* Hook to fetch and manage geolocation data - V2 Implementation
|
|
6
7
|
* Compatible with V1 interface while using V2 provider architecture
|
|
@@ -111,10 +112,11 @@ export function useGeoLocation(options = {}) {
|
|
|
111
112
|
void fetchGeoData();
|
|
112
113
|
}
|
|
113
114
|
}, [refetchOnMount, apiService, fetchGeoData]);
|
|
115
|
+
const tagadaError = useMemo(() => error ? new TagadaError(error, { code: TagadaErrorCode.NETWORK_ERROR }) : null, [error]);
|
|
114
116
|
return {
|
|
115
117
|
data,
|
|
116
118
|
isLoading,
|
|
117
|
-
error,
|
|
119
|
+
error: tagadaError,
|
|
118
120
|
fetchGeoData,
|
|
119
121
|
clearData,
|
|
120
122
|
isLocalhost: isLocalhost(data?.ip_address),
|
|
@@ -165,6 +165,15 @@ export function useGoogleAutocomplete(options) {
|
|
|
165
165
|
postalCode: '',
|
|
166
166
|
fullStreetAddress: '',
|
|
167
167
|
};
|
|
168
|
+
// Temporary variables for comprehensive address component extraction
|
|
169
|
+
let premise = '';
|
|
170
|
+
let neighborhood = '';
|
|
171
|
+
let sublocality5 = '';
|
|
172
|
+
let sublocality4 = '';
|
|
173
|
+
let sublocality3 = '';
|
|
174
|
+
let sublocality2 = '';
|
|
175
|
+
let sublocality1 = '';
|
|
176
|
+
let postalTown = '';
|
|
168
177
|
place.address_components?.forEach((component) => {
|
|
169
178
|
const types = component.types;
|
|
170
179
|
if (types.includes('subpremise')) {
|
|
@@ -174,19 +183,47 @@ export function useGoogleAutocomplete(options) {
|
|
|
174
183
|
if (types.includes('street_number')) {
|
|
175
184
|
extracted.streetNumber = component.long_name;
|
|
176
185
|
}
|
|
186
|
+
if (types.includes('premise')) {
|
|
187
|
+
// Building number (used in Asian addresses instead of street_number)
|
|
188
|
+
premise = component.long_name;
|
|
189
|
+
}
|
|
177
190
|
if (types.includes('route')) {
|
|
178
191
|
extracted.route = component.long_name;
|
|
179
192
|
}
|
|
193
|
+
if (types.includes('neighborhood')) {
|
|
194
|
+
// Neighborhood (alternative to sublocality in some regions)
|
|
195
|
+
neighborhood = component.long_name;
|
|
196
|
+
}
|
|
197
|
+
if (types.includes('sublocality_level_5')) {
|
|
198
|
+
// Fifth-level sublocality (most granular)
|
|
199
|
+
sublocality5 = component.long_name;
|
|
200
|
+
}
|
|
201
|
+
if (types.includes('sublocality_level_4')) {
|
|
202
|
+
// Street name in Asian addresses (e.g., Korean: "Yulgok-ro 27-gil", Japanese block)
|
|
203
|
+
sublocality4 = component.long_name;
|
|
204
|
+
}
|
|
205
|
+
if (types.includes('sublocality_level_3')) {
|
|
206
|
+
// Neighborhood (e.g., Japanese chōme: "3-chōme")
|
|
207
|
+
sublocality3 = component.long_name;
|
|
208
|
+
}
|
|
209
|
+
if (types.includes('sublocality_level_2')) {
|
|
210
|
+
// Second-level sublocality (e.g., Japanese area: "Hirano")
|
|
211
|
+
sublocality2 = component.long_name;
|
|
212
|
+
}
|
|
213
|
+
if (types.includes('sublocality_level_1')) {
|
|
214
|
+
// District (fallback for city in some Asian countries)
|
|
215
|
+
sublocality1 = component.long_name;
|
|
216
|
+
}
|
|
180
217
|
if (types.includes('locality')) {
|
|
181
218
|
extracted.locality = component.long_name;
|
|
182
219
|
}
|
|
220
|
+
if (types.includes('postal_town')) {
|
|
221
|
+
// Postal town (used in UK, Ireland instead of locality)
|
|
222
|
+
postalTown = component.long_name;
|
|
223
|
+
}
|
|
183
224
|
if (types.includes('administrative_area_level_2')) {
|
|
184
225
|
extracted.administrativeAreaLevel2 = component.short_name;
|
|
185
226
|
extracted.administrativeAreaLevel2Long = component.long_name;
|
|
186
|
-
// Use level_2 as fallback for locality if locality is not set
|
|
187
|
-
if (!extracted.locality) {
|
|
188
|
-
extracted.locality = component.long_name;
|
|
189
|
-
}
|
|
190
227
|
}
|
|
191
228
|
if (types.includes('administrative_area_level_1')) {
|
|
192
229
|
extracted.administrativeAreaLevel1 = component.short_name;
|
|
@@ -199,45 +236,57 @@ export function useGoogleAutocomplete(options) {
|
|
|
199
236
|
extracted.postalCode = component.long_name;
|
|
200
237
|
}
|
|
201
238
|
});
|
|
239
|
+
// === APPLY COMPREHENSIVE FALLBACK LOGIC ===
|
|
240
|
+
// 1. Building/House Number with fallbacks
|
|
241
|
+
// Priority: street_number (Western) > premise (Asian)
|
|
242
|
+
const buildingNumber = extracted.streetNumber || premise;
|
|
243
|
+
// 2. Street Name with comprehensive fallbacks
|
|
244
|
+
// Priority: route (Western) > sublocality_level_5 > sublocality_level_4 (Asian streets)
|
|
245
|
+
// > sublocality_level_3 (Neighborhood) > neighborhood
|
|
246
|
+
const streetName = extracted.route || sublocality5 || sublocality4 || sublocality3 || neighborhood;
|
|
247
|
+
// 3. Update locality with fallbacks if not set
|
|
248
|
+
// Priority: locality > postal_town > sublocality_level_2 > sublocality_level_1
|
|
249
|
+
if (!extracted.locality) {
|
|
250
|
+
extracted.locality = postalTown || sublocality2 || sublocality1 || '';
|
|
251
|
+
}
|
|
252
|
+
// 4. State fallback for French addresses
|
|
202
253
|
// For countries like France where administrative_area_level_1 (région) may be missing,
|
|
203
254
|
// use administrative_area_level_2 (département) as the primary state/province value
|
|
204
|
-
// We prefer the long_name (e.g., "Bouches-du-Rhône") over short_name (e.g., "13")
|
|
205
|
-
// because it's more likely to match our state database entries
|
|
206
255
|
if (!extracted.administrativeAreaLevel1 && extracted.administrativeAreaLevel2) {
|
|
207
|
-
// Use long name as the primary value (e.g., "Bouches-du-Rhône" instead of "13")
|
|
208
256
|
extracted.administrativeAreaLevel1 = extracted.administrativeAreaLevel2Long || extracted.administrativeAreaLevel2;
|
|
209
257
|
extracted.administrativeAreaLevel1Long = extracted.administrativeAreaLevel2Long;
|
|
210
258
|
}
|
|
211
|
-
//
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const streetParts = [];
|
|
217
|
-
if (extracted.subpremise) {
|
|
218
|
-
// Check if subpremise already contains formatting (e.g., "Unit 711")
|
|
219
|
-
const normalizedSubpremise = extracted.subpremise.trim();
|
|
220
|
-
streetParts.push(normalizedSubpremise);
|
|
221
|
-
}
|
|
222
|
-
if (extracted.streetNumber) {
|
|
223
|
-
streetParts.push(extracted.streetNumber);
|
|
259
|
+
// === CONSTRUCT FULL STREET ADDRESS ===
|
|
260
|
+
let addressValue = '';
|
|
261
|
+
if (extracted.subpremise && buildingNumber && streetName) {
|
|
262
|
+
// Unit + Building + Street (e.g., "711/3 Network Place", "5/3 Yulgok-ro 27-gil")
|
|
263
|
+
addressValue = `${extracted.subpremise}/${buildingNumber} ${streetName}`;
|
|
224
264
|
}
|
|
225
|
-
if (
|
|
226
|
-
|
|
265
|
+
else if (buildingNumber && streetName) {
|
|
266
|
+
// Building + Street (e.g., "3 Network Place", "3-8 Hirano" for Japanese)
|
|
267
|
+
// For Japanese addresses, check if we have multiple sublocality levels to combine
|
|
268
|
+
if (premise && sublocality4 && sublocality3) {
|
|
269
|
+
// Japanese format: "3-chōme-8-3" (chome-block-building)
|
|
270
|
+
addressValue = `${sublocality3}-${sublocality4}-${premise}`;
|
|
271
|
+
// Add area name if available (e.g., "3-chōme-8-3 Hirano")
|
|
272
|
+
if (sublocality2) {
|
|
273
|
+
addressValue = `${addressValue} ${sublocality2}`;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
// Standard format
|
|
278
|
+
addressValue = `${buildingNumber} ${streetName}`;
|
|
279
|
+
}
|
|
227
280
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
// Remove "Unit", "Apt", etc. prefixes for cleaner format
|
|
232
|
-
const cleanSubpremise = extracted.subpremise
|
|
233
|
-
.replace(/^(Unit|Apt|Apartment|Suite|#)\s*/i, '')
|
|
234
|
-
.trim();
|
|
235
|
-
extracted.fullStreetAddress = `${cleanSubpremise}/${extracted.streetNumber} ${extracted.route}`;
|
|
281
|
+
else if (streetName) {
|
|
282
|
+
// Only street name available (e.g., "Pyeongtaek 3-ro 56beon-gil")
|
|
283
|
+
addressValue = streetName;
|
|
236
284
|
}
|
|
237
|
-
else {
|
|
238
|
-
//
|
|
239
|
-
|
|
285
|
+
else if (buildingNumber) {
|
|
286
|
+
// Edge case: Only building number (rare)
|
|
287
|
+
addressValue = buildingNumber;
|
|
240
288
|
}
|
|
289
|
+
extracted.fullStreetAddress = addressValue.trim();
|
|
241
290
|
return extracted;
|
|
242
291
|
}, []);
|
|
243
292
|
// Extract address in the format expected by shipping/billing address forms
|
|
@@ -106,7 +106,7 @@ export function useISOData(language = 'en', autoImport = true, disputeSetting =
|
|
|
106
106
|
*/
|
|
107
107
|
export function getAvailableLanguages() {
|
|
108
108
|
// Return all available languages (not just registered ones)
|
|
109
|
-
return ['en', 'ru', 'de', 'fr', 'es', 'zh', 'hi', 'pt', 'ja', 'ar', 'it', 'he'];
|
|
109
|
+
return ['en', 'ru', 'de', 'da', 'fr', 'es', 'zh', 'hi', 'pt', 'ja', 'ar', 'it', 'he'];
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
112
|
* Hook to manually import and register a language
|
|
@@ -2,14 +2,14 @@ export interface Payment {
|
|
|
2
2
|
id: string;
|
|
3
3
|
status: string;
|
|
4
4
|
subStatus: string;
|
|
5
|
-
requireAction: 'none' | 'redirect' | 'error' | 'radar';
|
|
5
|
+
requireAction: 'none' | 'redirect' | 'redirect_to_payment' | 'error' | 'radar';
|
|
6
6
|
requireActionData?: {
|
|
7
|
-
type: 'redirect' | 'threeds_auth' | 'processor_auth' | 'error' | 'stripe_radar' | 'finix_radar' | 'radar';
|
|
7
|
+
type: 'redirect' | 'redirect_to_payment' | 'threeds_auth' | 'processor_auth' | 'error' | 'stripe_radar' | 'finix_radar' | 'radar' | 'kesspay_auth' | 'trustflow_auth' | 'mastercard_auth';
|
|
8
8
|
url?: string;
|
|
9
9
|
processed: boolean;
|
|
10
10
|
processorId?: string;
|
|
11
11
|
metadata?: {
|
|
12
|
-
type: 'redirect' | 'stripe_radar' | 'finix_radar';
|
|
12
|
+
type: 'redirect' | 'redirect_to_payment' | 'stripe_radar' | 'finix_radar';
|
|
13
13
|
redirect?: {
|
|
14
14
|
redirectUrl: string;
|
|
15
15
|
returnUrl: string;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Payment Hook using TanStack Query (V2)
|
|
3
3
|
* Matches the old usePayment.ts implementation exactly for easy migration
|
|
4
4
|
*/
|
|
5
|
-
import type { Payment, PaymentResponse, PaymentOptions, CardPaymentMethod, ApplePayToken, PaymentInstrumentResponse, PaymentInstrumentCustomerResponse } from '../../core/resources/payments';
|
|
5
|
+
import type { Payment, PaymentResponse, PaymentOptions, CardPaymentMethod, ApplePayToken, GooglePayToken, PaymentInstrumentResponse, PaymentInstrumentCustomerResponse } from '../../core/resources/payments';
|
|
6
|
+
import { TagadaError } from '../../core/errors';
|
|
6
7
|
export type { Payment as PaymentType, PaymentResponse, PaymentOptions, CardPaymentMethod, ApplePayToken, PaymentInstrumentResponse, PaymentInstrumentCustomerResponse, PaymentInstrumentCustomer } from '../../core/resources/payments';
|
|
7
8
|
/**
|
|
8
9
|
* Metadata provided with payment callbacks
|
|
@@ -11,7 +12,12 @@ export interface PaymentCompletionMetadata {
|
|
|
11
12
|
/** True if payment completed after external redirect (3DS, PayPal, etc.) */
|
|
12
13
|
isRedirectReturn: boolean;
|
|
13
14
|
/** Order associated with the payment (if available) */
|
|
14
|
-
order?:
|
|
15
|
+
order?: {
|
|
16
|
+
id: string;
|
|
17
|
+
amount?: number;
|
|
18
|
+
currency?: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
};
|
|
15
21
|
/** Checkout session ID (if available) */
|
|
16
22
|
checkoutSessionId?: string;
|
|
17
23
|
}
|
|
@@ -37,14 +43,21 @@ export interface UsePaymentOptions {
|
|
|
37
43
|
export interface PaymentHook {
|
|
38
44
|
processCardPayment: (checkoutSessionId: string, cardData: CardPaymentMethod, options?: PaymentOptions) => Promise<PaymentResponse>;
|
|
39
45
|
processApplePayPayment: (checkoutSessionId: string, applePayToken: ApplePayToken, options?: PaymentOptions) => Promise<PaymentResponse>;
|
|
40
|
-
processGooglePayPayment: (checkoutSessionId: string, googlePayToken:
|
|
46
|
+
processGooglePayPayment: (checkoutSessionId: string, googlePayToken: GooglePayToken, options?: PaymentOptions) => Promise<PaymentResponse>;
|
|
41
47
|
processPaymentWithInstrument: (checkoutSessionId: string, paymentInstrumentId: string, options?: PaymentOptions) => Promise<PaymentResponse>;
|
|
48
|
+
processApmPayment: (checkoutSessionId: string, options: {
|
|
49
|
+
processorId: string;
|
|
50
|
+
paymentMethod: string;
|
|
51
|
+
initiatedBy?: 'customer' | 'merchant';
|
|
52
|
+
source?: 'upsell' | 'checkout' | 'offer' | 'missing_club' | 'forced';
|
|
53
|
+
paymentFlowId?: string;
|
|
54
|
+
} & Pick<PaymentOptions, 'onFailure' | 'onPaymentFailed' | 'onSuccess' | 'onPaymentSuccess'>) => Promise<PaymentResponse>;
|
|
42
55
|
createCardPaymentInstrument: (cardData: CardPaymentMethod) => Promise<PaymentInstrumentResponse>;
|
|
43
56
|
createApplePayPaymentInstrument: (applePayToken: ApplePayToken) => Promise<PaymentInstrumentResponse>;
|
|
44
|
-
createGooglePayPaymentInstrument: (googlePayToken:
|
|
57
|
+
createGooglePayPaymentInstrument: (googlePayToken: GooglePayToken) => Promise<PaymentInstrumentResponse>;
|
|
45
58
|
getCardPaymentInstruments: () => Promise<PaymentInstrumentCustomerResponse>;
|
|
46
59
|
isLoading: boolean;
|
|
47
|
-
error:
|
|
60
|
+
error: TagadaError | null;
|
|
48
61
|
clearError: () => void;
|
|
49
62
|
currentPaymentId: string | null;
|
|
50
63
|
}
|