diff --git a/src/Billing/Controllers/AppleController.cs b/src/Billing/Controllers/AppleController.cs index f7941d254a..43638047a7 100644 --- a/src/Billing/Controllers/AppleController.cs +++ b/src/Billing/Controllers/AppleController.cs @@ -1,12 +1,9 @@ -using Bit.Billing.Utilities; -using Bit.Core; -using Bit.Core.Enums; -using Bit.Core.Models.Table; -using Bit.Core.Repositories; -using Bit.Core.Services; +using Bit.Core; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Newtonsoft.Json; +using System; using System.IO; using System.Text; using System.Threading.Tasks; @@ -17,28 +14,13 @@ namespace Bit.Billing.Controllers public class AppleController : Controller { private readonly BillingSettings _billingSettings; - private readonly ITransactionRepository _transactionRepository; - private readonly IOrganizationRepository _organizationRepository; - private readonly IUserRepository _userRepository; - private readonly IMailService _mailService; - private readonly IPaymentService _paymentService; private readonly ILogger _logger; public AppleController( IOptions billingSettings, - ITransactionRepository transactionRepository, - IOrganizationRepository organizationRepository, - IUserRepository userRepository, - IMailService mailService, - IPaymentService paymentService, ILogger logger) { _billingSettings = billingSettings?.Value; - _transactionRepository = transactionRepository; - _organizationRepository = organizationRepository; - _userRepository = userRepository; - _mailService = mailService; - _paymentService = paymentService; _logger = logger; } @@ -68,10 +50,17 @@ namespace Bit.Billing.Controllers return new BadRequestResult(); } - _logger.LogInformation(Constants.BypassFiltersEventId, "Got IAP Status Update"); - _logger.LogInformation(Constants.BypassFiltersEventId, body); - - return new OkResult(); + try + { + var json = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(body), Formatting.Indented); + _logger.LogInformation("Apple IAP Notification:\n\n" + Constants.BypassFiltersEventId, json); + return new OkResult(); + } + catch(Exception e) + { + _logger.LogError(e, "Error processing IAP status notification."); + return new BadRequestResult(); + } } } }