Skip to content

Instantly share code, notes, and snippets.

@dturton
Created February 21, 2020 16:32
Show Gist options
  • Save dturton/5d3f6afd38cc2a0a59830e7e94059eb6 to your computer and use it in GitHub Desktop.
Save dturton/5d3f6afd38cc2a0a59830e7e94059eb6 to your computer and use it in GitHub Desktop.
import client from "../client";
import CA from "../CA";
export const handle = async function() {
try {
const response = await CA.get(
"Orders?$expand=Items($select=Sku,Quantity),CustomFields&exported=false&$filter=Fulfillments/Any (c: c/DistributionCenterID eq 2) and ShippingStatus eq 'Unshipped' and CreatedDateUtc ge 2020-01-12"
);
const promises = response.data.value
.map(order =>
client.run.withTag(order.SiteOrderID).workflow("PushOrder", order)
)
return Promise.all(promises)
.then(data => data)
.catch(err => err);
} catch (error) {
throw error;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment