@vindhq/sloud-payment-sdk 1.0.5 → 1.0.7
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.cjs.js +24 -51295
- package/dist/index.d.ts +268 -3
- package/dist/index.esm.js +24 -51293
- package/dist/index.umd.js +24 -51301
- package/package.json +4 -1
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/index.umd.js.map +0 -1
- package/dist/react/index.esm.js +0 -51440
- package/dist/react/index.esm.js.map +0 -1
- package/dist/react/rollup.config.d.ts +0 -8
- package/dist/react/rollup.config.dts.d.ts +0 -3
- package/dist/react/src/components/Button/Button.types.d.ts +0 -6
- package/dist/react/src/components/Button/index.d.ts +0 -3
- package/dist/react/src/components/CopyToClipboardSpan/CopyToClipboard.types.d.ts +0 -4
- package/dist/react/src/components/CopyToClipboardSpan/index.d.ts +0 -3
- package/dist/react/src/components/Input/Input.types.d.ts +0 -17
- package/dist/react/src/components/Input/index.d.ts +0 -3
- package/dist/react/src/components/Skeleton/PaymentOptionSkeletons.d.ts +0 -6
- package/dist/react/src/components/TextArea/TextArea.types.d.ts +0 -19
- package/dist/react/src/components/TextArea/index.d.ts +0 -3
- package/dist/react/src/components/Widget.d.ts +0 -6
- package/dist/react/src/components/modals/AwaitingPaymentModal/AwaitingPaymentModal.d.ts +0 -2
- package/dist/react/src/components/modals/AwaitingPaymentTimeoutModal/AwaitingPaymentTimeoutModal.d.ts +0 -2
- package/dist/react/src/components/modals/Modal.d.ts +0 -10
- package/dist/react/src/components/modals/PaymentDetailsModal/PaymentDetailsModal.d.ts +0 -2
- package/dist/react/src/components/modals/PaymentDetailsModal/hooks/useTimer.d.ts +0 -7
- package/dist/react/src/components/modals/PaymentOptionsModal/PaymentOptionsModal.d.ts +0 -2
- package/dist/react/src/components/modals/PaymentOptionsModal/RadioButton.d.ts +0 -11
- package/dist/react/src/components/modals/PaymentOptionsModal/paymentOptionsMap.d.ts +0 -5
- package/dist/react/src/components/modals/SuccessModal/SuccessModal.d.ts +0 -2
- package/dist/react/src/components/modals/state/actions/data.d.ts +0 -10
- package/dist/react/src/components/modals/state/actions/index.d.ts +0 -5
- package/dist/react/src/components/modals/state/actions/modal.d.ts +0 -5
- package/dist/react/src/components/modals/state/actions/payment.d.ts +0 -7
- package/dist/react/src/components/modals/state/constants/actionTypes.d.ts +0 -24
- package/dist/react/src/components/modals/state/constants/index.d.ts +0 -2
- package/dist/react/src/components/modals/state/constants/initialState.d.ts +0 -36
- package/dist/react/src/components/modals/state/reducers/data.d.ts +0 -2
- package/dist/react/src/components/modals/state/reducers/index.d.ts +0 -2
- package/dist/react/src/components/modals/state/reducers/modal.d.ts +0 -2
- package/dist/react/src/components/modals/state/reducers/payment.d.ts +0 -2
- package/dist/react/src/components/modals/state/types/common.d.ts +0 -12
- package/dist/react/src/components/modals/state/types/data.d.ts +0 -34
- package/dist/react/src/components/modals/state/types/index.d.ts +0 -8
- package/dist/react/src/components/modals/state/types/modal.d.ts +0 -12
- package/dist/react/src/components/modals/state/types/payment.d.ts +0 -14
- package/dist/react/src/components/modals/state/utils/index.d.ts +0 -37
- package/dist/react/src/context/ModalProvider.d.ts +0 -4
- package/dist/react/src/context/PaymentInfoContext.d.ts +0 -26
- package/dist/react/src/context/PaymentWidgetContext.d.ts +0 -13
- package/dist/react/src/context/modal.d.ts +0 -4
- package/dist/react/src/context/types.d.ts +0 -28
- package/dist/react/src/hooks/types.d.ts +0 -34
- package/dist/react/src/hooks/useModalControl.d.ts +0 -27
- package/dist/react/src/hooks/usePaymentAPI.d.ts +0 -10
- package/dist/react/src/hooks/useShortPolling.d.ts +0 -4
- package/dist/react/src/index.d.ts +0 -2
- package/dist/react/src/services/config/endpoints.d.ts +0 -9
- package/dist/react/src/services/config/error.d.ts +0 -5
- package/dist/react/src/services/index.d.ts +0 -27
- package/dist/react/src/services/payments/index.d.ts +0 -4
- package/dist/react/src/services/payments/types.d.ts +0 -68
- package/dist/react/src/services/products/index.d.ts +0 -1
- package/dist/react/src/services/products/types.d.ts +0 -124
- package/dist/react/src/services/store/index.d.ts +0 -2
- package/dist/react/src/services/store/types.d.ts +0 -57
- package/dist/react/src/services/utils/widgetConfig.d.ts +0 -20
- package/dist/react/src/svg_components/ArrowLeftIcon.d.ts +0 -3
- package/dist/react/src/svg_components/BankTransferIcon.d.ts +0 -2
- package/dist/react/src/svg_components/CancelIcon.d.ts +0 -7
- package/dist/react/src/svg_components/CardIcon.d.ts +0 -2
- package/dist/react/src/svg_components/CloseIcon.d.ts +0 -3
- package/dist/react/src/svg_components/CopyIcon.d.ts +0 -2
- package/dist/react/src/svg_components/EyeCloseIcon.d.ts +0 -5
- package/dist/react/src/svg_components/EyeOpenIcon.d.ts +0 -5
- package/dist/react/src/svg_components/SloudIcon.d.ts +0 -2
- package/dist/react/src/utils/enums/AxiosErrorCodes.d.ts +0 -7
- package/dist/react/src/utils/enums/AxiosMethods.d.ts +0 -7
- package/dist/react/src/utils/helpers/classNames.d.ts +0 -7
- package/dist/react/src/utils/helpers/formatCurrency.d.ts +0 -10
- package/dist/react/src/utils/helpers/phoneDefaults.d.ts +0 -3
- package/dist/react/src/utils/helpers/validatePhone.d.ts +0 -7
- package/dist/react/src/utils/image_utils/index.d.ts +0 -9
- package/dist/react/src/utils/storage/index.d.ts +0 -9
- package/dist/react/src/widget.d.ts +0 -27
- package/dist/rollup.config.d.ts +0 -8
- package/dist/rollup.config.dts.d.ts +0 -3
- package/dist/src/components/Button/Button.types.d.ts +0 -6
- package/dist/src/components/Button/index.d.ts +0 -3
- package/dist/src/components/CopyToClipboardSpan/CopyToClipboard.types.d.ts +0 -4
- package/dist/src/components/CopyToClipboardSpan/index.d.ts +0 -3
- package/dist/src/components/Input/Input.types.d.ts +0 -17
- package/dist/src/components/Input/index.d.ts +0 -3
- package/dist/src/components/Skeleton/PaymentOptionSkeletons.d.ts +0 -6
- package/dist/src/components/TextArea/TextArea.types.d.ts +0 -19
- package/dist/src/components/TextArea/index.d.ts +0 -3
- package/dist/src/components/Widget.d.ts +0 -6
- package/dist/src/components/modals/AwaitingPaymentModal/AwaitingPaymentModal.d.ts +0 -2
- package/dist/src/components/modals/AwaitingPaymentTimeoutModal/AwaitingPaymentTimeoutModal.d.ts +0 -2
- package/dist/src/components/modals/Modal.d.ts +0 -10
- package/dist/src/components/modals/PaymentDetailsModal/PaymentDetailsModal.d.ts +0 -2
- package/dist/src/components/modals/PaymentDetailsModal/hooks/useTimer.d.ts +0 -7
- package/dist/src/components/modals/PaymentOptionsModal/PaymentOptionsModal.d.ts +0 -2
- package/dist/src/components/modals/PaymentOptionsModal/RadioButton.d.ts +0 -11
- package/dist/src/components/modals/PaymentOptionsModal/paymentOptionsMap.d.ts +0 -5
- package/dist/src/components/modals/SuccessModal/SuccessModal.d.ts +0 -2
- package/dist/src/components/modals/state/actions/data.d.ts +0 -10
- package/dist/src/components/modals/state/actions/index.d.ts +0 -5
- package/dist/src/components/modals/state/actions/modal.d.ts +0 -5
- package/dist/src/components/modals/state/actions/payment.d.ts +0 -7
- package/dist/src/components/modals/state/constants/actionTypes.d.ts +0 -24
- package/dist/src/components/modals/state/constants/index.d.ts +0 -2
- package/dist/src/components/modals/state/constants/initialState.d.ts +0 -36
- package/dist/src/components/modals/state/reducers/data.d.ts +0 -2
- package/dist/src/components/modals/state/reducers/index.d.ts +0 -2
- package/dist/src/components/modals/state/reducers/modal.d.ts +0 -2
- package/dist/src/components/modals/state/reducers/payment.d.ts +0 -2
- package/dist/src/components/modals/state/types/common.d.ts +0 -12
- package/dist/src/components/modals/state/types/data.d.ts +0 -34
- package/dist/src/components/modals/state/types/index.d.ts +0 -8
- package/dist/src/components/modals/state/types/modal.d.ts +0 -12
- package/dist/src/components/modals/state/types/payment.d.ts +0 -14
- package/dist/src/components/modals/state/utils/index.d.ts +0 -37
- package/dist/src/context/ModalProvider.d.ts +0 -4
- package/dist/src/context/PaymentInfoContext.d.ts +0 -26
- package/dist/src/context/PaymentWidgetContext.d.ts +0 -13
- package/dist/src/context/modal.d.ts +0 -4
- package/dist/src/context/types.d.ts +0 -28
- package/dist/src/hooks/types.d.ts +0 -34
- package/dist/src/hooks/useModalControl.d.ts +0 -27
- package/dist/src/hooks/usePaymentAPI.d.ts +0 -10
- package/dist/src/hooks/useShortPolling.d.ts +0 -4
- package/dist/src/index.d.ts +0 -2
- package/dist/src/services/config/endpoints.d.ts +0 -9
- package/dist/src/services/config/error.d.ts +0 -5
- package/dist/src/services/index.d.ts +0 -27
- package/dist/src/services/payments/index.d.ts +0 -4
- package/dist/src/services/payments/types.d.ts +0 -68
- package/dist/src/services/products/index.d.ts +0 -1
- package/dist/src/services/products/types.d.ts +0 -124
- package/dist/src/services/store/index.d.ts +0 -2
- package/dist/src/services/store/types.d.ts +0 -57
- package/dist/src/services/utils/widgetConfig.d.ts +0 -20
- package/dist/src/svg_components/ArrowLeftIcon.d.ts +0 -3
- package/dist/src/svg_components/BankTransferIcon.d.ts +0 -2
- package/dist/src/svg_components/CancelIcon.d.ts +0 -7
- package/dist/src/svg_components/CardIcon.d.ts +0 -2
- package/dist/src/svg_components/CloseIcon.d.ts +0 -3
- package/dist/src/svg_components/CopyIcon.d.ts +0 -2
- package/dist/src/svg_components/EyeCloseIcon.d.ts +0 -5
- package/dist/src/svg_components/EyeOpenIcon.d.ts +0 -5
- package/dist/src/svg_components/SloudIcon.d.ts +0 -2
- package/dist/src/utils/enums/AxiosErrorCodes.d.ts +0 -7
- package/dist/src/utils/enums/AxiosMethods.d.ts +0 -7
- package/dist/src/utils/helpers/classNames.d.ts +0 -7
- package/dist/src/utils/helpers/formatCurrency.d.ts +0 -10
- package/dist/src/utils/helpers/phoneDefaults.d.ts +0 -3
- package/dist/src/utils/helpers/validatePhone.d.ts +0 -7
- package/dist/src/utils/image_utils/index.d.ts +0 -9
- package/dist/src/utils/storage/index.d.ts +0 -9
- package/dist/src/widget.d.ts +0 -27
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,138 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Common fields shared across all payment types
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Data passed to the onSuccess callback after a successful payment
|
|
6
|
+
*/
|
|
7
|
+
interface PaymentSuccessData {
|
|
8
|
+
reference: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
currency: string;
|
|
11
|
+
}
|
|
12
|
+
interface BasePaymentWidgetOptions {
|
|
2
13
|
public_key: string;
|
|
3
14
|
isLocalEnv?: boolean;
|
|
4
|
-
|
|
15
|
+
transaction_id?: string;
|
|
16
|
+
customer_id?: string;
|
|
17
|
+
business_id?: string;
|
|
18
|
+
/** Called when a payment completes successfully */
|
|
19
|
+
onSuccess?: (data: PaymentSuccessData) => void;
|
|
20
|
+
}
|
|
21
|
+
interface Customer {
|
|
5
22
|
first_name: string;
|
|
6
23
|
last_name: string;
|
|
7
24
|
phone_number: string;
|
|
8
25
|
email: string;
|
|
9
26
|
}
|
|
27
|
+
interface DeliveryDetails {
|
|
28
|
+
street: string;
|
|
29
|
+
city: string;
|
|
30
|
+
state: string;
|
|
31
|
+
country: string;
|
|
32
|
+
note?: string;
|
|
33
|
+
}
|
|
34
|
+
interface Product {
|
|
35
|
+
product_id: string;
|
|
36
|
+
quantity: number;
|
|
37
|
+
variation?: string[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* String literal types for payment modes
|
|
41
|
+
* These provide better IntelliSense suggestions
|
|
42
|
+
*/
|
|
43
|
+
type PaymentType = "external" | "storefront" | "sloudfront";
|
|
44
|
+
/**
|
|
45
|
+
* String literal types for channel options
|
|
46
|
+
* These provide better IntelliSense suggestions
|
|
47
|
+
*/
|
|
48
|
+
type ChannelType = "pickup" | "delivery";
|
|
49
|
+
/**
|
|
50
|
+
* Enum for backward compatibility and convenience
|
|
51
|
+
* Use either string literals or enum values
|
|
52
|
+
*/
|
|
53
|
+
declare enum ModeType {
|
|
54
|
+
Storefront = "storefront",
|
|
55
|
+
External = "external",
|
|
56
|
+
Sloudfront = "sloudfront"
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Options for external payment type
|
|
60
|
+
* Used for simple payments with customer details
|
|
61
|
+
*/
|
|
62
|
+
interface ExternalPaymentWidgetOptions extends BasePaymentWidgetOptions {
|
|
63
|
+
type: "external";
|
|
64
|
+
amount: number;
|
|
65
|
+
customer: Customer;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Base options for storefront payment type (shared fields)
|
|
69
|
+
*/
|
|
70
|
+
interface BaseStorefrontPaymentWidgetOptions extends BasePaymentWidgetOptions {
|
|
71
|
+
type: "storefront";
|
|
72
|
+
slug: string;
|
|
73
|
+
amount: number;
|
|
74
|
+
discount?: number;
|
|
75
|
+
customer: Customer;
|
|
76
|
+
products: Product[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Storefront options when channel is 'pickup' - delivery_details is optional
|
|
80
|
+
*/
|
|
81
|
+
interface StorefrontPickupOptions extends BaseStorefrontPaymentWidgetOptions {
|
|
82
|
+
channel: "pickup";
|
|
83
|
+
delivery_details?: DeliveryDetails;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Storefront options when channel is 'delivery' - delivery_details is required
|
|
87
|
+
*/
|
|
88
|
+
interface StorefrontDeliveryOptions extends BaseStorefrontPaymentWidgetOptions {
|
|
89
|
+
channel: "delivery";
|
|
90
|
+
delivery_details: DeliveryDetails;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Options for storefront payment type
|
|
94
|
+
* Used for e-commerce orders with products and delivery
|
|
95
|
+
* delivery_details is required only when channel is 'delivery'
|
|
96
|
+
*/
|
|
97
|
+
type StorefrontPaymentWidgetOptions = StorefrontPickupOptions | StorefrontDeliveryOptions;
|
|
98
|
+
/**
|
|
99
|
+
* Base options for sloudfront payment type (shared fields)
|
|
100
|
+
*/
|
|
101
|
+
interface BaseSloudfrontPaymentWidgetOptions extends BasePaymentWidgetOptions {
|
|
102
|
+
type: "sloudfront";
|
|
103
|
+
amount: number;
|
|
104
|
+
discount?: number;
|
|
105
|
+
customer: Customer;
|
|
106
|
+
products: Product[];
|
|
107
|
+
transaction_id?: string;
|
|
108
|
+
customer_id: string;
|
|
109
|
+
business_id: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Sloudfront options when channel is 'pickup' - delivery_details is optional
|
|
113
|
+
*/
|
|
114
|
+
interface SloudfrontPickupOptions extends BaseSloudfrontPaymentWidgetOptions {
|
|
115
|
+
channel: "pickup";
|
|
116
|
+
delivery_details?: DeliveryDetails;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Sloudfront options when channel is 'delivery' - delivery_details is required
|
|
120
|
+
*/
|
|
121
|
+
interface SloudfrontDeliveryOptions extends BaseSloudfrontPaymentWidgetOptions {
|
|
122
|
+
channel: "delivery";
|
|
123
|
+
delivery_details: DeliveryDetails;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Options for sloudfront payment type
|
|
127
|
+
* delivery_details is required only when channel is 'delivery'
|
|
128
|
+
*/
|
|
129
|
+
type SloudfrontPaymentWidgetOptions = SloudfrontPickupOptions | SloudfrontDeliveryOptions;
|
|
130
|
+
/**
|
|
131
|
+
* Discriminated union of all payment widget option types
|
|
132
|
+
* TypeScript will enforce that the correct fields are provided based on the type
|
|
133
|
+
*/
|
|
134
|
+
type PaymentWidgetOptions = ExternalPaymentWidgetOptions | StorefrontPaymentWidgetOptions | SloudfrontPaymentWidgetOptions;
|
|
135
|
+
|
|
10
136
|
declare class PaymentWidget {
|
|
11
137
|
private options;
|
|
12
138
|
private container;
|
|
@@ -26,4 +152,143 @@ declare class PaymentWidget {
|
|
|
26
152
|
hidePopup(): void;
|
|
27
153
|
}
|
|
28
154
|
|
|
29
|
-
|
|
155
|
+
declare class PaymentWidgetValidationError extends Error {
|
|
156
|
+
constructor(message: string);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Validates payment widget options based on the type
|
|
160
|
+
* @throws {PaymentWidgetValidationError} if validation fails
|
|
161
|
+
*/
|
|
162
|
+
declare function validatePaymentWidgetOptions(options: PaymentWidgetOptions): void;
|
|
163
|
+
|
|
164
|
+
interface IExternalPaymentPayload {
|
|
165
|
+
type: "external";
|
|
166
|
+
amount: number;
|
|
167
|
+
customer: {
|
|
168
|
+
first_name: string;
|
|
169
|
+
last_name: string;
|
|
170
|
+
phone_number: string;
|
|
171
|
+
email: string;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
interface IStorefrontPaymentPayload {
|
|
175
|
+
type: "storefront";
|
|
176
|
+
slug: string;
|
|
177
|
+
order: {
|
|
178
|
+
additional_amount?: number;
|
|
179
|
+
discount?: number;
|
|
180
|
+
items: Array<{
|
|
181
|
+
product_id: string;
|
|
182
|
+
quantity: number;
|
|
183
|
+
variation?: string[];
|
|
184
|
+
}>;
|
|
185
|
+
payment_method?: string;
|
|
186
|
+
channel?: string;
|
|
187
|
+
buyer_details: {
|
|
188
|
+
first_name: string;
|
|
189
|
+
last_name: string;
|
|
190
|
+
email: string;
|
|
191
|
+
phone_number: string;
|
|
192
|
+
};
|
|
193
|
+
delivery_details?: {
|
|
194
|
+
street: string;
|
|
195
|
+
city: string;
|
|
196
|
+
state: string;
|
|
197
|
+
country: string;
|
|
198
|
+
note?: string;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
interface ISloudfrontPaymentPayload {
|
|
203
|
+
type: "sloudfront";
|
|
204
|
+
manual_order: {
|
|
205
|
+
additional_amount?: number;
|
|
206
|
+
discount?: number;
|
|
207
|
+
items: Array<{
|
|
208
|
+
product_id: string;
|
|
209
|
+
quantity: number;
|
|
210
|
+
variation?: string[];
|
|
211
|
+
}>;
|
|
212
|
+
payment_method?: string;
|
|
213
|
+
channel?: string;
|
|
214
|
+
buyer_details?: {
|
|
215
|
+
first_name: string;
|
|
216
|
+
last_name: string;
|
|
217
|
+
email: string;
|
|
218
|
+
phone_number: string;
|
|
219
|
+
};
|
|
220
|
+
delivery_details?: {
|
|
221
|
+
street: string;
|
|
222
|
+
city: string;
|
|
223
|
+
state: string;
|
|
224
|
+
country: string;
|
|
225
|
+
note?: string;
|
|
226
|
+
};
|
|
227
|
+
transaction_id?: string;
|
|
228
|
+
customer_id: string;
|
|
229
|
+
business_id: string;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
type IGeneratePaymentInstrumentPayload = IExternalPaymentPayload | IStorefrontPaymentPayload | ISloudfrontPaymentPayload;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Base interface for payload builders
|
|
236
|
+
*/
|
|
237
|
+
interface PayloadBuilder<T extends IGeneratePaymentInstrumentPayload> {
|
|
238
|
+
build(options: PaymentWidgetOptions, payment_method?: string): T;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Factory function to build payment instrument payload based on options type
|
|
242
|
+
*
|
|
243
|
+
* @param options - Payment widget options
|
|
244
|
+
* @returns Constructed payload for the payment instrument API
|
|
245
|
+
* @throws Error if the payment type is not supported
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* // External payment
|
|
249
|
+
* const payload = buildPaymentInstrumentPayload({
|
|
250
|
+
* type: "external",
|
|
251
|
+
* amount: 25000,
|
|
252
|
+
* // ... other options
|
|
253
|
+
* });
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* // Storefront payment
|
|
257
|
+
* const payload = buildPaymentInstrumentPayload({
|
|
258
|
+
* type: "storefront",
|
|
259
|
+
* slug: "my-store",
|
|
260
|
+
* products: [...],
|
|
261
|
+
* // ... other options
|
|
262
|
+
* });
|
|
263
|
+
*/
|
|
264
|
+
declare function buildPaymentInstrumentPayload(options: PaymentWidgetOptions, payment_method?: string): IGeneratePaymentInstrumentPayload;
|
|
265
|
+
/**
|
|
266
|
+
* Register a new payload builder for a custom payment type
|
|
267
|
+
* This allows for extending the system with new payment types without modifying existing code
|
|
268
|
+
*
|
|
269
|
+
* @param type - The payment type identifier
|
|
270
|
+
* @param builder - The payload builder instance
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* class SubscriptionPaymentPayloadBuilder implements PayloadBuilder<ISubscriptionPaymentPayload> {
|
|
274
|
+
* build(options: PaymentWidgetOptions): ISubscriptionPaymentPayload {
|
|
275
|
+
* return {
|
|
276
|
+
* type: "subscription",
|
|
277
|
+
* plan_id: options.plan_id,
|
|
278
|
+
* // ... other fields
|
|
279
|
+
* };
|
|
280
|
+
* }
|
|
281
|
+
* }
|
|
282
|
+
*
|
|
283
|
+
* registerPayloadBuilder("subscription", new SubscriptionPaymentPayloadBuilder());
|
|
284
|
+
*/
|
|
285
|
+
declare function registerPayloadBuilder(type: string, builder: PayloadBuilder<IGeneratePaymentInstrumentPayload>): void;
|
|
286
|
+
/**
|
|
287
|
+
* Get all registered payment types
|
|
288
|
+
*
|
|
289
|
+
* @returns Array of registered payment type identifiers
|
|
290
|
+
*/
|
|
291
|
+
declare function getRegisteredPaymentTypes(): string[];
|
|
292
|
+
|
|
293
|
+
export { ModeType, PaymentWidgetValidationError, buildPaymentInstrumentPayload, PaymentWidget as default, getRegisteredPaymentTypes, registerPayloadBuilder, validatePaymentWidgetOptions };
|
|
294
|
+
export type { ChannelType, ExternalPaymentWidgetOptions, PaymentSuccessData, PaymentType, PaymentWidgetOptions, SloudfrontPaymentWidgetOptions, StorefrontPaymentWidgetOptions };
|