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

Bugfix/new donation flow issues #1962

Merged
4 changes: 2 additions & 2 deletions public/locales/en/donation-flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
},
"noregister": {
"label": "Continue without registration",
"description": "You will not be able to get a donation certificate or a list of your donations. If you still want to receive a receipt, please share your email - it will not be visible in the platform"
"description": "You will not be able to get a donation certificate or a list of your donations. If you still want to receive a receipt, please share your email - it will not be visible in the platform."
},
"field": {
"password": "Password",
Expand All @@ -128,7 +128,7 @@
"donation": "Donation",
"transaction": {
"title": "Transaction",
"description": "The transaction is only to compensate the transfer and is calculated based on your method of payment. \"Podkrepi.bg\" works with 0% commission"
"description": "The transaction is only to compensate the transfer and is calculated based on your method of payment. \"Podkrepi.bg\" works with 0% commission."
},
"total": "Total",
"field": {
Expand Down
6 changes: 3 additions & 3 deletions src/components/client/donation-flow/DonationFlowForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,15 @@ export function DonationFlowForm() {
<ConfirmationDialog
isOpen={showCancelDialog}
handleCancel={() => {
cancelSetupIntentMutation.mutate({ id: setupIntent.id })
router.push(routes.campaigns.viewCampaignBySlug(campaign.slug))
setShowCancelDialog(false)
}}
title={t('cancel-dialog.title')}
content={t('cancel-dialog.content')}
confirmButtonLabel={t('cancel-dialog.btn-continue')}
cancelButtonLabel={t('cancel-dialog.btn-cancel')}
handleConfirm={() => {
setShowCancelDialog(false)
cancelSetupIntentMutation.mutate({ id: setupIntent.id })
router.push(routes.campaigns.viewCampaignBySlug(campaign.slug))
}}
/>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export default function DonationFlowStatusPage({ slug }: { slug: string }) {
text={t('status.success.link.return')}
/>
</Grid2>
<Grid2>
<Grid2 size={{ xs: 12, md: 6 }}>
<LinkCard href={routes.campaigns.index} text={t('status.success.link.see')} />
</Grid2>
<Grid2 size={{ xs: 12, md: 6 }}>
Expand Down
5 changes: 4 additions & 1 deletion src/components/client/donation-flow/steps/Amount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const amountValidation = {
then: yup.string().required(),
}),
finalAmount: yup.number().when('payment', {
is: 'card',
is: (payment: string | null) => ['card', null].includes(payment),
then: () =>
yup.number().min(1, 'donation-flow:step.amount.field.final-amount.error').required(),
}),
Expand Down Expand Up @@ -70,6 +70,9 @@ export default function Amount({ disabled, sectionRef, error }: SelectDonationAm
? toMoney(Number(formik.values.otherAmount))
: Number(formik.values.amountChosen)

// Do not perform calculations if amount is not set
if (amountChosen === 0) return

if (formik.values.cardIncludeFees) {
formik.setFieldValue('amountWithoutFees', amountChosen)
formik.setFieldValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ export default function InlineRegisterForm() {
</FormHelperText>
)}
</Grid>
<Grid item xs={12}>
<AcceptTermsField name="registerTerms" />
<AcceptPrivacyPolicyField name="registerGdpr" />
</Grid>

<Grid item xs={12}>
<Button
Expand Down
7 changes: 6 additions & 1 deletion src/components/common/form/AcceptPrivacyPolicyField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useTranslation } from 'next-i18next'
import { Typography } from '@mui/material'
import { useRouter } from 'next/router'

import { routes } from 'common/routes'
import ExternalLink from 'components/common/ExternalLink'
Expand All @@ -18,6 +19,8 @@ export default function AcceptPrivacyPolicyField({
...rest
}: AcceptGDPRFieldProps) {
const { t } = useTranslation()
const { locale } = useRouter()

return (
<CheckboxField
name={name}
Expand All @@ -26,7 +29,9 @@ export default function AcceptPrivacyPolicyField({
label={
<Typography variant="body2">
{t('validation:informed-agree-with')}{' '}
<ExternalLink href={routes.privacyPolicy}>{t('validation:gdpr')}</ExternalLink>
<ExternalLink href={`/${locale}${routes.privacyPolicy}`}>
{t('validation:gdpr')}
</ExternalLink>
</Typography>
}
{...rest}
Expand Down
Loading