@koomipay/react 2.1.0 → 2.1.2
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 +300 -115
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/types/components/ApplePayComponent.d.ts +12 -8
- package/dist/cjs/types/components/CardComponent.d.ts +24 -5
- package/dist/cjs/types/components/GooglePayComponent.d.ts +13 -19
- package/dist/cjs/types/components/POSComponent.d.ts +1 -1
- package/dist/cjs/types/components/QrPayComponent.d.ts +22 -9
- package/dist/cjs/types/components/RedirectPayComponent.d.ts +19 -0
- package/dist/cjs/types/components/RedirectShopperInIframe.d.ts +6 -0
- package/dist/cjs/types/index.d.ts +8 -2
- package/dist/cjs/types/lib/client.d.ts +57 -14
- package/dist/cjs/types/utils/format.d.ts +4 -0
- package/dist/es/index.js +1 -1
- package/dist/es/types/components/ApplePayComponent.d.ts +12 -8
- package/dist/es/types/components/CardComponent.d.ts +24 -5
- package/dist/es/types/components/GooglePayComponent.d.ts +13 -19
- package/dist/es/types/components/POSComponent.d.ts +1 -1
- package/dist/es/types/components/QrPayComponent.d.ts +22 -9
- package/dist/es/types/components/RedirectPayComponent.d.ts +19 -0
- package/dist/es/types/components/RedirectShopperInIframe.d.ts +6 -0
- package/dist/es/types/index.d.ts +8 -2
- package/dist/es/types/lib/client.d.ts +57 -14
- package/dist/es/types/utils/format.d.ts +4 -0
- package/dist/koomipay.css +1 -1
- package/package.json +12 -9
- package/dist/cjs/types/components/CheckoutContainer.d.ts +0 -38
- package/dist/cjs/types/components/GrabPayComponent.d.ts +0 -9
- package/dist/es/types/components/CheckoutContainer.d.ts +0 -38
- package/dist/es/types/components/GrabPayComponent.d.ts +0 -9
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type GooglePayMethodPayload = {
|
|
3
|
-
type: 'googlepay';
|
|
4
|
-
googlePayToken: string;
|
|
5
|
-
browserInfo: any;
|
|
6
|
-
};
|
|
1
|
+
import { CheckoutAmount, ConfirmPaymentOptions, KoomiPayClient, PaymentResultPayload } from "../lib/client";
|
|
7
2
|
export type AdyenGooglePayButtonType = "plain" | "buy" | "book" | "checkout" | "donate" | "order" | "pay" | "subscribe";
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
export default function GooglePayComponent({ client, paymentMethod, submitPayment, countryCode, amount }: GooglePayComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export type GooglePayComponentProps = {
|
|
4
|
+
onValid?: (isValid: boolean) => void;
|
|
5
|
+
client?: KoomiPayClient;
|
|
6
|
+
amount?: CheckoutAmount;
|
|
7
|
+
countryCode?: string;
|
|
8
|
+
onPaymentError?: (message?: string) => void;
|
|
9
|
+
onPaymentComplete?: (payload: PaymentResultPayload) => void;
|
|
10
|
+
paymentMethod: any;
|
|
11
|
+
showPayButton?: boolean;
|
|
12
|
+
onSubmit?: (confirm: (payload: ConfirmPaymentOptions) => Promise<void>) => void;
|
|
13
|
+
};
|
|
14
|
+
export default function GooglePayComponent({ client, onValid, paymentMethod, onPaymentError, onPaymentComplete, countryCode, amount, showPayButton, onSubmit, }: GooglePayComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CheckoutAmount, ConfirmPaymentOptions, KoomiPayClient, KoomiPaymentMethod, PaymentResultPayload } from "src/lib/client";
|
|
3
3
|
export type KoomiQrPaymentMethod = KoomiPaymentMethod & {
|
|
4
4
|
type: string;
|
|
5
|
+
options: QrPaymentOptions;
|
|
5
6
|
};
|
|
6
|
-
export type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
options: QrOptions;
|
|
10
|
-
actionData?: any;
|
|
11
|
-
loadingContext?: string;
|
|
7
|
+
export type QrPaymentOptions = {
|
|
8
|
+
qrCodeSize?: string;
|
|
9
|
+
countdownTime?: number;
|
|
12
10
|
};
|
|
13
|
-
export
|
|
11
|
+
export type QrPayComponentProps = {
|
|
12
|
+
onValid?: (isValid: boolean) => void;
|
|
13
|
+
client?: KoomiPayClient;
|
|
14
|
+
amount?: CheckoutAmount;
|
|
15
|
+
countryCode?: string;
|
|
16
|
+
onPaymentError?: (message?: string) => void;
|
|
17
|
+
onPaymentComplete?: (payload?: PaymentResultPayload) => void;
|
|
18
|
+
paymentMethod: any;
|
|
19
|
+
showPayButton?: boolean;
|
|
20
|
+
onSubmit?: (confirm: (payload: ConfirmPaymentOptions) => Promise<void>) => void;
|
|
21
|
+
};
|
|
22
|
+
export type QrPayComponentRef = {
|
|
23
|
+
submit: () => void;
|
|
24
|
+
};
|
|
25
|
+
export declare const QrPayComponent: import("react").ForwardRefExoticComponent<QrPayComponentProps & import("react").RefAttributes<QrPayComponentRef>>;
|
|
26
|
+
export default QrPayComponent;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CheckoutAmount, ConfirmPaymentOptions, KoomiPayClient, PaymentResultPayload } from "src/lib/client";
|
|
3
|
+
export type RedirectPayComponentProps = {
|
|
4
|
+
onValid?: (isValid: boolean) => void;
|
|
5
|
+
client?: KoomiPayClient;
|
|
6
|
+
amount?: CheckoutAmount;
|
|
7
|
+
countryCode?: string;
|
|
8
|
+
onPaymentError?: (message?: string) => void;
|
|
9
|
+
onPaymentComplete?: (payload?: PaymentResultPayload) => void;
|
|
10
|
+
paymentMethod: any;
|
|
11
|
+
showPayButton?: boolean;
|
|
12
|
+
onSubmit?: (confirm: (payload: ConfirmPaymentOptions) => Promise<void>) => void;
|
|
13
|
+
onRedirect?: (url: string) => void;
|
|
14
|
+
};
|
|
15
|
+
export type RedirectPayComponentRef = {
|
|
16
|
+
submit: () => void;
|
|
17
|
+
};
|
|
18
|
+
export declare const RedirectPayComponent: import("react").ForwardRefExoticComponent<RedirectPayComponentProps & import("react").RefAttributes<RedirectPayComponentRef>>;
|
|
19
|
+
export default RedirectPayComponent;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
export { CheckoutContainer } from "./components/CheckoutContainer";
|
|
2
1
|
export { CardComponent } from "./components/CardComponent";
|
|
3
2
|
export { PaymentMethod } from "./components/PaymentMethod";
|
|
4
3
|
export { createClient } from "./lib/client";
|
|
4
|
+
export type { CardComponentRef, } from "./components/CardComponent";
|
|
5
|
+
export type { QrPayComponentRef } from "./components/QrPayComponent";
|
|
6
|
+
export type { KoomiPayClient } from "./lib/client";
|
|
5
7
|
import GooglePayComponent from "./components/GooglePayComponent";
|
|
6
|
-
|
|
8
|
+
import ApplePayComponent from "./components/ApplePayComponent";
|
|
9
|
+
import QrPayComponent from "./components/QrPayComponent";
|
|
10
|
+
import RedirectShopperInIframe from "./components/RedirectShopperInIframe";
|
|
11
|
+
import RedirectPayComponent from "./components/RedirectPayComponent";
|
|
12
|
+
export { GooglePayComponent, ApplePayComponent, QrPayComponent, RedirectShopperInIframe, RedirectPayComponent };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { KoomiPaymentMethod } from "src/components/CheckoutContainer";
|
|
2
1
|
export type CheckoutPayload = {
|
|
3
2
|
orderID: String;
|
|
4
|
-
returnUrl
|
|
3
|
+
returnUrl?: String;
|
|
5
4
|
items?: CheckoutItem[];
|
|
6
5
|
amount: NonNullable<CheckoutAmount>;
|
|
7
6
|
paymentMethod: object;
|
|
@@ -19,7 +18,7 @@ export type CheckoutItem = {
|
|
|
19
18
|
quantity: NonNullable<number>;
|
|
20
19
|
price: NonNullable<number>;
|
|
21
20
|
};
|
|
22
|
-
export declare function createClient({ apiKey }:
|
|
21
|
+
export declare function createClient({ apiKey, apiUrl, countryCode }: KoomipayClientOptions): KoomiPayClient;
|
|
23
22
|
export type ClientConfiguration = {
|
|
24
23
|
baseApiUri: string;
|
|
25
24
|
assetHost: string;
|
|
@@ -27,9 +26,7 @@ export type ClientConfiguration = {
|
|
|
27
26
|
clientKey: string;
|
|
28
27
|
};
|
|
29
28
|
export type GetPaymentMethodArgs = {
|
|
30
|
-
amount?: CheckoutAmount;
|
|
31
29
|
countryCode?: String;
|
|
32
|
-
merchantOrigin?: String;
|
|
33
30
|
};
|
|
34
31
|
export type PaymentMethodResponse = {
|
|
35
32
|
success?: Boolean;
|
|
@@ -38,7 +35,7 @@ export type PaymentMethodResponse = {
|
|
|
38
35
|
paymentMethods?: KoomiPaymentMethod[];
|
|
39
36
|
};
|
|
40
37
|
export type TokenizeCardPayload = {
|
|
41
|
-
returnUrl
|
|
38
|
+
returnUrl?: String;
|
|
42
39
|
paymentMethod: object;
|
|
43
40
|
RequestedTestAcquirerResponseCode?: number;
|
|
44
41
|
};
|
|
@@ -46,23 +43,69 @@ export type GetTokensPayload = {
|
|
|
46
43
|
shopperReference: string;
|
|
47
44
|
};
|
|
48
45
|
export type CreateTokenPayload = {
|
|
49
|
-
returnUrl
|
|
46
|
+
returnUrl?: string;
|
|
50
47
|
paymentMethod: object;
|
|
51
48
|
RequestedTestAcquirerResponseCode?: number;
|
|
52
49
|
browserInfo: object;
|
|
53
50
|
setupIntent: string;
|
|
54
51
|
};
|
|
55
|
-
export
|
|
56
|
-
apiUrl: string;
|
|
52
|
+
export type KoomipayClientOptions = {
|
|
57
53
|
apiKey: string;
|
|
54
|
+
countryCode?: string;
|
|
55
|
+
apiUrl?: string;
|
|
56
|
+
};
|
|
57
|
+
export type OrderItem = {
|
|
58
|
+
productID: string;
|
|
59
|
+
productName: string;
|
|
60
|
+
quantity: number;
|
|
61
|
+
price: number;
|
|
62
|
+
};
|
|
63
|
+
export type ConfirmPaymentOptions = {
|
|
64
|
+
amount?: {
|
|
65
|
+
value: number;
|
|
66
|
+
currency: string;
|
|
67
|
+
};
|
|
68
|
+
orderID?: string;
|
|
69
|
+
items?: OrderItem[];
|
|
70
|
+
autoCapture?: boolean;
|
|
71
|
+
metadata?: Record<string, any>;
|
|
72
|
+
returnUrl?: string;
|
|
73
|
+
};
|
|
74
|
+
export type PaymentResultPayload = {
|
|
75
|
+
resultCode: string;
|
|
76
|
+
action: any;
|
|
77
|
+
message?: string;
|
|
78
|
+
};
|
|
79
|
+
export type KoomiPaymentMethod = {
|
|
80
|
+
type: string;
|
|
81
|
+
name: string;
|
|
82
|
+
[key: string]: any;
|
|
83
|
+
};
|
|
84
|
+
export type DefaultPaymentMethodComponentProps = {
|
|
85
|
+
client?: KoomiPayClient;
|
|
86
|
+
amount?: CheckoutAmount;
|
|
87
|
+
onValid?: (isValid: boolean) => void;
|
|
88
|
+
onChange?: (args: any) => void;
|
|
89
|
+
countryCode?: string;
|
|
90
|
+
paymentMethod: KoomiPaymentMethod | null;
|
|
91
|
+
};
|
|
92
|
+
export declare class KoomiPayClient {
|
|
93
|
+
private apiUrl;
|
|
94
|
+
private apiKey;
|
|
95
|
+
private countryCode;
|
|
96
|
+
private fetchConfig;
|
|
97
|
+
private paymentMethods;
|
|
58
98
|
config: any;
|
|
59
|
-
constructor(opts:
|
|
60
|
-
|
|
99
|
+
constructor(opts: KoomipayClientOptions);
|
|
100
|
+
isAvailable(): Promise<void>;
|
|
101
|
+
getConfig(): Promise<any>;
|
|
102
|
+
private getBaseApiUri;
|
|
61
103
|
getApiKey(): string;
|
|
62
|
-
|
|
63
|
-
|
|
104
|
+
getPaymentMethods(): KoomiPaymentMethod[];
|
|
105
|
+
private initConfig;
|
|
106
|
+
private fetchPaymentConfig;
|
|
107
|
+
private fetchPaymentMethods;
|
|
64
108
|
checkout(payload: CheckoutPayload): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
65
|
-
instantCheckout(payload: CheckoutPayload): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
66
109
|
submitAdditionalDetails(payload: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
67
110
|
tokenizeCard(payload: TokenizeCardPayload): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
68
111
|
getTokens(payload: GetTokensPayload): Promise<import("axios").AxiosResponse<any, any, {}>>;
|