From d73fd6d88ee2874c9b60135f203ecfb7c6ce29a6 Mon Sep 17 00:00:00 2001 From: Sergei Tsoganov Date: Tue, 6 Jun 2023 11:52:09 +0300 Subject: [PATCH] Removed reference no param from invoice payment --- .github/workflows/ruby.yml | 16 +++++++--------- app/controllers/invoices_controller.rb | 4 +--- app/services/billing/oneoff.rb | 4 ++-- app/views/invoices/partials/_invoice.html.erb | 2 +- app/views/invoices/show.html.erb | 2 +- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 0e7afd59..b13a64ad 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-18.04] + os: [ubuntu-22.04] ruby: [ '3.2.0' ] runs-on: ${{ matrix.os }} continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} @@ -24,13 +24,11 @@ jobs: bundle env head -n1 $(which bundle) - - name: Install wkhtmlpdf (push) + - name: Install wkhtmltopdf (push) run: | - wget http://se.archive.ubuntu.com/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb - sudo dpkg -i libpng12-0_1.2.54-1ubuntu1_amd64.deb - wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.xenial_amd64.deb - sudo apt-get install -y gdebi - sudo gdebi --non-interactive wkhtmltox_0.12.5-1.xenial_amd64.deb + sudo apt-get install -y xfonts-base xfonts-75dpi + wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb + sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb if: github.event_name == 'push' - name: Set ENV for codeclimate (pull_request) @@ -79,9 +77,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-18.04 ] + os: [ ubuntu-22.04 ] ruby: [ '3.2.0' ] - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 env: CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} 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 @@ <%= currency(invoice[:total].to_f) %> <% if invoice[:payable] && invoice[:payment_link].present? %> - <%= link_to ''.html_safe, pay_path(invoice_number: invoice[:number], reference_no: invoice[:reference_no]), data: { 'turbo-method': :post } %> + <%= link_to ''.html_safe, pay_path(invoice_number: invoice[:number]), data: { 'turbo-method': :post } %> <% end %> diff --git a/app/views/invoices/show.html.erb b/app/views/invoices/show.html.erb index 3b5e4094..4887a904 100644 --- a/app/views/invoices/show.html.erb +++ b/app/views/invoices/show.html.erb @@ -19,7 +19,7 @@ <% if @invoice[:payable] && @invoice[:payment_link].present? %>
- <%= button_to t(:pay), pay_path(invoice_number: @invoice[:number], reference_no: @invoice[:reference_no]), method: :post, class: 'button button--secondary' %> + <%= button_to t(:pay), pay_path(invoice_number: @invoice[:number]), method: :post, class: 'button button--secondary' %>
<% end %> <% if @invoice[:cancellable] && !@invoice[:monthly_invoice] %>