Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zomars/cal 748 paid bookings are failing #1335

Merged
merged 30 commits into from
Dec 17, 2021
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
94e0a9d
E2E video adjustments
zomars Dec 15, 2021
89765ba
Adds test to add Stripe integration
zomars Dec 15, 2021
8bc072a
Type fix
zomars Dec 15, 2021
62f8832
WIP: Payment troubleshooting
zomars Dec 15, 2021
30026be
Paid bookings shouldn't be confirmed by default
zomars Dec 15, 2021
25aaa5b
Runs stripe test only if installed
zomars Dec 16, 2021
1819534
BookingListItem Adjustments
zomars Dec 16, 2021
49621a0
Pending paid bookings should be unconfirmed
zomars Dec 16, 2021
e7d4140
Attempt to fix paid bookings
zomars Dec 16, 2021
def87e5
Type fixes
zomars Dec 16, 2021
23af4e4
Type fixes
zomars Dec 16, 2021
888c555
Merge branch 'main' into zomars/cal-748-paid-bookings-are-failing
zomars Dec 16, 2021
2cc7f0a
Tests fixes
zomars Dec 16, 2021
354b6e8
Adds paid booking to seeder
zomars Dec 16, 2021
385de7e
Moves stripe tests to own file
zomars Dec 16, 2021
b432c4f
Matches app locale to Stripe's
zomars Dec 16, 2021
b1fc6c0
Fixes minimun price for testing
zomars Dec 16, 2021
b8cebe1
Stripe test fixes
zomars Dec 16, 2021
747c6d1
Fixes stripe frame test
zomars Dec 16, 2021
9bb04fc
Added some Stripe TODOs
zomars Dec 16, 2021
799d042
Adds Stripe CI env vars
zomars Dec 16, 2021
a74871f
Merge branch 'main' into zomars/cal-748-paid-bookings-are-failing
kodiakhq[bot] Dec 17, 2021
2431d81
Merge branch 'main' into zomars/cal-748-paid-bookings-are-failing
kodiakhq[bot] Dec 17, 2021
720bb6b
Merge branch 'main' into zomars/cal-748-paid-bookings-are-failing
kodiakhq[bot] Dec 17, 2021
1a2e77b
Merge branch 'main' into zomars/cal-748-paid-bookings-are-failing
kodiakhq[bot] Dec 17, 2021
73a2cf5
Ignores all .env files
zomars Dec 17, 2021
a28b73c
Uses playwright server
zomars Dec 17, 2021
951d2e1
Revert "removed empty language files, triyng to debug crowdin (#1341)"
zomars Dec 17, 2021
db5a61b
Merge branch 'main' into zomars/cal-748-paid-bookings-are-failing
kodiakhq[bot] Dec 17, 2021
23e3db4
Sets e2e reporter as list
zomars Dec 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Matches app locale to Stripe's
  • Loading branch information
zomars committed Dec 16, 2021
commit b432c4f81434a8fcff4058a8d032a6917951568f
24 changes: 14 additions & 10 deletions ee/components/stripe/Payment.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { CardElement, useStripe, useElements } from "@stripe/react-stripe-js";
import { StripeCardElementChangeEvent } from "@stripe/stripe-js";
import { CardElement, useElements, useStripe } from "@stripe/react-stripe-js";
import stripejs, { StripeCardElementChangeEvent, StripeElementLocale } from "@stripe/stripe-js";
import { useRouter } from "next/router";
import { stringify } from "querystring";
import React, { useState } from "react";
import { SyntheticEvent } from "react";
import React, { SyntheticEvent, useEffect, useState } from "react";

import { PaymentData } from "@ee/lib/stripe/server";

Expand All @@ -12,7 +11,7 @@ import { useLocale } from "@lib/hooks/useLocale";

import Button from "@components/ui/Button";

const CARD_OPTIONS = {
const CARD_OPTIONS: stripejs.StripeCardElementOptions = {
iconStyle: "solid" as const,
classes: {
base: "block p-2 w-full border-solid border-2 border-gray-300 rounded-md shadow-sm dark:bg-brand dark:text-brandcontrast dark:border-gray-900 focus-within:ring-black focus-within:border-brand sm:text-sm",
Expand All @@ -29,7 +28,7 @@ const CARD_OPTIONS = {
},
},
},
};
} as const;

type Props = {
payment: {
Expand All @@ -47,18 +46,23 @@ type States =
| { status: "ok" };

export default function PaymentComponent(props: Props) {
const { t } = useLocale();
const { t, i18n } = useLocale();
const router = useRouter();
const { name, date } = router.query;
const [state, setState] = useState<States>({ status: "idle" });
const stripe = useStripe();
const elements = useElements();

const { isDarkMode } = useDarkMode();

useEffect(() => {
elements?.update({ locale: i18n.language as StripeElementLocale });
}, [elements, i18n.language]);

if (isDarkMode) {
CARD_OPTIONS.style.base.color = "#fff";
CARD_OPTIONS.style.base.iconColor = "#fff";
CARD_OPTIONS.style.base["::placeholder"].color = "#fff";
CARD_OPTIONS.style!.base!.color = "#fff";
CARD_OPTIONS.style!.base!.iconColor = "#fff";
CARD_OPTIONS.style!.base!["::placeholder"]!.color = "#fff";
}

const handleChange = async (event: StripeCardElementChangeEvent) => {
Expand Down