public topups_fixture() { StripeSource source = new StripeSourceService(Cache.ApiKey).Create(new StripeSourceCreateOptions { Type = StripeSourceType.AchCreditTransfer, Currency = "usd", Owner = new StripeSourceOwner { Email = "*****@*****.**" } }); // Sleep for 5 seconds to ensure the Source is chargeable // 1 or 2 seconds are unfortunately not enough. System.Threading.Thread.Sleep(5000); TopupCreateOptions = new StripeTopupCreateOptions { Amount = 1000, Currency = "usd", Description = "Test Topup", SourceId = source.Id, StatementDescriptor = "Descriptor", }; TopupUpdateOptions = new StripeTopupUpdateOptions { Metadata = new Dictionary <string, string>() { { "some-key", "some-value" } } }; var service = new StripeTopupService(Cache.ApiKey); Topup = service.Create(TopupCreateOptions); TopupUpdated = service.Update(Topup.Id, TopupUpdateOptions); TopupRetrieved = service.Get(Topup.Id); TopupListOptions = new StripeTopupListOptions { Created = new StripeDateFilter { EqualTo = Topup.Created }, }; TopupList = service.List(TopupListOptions); }
public topups_fixture() { StripeSource source = new StripeSourceService(Cache.ApiKey).Create(new StripeSourceCreateOptions { Type = StripeSourceType.AchCreditTransfer, Currency = "usd", Owner = new StripeSourceOwner { Email = "*****@*****.**" } }); TopupCreateOptions = new StripeTopupCreateOptions { Amount = 1000, Currency = "usd", Description = "Test Topup", SourceId = source.Id, StatementDescriptor = "Descriptor", }; TopupUpdateOptions = new StripeTopupUpdateOptions { Metadata = new Dictionary <string, string>() { { "some-key", "some-value" } } }; var service = new StripeTopupService(Cache.ApiKey); // We have to disable that part of the fixture. Creating a Topup requires a // chargeable Source. In Test mode this can take a random time though which // breaks the tests unfortunately. // Since the feature is in private beta, we're just skipping the tests // anyway. //Topup = service.Create(TopupCreateOptions); //TopupUpdated = service.Update(Topup.Id, TopupUpdateOptions); //TopupRetrieved = service.Get(Topup.Id); //TopupListOptions = new StripeTopupListOptions //{ // Created = new StripeDateFilter { EqualTo = Topup.Created }, //}; //TopupList = service.List(TopupListOptions); }
public StripeTopupServiceTest() { this.service = new StripeTopupService(); this.createOptions = new StripeTopupCreateOptions() { Amount = 123, Currency = "usd", StatementDescriptor = "descriptor", }; this.updateOptions = new StripeTopupUpdateOptions() { Metadata = new Dictionary <string, string>() { { "key", "value" }, }, }; this.listOptions = new StripeTopupListOptions() { Limit = 1, }; }