@wix/auto_sdk_get-paid_receipts 1.0.170 → 1.0.172

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.
@@ -1,6 +1,6 @@
1
1
  import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
2
- import { Receipt, CreateReceiptApplicationErrors, ReceiptsQueryBuilder, RegenerateReceiptDocumentApplicationErrors, SendReceiptEmailOptions, SendReceiptEmailApplicationErrors, GetLatestReceiptNumberOptions, GetLatestReceiptNumberResponse, UpdateExtendedFieldsOptions, UpdateExtendedFieldsResponse, ReceiptCreatedEnvelope, ReceiptSentEnvelope, ReceiptUpdatedEnvelope } from './index.typings.js';
3
- export { ActionEvent, AdditionalFee, AdditionalFeeTax, Address, AddressLocation, AddressStreetOneOf, BaseEventMetadata, BusinessDetails, CreateReceiptRequest, CreateReceiptResponse, CursorPaging, CursorPagingMetadata, CursorQuery, CursorQueryPagingMethodOneOf, Cursors, CustomField, CustomFields, Customer, Discount, Document, DocumentStatus, DocumentStatusWithLiterals, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, EventMetadata, ExtendedFields, Failed, FooterCustomField, FullAddressContactDetails, GenerateReceiptDocument, GetLatestReceiptNumberRequest, GetReceiptRequest, GetReceiptResponse, IdentificationData, IdentificationDataIdOneOf, LineItem, LineItemTax, LineItemTotals, Locale, MessageEnvelope, Numbering, Payment, QueryReceiptsRequest, QueryReceiptsResponse, ReceiptDocumentHandled, ReceiptDocumentHandledResultOneOf, ReceiptDocumentProcess, ReceiptNumberingProcess, ReceiptOrderType, ReceiptOrderTypeWithLiterals, ReceiptsQueryResult, RegenerateReceiptDocumentRequest, RegenerateReceiptDocumentResponse, RegionalProperties, RequestOrigin, RequestOriginWithLiterals, RestoreInfo, SendReceiptEmailRequest, SendReceiptEmailResponse, Sent, ShippingAddressContactDetails, ShippingInfo, ShippingTax, SortOrder, SortOrderWithLiterals, Sorting, SourceReference, SourceReferenceOrderOneOf, StandardDetails, StreetAddress, Subdivision, SubdivisionType, SubdivisionTypeWithLiterals, Succeeded, Tax, Totals, UpdateExtendedFieldsRequest, UpdateReceiptRequest, UpdateReceiptResponse, VatId, VatType, VatTypeWithLiterals, WebhookIdentityType, WebhookIdentityTypeWithLiterals, WixEcom, WixPayment } from './index.typings.js';
2
+ import { Receipt, CreateReceiptApplicationErrors, RegenerateReceiptDocumentApplicationErrors, SendReceiptEmailOptions, SendReceiptEmailApplicationErrors, GetLatestReceiptNumberOptions, GetLatestReceiptNumberResponse, UpdateExtendedFieldsOptions, UpdateExtendedFieldsResponse, ReceiptCreatedEnvelope, ReceiptSentEnvelope, ReceiptUpdatedEnvelope, ReceiptsQueryBuilder, CursorQuery, typedQueryReceipts } from './index.typings.js';
3
+ export { ActionEvent, AdditionalFee, AdditionalFeeTax, Address, AddressLocation, AddressStreetOneOf, BaseEventMetadata, BusinessDetails, CreateReceiptRequest, CreateReceiptResponse, CursorPaging, CursorPagingMetadata, CursorQueryPagingMethodOneOf, Cursors, CustomField, CustomFields, Customer, Discount, Document, DocumentStatus, DocumentStatusWithLiterals, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, EventMetadata, ExtendedFields, Failed, FooterCustomField, FullAddressContactDetails, GenerateReceiptDocument, GetLatestReceiptNumberRequest, GetReceiptRequest, GetReceiptResponse, IdentificationData, IdentificationDataIdOneOf, LineItem, LineItemTax, LineItemTotals, Locale, MessageEnvelope, Numbering, Payment, QueryReceiptsRequest, QueryReceiptsResponse, ReceiptDocumentHandled, ReceiptDocumentHandledResultOneOf, ReceiptDocumentProcess, ReceiptNumberingProcess, ReceiptOrderType, ReceiptOrderTypeWithLiterals, ReceiptsQueryResult, RegenerateReceiptDocumentRequest, RegenerateReceiptDocumentResponse, RegionalProperties, RequestOrigin, RequestOriginWithLiterals, RestoreInfo, SendReceiptEmailRequest, SendReceiptEmailResponse, Sent, ShippingAddressContactDetails, ShippingInfo, ShippingTax, SortOrder, SortOrderWithLiterals, Sorting, SourceReference, SourceReferenceOrderOneOf, StandardDetails, StreetAddress, Subdivision, SubdivisionType, SubdivisionTypeWithLiterals, Succeeded, Tax, Totals, UpdateExtendedFieldsRequest, UpdateReceiptRequest, UpdateReceiptResponse, VatId, VatType, VatTypeWithLiterals, WebhookIdentityType, WebhookIdentityTypeWithLiterals, WixEcom, WixPayment } from './index.typings.js';
4
4
 
