diff --git a/app/controllers/invoices_controller.rb b/app/controllers/invoices_controller.rb index 227152ba..daa03537 100644 --- a/app/controllers/invoices_controller.rb +++ b/app/controllers/invoices_controller.rb @@ -65,10 +65,8 @@ def add_credit def pay invoice_number = params[:invoice_number] - reference_no = params[:reference_no] response = Billing::Oneoff.send_invoice(invoice_number: invoice_number.to_s, - customer_url: callback_url, - reference_number: reference_no) + customer_url: callback_url) if response['error'].present? flash.alert = response['error']['message'] diff --git a/app/services/billing/oneoff.rb b/app/services/billing/oneoff.rb index 6c3c14a0..a251cbdb 100644 --- a/app/services/billing/oneoff.rb +++ b/app/services/billing/oneoff.rb @@ -3,13 +3,13 @@ class Oneoff include Billing::Request attr_reader :invoice_number, :customer_url, :reference_number - def initialize(invoice_number:, customer_url:, reference_number:) + def initialize(invoice_number:, customer_url:, reference_number: nil) @invoice_number = invoice_number @customer_url = customer_url @reference_number = reference_number end - def self.send_invoice(invoice_number:, customer_url:, reference_number:) + def self.send_invoice(invoice_number:, customer_url:, reference_number: nil) fetcher = new(invoice_number: invoice_number, customer_url: customer_url, reference_number: reference_number) fetcher.send_it end diff --git a/app/views/invoices/partials/_invoice.html.erb b/app/views/invoices/partials/_invoice.html.erb index 4b7643ef..69bc2525 100644 --- a/app/views/invoices/partials/_invoice.html.erb +++ b/app/views/invoices/partials/_invoice.html.erb @@ -18,7 +18,7 @@