From ad95dd6bb25cd216d43f12d938dc19182faf98cb Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 19 Sep 2019 10:04:15 -0400 Subject: [PATCH] check for valid transaction as well --- src/Core/Services/Implementations/AppleIapService.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Core/Services/Implementations/AppleIapService.cs b/src/Core/Services/Implementations/AppleIapService.cs index c31368f15..dfd93aaed 100644 --- a/src/Core/Services/Implementations/AppleIapService.cs +++ b/src/Core/Services/Implementations/AppleIapService.cs @@ -45,9 +45,11 @@ namespace Bit.Core.Services var validProductBundle = receiptStatus.Receipt.BundleId == "com.bitwarden.desktop" || receiptStatus.Receipt.BundleId == "com.8bit.bitwarden"; var validProduct = receiptStatus.LatestReceiptInfo.LastOrDefault()?.ProductId == "premium_annually"; - if(validEnvironment && validProductBundle && validProduct && - receiptStatus.GetOriginalTransactionId() != null && - receiptStatus.GetLastTransactionId() != null) + var validIds = receiptStatus.GetOriginalTransactionId() != null && + receiptStatus.GetLastTransactionId() != null; + var validTransaction = receiptStatus.GetLastExpiresDate() + .GetValueOrDefault(DateTime.MinValue) > DateTime.UtcNow; + if(validEnvironment && validProductBundle && validProduct && validIds && validTransaction) { return receiptStatus; }