1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-28 14:54:50 -05:00

display names for enums

This commit is contained in:
Kyle Spearrin 2019-02-26 12:37:29 -05:00
parent b042fc5543
commit 91bbc3e8f9
3 changed files with 23 additions and 3 deletions

View File

@ -1,12 +1,20 @@
namespace Bit.Core.Enums
using System.ComponentModel.DataAnnotations;
namespace Bit.Core.Enums
{
public enum PaymentMethodType : byte
{
[Display(Name = "Card")]
Card = 0,
[Display(Name = "Bank Account")]
BankAccount = 1,
[Display(Name = "PayPal")]
PayPal = 2,
[Display(Name = "BitPay")]
BitPay = 3,
[Display(Name = "Credit")]
Credit = 4,
[Display(Name = "Wire Transfer")]
WireTransfer = 5,
}
}

View File

@ -1,11 +1,18 @@
namespace Bit.Core.Enums
using System.ComponentModel.DataAnnotations;
namespace Bit.Core.Enums
{
public enum TransactionType : byte
{
[Display(Name = "Charge")]
Charge = 0,
[Display(Name = "Credit")]
Credit = 1,
[Display(Name = "Promotional Credit")]
PromotionalCredit = 2,
[Display(Name = "Referral Credit")]
ReferralCredit = 3,
[Display(Name = "Refund")]
Refund = 4,
}
}

View File

@ -1043,7 +1043,12 @@ namespace Bit.Core.Services
if(!string.IsNullOrWhiteSpace(subscriber.GatewayCustomerId))
{
var customer = await customerService.GetAsync(subscriber.GatewayCustomerId);
Customer customer = null;
try
{
customer = await customerService.GetAsync(subscriber.GatewayCustomerId);
}
catch(StripeException) { }
if(customer != null)
{
billingInfo.Balance = customer.AccountBalance / 100M;