FinalFormBillingAddress

This commit is contained in:
DavidBelisle 2022-12-12 13:47:44 -05:00
parent ef70c2b453
commit 4bf0e7ca45
2 changed files with 15 additions and 2 deletions

View File

@ -105,7 +105,12 @@ const InvoiceItem = ({ invoice, onCancel, paymentInfos }) => {
Nom : {invoice.payment.name}<br/>
Email : {invoice.payment.email}<br/>
Téléphone : {invoice.payment.phone}<br/>
Numéro de carte : **** **** **** {invoice.payment.lastFourDigits}<br/>
Numéro de carte : **** **** **** {invoice.payment.lastFourDigits}<br/><br/>
<label style={{"fontWeight": "bold"}}>Adresse de Facturation :</label><br/>
{invoice.payment.billingAddress.civicNumber} {invoice.payment.billingAddress.street} <br />
{invoice.payment.billingAddress.appartment != null ? <>App: {invoice.payment.billingAddress.appartment} <br /></> : null}
{invoice.payment.billingAddress.city}, {invoice.payment.billingAddress.province} {invoice.payment.billingAddress.postalCode}<br />
{invoice.payment.billingAddress.country}<br /><br/>
</>
: null }

View File

@ -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',