5
5
  declare function createReceipt$1(httpClient: HttpClient): CreateReceiptSignature;
6
6
  interface CreateReceiptSignature {
@@ -24,13 +24,6 @@ interface GetReceiptSignature {
24
24
  */
25
25
  (receiptId: string): Promise<NonNullablePaths<Receipt, `numbering.displayNumber` | `regionalProperties.locale.languageCode` | `currency` | `sourceReference.wixPaymentOrder.orderId` | `sourceReference.wixPaymentOrder.transactionId` | `sourceReference.wixEcomOrder.orderId` | `sourceReference.wixEcomOrder.transactionId` | `sourceReference.appId` | `sourceReference.externalReferenceId` | `sourceReference.receiptOrderType` | `businessDetails.address.streetAddress.number` | `businessDetails.address.streetAddress.name` | `businessDetails.address.streetAddress.apt` | `customer.contactDetails.vatId._id` | `customer.contactDetails.vatId.type` | `lineItems` | `shippingInfo.title` | `shippingInfo.priceBeforeTax` | `shippingInfo.priceAfterTax` | `shippingInfo.taxBreakdown` | `shippingInfo.taxBreakdown.${number}.name` | `shippingInfo.taxBreakdown.${number}.rate` | `shippingInfo.taxBreakdown.${number}.amount` | `additionalFees` | `additionalFees.${number}.name` | `additionalFees.${number}.priceBeforeTax` | `additionalFees.${number}.priceAfterTax` | `discounts` | `discounts.${number}.name` | `discounts.${number}.amount` | `payment.paymentMethod` | `payment.amount` | `taxBreakdown` | `taxBreakdown.${number}.name` | `taxBreakdown.${number}.rate` | `taxBreakdown.${number}.taxAmount` | `taxBreakdown.${number}.taxableAmount` | `customFields.headerCustomFields` | `customFields.headerCustomFields.${number}.value` | `customFields.businessCustomFields` | `customFields.customerCustomFields` | `customFields.footerCustomFields` | `customFields.footerCustomFields.${number}.title` | `document.status`, 5>>;
26
26
  }
27
- declare function queryReceipts$1(httpClient: HttpClient): QueryReceiptsSignature;
28
- interface QueryReceiptsSignature {
29
- /**
30
- * Retrieves a list of up to 100 receipts, given the specified filtering, paging, and sorting ([SDK](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/api-query-language) | [REST](https://dev.wix.com/api/rest/getting-started/api-query-language)).
31
- */
32
- (): ReceiptsQueryBuilder;
33
- }
34
27
  declare function regenerateReceiptDocument$1(httpClient: HttpClient): RegenerateReceiptDocumentSignature;
35
28
  interface RegenerateReceiptDocumentSignature {
36
29
  /**
@@ -83,13 +76,17 @@ declare const onReceiptCreated$1: EventDefinition<ReceiptCreatedEnvelope, "wix.r
83
76
  declare const onReceiptSent$1: EventDefinition<ReceiptSentEnvelope, "wix.receipts.v1.receipt_sent">;
84
77
  declare const onReceiptUpdated$1: EventDefinition<ReceiptUpdatedEnvelope, "wix.receipts.v1.receipt_updated">;
85
78
 
79
+ declare function customQueryReceipts(httpClient: HttpClient): {
80
+ (): ReceiptsQueryBuilder;
81
+ (query: CursorQuery): ReturnType<typeof typedQueryReceipts>;
82
+ };
86
83
  declare const createReceipt: MaybeContext<BuildRESTFunction<typeof createReceipt$1> & typeof createReceipt$1>;
87
84
  declare const getReceipt: MaybeContext<BuildRESTFunction<typeof getReceipt$1> & typeof getReceipt$1>;
88
- declare const queryReceipts: MaybeContext<BuildRESTFunction<typeof queryReceipts$1> & typeof queryReceipts$1>;
89
85
  declare const regenerateReceiptDocument: MaybeContext<BuildRESTFunction<typeof regenerateReceiptDocument$1> & typeof regenerateReceiptDocument$1>;
90
86
  declare const sendReceiptEmail: MaybeContext<BuildRESTFunction<typeof sendReceiptEmail$1> & typeof sendReceiptEmail$1>;
91
87
  declare const getLatestReceiptNumber: MaybeContext<BuildRESTFunction<typeof getLatestReceiptNumber$1> & typeof getLatestReceiptNumber$1>;
92
88
  declare const updateExtendedFields: MaybeContext<BuildRESTFunction<typeof updateExtendedFields$1> & typeof updateExtendedFields$1>;
89
+ declare const queryReceipts: MaybeContext<BuildRESTFunction<typeof customQueryReceipts> & typeof customQueryReceipts>;
93
90
  /**
94
91
  * Triggered when a receipt is created.
95
92
  */
@@ -103,4 +100,4 @@ declare const onReceiptSent: BuildEventDefinition<typeof onReceiptSent$1> & type
103
100
  */
104
101
  declare const onReceiptUpdated: BuildEventDefinition<typeof onReceiptUpdated$1> & typeof onReceiptUpdated$1;
105
102
 
106
- export { CreateReceiptApplicationErrors, GetLatestReceiptNumberOptions, GetLatestReceiptNumberResponse, Receipt, ReceiptCreatedEnvelope, ReceiptSentEnvelope, ReceiptUpdatedEnvelope, ReceiptsQueryBuilder, RegenerateReceiptDocumentApplicationErrors, SendReceiptEmailApplicationErrors, SendReceiptEmailOptions, UpdateExtendedFieldsOptions, UpdateExtendedFieldsResponse, createReceipt, getLatestReceiptNumber, getReceipt, onReceiptCreated, onReceiptSent, onReceiptUpdated, queryReceipts, regenerateReceiptDocument, sendReceiptEmail, updateExtendedFields };
103
+ export { CreateReceiptApplicationErrors, CursorQuery, GetLatestReceiptNumberOptions, GetLatestReceiptNumberResponse, Receipt, ReceiptCreatedEnvelope, ReceiptSentEnvelope, ReceiptUpdatedEnvelope, ReceiptsQueryBuilder, RegenerateReceiptDocumentApplicationErrors, SendReceiptEmailApplicationErrors, SendReceiptEmailOptions, UpdateExtendedFieldsOptions, UpdateExtendedFieldsResponse, createReceipt, getLatestReceiptNumber, getReceipt, onReceiptCreated, onReceiptSent, onReceiptUpdated, queryReceipts, regenerateReceiptDocument, sendReceiptEmail, updateExtendedFields };
@@ -552,6 +552,44 @@ function queryReceipts2() {
552
552
  transformationPaths: {}
553
553
  });
554
554
  }
