@wix/payments 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/payments",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
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.5"
21
+ "@wix/payments_refunds": "1.0.6"
22
22
  },
23
23
  "devDependencies": {
24
24
  "glob": "^10.4.1",
@@ -42,5 +42,5 @@
42
42
  "fqdn": ""
43
43
  }
44
44
  },
45
- "falconPackageHash": "b6855b55b9e54ca91a6b035e430ec1ee043f21b93272451278b3b5de"
45
+ "falconPackageHash": "0811131cc2ee7f932c25c6c438c61ace5fd8f16412ef7fb65bb3b9af"
46
46
  }
@@ -612,6 +612,7 @@ interface UpdateExtendedFieldsOptions {
612
612
  namespaceData: Record<string, any> | null;
613
613
  }
614
614
 
615
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
615
616
  interface HttpClient {
616
617
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
617
618
  fetchWithAuth: typeof fetch;
@@ -636,6 +637,7 @@ type APIMetadata = {
636
637
  entityFqdn?: string;
637
638
  packageName?: string;
638
639
  };
640
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
639
641
  type EventDefinition<Payload = unknown, Type extends string = string> = {
640
642
  __type: 'event-definition';
641
643
  type: Type;
@@ -644,6 +646,8 @@ type EventDefinition<Payload = unknown, Type extends string = string> = {
644
646
  __payload: Payload;
645
647
  };
646
648
  declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
649
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
650
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
647
651
 
648
652
  declare global {
649
653
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -652,16 +656,17 @@ declare global {
652
656
  }
653
657
  }
654
658
 
655
- declare const __metadata: {
656
- PACKAGE_NAME: string;
657
- };
658
- declare function createRefund(httpClient: HttpClient): (refund: Refund, options?: CreateRefundOptions) => Promise<Refund & RefundNonNullableFields>;
659
- declare function getRefund(httpClient: HttpClient): (refundId: string) => Promise<Refund & RefundNonNullableFields>;
660
- declare function queryRefunds(httpClient: HttpClient): () => RefundsQueryBuilder;
661
- declare function updateExtendedFields(httpClient: HttpClient): (_id: string, namespace: string, options: UpdateExtendedFieldsOptions) => Promise<UpdateExtendedFieldsResponse & UpdateExtendedFieldsResponseNonNullableFields>;
662
- declare function getRefundability(httpClient: HttpClient): (chargeId: string) => Promise<GetRefundabilityResponse & GetRefundabilityResponseNonNullableFields>;
663
- declare const onRefundCreated: EventDefinition<RefundCreatedEnvelope, "wix.payments.refunds.v1.refund_created">;
664
- declare const onRefundUpdated: 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;
662
+
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>>;
665
670
 
666
671
  type index_d_ActionEvent = ActionEvent;
667
672
  type index_d_BaseEventMetadata = BaseEventMetadata;
@@ -721,7 +726,6 @@ type index_d_UpdateExtendedFieldsResponse = UpdateExtendedFieldsResponse;
721
726
  type index_d_UpdateExtendedFieldsResponseNonNullableFields = UpdateExtendedFieldsResponseNonNullableFields;
722
727
  type index_d_WebhookIdentityType = WebhookIdentityType;
723
728
  declare const index_d_WebhookIdentityType: typeof WebhookIdentityType;
724
- declare const index_d___metadata: typeof __metadata;
725
729
  declare const index_d_createRefund: typeof createRefund;
726
730
  declare const index_d_getRefund: typeof getRefund;
727
731
  declare const index_d_getRefundability: typeof getRefundability;
@@ -730,7 +734,7 @@ declare const index_d_onRefundUpdated: typeof onRefundUpdated;
730
734
  declare const index_d_queryRefunds: typeof queryRefunds;
731
735
  declare const index_d_updateExtendedFields: typeof updateExtendedFields;
732
736
  declare namespace index_d {
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 };
737
+ 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_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 };
734
738
  }
735
739
 
736
740
  export { index_d as refunds };