@@ -67,6 +67,17 @@ public SubscriptionController(IDepartmentsService departmentsService, IUsersServ
6767
6868 #endregion Private Members and Constructors
6969
70+ private static bool ShouldUsePaddleForSubscriptionFlow ( Payment currentPayment , string paddleCustomerId )
71+ {
72+ if ( ! string . IsNullOrWhiteSpace ( paddleCustomerId ) )
73+ return true ;
74+
75+ if ( currentPayment != null && ! currentPayment . IsFreePlan ( ) )
76+ return currentPayment . Method == ( int ) PaymentMethods . Paddle ;
77+
78+ return Config . PaymentProviderConfig . IsPaddleActive ( ) ;
79+ }
80+
7081 [ HttpGet ]
7182 [ Authorize ]
7283 public async Task < IActionResult > SelectRegistrationPlan ( string discountCode = null )
@@ -81,7 +92,7 @@ public async Task<IActionResult> SelectRegistrationPlan(string discountCode = nu
8192 model . DiscountCode = discountCode ;
8293
8394 var paddleCustomerId = await _departmentSettingsService . GetPaddleCustomerIdForDepartmentAsync ( DepartmentId ) ;
84- bool isPaddleDepartment = ! string . IsNullOrWhiteSpace ( paddleCustomerId ) ;
95+ bool isPaddleDepartment = ShouldUsePaddleForSubscriptionFlow ( currentPayment , paddleCustomerId ) ;
8596 model . IsPaddleDepartment = isPaddleDepartment ;
8697 model . PaddleEnvironment = Config . PaymentProviderConfig . GetPaddleEnvironment ( ) ;
8798 model . PaddleClientToken = Config . PaymentProviderConfig . GetPaddleClientToken ( ) ;
@@ -232,8 +243,7 @@ public async Task<IActionResult> Index()
232243 model . AddonCost = "0" ;
233244
234245 var paddleCustomerId = await _departmentSettingsService . GetPaddleCustomerIdForDepartmentAsync ( DepartmentId ) ;
235- bool isPaddleDepartment = ! string . IsNullOrWhiteSpace ( paddleCustomerId )
236- || ( model . Payment != null && model . Payment . Method == ( int ) PaymentMethods . Paddle ) ;
246+ bool isPaddleDepartment = ShouldUsePaddleForSubscriptionFlow ( model . Payment , paddleCustomerId ) ;
237247 model . IsPaddleDepartment = isPaddleDepartment ;
238248
239249 if ( isPaddleDepartment )
0 commit comments