555
+ async function typedQueryReceipts(query) {
556
+ const { httpClient, sideEffects } = arguments[1];
557
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ query });
558
+ const reqOpts = queryReceipts(payload);
559
+ sideEffects?.onSiteCall?.();
560
+ try {
561
+ const result = await httpClient.request(reqOpts);
562
+ sideEffects?.onSuccess?.(result);
563
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
564
+ (0, import_transform_paths2.transformPaths)(result.data, [
565
+ {
566
+ transformFn: import_address2.transformRESTAddressToSDKAddress,
567
+ paths: [
568
+ { path: "receipts.businessDetails.address" },
569
+ { path: "receipts.customer.billingAddress" },
570
+ { path: "receipts.customer.shippingAddress" }
571
+ ]
572
+ },
573
+ {
574
+ transformFn: import_image2.transformRESTImageToSDKImage,
575
+ paths: [{ path: "receipts.businessDetails.logo" }]
576
+ }
577
+ ])
578
+ );
579
+ } catch (err) {
580
+ const transformedError = (0, import_transform_error.transformError)(
581
+ err,
582
+ {
583
+ spreadPathsToArguments: {},
584
+ explicitPathsToArguments: { query: "$[0]" },
585
+ singleArgumentUnchanged: false
586
+ },
587
+ ["query"]
588
+ );
589
+ sideEffects?.onError?.(err);
590
+ throw transformedError;
591
+ }
592
+ }
555
593
  async function regenerateReceiptDocument2(receiptId) {
556
594
  const { httpClient, sideEffects } = arguments[1];
557
595
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
@@ -699,6 +737,13 @@ function queryReceipts3(httpClient) {
699
737
  { httpClient }
700
738
  );
701
739
  }
