Socket
Socket
Sign inDemoInstall

@ns8/ns8-shopify-switches

Package Overview
Dependencies
78
Maintainers
13
Versions
195
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.162 to 1.0.163

10

dist/cancelShopifyOrder.js

@@ -27,13 +27,9 @@ "use strict";

};
console.time('cancelFullyPaidOrder timer');
const results = await shopifyClient.order.cancel(id, Object.assign({}, params))
.catch((error) => new Error(`Unable to cancel fully paid order. ${JSON.stringify(error)}`));
console.timeEnd('cancelFullyPaidOrder timer');
return results instanceof Error ? results : 'Paid order refunded and canceled.';
};
const cancelRefundedOrder = async (shopifyClient, orderId, email = false) => {
console.time('cancelRefundedOrder timer');
const results = await shopifyClient.order.cancel(orderId, { email, restock: true, reason: 'fraud' })
.catch((error) => new Error(`Unable to cancel refunded order. ${JSON.stringify(error)}`));
console.timeEnd('cancelRefundedOrder timer');
return results instanceof Error ? results : 'Refunded order canceled.';

@@ -48,5 +44,3 @@ };

const { id } = order;
console.time('voidAuthorizedOrder getTransactions timer');
const transactions = await getTransactions(shopifyClient, id);
console.timeEnd('voidAuthorizedOrder getTransactions timer');
if (transactions instanceof Error) {

@@ -57,5 +51,3 @@ return transactions;

if (transaction) {
console.time('voidAuthorizedOrder voidTransaction timer');
voidTransactionResults = await voidTransaction(shopifyClient, transaction);
console.timeEnd('voidAuthorizedOrder voidTransaction timer');
if (voidTransactionResults instanceof Error) {

@@ -71,5 +63,3 @@ returnMessage = voidTransactionResults;

}
console.time('cancelUnpaidOrder timer');
cancelOrderResults = await cancelUnpaidOrder(shopifyClient, id, email);
console.timeEnd('cancelUnpaidOrder timer');
if (cancelOrderResults instanceof Error) {

@@ -76,0 +66,0 @@ returnMessage = `${returnMessage} --- ${cancelOrderResults}`;

4

dist/capturePayment.js

@@ -16,5 +16,3 @@ "use strict";

let returnMessage;
console.time('capturePayment getOrder timer');
const order = await getOrder(shopifyClient, orderId);
console.timeEnd('capturePayment getOrder timer');
if (order instanceof Error) {

@@ -24,5 +22,3 @@ returnMessage = order;

else if (paymentCanBeCaptured(order)) {
console.time('capturePayment createCaptureTransaction timer');
returnMessage = await createCaptureTransaction(shopifyClient, orderId);
console.timeEnd('capturePayment createCaptureTransaction timer');
}

@@ -29,0 +25,0 @@ else {

@@ -37,5 +37,3 @@ "use strict";

const { line_items } = await shopifyClient.order.get(orderId, { fields: 'line_items' });
console.time('fulfillOrder getAllLocations timer');
const allLocations = await getAllLocations(shopifyClient);
console.timeEnd('fulfillOrder getAllLocations timer');
if (allLocations instanceof Error) {

@@ -49,5 +47,3 @@ returnMessage = allLocations;

if (hasCustomFulfillmentService(allLocations)) {
console.time('fulfillOrder getFulfillmentServices timer');
const fulfillmentServices = await getFulfillmentServices(shopifyClient);
console.timeEnd('fulfillOrder getFulfillmentServices timer');
if (!(fulfillmentServices instanceof Error)) {

@@ -65,5 +61,3 @@ fulfillmentGroups.push(...groupCustomFulfillments(fulfillmentServices, line_items));

};
console.time('fulfillOrder fulfillmentResults timer');
fulfillmentResults.push(await shopifyClient.fulfillment.create(orderId, fulfillmentPayload));
console.timeEnd('fulfillOrder fulfillmentResults timer');
}

@@ -70,0 +64,0 @@ }

@@ -25,5 +25,3 @@ "use strict";

if (status === ns8_protect_models_1.Status.CANCELLED) {
console.time('cancelShopifyOrder timer');
cancelShopifyOrderResults = await cancelShopifyOrder_1.default(client, orderId, profile.emailOnCancel);
console.timeEnd('cancelShopifyOrder timer');
console.log('cancelShopifyOrderResults', cancelShopifyOrderResults.toString());

@@ -33,21 +31,13 @@ }

if (interceptPaymentCapture === ns8_protect_models_1.InterceptOption.BEFORE) {
console.time('capturePayment timer');
paymentCaptureResults = await capturePayment_1.default(client, orderId);
console.timeEnd('capturePayment timer');
console.log('paymentCaptureResults', paymentCaptureResults.toString());
}
if (interceptPaymentCapture === ns8_protect_models_1.InterceptOption.AFTER) {
console.time('fulfillOrder timer');
fulfillmentResults = await fulfillOrder_1.default(client, orderId);
console.timeEnd('fulfillOrder timer');
console.log('fulfillmentResults', JSON.stringify(fulfillmentResults));
}
}
console.time('getPlatformOrderDetails timer');
orderDetails = await getPlatformOrderDetails_1.default(switchContext.data, client);
console.timeEnd('getPlatformOrderDetails timer');
console.time('updateOrderResults timer');
updateOrderResults = await client.order.update(orderId, orderDetails)
.catch((error) => new Error(`Failed to update order: ${JSON.stringify(error)}`));
console.timeEnd('updateOrderResults timer');
console.log('updateOrderResults', JSON.stringify(updateOrderResults));

@@ -54,0 +44,0 @@ const platformStatus = {

2

package.json
{
"name": "@ns8/ns8-shopify-switches",
"version": "1.0.162",
"version": "1.0.163",
"description": "Custom switches for the shopify integration",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc