|
1 | 1 | using Bit.Core.AdminConsole.Entities;
|
2 | 2 | using Bit.Core.AdminConsole.OrganizationFeatures.Organizations;
|
3 | 3 | using Bit.Core.Billing.Enums;
|
| 4 | +using Bit.Core.Billing.Models.Sales; |
| 5 | +using Bit.Core.Billing.Services; |
4 | 6 | using Bit.Core.Entities;
|
5 | 7 | using Bit.Core.Enums;
|
6 | 8 | using Bit.Core.Exceptions;
|
7 | 9 | using Bit.Core.Models.Business;
|
8 | 10 | using Bit.Core.Models.Data;
|
9 |
| -using Bit.Core.Models.StaticStore; |
10 | 11 | using Bit.Core.Repositories;
|
11 |
| -using Bit.Core.Services; |
12 | 12 | using Bit.Core.Tools.Enums;
|
13 | 13 | using Bit.Core.Tools.Models.Business;
|
14 | 14 | using Bit.Core.Tools.Services;
|
@@ -60,20 +60,16 @@ await sutProvider.GetDependency<IReferenceEventService>().Received(1)
|
60 | 60 | Assert.NotNull(result.Organization);
|
61 | 61 | Assert.NotNull(result.OrganizationUser);
|
62 | 62 |
|
63 |
| - await sutProvider.GetDependency<IPaymentService>().Received(1).PurchaseOrganizationAsync( |
64 |
| - Arg.Any<Organization>(), |
65 |
| - signup.PaymentMethodType.Value, |
66 |
| - signup.PaymentToken, |
67 |
| - plan, |
68 |
| - signup.AdditionalStorageGb, |
69 |
| - signup.AdditionalSeats, |
70 |
| - signup.PremiumAccessAddon, |
71 |
| - signup.TaxInfo, |
72 |
| - false, |
73 |
| - signup.AdditionalSmSeats.GetValueOrDefault(), |
74 |
| - signup.AdditionalServiceAccounts.GetValueOrDefault(), |
75 |
| - signup.UseSecretsManager |
76 |
| - ); |
| 63 | + await sutProvider.GetDependency<IOrganizationBillingService>().Received(1).Finalize( |
| 64 | + Arg.Is<OrganizationSale>(sale => |
| 65 | + sale.CustomerSetup.TokenizedPaymentSource.Type == signup.PaymentMethodType.Value && |
| 66 | + sale.CustomerSetup.TokenizedPaymentSource.Token == signup.PaymentToken && |
| 67 | + sale.CustomerSetup.TaxInformation.Country == signup.TaxInfo.BillingAddressCountry && |
| 68 | + sale.CustomerSetup.TaxInformation.PostalCode == signup.TaxInfo.BillingAddressPostalCode && |
| 69 | + sale.SubscriptionSetup.Plan == plan && |
| 70 | + sale.SubscriptionSetup.PasswordManagerOptions.Seats == signup.AdditionalSeats && |
| 71 | + sale.SubscriptionSetup.PasswordManagerOptions.Storage == signup.AdditionalStorageGb && |
| 72 | + sale.SubscriptionSetup.SecretsManagerOptions == null)); |
77 | 73 | }
|
78 | 74 |
|
79 | 75 | [Theory]
|
@@ -155,20 +151,17 @@ await sutProvider.GetDependency<IReferenceEventService>().Received(1)
|
155 | 151 | Assert.NotNull(result.Organization);
|
156 | 152 | Assert.NotNull(result.OrganizationUser);
|
157 | 153 |
|
158 |
| - await sutProvider.GetDependency<IPaymentService>().Received(1).PurchaseOrganizationAsync( |
159 |
| - Arg.Any<Organization>(), |
160 |
| - signup.PaymentMethodType.Value, |
161 |
| - signup.PaymentToken, |
162 |
| - Arg.Is<Plan>(plan), |
163 |
| - signup.AdditionalStorageGb, |
164 |
| - signup.AdditionalSeats, |
165 |
| - signup.PremiumAccessAddon, |
166 |
| - signup.TaxInfo, |
167 |
| - false, |
168 |
| - signup.AdditionalSmSeats.GetValueOrDefault(), |
169 |
| - signup.AdditionalServiceAccounts.GetValueOrDefault(), |
170 |
| - signup.IsFromSecretsManagerTrial |
171 |
| - ); |
| 154 | + await sutProvider.GetDependency<IOrganizationBillingService>().Received(1).Finalize( |
| 155 | + Arg.Is<OrganizationSale>(sale => |
| 156 | + sale.CustomerSetup.TokenizedPaymentSource.Type == signup.PaymentMethodType.Value && |
| 157 | + sale.CustomerSetup.TokenizedPaymentSource.Token == signup.PaymentToken && |
| 158 | + sale.CustomerSetup.TaxInformation.Country == signup.TaxInfo.BillingAddressCountry && |
| 159 | + sale.CustomerSetup.TaxInformation.PostalCode == signup.TaxInfo.BillingAddressPostalCode && |
| 160 | + sale.SubscriptionSetup.Plan == plan && |
| 161 | + sale.SubscriptionSetup.PasswordManagerOptions.Seats == signup.AdditionalSeats && |
| 162 | + sale.SubscriptionSetup.PasswordManagerOptions.Storage == signup.AdditionalStorageGb && |
| 163 | + sale.SubscriptionSetup.SecretsManagerOptions.Seats == signup.AdditionalSmSeats && |
| 164 | + sale.SubscriptionSetup.SecretsManagerOptions.ServiceAccounts == signup.AdditionalServiceAccounts)); |
172 | 165 | }
|
173 | 166 |
|
174 | 167 | [Theory]
|
|
0 commit comments