April 2020
Intermediate to advanced
716 pages
18h 55m
English
If a seller chooses to process the order for a product, we will need to invoke an API that will charge the customer for the total cost of the product ordered. So, when a seller selects Processing from the status values dropdown for a specific product in the order, we will call the processCharge fetch method inside the handleStatusChange method, as shown in the following code.
mern-marketplace/client/order/ProductOrderEdit.js:
processCharge({ userId: jwt.user._id, shopId: props.shopId, orderId: order._id }, { t: jwt.token }, { cartItemId: product._id, status: event.target.value, amount: (product.quantity * product.product.price) }) .then((data) => { if (data.error) { setValues({ ...values, ...Read now
Unlock full access