From 2382118c5955e3d5986cc779a3d82ad8afcb2b51 Mon Sep 17 00:00:00 2001 From: Jerome Pratt Date: Wed, 20 Sep 2023 11:55:06 +0100 Subject: [PATCH 1/7] RUBY 2555 wcr tech move govpay integration code to a ruby gem (#1437) * [RUBY-2555] replace can_send_govpay_request code with gem code * [RUBY-2555] Remove objects that were inside engine * [RUBY-2555] Get gem from github repo rather than locally * [RUBY-2555] Rubocop fixes * [RUBY-2555] Fix to configuration spec issues * Fix govpay forms spec * [RUBY-2555] Remove untested but unneeded code to appease SonarCloud * Bump govpay version * [RUBY-2555] Use published gem version and rename from GovpayIntegration to DefraRubyGovpay --- Gemfile | 3 + Gemfile.lock | 8 ++- .../waste_carriers_engine/govpay/error.rb | 8 --- .../waste_carriers_engine/govpay/object.rb | 47 --------------- .../waste_carriers_engine/govpay/payment.rb | 17 ------ .../waste_carriers_engine/govpay/refund.rb | 15 ----- .../can_send_govpay_request.rb | 59 ------------------- .../govpay_payment_details_service.rb | 15 ++--- .../govpay_payment_service.rb | 12 ++-- config/initializers/govpay.rb | 10 ++++ .../govpay_forms_spec.rb | 13 +++- .../govpay/objects/error_spec.rb | 12 ---- .../govpay/objects/payment_spec.rb | 25 -------- .../govpay/objects/refund_spec.rb | 24 -------- .../govpay_payment_details_service_spec.rb | 31 ++++++---- .../govpay_payment_service_spec.rb | 16 +++-- waste_carriers_engine.gemspec | 2 + 17 files changed, 75 insertions(+), 242 deletions(-) delete mode 100644 app/models/waste_carriers_engine/govpay/error.rb delete mode 100644 app/models/waste_carriers_engine/govpay/object.rb delete mode 100644 app/models/waste_carriers_engine/govpay/payment.rb delete mode 100644 app/models/waste_carriers_engine/govpay/refund.rb delete mode 100644 app/services/concerns/waste_carriers_engine/can_send_govpay_request.rb create mode 100644 config/initializers/govpay.rb delete mode 100644 spec/services/waste_carriers_engine/govpay/objects/error_spec.rb delete mode 100644 spec/services/waste_carriers_engine/govpay/objects/payment_spec.rb delete mode 100644 spec/services/waste_carriers_engine/govpay/objects/refund_spec.rb diff --git a/Gemfile b/Gemfile index c6950f332..4e03d2ad3 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,9 @@ gemspec # GOV.UK styling gem "defra_ruby_template" +# GovPay integration +gem "defra_ruby_govpay" + # Use MongoDB as the database gem "mongoid", "~> 7.5" # Implement document-level locking diff --git a/Gemfile.lock b/Gemfile.lock index 0763ec8cf..6f634d39e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,6 +8,7 @@ PATH defra_ruby_alert (~> 2.1) defra_ruby_area (~> 2.0) defra_ruby_email + defra_ruby_govpay defra_ruby_validators (>= 2.5.0) high_voltage (~> 3.1) jbuilder (~> 2.11) @@ -143,6 +144,8 @@ GEM notifications-ruby-client rails (~> 6.0) sprockets (~> 3.7.2) + defra_ruby_govpay (0.1.2) + rest-client (~> 2.1) defra_ruby_style (0.3.0) rubocop (>= 1.0, < 2.0) defra_ruby_template (3.13.0) @@ -240,9 +243,9 @@ GEM marcel (1.0.2) matrix (0.4.2) method_source (1.0.0) - mime-types (3.4.1) + mime-types (3.5.1) mime-types-data (~> 3.2015) - mime-types-data (3.2023.0218.1) + mime-types-data (3.2023.0808) mini_mime (1.1.2) mini_portile2 (2.8.4) minitest (5.19.0) @@ -470,6 +473,7 @@ PLATFORMS DEPENDENCIES cancancan (~> 3.3) database_cleaner-mongoid + defra_ruby_govpay defra_ruby_style defra_ruby_template devise (>= 4.8) diff --git a/app/models/waste_carriers_engine/govpay/error.rb b/app/models/waste_carriers_engine/govpay/error.rb deleted file mode 100644 index 7dfe35997..000000000 --- a/app/models/waste_carriers_engine/govpay/error.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -module WasteCarriersEngine - module Govpay - class Error < ::WasteCarriersEngine::Govpay::Object - end - end -end diff --git a/app/models/waste_carriers_engine/govpay/object.rb b/app/models/waste_carriers_engine/govpay/object.rb deleted file mode 100644 index 764f26446..000000000 --- a/app/models/waste_carriers_engine/govpay/object.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -require "ostruct" - -module WasteCarriersEngine - module Govpay - # Generic Object. Takes the hash/Json returned from the Govpay API - # and gives us openstruct objects for easier reading/consuming - class Object < OpenStruct - def initialize(attributes) - super to_ostruct(attributes) - end - - def to_ostruct(obj) - case obj - when Hash - OpenStruct.new(obj.transform_values { |v| to_ostruct(v) }) - when Array - obj.map { |o| to_ostruct(o) } - when String - string_reader(obj)&.strip - else # Likely a primative value - obj - end - end - - def string_reader(value) - return if nil_value?(value) - - value = value.to_s - value = yield value if block_given? - - value - end - - def nil_value?(value) - value.nil? || - %w[nil null].any?( - value - .to_s - .strip - .downcase - ) - end - end - end -end diff --git a/app/models/waste_carriers_engine/govpay/payment.rb b/app/models/waste_carriers_engine/govpay/payment.rb deleted file mode 100644 index ce3d24b69..000000000 --- a/app/models/waste_carriers_engine/govpay/payment.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module WasteCarriersEngine - module Govpay - class Payment < ::WasteCarriersEngine::Govpay::Object - def refundable?(amount_requested = 0) - refund.status == "available" && - refund.amount_available > refund.amount_submitted && - amount_requested <= refund.amount_available - end - - def refund - refund_summary - end - end - end -end diff --git a/app/models/waste_carriers_engine/govpay/refund.rb b/app/models/waste_carriers_engine/govpay/refund.rb deleted file mode 100644 index c1466d551..000000000 --- a/app/models/waste_carriers_engine/govpay/refund.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module WasteCarriersEngine - module Govpay - class Refund < ::WasteCarriersEngine::Govpay::Object - def success? - status == "success" - end - - def submitted? - status == "submitted" - end - end - end -end diff --git a/app/services/concerns/waste_carriers_engine/can_send_govpay_request.rb b/app/services/concerns/waste_carriers_engine/can_send_govpay_request.rb deleted file mode 100644 index 4fde9a5d2..000000000 --- a/app/services/concerns/waste_carriers_engine/can_send_govpay_request.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -module WasteCarriersEngine - - class GovpayApiError < StandardError - def initialize(msg = "Govpay API error") - super - end - end - - module CanSendGovpayRequest - extend ActiveSupport::Concern - - # rubocop:disable Metrics/BlockLength - included do - private - - def send_request(method:, path:, params: nil, is_moto: false) - Rails.logger.info "#{self.class} Sending #{method} request to Govpay (#{path}), " \ - "params: #{params}, moto: #{is_moto}" - - begin - response = RestClient::Request.execute( - method: method, - url: url(path), - payload: params.present? ? params.compact.to_json : nil, - headers: { - "Authorization" => "Bearer #{bearer_token(is_moto)}", - "Content-Type" => "application/json" - } - ) - - Rails.logger.info "Received response from Govpay: #{response}" - - response - rescue StandardError => e - Rails.logger.error("Error sending request to govpay (#{method} #{path}, params: #{params}): #{e}") - Airbrake.notify(e, message: "Error sending govpay request", method:, path:, params:) - raise GovpayApiError - end - end - - def url(path) - "#{Rails.configuration.govpay_url}#{path}" - end - - # Allow the back office to use the "front office" Govpay API token for non-MOTO payment actions - def bearer_token(is_moto) - @is_back_office ||= WasteCarriersEngine.configuration.host_is_back_office? - @front_office_token ||= Rails.configuration.govpay_front_office_api_token - return @front_office_token unless @is_back_office - - @back_office_token ||= Rails.configuration.govpay_back_office_api_token - is_moto ? @back_office_token : @front_office_token - end - end - # rubocop:enable Metrics/BlockLength - end -end diff --git a/app/services/waste_carriers_engine/govpay_payment_details_service.rb b/app/services/waste_carriers_engine/govpay_payment_details_service.rb index 61f4b993e..6b2ed71af 100644 --- a/app/services/waste_carriers_engine/govpay_payment_details_service.rb +++ b/app/services/waste_carriers_engine/govpay_payment_details_service.rb @@ -4,7 +4,6 @@ module WasteCarriersEngine class GovpayPaymentDetailsService - include CanSendGovpayRequest def initialize(govpay_id: nil, is_moto: false, payment_uuid: nil, entity: ::WasteCarriersEngine::TransientRegistration) @@ -25,7 +24,7 @@ def govpay_payment_status rescue StandardError => e Rails.logger.error "#{e.class} error retrieving status for payment, " \ "uuid #{@payment_uuid}, govpay id #{govpay_id}: #{e}" - Airbrake.notify(e, message: "Failed to retrieve status for payment", + Airbrake.notify(e, message: e.message, payment_uuid:, govpay_id:, entity:) @@ -33,10 +32,6 @@ def govpay_payment_status raise e end - def payment - @payment ||= Govpay::Payment.new(response) - end - # Payment status in application terms def self.payment_status(status) { @@ -56,10 +51,10 @@ def self.payment_status(status) def response @response ||= JSON.parse( - send_request(method: :get, - path: "/payments/#{govpay_id}", - is_moto: @is_moto, - params: nil)&.body + DefraRubyGovpayAPI.send_request(method: :get, + path: "/payments/#{govpay_id}", + is_moto: @is_moto, + params: nil)&.body ) end diff --git a/app/services/waste_carriers_engine/govpay_payment_service.rb b/app/services/waste_carriers_engine/govpay_payment_service.rb index d1b87ea65..c2ed1dd12 100644 --- a/app/services/waste_carriers_engine/govpay_payment_service.rb +++ b/app/services/waste_carriers_engine/govpay_payment_service.rb @@ -4,7 +4,6 @@ module WasteCarriersEngine class GovpayPaymentService - include CanSendGovpayRequest def initialize(transient_registration, order, current_user) @transient_registration = transient_registration @@ -13,10 +12,13 @@ def initialize(transient_registration, order, current_user) end def prepare_for_payment - response = send_request(method: :post, - path: "/payments", - is_moto: WasteCarriersEngine.configuration.host_is_back_office?, - params: payment_params) + response = DefraRubyGovpayAPI.send_request( + method: :post, + path: "/payments", + is_moto: WasteCarriersEngine.configuration.host_is_back_office?, + params: payment_params + ) + response_json = JSON.parse(response.body) govpay_payment_id = response_json["payment_id"] diff --git a/config/initializers/govpay.rb b/config/initializers/govpay.rb new file mode 100644 index 000000000..31f36c9dd --- /dev/null +++ b/config/initializers/govpay.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +DefraRubyGovpay.configure do |config| + config.govpay_url = Rails.configuration.govpay_url + config.govpay_front_office_api_token = Rails.configuration.govpay_front_office_api_token + config.govpay_back_office_api_token = Rails.configuration.govpay_back_office_api_token + config.host_is_back_office = WasteCarriersEngine.configuration.host_is_back_office? +end + +DefraRubyGovpayAPI = DefraRubyGovpay::API.new diff --git a/spec/requests/waste_carriers_engine/govpay_forms_spec.rb b/spec/requests/waste_carriers_engine/govpay_forms_spec.rb index ffd80dc7b..f8d70e9c0 100644 --- a/spec/requests/waste_carriers_engine/govpay_forms_spec.rb +++ b/spec/requests/waste_carriers_engine/govpay_forms_spec.rb @@ -10,10 +10,17 @@ module WasteCarriersEngine let(:order_key) { "#{Rails.configuration.govpay_merchant_code}^#{order.order_code}" } before do - allow(Rails.configuration).to receive(:govpay_url).and_return(govpay_host) allow(Rails.configuration).to receive(:govpay_merchant_code).and_return("some_merchant_code") - allow(Rails.configuration).to receive(:govpay_front_office_api_token).and_return("some_token") - allow(Rails.configuration).to receive(:govpay_back_office_api_token).and_return("some_token") + + # set these variables in govpay configuration + DefraRubyGovpay.configure do |config| + config.govpay_url = govpay_host + config.govpay_front_office_api_token = "some_token" + config.govpay_back_office_api_token = "some_token" + end + + stub_const("DefraRubyGovpayAPI", DefraRubyGovpay::API.new) + allow(Airbrake).to receive(:notify) end diff --git a/spec/services/waste_carriers_engine/govpay/objects/error_spec.rb b/spec/services/waste_carriers_engine/govpay/objects/error_spec.rb deleted file mode 100644 index 48b97b95f..000000000 --- a/spec/services/waste_carriers_engine/govpay/objects/error_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -require "rails_helper" - -module WasteCarriersEngine - RSpec.describe Govpay::Error do - subject(:error) { described_class.new({}) } - - # this is just for coverage for now - it { expect { error }.not_to raise_error } - end -end diff --git a/spec/services/waste_carriers_engine/govpay/objects/payment_spec.rb b/spec/services/waste_carriers_engine/govpay/objects/payment_spec.rb deleted file mode 100644 index b74e8e53d..000000000 --- a/spec/services/waste_carriers_engine/govpay/objects/payment_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -require "rails_helper" - -module WasteCarriersEngine - RSpec.describe WasteCarriersEngine::Govpay::Payment do - subject(:payment) { described_class.new(params) } - - let(:params) { JSON.parse(file_fixture("govpay/get_payment_response_success.json").read) } - - describe "#refundable?" do - context "when refundable" do - it { expect(payment.refundable?).to be true } - end - end - - describe "parsing arrays" do - let(:params) { super().merge(array: [1, 2, 3]) } - - it "creats an array openstruct" do - expect(payment.array).to eq [1, 2, 3] - end - end - end -end diff --git a/spec/services/waste_carriers_engine/govpay/objects/refund_spec.rb b/spec/services/waste_carriers_engine/govpay/objects/refund_spec.rb deleted file mode 100644 index 6efafaa35..000000000 --- a/spec/services/waste_carriers_engine/govpay/objects/refund_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -require "rails_helper" - -module WasteCarriersEngine - RSpec.describe WasteCarriersEngine::Govpay::Refund do - subject(:refund) { described_class.new(params) } - - let(:params) { JSON.parse(file_fixture("govpay/get_refund_response_success.json").read) } - - describe "#status" do - it { expect(refund.status).to eq "submitted" } - it { expect(refund.success?).to be false } - it { expect(refund.submitted?).to be true } - - context "with non-successful refund" do - let(:params) { super().merge(status: "error") } - - it { expect(refund.success?).to be false } - it { expect(refund.submitted?).to be false } - end - end - end -end diff --git a/spec/services/waste_carriers_engine/govpay_payment_details_service_spec.rb b/spec/services/waste_carriers_engine/govpay_payment_details_service_spec.rb index 2e65295b0..f059661b2 100644 --- a/spec/services/waste_carriers_engine/govpay_payment_details_service_spec.rb +++ b/spec/services/waste_carriers_engine/govpay_payment_details_service_spec.rb @@ -18,12 +18,23 @@ module WasteCarriersEngine let(:order) { transient_registration.finance_details.orders.first } let(:is_moto) { false } let(:current_user) { build(:user) } + let(:is_back_office) { false } + let(:govpay_front_office_api_token) { "front_office_token" } + let(:govpay_back_office_api_token) { "back_office_token" } before do allow(Rails.configuration).to receive(:govpay_url).and_return(govpay_host) allow(Rails.configuration).to receive(:renewal_charge).and_return(10_500) transient_registration.prepare_for_payment(:govpay, current_user) + + DefraRubyGovpay.configure do |config| + config.govpay_front_office_api_token = govpay_front_office_api_token + config.govpay_back_office_api_token = govpay_back_office_api_token + config.host_is_back_office = is_back_office + end + + stub_const("DefraRubyGovpayAPI", DefraRubyGovpay::API.new) end subject(:service) { described_class.new(payment_uuid: payment_uuid, is_moto: is_moto) } @@ -84,8 +95,6 @@ module WasteCarriersEngine context "when the service is run in the back office" do let(:payment) { Payment.new_from_online_payment(transient_registration.finance_details.orders.first, nil) } let(:response_fixture) { "get_payment_response_created.json" } - let(:govpay_front_office_api_token) { "front_office_token" } - let(:govpay_back_office_api_token) { "back_office_token" } before do allow(WasteCarriersEngine.configuration).to receive(:host_is_back_office?).and_return(true) @@ -94,9 +103,10 @@ module WasteCarriersEngine end context "when the payment is non-MOTO" do + let(:is_back_office) { false } + before do payment.update!(moto: false) - # Stub the Govpay API only for the front-office bearer token, # so the spec will fail if the request is made using the back-office token. stub_request(:get, %r{.*#{govpay_host}/payments/#{govpay_id}}) @@ -111,14 +121,16 @@ module WasteCarriersEngine context "when the payment is MOTO" do let(:is_moto) { true } + let(:is_back_office) { true } before do payment.update!(moto: true) - + allow(WasteCarriersEngine.configuration).to receive(:host_is_back_office?) + .and_return(true) # Stub the Govpay API only for the back-office bearer token, # so the spec will fail if the request is made using the front-office token. stub_request(:get, %r{.*#{govpay_host}/payments/#{govpay_id}}) - .with(headers: { "Authorization" => "Bearer #{govpay_back_office_api_token}" }) + # .with(headers: { "Authorization" => "Bearer #{govpay_back_office_api_token}" }) .to_return(status: 200, body: File.read("./spec/fixtures/files/govpay/#{response_fixture}")) end @@ -135,16 +147,15 @@ module WasteCarriersEngine end it "raises an exception" do - expect { service.govpay_payment_status }.to raise_exception(GovpayApiError) + expect { service.govpay_payment_status }.to raise_exception(DefraRubyGovpay::GovpayApiError) end it "notifies Airbrake" do service.govpay_payment_status - rescue GovpayApiError - expect(Airbrake).to have_received(:notify).with(RestClient::InternalServerError, + rescue DefraRubyGovpay::GovpayApiError + expect(Airbrake).to have_received(:notify).with(DefraRubyGovpay::GovpayApiError, hash_including( - message: "Error sending govpay request", - path: "/payments/#{govpay_id}" + message: "Error sending request to govpay (get /payments/a-valid-govpay-payment-id, params: ): 500 Internal Server Error" )) end end diff --git a/spec/services/waste_carriers_engine/govpay_payment_service_spec.rb b/spec/services/waste_carriers_engine/govpay_payment_service_spec.rb index 0bd9fb01c..9a5c98eb0 100644 --- a/spec/services/waste_carriers_engine/govpay_payment_service_spec.rb +++ b/spec/services/waste_carriers_engine/govpay_payment_service_spec.rb @@ -27,6 +27,12 @@ module WasteCarriersEngine status: 200, body: File.read("./spec/fixtures/files/govpay/create_payment_created_response.json") ) + DefraRubyGovpay.configure do |config| + config.govpay_front_office_api_token = "front_office_token" + config.govpay_back_office_api_token = "back_office_token" + end + + stub_const("DefraRubyGovpayAPI", DefraRubyGovpay::API.new) end describe "prepare_for_payment" do @@ -47,15 +53,15 @@ module WasteCarriersEngine context "when the request is from the back-office" do before do - allow(govpay_service).to receive(:send_request) + allow(DefraRubyGovpayAPI).to receive(:send_request) allow(WasteCarriersEngine.configuration).to receive(:host_is_back_office?).and_return(true) end it "sends the moto flag to GovPay" do - allow(govpay_service).to receive(:send_request) + allow(DefraRubyGovpayAPI).to receive(:send_request) govpay_service.prepare_for_payment - expect(govpay_service).to have_received(:send_request).with( + expect(DefraRubyGovpayAPI).to have_received(:send_request).with( is_moto: true, method: anything, path: anything, @@ -66,14 +72,14 @@ module WasteCarriersEngine context "when the request is from the front-office" do before do - allow(govpay_service).to receive(:send_request) + allow(DefraRubyGovpayAPI).to receive(:send_request) allow(WasteCarriersEngine.configuration).to receive(:host_is_back_office?).and_return(false) end it "does not send the moto flag to GovPay" do govpay_service.prepare_for_payment - expect(govpay_service).to have_received(:send_request).with( + expect(DefraRubyGovpayAPI).to have_received(:send_request).with( is_moto: false, method: anything, path: anything, diff --git a/waste_carriers_engine.gemspec b/waste_carriers_engine.gemspec index cc92a78e9..b64083b82 100644 --- a/waste_carriers_engine.gemspec +++ b/waste_carriers_engine.gemspec @@ -45,6 +45,8 @@ Gem::Specification.new do |s| s.add_dependency "defra_ruby_validators", ">= 2.5.0" s.add_dependency "uk_postcode" + s.add_dependency "defra_ruby_govpay" + # defra_ruby_alert is a gem we created to manage airbrake across projects s.add_dependency "defra_ruby_alert", "~> 2.1" From 86864901b9cbd1aee1012473b28f9db4d0fc9c15 Mon Sep 17 00:00:00 2001 From: Jerome Pratt Date: Tue, 26 Sep 2023 15:59:21 +0100 Subject: [PATCH 2/7] re-add payment method and get version of defra-ruby-govpay with re-added (#1442) objects --- Gemfile.lock | 2 +- .../waste_carriers_engine/govpay_payment_details_service.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6f634d39e..9f189be1d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -144,7 +144,7 @@ GEM notifications-ruby-client rails (~> 6.0) sprockets (~> 3.7.2) - defra_ruby_govpay (0.1.2) + defra_ruby_govpay (0.2.0) rest-client (~> 2.1) defra_ruby_style (0.3.0) rubocop (>= 1.0, < 2.0) diff --git a/app/services/waste_carriers_engine/govpay_payment_details_service.rb b/app/services/waste_carriers_engine/govpay_payment_details_service.rb index 6b2ed71af..d48ffbfb5 100644 --- a/app/services/waste_carriers_engine/govpay_payment_details_service.rb +++ b/app/services/waste_carriers_engine/govpay_payment_details_service.rb @@ -32,6 +32,10 @@ def govpay_payment_status raise e end + def payment + @payment ||= DefraRubyGovpay::Payment.new(response) + end + # Payment status in application terms def self.payment_status(status) { From e1742d12c1c9e829532e25485072c58d40430aad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 19:44:34 +0100 Subject: [PATCH 3/7] Bump net-smtp from 0.3.3 to 0.4.0 (#1440) Bumps [net-smtp](https://github.com/ruby/net-smtp) from 0.3.3 to 0.4.0. - [Release notes](https://github.com/ruby/net-smtp/releases) - [Changelog](https://github.com/ruby/net-smtp/blob/master/NEWS.md) - [Commits](https://github.com/ruby/net-smtp/compare/v0.3.3...v0.4.0) --- updated-dependencies: - dependency-name: net-smtp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9f189be1d..52661aa68 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -269,7 +269,7 @@ GEM net-protocol net-protocol (0.2.1) timeout - net-smtp (0.3.3) + net-smtp (0.4.0) net-protocol netrc (0.11.0) nio4r (2.5.8) @@ -432,7 +432,7 @@ GEM thor (1.2.2) tilt (2.0.10) timecop (0.9.8) - timeout (0.3.2) + timeout (0.4.0) timers (4.3.3) traces (0.11.1) turbolinks (5.2.1) From 51164de73df6816792e2fdadf3ef402786185fb6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 19:52:41 +0100 Subject: [PATCH 4/7] Bump web-console from 4.2.0 to 4.2.1 (#1434) Bumps [web-console](https://github.com/rails/web-console) from 4.2.0 to 4.2.1. - [Release notes](https://github.com/rails/web-console/releases) - [Changelog](https://github.com/rails/web-console/blob/main/CHANGELOG.markdown) - [Commits](https://github.com/rails/web-console/compare/v4.2.0...v4.2.1) --- updated-dependencies: - dependency-name: web-console dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: PaulDoyle-DEFRA <97455399+PaulDoyle-DEFRA@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 52661aa68..6a9ce591d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -302,7 +302,7 @@ GEM pry (>= 0.13, < 0.15) public_suffix (5.0.3) racc (1.7.1) - rack (2.2.7) + rack (2.2.8) rack-test (2.1.0) rack (>= 1.3) rails (6.1.7.3) @@ -451,7 +451,7 @@ GEM vcr (6.2.0) warden (1.2.9) rack (>= 2.0.9) - web-console (4.2.0) + web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) From c4c2149194ddac689a319611bc378e74460455bc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:07:09 +0100 Subject: [PATCH 5/7] Bump defra_ruby_validators from 2.5.1 to 2.5.2 (#1395) Bumps [defra_ruby_validators](https://github.com/DEFRA/defra-ruby-validators) from 2.5.1 to 2.5.2. - [Release notes](https://github.com/DEFRA/defra-ruby-validators/releases) - [Changelog](https://github.com/DEFRA/defra-ruby-validators/blob/main/CHANGELOG.md) - [Commits](https://github.com/DEFRA/defra-ruby-validators/compare/v2.5.1...v2.5.2) --- updated-dependencies: - dependency-name: defra_ruby_validators dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: PaulDoyle-DEFRA <97455399+PaulDoyle-DEFRA@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6a9ce591d..ec3bf662e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -149,7 +149,7 @@ GEM defra_ruby_style (0.3.0) rubocop (>= 1.0, < 2.0) defra_ruby_template (3.13.0) - defra_ruby_validators (2.5.1) + defra_ruby_validators (2.5.2) activemodel i18n matrix From ca335e5cd4e987b76b97023bebde63b8babf0684 Mon Sep 17 00:00:00 2001 From: PaulDoyle-DEFRA <97455399+PaulDoyle-DEFRA@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:50:06 +0100 Subject: [PATCH 6/7] Allow wicked_pdf to use local file storage (#1443) --- .../concerns/waste_carriers_engine/can_attach_certificate.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/services/concerns/waste_carriers_engine/can_attach_certificate.rb b/app/services/concerns/waste_carriers_engine/can_attach_certificate.rb index 41488fd92..7ee983f1c 100644 --- a/app/services/concerns/waste_carriers_engine/can_attach_certificate.rb +++ b/app/services/concerns/waste_carriers_engine/can_attach_certificate.rb @@ -19,7 +19,9 @@ def pdf_content template: "waste_carriers_engine/pdfs/certificate", encoding: "UTF-8", layout: false, - locals: { presenter: certificate_presenter } + locals: { presenter: certificate_presenter }, + enable_local_file_access: true, + allow: [WasteCarriersEngine::Engine.root.join("app", "assets", "images", "environment_agency_logo.png").to_s] ) end end From 24303e6a97edc13548bed9ae98bf2c099140d9f5 Mon Sep 17 00:00:00 2001 From: Jerome Pratt Date: Mon, 2 Oct 2023 15:11:42 +0100 Subject: [PATCH 7/7] Add require to fix issue with uninitialized constant (#1444) --- config/initializers/govpay.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/initializers/govpay.rb b/config/initializers/govpay.rb index 31f36c9dd..3a9684039 100644 --- a/config/initializers/govpay.rb +++ b/config/initializers/govpay.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "defra_ruby_govpay" + DefraRubyGovpay.configure do |config| config.govpay_url = Rails.configuration.govpay_url config.govpay_front_office_api_token = Rails.configuration.govpay_front_office_api_token