@wix/payments 1.0.1 → 1.0.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.
@@ -0,0 +1,746 @@
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 {
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;
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;
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;
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 {
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 {
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 {
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 SyncRefundRequest {
136
+ /** Refund ID. */
137
+ refundId?: string | null;
138
+ /** ID of the refund on the PSP side. */
139
+ providerRefundId?: string | null;
140
+ /** ID of charge for which the funds are returned by this refund. */
141
+ chargeId?: string | null;
142
+ /**
143
+ * Status of the refund.
144
+ * Read more about statuses in this [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#lifecycle-of-a-refund>).
145
+ */
146
+ status?: Status;
147
+ /**
148
+ * Status code.
149
+ * [Read more about reason codes.](https://dev.wix.com/docs/rest/api-reference/payment-provider-spi/reason-codes)
150
+ */
151
+ statusCode?: string | null;
152
+ /** Currency of refund, should be the same as currency of charge. */
153
+ currency?: string | null;
154
+ /**
155
+ * Amount of refund in base units, what's returned to the customer.
156
+ * E.g. "12.95".
157
+ */
158
+ amount?: string | null;
159
+ /**
160
+ * Application fee returned to merchant from Wix.
161
+ * Having this as a separate field since Refund.returned_application_fee is readOnly.
162
+ */
163
+ returnedApplicationFee?: string | null;
164
+ /** Reason why this refund was issued. */
165
+ reason?: string | null;
166
+ /** Optional free-text note about this refund. */
167
+ note?: string | null;
168
+ }
169
+ interface SyncRefundResponse {
170
+ /** Created/updated refund. */
171
+ refund?: Refund;
172
+ }
173
+ interface CreateRefundRequest {
174
+ /** Refund to be created. */
175
+ refund: Refund;
176
+ /**
177
+ * Optional parameter used to prevent unintended refunds.
178
+ * Used to check previously refunded amount according to the client
179
+ * against the amount from server perspective.
180
+ * If they don't match, error with code `PREVIOUSLY_REFUNDED_AMOUNT_MISMATCH` is returned.
181
+ *
182
+ * Read more about preventing unintended refunds in this
183
+ * [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#preventing-unintended-refunds>).
184
+ */
185
+ previouslyRefundedAmount?: string | null;
186
+ }
187
+ interface CreateRefundResponse {
188
+ /** The created refund. */
189
+ refund?: Refund;
190
+ }
191
+ interface GetRefundRequest {
192
+ /** ID of the refund to retrieve. */
193
+ refundId: string;
194
+ }
195
+ interface GetRefundResponse {
196
+ /** The requested refund. */
197
+ refund?: Refund;
198
+ }
199
+ interface QueryRefundsRequest {
200
+ /** WQL expression. */
201
+ query?: CursorQuery;
202
+ }
203
+ interface CursorQuery extends CursorQueryPagingMethodOneOf {
204
+ /** 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`. */
205
+ cursorPaging?: CursorPaging;
206
+ /**
207
+ * Filter object in the following format:
208
+ * `"filter" : {
209
+ * "fieldName1": "value1",
210
+ * "fieldName2":{"$operator":"value2"}
211
+ * }`
212
+ * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
213
+ */
214
+ filter?: Record<string, any> | null;
215
+ /**
216
+ * Sort object in the following format:
217
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
218
+ */
219
+ sort?: Sorting[];
220
+ }
221
+ /** @oneof */
222
+ interface CursorQueryPagingMethodOneOf {
223
+ /** 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`. */
224
+ cursorPaging?: CursorPaging;
225
+ }
226
+ interface Sorting {
227
+ /** Name of the field to sort by. */
228
+ fieldName?: string;
229
+ /** Sort order. */
230
+ order?: SortOrder;
231
+ }
232
+ declare enum SortOrder {
233
+ ASC = "ASC",
234
+ DESC = "DESC"
235
+ }
236
+ interface CursorPaging {
237
+ /** Number of items to load. */
238
+ limit?: number | null;
239
+ /**
240
+ * Pointer to the next or previous page in the list of results.
241
+ *
242
+ * You can get the relevant cursor token
243
+ * from the `pagingMetadata` object in the previous call's response.
244
+ * Not relevant for the first request.
245
+ */
246
+ cursor?: string | null;
247
+ }
248
+ interface QueryRefundsResponse {
249
+ /** List of refunds. */
250
+ refunds?: Refund[];
251
+ /** Paging metadata */
252
+ pagingMetadata?: CursorPagingMetadata;
253
+ }
254
+ interface CursorPagingMetadata {
255
+ /** Number of items returned in the response. */
256
+ count?: number | null;
257
+ /** Offset that was requested. */
258
+ cursors?: Cursors;
259
+ /**
260
+ * Indicates if there are more results after the current page.
261
+ * If `true`, another page of results can be retrieved.
262
+ * If `false`, this is the last page.
263
+ */
264
+ hasNext?: boolean | null;
265
+ }
266
+ interface Cursors {
267
+ /** Cursor pointing to next page in the list of results. */
268
+ next?: string | null;
269
+ /** Cursor pointing to previous page in the list of results. */
270
+ prev?: string | null;
271
+ }
272
+ interface UpdateExtendedFieldsRequest {
273
+ /** ID of the entity to update. */
274
+ _id: string;
275
+ /** Identifier for the app whose extended fields are being updated. */
276
+ namespace: string;
277
+ /** 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. */
278
+ namespaceData: Record<string, any> | null;
279
+ }
280
+ interface UpdateExtendedFieldsResponse {
281
+ /** Updated refund. */
282
+ refund?: Refund;
283
+ }
284
+ interface GetRefundabilityRequest {
285
+ /** ID of the charge for which refundability will be calculated. */
286
+ chargeId: string;
287
+ }
288
+ interface GetRefundabilityResponse {
289
+ /** Refundability for the charge. */
290
+ refundability?: Refundability;
291
+ }
292
+ /**
293
+ * Internal notes:
294
+ *
295
+ * Instead of separate Refundability and PartialRefundability, we provide min and max refund amount.
296
+ * If only full refund is possible, min_refund_amount = max_refund_amount = charge amount.
297
+ */
298
+ interface Refundability extends RefundabilityDetailsOneOf {
299
+ /** When charge is refundable, specifies what amounts are allowed for refund. */
300
+ refundOptions?: RefundOptions;
301
+ /** When charge is not refundable, specifies why refund is not allowed. */
302
+ rejection?: Rejection;
303
+ /** Whether the caller is allowed to refund the charge. */
304
+ refundable?: boolean;
305
+ /** Currency of the charge. */
306
+ currency?: string | null;
307
+ /**
308
+ * Sum of amounts of `SUCCEEDED` refunds for this charge in base units, e.g. "6.47".
309
+ * Used to prevent unintended refunds, read more in this
310
+ * [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#preventing-unintended-refunds>).
311
+ */
312
+ previouslyRefundedAmount?: string | null;
313
+ }
314
+ /** @oneof */
315
+ interface RefundabilityDetailsOneOf {
316
+ /** When charge is refundable, specifies what amounts are allowed for refund. */
317
+ refundOptions?: RefundOptions;
318
+ /** When charge is not refundable, specifies why refund is not allowed. */
319
+ rejection?: Rejection;
320
+ }
321
+ interface RefundOptions {
322
+ /** Minimum amount allowed to be refunded in base units, e.g. "0.50". */
323
+ minRefundAmount?: string | null;
324
+ /** Maximum amount allowed to be refunded in base units, e.g. "12.95". */
325
+ maxRefundAmount?: string | null;
326
+ }
327
+ interface Rejection {
328
+ /**
329
+ * Following reasons are possible:
330
+ * - `CHARGE_REFUNDED` — charge is already fully refunded.
331
+ * - `CHARGE_REFUND_IN_PROGRESS` — another refund was initiated for this charge
332
+ * and is waiting for confirmation from the provider.
333
+ * - `CHARGE_DISPUTED` — charge was disputed.
334
+ * - `CHARGE_REFUND_PERIOD_ENDED` — charge is too old to be refunded.
335
+ * - `CHARGE_UNPAID` — charge is unpaid.
336
+ * - `PROVIDER_DOWN` — PSP is temporarily down.
337
+ * - `PROVIDER_NOT_SUPPORTED` — provider doesn't support refunds at the moment,
338
+ * charge is in the wrong state,
339
+ * or we don't have required information for this transaction.
340
+ * - `PAYMENT_METHOD_NOT_SUPPORTED` — payment method of a charge doesn't support refunds.
341
+ * - `MERCHANT_ACCOUNT_NOT_SUPPORTED` — merchant account doesn't support refunds at the moment.
342
+ * - `MERCHANT_BALANCE_INSUFFICIENT` — merchant doesn't have enough balance to issue a refund for this charge.
343
+ * - `NOT_AUTHORIZED` — logged in merchant has no permission to refund this charge.
344
+ */
345
+ reason?: RejectionReason;
346
+ }
347
+ declare enum RejectionReason {
348
+ UNKNOWN_REJECTION_REASON = "UNKNOWN_REJECTION_REASON",
349
+ /** Charge is already fully refunded. */
350
+ CHARGE_REFUNDED = "CHARGE_REFUNDED",
351
+ /** Another refund was initiated for this charge and is waiting for confirmation from the provider. */
352
+ CHARGE_REFUND_IN_PROGRESS = "CHARGE_REFUND_IN_PROGRESS",
353
+ /** Charge was disputed. */
354
+ CHARGE_DISPUTED = "CHARGE_DISPUTED",
355
+ /** Charge is too old to be refunded. */
356
+ CHARGE_REFUND_PERIOD_ENDED = "CHARGE_REFUND_PERIOD_ENDED",
357
+ /** Charge is unpaid. */
358
+ CHARGE_UNPAID = "CHARGE_UNPAID",
359
+ /** PSP is temporarily down. */
360
+ PROVIDER_DOWN = "PROVIDER_DOWN",
361
+ /**
362
+ * Provider doesn't support refunds at the moment, transaction in a wrong state or we don't
363
+ * have required information for this transaction.
364
+ */
365
+ PROVIDER_NOT_SUPPORTED = "PROVIDER_NOT_SUPPORTED",
366
+ /** Payment method of a charge doesn't support refunds. */
367
+ PAYMENT_METHOD_NOT_SUPPORTED = "PAYMENT_METHOD_NOT_SUPPORTED",
368
+ /** Merchant account doesn't support refunds at the moment. */
369
+ MERCHANT_ACCOUNT_NOT_SUPPORTED = "MERCHANT_ACCOUNT_NOT_SUPPORTED",
370
+ /** Merchant doesn't have enough balance to issue a refund for this charge. */
371
+ MERCHANT_BALANCE_INSUFFICIENT = "MERCHANT_BALANCE_INSUFFICIENT",
372
+ /** Logged in merchant has no permission to refund this charge. */
373
+ NOT_AUTHORIZED = "NOT_AUTHORIZED"
374
+ }
375
+ interface DomainEvent extends DomainEventBodyOneOf {
376
+ createdEvent?: EntityCreatedEvent;
377
+ updatedEvent?: EntityUpdatedEvent;
378
+ deletedEvent?: EntityDeletedEvent;
379
+ actionEvent?: ActionEvent;
380
+ /**
381
+ * Unique event ID.
382
+ * Allows clients to ignore duplicate webhooks.
383
+ */
384
+ _id?: string;
385
+ /**
386
+ * Assumes actions are also always typed to an entity_type
387
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
388
+ */
389
+ entityFqdn?: string;
390
+ /**
391
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
392
+ * This is although the created/updated/deleted notion is duplication of the oneof types
393
+ * Example: created/updated/deleted/started/completed/email_opened
394
+ */
395
+ slug?: string;
396
+ /** ID of the entity associated with the event. */
397
+ entityId?: string;
398
+ /** Event timestamp. */
399
+ eventTime?: Date;
400
+ /**
401
+ * Whether the event was triggered as a result of a privacy regulation application
402
+ * (for example, GDPR).
403
+ */
404
+ triggeredByAnonymizeRequest?: boolean | null;
405
+ /** If present, indicates the action that triggered the event. */
406
+ originatedFrom?: string | null;
407
+ /**
408
+ * A sequence number defining the order of updates to the underlying entity.
409
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
410
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
411
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
412
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
413
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
414
+ */
415
+ entityEventSequence?: string | null;
416
+ }
417
+ /** @oneof */
418
+ interface DomainEventBodyOneOf {
419
+ createdEvent?: EntityCreatedEvent;
420
+ updatedEvent?: EntityUpdatedEvent;
421
+ deletedEvent?: EntityDeletedEvent;
422
+ actionEvent?: ActionEvent;
423
+ }
424
+ interface EntityCreatedEvent {
425
+ entity?: string;
426
+ }
427
+ interface EntityUpdatedEvent {
428
+ /**
429
+ * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
430
+ * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
431
+ * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
432
+ */
433
+ currentEntity?: string;
434
+ }
435
+ interface EntityDeletedEvent {
436
+ /** Entity that was deleted */
437
+ deletedEntity?: string | null;
438
+ }
439
+ interface ActionEvent {
440
+ body?: string;
441
+ }
442
+ interface MessageEnvelope {
443
+ /** App instance ID. */
444
+ instanceId?: string | null;
445
+ /** Event type. */
446
+ eventType?: string;
447
+ /** The identification type and identity data. */
448
+ identity?: IdentificationData;
449
+ /** Stringify payload. */
450
+ data?: string;
451
+ }
452
+ interface IdentificationData extends IdentificationDataIdOneOf {
453
+ /** ID of a site visitor that has not logged in to the site. */
454
+ anonymousVisitorId?: string;
455
+ /** ID of a site visitor that has logged in to the site. */
456
+ memberId?: string;
457
+ /** ID of a Wix user (site owner, contributor, etc.). */
458
+ wixUserId?: string;
459
+ /** ID of an app. */
460
+ appId?: string;
461
+ /** @readonly */
462
+ identityType?: WebhookIdentityType;
463
+ }
464
+ /** @oneof */
465
+ interface IdentificationDataIdOneOf {
466
+ /** ID of a site visitor that has not logged in to the site. */
467
+ anonymousVisitorId?: string;
468
+ /** ID of a site visitor that has logged in to the site. */
469
+ memberId?: string;
470
+ /** ID of a Wix user (site owner, contributor, etc.). */
471
+ wixUserId?: string;
472
+ /** ID of an app. */
473
+ appId?: string;
474
+ }
475
+ declare enum WebhookIdentityType {
476
+ UNKNOWN = "UNKNOWN",
477
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
478
+ MEMBER = "MEMBER",
479
+ WIX_USER = "WIX_USER",
480
+ APP = "APP"
481
+ }
482
+ interface CreateRefundResponseNonNullableFields {
483
+ refund?: {
484
+ status: Status;
485
+ statusInfo?: {
486
+ code: string;
487
+ };
488
+ };
489
+ }
490
+ interface GetRefundResponseNonNullableFields {
491
+ refund?: {
492
+ status: Status;
493
+ statusInfo?: {
494
+ code: string;
495
+ };
496
+ };
497
+ }
498
+ interface QueryRefundsResponseNonNullableFields {
499
+ refunds: {
500
+ status: Status;
501
+ statusInfo?: {
502
+ code: string;
503
+ };
504
+ }[];
505
+ }
506
+ interface UpdateExtendedFieldsResponseNonNullableFields {
507
+ refund?: {
508
+ status: Status;
509
+ statusInfo?: {
510
+ code: string;
511
+ };
512
+ };
513
+ }
514
+ interface GetRefundabilityResponseNonNullableFields {
515
+ refundability?: {
516
+ rejection?: {
517
+ reason: RejectionReason;
518
+ };
519
+ refundable: boolean;
520
+ };
521
+ }
522
+ interface BaseEventMetadata {
523
+ /** App instance ID. */
524
+ instanceId?: string | null;
525
+ /** Event type. */
526
+ eventType?: string;
527
+ /** The identification type and identity data. */
528
+ identity?: IdentificationData;
529
+ }
530
+ interface EventMetadata extends BaseEventMetadata {
531
+ /**
532
+ * Unique event ID.
533
+ * Allows clients to ignore duplicate webhooks.
534
+ */
535
+ _id?: string;
536
+ /**
537
+ * Assumes actions are also always typed to an entity_type
538
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
539
+ */
540
+ entityFqdn?: string;
541
+ /**
542
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
543
+ * This is although the created/updated/deleted notion is duplication of the oneof types
544
+ * Example: created/updated/deleted/started/completed/email_opened
545
+ */
546
+ slug?: string;
547
+ /** ID of the entity associated with the event. */
548
+ entityId?: string;
549
+ /** Event timestamp. */
550
+ eventTime?: Date;
551
+ /**
552
+ * Whether the event was triggered as a result of a privacy regulation application
553
+ * (for example, GDPR).
554
+ */
555
+ triggeredByAnonymizeRequest?: boolean | null;
556
+ /** If present, indicates the action that triggered the event. */
557
+ originatedFrom?: string | null;
558
+ /**
559
+ * A sequence number defining the order of updates to the underlying entity.
560
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
561
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
562
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
563
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
564
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
565
+ */
566
+ entityEventSequence?: string | null;
567
+ }
568
+ interface RefundCreatedEnvelope {
569
+ entity: Refund;
570
+ metadata: EventMetadata;
571
+ }
572
+ interface RefundUpdatedEnvelope {
573
+ entity: Refund;
574
+ metadata: EventMetadata;
575
+ }
576
+ interface CreateRefundOptions {
577
+ /**
578
+ * Optional parameter used to prevent unintended refunds.
579
+ * Used to check previously refunded amount according to the client
580
+ * against the amount from server perspective.
581
+ * If they don't match, error with code `PREVIOUSLY_REFUNDED_AMOUNT_MISMATCH` is returned.
582
+ *
583
+ * Read more about preventing unintended refunds in this
584
+ * [article](<https://dev.wix.com/docs/rest/business-management/payments/refunds/introduction#preventing-unintended-refunds>).
585
+ */
586
+ previouslyRefundedAmount?: string | null;
587
+ }
588
+ interface QueryCursorResult {
589
+ cursors: Cursors;
590
+ hasNext: () => boolean;
591
+ hasPrev: () => boolean;
592
+ length: number;
593
+ pageSize: number;
594
+ }
595
+ interface RefundsQueryResult extends QueryCursorResult {
596
+ items: Refund[];
597
+ query: RefundsQueryBuilder;
598
+ next: () => Promise<RefundsQueryResult>;
599
+ prev: () => Promise<RefundsQueryResult>;
600
+ }
601
+ interface RefundsQueryBuilder {
602
+ /** @param propertyName - Property whose value is compared with `value`.
603
+ * @param value - Value to compare against.
604
+ * @documentationMaturity preview
605
+ */
606
+ eq: (propertyName: 'chargeId', value: any) => RefundsQueryBuilder;
607
+ /** @documentationMaturity preview */
608
+ in: (propertyName: 'chargeId', value: any) => RefundsQueryBuilder;
609
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
610
+ * @documentationMaturity preview
611
+ */
612
+ limit: (limit: number) => RefundsQueryBuilder;
613
+ /** @param cursor - A pointer to specific record
614
+ * @documentationMaturity preview
615
+ */
616
+ skipTo: (cursor: string) => RefundsQueryBuilder;
617
+ /** @documentationMaturity preview */
618
+ find: () => Promise<RefundsQueryResult>;
619
+ }
620
+ interface UpdateExtendedFieldsOptions {
621
+ /** 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. */
622
+ namespaceData: Record<string, any> | null;
623
+ }
624
+
625
+ interface HttpClient {
626
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
627
+ }
628
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
629
+ type HttpResponse<T = any> = {
630
+ data: T;
631
+ status: number;
632
+ statusText: string;
633
+ headers: any;
634
+ request?: any;
635
+ };
636
+ type RequestOptions<_TResponse = any, Data = any> = {
637
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
638
+ url: string;
639
+ data?: Data;
640
+ params?: URLSearchParams;
641
+ } & APIMetadata;
642
+ type APIMetadata = {
643
+ methodFqn?: string;
644
+ entityFqdn?: string;
645
+ packageName?: string;
646
+ };
647
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
648
+ __type: 'event-definition';
649
+ type: Type;
650
+ isDomainEvent?: boolean;
651
+ transformations?: unknown;
652
+ __payload: Payload;
653
+ };
654
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
655
+
656
+ declare const __metadata: {
657
+ PACKAGE_NAME: string;
658
+ };
659
+ declare function createRefund(httpClient: HttpClient): (refund: Refund, options?: CreateRefundOptions) => Promise<Refund & {
660
+ status: Status;
661
+ statusInfo?: {
662
+ code: string;
663
+ } | undefined;
664
+ }>;
665
+ declare function getRefund(httpClient: HttpClient): (refundId: string) => Promise<Refund & {
666
+ status: Status;
667
+ statusInfo?: {
668
+ code: string;
669
+ } | undefined;
670
+ }>;
671
+ declare function queryRefunds(httpClient: HttpClient): () => RefundsQueryBuilder;
672
+ declare function updateExtendedFields(httpClient: HttpClient): (_id: string, namespace: string, options: UpdateExtendedFieldsOptions) => Promise<UpdateExtendedFieldsResponse & UpdateExtendedFieldsResponseNonNullableFields>;
673
+ declare function getRefundability(httpClient: HttpClient): (chargeId: string) => Promise<GetRefundabilityResponse & GetRefundabilityResponseNonNullableFields>;
674
+ declare const onRefundCreated: EventDefinition<RefundCreatedEnvelope, "wix.payments.refunds.v1.refund_created">;
675
+ declare const onRefundUpdated: EventDefinition<RefundUpdatedEnvelope, "wix.payments.refunds.v1.refund_updated">;
676
+
677
+ type index_d_ActionEvent = ActionEvent;
678
+ type index_d_BaseEventMetadata = BaseEventMetadata;
679
+ type index_d_CreateRefundOptions = CreateRefundOptions;
680
+ type index_d_CreateRefundRequest = CreateRefundRequest;
681
+ type index_d_CreateRefundResponse = CreateRefundResponse;
682
+ type index_d_CreateRefundResponseNonNullableFields = CreateRefundResponseNonNullableFields;
683
+ type index_d_CursorPaging = CursorPaging;
684
+ type index_d_CursorPagingMetadata = CursorPagingMetadata;
685
+ type index_d_CursorQuery = CursorQuery;
686
+ type index_d_CursorQueryPagingMethodOneOf = CursorQueryPagingMethodOneOf;
687
+ type index_d_Cursors = Cursors;
688
+ type index_d_DomainEvent = DomainEvent;
689
+ type index_d_DomainEventBodyOneOf = DomainEventBodyOneOf;
690
+ type index_d_EntityCreatedEvent = EntityCreatedEvent;
691
+ type index_d_EntityDeletedEvent = EntityDeletedEvent;
692
+ type index_d_EntityUpdatedEvent = EntityUpdatedEvent;
693
+ type index_d_EventMetadata = EventMetadata;
694
+ type index_d_ExtendedFields = ExtendedFields;
695
+ type index_d_GetRefundRequest = GetRefundRequest;
696
+ type index_d_GetRefundResponse = GetRefundResponse;
697
+ type index_d_GetRefundResponseNonNullableFields = GetRefundResponseNonNullableFields;
698
+ type index_d_GetRefundabilityRequest = GetRefundabilityRequest;
699
+ type index_d_GetRefundabilityResponse = GetRefundabilityResponse;
700
+ type index_d_GetRefundabilityResponseNonNullableFields = GetRefundabilityResponseNonNullableFields;
701
+ type index_d_IdentificationData = IdentificationData;
702
+ type index_d_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
703
+ type index_d_Initiator = Initiator;
704
+ declare const index_d_Initiator: typeof Initiator;
705
+ type index_d_MessageEnvelope = MessageEnvelope;
706
+ type index_d_QueryRefundsRequest = QueryRefundsRequest;
707
+ type index_d_QueryRefundsResponse = QueryRefundsResponse;
708
+ type index_d_QueryRefundsResponseNonNullableFields = QueryRefundsResponseNonNullableFields;
709
+ type index_d_Refund = Refund;
710
+ type index_d_RefundCreatedEnvelope = RefundCreatedEnvelope;
711
+ type index_d_RefundOptions = RefundOptions;
712
+ type index_d_RefundUpdatedEnvelope = RefundUpdatedEnvelope;
713
+ type index_d_Refundability = Refundability;
714
+ type index_d_RefundabilityDetailsOneOf = RefundabilityDetailsOneOf;
715
+ type index_d_RefundsQueryBuilder = RefundsQueryBuilder;
716
+ type index_d_RefundsQueryResult = RefundsQueryResult;
717
+ type index_d_Rejection = Rejection;
718
+ type index_d_RejectionReason = RejectionReason;
719
+ declare const index_d_RejectionReason: typeof RejectionReason;
720
+ type index_d_SortOrder = SortOrder;
721
+ declare const index_d_SortOrder: typeof SortOrder;
722
+ type index_d_Sorting = Sorting;
723
+ type index_d_Status = Status;
724
+ declare const index_d_Status: typeof Status;
725
+ type index_d_StatusInfo = StatusInfo;
726
+ type index_d_SyncRefundRequest = SyncRefundRequest;
727
+ type index_d_SyncRefundResponse = SyncRefundResponse;
728
+ type index_d_UpdateExtendedFieldsOptions = UpdateExtendedFieldsOptions;
729
+ type index_d_UpdateExtendedFieldsRequest = UpdateExtendedFieldsRequest;
730
+ type index_d_UpdateExtendedFieldsResponse = UpdateExtendedFieldsResponse;
731
+ type index_d_UpdateExtendedFieldsResponseNonNullableFields = UpdateExtendedFieldsResponseNonNullableFields;
732
+ type index_d_WebhookIdentityType = WebhookIdentityType;
733
+ declare const index_d_WebhookIdentityType: typeof WebhookIdentityType;
734
+ declare const index_d___metadata: typeof __metadata;
735
+ declare const index_d_createRefund: typeof createRefund;
736
+ declare const index_d_getRefund: typeof getRefund;
737
+ declare const index_d_getRefundability: typeof getRefundability;
738
+ declare const index_d_onRefundCreated: typeof onRefundCreated;
739
+ declare const index_d_onRefundUpdated: typeof onRefundUpdated;
740
+ declare const index_d_queryRefunds: typeof queryRefunds;
741
+ declare const index_d_updateExtendedFields: typeof updateExtendedFields;
742
+ declare namespace index_d {
743
+ export { type index_d_ActionEvent as ActionEvent, type index_d_BaseEventMetadata as BaseEventMetadata, type index_d_CreateRefundOptions as CreateRefundOptions, type index_d_CreateRefundRequest as CreateRefundRequest, type index_d_CreateRefundResponse as CreateRefundResponse, type index_d_CreateRefundResponseNonNullableFields as CreateRefundResponseNonNullableFields, type index_d_CursorPaging as CursorPaging, type index_d_CursorPagingMetadata as CursorPagingMetadata, type index_d_CursorQuery as CursorQuery, type index_d_CursorQueryPagingMethodOneOf as CursorQueryPagingMethodOneOf, type index_d_Cursors as Cursors, type index_d_DomainEvent as DomainEvent, type index_d_DomainEventBodyOneOf as DomainEventBodyOneOf, type index_d_EntityCreatedEvent as EntityCreatedEvent, type index_d_EntityDeletedEvent as EntityDeletedEvent, type index_d_EntityUpdatedEvent as EntityUpdatedEvent, type index_d_EventMetadata as EventMetadata, type index_d_ExtendedFields as ExtendedFields, type index_d_GetRefundRequest as GetRefundRequest, type index_d_GetRefundResponse as GetRefundResponse, type index_d_GetRefundResponseNonNullableFields as GetRefundResponseNonNullableFields, type index_d_GetRefundabilityRequest as GetRefundabilityRequest, type index_d_GetRefundabilityResponse as GetRefundabilityResponse, type index_d_GetRefundabilityResponseNonNullableFields as GetRefundabilityResponseNonNullableFields, type index_d_IdentificationData as IdentificationData, type index_d_IdentificationDataIdOneOf as IdentificationDataIdOneOf, index_d_Initiator as Initiator, type index_d_MessageEnvelope as MessageEnvelope, type index_d_QueryRefundsRequest as QueryRefundsRequest, type index_d_QueryRefundsResponse as QueryRefundsResponse, type index_d_QueryRefundsResponseNonNullableFields as QueryRefundsResponseNonNullableFields, type index_d_Refund as Refund, type index_d_RefundCreatedEnvelope as RefundCreatedEnvelope, type index_d_RefundOptions as RefundOptions, type index_d_RefundUpdatedEnvelope as RefundUpdatedEnvelope, type index_d_Refundability as Refundability, type index_d_RefundabilityDetailsOneOf as RefundabilityDetailsOneOf, type index_d_RefundsQueryBuilder as RefundsQueryBuilder, type index_d_RefundsQueryResult as RefundsQueryResult, type index_d_Rejection as Rejection, index_d_RejectionReason as RejectionReason, index_d_SortOrder as SortOrder, type index_d_Sorting as Sorting, index_d_Status as Status, type index_d_StatusInfo as StatusInfo, type index_d_SyncRefundRequest as SyncRefundRequest, type index_d_SyncRefundResponse as SyncRefundResponse, type index_d_UpdateExtendedFieldsOptions as UpdateExtendedFieldsOptions, type index_d_UpdateExtendedFieldsRequest as UpdateExtendedFieldsRequest, type index_d_UpdateExtendedFieldsResponse as UpdateExtendedFieldsResponse, type index_d_UpdateExtendedFieldsResponseNonNullableFields as UpdateExtendedFieldsResponseNonNullableFields, index_d_WebhookIdentityType as WebhookIdentityType, index_d___metadata as __metadata, index_d_createRefund as createRefund, index_d_getRefund as getRefund, index_d_getRefundability as getRefundability, index_d_onRefundCreated as onRefundCreated, index_d_onRefundUpdated as onRefundUpdated, index_d_queryRefunds as queryRefunds, index_d_updateExtendedFields as updateExtendedFields };
744
+ }
745
+
746
+ export { index_d as refunds };