arky-sdk 0.3.140 → 0.3.141
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 +18 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -970,10 +970,27 @@ var createEshopApi = (apiConfig) => {
|
|
|
970
970
|
);
|
|
971
971
|
},
|
|
972
972
|
async checkout(params, options) {
|
|
973
|
+
let blocks = params.blocks || [];
|
|
974
|
+
if (params.address && !blocks.some((b) => b.type === "ADDRESS")) {
|
|
975
|
+
const addressBlock = {
|
|
976
|
+
type: "ADDRESS",
|
|
977
|
+
id: crypto.randomUUID(),
|
|
978
|
+
key: "shipping_address",
|
|
979
|
+
properties: {
|
|
980
|
+
addressType: "SHIPPING"
|
|
981
|
+
},
|
|
982
|
+
value: [params.address]
|
|
983
|
+
};
|
|
984
|
+
blocks = [...blocks, addressBlock];
|
|
985
|
+
}
|
|
973
986
|
const payload = {
|
|
974
987
|
businessId: apiConfig.businessId,
|
|
975
988
|
market: apiConfig.market,
|
|
976
|
-
|
|
989
|
+
items: params.items,
|
|
990
|
+
blocks,
|
|
991
|
+
paymentMethodId: params.paymentMethodId,
|
|
992
|
+
shippingMethodId: params.shippingMethodId,
|
|
993
|
+
promoCodeId: params.promoCodeId
|
|
977
994
|
};
|
|
978
995
|
return apiConfig.httpClient.post(
|
|
979
996
|
`/v1/businesses/${apiConfig.businessId}/orders/checkout`,
|