From fa0b793333075eb98dfabe4c4590561fe87acf9c Mon Sep 17 00:00:00 2001 From: Travis Semple Date: Tue, 29 Oct 2024 09:59:01 -0700 Subject: [PATCH] Add in feature flag remove-premium-restrictions (#3129) --- auth-api/src/auth_api/services/products.py | 7 ++++++- .../src/auth_api/services/validators/payment_type.py | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/auth-api/src/auth_api/services/products.py b/auth-api/src/auth_api/services/products.py index eca62ee1d..e078dc3fe 100644 --- a/auth-api/src/auth_api/services/products.py +++ b/auth-api/src/auth_api/services/products.py @@ -30,6 +30,7 @@ from auth_api.models import db from auth_api.models.dataclass import Activity, KeycloakGroupSubscription, ProductReviewTask from auth_api.schemas import ProductCodeSchema +from auth_api.services.flags import flags from auth_api.services.keycloak import KeycloakService from auth_api.services.user import User as UserService from auth_api.utils.constants import BCOL_PROFILE_PRODUCT_MAP @@ -174,7 +175,11 @@ def create_product_subscription( if product_model.need_system_admin: check_auth(system_required=True, org_id=org_id) # Check if product needs premium account, if yes skip and continue. - if product_model.premium_only and org.type_code not in PREMIUM_ORG_TYPES: + if ( + flags.is_on("remove-premium-restrictions", default=False) is False + and product_model.premium_only + and org.type_code not in PREMIUM_ORG_TYPES + ): continue subscription_status = Product.find_subscription_status(org, product_model, auto_approve) diff --git a/auth-api/src/auth_api/services/validators/payment_type.py b/auth-api/src/auth_api/services/validators/payment_type.py index b50fa3d1a..c3af97390 100644 --- a/auth-api/src/auth_api/services/validators/payment_type.py +++ b/auth-api/src/auth_api/services/validators/payment_type.py @@ -15,6 +15,7 @@ from flask import current_app from auth_api.exceptions import BusinessException, Error +from auth_api.services.flags import flags from auth_api.services.validators.validator_response import ValidatorResponse from auth_api.utils.enums import AccessType, OrgType, PaymentMethod from auth_api.utils.user_context import user_context @@ -49,6 +50,16 @@ def validate(is_fatal=False, **kwargs) -> ValidatorResponse: OrgType.SBC_STAFF: non_ejv_payment_methods, OrgType.STAFF: non_ejv_payment_methods, } + if flags.is_on("remove-premium-restrictions", default=False) is True: + for k in org_payment_method_mapping: + org_payment_method_mapping[k] = ( + PaymentMethod.CREDIT_CARD.value, + PaymentMethod.DIRECT_PAY.value, + PaymentMethod.ONLINE_BANKING.value, + PaymentMethod.PAD.value, + PaymentMethod.BCOL.value, + PaymentMethod.EFT.value, + ) payment_type = None if access_type == AccessType.GOVM.value: payment_type = PaymentMethod.EJV.value