@paynext/sdk 0.0.73 → 0.0.74

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 CHANGED
@@ -25,7 +25,7 @@ await checkout.mount({
25
25
  // Handle successful payment
26
26
  console.log('Payment successful!', result)
27
27
  },
28
- onCheckoutFail: (error: Error) => {
28
+ onCheckoutFail: (error: IErrorInterface) => {
29
29
  // Handle payment failure
30
30
  console.error('Payment failed:', error)
31
31
  }
@@ -57,12 +57,12 @@ export const CheckoutComponent: FC<Readonly<IProps> = (props) => {
57
57
  checkout.mount({
58
58
  clientToken,
59
59
  environment: 'sandbox',
60
- apiVersion: '1.0.0'
60
+ apiVersion: '1.0.0',
61
61
  onCheckoutComplete: (result: PaymentResult) => {
62
62
  // Handle successful payment
63
63
  console.log('Payment completed:', result)
64
64
  },
65
- onCheckoutFail: (error: Error) => {
65
+ onCheckoutFail: (error: IErrorInterface) => {
66
66
  // Handle payment failure
67
67
  console.error('Payment failed:', error)
68
68
  }
@@ -90,7 +90,7 @@ interface PayNextConfig {
90
90
  translate?: CheckoutTranslate
91
91
  styles?: StylesConfig
92
92
  onCheckoutComplete?: (result: PaymentResult) => void
93
- onCheckoutFail?: (error: Error) => void
93
+ onCheckoutFail?: (error: IErrorInterface) => void
94
94
  }
95
95
  ```
96
96
 
package/dist/index.d.ts CHANGED
@@ -248,7 +248,7 @@ declare type HTMLStyles = {
248
248
  };
249
249
 
250
250
  declare interface IApplePayButtonStyles {
251
- styles?: Pick<ApplePayOptions, 'type' | 'style' | 'padding' | 'borderRadius' | 'size'>;
251
+ styles?: Partial<Pick<ApplePayOptions, 'type' | 'style' | 'padding' | 'borderRadius' | 'size'>>;
252
252
  }
253
253
 
254
254
  declare interface IButtonActionsHandler<TSuccess = void> {
@@ -265,8 +265,14 @@ declare interface ICheckoutState {
265
265
  styles: StylesState;
266
266
  }
267
267
 
268
+ declare interface IErrorInterface {
269
+ advice_code: 'try_again_later' | 'do_not_try_again';
270
+ decline_code: DeclineCode;
271
+ message: string;
272
+ }
273
+
268
274
  declare interface IGooglePayButtonStyles {
269
- styles?: Pick<GooglePayOptions, 'type' | 'color' | 'borderRadius' | 'size'>;
275
+ styles?: Partial<Pick<GooglePayOptions, 'type' | 'color' | 'borderRadius' | 'size'>>;
270
276
  }
271
277
 
272
278
  declare interface InputStyles {
@@ -404,11 +410,7 @@ export declare interface PaymentResult {
404
410
  refunded_amount: number;
405
411
  status_reason: {
406
412
  status: 'declined' | 'failed';
407
- status_reason: {
408
- advice_code: 'try_again_later' | 'do_not_try_again';
409
- decline_code: DeclineCode;
410
- message: string;
411
- };
413
+ status_reason: IErrorInterface;
412
414
  };
413
415
  subscription?: {
414
416
  id: string;
@@ -486,7 +488,7 @@ export declare interface PayNextConfig {
486
488
  translate?: DeepPartial<CheckoutTranslate>;
487
489
  locale?: Locale;
488
490
  onCheckoutComplete?: (result: PaymentResult) => void;
489
- onCheckoutFail?: (error: unknown) => void;
491
+ onCheckoutFail?: (error: IErrorInterface) => void;
490
492
  }
491
493
 
492
494
  declare class PayPalService {