@dropp.cc/payment-sdk 1.0.21 → 1.0.22
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/dist/index.d.ts +142 -0
- package/package.json +2 -2
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
export type Environment = 'production' | 'qa' | 'sandbox';
|
|
2
|
+
export type PaymentType = 'standard' | 'preauth' | 'recurring';
|
|
3
|
+
|
|
4
|
+
export interface ServerAuthContext {
|
|
5
|
+
sessionId: string;
|
|
6
|
+
merchantAccount: string;
|
|
7
|
+
amount: number;
|
|
8
|
+
paymentType: PaymentType;
|
|
9
|
+
invoiceId: string;
|
|
10
|
+
expiry: string | null;
|
|
11
|
+
issuedAt: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface SDKConfig {
|
|
15
|
+
merchantId: string;
|
|
16
|
+
apiKey: string;
|
|
17
|
+
packageName: string;
|
|
18
|
+
environment?: Environment;
|
|
19
|
+
paymentAppUrl?: string;
|
|
20
|
+
baseUrl?: string;
|
|
21
|
+
getServerAuthToken?: (context: ServerAuthContext) => Promise<string> | string;
|
|
22
|
+
requireServerAuthToken?: boolean;
|
|
23
|
+
allowLocalCallbacksInNonProd?: boolean;
|
|
24
|
+
allowedOrigins?: string[];
|
|
25
|
+
debugLogging?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PaymentOptions {
|
|
29
|
+
amount: number;
|
|
30
|
+
currency: string;
|
|
31
|
+
itemName: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
invoiceId?: string;
|
|
34
|
+
paymentType?: PaymentType;
|
|
35
|
+
thumbnail?: string;
|
|
36
|
+
authHoldTimeInSeconds?: number;
|
|
37
|
+
callbackUrl?: string;
|
|
38
|
+
recurringEndDate?: string;
|
|
39
|
+
recurringInterval?: string;
|
|
40
|
+
frequency?: string;
|
|
41
|
+
successURL?: string;
|
|
42
|
+
failureURL?: string;
|
|
43
|
+
acceptPaymentDelay?: boolean;
|
|
44
|
+
serverAuthToken?: string;
|
|
45
|
+
appUrl?: string;
|
|
46
|
+
onSuccess?: (result: PaymentResult) => void;
|
|
47
|
+
onFailure?: (result: PaymentResult) => void;
|
|
48
|
+
onCancel?: (result: PaymentResult) => void;
|
|
49
|
+
onClose?: () => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface HostedPageOptions {
|
|
53
|
+
onClose?: () => void;
|
|
54
|
+
onCancel?: (result: PaymentResult) => void;
|
|
55
|
+
onFailed?: (result: PaymentResult) => void;
|
|
56
|
+
onAccountChanged?: (payload: unknown) => void;
|
|
57
|
+
onPageFailed?: (payload: unknown) => void;
|
|
58
|
+
modules?: string[];
|
|
59
|
+
confirmationMessage?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface PaymentResult {
|
|
63
|
+
status: string;
|
|
64
|
+
code?: string;
|
|
65
|
+
message?: string;
|
|
66
|
+
data?: unknown;
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface HostedPageResult {
|
|
71
|
+
status: 'opened' | 'cancelled';
|
|
72
|
+
route: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface InitResult {
|
|
76
|
+
status: string;
|
|
77
|
+
code: string;
|
|
78
|
+
message: string;
|
|
79
|
+
sdk: DroppPaymentSDK;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface InitializeResult {
|
|
83
|
+
status: string;
|
|
84
|
+
code: string;
|
|
85
|
+
message: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface AccountStatusResult {
|
|
89
|
+
type: string;
|
|
90
|
+
data: {
|
|
91
|
+
linked: boolean;
|
|
92
|
+
method?: string;
|
|
93
|
+
[key: string]: unknown;
|
|
94
|
+
};
|
|
95
|
+
[key: string]: unknown;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export declare class DroppPaymentSDK {
|
|
99
|
+
constructor(config: SDKConfig);
|
|
100
|
+
|
|
101
|
+
pay(options: PaymentOptions): Promise<PaymentResult>;
|
|
102
|
+
initialize(): Promise<InitializeResult>;
|
|
103
|
+
closePayment(): void;
|
|
104
|
+
dashboard(options?: HostedPageOptions): Promise<HostedPageResult>;
|
|
105
|
+
open(moduleId: string, options?: HostedPageOptions): Promise<HostedPageResult>;
|
|
106
|
+
unlinkAccount(options?: HostedPageOptions): Promise<HostedPageResult>;
|
|
107
|
+
transactions(options?: HostedPageOptions): Promise<HostedPageResult>;
|
|
108
|
+
offers(options?: HostedPageOptions): Promise<HostedPageResult>;
|
|
109
|
+
status(): Promise<AccountStatusResult>;
|
|
110
|
+
|
|
111
|
+
static getVersion(): string;
|
|
112
|
+
static getEnvironments(): Record<'PRODUCTION' | 'QA' | 'SANDBOX', Environment>;
|
|
113
|
+
static getPaymentTypes(): Record<'STANDARD' | 'PREAUTH' | 'RECURRING', PaymentType>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export declare function createPaymentSDK(config: SDKConfig): Promise<InitResult>;
|
|
117
|
+
export declare function getDroppInstance(): DroppPaymentSDK | null;
|
|
118
|
+
|
|
119
|
+
export declare const ENVIRONMENTS: Record<'PRODUCTION' | 'QA' | 'SANDBOX', Environment>;
|
|
120
|
+
export declare const PAYMENT_TYPES: Record<'STANDARD' | 'PREAUTH' | 'RECURRING', PaymentType>;
|
|
121
|
+
|
|
122
|
+
export declare const Dropp: {
|
|
123
|
+
init(config: SDKConfig): Promise<InitResult>;
|
|
124
|
+
pay(options: PaymentOptions): Promise<PaymentResult>;
|
|
125
|
+
dashboard(options?: HostedPageOptions): Promise<HostedPageResult>;
|
|
126
|
+
open(moduleId: string, options?: HostedPageOptions): Promise<HostedPageResult>;
|
|
127
|
+
unlinkAccount(options?: HostedPageOptions): Promise<HostedPageResult>;
|
|
128
|
+
transactions(options?: HostedPageOptions): Promise<HostedPageResult>;
|
|
129
|
+
offers(options?: HostedPageOptions): Promise<HostedPageResult>;
|
|
130
|
+
status(): Promise<AccountStatusResult>;
|
|
131
|
+
getInstance(): DroppPaymentSDK | null;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
declare const _default: {
|
|
135
|
+
DroppPaymentSDK: typeof DroppPaymentSDK;
|
|
136
|
+
createPaymentSDK: typeof createPaymentSDK;
|
|
137
|
+
Dropp: typeof Dropp;
|
|
138
|
+
ENVIRONMENTS: typeof ENVIRONMENTS;
|
|
139
|
+
PAYMENT_TYPES: typeof PAYMENT_TYPES;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dropp.cc/payment-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "Dropp Payment SDK for Web - Secure payment integration for web applications.",
|
|
5
5
|
"main": "dist/dropp-payment-sdk.js",
|
|
6
6
|
"module": "dist/dropp-payment-sdk.esm.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"LICENSE"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "rollup -c",
|
|
14
|
+
"build": "rollup -c && node scripts/copy-types.mjs",
|
|
15
15
|
"dev": "rollup -c -w",
|
|
16
16
|
"test": "node scripts/verify-origins.mjs",
|
|
17
17
|
"test:origins": "node scripts/verify-origins.mjs",
|