Skip to content

Commit 5476206

Browse files
committed
chore: added backup message for cancelled subscription
1 parent c2cfffb commit 5476206

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

CompressImagesFunction/host.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
},
77
"extensions": {
88
"queues": {
9-
"batchSize": 2
9+
"batchSize": 2,
10+
"maxDequeueCount" : 2,
11+
"newBatchThreshold" : 1
1012
}
1113
}
1214
}

WebHook/WebHookFunction.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,18 @@ await marketplaceTable.ExecuteAsync(TableOperation.InsertOrMerge(new Marketplace
387387
return hook.action;
388388
case "cancelled":
389389
await marketplaceTable.DropRow(hook.marketplace_purchase.account.id, hook.marketplace_purchase.account.login);
390+
if (KnownGitHubs.Plans.ContainsKey(hook.marketplace_purchase.plan.id) &&
391+
KnownGitHubs.Plans[hook.marketplace_purchase.plan.id] != 0)
392+
{
393+
await backupMessages.AddMessageAsync(new CloudQueueMessage(JsonConvert.SerializeObject(
394+
new BackupMessage
395+
{
396+
PlanId = hook.marketplace_purchase.plan.id,
397+
Price = hook.marketplace_purchase.plan.monthly_price_in_cents / 100,
398+
SaleType = "cancelled"
399+
})));
400+
}
401+
390402
logger.LogInformation("ProcessMarketplacePurchaseAsync/cancelled {PlanId} for {Owner}", hook.marketplace_purchase.plan.id, hook.marketplace_purchase.account.login);
391403
return "cancelled";
392404
default:

0 commit comments

Comments
 (0)