@ns8/ns8-shopify-switches
Advanced tools
Comparing version 1.0.153 to 1.0.154
@@ -147,24 +147,34 @@ "use strict"; | ||
let session; | ||
if (client_details && Object.keys(client_details).length) { | ||
if (test && (!client_details || Object.keys(client_details).length === 0)) { | ||
session = makeTestSession(); | ||
} | ||
else if (client_details && Object.keys(client_details).length > 0) { | ||
session = mapSession(client_details); | ||
} | ||
else if (test) { | ||
session = makeTestSession(); | ||
if (session) { | ||
return new ns8_protect_models_1.Order({ | ||
name, | ||
currency, | ||
merchantId, | ||
addresses, | ||
session, | ||
platformId: id.toString(), | ||
customer: protectCustomer, | ||
platformCreatedAt: new Date(created_at), | ||
totalPrice: parseFloat(total_price), | ||
transactions: mapTransactions(shopifyTransactionList), | ||
lineItems: mapLineItems(line_items), | ||
hasGiftCard: hasGiftCard(line_items), | ||
platformStatus: 'Active', | ||
}); | ||
} | ||
return new ns8_protect_models_1.Order({ | ||
name, | ||
currency, | ||
merchantId, | ||
addresses, | ||
session, | ||
platformId: id.toString(), | ||
customer: protectCustomer, | ||
platformCreatedAt: new Date(created_at), | ||
totalPrice: parseFloat(total_price), | ||
transactions: mapTransactions(shopifyTransactionList), | ||
lineItems: mapLineItems(line_items), | ||
hasGiftCard: hasGiftCard(line_items), | ||
platformStatus: 'Active', | ||
}); | ||
console.log('This order cannot be created due to lack of session data.' + | ||
`Domain: ${switchContext.merchant.domain} ` + | ||
`Shopify Order ID: ${order_id}`); | ||
} | ||
else { | ||
console.log('Order transaction not qualified to create a new order. ' + | ||
`Domain: ${switchContext.merchant.domain} ` + | ||
`Shopify Order ID: ${order_id}`); | ||
} | ||
} | ||
@@ -171,0 +181,0 @@ } |
{ | ||
"name": "@ns8/ns8-shopify-switches", | ||
"version": "1.0.153", | ||
"version": "1.0.154", | ||
"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
73291
860