740
+ function typedQueryReceipts2(httpClient) {
741
+ return (query) => typedQueryReceipts(
742
+ query,
743
+ // @ts-ignore
744
+ { httpClient }
745
+ );
746
+ }
702
747
  function regenerateReceiptDocument3(httpClient) {
703
748
  return (receiptId) => regenerateReceiptDocument2(
704
749
  receiptId,
@@ -821,13 +866,25 @@ var onReceiptUpdated = (0, import_sdk_types.EventDefinition)(
821
866
  // src/receipts-v1-receipt-receipts.context.ts
822
867
  var import_rest_modules3 = require("@wix/sdk-runtime/rest-modules");
823
868
  var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
869
+ var import_query_method_router = require("@wix/sdk-runtime/query-method-router");
870
+ function customQueryReceipts(httpClient) {
871
+ const router = (0, import_query_method_router.createQueryOverloadRouter)({
872
+ builderQueryFunction: () => queryReceipts3(httpClient)(),
873
+ typedQueryFunction: (query) => typedQueryReceipts2(httpClient)(query),
874
+ hasOptionsParameter: false
875
+ });
876
+ function overloadedQuery(query) {
877
+ return router(...arguments);
878
+ }
879
+ return overloadedQuery;
880
+ }
824
881
  var createReceipt4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(createReceipt3);
825
882
  var getReceipt4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getReceipt3);
826
- var queryReceipts4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(queryReceipts3);
827
883
  var regenerateReceiptDocument4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(regenerateReceiptDocument3);
828
884
  var sendReceiptEmail4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(sendReceiptEmail3);
829
885
  var getLatestReceiptNumber4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getLatestReceiptNumber3);
830
886
  var updateExtendedFields4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(updateExtendedFields3);
887
+ var queryReceipts4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(customQueryReceipts);
831
888
  var onReceiptCreated2 = (0, import_event_definition_modules.createEventModule)(onReceiptCreated);
832
889
  var onReceiptSent2 = (0, import_event_definition_modules.createEventModule)(onReceiptSent);
833
890
  var onReceiptUpdated2 = (0, import_event_definition_modules.createEventModule)(onReceiptUpdated);