@wix/payments 1.0.1 → 1.0.3

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,785 @@
1
+ /**
2
+ * A refund a record of an attempt of
3
+ * returning funds for a charge from a merchant to a customer to who has made a purchase.
4
+ * Read more about refunds in this [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction>).
5
+ */
6
+ interface Refund$1 {
7
+ /**
8
+ * Refund ID.
9
+ * @readonly
10
+ */
11
+ id?: string | null;
12
+ /**
13
+ * Revision number, which increments by 1 each time the refund is updated.
14
+ *
15
+ * Ignored when creating a refund.
16
+ * @readonly
17
+ */
18
+ revision?: string | null;
19
+ /**
20
+ * Date and time the refund was created.
21
+ * @readonly
22
+ */
23
+ createdDate?: Date;
24
+ /**
25
+ * Date and time the refund was last updated.
26
+ * @readonly
27
+ */
28
+ updatedDate?: Date;
29
+ /** Data Extensions */
30
+ extendedFields?: ExtendedFields$1;
31
+ /** ID of charge for which the funds are returned by this refund. */
32
+ chargeId?: string | null;
33
+ /** Currency of refund, should be the same as currency of charge. */
34
+ currency?: string | null;
35
+ /**
36
+ * Amount of refund in base units, what's returned to the customer.
37
+ * E.g. "12.95".
38
+ */
39
+ amount?: string | null;
40
+ /**
41
+ * Application fee returned to merchant from Wix.
42
+ * In base units, e.g. "12.95".
43
+ * Not present when no application fee was returned.
44
+ * @readonly
45
+ */
46
+ returnedApplicationFee?: string | null;
47
+ /**
48
+ * Processing fee returned to merchant from provider.
49
+ * In base units, e.g. "12.95".
50
+ * Applicable only to Wix Payments provider.
51
+ * Not present when no processing fee was returned.
52
+ * @readonly
53
+ */
54
+ returnedProcessingFee?: string | null;
55
+ /**
56
+ * True when refund returns all funds for a charge.
57
+ * @readonly
58
+ */
59
+ full?: boolean | null;
60
+ /**
61
+ * Status of the refund.
62
+ * Read more about statuses in this [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#lifecycle-of-a-refund>).
63
+ * @readonly
64
+ */
65
+ status?: Status$1;
66
+ /**
67
+ * ID of the refund on the PSP side.
68
+ * @readonly
69
+ */
70
+ providerRefundId?: string | null;
71
+ /** Reason why this refund was issued. */
72
+ reason?: string | null;
73
+ /**
74
+ * Details about refund status.
75
+ * Mostly used with statuses `FAILED` and `REVERSED`.
76
+ * @readonly
77
+ */
78
+ statusInfo?: StatusInfo$1;
79
+ /**
80
+ * Acquirer Reference Number.
81
+ * @readonly
82
+ */
83
+ acquirerReferenceNumber?: string | null;
84
+ /** Optional free-text note about this refund. */
85
+ note?: string | null;
86
+ }
87
+ interface ExtendedFields$1 {
88
+ /**
89
+ * Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
90
+ * The value of each key is structured according to the schema defined when the extended fields were configured.
91
+ *
92
+ * You can only access fields for which you have the appropriate permissions.
93
+ *
94
+ * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
95
+ */
96
+ namespaces?: Record<string, Record<string, any>>;
97
+ }
98
+ declare enum Status$1 {
99
+ UNKNOWN_STATUS = "UNKNOWN_STATUS",
100
+ /**
101
+ * Initial status for all refunds.
102
+ * Provisional, refund should be in this status for less than a minute.
103
+ */
104
+ STARTING = "STARTING",
105
+ /** Status right after STARTED for asynchronous refunds. */
106
+ PENDING = "PENDING",
107
+ /**
108
+ * Refund was successful.
109
+ * Can transition to REVERSED in corner cases.
110
+ */
111
+ SUCCEEDED = "SUCCEEDED",
112
+ /** Regular error, terminal status. */
113
+ FAILED = "FAILED",
114
+ /**
115
+ * Either refund reversal
116
+ * or any other error that comes after success, terminal status.
117
+ */
118
+ REVERSED = "REVERSED"
119
+ }
120
+ declare enum Initiator {
121
+ UNKNOWN_INITIATOR = "UNKNOWN_INITIATOR",
122
+ WIX = "WIX",
123
+ API = "API",
124
+ PROVIDER = "PROVIDER"
125
+ }
126
+ interface StatusInfo$1 {
127
+ /**
128
+ * Reason code.
129
+ * [Read more about reason codes.](https://dev.wix.com/docs/rest/api-reference/payment-provider-spi/reason-codes)
130
+ */
131
+ code?: string;
132
+ /** Free-text description. */
133
+ description?: string | null;
134
+ }
135
+ interface CreateRefundRequest$1 {
136
+ /** Refund to be created. */
137
+ refund: Refund$1;
138
+ /**
139
+ * Optional parameter used to prevent unintended refunds.
140
+ * Used to check previously refunded amount according to the client
141
+ * against the amount from server perspective.
142
+ * If they don't match, error with code `PREVIOUSLY_REFUNDED_AMOUNT_MISMATCH` is returned.
143
+ *
144
+ * Read more about preventing unintended refunds in this
145
+ * [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#preventing-unintended-refunds>).
146
+ */
147
+ previouslyRefundedAmount?: string | null;
148
+ }
149
+ interface CreateRefundResponse$1 {
150
+ /** The created refund. */
151
+ refund?: Refund$1;
152
+ }
153
+ interface GetRefundRequest$1 {
154
+ /** ID of the refund to retrieve. */
155
+ refundId: string;
156
+ }
157
+ interface GetRefundResponse$1 {
158
+ /** The requested refund. */
159
+ refund?: Refund$1;
160
+ }
161
+ interface QueryRefundsRequest$1 {
162
+ /** WQL expression. */
163
+ query?: CursorQuery$1;
164
+ }
165
+ interface CursorQuery$1 extends CursorQueryPagingMethodOneOf$1 {
166
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
167
+ cursorPaging?: CursorPaging$1;
168
+ /**
169
+ * Filter object in the following format:
170
+ * `"filter" : {
171
+ * "fieldName1": "value1",
172
+ * "fieldName2":{"$operator":"value2"}
173
+ * }`
174
+ * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
175
+ */
176
+ filter?: Record<string, any> | null;
177
+ /**
178
+ * Sort object in the following format:
179
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
180
+ */
181
+ sort?: Sorting$1[];
182
+ }
183
+ /** @oneof */
184
+ interface CursorQueryPagingMethodOneOf$1 {
185
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
186
+ cursorPaging?: CursorPaging$1;
187
+ }
188
+ interface Sorting$1 {
189
+ /** Name of the field to sort by. */
190
+ fieldName?: string;
191
+ /** Sort order. */
192
+ order?: SortOrder$1;
193
+ }
194
+ declare enum SortOrder$1 {
195
+ ASC = "ASC",
196
+ DESC = "DESC"
197
+ }
198
+ interface CursorPaging$1 {
199
+ /** Number of items to load. */
200
+ limit?: number | null;
201
+ /**
202
+ * Pointer to the next or previous page in the list of results.
203
+ *
204
+ * You can get the relevant cursor token
205
+ * from the `pagingMetadata` object in the previous call's response.
206
+ * Not relevant for the first request.
207
+ */
208
+ cursor?: string | null;
209
+ }
210
+ interface QueryRefundsResponse$1 {
211
+ /** List of refunds. */
212
+ refunds?: Refund$1[];
213
+ /** Paging metadata */
214
+ pagingMetadata?: CursorPagingMetadata$1;
215
+ }
216
+ interface CursorPagingMetadata$1 {
217
+ /** Number of items returned in the response. */
218
+ count?: number | null;
219
+ /** Offset that was requested. */
220
+ cursors?: Cursors$1;
221
+ /**
222
+ * Indicates if there are more results after the current page.
223
+ * If `true`, another page of results can be retrieved.
224
+ * If `false`, this is the last page.
225
+ */
226
+ hasNext?: boolean | null;
227
+ }
228
+ interface Cursors$1 {
229
+ /** Cursor pointing to next page in the list of results. */
230
+ next?: string | null;
231
+ /** Cursor pointing to previous page in the list of results. */
232
+ prev?: string | null;
233
+ }
234
+ interface UpdateExtendedFieldsRequest$1 {
235
+ /** ID of the entity to update. */
236
+ id: string;
237
+ /** Identifier for the app whose extended fields are being updated. */
238
+ namespace: string;
239
+ /** Data to update. Structured according to the [schema](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields#json-schema-for-extended-fields) defined when the extended fields were configured. */
240
+ namespaceData: Record<string, any> | null;
241
+ }
242
+ interface UpdateExtendedFieldsResponse$1 {
243
+ /** Updated refund. */
244
+ refund?: Refund$1;
245
+ }
246
+ interface GetRefundabilityRequest$1 {
247
+ /** ID of the charge for which refundability will be calculated. */
248
+ chargeId: string;
249
+ }
250
+ interface GetRefundabilityResponse$1 {
251
+ /** Refundability for the charge. */
252
+ refundability?: Refundability$1;
253
+ }
254
+ /**
255
+ * Internal notes:
256
+ *
257
+ * Instead of separate Refundability and PartialRefundability, we provide min and max refund amount.
258
+ * If only full refund is possible, min_refund_amount = max_refund_amount = charge amount.
259
+ */
260
+ interface Refundability$1 extends RefundabilityDetailsOneOf$1 {
261
+ /** When charge is refundable, specifies what amounts are allowed for refund. */
262
+ refundOptions?: RefundOptions$1;
263
+ /** When charge is not refundable, specifies why refund is not allowed. */
264
+ rejection?: Rejection$1;
265
+ /** Whether the caller is allowed to refund the charge. */
266
+ refundable?: boolean;
267
+ /** Currency of the charge. */
268
+ currency?: string | null;
269
+ /**
270
+ * Sum of amounts of `SUCCEEDED` refunds for this charge in base units, e.g. "6.47".
271
+ * Used to prevent unintended refunds, read more in this
272
+ * [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#preventing-unintended-refunds>).
273
+ */
274
+ previouslyRefundedAmount?: string | null;
275
+ }
276
+ /** @oneof */
277
+ interface RefundabilityDetailsOneOf$1 {
278
+ /** When charge is refundable, specifies what amounts are allowed for refund. */
279
+ refundOptions?: RefundOptions$1;
280
+ /** When charge is not refundable, specifies why refund is not allowed. */
281
+ rejection?: Rejection$1;
282
+ }
283
+ interface RefundOptions$1 {
284
+ /** Minimum amount allowed to be refunded in base units, e.g. "0.50". */
285
+ minRefundAmount?: string | null;
286
+ /** Maximum amount allowed to be refunded in base units, e.g. "12.95". */
287
+ maxRefundAmount?: string | null;
288
+ }
289
+ interface Rejection$1 {
290
+ /**
291
+ * Following reasons are possible:
292
+ * - `CHARGE_REFUNDED` — charge is already fully refunded.
293
+ * - `CHARGE_REFUND_IN_PROGRESS` — another refund was initiated for this charge
294
+ * and is waiting for confirmation from the provider.
295
+ * - `CHARGE_DISPUTED` — charge was disputed.
296
+ * - `CHARGE_REFUND_PERIOD_ENDED` — charge is too old to be refunded.
297
+ * - `CHARGE_UNPAID` — charge is unpaid.
298
+ * - `PROVIDER_DOWN` — PSP is temporarily down.
299
+ * - `PROVIDER_NOT_SUPPORTED` — provider doesn't support refunds at the moment,
300
+ * charge is in the wrong state,
301
+ * or we don't have required information for this transaction.
302
+ * - `PAYMENT_METHOD_NOT_SUPPORTED` — payment method of a charge doesn't support refunds.
303
+ * - `MERCHANT_ACCOUNT_NOT_SUPPORTED` — merchant account doesn't support refunds at the moment.
304
+ * - `MERCHANT_BALANCE_INSUFFICIENT` — merchant doesn't have enough balance to issue a refund for this charge.
305
+ * - `NOT_AUTHORIZED` — logged in merchant has no permission to refund this charge.
306
+ */
307
+ reason?: RejectionReason$1;
308
+ }
309
+ declare enum RejectionReason$1 {
310
+ UNKNOWN_REJECTION_REASON = "UNKNOWN_REJECTION_REASON",
311
+ /** Charge is already fully refunded. */
312
+ CHARGE_REFUNDED = "CHARGE_REFUNDED",
313
+ /** Another refund was initiated for this charge and is waiting for confirmation from the provider. */
314
+ CHARGE_REFUND_IN_PROGRESS = "CHARGE_REFUND_IN_PROGRESS",
315
+ /** Charge was disputed. */
316
+ CHARGE_DISPUTED = "CHARGE_DISPUTED",
317
+ /** Charge is too old to be refunded. */
318
+ CHARGE_REFUND_PERIOD_ENDED = "CHARGE_REFUND_PERIOD_ENDED",
319
+ /** Charge is unpaid. */
320
+ CHARGE_UNPAID = "CHARGE_UNPAID",
321
+ /** PSP is temporarily down. */
322
+ PROVIDER_DOWN = "PROVIDER_DOWN",
323
+ /**
324
+ * Provider doesn't support refunds at the moment, transaction in a wrong state or we don't
325
+ * have required information for this transaction.
326
+ */
327
+ PROVIDER_NOT_SUPPORTED = "PROVIDER_NOT_SUPPORTED",
328
+ /** Payment method of a charge doesn't support refunds. */
329
+ PAYMENT_METHOD_NOT_SUPPORTED = "PAYMENT_METHOD_NOT_SUPPORTED",
330
+ /** Merchant account doesn't support refunds at the moment. */
331
+ MERCHANT_ACCOUNT_NOT_SUPPORTED = "MERCHANT_ACCOUNT_NOT_SUPPORTED",
332
+ /** Merchant doesn't have enough balance to issue a refund for this charge. */
333
+ MERCHANT_BALANCE_INSUFFICIENT = "MERCHANT_BALANCE_INSUFFICIENT",
334
+ /** Logged in merchant has no permission to refund this charge. */
335
+ NOT_AUTHORIZED = "NOT_AUTHORIZED"
336
+ }
337
+ interface CreateRefundResponseNonNullableFields$1 {
338
+ refund?: {
339
+ status: Status$1;
340
+ initiator: Initiator;
341
+ statusInfo?: {
342
+ code: string;
343
+ };
344
+ };
345
+ }
346
+ interface GetRefundResponseNonNullableFields$1 {
347
+ refund?: {
348
+ status: Status$1;
349
+ initiator: Initiator;
350
+ statusInfo?: {
351
+ code: string;
352
+ };
353
+ };
354
+ }
355
+ interface QueryRefundsResponseNonNullableFields$1 {
356
+ refunds: {
357
+ status: Status$1;
358
+ initiator: Initiator;
359
+ statusInfo?: {
360
+ code: string;
361
+ };
362
+ }[];
363
+ }
364
+ interface UpdateExtendedFieldsResponseNonNullableFields$1 {
365
+ refund?: {
366
+ status: Status$1;
367
+ initiator: Initiator;
368
+ statusInfo?: {
369
+ code: string;
370
+ };
371
+ };
372
+ }
373
+ interface GetRefundabilityResponseNonNullableFields$1 {
374
+ refundability?: {
375
+ rejection?: {
376
+ reason: RejectionReason$1;
377
+ };
378
+ refundable: boolean;
379
+ };
380
+ }
381
+
382
+ /**
383
+ * A refund a record of an attempt of
384
+ * returning funds for a charge from a merchant to a customer to who has made a purchase.
385
+ * Read more about refunds in this [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction>).
386
+ */
387
+ interface Refund {
388
+ /**
389
+ * Refund ID.
390
+ * @readonly
391
+ */
392
+ _id?: string | null;
393
+ /**
394
+ * Revision number, which increments by 1 each time the refund is updated.
395
+ *
396
+ * Ignored when creating a refund.
397
+ * @readonly
398
+ */
399
+ revision?: string | null;
400
+ /**
401
+ * Date and time the refund was created.
402
+ * @readonly
403
+ */
404
+ _createdDate?: Date;
405
+ /**
406
+ * Date and time the refund was last updated.
407
+ * @readonly
408
+ */
409
+ _updatedDate?: Date;
410
+ /** Data Extensions */
411
+ extendedFields?: ExtendedFields;
412
+ /** ID of charge for which the funds are returned by this refund. */
413
+ chargeId?: string | null;
414
+ /** Currency of refund, should be the same as currency of charge. */
415
+ currency?: string | null;
416
+ /**
417
+ * Amount of refund in base units, what's returned to the customer.
418
+ * E.g. "12.95".
419
+ */
420
+ amount?: string | null;
421
+ /**
422
+ * Application fee returned to merchant from Wix.
423
+ * In base units, e.g. "12.95".
424
+ * Not present when no application fee was returned.
425
+ * @readonly
426
+ */
427
+ returnedApplicationFee?: string | null;
428
+ /**
429
+ * Processing fee returned to merchant from provider.
430
+ * In base units, e.g. "12.95".
431
+ * Applicable only to Wix Payments provider.
432
+ * Not present when no processing fee was returned.
433
+ * @readonly
434
+ */
435
+ returnedProcessingFee?: string | null;
436
+ /**
437
+ * True when refund returns all funds for a charge.
438
+ * @readonly
439
+ */
440
+ full?: boolean | null;
441
+ /**
442
+ * Status of the refund.
443
+ * Read more about statuses in this [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#lifecycle-of-a-refund>).
444
+ * @readonly
445
+ */
446
+ status?: Status;
447
+ /**
448
+ * ID of the refund on the PSP side.
449
+ * @readonly
450
+ */
451
+ providerRefundId?: string | null;
452
+ /** Reason why this refund was issued. */
453
+ reason?: string | null;
454
+ /**
455
+ * Details about refund status.
456
+ * Mostly used with statuses `FAILED` and `REVERSED`.
457
+ * @readonly
458
+ */
459
+ statusInfo?: StatusInfo;
460
+ /**
461
+ * Acquirer Reference Number.
462
+ * @readonly
463
+ */
464
+ acquirerReferenceNumber?: string | null;
465
+ /** Optional free-text note about this refund. */
466
+ note?: string | null;
467
+ }
468
+ interface ExtendedFields {
469
+ /**
470
+ * Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
471
+ * The value of each key is structured according to the schema defined when the extended fields were configured.
472
+ *
473
+ * You can only access fields for which you have the appropriate permissions.
474
+ *
475
+ * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
476
+ */
477
+ namespaces?: Record<string, Record<string, any>>;
478
+ }
479
+ declare enum Status {
480
+ UNKNOWN_STATUS = "UNKNOWN_STATUS",
481
+ /**
482
+ * Initial status for all refunds.
483
+ * Provisional, refund should be in this status for less than a minute.
484
+ */
485
+ STARTING = "STARTING",
486
+ /** Status right after STARTED for asynchronous refunds. */
487
+ PENDING = "PENDING",
488
+ /**
489
+ * Refund was successful.
490
+ * Can transition to REVERSED in corner cases.
491
+ */
492
+ SUCCEEDED = "SUCCEEDED",
493
+ /** Regular error, terminal status. */
494
+ FAILED = "FAILED",
495
+ /**
496
+ * Either refund reversal
497
+ * or any other error that comes after success, terminal status.
498
+ */
499
+ REVERSED = "REVERSED"
500
+ }
501
+ interface StatusInfo {
502
+ /**
503
+ * Reason code.
504
+ * [Read more about reason codes.](https://dev.wix.com/docs/rest/api-reference/payment-provider-spi/reason-codes)
505
+ */
506
+ code?: string;
507
+ /** Free-text description. */
508
+ description?: string | null;
509
+ }
510
+ interface CreateRefundRequest {
511
+ /** Refund to be created. */
512
+ refund: Refund;
513
+ /**
514
+ * Optional parameter used to prevent unintended refunds.
515
+ * Used to check previously refunded amount according to the client
516
+ * against the amount from server perspective.
517
+ * If they don't match, error with code `PREVIOUSLY_REFUNDED_AMOUNT_MISMATCH` is returned.
518
+ *
519
+ * Read more about preventing unintended refunds in this
520
+ * [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#preventing-unintended-refunds>).
521
+ */
522
+ previouslyRefundedAmount?: string | null;
523
+ }
524
+ interface CreateRefundResponse {
525
+ /** The created refund. */
526
+ refund?: Refund;
527
+ }
528
+ interface GetRefundRequest {
529
+ /** ID of the refund to retrieve. */
530
+ refundId: string;
531
+ }
532
+ interface GetRefundResponse {
533
+ /** The requested refund. */
534
+ refund?: Refund;
535
+ }
536
+ interface QueryRefundsRequest {
537
+ /** WQL expression. */
538
+ query?: CursorQuery;
539
+ }
540
+ interface CursorQuery extends CursorQueryPagingMethodOneOf {
541
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
542
+ cursorPaging?: CursorPaging;
543
+ /**
544
+ * Filter object in the following format:
545
+ * `"filter" : {
546
+ * "fieldName1": "value1",
547
+ * "fieldName2":{"$operator":"value2"}
548
+ * }`
549
+ * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
550
+ */
551
+ filter?: Record<string, any> | null;
552
+ /**
553
+ * Sort object in the following format:
554
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
555
+ */
556
+ sort?: Sorting[];
557
+ }
558
+ /** @oneof */
559
+ interface CursorQueryPagingMethodOneOf {
560
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
561
+ cursorPaging?: CursorPaging;
562
+ }
563
+ interface Sorting {
564
+ /** Name of the field to sort by. */
565
+ fieldName?: string;
566
+ /** Sort order. */
567
+ order?: SortOrder;
568
+ }
569
+ declare enum SortOrder {
570
+ ASC = "ASC",
571
+ DESC = "DESC"
572
+ }
573
+ interface CursorPaging {
574
+ /** Number of items to load. */
575
+ limit?: number | null;
576
+ /**
577
+ * Pointer to the next or previous page in the list of results.
578
+ *
579
+ * You can get the relevant cursor token
580
+ * from the `pagingMetadata` object in the previous call's response.
581
+ * Not relevant for the first request.
582
+ */
583
+ cursor?: string | null;
584
+ }
585
+ interface QueryRefundsResponse {
586
+ /** List of refunds. */
587
+ refunds?: Refund[];
588
+ /** Paging metadata */
589
+ pagingMetadata?: CursorPagingMetadata;
590
+ }
591
+ interface CursorPagingMetadata {
592
+ /** Number of items returned in the response. */
593
+ count?: number | null;
594
+ /** Offset that was requested. */
595
+ cursors?: Cursors;
596
+ /**
597
+ * Indicates if there are more results after the current page.
598
+ * If `true`, another page of results can be retrieved.
599
+ * If `false`, this is the last page.
600
+ */
601
+ hasNext?: boolean | null;
602
+ }
603
+ interface Cursors {
604
+ /** Cursor pointing to next page in the list of results. */
605
+ next?: string | null;
606
+ /** Cursor pointing to previous page in the list of results. */
607
+ prev?: string | null;
608
+ }
609
+ interface UpdateExtendedFieldsRequest {
610
+ /** ID of the entity to update. */
611
+ _id: string;
612
+ /** Identifier for the app whose extended fields are being updated. */
613
+ namespace: string;
614
+ /** Data to update. Structured according to the [schema](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields#json-schema-for-extended-fields) defined when the extended fields were configured. */
615
+ namespaceData: Record<string, any> | null;
616
+ }
617
+ interface UpdateExtendedFieldsResponse {
618
+ /** Updated refund. */
619
+ refund?: Refund;
620
+ }
621
+ interface GetRefundabilityRequest {
622
+ /** ID of the charge for which refundability will be calculated. */
623
+ chargeId: string;
624
+ }
625
+ interface GetRefundabilityResponse {
626
+ /** Refundability for the charge. */
627
+ refundability?: Refundability;
628
+ }
629
+ /**
630
+ * Internal notes:
631
+ *
632
+ * Instead of separate Refundability and PartialRefundability, we provide min and max refund amount.
633
+ * If only full refund is possible, min_refund_amount = max_refund_amount = charge amount.
634
+ */
635
+ interface Refundability extends RefundabilityDetailsOneOf {
636
+ /** When charge is refundable, specifies what amounts are allowed for refund. */
637
+ refundOptions?: RefundOptions;
638
+ /** When charge is not refundable, specifies why refund is not allowed. */
639
+ rejection?: Rejection;
640
+ /** Whether the caller is allowed to refund the charge. */
641
+ refundable?: boolean;
642
+ /** Currency of the charge. */
643
+ currency?: string | null;
644
+ /**
645
+ * Sum of amounts of `SUCCEEDED` refunds for this charge in base units, e.g. "6.47".
646
+ * Used to prevent unintended refunds, read more in this
647
+ * [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#preventing-unintended-refunds>).
648
+ */
649
+ previouslyRefundedAmount?: string | null;
650
+ }
651
+ /** @oneof */
652
+ interface RefundabilityDetailsOneOf {
653
+ /** When charge is refundable, specifies what amounts are allowed for refund. */
654
+ refundOptions?: RefundOptions;
655
+ /** When charge is not refundable, specifies why refund is not allowed. */
656
+ rejection?: Rejection;
657
+ }
658
+ interface RefundOptions {
659
+ /** Minimum amount allowed to be refunded in base units, e.g. "0.50". */
660
+ minRefundAmount?: string | null;
661
+ /** Maximum amount allowed to be refunded in base units, e.g. "12.95". */
662
+ maxRefundAmount?: string | null;
663
+ }
664
+ interface Rejection {
665
+ /**
666
+ * Following reasons are possible:
667
+ * - `CHARGE_REFUNDED` — charge is already fully refunded.
668
+ * - `CHARGE_REFUND_IN_PROGRESS` — another refund was initiated for this charge
669
+ * and is waiting for confirmation from the provider.
670
+ * - `CHARGE_DISPUTED` — charge was disputed.
671
+ * - `CHARGE_REFUND_PERIOD_ENDED` — charge is too old to be refunded.
672
+ * - `CHARGE_UNPAID` — charge is unpaid.
673
+ * - `PROVIDER_DOWN` — PSP is temporarily down.
674
+ * - `PROVIDER_NOT_SUPPORTED` — provider doesn't support refunds at the moment,
675
+ * charge is in the wrong state,
676
+ * or we don't have required information for this transaction.
677
+ * - `PAYMENT_METHOD_NOT_SUPPORTED` — payment method of a charge doesn't support refunds.
678
+ * - `MERCHANT_ACCOUNT_NOT_SUPPORTED` — merchant account doesn't support refunds at the moment.
679
+ * - `MERCHANT_BALANCE_INSUFFICIENT` — merchant doesn't have enough balance to issue a refund for this charge.
680
+ * - `NOT_AUTHORIZED` — logged in merchant has no permission to refund this charge.
681
+ */
682
+ reason?: RejectionReason;
683
+ }
684
+ declare enum RejectionReason {
685
+ UNKNOWN_REJECTION_REASON = "UNKNOWN_REJECTION_REASON",
686
+ /** Charge is already fully refunded. */
687
+ CHARGE_REFUNDED = "CHARGE_REFUNDED",
688
+ /** Another refund was initiated for this charge and is waiting for confirmation from the provider. */
689
+ CHARGE_REFUND_IN_PROGRESS = "CHARGE_REFUND_IN_PROGRESS",
690
+ /** Charge was disputed. */
691
+ CHARGE_DISPUTED = "CHARGE_DISPUTED",
692
+ /** Charge is too old to be refunded. */
693
+ CHARGE_REFUND_PERIOD_ENDED = "CHARGE_REFUND_PERIOD_ENDED",
694
+ /** Charge is unpaid. */
695
+ CHARGE_UNPAID = "CHARGE_UNPAID",
696
+ /** PSP is temporarily down. */
697
+ PROVIDER_DOWN = "PROVIDER_DOWN",
698
+ /**
699
+ * Provider doesn't support refunds at the moment, transaction in a wrong state or we don't
700
+ * have required information for this transaction.
701
+ */
702
+ PROVIDER_NOT_SUPPORTED = "PROVIDER_NOT_SUPPORTED",
703
+ /** Payment method of a charge doesn't support refunds. */
704
+ PAYMENT_METHOD_NOT_SUPPORTED = "PAYMENT_METHOD_NOT_SUPPORTED",
705
+ /** Merchant account doesn't support refunds at the moment. */
706
+ MERCHANT_ACCOUNT_NOT_SUPPORTED = "MERCHANT_ACCOUNT_NOT_SUPPORTED",
707
+ /** Merchant doesn't have enough balance to issue a refund for this charge. */
708
+ MERCHANT_BALANCE_INSUFFICIENT = "MERCHANT_BALANCE_INSUFFICIENT",
709
+ /** Logged in merchant has no permission to refund this charge. */
710
+ NOT_AUTHORIZED = "NOT_AUTHORIZED"
711
+ }
712
+ interface CreateRefundResponseNonNullableFields {
713
+ refund?: {
714
+ status: Status;
715
+ statusInfo?: {
716
+ code: string;
717
+ };
718
+ };
719
+ }
720
+ interface GetRefundResponseNonNullableFields {
721
+ refund?: {
722
+ status: Status;
723
+ statusInfo?: {
724
+ code: string;
725
+ };
726
+ };
727
+ }
728
+ interface QueryRefundsResponseNonNullableFields {
729
+ refunds: {
730
+ status: Status;
731
+ statusInfo?: {
732
+ code: string;
733
+ };
734
+ }[];
735
+ }
736
+ interface UpdateExtendedFieldsResponseNonNullableFields {
737
+ refund?: {
738
+ status: Status;
739
+ statusInfo?: {
740
+ code: string;
741
+ };
742
+ };
743
+ }
744
+ interface GetRefundabilityResponseNonNullableFields {
745
+ refundability?: {
746
+ rejection?: {
747
+ reason: RejectionReason;
748
+ };
749
+ refundable: boolean;
750
+ };
751
+ }
752
+
753
+ type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q = unknown, R = unknown> = {
754
+ getUrl: (context: any) => string;
755
+ httpMethod: K;
756
+ path: string;
757
+ pathParams: M;
758
+ __requestType: T;
759
+ __originalRequestType: S;
760
+ __responseType: Q;
761
+ __originalResponseType: R;
762
+ };
763
+ declare function createRefund(): __PublicMethodMetaInfo<'POST', {}, CreateRefundRequest, CreateRefundRequest$1, CreateRefundResponse & CreateRefundResponseNonNullableFields, CreateRefundResponse$1 & CreateRefundResponseNonNullableFields$1>;
764
+ declare function getRefund(): __PublicMethodMetaInfo<'GET', {
765
+ refundId: string;
766
+ }, GetRefundRequest, GetRefundRequest$1, GetRefundResponse & GetRefundResponseNonNullableFields, GetRefundResponse$1 & GetRefundResponseNonNullableFields$1>;
767
+ declare function queryRefunds(): __PublicMethodMetaInfo<'POST', {}, QueryRefundsRequest, QueryRefundsRequest$1, QueryRefundsResponse & QueryRefundsResponseNonNullableFields, QueryRefundsResponse$1 & QueryRefundsResponseNonNullableFields$1>;
768
+ declare function updateExtendedFields(): __PublicMethodMetaInfo<'POST', {
769
+ id: string;
770
+ }, UpdateExtendedFieldsRequest, UpdateExtendedFieldsRequest$1, UpdateExtendedFieldsResponse & UpdateExtendedFieldsResponseNonNullableFields, UpdateExtendedFieldsResponse$1 & UpdateExtendedFieldsResponseNonNullableFields$1>;
771
+ declare function getRefundability(): __PublicMethodMetaInfo<'GET', {
772
+ chargeId: string;
773
+ }, GetRefundabilityRequest, GetRefundabilityRequest$1, GetRefundabilityResponse & GetRefundabilityResponseNonNullableFields, GetRefundabilityResponse$1 & GetRefundabilityResponseNonNullableFields$1>;
774
+
775
+ type meta___PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q = unknown, R = unknown> = __PublicMethodMetaInfo<K, M, T, S, Q, R>;
776
+ declare const meta_createRefund: typeof createRefund;
777
+ declare const meta_getRefund: typeof getRefund;
778
+ declare const meta_getRefundability: typeof getRefundability;
779
+ declare const meta_queryRefunds: typeof queryRefunds;
780
+ declare const meta_updateExtendedFields: typeof updateExtendedFields;
781
+ declare namespace meta {
782
+ export { type meta___PublicMethodMetaInfo as __PublicMethodMetaInfo, meta_createRefund as createRefund, meta_getRefund as getRefund, meta_getRefundability as getRefundability, meta_queryRefunds as queryRefunds, meta_updateExtendedFields as updateExtendedFields };
783
+ }
784
+
785
+ export { meta as refunds };