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

1248 - Add locale to stripe return urls #1250

Merged
Changes from all commits
Commits
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
11 changes: 7 additions & 4 deletions src/components/one-time-donation/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ interface DonationStepperProps {
}

export default function DonationStepper({ onStepChange }: DonationStepperProps) {
const { t } = useTranslation('one-time-donation')
const { t, i18n } = useTranslation('one-time-donation')
const router = useRouter()
const success = router.query.success === 'true' ? true : false
initialValues.amount = (router.query.price as string) || ''
Expand All @@ -63,7 +63,6 @@ export default function DonationStepper({ onStepChange }: DonationStepperProps)
const { campaign } = data

const userEmail = session?.user?.email

const donate = React.useCallback(
async (amount?: number, values?: OneTimeDonation) => {
const { data } = await mutation.mutateAsync({
Expand All @@ -75,8 +74,12 @@ export default function DonationStepper({ onStepChange }: DonationStepperProps)
personEmail: values?.personsEmail ? values.personsEmail : userEmail,
isAnonymous: values?.isAnonymous !== undefined ? values.isAnonymous : true,
phone: values?.personsPhone ? values.personsPhone : null,
successUrl: `${baseUrl}${routes.campaigns.oneTimeDonation(campaign.slug)}?success=true`,
cancelUrl: `${baseUrl}${routes.campaigns.oneTimeDonation(campaign.slug)}?success=false`,
successUrl: `${baseUrl}/${i18n.language}/${routes.campaigns.oneTimeDonation(
campaign.slug,
)}?success=true`,
cancelUrl: `${baseUrl}/${i18n.language}/${routes.campaigns.oneTimeDonation(
campaign.slug,
)}?success=false`,
message: values?.message,
})
if (values?.payment === PaymentProvider.bank) {
Expand Down