Skip to content

Commit e5abd60

Browse files
authored
Merge pull request #1197 from imgbot/backup_improvements
chore: added sender email and organization email to backup queue
2 parents f1a44bb + da9c090 commit e5abd60

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

Common/Messages/BackupMessage.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ public class BackupMessage
99
public string BillingCycle { get; set; }
1010

1111
public int Price { get; set; }
12+
13+
public string SenderEmail { get; set; }
14+
15+
public string OrganizationBillingEmail { get; set; }
1216
}
1317
}

WebHook/WebHookFunction.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,9 @@ await backupMessages.AddMessageAsync(new CloudQueueMessage(JsonConvert.Serialize
373373
PlanId = hook.marketplace_purchase.plan.id,
374374
Price = price,
375375
SaleType = recurrentSale,
376-
BillingCycle = hook.marketplace_purchase.billing_cycle
376+
BillingCycle = hook.marketplace_purchase.billing_cycle,
377+
SenderEmail = hook.sender.email,
378+
OrganizationBillingEmail = hook.marketplace_purchase.account.organization_billing_email
377379
})));
378380
}
379381

@@ -405,13 +407,22 @@ await marketplaceTable.ExecuteAsync(TableOperation.InsertOrMerge(new Marketplace
405407
price = hook.marketplace_purchase.plan.yearly_price_in_cents / 100;
406408
}
407409

410+
var returnType = "cancelled";
411+
412+
if (hook.marketplace_purchase.on_free_trial == true)
413+
{
414+
returnType = "cancelled_free_trial";
415+
}
416+
408417
await backupMessages.AddMessageAsync(new CloudQueueMessage(JsonConvert.SerializeObject(
409418
new BackupMessage
410419
{
411420
PlanId = hook.marketplace_purchase.plan.id,
412421
Price = price,
413-
SaleType = "cancelled",
414-
BillingCycle = hook.marketplace_purchase.billing_cycle
422+
SaleType = returnType,
423+
BillingCycle = hook.marketplace_purchase.billing_cycle,
424+
SenderEmail = hook.sender.email,
425+
OrganizationBillingEmail = hook.marketplace_purchase.account.organization_billing_email
415426
})));
416427
}
417428

0 commit comments

Comments
 (0)