Class: Tang::DeleteCustomer

Inherits:
Object
  • Object
show all
Defined in:
app/services/tang/delete_customer.rb

Class Method Summary collapse

Class Method Details

.call(customer) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'app/services/tang/delete_customer.rb', line 3

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