Sha256: 21cdcce1159bdc2c2bddf85be8252c7c59df6a48fc4804c6c1befeaee09b31d8

Contents?: true

Size: 370 Bytes

Versions: 4

Compression:

Stored size: 370 Bytes

Contents

module Tang
  class RemoveSubscriptionDiscount
    def self.call(subscription)
      begin
        Stripe::Subscription.retrieve(subscription.stripe_id).delete_discount()
      rescue Stripe::StripeError => e
        subscription.errors[:base] << e.message
      end

      subscription.update(coupon: nil, coupon_start: nil)

      return subscription
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tang-0.2.0 app/services/tang/remove_subscription_discount.rb
tang-0.1.0 app/services/tang/remove_subscription_discount.rb
tang-0.0.9 app/services/tang/remove_subscription_discount.rb
tang-0.0.8 app/services/tang/remove_subscription_discount.rb