Sha256: f18af97e7ded3b0f77efb605ca00e7e1b266d29d4f345fe5206f22735f3a721c

Contents?: true

Size: 361 Bytes

Versions: 2

Compression:

Stored size: 361 Bytes

Contents

module Tang
  class DeleteCustomer
    def self.call(customer)
      if customer.stripe_id.present?
        begin
          c = Stripe::Customer.retrieve(customer.stripe_id)
          c.delete
        rescue Stripe::StripeError => e
          customer.errors.add(:base, :invalid, message: e.message)
        end
      end
      return customer
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tang-0.2.2 app/services/tang/delete_customer.rb
tang-0.2.1 app/services/tang/delete_customer.rb