static void GetDisputedCharges(StripeDisputeService chargeService, TraceWriter log) { string lastObjectId = null; StripeList <StripeDispute> response = null; //var greaterThanCreatedFilter = GetLatestCreatedTime(); var listOptions = new StripeDisputeListOptions() { Limit = 100, StartingAfter = lastObjectId }; do { response = chargeService.List(listOptions); foreach (var d in response.Data) { var disputes = DisputesResponseToStripeDisputes(d); UpsertStripeDispute(disputes, log); log.Info($"Dispute Updated: {disputes.DisputeId.ToString()}"); } lastObjectId = response.Data.LastOrDefault()?.Id; listOptions.StartingAfter = lastObjectId; log.Info($"Charge last ObjectId: {lastObjectId}. More responses? {response.HasMore}"); }while (response.HasMore); }
public static void Run([TimerTrigger("0 0 8 * * *")] TimerInfo myTimer, TraceWriter log) { if (myTimer.IsPastDue) { log.Info("Timer is running late!"); } log.Info($"C# Timer trigger function executed at: {DateTime.Now}"); StripeDisputeService chargeService = new StripeDisputeService(); chargeService.ExpandCharge = true; StripeConfiguration.SetApiKey(ConfigurationManager.AppSettings["StripeApiKey"]); GetDisputedCharges(chargeService, log); }
public StripeDisputeServiceTest() { this.service = new StripeDisputeService(); this.updateOptions = new StripeDisputeUpdateOptions() { Metadata = new Dictionary <string, string>() { { "key", "value" }, }, }; this.listOptions = new StripeDisputeListOptions() { Limit = 1, }; }