From 91bbc3e8f90cb634308a80ba4353d1009c8343a0 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 26 Feb 2019 12:37:29 -0500 Subject: [PATCH] display names for enums --- src/Core/Enums/PaymentMethodType.cs | 10 +++++++++- src/Core/Enums/TransactionType.cs | 9 ++++++++- .../Services/Implementations/StripePaymentService.cs | 7 ++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/Core/Enums/PaymentMethodType.cs b/src/Core/Enums/PaymentMethodType.cs index 0821f211b3..07ce1a5d81 100644 --- a/src/Core/Enums/PaymentMethodType.cs +++ b/src/Core/Enums/PaymentMethodType.cs @@ -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, } } diff --git a/src/Core/Enums/TransactionType.cs b/src/Core/Enums/TransactionType.cs index 45baa68c06..02556ae1da 100644 --- a/src/Core/Enums/TransactionType.cs +++ b/src/Core/Enums/TransactionType.cs @@ -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, } } diff --git a/src/Core/Services/Implementations/StripePaymentService.cs b/src/Core/Services/Implementations/StripePaymentService.cs index 2f3a94e8eb..0dcb7bc5a7 100644 --- a/src/Core/Services/Implementations/StripePaymentService.cs +++ b/src/Core/Services/Implementations/StripePaymentService.cs @@ -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;