Socket
Socket
Sign inDemoInstall

@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.156 to 1.0.157

32

dist/ShopifyCreateOrderActionSwitch.js

@@ -166,20 +166,22 @@ "use strict";

exports.getClientDetails = getClientDetails;
const shouldOrderBeProcessed = (transaction) => {
const { kind, payment_details, status, source_name, } = transaction;
let shouldProcessOrder = false;
if (!payment_details && kind !== 'void' && kind !== 'refund' && (status === 'pending' || status === 'success')) {
shouldProcessOrder = true;
}
if (payment_details && status === 'success' && (kind === 'sale' || kind === 'authorization')) {
shouldProcessOrder = true;
}
if (source_name === 'pos') {
shouldProcessOrder = false;
}
return shouldProcessOrder;
};
exports.shouldOrderBeProcessed = shouldOrderBeProcessed;
class ShopifyCreateOrderActionSwitch {
async create(switchContext) {
const { order_id, kind, payment_details, status, source_name, } = switchContext.data;
const { order_id } = switchContext.data;
console.log(switchContext.merchant.domain, order_id);
let shouldProcessOrder = false;
if (!payment_details && (status === 'pending' || status === 'success')) {
shouldProcessOrder = true;
}
if (payment_details && status === 'success' && kind === 'authorization') {
shouldProcessOrder = true;
}
if (payment_details && status === 'success' && kind === 'sale') {
shouldProcessOrder = true;
}
if (source_name === 'pos') {
shouldProcessOrder = false;
}
if (shouldProcessOrder) {
if (shouldOrderBeProcessed(switchContext.data)) {
const client = getShopifyClient_1.default(switchContext);

@@ -186,0 +188,0 @@ const shopifyOrder = await client.order.get(order_id);

{
"name": "@ns8/ns8-shopify-switches",
"version": "1.0.156",
"version": "1.0.157",
"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

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