arky-sdk 0.3.138 → 0.3.140

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.js CHANGED
@@ -942,9 +942,26 @@ var createEshopApi = (apiConfig) => {
942
942
  },
943
943
  // ===== PAYMENTS =====
944
944
  async getQuote(params, options) {
945
+ let blocks = params.blocks || [];
946
+ if (params.location && !blocks.some((b) => b.type === "ADDRESS")) {
947
+ const addressBlock = {
948
+ type: "ADDRESS",
949
+ id: crypto.randomUUID(),
950
+ key: "shipping_address",
951
+ properties: {
952
+ addressType: "SHIPPING"
953
+ },
954
+ value: [params.location]
955
+ };
956
+ blocks = [...blocks, addressBlock];
957
+ }
945
958
  const payload = {
946
959
  market: apiConfig.market,
947
- ...params
960
+ items: params.items,
961
+ blocks,
962
+ paymentMethodId: params.paymentMethodId,
963
+ shippingMethodId: params.shippingMethodId,
964
+ promoCode: params.promoCode
948
965
  };
949
966
  return apiConfig.httpClient.post(
950
967
  `/v1/businesses/${apiConfig.businessId}/orders/quote`,