1
0
mirror of https://github.com/bitwarden/server.git synced 2025-02-17 02:01:53 +01:00

check for valid transaction as well

This commit is contained in:
Kyle Spearrin 2019-09-19 10:04:15 -04:00
parent 62f4e67e8a
commit ad95dd6bb2

View File

@ -45,9 +45,11 @@ namespace Bit.Core.Services
var validProductBundle = receiptStatus.Receipt.BundleId == "com.bitwarden.desktop" || var validProductBundle = receiptStatus.Receipt.BundleId == "com.bitwarden.desktop" ||
receiptStatus.Receipt.BundleId == "com.8bit.bitwarden"; receiptStatus.Receipt.BundleId == "com.8bit.bitwarden";
var validProduct = receiptStatus.LatestReceiptInfo.LastOrDefault()?.ProductId == "premium_annually"; var validProduct = receiptStatus.LatestReceiptInfo.LastOrDefault()?.ProductId == "premium_annually";
if(validEnvironment && validProductBundle && validProduct && var validIds = receiptStatus.GetOriginalTransactionId() != null &&
receiptStatus.GetOriginalTransactionId() != null && receiptStatus.GetLastTransactionId() != null;
receiptStatus.GetLastTransactionId() != null) var validTransaction = receiptStatus.GetLastExpiresDate()
.GetValueOrDefault(DateTime.MinValue) > DateTime.UtcNow;
if(validEnvironment && validProductBundle && validProduct && validIds && validTransaction)
{ {
return receiptStatus; return receiptStatus;
} }