Skip to content

Latest commit

 

History

History
235 lines (129 loc) · 2.95 KB

21_Handling_Payments.md

File metadata and controls

235 lines (129 loc) · 2.95 KB

[Stephen Grider] Microservices with Node JS and React [ENG, 2020]

21. Handling Payments


01. The Payments Service


Application


02. Initial Setup


03. Replicated Fields


Application


Application


04. Another Order Model!


05. Update-If-Current

$ cd payments
$ npm install --save mongoose-update-if-current

06. Replicating Orders


07. Testing Order Creation

$ cd payments
$ npm run test

08. Marking an Order as Cancelled


09. Cancelled Testing


10. Starting the Listeners

CREATE TICKET
CREATE ORDER

Application


Application


11. Payments Flow with Stripe


Application


Application


12. Implementing the Create Charge Handler


Application


13. Validating Order Payment


14. Testing Order Validation Before Payment


15. Testing Same-User Validation


16. Stripe Setup


Application


$ npm install --save stripe

stripe.com

Developers --> API keys


17. Creating a Stripe Secret

$ kubectl create secret generic stripe-secret --from-literal=STRIPE_KEY=<STRIPE_SECRET_KEY>

18. Creating a Charge with Stripe

https://stripe.com/docs/api/charges/create


19. Manual Testing of Payments

$ cd payments
$ npm update @grider-ms-tickets/common

restart skaffold dev


CREATE TICKET
CREATE ORDER
// CREATE PAYMENT
$ curl \
--insecure \
--cookie /tmp/cookies.txt \
--data '{"orderId":"5ec6c93f6c627e0023725faf", "token": "tok_visa"}' \
--header "Content-Type: application/json" \
--request POST https://ticketing.dev/api/payments/ \
| python -m json.tool

Application


20. Automated Payment Testing


21. Mocked Stripe Client


22. A More Realistic Test Setup


23. Realistic Test Implementation


24. Tying an Order and Charge Together


25. Testing Payment Creation


26. Publishing a Payment Created Event


Application


$ cd payments
$ npm update @grider-ms-tickets/common

$ cd orders
$ npm update @grider-ms-tickets/common

$ cd tickets
$ npm update @grider-ms-tickets/common

27. More on Publishing


28. Marking an Order as Complete




Marley

Any questions in english: Telegram Chat
Любые вопросы на русском: Телеграм чат