Socket
Socket
Sign inDemoInstall

@idigi/reaction-plugin-shipments-flat-rate

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@idigi/reaction-plugin-shipments-flat-rate - npm Package Compare versions

Comparing version 1.0.29 to 1.0.30

2

package.json
{
"name": "@idigi/reaction-plugin-shipments-flat-rate",
"description": "Flat Rate Shipments plugin for the Reaction API",
"version": "1.0.29",
"version": "1.0.30",
"main": "index.js",

@@ -6,0 +6,0 @@ "type": "module",

@@ -10,5 +10,17 @@ import Random from "@reactioncommerce/random";

cartToken,
accountId,
appId,
input: _in,
debug,
...more
} = input;
//* Debug
if (input.debug)
console.info(
`\n---: setFulfillmentOnCart : ${new Date().toISOString()} :-----------\n`,
input
);
let update = { ...more };
//? Debug
if (debug) console.info(`\n\n==> { setFulfillmentOnCart:update }\n`, update);
// Address

@@ -19,7 +31,14 @@ if (Object.keys(address || {}).length || addressId) {

}
//? Debug
if (debug)
console.info(
`\n\n==> { setFulfillmentOnCart:update.address }\n`,
update.address
);
const cart = await context.queries.getCartById(context, cartId, {
cartToken,
...input,
throwIfNotFound: true,
});
//? Debug
if (debug) console.info(`\n\n==> { setFulfillmentOnCart:cart }\n`, cart);
let didModify = false;

@@ -37,8 +56,8 @@ if (!(cart.shipping || []).length) {

}
// console.info(
// `\n\n==> { setFulfillmentOnCart:cart.shipping }\n`,
// cart.shipping,
// `\n`,
// ``
// );
//? Debug
if (debug)
console.info(
`\n\n==> { setFulfillmentOnCart:cart.shipping }\n`,
cart.shipping
);
///|\\\|///|\\\|///|\\\

@@ -59,3 +78,8 @@ /// Update

});
//? Debug
if (debug)
console.info(
`\n\n==> { setFulfillmentOnCart:updatedFulfillmentGroups }\n`,
updatedFulfillmentGroups
);
if (!didModify) return { cart };

@@ -70,4 +94,6 @@

const savedCart = await context.mutations.saveCart(context, updatedCart);
//? Debug
if (debug)
console.info(`\n\n==> { setFulfillmentOnCart:savedCart }\n`, savedCart);
return { cart: savedCart };
}

@@ -14,3 +14,7 @@ import hashToken from "@reactioncommerce/api-utils/hashToken.js";

*/
export default async function getCartById(context, cartId, { cartToken, throwIfNotFound = false } = {}) {
export default async function getCartById(
context,
cartId,
{ cartToken, throwIfNotFound = false, accountId: accountIdIn } = {}
) {
const { accountId, collections } = context;

@@ -30,3 +34,8 @@ const { Cart } = collections;

if (cart && cart.accountId && cart.accountId !== accountId) {
if (
cart &&
cart.accountId &&
cart.accountId !== accountId &&
cart.accountId !== accountIdIn
) {
throw new ReactionError("access-denied", "Access Denied");

@@ -33,0 +42,0 @@ }

@@ -37,3 +37,2 @@ import decodeOpaqueIdForNamespace from "@reactioncommerce/api-utils/decodeOpaqueIdForNamespace.js";

ids = {},
...more
} = input;

@@ -48,17 +47,12 @@

if (address && address._id) address._id = decodeAddressOpaqueId(address._id);
// console.info(
// `\n\n==> { setFulfillmentOnCart:input }\n`,
// input,
// {
// address,
// addressId,
// cartId,
// fulfillmentId,
// ...more,
// },
// `\n`,
// ``
// );
if (input.debug)
console.info(`\n\n==> { setFulfillmentOnCart:input }\n`, input, {
address,
addressId,
cartId,
fulfillmentId,
});
const { cart } = await context.mutations.setFulfillmentOnCart(context, {
...input,
address,

@@ -86,3 +80,2 @@ addressId,

},
...more,
});

@@ -89,0 +82,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc