From 4bf0e7ca451c2be0fd9e2b606124f18d32ecb832 Mon Sep 17 00:00:00 2001 From: DavidBelisle <79233327+DavidBelisle@users.noreply.github.com> Date: Mon, 12 Dec 2022 13:47:44 -0500 Subject: [PATCH] FinalFormBillingAddress --- .../grosses-mitaines-ui/src/components/InvoiceItem.js | 7 ++++++- .../grosses-mitaines-ui/src/components/PaymentForm.js | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/InvoiceItem.js b/GrossesMitaines/grosses-mitaines-ui/src/components/InvoiceItem.js index 354c524..ea2a446 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/InvoiceItem.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/InvoiceItem.js @@ -105,7 +105,12 @@ const InvoiceItem = ({ invoice, onCancel, paymentInfos }) => { Nom : {invoice.payment.name}
Email : {invoice.payment.email}
Téléphone : {invoice.payment.phone}
- Numéro de carte : **** **** **** {invoice.payment.lastFourDigits}
+ Numéro de carte : **** **** **** {invoice.payment.lastFourDigits}

+
+ {invoice.payment.billingAddress.civicNumber} {invoice.payment.billingAddress.street}
+ {invoice.payment.billingAddress.appartment != null ? <>App: {invoice.payment.billingAddress.appartment}
: null} + {invoice.payment.billingAddress.city}, {invoice.payment.billingAddress.province} {invoice.payment.billingAddress.postalCode}
+ {invoice.payment.billingAddress.country}

: null } diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/PaymentForm.js b/GrossesMitaines/grosses-mitaines-ui/src/components/PaymentForm.js index 8e862cf..df68091 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/PaymentForm.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/PaymentForm.js @@ -105,7 +105,7 @@ const PaymentForm = ({ cost, invoice }) => { const onSubmit = async (e) => { - e.preventDefault(); + //e.preventDefault(); setIsLoading(true); const { error } = await stripe.createPaymentMethod({ type: "card", @@ -129,8 +129,16 @@ const PaymentForm = ({ cost, invoice }) => { invoice.email = cardEmail; invoice.phone = cardPhone; invoice.lastFourDigits = result.token.card.last4; + invoice.billCivicNumber = currentAdress.civicNumber; + invoice.billAppartment = currentAdress.appartment; + invoice.billStreet = currentAdress.street; + invoice.billCity = currentAdress.city; + invoice.billProvince = currentAdress.province; + invoice.billCountry = currentAdress.country; + invoice.billPostalCode = currentAdress.postalCode; const json = JSON.stringify(invoice); + console.log(invoice); fetch(`https://localhost:7292/api/Invoice`, { method: 'POST',