Skip to content

Commit

Permalink
Add in feature flag remove-premium-restrictions (#3129)
Browse files Browse the repository at this point in the history
  • Loading branch information
seeker25 authored Oct 29, 2024
1 parent 509b67a commit fa0b793
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion auth-api/src/auth_api/services/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions auth-api/src/auth_api/services/validators/payment_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fa0b793

Please sign in to comment.