@wix/payments 1.0.3 → 1.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/payments",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -18,7 +18,7 @@
18
18
  "type-bundles"
19
19
  ],
20
20
  "dependencies": {
21
- "@wix/payments_refunds": "1.0.3"
21
+ "@wix/payments_refunds": "1.0.5"
22
22
  },
23
23
  "devDependencies": {
24
24
  "glob": "^10.4.1",
@@ -42,5 +42,5 @@
42
42
  "fqdn": ""
43
43
  }
44
44
  },
45
- "falconPackageHash": "bb89c54e2fe412112a0ff60b85758c01fb7cbf452226065ad2662f1d"
45
+ "falconPackageHash": "b6855b55b9e54ca91a6b035e430ec1ee043f21b93272451278b3b5de"
46
46
  }
@@ -117,6 +117,12 @@ declare enum Status {
117
117
  */
118
118
  REVERSED = "REVERSED"
119
119
  }
120
+ declare enum Initiator {
121
+ UNKNOWN_INITIATOR = "UNKNOWN_INITIATOR",
122
+ WIX = "WIX",
123
+ API = "API",
124
+ PROVIDER = "PROVIDER"
125
+ }
120
126
  interface StatusInfo {
121
127
  /**
122
128
  * Reason code.
@@ -126,16 +132,159 @@ interface StatusInfo {
126
132
  /** Free-text description. */
127
133
  description?: string | null;
128
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
+ }
129
266
  interface Cursors {
130
267
  /** Cursor pointing to next page in the list of results. */
131
268
  next?: string | null;
132
269
  /** Cursor pointing to previous page in the list of results. */
133
270
  prev?: string | null;
134
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
+ }
135
280
  interface UpdateExtendedFieldsResponse {
136
281
  /** Updated refund. */
137
282
  refund?: Refund;
138
283
  }
