horoeka-2022 / gardenz

Empowering community gardens in New Zealand
0 stars 1 forks source link

Shop: Payment #68

Open clementine-smart opened 1 year ago

clementine-smart commented 1 year ago

This is part of a much larger feature of implementing an ecommerce shop and then managing orders for each garden in both Users and Admin. This is the last part of our checkout section after delivery, here a user will put in their payment details and complete their order. Later, we will link to Stripe, a library for processing payments but for now we will just create a simple form.

Checkout the Figma wireframes so you can see exactly what you are building. If you have any questions after reading the ticket please make sure you have asked for questions before starting!!

We need to make the payment component and files in the following folder. Create these new files.

client/
├─ views/
│  ├─ users/
│  │  ├─ Gardens/
│  │  │  ├─ Shop/
│  │  │  │  ├─ Payment/ <-- new
│  │  │  │  │  ├─ Payment.jsx<-- new
│  │  │  │  │  ├─ payment.test.js<-- new

Payment.jsx will render when the user hits the route garden/:id/shop/payment

You will be getting passed the delivery details and the cart state through props which you will need to send to the orders db once the user clicks confirm payment. If the Delivery and Cart has not been completed, hardcode these objects to send to the db.

Inside Payment.jsx

Your form components will live elsewhere in Subcomponents rather than views.

client/
├─ subcomponent/
│  ├─ Payment/
│  │  ├─ PaymentForm.jsx
│  │  ├─ paymentHelper.js
│  │  ├─ paymentForm.test.js