@openhive-eu/payment 0.0.0-beta.2 → 0.0.0-beta.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.
@@ -0,0 +1,29 @@
1
+ import { client } from "./api-client";
2
+ type PayParams = {
3
+ apiClient: typeof client;
4
+ };
5
+ interface PayClientInterface {
6
+ getPaymentMethods: () => Promise<{
7
+ id: string;
8
+ name: string;
9
+ code: string;
10
+ provider: string;
11
+ description: string;
12
+ logoUrl: string;
13
+ }[]>;
14
+ }
15
+ declare class PayClient implements PayClientInterface {
16
+ private apiClient;
17
+ constructor(params: PayParams);
18
+ getPaymentMethods: () => Promise<{
19
+ id: string;
20
+ name: string;
21
+ code: string;
22
+ provider: string;
23
+ description: string;
24
+ logoUrl: string;
25
+ }[]>;
26
+ setConfig: (newParams: Partial<PayParams>) => void;
27
+ }
28
+ export { PayClient };
29
+ export type { PayParams, PayClientInterface };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openhive-eu/payment",
3
- "version": "0.0.0-beta.2",
3
+ "version": "0.0.0-beta.4",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "license": "ISC",
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import { OpenPay } from "~/lib/openpay";
3
- declare const OpenPayProvider: ({ token, children, }: {
4
- token?: string;
5
- children: React.ReactNode;
6
- }) => import("react/jsx-runtime").JSX.Element;
7
- declare const useOpenPay: () => OpenPay;
8
- declare const usePayEvent: (eventName: string, callback: (event: CustomEvent) => void) => null;
9
- export { OpenPayProvider, useOpenPay, usePayEvent };
@@ -1,15 +0,0 @@
1
- import type { RequestToPay } from "~/lib/api-client";
2
- export declare function PaymentWidget({ defaultAmount, readOnlyAmount, defaultReference, customer, onClose, onSuccess, }: {
3
- defaultAmount?: string;
4
- maxAmount?: number;
5
- readOnlyAmount?: boolean;
6
- defaultReference?: string;
7
- audience?: "private" | "pro";
8
- customer: {
9
- name?: string;
10
- email?: string;
11
- phone?: string;
12
- };
13
- onClose?: () => void;
14
- onSuccess?: (requestToPay: RequestToPay) => void;
15
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,35 +0,0 @@
1
- import { client } from "./api-client";
2
- import type { paths } from "./gen/api-schema";
3
- type OpenPayEvent = {
4
- eventName: string;
5
- callback: (event: any) => void;
6
- };
7
- type OpenPayParams = {
8
- apiClient: typeof client;
9
- };
10
- declare class OpenPay {
11
- private apiClient;
12
- private events;
13
- constructor(params: OpenPayParams);
14
- setToken: (newToken?: string) => void;
15
- subscribe: (eventName: string, detail: any) => void;
16
- unsubscribe: (eventName: string) => void;
17
- getPaymentMethods: () => Promise<{
18
- name: string;
19
- code: string;
20
- provider: string;
21
- description: string;
22
- logoUrl: string;
23
- }[]>;
24
- requestToPay: (requestToPay: paths["/api/v1/payment-sessions"]["post"]["requestBody"]["content"]["application/json"]) => Promise<{
25
- Uuid?: string | null;
26
- status?: "pending" | "succeeded" | "failed" | "expired" | "canceled";
27
- partner?: "stripe" | "fintecture" | "adyen";
28
- partnerSessionId?: string | null;
29
- errorCode?: string | null;
30
- errorMessage?: string | null;
31
- } | undefined>;
32
- setConfig: (newParams: Partial<OpenPayParams>) => void;
33
- }
34
- export { OpenPay };
35
- export type { OpenPayEvent, OpenPayParams };