Sha256: b72e5cbbd5caf7548a2873790a7cb0f0f0fb336100354edb505c4e544ca55556
Contents?: true
Size: 696 Bytes
Versions: 4
Compression:
Stored size: 696 Bytes
Contents
module Tang class CreateCoupon def self.call(coupon) if !coupon.valid? return coupon end begin Stripe::Coupon.create( id: coupon.stripe_id, duration: coupon.duration, percent_off: coupon.percent_off, duration_in_months: coupon.duration_in_months, amount_off: coupon.amount_off, currency: coupon.currency, max_redemptions: coupon.max_redemptions, redeem_by: (coupon.redeem_by.present? ? coupon.redeem_by.to_i : nil) ) rescue Stripe::StripeError => e coupon.errors[:base] << e.message return coupon end return coupon end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tang-0.2.0 | app/services/tang/create_coupon.rb |
tang-0.1.0 | app/services/tang/create_coupon.rb |
tang-0.0.9 | app/services/tang/create_coupon.rb |
tang-0.0.8 | app/services/tang/create_coupon.rb |