284
+ interface GetRefundabilityRequest {
285
+ /** ID of the charge for which refundability will be calculated. */
286
+ chargeId: string;
287
+ }
139
288
  interface GetRefundabilityResponse {
140
289
  /** Refundability for the charge. */
141
290
  refundability?: Refundability;
@@ -223,6 +372,83 @@ declare enum RejectionReason {
223
372
  /** Logged in merchant has no permission to refund this charge. */
224
373
  NOT_AUTHORIZED = "NOT_AUTHORIZED"
225
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
+ }
226
452
  interface IdentificationData extends IdentificationDataIdOneOf {
227
453
  /** ID of a site visitor that has not logged in to the site. */
228
454
  anonymousVisitorId?: string;
@@ -253,21 +479,35 @@ declare enum WebhookIdentityType {
253
479
  WIX_USER = "WIX_USER",
254
480
  APP = "APP"
255
481
  }
482
+ interface StatusInfoNonNullableFields {
483
+ code: string;
484
+ }
485
+ interface RefundNonNullableFields {
486
+ status: Status;
487
+ initiator: Initiator;
488
+ statusInfo?: StatusInfoNonNullableFields;
489
+ }
490
+ interface CreateRefundResponseNonNullableFields {
491
+ refund?: RefundNonNullableFields;
492
+ }
493
+ interface GetRefundResponseNonNullableFields {
494
+ refund?: RefundNonNullableFields;
495
+ }
496
+ interface QueryRefundsResponseNonNullableFields {
497
+ refunds: RefundNonNullableFields[];
498
+ }
256
499
  interface UpdateExtendedFieldsResponseNonNullableFields {
257
- refund?: {
258
- status: Status;
259
- statusInfo?: {
260
- code: string;
261
- };
262
- };
500
+ refund?: RefundNonNullableFields;
501
+ }
502
+ interface RejectionNonNullableFields {
503
+ reason: RejectionReason;
504
+ }
505
+ interface RefundabilityNonNullableFields {
506
+ rejection?: RejectionNonNullableFields;
507
+ refundable: boolean;
263
508
  }
264
509
  interface GetRefundabilityResponseNonNullableFields {
265
- refundability?: {
266
- rejection?: {
267
- reason: RejectionReason;
268
- };
269
- refundable: boolean;
270
- };
510
+ refundability?: RefundabilityNonNullableFields;
271
511
  }
272
512
  interface BaseEventMetadata {
273
513
  /** App instance ID. */
@@ -375,7 +615,8 @@ interface UpdateExtendedFieldsOptions {
375
615
  type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
376
616
  interface HttpClient {
377
617
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
378
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
618
+ fetchWithAuth: typeof fetch;
619
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
379
620
  }
380
621
  type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
381
622
  type HttpResponse<T = any> = {
@@ -415,32 +656,76 @@ declare global {
415
656
  }
416
657
  }
417
658
 
418
- declare function createRefund$1(httpClient: HttpClient): (refund: Refund, options?: CreateRefundOptions) => Promise<Refund & {
419
- status: Status;
420
- statusInfo?: {
421
- code: string;
422
- } | undefined;
423
- }>;
424
- declare function getRefund$1(httpClient: HttpClient): (refundId: string) => Promise<Refund & {
425
- status: Status;
426
- statusInfo?: {
427
- code: string;
428
- } | undefined;
429
- }>;
430
- declare function queryRefunds$1(httpClient: HttpClient): () => RefundsQueryBuilder;
431
- declare function updateExtendedFields$1(httpClient: HttpClient): (_id: string, namespace: string, options: UpdateExtendedFieldsOptions) => Promise<UpdateExtendedFieldsResponse & UpdateExtendedFieldsResponseNonNullableFields>;
432
- declare function getRefundability$1(httpClient: HttpClient): (chargeId: string) => Promise<GetRefundabilityResponse & GetRefundabilityResponseNonNullableFields>;
433
- declare const onRefundCreated$1: EventDefinition<RefundCreatedEnvelope, "wix.payments.refunds.v1.refund_created">;
434
- declare const onRefundUpdated$1: EventDefinition<RefundUpdatedEnvelope, "wix.payments.refunds.v1.refund_updated">;
659
+ declare function createRESTModule<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
660
+
661
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
435
662
 
436
- declare const createRefund: BuildRESTFunction<typeof createRefund$1>;
437
- declare const getRefund: BuildRESTFunction<typeof getRefund$1>;
438
- declare const queryRefunds: BuildRESTFunction<typeof queryRefunds$1>;
439
- declare const updateExtendedFields: BuildRESTFunction<typeof updateExtendedFields$1>;
440
- declare const getRefundability: BuildRESTFunction<typeof getRefundability$1>;
441
- declare const onRefundCreated: BuildEventDefinition<typeof onRefundCreated$1>;
442
- declare const onRefundUpdated: BuildEventDefinition<typeof onRefundUpdated$1>;
663
+ declare const createRefund: ReturnType<typeof createRESTModule<typeof publicCreateRefund>>;
664
+ declare const getRefund: ReturnType<typeof createRESTModule<typeof publicGetRefund>>;
665
+ declare const queryRefunds: ReturnType<typeof createRESTModule<typeof publicQueryRefunds>>;
666
+ declare const updateExtendedFields: ReturnType<typeof createRESTModule<typeof publicUpdateExtendedFields>>;
667
+ declare const getRefundability: ReturnType<typeof createRESTModule<typeof publicGetRefundability>>;
668
+ declare const onRefundCreated: ReturnType<typeof createEventModule<typeof publicOnRefundCreated>>;
669
+ declare const onRefundUpdated: ReturnType<typeof createEventModule<typeof publicOnRefundUpdated>>;
443
670
 
671
+ type context_ActionEvent = ActionEvent;
672
+ type context_BaseEventMetadata = BaseEventMetadata;
673
+ type context_CreateRefundOptions = CreateRefundOptions;
674
+ type context_CreateRefundRequest = CreateRefundRequest;
675
+ type context_CreateRefundResponse = CreateRefundResponse;
676
+ type context_CreateRefundResponseNonNullableFields = CreateRefundResponseNonNullableFields;
677
+ type context_CursorPaging = CursorPaging;
678
+ type context_CursorPagingMetadata = CursorPagingMetadata;
679
+ type context_CursorQuery = CursorQuery;
680
+ type context_CursorQueryPagingMethodOneOf = CursorQueryPagingMethodOneOf;
681
+ type context_Cursors = Cursors;
682
+ type context_DomainEvent = DomainEvent;
683
+ type context_DomainEventBodyOneOf = DomainEventBodyOneOf;
684
+ type context_EntityCreatedEvent = EntityCreatedEvent;
685
+ type context_EntityDeletedEvent = EntityDeletedEvent;
686
+ type context_EntityUpdatedEvent = EntityUpdatedEvent;
687
+ type context_EventMetadata = EventMetadata;
688
+ type context_ExtendedFields = ExtendedFields;
689
+ type context_GetRefundRequest = GetRefundRequest;
690
+ type context_GetRefundResponse = GetRefundResponse;
691
+ type context_GetRefundResponseNonNullableFields = GetRefundResponseNonNullableFields;
692
+ type context_GetRefundabilityRequest = GetRefundabilityRequest;
693
+ type context_GetRefundabilityResponse = GetRefundabilityResponse;
694
+ type context_GetRefundabilityResponseNonNullableFields = GetRefundabilityResponseNonNullableFields;
695
+ type context_IdentificationData = IdentificationData;
696
+ type context_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
697
+ type context_Initiator = Initiator;
698
+ declare const context_Initiator: typeof Initiator;
699
+ type context_MessageEnvelope = MessageEnvelope;
700
+ type context_QueryRefundsRequest = QueryRefundsRequest;
701
+ type context_QueryRefundsResponse = QueryRefundsResponse;
702
+ type context_QueryRefundsResponseNonNullableFields = QueryRefundsResponseNonNullableFields;
703
+ type context_Refund = Refund;
704
+ type context_RefundCreatedEnvelope = RefundCreatedEnvelope;
705
+ type context_RefundNonNullableFields = RefundNonNullableFields;
706
+ type context_RefundOptions = RefundOptions;
707
+ type context_RefundUpdatedEnvelope = RefundUpdatedEnvelope;
708
+ type context_Refundability = Refundability;
709
+ type context_RefundabilityDetailsOneOf = RefundabilityDetailsOneOf;
710
+ type context_RefundsQueryBuilder = RefundsQueryBuilder;
711
+ type context_RefundsQueryResult = RefundsQueryResult;
712
+ type context_Rejection = Rejection;
713
+ type context_RejectionReason = RejectionReason;
714
+ declare const context_RejectionReason: typeof RejectionReason;
715
+ type context_SortOrder = SortOrder;
716
+ declare const context_SortOrder: typeof SortOrder;
717
+ type context_Sorting = Sorting;
718
+ type context_Status = Status;
719
+ declare const context_Status: typeof Status;
720
+ type context_StatusInfo = StatusInfo;
721
+ type context_SyncRefundRequest = SyncRefundRequest;
722
+ type context_SyncRefundResponse = SyncRefundResponse;
723
+ type context_UpdateExtendedFieldsOptions = UpdateExtendedFieldsOptions;
724
+ type context_UpdateExtendedFieldsRequest = UpdateExtendedFieldsRequest;
725
+ type context_UpdateExtendedFieldsResponse = UpdateExtendedFieldsResponse;
726
+ type context_UpdateExtendedFieldsResponseNonNullableFields = UpdateExtendedFieldsResponseNonNullableFields;
727
+ type context_WebhookIdentityType = WebhookIdentityType;
728
+ declare const context_WebhookIdentityType: typeof WebhookIdentityType;
444
729
  declare const context_createRefund: typeof createRefund;
445
730
  declare const context_getRefund: typeof getRefund;
446
731
  declare const context_getRefundability: typeof getRefundability;
@@ -449,7 +734,7 @@ declare const context_onRefundUpdated: typeof onRefundUpdated;
449
734
  declare const context_queryRefunds: typeof queryRefunds;
450
735
  declare const context_updateExtendedFields: typeof updateExtendedFields;
451
736
  declare namespace context {
452
- export { context_createRefund as createRefund, context_getRefund as getRefund, context_getRefundability as getRefundability, context_onRefundCreated as onRefundCreated, context_onRefundUpdated as onRefundUpdated, context_queryRefunds as queryRefunds, context_updateExtendedFields as updateExtendedFields };
737
+ export { type context_ActionEvent as ActionEvent, type context_BaseEventMetadata as BaseEventMetadata, type context_CreateRefundOptions as CreateRefundOptions, type context_CreateRefundRequest as CreateRefundRequest, type context_CreateRefundResponse as CreateRefundResponse, type context_CreateRefundResponseNonNullableFields as CreateRefundResponseNonNullableFields, type context_CursorPaging as CursorPaging, type context_CursorPagingMetadata as CursorPagingMetadata, type context_CursorQuery as CursorQuery, type context_CursorQueryPagingMethodOneOf as CursorQueryPagingMethodOneOf, type context_Cursors as Cursors, type context_DomainEvent as DomainEvent, type context_DomainEventBodyOneOf as DomainEventBodyOneOf, type context_EntityCreatedEvent as EntityCreatedEvent, type context_EntityDeletedEvent as EntityDeletedEvent, type context_EntityUpdatedEvent as EntityUpdatedEvent, type context_EventMetadata as EventMetadata, type context_ExtendedFields as ExtendedFields, type context_GetRefundRequest as GetRefundRequest, type context_GetRefundResponse as GetRefundResponse, type context_GetRefundResponseNonNullableFields as GetRefundResponseNonNullableFields, type context_GetRefundabilityRequest as GetRefundabilityRequest, type context_GetRefundabilityResponse as GetRefundabilityResponse, type context_GetRefundabilityResponseNonNullableFields as GetRefundabilityResponseNonNullableFields, type context_IdentificationData as IdentificationData, type context_IdentificationDataIdOneOf as IdentificationDataIdOneOf, context_Initiator as Initiator, type context_MessageEnvelope as MessageEnvelope, type context_QueryRefundsRequest as QueryRefundsRequest, type context_QueryRefundsResponse as QueryRefundsResponse, type context_QueryRefundsResponseNonNullableFields as QueryRefundsResponseNonNullableFields, type context_Refund as Refund, type context_RefundCreatedEnvelope as RefundCreatedEnvelope, type context_RefundNonNullableFields as RefundNonNullableFields, type context_RefundOptions as RefundOptions, type context_RefundUpdatedEnvelope as RefundUpdatedEnvelope, type context_Refundability as Refundability, type context_RefundabilityDetailsOneOf as RefundabilityDetailsOneOf, type context_RefundsQueryBuilder as RefundsQueryBuilder, type context_RefundsQueryResult as RefundsQueryResult, type context_Rejection as Rejection, context_RejectionReason as RejectionReason, context_SortOrder as SortOrder, type context_Sorting as Sorting, context_Status as Status, type context_StatusInfo as StatusInfo, type context_SyncRefundRequest as SyncRefundRequest, type context_SyncRefundResponse as SyncRefundResponse, type context_UpdateExtendedFieldsOptions as UpdateExtendedFieldsOptions, type context_UpdateExtendedFieldsRequest as UpdateExtendedFieldsRequest, type context_UpdateExtendedFieldsResponse as UpdateExtendedFieldsResponse, type context_UpdateExtendedFieldsResponseNonNullableFields as UpdateExtendedFieldsResponseNonNullableFields, context_WebhookIdentityType as WebhookIdentityType, context_createRefund as createRefund, context_getRefund as getRefund, context_getRefundability as getRefundability, context_onRefundCreated as onRefundCreated, context_onRefundUpdated as onRefundUpdated, context_queryRefunds as queryRefunds, context_updateExtendedFields as updateExtendedFields };
453
738
  }
454
739
 
455
740
  export { context as refunds };
@@ -479,45 +479,35 @@ declare enum WebhookIdentityType {
479
479
  WIX_USER = "WIX_USER",
480
480
  APP = "APP"
481
481
  }
482
+ interface StatusInfoNonNullableFields {
483
+ code: string;
484
+ }
485
+ interface RefundNonNullableFields {
486
+ status: Status;
487
+ initiator: Initiator;
488
+ statusInfo?: StatusInfoNonNullableFields;
489
+ }
482
490
  interface CreateRefundResponseNonNullableFields {
483
- refund?: {
484
- status: Status;
485
- statusInfo?: {
486
- code: string;
487
- };
488
- };
491
+ refund?: RefundNonNullableFields;
489
492
  }
490
493
  interface GetRefundResponseNonNullableFields {
491
- refund?: {
492
- status: Status;
493
- statusInfo?: {
494
- code: string;
495
- };
496
- };
494
+ refund?: RefundNonNullableFields;
497
495
  }
498
496
  interface QueryRefundsResponseNonNullableFields {
499
- refunds: {
500
- status: Status;
501
- statusInfo?: {
502
- code: string;
503
- };
504
- }[];
497
+ refunds: RefundNonNullableFields[];
505
498
  }
506
499
  interface UpdateExtendedFieldsResponseNonNullableFields {
507
- refund?: {
508
- status: Status;
509
- statusInfo?: {
510
- code: string;
511
- };
512
- };
500
+ refund?: RefundNonNullableFields;
501
+ }
502
+ interface RejectionNonNullableFields {
503
+ reason: RejectionReason;
504
+ }
505
+ interface RefundabilityNonNullableFields {
506
+ rejection?: RejectionNonNullableFields;
507
+ refundable: boolean;
513
508
  }
514
509
  interface GetRefundabilityResponseNonNullableFields {
515
- refundability?: {
516
- rejection?: {
517
- reason: RejectionReason;
518
- };
519
- refundable: boolean;
520
- };
510
+ refundability?: RefundabilityNonNullableFields;
521
511
  }
522
512
  interface BaseEventMetadata {
523
513
  /** App instance ID. */
@@ -624,7 +614,8 @@ interface UpdateExtendedFieldsOptions {
624
614
 
625
615
  interface HttpClient {
626
616
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
627
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
617
+ fetchWithAuth: typeof fetch;
618
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
628
619
  }
629
620
  type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
630
621
  type HttpResponse<T = any> = {
@@ -664,18 +655,8 @@ declare global {
664
655
  declare const __metadata: {
665
656
  PACKAGE_NAME: string;
666
657
  };
667
- declare function createRefund(httpClient: HttpClient): (refund: Refund, options?: CreateRefundOptions) => Promise<Refund & {
668
- status: Status;
669
- statusInfo?: {
670
- code: string;
671
- } | undefined;
672
- }>;
673
- declare function getRefund(httpClient: HttpClient): (refundId: string) => Promise<Refund & {
674
- status: Status;
675
- statusInfo?: {
676
- code: string;
677
- } | undefined;
678
- }>;
658
+ declare function createRefund(httpClient: HttpClient): (refund: Refund, options?: CreateRefundOptions) => Promise<Refund & RefundNonNullableFields>;
659
+ declare function getRefund(httpClient: HttpClient): (refundId: string) => Promise<Refund & RefundNonNullableFields>;
679
660
  declare function queryRefunds(httpClient: HttpClient): () => RefundsQueryBuilder;
680
661
  declare function updateExtendedFields(httpClient: HttpClient): (_id: string, namespace: string, options: UpdateExtendedFieldsOptions) => Promise<UpdateExtendedFieldsResponse & UpdateExtendedFieldsResponseNonNullableFields>;
681
662
  declare function getRefundability(httpClient: HttpClient): (chargeId: string) => Promise<GetRefundabilityResponse & GetRefundabilityResponseNonNullableFields>;
@@ -716,6 +697,7 @@ type index_d_QueryRefundsResponse = QueryRefundsResponse;
716
697
  type index_d_QueryRefundsResponseNonNullableFields = QueryRefundsResponseNonNullableFields;
717
698
  type index_d_Refund = Refund;
718
699
  type index_d_RefundCreatedEnvelope = RefundCreatedEnvelope;
700
+ type index_d_RefundNonNullableFields = RefundNonNullableFields;
719
701
  type index_d_RefundOptions = RefundOptions;
720
702
  type index_d_RefundUpdatedEnvelope = RefundUpdatedEnvelope;
721
703
  type index_d_Refundability = Refundability;
@@ -748,7 +730,7 @@ declare const index_d_onRefundUpdated: typeof onRefundUpdated;
748
730
  declare const index_d_queryRefunds: typeof queryRefunds;
749
731
  declare const index_d_updateExtendedFields: typeof updateExtendedFields;
750
732
  declare namespace index_d {
751
- 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 };
733
+ 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_RefundNonNullableFields as RefundNonNullableFields, 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 };
752
734
  }
753
735
 
754
736
  export { index_d as refunds };
@@ -117,7 +117,7 @@ declare enum Status$1 {
117
117
  */
118
118
  REVERSED = "REVERSED"
119
119
  }
120
- declare enum Initiator {
120
+ declare enum Initiator$1 {
121
121
  UNKNOWN_INITIATOR = "UNKNOWN_INITIATOR",
122
122
  WIX = "WIX",
123
123
  API = "API",
@@ -334,49 +334,35 @@ declare enum RejectionReason$1 {
334
334
  /** Logged in merchant has no permission to refund this charge. */
335
335
  NOT_AUTHORIZED = "NOT_AUTHORIZED"
336
336
  }
337
+ interface StatusInfoNonNullableFields$1 {
338
+ code: string;
339
+ }
340
+ interface RefundNonNullableFields$1 {
341
+ status: Status$1;
342
+ initiator: Initiator$1;
343
+ statusInfo?: StatusInfoNonNullableFields$1;
344
+ }
337
345
  interface CreateRefundResponseNonNullableFields$1 {
338
- refund?: {
339
- status: Status$1;
340
- initiator: Initiator;
341
- statusInfo?: {
342
- code: string;
343
- };
344
- };
346
+ refund?: RefundNonNullableFields$1;
345
347
  }
346
348
  interface GetRefundResponseNonNullableFields$1 {
347
- refund?: {
348
- status: Status$1;
349
- initiator: Initiator;
350
- statusInfo?: {
351
- code: string;
352
- };
353
- };
349
+ refund?: RefundNonNullableFields$1;
354
350
  }
355
351
  interface QueryRefundsResponseNonNullableFields$1 {
356
- refunds: {
357
- status: Status$1;
358
- initiator: Initiator;
359
- statusInfo?: {
360
- code: string;
361
- };
362
- }[];
352
+ refunds: RefundNonNullableFields$1[];
363
353
  }
364
354
  interface UpdateExtendedFieldsResponseNonNullableFields$1 {
365
- refund?: {
366
- status: Status$1;
367
- initiator: Initiator;
368
- statusInfo?: {
369
- code: string;
370
- };
371
- };
355
+ refund?: RefundNonNullableFields$1;
356
+ }
357
+ interface RejectionNonNullableFields$1 {
358
+ reason: RejectionReason$1;
359
+ }
360
+ interface RefundabilityNonNullableFields$1 {
361
+ rejection?: RejectionNonNullableFields$1;
362
+ refundable: boolean;
372
363
  }
373
364
  interface GetRefundabilityResponseNonNullableFields$1 {
374
- refundability?: {
375
- rejection?: {
376
- reason: RejectionReason$1;
377
- };
378
- refundable: boolean;
379
- };
365
+ refundability?: RefundabilityNonNullableFields$1;
380
366
  }
381
367
 
382
368
  /**
@@ -498,6 +484,12 @@ declare enum Status {
498
484
  */
499
485
  REVERSED = "REVERSED"
500
486
  }
487
+ declare enum Initiator {
488
+ UNKNOWN_INITIATOR = "UNKNOWN_INITIATOR",
489
+ WIX = "WIX",
490
+ API = "API",
491
+ PROVIDER = "PROVIDER"
492
+ }
501
493
  interface StatusInfo {
502
494
  /**
503
495
  * Reason code.
@@ -709,45 +701,35 @@ declare enum RejectionReason {
709
701
  /** Logged in merchant has no permission to refund this charge. */
710
702
  NOT_AUTHORIZED = "NOT_AUTHORIZED"
711
703
  }
704
+ interface StatusInfoNonNullableFields {
705
+ code: string;
706
+ }
707
+ interface RefundNonNullableFields {
708
+ status: Status;
709
+ initiator: Initiator;
710
+ statusInfo?: StatusInfoNonNullableFields;
711
+ }
712
712
  interface CreateRefundResponseNonNullableFields {
713
- refund?: {
714
- status: Status;
715
- statusInfo?: {
716
- code: string;
717
- };
718
- };
713
+ refund?: RefundNonNullableFields;
719
714
  }
720
715
  interface GetRefundResponseNonNullableFields {
721
- refund?: {
722
- status: Status;
723
- statusInfo?: {
724
- code: string;
725
- };
726
- };
716
+ refund?: RefundNonNullableFields;
727
717
  }
728
718
  interface QueryRefundsResponseNonNullableFields {
729
- refunds: {
730
- status: Status;
731
- statusInfo?: {
732
- code: string;
733
- };
734
- }[];
719
+ refunds: RefundNonNullableFields[];
735
720
  }
736
721
  interface UpdateExtendedFieldsResponseNonNullableFields {
737
- refund?: {
738
- status: Status;
739
- statusInfo?: {
740
- code: string;
741
- };
742
- };
722
+ refund?: RefundNonNullableFields;
723
+ }
724
+ interface RejectionNonNullableFields {
725
+ reason: RejectionReason;
726
+ }
727
+ interface RefundabilityNonNullableFields {
728
+ rejection?: RejectionNonNullableFields;
729
+ refundable: boolean;
743
730
  }
744
731
  interface GetRefundabilityResponseNonNullableFields {
745
- refundability?: {
746
- rejection?: {
747
- reason: RejectionReason;
748
- };
749
- refundable: boolean;
750
- };
732
+ refundability?: RefundabilityNonNullableFields;
751
733
  }
752
734
 
753
735
  type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q = unknown, R = unknown> = {