Skip to content

Commit

Permalink
Merge pull request #65 from dilmaheu/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jurjendevries authored Dec 11, 2023
2 parents 6af3ddd + 02cb1b7 commit 35c6796
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/utils/fetchExactAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const fetchExactAPI = async (method, url, data) =>
body: JSON.stringify(data),
})
.then((res) => {
if (!res.ok) throw new Error(res.status + " " + res.statusText);

console.log(
`RateLimit-Remaining: ${res.headers.get("x-ratelimit-remaining")}`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export type Context = Partial<{
DeliveryDate: string;
hasInvoicedSalesOrder: boolean;
hasSentInvoice: boolean;
hasUpdatedShippingMethod: boolean;
hasCreatedGoodsDelivery: boolean;
}>;
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ export default async function sendInvoice(

context.hasSentInvoice = true;
}),
fetchExactAPI("PUT", `/salesorder/SalesOrders(guid'${orderID}')`, {
ShippingMethod: shippingMethodID,
}),
!context.hasUpdatedShippingMethod &&
fetchExactAPI("PUT", `/salesorder/SalesOrders(guid'${orderID}')`, {
ShippingMethod: shippingMethodID,
}).then(() => {
context.hasUpdatedShippingMethod = true;
}),
]);

console.log("Exact: Sales invoice sent successfully");
Expand Down

0 comments on commit 35c6796

Please sign in to comment.