in support-frontend/app/utils/CheckoutValidationRules.scala [59:85]
def checkContributionPaymentMethodEnabled(
switches: RecurringPaymentMethodSwitches,
paymentFields: PaymentFields,
) = paymentFields match {
case _: PayPalPaymentFields =>
if (switches.payPal.contains(On)) Valid else Invalid("Invalid Payment Method")
case _: DirectDebitPaymentFields =>
if (switches.directDebit.contains(On)) Valid else Invalid("Invalid Payment Method")
case _: SepaPaymentFields =>
if (switches.sepa.contains(On)) Valid else Invalid("Invalid Payment Method")
case _: StripeHostedPaymentFields =>
if (switches.stripeHostedCheckout.contains(On)) Valid else Invalid("Invalid Payment Method")
case s: StripePaymentFields =>
s.stripePaymentType match {
case Some(StripePaymentType.StripeApplePay) =>
if (switches.stripeApplePay.contains(On)) Valid else Invalid("Invalid Payment Method")
case Some(StripePaymentType.StripePaymentRequestButton) =>
if (switches.stripePaymentRequestButton.contains(On)) Valid else Invalid("Invalid Payment Method")
case Some(StripePaymentType.StripeCheckout) =>
if (switches.stripe.contains(On)) Valid else Invalid("Invalid Payment Method")
case None => Invalid("Invalid Payment Method")
}
case _: ExistingPaymentFields =>
// Return Valid for all existing payments because we can't tell whether the user has a direct debit or card but,
// there are separate switches in the switchboards(RRCP-Reader Revenue Control Panel) for these
Valid
}