mainstack-payments 2.0.3 → 2.0.4

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.
Files changed (61) hide show
  1. package/build/{CashAppPayment-B8Nptk48.js → CashAppPayment-BghcQZPY.js} +44 -45
  2. package/build/{CryptoPayments-T-b2WqT2.js → CryptoPayments-eVW9ZpTq.js} +43 -44
  3. package/build/api/config.d.ts +10 -0
  4. package/build/api/index.d.ts +121 -0
  5. package/build/{src/components → components}/CheckoutForm.d.ts +7 -2
  6. package/build/{src/components → components}/PaymentOptions/CashAppPayment.d.ts +3 -2
  7. package/build/components/PaymentOptions/CryptoPayments.d.ts +12 -0
  8. package/build/{src/components → components}/WalletPay.d.ts +2 -2
  9. package/build/hooks/usePaystackPayment.d.ts +21 -0
  10. package/build/{index-Da917IzI.js → index-OyliAwvi.js} +2088 -1988
  11. package/build/index.css +1 -1
  12. package/build/mainstack-payments.js +12 -10
  13. package/build/types/index.d.ts +233 -0
  14. package/package.json +1 -1
  15. package/build/src/api/config.d.ts +0 -7
  16. package/build/src/api/index.d.ts +0 -89
  17. package/build/src/components/PaymentOptions/CryptoPayments.d.ts +0 -11
  18. package/build/src/hooks/usePaystackPayment.d.ts +0 -31
  19. package/build/src/types/index.d.ts +0 -101
  20. /package/build/{src/app.d.ts → app.d.ts} +0 -0
  21. /package/build/{src/components → components}/ConfirmEmailModal.d.ts +0 -0
  22. /package/build/{src/components → components}/ContactAction.d.ts +0 -0
  23. /package/build/{src/components → components}/ContactForm.d.ts +0 -0
  24. /package/build/{src/components → components}/Payment.d.ts +0 -0
  25. /package/build/{src/components → components}/PaymentActionModal.d.ts +0 -0
  26. /package/build/{src/components → components}/PaymentOptions/PaystackPayments.d.ts +0 -0
  27. /package/build/{src/components → components}/PaystackPaymentErrorModal.d.ts +0 -0
  28. /package/build/{src/components → components}/PrivacyPolicy.d.ts +0 -0
  29. /package/build/{src/components → components}/SummaryCard.d.ts +0 -0
  30. /package/build/{src/components → components}/UI/CardButton.d.ts +0 -0
  31. /package/build/{src/components → components}/UI/Collapse.d.ts +0 -0
  32. /package/build/{src/components → components}/UI/PaymentsDivider.d.ts +0 -0
  33. /package/build/{src/components → components}/UI/icons/AfricanPayIcon.d.ts +0 -0
  34. /package/build/{src/components → components}/UI/icons/ApplePayIcon.d.ts +0 -0
  35. /package/build/{src/components → components}/UI/icons/CashAppIcon.d.ts +0 -0
  36. /package/build/{src/components → components}/UI/icons/CheckoutCardIcon.d.ts +0 -0
  37. /package/build/{src/components → components}/UI/icons/CryptoIcon.d.ts +0 -0
  38. /package/build/{src/components → components}/UI/icons/GooglePayIcon.d.ts +0 -0
  39. /package/build/{src/components → components}/UI/icons/MainstackLogo.d.ts +0 -0
  40. /package/build/{src/constants → constants}/index.d.ts +0 -0
  41. /package/build/{src/enums → enums}/currenciesEnums.d.ts +0 -0
  42. /package/build/{src/hooks → hooks}/useApi.d.ts +0 -0
  43. /package/build/{src/hooks → hooks}/useDebounce.d.ts +0 -0
  44. /package/build/{src/hooks → hooks}/usePayment.d.ts +0 -0
  45. /package/build/{src/hooks → hooks}/useSmoothScroll.d.ts +0 -0
  46. /package/build/{src/index.d.ts → index.d.ts} +0 -0
  47. /package/build/{src/pages → pages}/DiscountCode.d.ts +0 -0
  48. /package/build/{src/pages → pages}/Home.d.ts +0 -0
  49. /package/build/{src/pages → pages}/Login.d.ts +0 -0
  50. /package/build/{src/pages → pages}/Page404.d.ts +0 -0
  51. /package/build/{src/pages → pages}/PaymentRedirect.d.ts +0 -0
  52. /package/build/{src/pages → pages}/index.d.ts +0 -0
  53. /package/build/{src/provider → provider}/index.d.ts +0 -0
  54. /package/build/{src/routes → routes}/index.d.ts +0 -0
  55. /package/build/{src/utils → utils}/ValidatePostcode.d.ts +0 -0
  56. /package/build/{src/utils → utils}/countries_flag.json.d.ts +0 -0
  57. /package/build/{src/utils → utils}/countries_with_flags_and_currencies.json.d.ts +0 -0
  58. /package/build/{src/utils → utils}/formatUnderscoreText.d.ts +0 -0
  59. /package/build/{src/utils → utils}/index.d.ts +0 -0
  60. /package/build/{src/utils → utils}/stringifyPrice.d.ts +0 -0
  61. /package/build/{src/utils → utils}/validations.d.ts +0 -0
