Closed ancasimon closed 3 years ago
2 Prerequisites for this ticket - We all need to make these updates in our database:
1 - WCG database > Orders table > Design > PurchaseDate column:
2 - WCG database > PaymentTypes table > Design > PaymentOption column:
To create additional users:
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('felix.jordan@gmail.com', 'Felix', 'Jordan', 'felix.jordan@gmail.com', '2020', 'password123', 1)
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('georgia.knox@gmail.com', 'Georgia', 'Knox', 'georgia.knox@gmail.com', '2020', 'password123', 1)
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('maria.paxton@gmail.com', 'Maria', 'Paxton', 'maria.paxton@gmail.com', '2020', 'password123', 1)
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('jonathan.mcknight@gmail.com', 'Jonathan', 'McKnight', 'jonathan.mcknight@gmail.com', '2020', 'password123', 1)
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('tony.pizzicato@gmail.com', 'Tony', 'Pizzicato', 'tony.pizzicato@gmail.com', '2020', 'password123', 1)
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('angela.andantino@gmail.com', 'Angela', 'Andantino', 'angela.andantino@gmail.com', '2020', 'password123', 1)
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('theresa.fiorelli@gmail.com', 'Theresa', 'Fiorelli', 'theresa.fiorelli@gmail.com', '2020', 'password123', 1)
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('fred.allegro@gmail.com', 'Fred', 'Allegro', 'fred.allegro@gmail.com', '2020', 'password123', 1)
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('jeremy.ritardando@gmail.com', 'Jeremy', 'Ritardando', 'jeremy.ritardando@gmail.com', '2020', 'password123', 1)
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('martin.nelson@gmail.com', 'Martin', 'Nelson', 'martin.nelson@gmail.com', '2020', 'password123', 1)
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('arthur.coal@gmail.com', 'Arthur', 'Coal', 'arthur.coal@gmail.com', '2020', 'password123', 1)
** 11/14 UPDATE - more users:
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('sylvan.mcwheeler@gmail.com', 'Sylvan', 'McWheeler', 'sylvan.mcwheeler@gmail.com', '2020', 'password123', 1)
insert into Users(username, firstName, lastName,email,dateCreated,password,IsActive)
values('stephanie.plum@gmail.com', 'Stephanie', 'Plum', 'stephanie.plum@gmail.com', '2020', 'password123', 1)
Add payment options for them - replace the placeholder text <USERIDHERE!!!!> with the ID of the new users above - REPEAT this script at least 2 times, for 2 of the users created above - so you can use them in the second part in the PR testing steps!
insert into PaymentTypes(PaymentOption, UserId, AccountNo,ExpirationYear,ExpirationMonth,IsActive)
values('newcard',<USERIDHERE!!!>,'10101010101',2025,12,1)
User Story 1
Given the customer is on a product detail page When clicking on an add to cart button Then a new order gets created with a line item for that product.
User Story 2
Given the customer is on the Shopping Cart page When clicking on the Start Shopping button Then a new order gets created.
Logic:
order
record for the cart and display the basic order data. To do that, we also need to apaymentType
record - we can get the latest payment type added for the user OR - if none available - we will create a new payment type record with some default data as the PaymentOption and the DeliveryAddress, which are required fields.order
record - like in the scenario above, to do that, we also need to apaymentType
record - so we can get the latest payment type added for the user OR - if none available - we will create a new payment type record - last, we will create a new ProductOrder record for the product the user clicks Add to Cart on!Dev Notes:
SQL
API:
React app:
then()
, this function also creates a ProductOrder record - SHOULD I MOVE THIS TO THE BACKEND?? AND PASS THE PRODUCT ID AS A PARAMETER???; -4-send the user to the Cart page after adding this product by includingthis.props.history.push('/cart'); in the
then()of this last Promise; -5- in the Add to Cart button in this component, add the
onClick` event handler which calls the new addToCart function we just wrote.