Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 3 additions & 13 deletions auth-api/src/auth_api/services/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
get_product_notification_data,
get_product_notification_type,
)
from auth_api.utils.pay import get_account_fees_dict
from auth_api.utils.roles import CLIENT_ADMIN_ROLES, CLIENT_AUTH_ROLES, GOV_ORG_TYPES, STAFF
from auth_api.utils.user_context import UserContext, user_context

Expand Down Expand Up @@ -171,7 +170,7 @@ def _is_previously_approved(org_id: int, product_code: str):
)
if task is None or (
task.relationship_status != TaskRelationshipStatus.ACTIVE.value
and task.action == TaskAction.PRODUCT_REVIEW.value
and task.action in (TaskAction.PRODUCT_REVIEW.value, TaskAction.NEW_PRODUCT_FEE_REVIEW.value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't look redundant, looks like a bug fix ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I just realized if I add it here then I don't need pay service

):
return False, None

Expand All @@ -197,8 +196,6 @@ def create_product_subscription(
if not skip_auth:
check_auth(one_of_roles=(*CLIENT_ADMIN_ROLES, STAFF), org_id=org_id)

account_fees_dict = get_account_fees_dict(org)

subscriptions_list = subscription_data.get("subscriptions")
for subscription in subscriptions_list:
product_code = subscription.get("productCode")
Expand All @@ -214,7 +211,7 @@ def create_product_subscription(
auto_approve = True

subscription_status = Product.find_subscription_status(
org, product_model, account_fees_dict, auto_approve
org, product_model, auto_approve
)
product_subscription = Product._subscribe_and_publish_activity(
SubscriptionRequest(
Expand Down Expand Up @@ -404,15 +401,8 @@ def _create_review_task(review_task: ProductReviewTask):
@staticmethod
def find_subscription_status(org, product_model, account_fees_dict, auto_approve=False):
"""Return the subscriptions status based on org type."""
required_review_types = GOV_ORG_TYPES

needs_review = (
org.access_type in required_review_types and account_fees_dict.get(product_model.code, False)
) or (product_model.need_review and not auto_approve)

if needs_review:
if not auto_approve and (org.access_type in GOV_ORG_TYPES or product_model.need_review):
return ProductSubscriptionStatus.PENDING_STAFF_REVIEW.value

return ProductSubscriptionStatus.ACTIVE.value

@staticmethod
Expand Down
48 changes: 0 additions & 48 deletions auth-api/src/auth_api/utils/pay.py

This file was deleted.

48 changes: 0 additions & 48 deletions auth-api/tests/unit/utils/test_pay.py

This file was deleted.

Loading