From 1b5652fb7c548b0995ca1394b5eca2077148e8b2 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 14 Feb 2019 23:37:08 -0500 Subject: [PATCH] inject IOptions for billing settings --- src/Billing/Utilities/PayPalClient.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Billing/Utilities/PayPalClient.cs b/src/Billing/Utilities/PayPalClient.cs index 0e203df57c..4a193a45ce 100644 --- a/src/Billing/Utilities/PayPalClient.cs +++ b/src/Billing/Utilities/PayPalClient.cs @@ -5,6 +5,7 @@ using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Options; using Newtonsoft.Json; namespace Bit.Billing.Utilities @@ -18,12 +19,13 @@ namespace Bit.Billing.Utilities private AuthResponse _authResponse; - public PayPalClient(BillingSettings billingSettings) + public PayPalClient(IOptions billingSettings) { - _baseApiUrl = _baseApiUrl = !billingSettings.PayPal.Production ? "https://api.sandbox.paypal.com/{0}" : + var bSettings = billingSettings?.Value; + _baseApiUrl = _baseApiUrl = !bSettings.PayPal.Production ? "https://api.sandbox.paypal.com/{0}" : "https://api.paypal.com/{0}"; - _clientId = billingSettings.PayPal.ClientId; - _clientSecret = billingSettings.PayPal.ClientSecret; + _clientId = bSettings.PayPal.ClientId; + _clientSecret = bSettings.PayPal.ClientSecret; } public async Task VerifyWebhookAsync(string webhookJson, IHeaderDictionary headers, string webhookId)