@authvia/payment-method-create 1.0.12 → 1.0.14

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.
@@ -58,8 +58,8 @@ declare const _default: import('vue').DefineComponent<Props, {
58
58
  venmo: boolean | import('../types').VenmoConfig;
59
59
  variant: "outlined" | "plain" | "underlined" | "filled" | "solo" | "solo-filled" | "solo-inverted";
60
60
  merchantId: string;
61
- customerRef: string;
62
61
  token: string;
62
+ customerRef: string;
63
63
  color: string;
64
64
  forgetDefault: boolean | string;
65
65
  forgetHidden: boolean | string;
@@ -342,6 +342,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
342
342
  };
343
343
  amount?: number;
344
344
  authToken?: string;
345
+ merchantId?: string;
345
346
  customerRef?: string;
346
347
  autoStart?: boolean;
347
348
  }, {
@@ -361,6 +362,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
361
362
  };
362
363
  amount?: number;
363
364
  authToken?: string;
365
+ merchantId?: string;
364
366
  customerRef?: string;
365
367
  autoStart?: boolean;
366
368
  }> & Readonly<{
@@ -371,6 +373,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
371
373
  onError?: ((error: import('../../types').PaymentMethodErrorPayload) => any) | undefined;
372
374
  onCancel?: (() => any) | undefined;
373
375
  }>, {
376
+ merchantId: string;
374
377
  amount: number;
375
378
  pzSettings: {
376
379
  clientId?: string;
@@ -12,6 +12,7 @@ declare const _default: import('vue').DefineComponent<{
12
12
  };
13
13
  amount?: number;
14
14
  authToken?: string;
15
+ merchantId?: string;
15
16
  customerRef?: string;
16
17
  autoStart?: boolean;
17
18
  }, {
@@ -31,6 +32,7 @@ declare const _default: import('vue').DefineComponent<{
31
32
  };
32
33
  amount?: number;
33
34
  authToken?: string;
35
+ merchantId?: string;
34
36
  customerRef?: string;
35
37
  autoStart?: boolean;
36
38
  }> & Readonly<{
@@ -41,6 +43,7 @@ declare const _default: import('vue').DefineComponent<{
41
43
  onError?: ((error: PaymentMethodErrorPayload) => any) | undefined;
42
44
  onCancel?: (() => any) | undefined;
43
45
  }>, {
46
+ merchantId: string;
44
47
  amount: number;
45
48
  pzSettings: {
46
49
  clientId?: string;
@@ -1,5 +1,5 @@
1
1
  import { Ref } from 'vue';
2
- import { PaymentMethod, APIOptions, PaymentMethodFilters, Token, PayPalSetupTokenResponse, PayPalIDTokenResponse } from '../model';
2
+ import { PaymentMethod, APIOptions, PaymentMethodFilters, Token, PaymentMethodPermissionRequest, PaymentMethodPermission, PayPalSetupTokenResponse, PayPalIDTokenResponse } from '../model';
3
3
  import { useWalletMerchantService } from './useWalletMerchantService';
4
4
  /**
5
5
  * Return type for usePaymentMethodService composable
@@ -9,9 +9,9 @@ export interface UsePaymentMethodServiceReturn {
9
9
  all: Ref<PaymentMethod[] | undefined>;
10
10
  options: Ref<PaymentMethod[]>;
11
11
  filters: Ref<PaymentMethodFilters | undefined>;
12
- permission: Ref<'use' | 'single-use' | undefined>;
12
+ permission: Ref<PaymentMethodPermission | undefined>;
13
13
  setActivePaymentMethod: (paymentMethod: PaymentMethod | undefined) => void;
14
- setActivePermission: (permission: 'use' | 'single-use' | undefined) => void;
14
+ setActivePermission: (permission: PaymentMethodPermission | undefined) => void;
15
15
  resetPermission: () => void;
16
16
  list: (userId: string, options: APIOptions) => Promise<PaymentMethod[]>;
17
17
  create: (userId: string, paymentMethod: PaymentMethod, options: APIOptions, squelch?: boolean, customHeaders?: {
@@ -26,6 +26,7 @@ export interface UsePaymentMethodServiceReturn {
26
26
  generatePaypalIDToken: (options: APIOptions) => Promise<PayPalIDTokenResponse>;
27
27
  getReturnUrl: () => string;
28
28
  generatePaypalSetupToken: (options: APIOptions, paymentSourceType: string) => Promise<PayPalSetupTokenResponse>;
29
+ setPaymentMethodPermission: (userId: string, paymentMethodId: string, options: APIOptions, permissionRequest: PaymentMethodPermissionRequest) => Promise<void>;
29
30
  }
30
31
  /**
31
32
  * Payment Method Service Composable
@@ -2,6 +2,12 @@
2
2
  * Injects bundled component styles into the shadow root.
3
3
  */
4
4
  export declare function injectComponentStyles(shadow: ShadowRoot): void;
5
+ /**
6
+ * Injects Google Places `.pac-container` styles into `document.head`.
7
+ * Google appends the suggestion dropdown to `document.body`, so shadow DOM CSS does not apply.
8
+ * Safe to call multiple times; only one style tag is created per page.
9
+ */
10
+ export declare function injectGooglePlacesAutocompleteDocumentStyles(): void;
5
11
  export declare function getVuetifyOverrideCss(element: HTMLElement): string;
6
12
  export declare function injectVuetifyOverrideStyles(shadow: ShadowRoot, css: string): void;
7
13
  /**
@@ -6,6 +6,8 @@ export declare class PaymentMethodAPIError extends Error {
6
6
  errors?: Array<any>;
7
7
  status?: number;
8
8
  id?: string;
9
+ /** Payment method type from duplicate (409) responses when provided by the API. */
10
+ type?: string;
9
11
  apiError?: Record<string, unknown>;
10
12
  /**
11
13
  * Construct Error With Code
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Minimal shape for a duplicate payment method API error (HTTP 409 with id).
3
+ */
4
+ export interface PaymentMethodDuplicateErrorLike {
5
+ status?: number;
6
+ code?: string | number;
7
+ id?: string;
8
+ type?: string;
9
+ }
10
+ export declare function getDuplicatePaymentMethodStatus(error: unknown): number | undefined;
11
+ export declare function getDuplicatePaymentMethodId(error: unknown): string | undefined;
12
+ export declare function getDuplicatePaymentMethodType(error: unknown): string;
@@ -0,0 +1,22 @@
1
+ import { APIOptions } from './APIOptions';
2
+ export type PaymentMethodPermission = 'use' | 'single-use';
3
+ /**
4
+ * Request body for `POST /v3/users/{userId}/payment-methods/{paymentMethodId}/permissions`.
5
+ */
6
+ export interface PaymentMethodPermissionRequest {
7
+ merchant: string;
8
+ customerRef: string;
9
+ permission: PaymentMethodPermission;
10
+ }
11
+ export type SetPaymentMethodPermissionFn = (userId: string, paymentMethodId: string, options: APIOptions, permissionRequest: PaymentMethodPermissionRequest) => Promise<void>;
12
+ /**
13
+ * Optional context for duplicate (409) recovery via the permissions API.
14
+ */
15
+ export interface HandlePaymentMethodPermissionOptions {
16
+ authToken?: string;
17
+ merchantId?: string;
18
+ customerRef?: string;
19
+ /** Fallback when the duplicate (409) error body does not include `type`. */
20
+ paymentMethodType?: string;
21
+ setPaymentMethodPermission?: SetPaymentMethodPermissionFn;
22
+ }
@@ -8,4 +8,6 @@ export * from './MerchantTheme';
8
8
  export * from './Contact';
9
9
  export * from './Merchant';
10
10
  export * from './MerchantProductSummary';
11
+ export * from './PaymentMethodPermissionRequest';
12
+ export * from './PaymentMethodDuplicateError';
11
13
  export * from './TokenGrants';
@@ -5,10 +5,12 @@ export declare const ACH_NAME_MIN_LENGTH: number;
5
5
  export declare const ACH_VALIDATION_MESSAGES: {
6
6
  readonly routingRequired: "Routing number cannot be blank";
7
7
  readonly routingInvalid: "Routing number is invalid";
8
+ readonly routingInvalidHint: "Routing number must be 8-9 digits";
8
9
  readonly accountRequired: "Account number cannot be blank";
9
10
  readonly accountInvalid: "Account number is invalid";
10
11
  readonly nameRequired: "Account holder name cannot be blank";
11
12
  readonly nameInvalid: "Account holder name is not valid; enter your full name and do not use special characters.";
13
+ readonly nameInvalidHint: "Account holder name must be your full name";
12
14
  };
13
15
  export declare const normalizeAchTextValue: (value: unknown) => string;
14
16
  export declare const sanitizeAchDigits: (value: unknown, maxLength: number) => string;
@@ -1,3 +1,7 @@
1
+ import { HandlePaymentMethodPermissionOptions } from '../model/PaymentMethodPermissionRequest';
2
+ import { PaymentMethodSuccessPayload } from './paymentMethodSuccessPayload';
3
+ export type { HandlePaymentMethodPermissionOptions, PaymentMethodPermissionRequest, SetPaymentMethodPermissionFn, } from '../model/PaymentMethodPermissionRequest';
4
+ export type PaymentMethodSuccessEmitFn = (event: 'success', payload: PaymentMethodSuccessPayload) => void;
1
5
  export declare const isMobile: () => boolean;
2
6
  /**
3
7
  * @param str Input string
@@ -53,11 +57,7 @@ export declare const isValidHandle: (handle: string) => boolean;
53
57
  export declare const anyAlpha: RegExp;
54
58
  export declare function addressFormat(address: string): string;
55
59
  /**
56
- * Handles payment method creation errors, specifically checking for 409 status (duplicate payment method)
57
- * @param error - The error object from the API call
58
- * @param emit - The emit function from the Vue component
59
- * @param clearFormData - Function to clear form data
60
- * @param forgetCard - Optional forgetCard value to include in success payload (defaults to false)
61
- * @returns boolean - true if 409 error was handled, false otherwise
60
+ * Handles payment method creation errors, specifically checking for 409 status (duplicate payment method).
61
+ * When 409 and permission options are provided, calls the permissions API before emitting success.
62
62
  */
63
- export declare function handlePaymentMethodError(error: any, emit: (..._args: any[]) => void, clearFormData: () => void, forgetCard?: boolean): boolean;
63
+ export declare function handlePaymentMethodError(error: unknown, emit: PaymentMethodSuccessEmitFn, clearFormData: () => void, forgetCard?: boolean, permissionOptions?: HandlePaymentMethodPermissionOptions): Promise<boolean>;