@@ -1,17 +1,17 @@
1
- import { jsxs as m, jsx as a } from "react/jsx-runtime";
2
- import { u as I, a as A, v as N, C as S } from "./index-Da917IzI.js";
3
- import { toast as z, BodyText as B, ChevronRightIcon as E } from "mainstack-design-system";
4
- import { u as H } from "./payments-B3Hm80pK.js";
5
- import { memo as $, useState as b, useCallback as P } from "react";
6
- const j = (i) => /* @__PURE__ */ m(
1
+ import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
+ import { u as A, a as b, v as N, b as S, C as z } from "./index-OyliAwvi.js";
3
+ import { toast as B, BodyText as E, ChevronRightIcon as H } from "mainstack-design-system";
4
+ import { u as $ } from "./payments-B3Hm80pK.js";
5
+ import { memo as j, useState as M, useCallback as P } from "react";
6
+ const R = (m) => /* @__PURE__ */ l(
7
7
  "svg",
8
8
  {
9
9
  viewBox: "0 0 32 32",
10
10
  fill: "none",
11
11
  xmlns: "http://www.w3.org/2000/svg",
12
- ...i,
12
+ ...m,
13
13
  children: [
14
- /* @__PURE__ */ m("g", { clipPath: "url(#clip0_3703_1664)", children: [
14
+ /* @__PURE__ */ l("g", { clipPath: "url(#clip0_3703_1664)", children: [
15
15
  /* @__PURE__ */ a(
16
16
  "path",
17
17
  {
@@ -32,43 +32,42 @@ const j = (i) => /* @__PURE__ */ m(
32
32
  /* @__PURE__ */ a("defs", { children: /* @__PURE__ */ a("clipPath", { id: "clip0_3703_1664", children: /* @__PURE__ */ a("rect", { width: "32", height: "32", rx: "16", fill: "white" }) }) })
33
33
  ]
34
34
  }
35
- ), M = $(
35
+ ), k = j(
36
36
  ({
37
- Request: i,
37
+ ProductRequest: m,
38
+ PaymentRequest: L,
38
39
  metadata: C,
39
- amount: c,
40
- currency: o,
41
- redirectUrl: l,
40
+ amount: o,
41
+ currency: c,
42
+ redirectUrl: s,
42
43
  checkForErrors: h
43
44
  }) => {
44
- const p = H(), { mutate: r, isLoading: L } = I(i), { mutate: f, isLoading: _ } = A(i), [v, d] = b(!1), u = L || _ || v, y = P(async () => {
45
+ const p = $(), { mutate: f, isLoading: v } = A(m), { mutate: r, isLoading: x } = b(L), [_, d] = M(!1), u = v || x || _, y = P(async () => {
45
46
  var w;
46
- const n = N(), g = {
47
+ const i = N(), g = {
47
48
  ...C,
48
- reference: n
49
+ reference: i
49
50
  };
50
51
  try {
51
- await r(
52
- {
53
- amount: c,
54
- reference: n,
55
- currency: o,
52
+ await f(
53
+ S({
56
54
  metadata: g,
57
- is_cashapp_payment: !0
58
- },
55
+ amount: o,
56
+ currency: c
57
+ }),
59
58
  {
60
59
  onSuccess: (e) => {
61
60
  },
62
61
  onError: (e) => {
63
- var s;
64
- throw ((s = e == null ? void 0 : e.raw) == null ? void 0 : s.message) ?? e;
62
+ var n;
63
+ throw ((n = e == null ? void 0 : e.raw) == null ? void 0 : n.message) ?? e;
65
64
  }
66
65
  }
67
66
  );
68
- const { client_secret: t } = await f(
67
+ const { client_secret: t } = await r(
69
68
  {
70
- amount: c,
71
- currency: o,
69
+ amount: o,
70
+ currency: c,
72
71
  metadata: g,
73
72
  is_cashapp_payment: !0
74
73
  },
@@ -76,8 +75,8 @@ const j = (i) => /* @__PURE__ */ m(
76
75
  onSuccess: (e) => {
77
76
  },
78
77
  onError: (e) => {
79
- var s;
80
- throw ((s = e == null ? void 0 : e.raw) == null ? void 0 : s.message) ?? e;
78
+ var n;
79
+ throw ((n = e == null ? void 0 : e.raw) == null ? void 0 : n.message) ?? e;
81
80
  }
82
81
  }
83
82
  );
@@ -90,7 +89,7 @@ const j = (i) => /* @__PURE__ */ m(
90
89
  // @ts-ignore
91
90
  type: "cashapp"
92
91
  },
93
- return_url: l.includes("?") ? `${l}&reference=${n}` : `${l}?reference=${n}`
92
+ return_url: s.includes("?") ? `${s}&reference=${i}` : `${s}?reference=${i}`
94
93
  }
95
94
  });
96
95
  if (e)
@@ -99,41 +98,41 @@ const j = (i) => /* @__PURE__ */ m(
99
98
  );
100
99
  }
101
100
  } catch (t) {
102
- d(!1), console.error(t), z.error({
101
+ d(!1), console.error(t), B.error({
103
102
  title: "",
104
103
  description: ((w = t == null ? void 0 : t.raw) == null ? void 0 : w.message) ?? (t == null ? void 0 : t.message) ?? t ?? "We couldn't complete your payment"
105
104
  });
106
105
  }
107
106
  }, [
108
107
  p,
109
- r,
110
108
  f,
111
- c,
109
+ r,
112
110
  o,
111
+ c,
113
112
  C,
114
- l,
113
+ s,
115
114
  d
116
- ]), x = P(async () => {
115
+ ]), I = P(async () => {
117
116
  await h() || y();
118
117
  }, [h, y]);
119
118
  return /* @__PURE__ */ a(
120
- S,
119
+ z,
121
120
  {
122
- onClick: x,
121
+ onClick: I,
123
122
  disabled: u,
124
123
  isLoading: u,
125
- children: /* @__PURE__ */ m("div", { className: "mpl:flex mpl:justify-between mpl:w-full mpl:items-center", children: [
126
- /* @__PURE__ */ m("div", { className: "mpl:flex mpl:items-center mpl:gap-12", children: [
127
- /* @__PURE__ */ a(j, { className: "mpl:size-32" }),
128
- /* @__PURE__ */ a(B, { size: "extrasmall", weight: "medium", children: "Cash App Pay" })
124
+ children: /* @__PURE__ */ l("div", { className: "mpl:flex mpl:justify-between mpl:w-full mpl:items-center", children: [
125
+ /* @__PURE__ */ l("div", { className: "mpl:flex mpl:items-center mpl:gap-12", children: [
126
+ /* @__PURE__ */ a(R, { className: "mpl:size-32" }),
127
+ /* @__PURE__ */ a(E, { size: "extrasmall", weight: "medium", children: "Cash App Pay" })
129
128
  ] }),
130
- /* @__PURE__ */ a(E, { className: "mpl:size-20" })
129
+ /* @__PURE__ */ a(H, { className: "mpl:size-20" })
131
130
  ] })
132
131
  }
133
132
  );
134
133
  }
135
134
  );
136
- M.displayName = "CashAppPayment";
135
+ k.displayName = "CashAppPayment";
137
136
  export {
138
- M as default
137
+ k as default
139
138
  };
@@ -1,9 +1,9 @@
1
- import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
- import { u as x, a as v, C as I, v as S } from "./index-Da917IzI.js";
3
- import { BodyText as E, ChevronRightIcon as z, toast as N } from "mainstack-design-system";
4
- import { u as $ } from "./payments-B3Hm80pK.js";
5
- import { useState as b } from "react";
6
- const j = (i) => /* @__PURE__ */ l(
1
+ import { jsxs as o, jsx as a } from "react/jsx-runtime";
2
+ import { u as I, a as v, C as S, v as b, b as E } from "./index-OyliAwvi.js";
3
+ import { BodyText as z, ChevronRightIcon as N, toast as $ } from "mainstack-design-system";
4
+ import { u as j } from "./payments-B3Hm80pK.js";
5
+ import { useState as B } from "react";
6
+ const M = (i) => /* @__PURE__ */ o(
7
7
  "svg",
8
8
  {
9
9
  viewBox: "0 0 32 32",
@@ -21,42 +21,41 @@ const j = (i) => /* @__PURE__ */ l(
21
21
  /* @__PURE__ */ a("defs", { children: /* @__PURE__ */ a("clipPath", { id: "clip0_2605_970", children: /* @__PURE__ */ a("rect", { width: "32", height: "32", fill: "white" }) }) })
22
22
  ]
23
23
  }
24
- ), W = ({
25
- Request: i,
26
- metadata: C,
27
- amount: c,
28
- currency: m,
29
- redirectUrl: o,
30
- checkForErrors: f
24
+ ), q = ({
25
+ ProductRequest: i,
26
+ PaymentRequest: C,
27
+ metadata: f,
28
+ amount: m,
29
+ currency: c,
30
+ redirectUrl: l,
31
+ checkForErrors: u
31
32
  }) => {
32
- const r = $(), { mutate: u, isLoading: g } = x(i), { mutate: w, isLoading: L } = v(i), [P, d] = b(!1), p = g || L || P, _ = async () => {
33
+ const d = j(), { mutate: g, isLoading: w } = I(i), { mutate: L, isLoading: P } = v(C), [_, r] = B(!1), p = w || P || _, x = async () => {
33
34
  var y;
34
- const n = S(), h = {
35
- ...C,
36
- reference: n
35
+ const s = b(), h = {
36
+ ...f,
37
+ reference: s
37
38
  };
38
39
  try {
39
- await u(
40
- {
41
- amount: c,
42
- reference: n,
43
- currency: m,
40
+ await g(
41
+ E({
44
42
  metadata: h,
45
- is_crypto_payment: !0
46
- },
43
+ amount: m,
44
+ currency: c
45
+ }),
47
46
  {
48
47
  onSuccess: (t) => {
49
48
  },
50
49
  onError: (t) => {
51
- var s;
52
- throw ((s = t == null ? void 0 : t.raw) == null ? void 0 : s.message) ?? t;
50
+ var n;
51
+ throw ((n = t == null ? void 0 : t.raw) == null ? void 0 : n.message) ?? t;
53
52
  }
54
53
  }
55
54
  );
56
- const { client_secret: e } = await w(
55
+ const { client_secret: e } = await L(
57
56
  {
58
- amount: c,
59
- currency: m,
57
+ amount: m,
58
+ currency: c,
60
59
  metadata: h,
61
60
  is_crypto_payment: !0
62
61
  },
@@ -64,52 +63,52 @@ const j = (i) => /* @__PURE__ */ l(
64
63
  onSuccess: (t) => {
65
64
  },
66
65
  onError: (t) => {
67
- var s;
68
- throw ((s = t == null ? void 0 : t.raw) == null ? void 0 : s.message) ?? t;
66
+ var n;
67
+ throw ((n = t == null ? void 0 : t.raw) == null ? void 0 : n.message) ?? t;
69
68
  }
70
69
  }
71
70
  );
72
- if (r) {
73
- d(!0);
74
- const { error: t } = await r.confirmPayment({
71
+ if (d) {
72
+ r(!0);
73
+ const { error: t } = await d.confirmPayment({
75
74
  clientSecret: e,
76
75
  confirmParams: {
77
76
  payment_method_data: {
78
77
  // @ts-ignore
79
78
  type: "crypto"
80
79
  },
81
- return_url: o.includes("?") ? `${o}&reference=${n}` : `${o}?reference=${n}`
80
+ return_url: l.includes("?") ? `${l}&reference=${s}` : `${l}?reference=${s}`
82
81
  }
83
82
  });
84
83
  if (t)
85
84
  throw new Error(t.message ?? "Couldn't load wallet integration");
86
85
  }
87
86
  } catch (e) {
88
- d(!1), console.error(e), N.error({
87
+ r(!1), console.error(e), $.error({
89
88
  title: "",
90
89
  description: ((y = e == null ? void 0 : e.raw) == null ? void 0 : y.message) ?? (e == null ? void 0 : e.message) ?? e ?? "We couldn't complete your payment"
91
90
  });
92
91
  }
93
92
  };
94
93
  return /* @__PURE__ */ a(
95
- I,
94
+ S,
96
95
  {
97
96
  onClick: async () => {
98
- await f() || _();
97
+ await u() || x();
99
98
  },
100
99
  disabled: p,
101
100
  isLoading: p,
102
- children: /* @__PURE__ */ l("div", { className: "mpl:flex mpl:justify-between mpl:w-full mpl:items-center", children: [
103
- /* @__PURE__ */ l("div", { className: "mpl:flex mpl:items-center mpl:gap-12", children: [
104
- /* @__PURE__ */ a(j, { className: "mpl:size-32" }),
105
- /* @__PURE__ */ a(E, { size: "extrasmall", weight: "medium", children: "Stablecoins & Crypto" })
101
+ children: /* @__PURE__ */ o("div", { className: "mpl:flex mpl:justify-between mpl:w-full mpl:items-center", children: [
102
+ /* @__PURE__ */ o("div", { className: "mpl:flex mpl:items-center mpl:gap-12", children: [
103
+ /* @__PURE__ */ a(M, { className: "mpl:size-32" }),
104
+ /* @__PURE__ */ a(z, { size: "extrasmall", weight: "medium", children: "Stablecoins & Crypto" })
106
105
  ] }),
107
- /* @__PURE__ */ a(z, { className: "mpl:size-20" }),
106
+ /* @__PURE__ */ a(N, { className: "mpl:size-20" }),
108
107
  " "
109
108
  ] })
110
109
  }
111
110
  );
112
111
  };
113
112
  export {
114
- W as default
113
+ q as default
115
114
  };
@@ -0,0 +1,10 @@
1
+ /** @format */
2
+ declare const InitializeAPIConfig: (baseUrl: string, paymentBaseUrl: string, productBaseUrl: string, feeBaseUrl: string, customHeaders?: {
3
+ [key: string]: string | boolean;
4
+ } | undefined) => {
5
+ Request: import('axios').AxiosInstance;
6
+ PaymentRequest: import('axios').AxiosInstance;
7
+ ProductRequest: import('axios').AxiosInstance;
8
+ FeeRequest: import('axios').AxiosInstance;
9
+ };
10
+ export default InitializeAPIConfig;
@@ -0,0 +1,121 @@
1
+ import { IInitPayment, IInitPaymentResponse, ITransactionFeesResponse, TAPIMetadata, TPaymentMethods } from 'types';
2
+
3
+ interface IGetTransactionFeesPayload {
4
+ merchantId: string;
5
+ currencyCode: string;
6
+ amount: number;
7
+ types: string[];
8
+ address?: {
9
+ country?: string;
10
+ postal_code?: string;
11
+ };
12
+ ip?: string;
13
+ appName?: string;
14
+ quantity?: number;
15
+ }
16
+ export declare const useGetTransactionFees: (payload: IGetTransactionFeesPayload, FeeRequest: any) => {
17
+ data: any;
18
+ isLoading: boolean;
19
+ refetch: () => Promise<import('hooks/useApi').IFetchResponse>;
20
+ error: any;
21
+ };
22
+ export declare const useInitPayment: (ProductRequest: any) => {
23
+ data: any;
24
+ isLoading: boolean;
25
+ mutate: (dataParams: IInitPayment, { onSuccess, onError, }: {
26
+ onSuccess: (data: any) => void;
27
+ onError: (error: any) => void;
28
+ }) => Promise<any>;
29
+ };
30
+ export declare const buildInitPaymentPayload: ({ metadata, amount, currency, countryISO, totalAmount, }: {
31
+ metadata: any;
32
+ amount: number;
33
+ currency: string;
34
+ countryISO?: string | undefined;
35
+ totalAmount?: number | undefined;
36
+ }) => IInitPayment;
37
+ export declare const buildChargePaymentPayload: ({ initResponse, feesResponse, metadata, currency, callbackUrl, paymentToken, paymentMethodId, ip, paymentMethod, }: {
38
+ initResponse: IInitPaymentResponse;
39
+ feesResponse: ITransactionFeesResponse;
40
+ metadata: any;
41
+ currency: string;
42
+ callbackUrl?: string | undefined;
43
+ paymentToken?: string | undefined;
44
+ paymentMethodId?: string | undefined;
45
+ ip?: string | undefined;
46
+ paymentMethod?: "crypto" | "cashapp" | "card" | "transfer" | "mobile_money" | "google_pay" | "apple_pay" | "bank_transfer" | "ussd" | "payattitude" | "qr" | "wechat_pay" | undefined;
47
+ }) => IChargePayment;
48
+ export interface IChargePayment {
49
+ orderId?: string;
50
+ reference?: string;
51
+ iPAddress?: string;
52
+ paymentMethod?: string;
53
+ paymentToken?: string;
54
+ customerPaymentMethodId?: string;
55
+ callbackUrl?: string;
56
+ amount: {
57
+ currency: string;
58
+ value: number;
59
+ };
60
+ feeAmount?: {
61
+ currency: string;
62
+ value: number;
63
+ };
64
+ feeIds?: string[];
65
+ merchantId: string;
66
+ customer?: {
67
+ email?: string;
68
+ phone?: string;
69
+ name?: string;
70
+ };
71
+ metadata?: Record<string, any>;
72
+ source?: string;
73
+ payment_method_id?: string;
74
+ }
75
+ export declare const useChargePayment: (PaymentRequest: any) => {
76
+ data: any;
77
+ isLoading: boolean;
78
+ mutate: (dataParams: IChargePayment, { onSuccess, onError, }: {
79
+ onSuccess: (data: any) => void;
80
+ onError: (error: any) => void;
81
+ }) => Promise<any>;
82
+ };
83
+ interface IIntentPayment {
84
+ amount: number;
85
+ currency: string;
86
+ payment_method_id?: string;
87
+ metadata: TAPIMetadata;
88
+ is_crypto_payment?: boolean;
89
+ is_cashapp_payment?: boolean;
90
+ }
91
+ export declare const useIntentPayment: (Request: any) => {
92
+ data: any;
93
+ isLoading: boolean;
94
+ mutate: (dataParams: IIntentPayment, { onSuccess, onError, }: {
95
+ onSuccess: (data: any) => void;
96
+ onError: (error: any) => void;
97
+ }) => Promise<any>;
98
+ };
99
+ export declare const useVerifyPayment: (reference: string, Request: any) => {
100
+ data: any;
101
+ isLoading: boolean;
102
+ refetch: () => Promise<import('hooks/useApi').IFetchResponse>;
103
+ error: any;
104
+ };
105
+ interface IApplyDiscount {
106
+ discount_code: string;
107
+ product_id: string;
108
+ account_id: string;
109
+ currency: string;
110
+ store_id: string;
111
+ cart_id?: string;
112
+ ticket_payload?: string;
113
+ payment_plan_id?: string;
114
+ }
115
+ export declare const useApplyDiscount: ({ discount_code, product_id, account_id, currency, store_id, ticket_payload, cart_id, payment_plan_id, }: IApplyDiscount, Request: any) => {
116
+ data: any;
117
+ isLoading: boolean;
118
+ refetch: () => Promise<import('hooks/useApi').IFetchResponse>;
119
+ error: any;
120
+ };
121
+ export {};
@@ -1,6 +1,7 @@
1
+ import { IChargePayment } from 'api';
1
2
  import { TCustomizations, TPaymentModel } from 'types';
2
3
 
3
- declare const CheckoutDetailsForm: ({ currency, amount, metadata, formik, isFree, showPayment, showCheckoutForm, onCancel, btn_color, onPaymentComplete, Request, paymentModel, callbackUrl, setIframeUrl, isEuroCurrencies, paymentWidth, customizations, onGoBack, Styles, }: {
4
+ declare const CheckoutDetailsForm: ({ currency, amount, metadata, formik, isFree, showPayment, showCheckoutForm, onCancel, btn_color, onPaymentComplete, PaymentRequest, paymentModel, callbackUrl, buildChargePayload, setIframeUrl, isEuroCurrencies, paymentWidth, customizations, onGoBack, Styles, }: {
4
5
  currency: string;
5
6
  amount: number;
6
7
  metadata?: any;
@@ -11,9 +12,13 @@ declare const CheckoutDetailsForm: ({ currency, amount, metadata, formik, isFree
11
12
  onCancel: () => void;
12
13
  btn_color: string;
13
14
  onPaymentComplete: (payload: object) => void;
14
- Request: any;
15
+ PaymentRequest: any;
15
16
  paymentModel: TPaymentModel;
16
17
  callbackUrl?: string | undefined;
18
+ buildChargePayload: (params: {
19
+ paymentToken?: string;
20
+ paymentMethodId?: string;
21
+ }) => IChargePayment | null;
17
22
  setIframeUrl: (payload: {
18
23
  url: string;
19
24
  reference: string;
@@ -1,12 +1,13 @@
1
1
  /** @format */
2
2
  /// <reference types="react" />
3
3
  interface CashAppPaymentProps {
4
- Request: any;
4
+ ProductRequest: any;
5
+ PaymentRequest: any;
5
6
  metadata: any;
6
7
  amount: number;
7
8
  currency: string;
8
9
  redirectUrl: string;
9
10
  checkForErrors: () => Promise<boolean>;
10
11
  }
11
- declare const CashAppPayment: import('react').MemoExoticComponent<({ Request, metadata, amount, currency, redirectUrl, checkForErrors, }: CashAppPaymentProps) => import("react/jsx-runtime").JSX.Element>;
12
+ declare const CashAppPayment: import('react').MemoExoticComponent<({ ProductRequest, PaymentRequest, metadata, amount, currency, redirectUrl, checkForErrors, }: CashAppPaymentProps) => import("react/jsx-runtime").JSX.Element>;
12
13
  export default CashAppPayment;
@@ -0,0 +1,12 @@
1
+ /** @format */
2
+ interface CryptoPaymentsProps {
3
+ ProductRequest: any;
4
+ PaymentRequest: any;
5
+ metadata: any;
6
+ amount: number;
7
+ currency: string;
8
+ redirectUrl: string;
9
+ checkForErrors: () => Promise<boolean>;
10
+ }
11
+ declare const CryptoPayments: ({ ProductRequest, PaymentRequest, metadata, amount, currency, redirectUrl, checkForErrors, }: CryptoPaymentsProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default CryptoPayments;
@@ -7,12 +7,12 @@ interface WalletPayProps {
7
7
  formik: any;
8
8
  checkForErrors: () => Promise<boolean>;
9
9
  onPaymentComplete: (payload: object) => void;
10
- Request: any;
10
+ PaymentRequest: any;
11
11
  stripeCountry: string;
12
12
  onInitializePayment?: (e: object) => Promise<{
13
13
  terminate?: boolean;
14
14
  }>;
15
15
  onToggleWallet: () => void;
16
16
  }
17
- declare const WalletPay: import('react').MemoExoticComponent<({ currency, metadata, amount, formik, checkForErrors, onPaymentComplete, Request, stripeCountry, onInitializePayment, onToggleWallet, }: WalletPayProps) => import("react/jsx-runtime").JSX.Element>;
17
+ declare const WalletPay: import('react').MemoExoticComponent<({ currency, metadata, amount, formik, checkForErrors, onPaymentComplete, PaymentRequest, stripeCountry, onInitializePayment, onToggleWallet, }: WalletPayProps) => import("react/jsx-runtime").JSX.Element>;
18
18
  export default WalletPay;
@@ -0,0 +1,21 @@
1
+ import { IChargePayment } from 'api';
2
+ import { AxiosInstance } from 'axios';
3
+ import { IInitPayment, IInitPaymentResponse } from 'types';
4
+
5
+ interface IProps {
6
+ ProductRequest: AxiosInstance;
7
+ PaymentRequest: AxiosInstance;
8
+ }
9
+ interface IMakePaymentArgs {
10
+ initPayload: IInitPayment;
11
+ buildChargePayload: (initResponse: IInitPaymentResponse) => IChargePayment;
12
+ handleChargeSuccess: (data: object) => void;
13
+ handleChargeError: (err?: object) => void;
14
+ handleInitError: (err?: object) => void;
15
+ }
16
+ export declare function usePaystackPayment({ ProductRequest, PaymentRequest }: IProps): {
17
+ makePaystackPayment: ({ initPayload, buildChargePayload, handleChargeError, handleInitError, handleChargeSuccess, }: IMakePaymentArgs) => void;
18
+ isInitializingPayment: boolean;
19
+ isChargingCard: boolean;
20
+ };
21
+ export {};