mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[AC 482]automatically apply discounts to provider portal orgs (#2801)
* Adding discount coupon on provider org creation * Change the provider discount Id * Fixing the whitespace format * Remove discount at subscription and apply to customer * resolving a failing test * Remove white spaces
This commit is contained in:
@ -10,7 +10,7 @@ public interface IPaymentService
|
||||
Task CancelAndRecoverChargesAsync(ISubscriber subscriber);
|
||||
Task<string> PurchaseOrganizationAsync(Organization org, PaymentMethodType paymentMethodType,
|
||||
string paymentToken, Plan plan, short additionalStorageGb, int additionalSeats,
|
||||
bool premiumAccessAddon, TaxInfo taxInfo);
|
||||
bool premiumAccessAddon, TaxInfo taxInfo, bool provider = false);
|
||||
Task SponsorOrganizationAsync(Organization org, OrganizationSponsorship sponsorship);
|
||||
Task RemoveOrganizationSponsorshipAsync(Organization org, OrganizationSponsorship sponsorship);
|
||||
Task<string> UpgradeFreeOrganizationAsync(Organization org, Plan plan,
|
||||
|
@ -664,7 +664,7 @@ public class OrganizationService : IOrganizationService
|
||||
{
|
||||
await _paymentService.PurchaseOrganizationAsync(organization, signup.PaymentMethodType.Value,
|
||||
signup.PaymentToken, plan, signup.AdditionalStorageGb, signup.AdditionalSeats,
|
||||
signup.PremiumAccessAddon, signup.TaxInfo);
|
||||
signup.PremiumAccessAddon, signup.TaxInfo, provider);
|
||||
}
|
||||
|
||||
var ownerId = provider ? default : signup.Owner.Id;
|
||||
|
@ -16,6 +16,7 @@ public class StripePaymentService : IPaymentService
|
||||
private const string PremiumPlanAppleIapId = "premium-annually-appleiap";
|
||||
private const decimal PremiumPlanAppleIapPrice = 14.99M;
|
||||
private const string StoragePlanId = "storage-gb-annually";
|
||||
private const string ProviderDiscountId = "msp-discount-35";
|
||||
|
||||
private readonly ITransactionRepository _transactionRepository;
|
||||
private readonly IUserRepository _userRepository;
|
||||
@ -45,7 +46,7 @@ public class StripePaymentService : IPaymentService
|
||||
|
||||
public async Task<string> PurchaseOrganizationAsync(Organization org, PaymentMethodType paymentMethodType,
|
||||
string paymentToken, StaticStore.Plan plan, short additionalStorageGb,
|
||||
int additionalSeats, bool premiumAccessAddon, TaxInfo taxInfo)
|
||||
int additionalSeats, bool premiumAccessAddon, TaxInfo taxInfo, bool provider = false)
|
||||
{
|
||||
Braintree.Customer braintreeCustomer = null;
|
||||
string stipeCustomerSourceToken = null;
|
||||
@ -134,7 +135,7 @@ public class StripePaymentService : IPaymentService
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Coupon = provider ? ProviderDiscountId : null,
|
||||
Address = new Stripe.AddressOptions
|
||||
{
|
||||
Country = taxInfo.BillingAddressCountry,
|
||||
|
Reference in New Issue
Block a user