mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
rename billing classes
This commit is contained in:
@ -115,7 +115,7 @@ namespace Bit.Core.Models.Api
|
|||||||
|
|
||||||
public class BillingInvoiceInfo
|
public class BillingInvoiceInfo
|
||||||
{
|
{
|
||||||
public BillingInvoiceInfo(BillingInfo.BillingInvoice inv)
|
public BillingInvoiceInfo(BillingInfo.BillingInvoiceInfo inv)
|
||||||
{
|
{
|
||||||
Amount = inv.Amount;
|
Amount = inv.Amount;
|
||||||
Date = inv.Date;
|
Date = inv.Date;
|
||||||
@ -127,7 +127,7 @@ namespace Bit.Core.Models.Api
|
|||||||
|
|
||||||
public class BillingInvoice : BillingInvoiceInfo
|
public class BillingInvoice : BillingInvoiceInfo
|
||||||
{
|
{
|
||||||
public BillingInvoice(BillingInfo.BillingInvoice2 inv)
|
public BillingInvoice(BillingInfo.BillingInvoice inv)
|
||||||
: base(inv)
|
: base(inv)
|
||||||
{
|
{
|
||||||
Url = inv.Url;
|
Url = inv.Url;
|
||||||
|
@ -12,9 +12,9 @@ namespace Bit.Core.Models.Business
|
|||||||
public decimal CreditAmount { get; set; }
|
public decimal CreditAmount { get; set; }
|
||||||
public BillingSource PaymentSource { get; set; }
|
public BillingSource PaymentSource { get; set; }
|
||||||
public BillingSubscription Subscription { get; set; }
|
public BillingSubscription Subscription { get; set; }
|
||||||
public BillingInvoice UpcomingInvoice { get; set; }
|
public BillingInvoiceInfo UpcomingInvoice { get; set; }
|
||||||
public IEnumerable<BillingCharge> Charges { get; set; } = new List<BillingCharge>();
|
public IEnumerable<BillingCharge> Charges { get; set; } = new List<BillingCharge>();
|
||||||
public IEnumerable<BillingInvoice2> Invoices { get; set; } = new List<BillingInvoice2>();
|
public IEnumerable<BillingInvoice> Invoices { get; set; } = new List<BillingInvoice>();
|
||||||
public IEnumerable<BillingTransaction> Transactions { get; set; } = new List<BillingTransaction>();
|
public IEnumerable<BillingTransaction> Transactions { get; set; } = new List<BillingTransaction>();
|
||||||
|
|
||||||
public class BillingSource
|
public class BillingSource
|
||||||
@ -194,17 +194,17 @@ namespace Bit.Core.Models.Business
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BillingInvoice
|
public class BillingInvoiceInfo
|
||||||
{
|
{
|
||||||
public BillingInvoice() { }
|
public BillingInvoiceInfo() { }
|
||||||
|
|
||||||
public BillingInvoice(Invoice inv)
|
public BillingInvoiceInfo(Invoice inv)
|
||||||
{
|
{
|
||||||
Amount = inv.AmountDue / 100M;
|
Amount = inv.AmountDue / 100M;
|
||||||
Date = inv.Date.Value;
|
Date = inv.Date.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BillingInvoice(Braintree.Subscription sub)
|
public BillingInvoiceInfo(Braintree.Subscription sub)
|
||||||
{
|
{
|
||||||
Amount = sub.NextBillAmount.GetValueOrDefault() + sub.Balance.GetValueOrDefault();
|
Amount = sub.NextBillAmount.GetValueOrDefault() + sub.Balance.GetValueOrDefault();
|
||||||
if(Amount < 0)
|
if(Amount < 0)
|
||||||
@ -309,9 +309,9 @@ namespace Bit.Core.Models.Business
|
|||||||
public string Details { get; set; }
|
public string Details { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BillingInvoice2 : BillingInvoice
|
public class BillingInvoice : BillingInvoiceInfo
|
||||||
{
|
{
|
||||||
public BillingInvoice2(Invoice inv)
|
public BillingInvoice(Invoice inv)
|
||||||
{
|
{
|
||||||
Url = inv.HostedInvoiceUrl;
|
Url = inv.HostedInvoiceUrl;
|
||||||
PdfUrl = inv.InvoicePdf;
|
PdfUrl = inv.InvoicePdf;
|
||||||
|
@ -17,7 +17,7 @@ namespace Bit.Core.Services
|
|||||||
Task ReinstateSubscriptionAsync(ISubscriber subscriber);
|
Task ReinstateSubscriptionAsync(ISubscriber subscriber);
|
||||||
Task<bool> UpdatePaymentMethodAsync(ISubscriber subscriber, PaymentMethodType paymentMethodType,
|
Task<bool> UpdatePaymentMethodAsync(ISubscriber subscriber, PaymentMethodType paymentMethodType,
|
||||||
string paymentToken);
|
string paymentToken);
|
||||||
Task<BillingInfo.BillingInvoice> GetUpcomingInvoiceAsync(ISubscriber subscriber);
|
Task<BillingInfo.BillingInvoiceInfo> GetUpcomingInvoiceAsync(ISubscriber subscriber);
|
||||||
Task<BillingInfo> GetBillingAsync(ISubscriber subscriber);
|
Task<BillingInfo> GetBillingAsync(ISubscriber subscriber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -884,7 +884,7 @@ namespace Bit.Core.Services
|
|||||||
return createdCustomer;
|
return createdCustomer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<BillingInfo.BillingInvoice> GetUpcomingInvoiceAsync(ISubscriber subscriber)
|
public async Task<BillingInfo.BillingInvoiceInfo> GetUpcomingInvoiceAsync(ISubscriber subscriber)
|
||||||
{
|
{
|
||||||
if(!string.IsNullOrWhiteSpace(subscriber.GatewaySubscriptionId))
|
if(!string.IsNullOrWhiteSpace(subscriber.GatewaySubscriptionId))
|
||||||
{
|
{
|
||||||
@ -903,7 +903,7 @@ namespace Bit.Core.Services
|
|||||||
});
|
});
|
||||||
if(upcomingInvoice != null)
|
if(upcomingInvoice != null)
|
||||||
{
|
{
|
||||||
return new BillingInfo.BillingInvoice(upcomingInvoice);
|
return new BillingInfo.BillingInvoiceInfo(upcomingInvoice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(StripeException) { }
|
catch(StripeException) { }
|
||||||
@ -985,7 +985,7 @@ namespace Bit.Core.Services
|
|||||||
Limit = 20
|
Limit = 20
|
||||||
});
|
});
|
||||||
billingInfo.Invoices = invoices?.Data?.OrderByDescending(i => i.Date)
|
billingInfo.Invoices = invoices?.Data?.OrderByDescending(i => i.Date)
|
||||||
.Select(i => new BillingInfo.BillingInvoice2(i));
|
.Select(i => new BillingInfo.BillingInvoice(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1005,7 +1005,7 @@ namespace Bit.Core.Services
|
|||||||
new UpcomingInvoiceOptions { CustomerId = subscriber.GatewayCustomerId });
|
new UpcomingInvoiceOptions { CustomerId = subscriber.GatewayCustomerId });
|
||||||
if(upcomingInvoice != null)
|
if(upcomingInvoice != null)
|
||||||
{
|
{
|
||||||
billingInfo.UpcomingInvoice = new BillingInfo.BillingInvoice(upcomingInvoice);
|
billingInfo.UpcomingInvoice = new BillingInfo.BillingInvoiceInfo(upcomingInvoice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(StripeException) { }
|
catch(StripeException) { }
|
||||||
|
Reference in New Issue
Block a user