static void Main(string[] args) { RepoDb.SqlServerBootstrap.Initialize(); var repo = new PaymentIntentRepository(); var data = repo.GetAll(0, 3000); StripeConfiguration.ApiKey = ConfigurationManager.AppSettings["Cashier:Stripe:Secret"]; var chargeApi = new Stripe.ChargeService(); var charges = chargeApi.List(new ChargeListOptions { Limit = 5000 }); foreach (var item in data) { var paymentMethodApi = new Stripe.PaymentMethodService(); var paymentIntentApi = new Stripe.PaymentIntentService(); var invoiceApi = new Stripe.InvoiceService(); if (item.ExternalReference?.StartsWith("pi_") ?? true) { continue; } var payment = charges.FirstOrDefault(p => p.PaymentMethod == item.ExternalReference); if (payment != null && !string.IsNullOrEmpty(payment.PaymentIntentId)) { item.ExternalReference = payment.PaymentIntentId; repo.SavePaymentIntent(item); } } }
public Invoice GetUpcomingInvoice(string customerId) { var invoiceService = new Stripe.InvoiceService(); var upcomingInvoiceOptions = new UpcomingInvoiceOptions() { Customer = customerId }; return(invoiceService.Upcoming(upcomingInvoiceOptions)); }
public ProjectInvoiceService( IServiceProvider serviceProvider, StripeInvoiceService invoiceService, InvoiceItemService invoiceItemService, ILogger <ProjectInvoiceService> logger, InvoicesEventHandlers events, IProjectService projectService, IBuyerAccountService buyerAccountService) : base(serviceProvider) { _invoiceService = invoiceService; _invoiceItemService = invoiceItemService; _logger = logger; _projectService = projectService; _buyerAccountService = buyerAccountService; _invoices = UnitOfWork.RepositoryAsync <StripeInvoice>(); _timeEntries = UnitOfWork.RepositoryAsync <TimeEntry>(); _items = UnitOfWork.RepositoryAsync <StripeInvoiceItem>(); _contracts = UnitOfWork.RepositoryAsync <Contract>(); AddEventHandler(events); }