May 2018
Intermediate to advanced
470 pages
13h 54m
English
When a seller changes the status of a product to Processing, we will set up a backend API to not only update the order but to also create a charge on the customer's credit card for the price of the product multiplied by the quantity ordered.
mern-marketplace/server/routes/order.routes.js:
router.route('/api/order/:orderId/charge/:userId/:shopId') .put(authCtrl.requireSignin, shopCtrl.isOwner, userCtrl.createCharge, orderCtrl.update)router.param('orderId', orderCtrl.orderByID)
To retrieve the order associated with the orderId parameter in the route, we will use the orderByID order controller method, which gets the order from the Order collection and attaches it to the request object to be accessed by the next methods, ...
Read now
Unlock full access