1- #nullable enable
2-
3- using Bit . Api . Models . Request ;
1+ using Bit . Api . Models . Request ;
42using Bit . Api . Models . Request . Accounts ;
53using Bit . Api . Models . Response ;
64using Bit . Api . Utilities ;
@@ -29,6 +27,7 @@ public class AccountsController(
2927 IFeatureService featureService ,
3028 ILicensingService licensingService ) : Controller
3129{
30+ // TODO: Remove when pm-24996-implement-upgrade-from-free-dialog is removed
3231 [ HttpPost ( "premium" ) ]
3332 public async Task < PaymentResponseModel > PostPremiumAsync (
3433 PremiumRequestModel model ,
@@ -76,6 +75,7 @@ public async Task<PaymentResponseModel> PostPremiumAsync(
7675 } ;
7776 }
7877
78+ // TODO: Migrate to Query / AccountBillingVNextController as part of Premium -> Organization upgrade work.
7979 [ HttpGet ( "subscription" ) ]
8080 public async Task < SubscriptionResponseModel > GetSubscriptionAsync (
8181 [ FromServices ] GlobalSettings globalSettings ,
@@ -114,29 +114,7 @@ public async Task<SubscriptionResponseModel> GetSubscriptionAsync(
114114 }
115115 }
116116
117- [ HttpPost ( "payment" ) ]
118- [ SelfHosted ( NotSelfHostedOnly = true ) ]
119- public async Task PostPaymentAsync ( [ FromBody ] PaymentRequestModel model )
120- {
121- var user = await userService . GetUserByPrincipalAsync ( User ) ;
122- if ( user == null )
123- {
124- throw new UnauthorizedAccessException ( ) ;
125- }
126-
127- await userService . ReplacePaymentMethodAsync ( user , model . PaymentToken , model . PaymentMethodType ! . Value ,
128- new TaxInfo
129- {
130- BillingAddressLine1 = model . Line1 ,
131- BillingAddressLine2 = model . Line2 ,
132- BillingAddressCity = model . City ,
133- BillingAddressState = model . State ,
134- BillingAddressCountry = model . Country ,
135- BillingAddressPostalCode = model . PostalCode ,
136- TaxIdNumber = model . TaxId
137- } ) ;
138- }
139-
117+ // TODO: Migrate to Command / AccountBillingVNextController as PUT /account/billing/vnext/subscription
140118 [ HttpPost ( "storage" ) ]
141119 [ SelfHosted ( NotSelfHostedOnly = true ) ]
142120 public async Task < PaymentResponseModel > PostStorageAsync ( [ FromBody ] StorageRequestModel model )
@@ -151,8 +129,11 @@ public async Task<PaymentResponseModel> PostStorageAsync([FromBody] StorageReque
151129 return new PaymentResponseModel { Success = true , PaymentIntentClientSecret = result } ;
152130 }
153131
154-
155-
132+ /*
133+ * TODO: A new version of this exists in the AccountBillingVNextController.
134+ * The individual-self-hosting-license-uploader.component needs to be updated to use it.
135+ * Then, this can be removed.
136+ */
156137 [ HttpPost ( "license" ) ]
157138 [ SelfHosted ( SelfHostedOnly = true ) ]
158139 public async Task PostLicenseAsync ( LicenseRequestModel model )
@@ -172,6 +153,7 @@ public async Task PostLicenseAsync(LicenseRequestModel model)
172153 await userService . UpdateLicenseAsync ( user , license ) ;
173154 }
174155
156+ // TODO: Migrate to Command / AccountBillingVNextController as DELETE /account/billing/vnext/subscription
175157 [ HttpPost ( "cancel" ) ]
176158 public async Task PostCancelAsync (
177159 [ FromBody ] SubscriptionCancellationRequestModel request ,
@@ -189,6 +171,7 @@ await subscriberService.CancelSubscription(user,
189171 user . IsExpired ( ) ) ;
190172 }
191173
174+ // TODO: Migrate to Command / AccountBillingVNextController as POST /account/billing/vnext/subscription/reinstate
192175 [ HttpPost ( "reinstate-premium" ) ]
193176 [ SelfHosted ( NotSelfHostedOnly = true ) ]
194177 public async Task PostReinstateAsync ( )
@@ -202,41 +185,6 @@ public async Task PostReinstateAsync()
202185 await userService . ReinstatePremiumAsync ( user ) ;
203186 }
204187
205- [ HttpGet ( "tax" ) ]
206- [ SelfHosted ( NotSelfHostedOnly = true ) ]
207- public async Task < TaxInfoResponseModel > GetTaxInfoAsync (
208- [ FromServices ] IPaymentService paymentService )
209- {
210- var user = await userService . GetUserByPrincipalAsync ( User ) ;
211- if ( user == null )
212- {
213- throw new UnauthorizedAccessException ( ) ;
214- }
215-
216- var taxInfo = await paymentService . GetTaxInfoAsync ( user ) ;
217- return new TaxInfoResponseModel ( taxInfo ) ;
218- }
219-
220- [ HttpPut ( "tax" ) ]
221- [ SelfHosted ( NotSelfHostedOnly = true ) ]
222- public async Task PutTaxInfoAsync (
223- [ FromBody ] TaxInfoUpdateRequestModel model ,
224- [ FromServices ] IPaymentService paymentService )
225- {
226- var user = await userService . GetUserByPrincipalAsync ( User ) ;
227- if ( user == null )
228- {
229- throw new UnauthorizedAccessException ( ) ;
230- }
231-
232- var taxInfo = new TaxInfo
233- {
234- BillingAddressPostalCode = model . PostalCode ,
235- BillingAddressCountry = model . Country ,
236- } ;
237- await paymentService . SaveTaxInfoAsync ( user , taxInfo ) ;
238- }
239-
240188 private async Task < IEnumerable < Guid > > GetOrganizationIdsClaimingUserAsync ( Guid userId )
241189 {
242190 var organizationsClaimingUser = await userService . GetOrganizationsClaimingUserAsync ( userId ) ;
0 commit comments