more
This commit is contained in:
@@ -26,8 +26,9 @@ const PaymentModal = ({
|
|||||||
const monthlySubscriptionPriceToday = selectedPlan[0].pricing[0].amount;
|
const monthlySubscriptionPriceToday = selectedPlan[0].pricing[0].amount;
|
||||||
const annualSubscriptionPriceToday = selectedPlan[0].pricing[1].amount * 12;
|
const annualSubscriptionPriceToday = selectedPlan[0].pricing[1].amount * 12;
|
||||||
|
|
||||||
const additionalAccountsMonthlyPriceToday =
|
const additionalAccountsMonthlyPriceToday = selectedPlan[0].pricing[2].amount
|
||||||
selectedPlan[0].pricing[2].amount * numberOfAccountsToAdd;
|
? selectedPlan[0].pricing[2].amount * numberOfAccountsToAdd
|
||||||
|
: null;
|
||||||
|
|
||||||
const additionalAccountsAnnualPriceToday =
|
const additionalAccountsAnnualPriceToday =
|
||||||
additionalAccountsMonthlyPriceToday * 12;
|
additionalAccountsMonthlyPriceToday * 12;
|
||||||
|
|||||||
@@ -216,29 +216,14 @@ const SignupPage = () => {
|
|||||||
if (isBusy) {
|
if (isBusy) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
const dataValues = validateUserData();
|
const dataValues = validateUserData();
|
||||||
if (dataValues === null) {
|
if (dataValues === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
const userDataValues = {
|
|
||||||
barNumber: "232323",
|
|
||||||
city: "broolyn",
|
|
||||||
email: "j@s.com",
|
|
||||||
firm: "asdf",
|
|
||||||
firstName: "ghghg",
|
|
||||||
lastName: "hhhhh",
|
|
||||||
password: "123344556",
|
|
||||||
practiceArea: "dfdfdf",
|
|
||||||
state: "New York",
|
|
||||||
streetAddress: "123 Main",
|
|
||||||
telephone: "(313) 555-5555",
|
|
||||||
zipCode: "12345",
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
saveLeadData(dataValues);
|
saveLeadData(dataValues);
|
||||||
|
*/
|
||||||
setShowSelectPlan(!showSelectPlan);
|
setShowSelectPlan(!showSelectPlan);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -260,13 +245,16 @@ const SignupPage = () => {
|
|||||||
paymentDataValues,
|
paymentDataValues,
|
||||||
customerDataValues
|
customerDataValues
|
||||||
) {
|
) {
|
||||||
|
console.log(
|
||||||
|
"~~~~~~~~~~~~~~~~~~~~_______-~~~~handleStripeAuthorization fired"
|
||||||
|
);
|
||||||
const additionalAccounts = numberOfAccountsToAdd
|
const additionalAccounts = numberOfAccountsToAdd
|
||||||
? numberOfAccountsToAdd
|
? numberOfAccountsToAdd
|
||||||
: 0;
|
: 0;
|
||||||
let error = false;
|
let error = false;
|
||||||
let subscriptionId = null;
|
let subscriptionId = null;
|
||||||
let customerId = null;
|
let customerId = null;
|
||||||
console.log("~~~~~~~~~~~~~~~~~~~~~~~~handleStripeAuthorization fired");
|
|
||||||
const token = await stripe.tokens.create({
|
const token = await stripe.tokens.create({
|
||||||
card: {
|
card: {
|
||||||
number: paymentDataValues.cardNumber,
|
number: paymentDataValues.cardNumber,
|
||||||
@@ -279,16 +267,15 @@ const SignupPage = () => {
|
|||||||
paymentDataValues.cardLastName,
|
paymentDataValues.cardLastName,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const type = selectedPlan[0].value ? selectedPlan[0].value : null;
|
||||||
try {
|
try {
|
||||||
console.log("got to create-subscription try block");
|
|
||||||
let response = await fetch(`${apiUrl}/create-subscription`, {
|
let response = await fetch(`${apiUrl}/create-subscription`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
type: selectedPlan,
|
planType: type,
|
||||||
additionalAccounts: additionalAccounts,
|
additionalAccounts: additionalAccounts,
|
||||||
isAnnual: isAnnual,
|
isAnnual: isAnnual,
|
||||||
customerData: {
|
customerData: {
|
||||||
@@ -325,18 +312,37 @@ const SignupPage = () => {
|
|||||||
|
|
||||||
const handleSignup = async (totalDue) => {
|
const handleSignup = async (totalDue) => {
|
||||||
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>handleSignup fired");
|
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>handleSignup fired");
|
||||||
console.log("totalDue", totalDue);
|
|
||||||
const paymentDataValues = validatePaymentData();
|
const paymentDataValues = validatePaymentData();
|
||||||
if (paymentDataValues === null) {
|
if (paymentDataValues === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let dataValues = validateUserData();
|
/* let dataValues = validateUserData();
|
||||||
if (dataValues === null) {
|
if (dataValues === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("dataValues in handleSignup", dataValues);
|
*/
|
||||||
|
const id = uuidv4();
|
||||||
|
const email = `${id}@jim.com`;
|
||||||
|
let dataValues = {
|
||||||
|
firstName: "fffff",
|
||||||
|
lastName: "ffff",
|
||||||
|
firm: "form",
|
||||||
|
telephone: "(313) 333-3333",
|
||||||
|
streetAddress: "123 main",
|
||||||
|
city: "new york",
|
||||||
|
state: "New York",
|
||||||
|
zipCode: "10122",
|
||||||
|
barNumber: "2343434",
|
||||||
|
practiceArea: "3df",
|
||||||
|
email: email,
|
||||||
|
password: "stingPrug1",
|
||||||
|
confirmPassword: "stingPrug1",
|
||||||
|
};
|
||||||
|
|
||||||
const planType = determinePlan(isAnnual, activeRadioOption);
|
const planType = determinePlan(isAnnual, activeRadioOption);
|
||||||
|
console.log(planType);
|
||||||
setIsBusy(true);
|
setIsBusy(true);
|
||||||
|
|
||||||
if (paymentDataValues && dataValues) {
|
if (paymentDataValues && dataValues) {
|
||||||
@@ -369,6 +375,7 @@ const SignupPage = () => {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsBusy(false);
|
setIsBusy(false);
|
||||||
|
console.log("-------->error", error);
|
||||||
setNotice(
|
setNotice(
|
||||||
error.message || "Sorry, something went wrong. Please try again."
|
error.message || "Sorry, something went wrong. Please try again."
|
||||||
);
|
);
|
||||||
@@ -625,4 +632,24 @@ const SignupPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default SignupPage;
|
export default SignupPage;
|
||||||
//
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
const userDataValues = {
|
||||||
|
barNumber: "232323",
|
||||||
|
city: "broolyn",
|
||||||
|
email: "j@s.com",
|
||||||
|
firm: "asdf",
|
||||||
|
firstName: "ghghg",
|
||||||
|
lastName: "hhhhh",
|
||||||
|
password: "123344556",
|
||||||
|
practiceArea: "dfdfdf",
|
||||||
|
state: "New York",
|
||||||
|
streetAddress: "123 Main",
|
||||||
|
telephone: "(313) 555-5555",
|
||||||
|
zipCode: "12345",
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export const signupRadioFields = [
|
|||||||
pricing: [
|
pricing: [
|
||||||
{ type: "monthly", amount: 69 },
|
{ type: "monthly", amount: 69 },
|
||||||
{ type: "annDiscount", amount: 52 },
|
{ type: "annDiscount", amount: 52 },
|
||||||
|
{ type: "additionalAccount", amount: 0 },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ export const handleFormDataChange = (e, name, data, fields) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const isFormDataHasErrors = (data) => {
|
export const isFormDataHasErrors = (data) => {
|
||||||
console.log("data", data);
|
|
||||||
return Object.values(data).reduce(
|
return Object.values(data).reduce(
|
||||||
(hasErrors, { error }) => hasErrors || error,
|
(hasErrors, { error }) => hasErrors || error,
|
||||||
false
|
false
|
||||||
|
|||||||
Reference in New Issue
Block a user