Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ns8/ns8-shopify-switches

Package Overview
Dependencies
Maintainers
13
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ns8/ns8-shopify-switches - npm Package Compare versions

Comparing version 1.0.160 to 1.0.161

10

dist/cancelShopifyOrder.js

@@ -27,9 +27,13 @@ "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.';

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

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

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

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

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

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

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

4

dist/capturePayment.js

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

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

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

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

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

@@ -37,3 +37,5 @@ "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) {

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

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

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

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

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

@@ -25,3 +25,5 @@ "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());

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

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));

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

2

package.json
{
"name": "@ns8/ns8-shopify-switches",
"version": "1.0.160",
"version": "1.0.161",
"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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc