1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +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" ||
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;
}