Payment
In the Payment
logic, in the controller, we should have the route payOrder()
, as usual.
And in the service, this is how the method would be. Note that, as we don't need a reference to the order
, due to the way prisma udpates the entity, the implementation becomes a bit cleaner. Also note that we create a payment
as an empty object, as its data will be generated automatically.
This is a case we can notice the Prisma type safety in action. If the order
wasn't fetched with its payment
, it wouldn't be available for extraction.
Commit - Implementing payment logic
Last updated