Skip to content

Instantly share code, notes, and snippets.

@anchietajunior
Last active July 26, 2019 13:40
Show Gist options
  • Select an option

  • Save anchietajunior/72541d94c0c193c180b39c14cef6b642 to your computer and use it in GitHub Desktop.

Select an option

Save anchietajunior/72541d94c0c193c180b39c14cef6b642 to your computer and use it in GitHub Desktop.
class Subscription
def initialize(user)
@user = user
end
def call
create_payment!
create_invoice!
rescue StandardError => e
puts e.message
end
private
attr_accessor :user, :payment
def create_payment!
@payment = Payment.create!(user: user, amount: 30.00)
end
def create_invoice!
Invoice.create!(payment: payment)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment