@commercelayer/cli-plugin-checkout
Advanced tools
Comparing version 2.0.0-beta.4 to 2.0.0
@@ -8,3 +8,2 @@ "use strict"; | ||
const url_1 = require("../../url"); | ||
const output_1 = require("@commercelayer/cli-core/lib/cjs/output"); | ||
class CheckoutIndex extends base_1.default { | ||
@@ -32,7 +31,7 @@ async run() { | ||
const lineItems = this.buildLineItems(skus, bundles); | ||
this.log((0, output_1.printObject)(lineItems)); | ||
const cl = this.commercelayerInit(flags); | ||
// Check SKUs existence | ||
const clSkus = await cl.skus.list({ filters: { code_matches_any: lineItems.filter(li => li.item_type === 'sku').map(li => li.sku_code).join(',') } }); | ||
lineItems.filter(li => li.item_type === 'sku').forEach(li => { | ||
const liSkus = lineItems.filter(li => li.item_type === 'sku'); | ||
const clSkus = await cl.skus.list({ filters: { code_matches_any: liSkus.map(li => li.sku_code).join(',') } }); | ||
liSkus.forEach(li => { | ||
if (!clSkus.some(cls => cls.code === li.sku_code)) | ||
@@ -42,4 +41,5 @@ this.error(`Inexistent SKU: ${chalk_1.default.redBright(String(li.sku_code))}`); | ||
// Check bundles existence | ||
const clBundles = await cl.bundles.list({ filters: { code_matches_any: lineItems.filter(li => li.item_type === 'bundle').map(li => li.bundle_code).join(',') } }); | ||
lineItems.filter(li => li.item_type === 'bundle').forEach(li => { | ||
const liBundles = lineItems.filter(li => li.item_type === 'bundle'); | ||
const clBundles = await cl.bundles.list({ filters: { code_matches_any: liBundles.map(li => li.bundle_code).join(',') } }); | ||
liBundles.forEach(li => { | ||
if (!clBundles.some(clb => clb.code === li.bundle_code)) | ||
@@ -46,0 +46,0 @@ this.error(`Inexistent bundle: ${chalk_1.default.redBright(String(li.bundle_code))}`); |
@@ -1,1 +0,1 @@ | ||
{"version":"2.0.0-beta.4","commands":{"checkout":{"id":"checkout","description":"create checkout URLs","pluginName":"@commercelayer/cli-plugin-checkout","pluginType":"core","aliases":[],"examples":["$ commercelayer checkout -O <order-id>","$ cl checkout -S <sku-code> -m <market-id> -c <coupon-code> -e <email-address>","$ cl checkout -S <sku-code-1> -S <sku-code-2> -m <market-id>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false},"accessToken":{"name":"accessToken","type":"option","char":"a","hidden":false,"required":true},"open":{"name":"open","type":"boolean","description":"open checkout URL in default browser","allowNo":false},"order":{"name":"order","type":"option","char":"O","description":"an order id"},"sku":{"name":"sku","type":"option","char":"S","description":"an SKU code"},"bundle":{"name":"bundle","type":"option","char":"B","description":"a bundle code"},"market":{"name":"market","type":"option","char":"m","description":"a market number"},"coupon":{"name":"coupon","type":"option","char":"c","description":"a promo code"},"email":{"name":"email","type":"option","char":"e","description":"a customer email"}},"args":[]},"checkout:noc":{"id":"checkout:noc","pluginName":"@commercelayer/cli-plugin-checkout","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[]},"checkout:order":{"id":"checkout:order","description":"create checkout URLs starting from an existing order","pluginName":"@commercelayer/cli-plugin-checkout","pluginType":"core","aliases":[],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false},"accessToken":{"name":"accessToken","type":"option","char":"a","hidden":false,"required":true},"open":{"name":"open","type":"boolean","description":"open checkout URL in default browser","allowNo":false}},"args":[{"name":"id","description":"unique id of the order","required":true}]}}} | ||
{"version":"2.0.0","commands":{"checkout":{"id":"checkout","description":"create checkout URLs","pluginName":"@commercelayer/cli-plugin-checkout","pluginType":"core","aliases":[],"examples":["$ commercelayer checkout -O <order-id>","$ cl checkout -S <sku-code> -m <market-id> -c <coupon-code> -e <email-address>","$ cl checkout -S <sku-code-1> -S <sku-code-2> -m <market-id>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false},"accessToken":{"name":"accessToken","type":"option","char":"a","hidden":false,"required":true},"open":{"name":"open","type":"boolean","description":"open checkout URL in default browser","allowNo":false},"order":{"name":"order","type":"option","char":"O","description":"an order id"},"sku":{"name":"sku","type":"option","char":"S","description":"an SKU code"},"bundle":{"name":"bundle","type":"option","char":"B","description":"a bundle code"},"market":{"name":"market","type":"option","char":"m","description":"a market number"},"coupon":{"name":"coupon","type":"option","char":"c","description":"a promo code"},"email":{"name":"email","type":"option","char":"e","description":"a customer email"}},"args":[]},"checkout:noc":{"id":"checkout:noc","pluginName":"@commercelayer/cli-plugin-checkout","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[]},"checkout:order":{"id":"checkout:order","description":"create checkout URLs starting from an existing order","pluginName":"@commercelayer/cli-plugin-checkout","pluginType":"core","aliases":[],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false},"accessToken":{"name":"accessToken","type":"option","char":"a","hidden":false,"required":true},"open":{"name":"open","type":"boolean","description":"open checkout URL in default browser","allowNo":false}},"args":[{"name":"id","description":"unique id of the order","required":true}]}}} |
{ | ||
"name": "@commercelayer/cli-plugin-checkout", | ||
"description": "Commerce Layer CLI Checkout plugin", | ||
"version": "2.0.0-beta.4", | ||
"version": "2.0.0", | ||
"author": "Pierluigi Viti <pierluigi@commercelayer.io>", | ||
@@ -6,0 +6,0 @@ "bin": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
23917