Skip to content

Instantly share code, notes, and snippets.

@anchietajunior
Created January 23, 2018 14:37
Show Gist options
  • Save anchietajunior/c2cb731b0f24d5b6176ee561e88c7d28 to your computer and use it in GitHub Desktop.
Save anchietajunior/c2cb731b0f24d5b6176ee561e88c7d28 to your computer and use it in GitHub Desktop.
class CreateInvoiceService
def initialize(params={})
@payment = Payment.find(params[:payment_id])
end
def charge
create_invoice
end
private
def create_invoice
invoice = ServiceInvoice.create(payment: @payment,
status: @payment.amount > 100000 ? "pending" : "issued")
invoice.status
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment