Last active
July 26, 2019 13:40
-
-
Save anchietajunior/72541d94c0c193c180b39c14cef6b642 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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