@devite/shopware-client 1.5.7 → 1.5.9

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/dist/index.cjs CHANGED
@@ -110,6 +110,9 @@ class ShopwareClient {
110
110
  * @throws {import('ofetch').FetchError} if the request is invalid
111
111
  */
112
112
  doRequest(path, options) {
113
+ if (path.length > 2048) {
114
+ throw new Error("Path may not exceed 2048 characters");
115
+ }
113
116
  const serializedBody = options?.body?.serialize() || void 0;
114
117
  let cacheKey = null;
115
118
  if (options?.maxAge && options.maxAge > 0) {
@@ -13306,13 +13309,13 @@ class OrderClient extends Client {
13306
13309
  /**
13307
13310
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
13308
13311
  */
13309
- async initiatePayment(request) {
13312
+ async handlePayment(request) {
13310
13313
  const response = await this.post("/handle-payment", {
13311
13314
  body: new JsonPayload(request)
13312
13315
  });
13313
13316
  if (response.statusCode === 200)
13314
13317
  return response.body.data;
13315
- throw new ShopwareError("Failed to initiate order payment", response);
13318
+ throw new ShopwareError("Failed to handle order payment", response);
13316
13319
  }
13317
13320
  /**
13318
13321
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
@@ -13579,9 +13582,13 @@ class SystemClient extends Client {
13579
13582
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
13580
13583
  */
13581
13584
  async getShippingMethods(request = {}, onlyAvailable = false) {
13582
- const response = await this.post(`/shipping-method?onlyAvailable=${onlyAvailable ? 1 : 0}`, {
13583
- body: new JsonPayload(request)
13584
- });
13585
+ const response = await this.post(
13586
+ `/shipping-method`,
13587
+ this.client.withContextToken({
13588
+ query: { onlyAvailable: onlyAvailable ? 1 : 0 },
13589
+ body: new JsonPayload(request)
13590
+ })
13591
+ );
13585
13592
  if (response.statusCode === 200)
13586
13593
  return response.body.data;
13587
13594
  throw new ShopwareError("Failed to fetch shipping methods", response);
@@ -13590,9 +13597,13 @@ class SystemClient extends Client {
13590
13597
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
13591
13598
  */
13592
13599
  async getPaymentMethods(request = {}, onlyAvailable = false) {
13593
- const response = await this.post(`/payment-method?onlyAvailable=${onlyAvailable ? 1 : 0}`, {
13594
- body: new JsonPayload(request)
13595
- });
13600
+ const response = await this.post(
13601
+ `/payment-method`,
13602
+ this.client.withContextToken({
13603
+ query: { onlyAvailable: onlyAvailable ? 1 : 0 },
13604
+ body: new JsonPayload(request)
13605
+ })
13606
+ );
13596
13607
  if (response.statusCode === 200)
13597
13608
  return response.body.data;
13598
13609
  throw new ShopwareError("Failed to fetch payment methods", response);
package/dist/index.d.cts CHANGED
@@ -107,7 +107,7 @@ import { CustomerLoginRequest, CustomerLoginResponse, CustomerLoginImitateReques
107
107
  import { DocumentDownloadRequest, DocumentDownloadResponse } from '#types/clients/store/DocumentClient';
108
108
  import { GatewayCheckoutResponse } from '#types/clients/store/GatewayClient';
109
109
  import { NewsletterConfirmRequest, NewsletterUpdateRequest, NewsletterUnsubscribeRequest } from '#types/clients/store/NewsletterClient';
110
- import { OrderPaymentInitiateRequest, OrderPaymentInitiateResponse, OrderCancelRequest, OrderCancelResponse, OrderListRequest, OrderListResponse as OrderListResponse$1, OrderUpdatePaymentMethodRequest, OrderUpdatePaymentMethodResponse, OrderDownloadFileResponse, OrderFromCartRequest, OrderFromCartResponse } from '#types/clients/store/OrderClient';
110
+ import { OrderPaymentHandleRequest, OrderPaymentHandleResponse, OrderCancelRequest, OrderCancelResponse, OrderListRequest, OrderListResponse as OrderListResponse$1, OrderUpdatePaymentMethodRequest, OrderUpdatePaymentMethodResponse, OrderDownloadFileResponse, OrderFromCartRequest, OrderFromCartResponse } from '#types/clients/store/OrderClient';
111
111
  import { ProductListingListWithCategoryRequest, ProductListingListWithCategoryResponse, ProductCrossSellingGroupListResponse, ProductSingleRequest, ProductSingleResponse as ProductSingleResponse$1, ProductListRequest, ProductListResponse as ProductListResponse$1, ProductReviewListRequest, ProductReviewListResponse, ProductReviewSaveRequest, ProductVariantWithOptionsRequest, ProductVariantWithOptionsResponse, ProductSearchRequest, ProductSearchResponse, ProductSearchSuggestionListRequest, ProductSearchSuggestionListResponse } from '#types/clients/store/ProductClient';
112
112
  import { SeoRouteListRequest, SeoRouteListResponse, SitemapListResponse, SitemapDownloadResponse } from '#types/clients/store/SeoClient';
113
113
  import { LanguageListRequest, LanguageListResponse as LanguageListResponse$1, SalutationListRequest, SalutationListResponse as SalutationListResponse$1, CurrencyListRequest, CurrencyListResponse as CurrencyListResponse$1, CountryStateListRequest, CountryStateListResponse, CountryListRequest, CountryListResponse as CountryListResponse$1, ShippingMethodListRequest, ShippingMethodListResponse as ShippingMethodListResponse$2, PaymentMethodListRequest, PaymentMethodListResponse as PaymentMethodListResponse$2 } from '#types/clients/store/SystemClient';
@@ -7343,7 +7343,7 @@ declare class OrderClient extends Client {
7343
7343
  /**
7344
7344
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
7345
7345
  */
7346
- initiatePayment(request: OrderPaymentInitiateRequest): Promise<OrderPaymentInitiateResponse>;
7346
+ handlePayment(request: OrderPaymentHandleRequest): Promise<OrderPaymentHandleResponse>;
7347
7347
  /**
7348
7348
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
7349
7349
  */
package/dist/index.d.mts CHANGED
@@ -107,7 +107,7 @@ import { CustomerLoginRequest, CustomerLoginResponse, CustomerLoginImitateReques
107
107
  import { DocumentDownloadRequest, DocumentDownloadResponse } from '#types/clients/store/DocumentClient';
108
108
  import { GatewayCheckoutResponse } from '#types/clients/store/GatewayClient';
109
109
  import { NewsletterConfirmRequest, NewsletterUpdateRequest, NewsletterUnsubscribeRequest } from '#types/clients/store/NewsletterClient';
110
- import { OrderPaymentInitiateRequest, OrderPaymentInitiateResponse, OrderCancelRequest, OrderCancelResponse, OrderListRequest, OrderListResponse as OrderListResponse$1, OrderUpdatePaymentMethodRequest, OrderUpdatePaymentMethodResponse, OrderDownloadFileResponse, OrderFromCartRequest, OrderFromCartResponse } from '#types/clients/store/OrderClient';
110
+ import { OrderPaymentHandleRequest, OrderPaymentHandleResponse, OrderCancelRequest, OrderCancelResponse, OrderListRequest, OrderListResponse as OrderListResponse$1, OrderUpdatePaymentMethodRequest, OrderUpdatePaymentMethodResponse, OrderDownloadFileResponse, OrderFromCartRequest, OrderFromCartResponse } from '#types/clients/store/OrderClient';
111
111
  import { ProductListingListWithCategoryRequest, ProductListingListWithCategoryResponse, ProductCrossSellingGroupListResponse, ProductSingleRequest, ProductSingleResponse as ProductSingleResponse$1, ProductListRequest, ProductListResponse as ProductListResponse$1, ProductReviewListRequest, ProductReviewListResponse, ProductReviewSaveRequest, ProductVariantWithOptionsRequest, ProductVariantWithOptionsResponse, ProductSearchRequest, ProductSearchResponse, ProductSearchSuggestionListRequest, ProductSearchSuggestionListResponse } from '#types/clients/store/ProductClient';
112
112
  import { SeoRouteListRequest, SeoRouteListResponse, SitemapListResponse, SitemapDownloadResponse } from '#types/clients/store/SeoClient';
113
113
  import { LanguageListRequest, LanguageListResponse as LanguageListResponse$1, SalutationListRequest, SalutationListResponse as SalutationListResponse$1, CurrencyListRequest, CurrencyListResponse as CurrencyListResponse$1, CountryStateListRequest, CountryStateListResponse, CountryListRequest, CountryListResponse as CountryListResponse$1, ShippingMethodListRequest, ShippingMethodListResponse as ShippingMethodListResponse$2, PaymentMethodListRequest, PaymentMethodListResponse as PaymentMethodListResponse$2 } from '#types/clients/store/SystemClient';
@@ -7343,7 +7343,7 @@ declare class OrderClient extends Client {
7343
7343
  /**
7344
7344
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
7345
7345
  */
7346
- initiatePayment(request: OrderPaymentInitiateRequest): Promise<OrderPaymentInitiateResponse>;
7346
+ handlePayment(request: OrderPaymentHandleRequest): Promise<OrderPaymentHandleResponse>;
7347
7347
  /**
7348
7348
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
7349
7349
  */
package/dist/index.d.ts CHANGED
@@ -107,7 +107,7 @@ import { CustomerLoginRequest, CustomerLoginResponse, CustomerLoginImitateReques
107
107
  import { DocumentDownloadRequest, DocumentDownloadResponse } from '#types/clients/store/DocumentClient';
108
108
  import { GatewayCheckoutResponse } from '#types/clients/store/GatewayClient';
109
109
  import { NewsletterConfirmRequest, NewsletterUpdateRequest, NewsletterUnsubscribeRequest } from '#types/clients/store/NewsletterClient';
110
- import { OrderPaymentInitiateRequest, OrderPaymentInitiateResponse, OrderCancelRequest, OrderCancelResponse, OrderListRequest, OrderListResponse as OrderListResponse$1, OrderUpdatePaymentMethodRequest, OrderUpdatePaymentMethodResponse, OrderDownloadFileResponse, OrderFromCartRequest, OrderFromCartResponse } from '#types/clients/store/OrderClient';
110
+ import { OrderPaymentHandleRequest, OrderPaymentHandleResponse, OrderCancelRequest, OrderCancelResponse, OrderListRequest, OrderListResponse as OrderListResponse$1, OrderUpdatePaymentMethodRequest, OrderUpdatePaymentMethodResponse, OrderDownloadFileResponse, OrderFromCartRequest, OrderFromCartResponse } from '#types/clients/store/OrderClient';
111
111
  import { ProductListingListWithCategoryRequest, ProductListingListWithCategoryResponse, ProductCrossSellingGroupListResponse, ProductSingleRequest, ProductSingleResponse as ProductSingleResponse$1, ProductListRequest, ProductListResponse as ProductListResponse$1, ProductReviewListRequest, ProductReviewListResponse, ProductReviewSaveRequest, ProductVariantWithOptionsRequest, ProductVariantWithOptionsResponse, ProductSearchRequest, ProductSearchResponse, ProductSearchSuggestionListRequest, ProductSearchSuggestionListResponse } from '#types/clients/store/ProductClient';
112
112
  import { SeoRouteListRequest, SeoRouteListResponse, SitemapListResponse, SitemapDownloadResponse } from '#types/clients/store/SeoClient';
113
113
  import { LanguageListRequest, LanguageListResponse as LanguageListResponse$1, SalutationListRequest, SalutationListResponse as SalutationListResponse$1, CurrencyListRequest, CurrencyListResponse as CurrencyListResponse$1, CountryStateListRequest, CountryStateListResponse, CountryListRequest, CountryListResponse as CountryListResponse$1, ShippingMethodListRequest, ShippingMethodListResponse as ShippingMethodListResponse$2, PaymentMethodListRequest, PaymentMethodListResponse as PaymentMethodListResponse$2 } from '#types/clients/store/SystemClient';
@@ -7343,7 +7343,7 @@ declare class OrderClient extends Client {
7343
7343
  /**
7344
7344
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
7345
7345
  */
7346
- initiatePayment(request: OrderPaymentInitiateRequest): Promise<OrderPaymentInitiateResponse>;
7346
+ handlePayment(request: OrderPaymentHandleRequest): Promise<OrderPaymentHandleResponse>;
7347
7347
  /**
7348
7348
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
7349
7349
  */
package/dist/index.mjs CHANGED
@@ -108,6 +108,9 @@ class ShopwareClient {
108
108
  * @throws {import('ofetch').FetchError} if the request is invalid
109
109
  */
110
110
  doRequest(path, options) {
111
+ if (path.length > 2048) {
112
+ throw new Error("Path may not exceed 2048 characters");
113
+ }
111
114
  const serializedBody = options?.body?.serialize() || void 0;
112
115
  let cacheKey = null;
113
116
  if (options?.maxAge && options.maxAge > 0) {
@@ -13304,13 +13307,13 @@ class OrderClient extends Client {
13304
13307
  /**
13305
13308
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
13306
13309
  */
13307
- async initiatePayment(request) {
13310
+ async handlePayment(request) {
13308
13311
  const response = await this.post("/handle-payment", {
13309
13312
  body: new JsonPayload(request)
13310
13313
  });
13311
13314
  if (response.statusCode === 200)
13312
13315
  return response.body.data;
13313
- throw new ShopwareError("Failed to initiate order payment", response);
13316
+ throw new ShopwareError("Failed to handle order payment", response);
13314
13317
  }
13315
13318
  /**
13316
13319
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
@@ -13577,9 +13580,13 @@ class SystemClient extends Client {
13577
13580
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
13578
13581
  */
13579
13582
  async getShippingMethods(request = {}, onlyAvailable = false) {
13580
- const response = await this.post(`/shipping-method?onlyAvailable=${onlyAvailable ? 1 : 0}`, {
13581
- body: new JsonPayload(request)
13582
- });
13583
+ const response = await this.post(
13584
+ `/shipping-method`,
13585
+ this.client.withContextToken({
13586
+ query: { onlyAvailable: onlyAvailable ? 1 : 0 },
13587
+ body: new JsonPayload(request)
13588
+ })
13589
+ );
13583
13590
  if (response.statusCode === 200)
13584
13591
  return response.body.data;
13585
13592
  throw new ShopwareError("Failed to fetch shipping methods", response);
@@ -13588,9 +13595,13 @@ class SystemClient extends Client {
13588
13595
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
13589
13596
  */
13590
13597
  async getPaymentMethods(request = {}, onlyAvailable = false) {
13591
- const response = await this.post(`/payment-method?onlyAvailable=${onlyAvailable ? 1 : 0}`, {
13592
- body: new JsonPayload(request)
13593
- });
13598
+ const response = await this.post(
13599
+ `/payment-method`,
13600
+ this.client.withContextToken({
13601
+ query: { onlyAvailable: onlyAvailable ? 1 : 0 },
13602
+ body: new JsonPayload(request)
13603
+ })
13604
+ );
13594
13605
  if (response.statusCode === 200)
13595
13606
  return response.body.data;
13596
13607
  throw new ShopwareError("Failed to fetch payment methods", response);
@@ -2,13 +2,13 @@ import { StateMachineState } from "#types/api/store/StateMachineState";
2
2
  import { Order } from "#types/api/store/order/Order";
3
3
  import { Criteria } from "#types/api/global/query/Criteria";
4
4
  import { EntitySearchResult } from "#types/api/store";
5
- export interface OrderPaymentInitiateRequest {
5
+ export interface OrderPaymentHandleRequest {
6
6
  orderId: string;
7
7
  finishUrl?: string;
8
8
  errorUrl?: string;
9
9
  paymentDetails?: Record<string, any>;
10
10
  }
11
- export interface OrderPaymentInitiateResponse {
11
+ export interface OrderPaymentHandleResponse {
12
12
  redirectUrl: string | null;
13
13
  }
14
14
  export interface OrderCancelRequest {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devite/shopware-client",
3
- "version": "1.5.7",
3
+ "version": "1.5.9",
4
4
  "description": "Third party API client for Shopware 6.",
5
5
  "repository": "devite-io/shopware-client",
6
6
  "license": "MIT",