Created
February 21, 2020 16:32
-
-
Save dturton/ef6c9f6b77a6b07bc8a07c5be547d82a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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