Sha256: 32795644f7639a3bf3e2f8590446dae2c4056fb9386913b76a449e6bb6064792

Contents?: true

Size: 350 Bytes

Versions: 4

Compression:

Stored size: 350 Bytes

Contents

module Tang
  class UpdateCoupon
    def self.call(coupon)
      if !coupon.valid?
        return coupon
      end

      begin
        c = Stripe::Coupon.retrieve(coupon.stripe_id)
        c.id = coupon.id
        c.save
      rescue Stripe::StripeError => e
        coupon.errors[:base] << e.message
      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/update_coupon.rb
tang-0.1.0 app/services/tang/update_coupon.rb
tang-0.0.9 app/services/tang/update_coupon.rb
tang-0.0.8 app/services/tang/update_coupon.rb