5656 get_product_notification_data ,
5757 get_product_notification_type ,
5858)
59- from auth_api .utils .pay import get_account_fees_dict
60- from auth_api .utils .roles import CLIENT_ADMIN_ROLES , CLIENT_AUTH_ROLES , GOV_ORG_TYPES , STAFF
59+ from auth_api .utils .roles import CLIENT_ADMIN_ROLES , CLIENT_AUTH_ROLES , STAFF
6160from auth_api .utils .user_context import UserContext , user_context
6261
6362from .activity_log_publisher import ActivityLogPublisher
@@ -197,8 +196,6 @@ def create_product_subscription(
197196 if not skip_auth :
198197 check_auth (one_of_roles = (* CLIENT_ADMIN_ROLES , STAFF ), org_id = org_id )
199198
200- account_fees_dict = get_account_fees_dict (org )
201-
202199 subscriptions_list = subscription_data .get ("subscriptions" )
203200 for subscription in subscriptions_list :
204201 product_code = subscription .get ("productCode" )
@@ -213,9 +210,7 @@ def create_product_subscription(
213210 if previously_approved :
214211 auto_approve = True
215212
216- subscription_status = Product .find_subscription_status (
217- org , product_model , account_fees_dict , auto_approve
218- )
213+ subscription_status = Product .find_subscription_status (org , product_model , auto_approve )
219214 product_subscription = Product ._subscribe_and_publish_activity (
220215 SubscriptionRequest (
221216 org_id = org_id ,
@@ -250,7 +245,6 @@ def create_product_subscription(
250245 ProductReviewTask (
251246 org_id = org .id ,
252247 org_name = org .name ,
253- org_access_type = org .access_type ,
254248 product_code = product_subscription .product_code ,
255249 product_description = product_model .description ,
256250 product_subscription_id = product_subscription .id ,
@@ -377,14 +371,11 @@ def _reset_subscription_and_review_task(
377371 @staticmethod
378372 def _create_review_task (review_task : ProductReviewTask ):
379373 task_type = review_task .product_description
380-
381- required_review_types = {AccessType .GOVM .value , AccessType .GOVN .value }
382- if review_task .product_code in QUALIFIED_SUPPLIER_PRODUCT_CODES :
383- action_type = TaskAction .QUALIFIED_SUPPLIER_REVIEW .value
384- elif review_task .org_access_type in required_review_types :
385- action_type = TaskAction .NEW_PRODUCT_FEE_REVIEW .value
386- else :
387- action_type = TaskAction .PRODUCT_REVIEW .value
374+ action_type = (
375+ TaskAction .QUALIFIED_SUPPLIER_REVIEW .value
376+ if review_task .product_code in QUALIFIED_SUPPLIER_PRODUCT_CODES
377+ else TaskAction .PRODUCT_REVIEW .value
378+ )
388379
389380 task_info = {
390381 "name" : review_task .org_name ,
@@ -402,17 +393,16 @@ def _create_review_task(review_task: ProductReviewTask):
402393 TaskService .create_task (task_info , False )
403394
404395 @staticmethod
405- def find_subscription_status (org , product_model , account_fees_dict , auto_approve = False ):
396+ def find_subscription_status (org , product_model , auto_approve = False ):
406397 """Return the subscriptions status based on org type."""
407- required_review_types = GOV_ORG_TYPES
408-
409- needs_review = (
410- org .access_type in required_review_types and account_fees_dict .get (product_model .code , False )
411- ) or (product_model .need_review and not auto_approve )
412-
413- if needs_review :
414- return ProductSubscriptionStatus .PENDING_STAFF_REVIEW .value
415-
398+ # GOVM accounts has default active subscriptions
399+ skip_review_types = [AccessType .GOVM .value ]
400+ if product_model .need_review and auto_approve is False :
401+ return (
402+ ProductSubscriptionStatus .ACTIVE .value
403+ if (org .access_type in skip_review_types )
404+ else ProductSubscriptionStatus .PENDING_STAFF_REVIEW .value
405+ )
416406 return ProductSubscriptionStatus .ACTIVE .value
417407
418408 @staticmethod
@@ -489,7 +479,7 @@ def update_product_subscription(product_sub_info: ProductSubscriptionInfo, is_ne
489479 is_approved = product_sub_info .is_approved
490480 is_hold = product_sub_info .is_hold
491481 org_id = product_sub_info .org_id
492- org_name = product_sub_info . org_name
482+
493483 # Approve/Reject Product subscription
494484 product_subscription : ProductSubscriptionModel = ProductSubscriptionModel .find_by_id (product_subscription_id )
495485
@@ -518,8 +508,6 @@ def update_product_subscription(product_sub_info: ProductSubscriptionInfo, is_ne
518508 product_sub_model = product_subscription ,
519509 is_reapproved = is_reapproved ,
520510 remarks = product_sub_info .task_remarks ,
521- org_id = org_id ,
522- org_name = org_name ,
523511 )
524512 )
525513
0 commit comments