@gopaycz/gopay-js-sdk 1.6.6

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,303 @@
1
+ import { CoreConfig, AwaitChargeOptions as AwaitChargeOptions$1 } from '@gopay-internal/core';
2
+ export { BrowserData, GoPayEnvironment, GoPayErrorCode, GoPayErrorCodes, GoPayHTTPError, GoPaySDKError } from '@gopay-internal/core';
3
+ import * as _gopay_internal_core_types_generated_js from '@gopay-internal/core/types/generated.js';
4
+ import { components } from '@gopay-internal/core/types/generated.js';
5
+
6
+ /** Server SDK configuration. All fields are optional. */
7
+ type GoPayConfig = CoreConfig;
8
+
9
+ /**
10
+ * Create a GoPay server-side SDK instance.
11
+ *
12
+ * ESM / CommonJS:
13
+ * ```ts
14
+ * import { createGoPaySDK } from '@gopaycz/gopay-js-sdk';
15
+ * const sdk = createGoPaySDK({ environment: 'sandbox' });
16
+ * await sdk.authenticate({ grant_type: 'client_credentials', client_id: '...', client_secret: '...', scope: '...' });
17
+ * ```
18
+ */
19
+ declare function createGoPaySDK(config?: GoPayConfig): {
20
+ createPaymentLink(goid: string, params: {
21
+ payment: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-From-Link-Request"];
22
+ expires_at?: string;
23
+ reusable: boolean;
24
+ }): Promise<{
25
+ expires_at?: string;
26
+ reusable: boolean;
27
+ id: string;
28
+ url: string;
29
+ active: boolean;
30
+ payment?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-From-Link-Request"];
31
+ stop_reason?: "FROM_API" | "ALREADY_PAID" | "EXPIRED";
32
+ }>;
33
+ linkStatus(linkId: string): Promise<{
34
+ expires_at?: string;
35
+ reusable: boolean;
36
+ id: string;
37
+ url: string;
38
+ active: boolean;
39
+ payment?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-From-Link-Request"];
40
+ stop_reason?: "FROM_API" | "ALREADY_PAID" | "EXPIRED";
41
+ }>;
42
+ disableLink(linkId: string): Promise<void>;
43
+ refundPayment(paymentId: string, params: {
44
+ amount: number;
45
+ }): Promise<{
46
+ id: string;
47
+ state: _gopay_internal_core_types_generated_js.components["schemas"]["Refund-State"];
48
+ amount: number;
49
+ currency: _gopay_internal_core_types_generated_js.components["schemas"]["Currency"];
50
+ created_at: string;
51
+ updated_at?: string;
52
+ }>;
53
+ listRefunds(paymentId: string): Promise<{
54
+ id: string;
55
+ state: _gopay_internal_core_types_generated_js.components["schemas"]["Refund-State"];
56
+ amount: number;
57
+ currency: _gopay_internal_core_types_generated_js.components["schemas"]["Currency"];
58
+ created_at: string;
59
+ updated_at?: string;
60
+ }[]>;
61
+ getRefund(refundId: string): Promise<{
62
+ id: string;
63
+ state: _gopay_internal_core_types_generated_js.components["schemas"]["Refund-State"];
64
+ amount: number;
65
+ currency: _gopay_internal_core_types_generated_js.components["schemas"]["Currency"];
66
+ created_at: string;
67
+ updated_at?: string;
68
+ }>;
69
+ createRecurrence(goid: string, params: {
70
+ type: "AUTO" | "ON_DEMAND";
71
+ schedule?: _gopay_internal_core_types_generated_js.components["schemas"]["Recurrence-Schedule"];
72
+ payment: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Create-Request"];
73
+ }): Promise<{
74
+ type: "AUTO" | "ON_DEMAND";
75
+ schedule?: _gopay_internal_core_types_generated_js.components["schemas"]["Recurrence-Schedule"];
76
+ id: string;
77
+ state?: "NEW" | "REQUESTED" | "STARTED" | "STOPPED";
78
+ stop_reason?: "RECURRENCE_EXPIRED" | "CARD_EXPIRED" | "CANCELLED_VIA_API" | "CANCELLED_VIA_BACKOFFICE" | "CANCELLED_BY_GOPAY" | "UNKNOWN";
79
+ payment: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Details"];
80
+ }>;
81
+ recurrenceStatus(recId: string): Promise<{
82
+ type: "AUTO" | "ON_DEMAND";
83
+ schedule?: _gopay_internal_core_types_generated_js.components["schemas"]["Recurrence-Schedule"];
84
+ id: string;
85
+ state?: "NEW" | "REQUESTED" | "STARTED" | "STOPPED";
86
+ stop_reason?: "RECURRENCE_EXPIRED" | "CARD_EXPIRED" | "CANCELLED_VIA_API" | "CANCELLED_VIA_BACKOFFICE" | "CANCELLED_BY_GOPAY" | "UNKNOWN";
87
+ payment: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Details"];
88
+ }>;
89
+ stopRecurrence(recId: string): Promise<void>;
90
+ startRecurrence(recId: string, params?: {
91
+ amount?: number;
92
+ order_number?: string;
93
+ order_description?: string;
94
+ additional_params?: _gopay_internal_core_types_generated_js.components["schemas"]["Additional-Param"][];
95
+ customer?: _gopay_internal_core_types_generated_js.components["schemas"]["Customer"];
96
+ callback?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Callback"];
97
+ }): Promise<{
98
+ id: string;
99
+ order_number: string;
100
+ state: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-State"];
101
+ amount: number;
102
+ currency: _gopay_internal_core_types_generated_js.components["schemas"]["Currency"];
103
+ customer: _gopay_internal_core_types_generated_js.components["schemas"]["Customer"];
104
+ gw_url: string;
105
+ charge?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Charge-Status-Response"];
106
+ payment_secret: string;
107
+ }>;
108
+ recurrenceNext(recId: string, params?: {
109
+ amount?: number;
110
+ order_number?: string;
111
+ order_description?: string;
112
+ additional_params?: _gopay_internal_core_types_generated_js.components["schemas"]["Additional-Param"][];
113
+ customer?: _gopay_internal_core_types_generated_js.components["schemas"]["Customer"];
114
+ callback?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Callback"];
115
+ }): Promise<{
116
+ id: string;
117
+ order_number: string;
118
+ state: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-State"];
119
+ amount: number;
120
+ currency: _gopay_internal_core_types_generated_js.components["schemas"]["Currency"];
121
+ customer: _gopay_internal_core_types_generated_js.components["schemas"]["Customer"];
122
+ gw_url: string;
123
+ charge?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Charge-Status-Response"];
124
+ payment_secret: string;
125
+ }>;
126
+ getCardDetails(cardId: string): Promise<{
127
+ card_id: string;
128
+ masked_pan: string;
129
+ masked_virtual_pan: string;
130
+ expiration_month: string;
131
+ expiration_year: string;
132
+ scheme: _gopay_internal_core_types_generated_js.components["schemas"]["Card-scheme"];
133
+ corporate: boolean;
134
+ fingerprint: string;
135
+ token: string;
136
+ card_art_url: string;
137
+ brand?: string;
138
+ service_type?: _gopay_internal_core_types_generated_js.components["schemas"]["Card-Service-Type"];
139
+ status?: _gopay_internal_core_types_generated_js.components["schemas"]["Card-Token-Status"];
140
+ }>;
141
+ deleteCard(cardId: string): Promise<void>;
142
+ tokenizeEncryptedCard(payload: string): Promise<{
143
+ card_id: string;
144
+ masked_pan: string;
145
+ masked_virtual_pan: string;
146
+ expiration_month: string;
147
+ expiration_year: string;
148
+ scheme: _gopay_internal_core_types_generated_js.components["schemas"]["Card-scheme"];
149
+ corporate: boolean;
150
+ fingerprint: string;
151
+ token: string;
152
+ card_art_url: string;
153
+ brand?: string;
154
+ service_type?: _gopay_internal_core_types_generated_js.components["schemas"]["Card-Service-Type"];
155
+ status?: _gopay_internal_core_types_generated_js.components["schemas"]["Card-Token-Status"];
156
+ }>;
157
+ getPaymentStatus(paymentId: string): Promise<{
158
+ id: string;
159
+ order_number: string;
160
+ state: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-State"];
161
+ amount: number;
162
+ currency: _gopay_internal_core_types_generated_js.components["schemas"]["Currency"];
163
+ customer: _gopay_internal_core_types_generated_js.components["schemas"]["Customer"];
164
+ gw_url: string;
165
+ charge?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Charge-Status-Response"];
166
+ payment_secret: string;
167
+ }>;
168
+ createPayment(goid: string, params: {
169
+ amount: number;
170
+ currency: _gopay_internal_core_types_generated_js.components["schemas"]["Currency"];
171
+ order_number: string;
172
+ order_description?: string;
173
+ additional_params?: _gopay_internal_core_types_generated_js.components["schemas"]["Additional-Param"][];
174
+ customer: _gopay_internal_core_types_generated_js.components["schemas"]["Customer"];
175
+ callback: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Callback"];
176
+ }): Promise<{
177
+ id: string;
178
+ order_number: string;
179
+ state: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-State"];
180
+ amount: number;
181
+ currency: _gopay_internal_core_types_generated_js.components["schemas"]["Currency"];
182
+ customer: _gopay_internal_core_types_generated_js.components["schemas"]["Customer"];
183
+ gw_url: string;
184
+ charge?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Charge-Status-Response"];
185
+ payment_secret: string;
186
+ }>;
187
+ chargePayment(paymentId: string, params: {
188
+ payment_instrument: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Charge-Data"];
189
+ }): Promise<{
190
+ id: string;
191
+ state: _gopay_internal_core_types_generated_js.components["schemas"]["Charge-State"];
192
+ payment_instrument: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Instrument-Data"];
193
+ return_url: string;
194
+ action?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Charge-Action"];
195
+ }>;
196
+ getChargeState(paymentId: string): Promise<{
197
+ id: string;
198
+ state: _gopay_internal_core_types_generated_js.components["schemas"]["Charge-State"];
199
+ payment_instrument?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Instrument-Data"];
200
+ return_url: string;
201
+ action?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Charge-Action"];
202
+ fail_reason?: string;
203
+ }>;
204
+ getGooglePayInfo(paymentId: string): Promise<{
205
+ environment?: "TEST" | "PRODUCTION";
206
+ paymentDataRequest?: {
207
+ apiVersion?: number;
208
+ apiVersionMinor?: number;
209
+ allowedPaymentMethods?: {
210
+ type?: string;
211
+ parameters?: {
212
+ allowedAuthMethods?: ("PAN_ONLY" | "CRYPTOGRAM_3DS")[];
213
+ allowedCardNetworks?: ("VISA" | "MASTERCARD")[];
214
+ };
215
+ tokenizationSpecification?: {
216
+ type?: string;
217
+ parameters?: {
218
+ gateway?: string;
219
+ gatewayMerchantId?: string;
220
+ };
221
+ };
222
+ }[];
223
+ transactionInfo?: {
224
+ currencyCode?: _gopay_internal_core_types_generated_js.components["schemas"]["Currency"];
225
+ countryCode?: string;
226
+ totalPriceStatus?: string;
227
+ totalPrice?: string;
228
+ };
229
+ merchantInfo?: {
230
+ merchantName?: string;
231
+ merchantId?: string;
232
+ };
233
+ emailRequired?: boolean;
234
+ };
235
+ }>;
236
+ getApplePayInfo(paymentId: string): Promise<{
237
+ applepayVersion?: number;
238
+ merchantIdentifier?: string;
239
+ applePayPaymentRequest?: {
240
+ merchantCapabilities?: string[];
241
+ supportedNetworks?: ("maestro" | "masterCard" | "electron" | "visa" | "vPay")[];
242
+ countryCode?: string;
243
+ currencyCode?: _gopay_internal_core_types_generated_js.components["schemas"]["Currency"];
244
+ requiredBillingContactFields?: string[];
245
+ requiredShippingContactFields?: string[];
246
+ applicationData?: string;
247
+ total?: {
248
+ label?: string;
249
+ amount?: string;
250
+ type?: string;
251
+ };
252
+ };
253
+ }>;
254
+ startApplePaySession(paymentId: string, session: {
255
+ onvalidatemerchant: ((event: unknown) => void) | null;
256
+ oncancel: ((event: unknown) => void) | null;
257
+ completeMerchantValidation(merchantSession: unknown): void;
258
+ abort(): void;
259
+ begin(): void;
260
+ }, origin?: string, callbacks?: {
261
+ oncancel?: (event: unknown) => void;
262
+ }): void;
263
+ getQRPaymentInfo(paymentId: string, format?: "png" | "svg"): Promise<{
264
+ amount: number;
265
+ currency: _gopay_internal_core_types_generated_js.components["schemas"]["Currency"];
266
+ recipient: _gopay_internal_core_types_generated_js.components["schemas"]["Bank-Transfer-Recipient"];
267
+ qr_code: _gopay_internal_core_types_generated_js.components["schemas"]["QR-Code-List"];
268
+ }>;
269
+ awaitChargeState(paymentId: string, options?: AwaitChargeOptions): Promise<{
270
+ id: string;
271
+ state: _gopay_internal_core_types_generated_js.components["schemas"]["Charge-State"];
272
+ payment_instrument?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Instrument-Data"];
273
+ return_url: string;
274
+ action?: _gopay_internal_core_types_generated_js.components["schemas"]["Payment-Charge-Action"];
275
+ fail_reason?: string;
276
+ }>;
277
+ authenticate(params: AuthenticateRequest): Promise<void>;
278
+ isAuthenticated(): boolean;
279
+ logout(): void;
280
+ setShareableKey(key: string): void;
281
+ getBrowserKeys(): {
282
+ shareable_key: string;
283
+ client_id: string;
284
+ };
285
+ version: string;
286
+ };
287
+ type GoPaySDK = ReturnType<typeof createGoPaySDK>;
288
+
289
+ type PaymentChargeStatusResponse = components['schemas']['Payment-Charge-Status-Response'];
290
+ /** Options for {@link awaitChargeState}. */
291
+ type AwaitChargeOptions = AwaitChargeOptions$1<PaymentChargeStatusResponse>;
292
+
293
+ interface ClientCredentialsRequest {
294
+ grant_type: 'client_credentials';
295
+ client_id: string;
296
+ client_secret: string;
297
+ scope: string;
298
+ }
299
+ type AuthenticateRequest = ClientCredentialsRequest;
300
+
301
+ declare const SDK_VERSION: string;
302
+
303
+ export { type AuthenticateRequest, type AwaitChargeOptions, type ClientCredentialsRequest, type GoPayConfig, type GoPaySDK, SDK_VERSION, createGoPaySDK };