public Task<DomainCustomer> GetAsync(DomainCustomer customer) { return Task.Run(() => { try { StripeCustomer c = _service.Get(customer.Id); return Task.FromResult(_mapper.Map<StripeCustomer, DomainCustomer>(c)); } catch (StripeException e) { throw new BillingException(string.Format("Failed to get customer {0}: {1}", customer.Id, e)); } }); }
public Task<IEnumerable<DomainCharge>> ListAsync(DomainCustomer customer, int count) { return Task.Run(() => { try { IEnumerable<StripeCharge> charges = _service.List(count, customer.Id); return Task.FromResult(_mapper.Map<IEnumerable<StripeCharge>, IEnumerable<DomainCharge>>(charges)); } catch (StripeException e) { throw new BillingException(string.Format("Failed to list charges for customer {0}: {1}", customer.Id, e)); } }); }