Updates to Sentry & removal of Stripe.

This commit is contained in:
Patrick Fic
2023-01-03 12:23:25 -08:00
parent f8e74d9bad
commit af009a0bb3
12 changed files with 181 additions and 409 deletions

View File

@@ -1,5 +1,3 @@
import { Elements } from "@stripe/react-stripe-js";
import { loadStripe } from "@stripe/stripe-js";
import { BackTop, Layout } from "antd";
import preval from "preval.macro";
import React, { lazy, Suspense, useEffect } from "react";
@@ -170,18 +168,6 @@ const DmsPayables = lazy(() =>
const { Content, Footer } = Layout;
const stripePromise = new Promise((resolve, reject) => {
// client.query({ query: QUERY_STRIPE_ID }).then((resp) => {
// if (resp.data.bodyshops[0])
resolve(
loadStripe(process.env.REACT_APP_STRIPE_PUBLIC_KEY, {
stripeAccount: "No Stripe Id Resolve",
})
);
// reject();
// });
});
const mapStateToProps = createStructuredSelector({
conflict: selectInstanceConflict,
bodyshop: selectBodyshop,
@@ -207,9 +193,9 @@ export function Manage({ match, conflict, bodyshop }) {
<Suspense
fallback={<LoadingSpinner message={t("general.labels.loadingapp")} />}
>
<Elements stripe={stripePromise}>
<PaymentModalContainer />
</Elements>
<BreadCrumbs />
<BillEnterModalContainer />
<JobCostingModal />

View File

@@ -1,81 +1,81 @@
import {
PaymentRequestButtonElement,
useStripe,
} from "@stripe/react-stripe-js";
import React, { useEffect, useState } from "react";
// import {
// PaymentRequestButtonElement,
// useStripe,
// } from "@stripe/react-stripe-js";
// import React, { useEffect, useState } from "react";
export default function MobilePaymentComponent() {
const stripe = useStripe();
// export default function MobilePaymentComponent() {
// const stripe = useStripe();
const [paymentRequest, setPaymentRequest] = useState(null);
useEffect(() => {
if (stripe) {
const pr = stripe.paymentRequest({
country: "CA",
displayItems: [{ label: "Deductible", amount: 1 }],
currency: "cad",
total: {
label: "Demo total",
amount: 1,
},
requestPayerName: true,
requestPayerEmail: true,
});
// const [paymentRequest, setPaymentRequest] = useState(null);
// useEffect(() => {
// if (stripe) {
// const pr = stripe.paymentRequest({
// country: "CA",
// displayItems: [{ label: "Deductible", amount: 1 }],
// currency: "cad",
// total: {
// label: "Demo total",
// amount: 1,
// },
// requestPayerName: true,
// requestPayerEmail: true,
// });
// Check the availability of the Payment Request API.
pr.canMakePayment().then((result) => {
if (result) {
setPaymentRequest(pr);
} else {
// var details = {
// total: { label: "", amount: { currency: "CAD", value: "0.00" } },
// };
// new PaymentRequest(
// [{ supportedMethods: ["basic-card"] }],
// {}
// // details
// ).show();
}
});
}
}, [stripe]);
// // Check the availability of the Payment Request API.
// pr.canMakePayment().then((result) => {
// if (result) {
// setPaymentRequest(pr);
// } else {
// // var details = {
// // total: { label: "", amount: { currency: "CAD", value: "0.00" } },
// // };
// // new PaymentRequest(
// // [{ supportedMethods: ["basic-card"] }],
// // {}
// // // details
// // ).show();
// }
// });
// }
// }, [stripe]);
if (paymentRequest) {
paymentRequest.on("paymentmethod", async (ev) => {
//Call server side to get the client secret
// Confirm the PaymentIntent without handling potential next actions (yet).
const { error: confirmError } = await stripe.confirmCardPayment(
"clientSecret",
{ payment_method: ev.paymentMethod.id },
{ handleActions: false }
);
// if (paymentRequest) {
// paymentRequest.on("paymentmethod", async (ev) => {
// //Call server side to get the client secret
// // Confirm the PaymentIntent without handling potential next actions (yet).
// const { error: confirmError } = await stripe.confirmCardPayment(
// "clientSecret",
// { payment_method: ev.paymentMethod.id },
// { handleActions: false }
// );
if (confirmError) {
// Report to the browser that the payment failed, prompting it to
// re-show the payment interface, or show an error message and close
// the payment interface.
ev.complete("fail");
} else {
// Report to the browser that the confirmation was successful, prompting
// it to close the browser payment method collection interface.
ev.complete("success");
// Let Stripe.js handle the rest of the payment flow.
const {
error, //paymentIntent
} = await stripe.confirmCardPayment("clientSecret");
if (error) {
// The payment failed -- ask your customer for a new payment method.
} else {
// The payment has succeeded.
}
}
});
return (
<div style={{ height: "300px" }}>
<PaymentRequestButtonElement options={{ paymentRequest }} />
</div>
);
}
// if (confirmError) {
// // Report to the browser that the payment failed, prompting it to
// // re-show the payment interface, or show an error message and close
// // the payment interface.
// ev.complete("fail");
// } else {
// // Report to the browser that the confirmation was successful, prompting
// // it to close the browser payment method collection interface.
// ev.complete("success");
// // Let Stripe.js handle the rest of the payment flow.
// const {
// error, //paymentIntent
// } = await stripe.confirmCardPayment("clientSecret");
// if (error) {
// // The payment failed -- ask your customer for a new payment method.
// } else {
// // The payment has succeeded.
// }
// }
// });
// return (
// <div style={{ height: "300px" }}>
// <PaymentRequestButtonElement options={{ paymentRequest }} />
// </div>
// );
// }
return <div></div>;
}
// return <div></div>;
// }

View File

@@ -1,23 +1,23 @@
import { Elements } from "@stripe/react-stripe-js";
import { loadStripe } from "@stripe/stripe-js";
import React from "react";
import MobilePaymentComponent from "./mobile-payment.component";
// import { Elements } from "@stripe/react-stripe-js";
// import { loadStripe } from "@stripe/stripe-js";
// import React from "react";
// import MobilePaymentComponent from "./mobile-payment.component";
const stripePromise = new Promise((resolve, reject) => {
resolve(
loadStripe(process.env.REACT_APP_STRIPE_PUBLIC_KEY, {
stripeAccount: "acct_1Fa7lFIEahEZW8b4",
})
);
});
// const stripePromise = new Promise((resolve, reject) => {
// resolve(
// loadStripe(process.env.REACT_APP_STRIPE_PUBLIC_KEY, {
// stripeAccount: "acct_1Fa7lFIEahEZW8b4",
// })
// );
// });
export default function MobilePaymentContainer() {
return (
<div>
The mobile payment container.
<Elements stripe={stripePromise}>
<MobilePaymentComponent />
</Elements>
</div>
);
}
// export default function MobilePaymentContainer() {
// return (
// <div>
// The mobile payment container.
// <Elements stripe={stripePromise}>
// <MobilePaymentComponent />
// </Elements>
// </div>
// );
// }