cleans up purchaseUTC when storage fails

This commit is contained in:
Ben 2025-03-12 14:26:56 +01:00
parent a676e0463d
commit c475802330
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B
2 changed files with 9 additions and 4 deletions

View File

@ -165,8 +165,7 @@ namespace AutoClient.Modes.FolderStore
}
catch (Exception exc)
{
entry.EncodedCid = string.Empty;
entry.PurchaseId = string.Empty;
entry.ClearPurchase();
saveChanges();
log.Error("Failed to start new purchase: " + exc);
HasFailed = true;
@ -215,8 +214,7 @@ namespace AutoClient.Modes.FolderStore
else if (!update.IsSubmitted)
{
Log("Request failed to start. State: " + update.State);
entry.EncodedCid = string.Empty;
entry.PurchaseId = string.Empty;
entry.ClearPurchase();
saveChanges();
return;
}

View File

@ -16,6 +16,13 @@
public string EncodedCid { get; set; } = string.Empty;
public string PurchaseId { get; set; } = string.Empty;
public DateTime PurchaseFinishedUtc { get; set; } = DateTime.MinValue;
public void ClearPurchase()
{
EncodedCid = string.Empty;
PurchaseId = string.Empty;
PurchaseFinishedUtc = DateTime.MinValue;
}
}
[Serializable]