From c74f706529028f46e6f362848b995719d04b6178 Mon Sep 17 00:00:00 2001 From: James Wyndham Date: Thu, 29 Feb 2024 12:37:31 +0800 Subject: [PATCH] bugfix - fixed button press logic --- Backend/Dockerfile | 2 + Backend/README.md | 2 +- Backend/compose.yaml | 5 +- Backend/main.go | 5 +- Frontend/app/(admin)/actions.ts | 14 + Frontend/app/providers.js | 2 +- .../components/GetStartedSectionButton.tsx | 8 +- Frontend/components/Header.tsx | 11 - Frontend/components/Modals/ModalSignUp.tsx | 8 +- Frontend/components/PriceCard.tsx | 8 +- Frontend/emails/BookNow/index.html | 572 ------------------ Frontend/emails/SignUp/index.html | 270 --------- Frontend/emails/WhitePaper/index.html | 288 --------- Frontend/public/sitemap.xml | 87 --- Frontend/sections/AccountContent.tsx | 8 - 15 files changed, 34 insertions(+), 1256 deletions(-) create mode 100644 Frontend/app/(admin)/actions.ts delete mode 100644 Frontend/emails/BookNow/index.html delete mode 100644 Frontend/emails/SignUp/index.html delete mode 100644 Frontend/emails/WhitePaper/index.html delete mode 100644 Frontend/public/sitemap.xml diff --git a/Backend/Dockerfile b/Backend/Dockerfile index 3bf76f9..0c46f56 100644 --- a/Backend/Dockerfile +++ b/Backend/Dockerfile @@ -8,6 +8,7 @@ WORKDIR /app ARG STRIPE_SECRET_KEY="" ARG STRIPE_CANCEL_URL="" ARG STRIPE_SUCCESS_URL="" +ARG STRIPE_BILLING_RETURN_URL="" ARG HOST="" ARG PORT="443" ARG DEVELOPMENT="" @@ -17,6 +18,7 @@ ENV DEBIAN_FRONTEND=noninteractive ENV STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY} ENV STRIPE_CANCEL_URL=${STRIPE_CANCEL_URL} ENV STRIPE_SUCCESS_URL=${STRIPE_SUCCESS_URL} +ENV STRIPE_BILLING_RETURN_URL=${STRIPE_BILLING_RETURN_URL} ENV HOST=${HOST} ENV PORT=${PORT} ENV DEVELOPMENT=${DEVELOPMENT} diff --git a/Backend/README.md b/Backend/README.md index fa0c7b2..6333964 100644 --- a/Backend/README.md +++ b/Backend/README.md @@ -168,7 +168,7 @@ I really hope this helps in building a fresh image. MIT License -Copyright (c) 2024 Sign365 +Copyright (c) 2024 BIZ365 PTY LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Backend/compose.yaml b/Backend/compose.yaml index ba99609..a643988 100644 --- a/Backend/compose.yaml +++ b/Backend/compose.yaml @@ -6,8 +6,9 @@ services: args: STRIPE_SECRET_KEY: sk_test_51Oc1xLGaxPbSqiRDaGtJNmtk3aMQHFHVVSqIaC7TCUK74HQxzkb3jbjDqq5NQyoDEyKSeDitPB2bHX4vXqS8s0z100rXePxwfB HOST: 0.0.0.0 - STRIPE_SUCCESS_URL: https://sign365.com.au/account - STRIPE_CANCEL_URL: https://sign365.com.au/pricing + STRIPE_SUCCESS_URL: https://fastpocket.dev/account + STRIPE_CANCEL_URL: https://fastpocket.dev/pricing + STRIPE_BILLING_RETURN_URL: https://fastpocket.dev/account PORT: 8090 DEVELOPMENT: "" platform: linux/amd64 diff --git a/Backend/main.go b/Backend/main.go index dd1bbcd..a4fade3 100644 --- a/Backend/main.go +++ b/Backend/main.go @@ -52,6 +52,7 @@ func main() { stripe.Key = os.Getenv("STRIPE_SECRET_KEY") stripeSuccessURL := os.Getenv("STRIPE_SUCCESS_URL") stripeCancelURL := os.Getenv("STRIPE_CANCEL_URL") + stripeBillingReturnURL := os.Getenv("STRIPE_BILLING_RETURN_URL") app.OnBeforeServe().Add(func(e *core.ServeEvent) error { e.Router.POST("/create-checkout-session", func(c echo.Context) error { // 1. Destructure the price and quantity from the POST body @@ -273,7 +274,7 @@ func main() { //create new session sessionParams := &stripe.BillingPortalSessionParams{ Customer: stripe.String(stripeCustomer.ID), - ReturnURL: stripe.String("https://sign365.com.au/account"), + ReturnURL: &stripeBillingReturnURL, } sesh, err := session.New(sessionParams) if err != nil { @@ -286,7 +287,7 @@ func main() { //create new session sessionParams := &stripe.BillingPortalSessionParams{ Customer: stripe.String(existingCustomerRecord.GetString("stripe_customer_id")), - ReturnURL: stripe.String("https://sign365.com.au/account"), + ReturnURL: &stripeBillingReturnURL, } sesh, err := session.New(sessionParams) if err != nil { diff --git a/Frontend/app/(admin)/actions.ts b/Frontend/app/(admin)/actions.ts new file mode 100644 index 0000000..bb3a287 --- /dev/null +++ b/Frontend/app/(admin)/actions.ts @@ -0,0 +1,14 @@ +import { cookies } from "next/headers"; + +export async function setCookie(key: string, value: string) { + const cookieStore = cookies() + cookieStore.set(key, value) + } +export async function removeCookie(key: string) { + const cookieStore = cookies() + cookieStore.delete(key) + } +export async function getCookie(key: string) { + const cookieStore = cookies() + return cookieStore.get(key) +} \ No newline at end of file diff --git a/Frontend/app/providers.js b/Frontend/app/providers.js index ebf4089..fd4a1ab 100644 --- a/Frontend/app/providers.js +++ b/Frontend/app/providers.js @@ -1,4 +1,4 @@ -'use client'; +"use client"; import posthog from 'posthog-js' import { PostHogProvider } from 'posthog-js/react' import GoogleAnalytics from "@/components/GoogleAnalytics"; diff --git a/Frontend/components/GetStartedSectionButton.tsx b/Frontend/components/GetStartedSectionButton.tsx index c188870..bd14223 100644 --- a/Frontend/components/GetStartedSectionButton.tsx +++ b/Frontend/components/GetStartedSectionButton.tsx @@ -12,8 +12,6 @@ export const GetStartedSectionButton = ({ user, }: GetStartedSectionButtonProps) => { const router = useRouter(); - const portalWebsite = process.env - .NEXT_PUBLIC_PORTAL_SIGN365_WEBSITE as string; const [subscription, setSubscription] = useState(); useEffect(() => { (async () => { @@ -28,11 +26,7 @@ export const GetStartedSectionButton = ({ }, [user]); return subscription ? ( - - - + <> ) : (