public CouponServiceTest( StripeMockFixture stripeMockFixture, MockHttpClientFixture mockHttpClientFixture) : base(stripeMockFixture, mockHttpClientFixture) { this.service = new CouponService(this.StripeClient); this.createOptions = new CouponCreateOptions { PercentOff = 25, Duration = "forever", }; this.updateOptions = new CouponUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new CouponListOptions { Limit = 1, }; }
public CouponServiceTest() { this.service = new CouponService(); this.createOptions = new CouponCreateOptions { PercentOff = 25, Duration = "forever", }; this.updateOptions = new CouponUpdateOptions { Metadata = new Dictionary <string, string> { { "key", "value" }, }, }; this.listOptions = new CouponListOptions { Limit = 1, }; }
public async Task <PaymentGatewayResult <IPaymentCoupon> > UpdateCouponAsync(string id, CouponUpdateOptions options) { try { var coupon = await _couponService.GetAsync(id); coupon = await _couponService.UpdateAsync(coupon.Id, options); return(PaymentGatewayResult <IPaymentCoupon> .Success(_mapper.Map <IPaymentCoupon>(coupon))); } catch (StripeException e) { return(PaymentGatewayResult <IPaymentCoupon> .Failed(e)); } }