defra_ruby_mocks 2.4.2 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/defra_ruby_mocks/govpay_controller.rb +33 -3
  3. data/app/services/defra_ruby_mocks/companies_house_service.rb +1 -3
  4. data/app/services/defra_ruby_mocks/govpay_create_payment_service.rb +20 -20
  5. data/app/services/defra_ruby_mocks/govpay_get_payment_service.rb +50 -50
  6. data/app/services/defra_ruby_mocks/govpay_refund_details_service.rb +6 -6
  7. data/app/services/defra_ruby_mocks/govpay_request_refund_service.rb +4 -4
  8. data/config/routes.rb +6 -1
  9. data/lib/defra_ruby_mocks/version.rb +1 -1
  10. data/lib/defra_ruby_mocks.rb +0 -6
  11. metadata +12 -209
  12. data/app/jobs/defra_ruby_mocks/application_job.rb +0 -6
  13. data/app/jobs/defra_ruby_mocks/govpay_payment_callback_job.rb +0 -17
  14. data/spec/defra_ruby_mocks_spec.rb +0 -44
  15. data/spec/dummy/README.rdoc +0 -28
  16. data/spec/dummy/Rakefile +0 -6
  17. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  18. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  19. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  20. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  21. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  22. data/spec/dummy/bin/bundle +0 -3
  23. data/spec/dummy/bin/rails +0 -4
  24. data/spec/dummy/bin/rake +0 -4
  25. data/spec/dummy/bin/setup +0 -29
  26. data/spec/dummy/config/application.rb +0 -27
  27. data/spec/dummy/config/boot.rb +0 -5
  28. data/spec/dummy/config/environment.rb +0 -5
  29. data/spec/dummy/config/environments/development.rb +0 -38
  30. data/spec/dummy/config/environments/production.rb +0 -76
  31. data/spec/dummy/config/environments/test.rb +0 -42
  32. data/spec/dummy/config/initializers/assets.rb +0 -11
  33. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  34. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  35. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  36. data/spec/dummy/config/initializers/inflections.rb +0 -16
  37. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  38. data/spec/dummy/config/initializers/session_store.rb +0 -3
  39. data/spec/dummy/config/initializers/to_time_preserves_timezone.rb +0 -10
  40. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -9
  41. data/spec/dummy/config/locales/en.yml +0 -23
  42. data/spec/dummy/config/routes.rb +0 -4
  43. data/spec/dummy/config/secrets.yml +0 -22
  44. data/spec/dummy/config.ru +0 -4
  45. data/spec/dummy/log/test.log +0 -2013
  46. data/spec/dummy/public/404.html +0 -67
  47. data/spec/dummy/public/422.html +0 -67
  48. data/spec/dummy/public/500.html +0 -66
  49. data/spec/dummy/public/favicon.ico +0 -0
  50. data/spec/examples.txt +0 -68
  51. data/spec/fixtures/files/govpay/create_payment_created_response.json +0 -24
  52. data/spec/fixtures/files/govpay/create_payment_error_response.json +0 -5
  53. data/spec/fixtures/files/govpay/get_payment_response_cancelled.json +0 -61
  54. data/spec/fixtures/files/govpay/get_payment_response_created.json +0 -73
  55. data/spec/fixtures/files/govpay/get_payment_response_error.json +0 -5
  56. data/spec/fixtures/files/govpay/get_payment_response_failure.json +0 -9
  57. data/spec/fixtures/files/govpay/get_payment_response_not_found.json +0 -4
  58. data/spec/fixtures/files/govpay/get_payment_response_submitted.json +0 -75
  59. data/spec/fixtures/files/govpay/get_payment_response_success.json +0 -62
  60. data/spec/lib/configuration_spec.rb +0 -75
  61. data/spec/rails_helper.rb +0 -46
  62. data/spec/requests/company_spec.rb +0 -91
  63. data/spec/requests/govpay_spec.rb +0 -170
  64. data/spec/requests/officers_spec.rb +0 -37
  65. data/spec/services/companies_house_service_spec.rb +0 -69
  66. data/spec/services/govpay_create_payment_service_spec.rb +0 -44
  67. data/spec/services/govpay_get_payment_service_spec.rb +0 -30
  68. data/spec/services/govpay_refund_details_service_spec.rb +0 -58
  69. data/spec/services/govpay_request_refund_service_spec.rb +0 -31
  70. data/spec/spec_helper.rb +0 -86
  71. data/spec/support/helpers/configuration.rb +0 -17
  72. data/spec/support/helpers/helpers.rb +0 -13
  73. data/spec/support/helpers/waste_carriers_engine.rb +0 -10
  74. data/spec/support/helpers/xml_matchers.rb +0 -19
  75. data/spec/support/pry.rb +0 -7
  76. data/spec/support/simplecov.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19d183f643c04c2d04305eed065be722baa44316b88e25cfb554acc6c400643f
4
- data.tar.gz: ce81faef997a6cc3c8d75583908470bf93887e8c690b00d5d23a717d9242f280
3
+ metadata.gz: daca7a21c8e025f343ee8e118ce47db24bc156f01646d747b3eb69f779f8f47e
4
+ data.tar.gz: 7d4d39f87f9caae3bf194ff94eb5e952d841deb2f97928177e83b739158166a5
5
5
  SHA512:
6
- metadata.gz: 7011f24a3a5dc22a452d088745e75d87b9906f9e632214f6c51df0f92343dcab0ebfc474a8983c8d99a89925e9e9ddc4de44a4efa73fc1362363d229fa0bde4a
7
- data.tar.gz: 27096c708c2bb8360ace94b5b48beb782429835ae9881a20e16aac58e921b9ea654039e6f674feab46cacc4d5f5f95a22854e39bce838d132d003dbec44b008e
6
+ metadata.gz: b95c89f6d29270099b4d96c5b841de3cbe2f97648a44006bfa13f442e35ea8b191b2c436db0426854efefdc9c001b89686eb3db004ab16acb6854b2036b05f7a
7
+ data.tar.gz: de085b31d9767d688660ee45b6530cd139d9cb3d4a2a313c5aa170494d415dc88c308f794a7c60b2891a0da6d47c84ce838318455399fc37f6fbcef783f833f0
@@ -8,17 +8,31 @@ module DefraRubyMocks
8
8
  def create_payment
9
9
  valid_create_params
10
10
 
11
- # Enqueue the payment callback to run after the controller responds
12
- DefraRubyMocks::GovpayPaymentCallbackJob.perform_later(params[:return_url])
11
+ store_return_url(params[:return_url])
13
12
 
14
13
  render json: GovpayCreatePaymentService.new.run(
15
- amount: params[:amount], description: params[:description], return_url: params[:return_url]
14
+ amount: params[:amount], description: params[:description]
16
15
  )
17
16
  rescue StandardError => e
18
17
  Rails.logger.error("MOCKS: Govpay payment creation error: #{e.message}")
19
18
  head 500
20
19
  end
21
20
 
21
+ # This mocks the Govpay route which presents the payment details page to the user.
22
+ # We don't mock the actual payment details and payment confirmation pages - we go
23
+ # straight to the application callback route.
24
+ def next_url
25
+ response_url = retrieve_return_url
26
+ Rails.logger.warn "Govpay mock calling response URL #{response_url}"
27
+ redirect_to response_url
28
+ # RestClient::Request.execute(method: :GET, url: response_url)
29
+ rescue RestClient::ExceptionWithResponse => e
30
+ Rails.logger.warn "Govpay mock: RestClient received response: #{e}"
31
+ rescue StandardError => e
32
+ Rails.logger.error("Govpay mock: Error sending request to govpay: #{e}")
33
+ Airbrake.notify(e, message: "Error on govpay request")
34
+ end
35
+
22
36
  def payment_details
23
37
  valid_payment_id
24
38
  render json: GovpayGetPaymentService.new.run(payment_id: params[:payment_id])
@@ -44,6 +58,22 @@ module DefraRubyMocks
44
58
  head 500
45
59
  end
46
60
 
61
+ private
62
+
63
+ # We need to persist the return_url between the initial payment creation request and the execution of next_url
64
+ def return_url_filepath
65
+ "#{Dir.tmpdir}/last_return_url"
66
+ end
67
+
68
+ def store_return_url(return_url)
69
+ Rails.logger.warn ":::::: storing return_url #{return_url}"
70
+ File.write(return_url_filepath, return_url)
71
+ end
72
+
73
+ def retrieve_return_url
74
+ File.read(return_url_filepath)
75
+ end
76
+
47
77
  def valid_create_params
48
78
  params.require(%i[amount description return_url])
49
79
  end
@@ -11,9 +11,7 @@ module DefraRubyMocks
11
11
  # SC534714, CE000958
12
12
  # IP00141R, IP27702R, SP02252R
13
13
  # https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/426891/uniformResourceIdentifiersCustomerGuide.pdf
14
- VALID_COMPANIES_HOUSE_REGISTRATION_NUMBER_REGEX = Regexp.new(
15
- /\A(\d{8,8}$)|([a-zA-Z]{2}\d{6}$)|([a-zA-Z]{2}\d{5}[a-zA-Z]{1}$)\z/i
16
- ).freeze
14
+ VALID_COMPANIES_HOUSE_REGISTRATION_NUMBER_REGEX = /\A(\d{8,8}$)|([a-zA-Z]{2}\d{6}$)|([a-zA-Z]{2}\d{5}[a-zA-Z]{1}$)\z/i
17
15
 
18
16
  NOT_FOUND = "99999999"
19
17
 
@@ -5,12 +5,12 @@ require "securerandom"
5
5
  module DefraRubyMocks
6
6
  class GovpayCreatePaymentService < BaseService
7
7
 
8
- def run(amount:, description:, return_url:)
8
+ def run(amount:, description:)
9
9
  success_response.merge(
10
10
  {
11
11
  _links: {
12
12
  self: { href: "#{base_url}/#{payment_id}", method: "GET" },
13
- next_url: { href: return_url, method: "GET" }
13
+ next_url: { href: "#{base_url}/secure/next-url-uuid-abc123", method: "GET" }
14
14
  },
15
15
  amount: amount.to_i,
16
16
  description: description,
@@ -32,28 +32,28 @@ module DefraRubyMocks
32
32
  # rubocop:disable Metrics/MethodLength
33
33
  def success_response
34
34
  {
35
- "created_date": "2020-03-03T16:17:19.554Z",
36
- "state": {
37
- "status": "created",
38
- "finished": false
35
+ created_date: "2020-03-03T16:17:19.554Z",
36
+ state: {
37
+ status: "created",
38
+ finished: false
39
39
  },
40
- "_links": {
41
- "self": {
42
- "href": "https://publicapi.payments.service.gov.uk/v1/payments/hu20sqlact5260q2nanm0q8u93",
43
- "method": "GET"
40
+ _links: {
41
+ self: {
42
+ href: "https://publicapi.payments.service.gov.uk/v1/payments/hu20sqlact5260q2nanm0q8u93",
43
+ method: "GET"
44
44
  },
45
- "next_url": {
46
- "href": "https://www.payments.service.gov.uk/secure/bb0a272c-8eaf-468d-b3xf-ae5e000d2231",
47
- "method": "GET"
45
+ next_url: {
46
+ href: "https://www.payments.service.gov.uk/secure/bb0a272c-8eaf-468d-b3xf-ae5e000d2231",
47
+ method: "GET"
48
48
  }
49
49
  },
50
- "amount": 14_500,
51
- "reference": "12345",
52
- "description": "Pay your council tax",
53
- "return_url": "https://your.service.gov.uk/completed",
54
- "payment_id": "hu20sqlact5260q2nanm0q8u93",
55
- "payment_provider": "worldpay",
56
- "provider_id": "10987654321"
50
+ amount: 14_500,
51
+ reference: "12345",
52
+ description: "Pay your council tax",
53
+ return_url: "https://your.service.gov.uk/completed",
54
+ payment_id: "hu20sqlact5260q2nanm0q8u93",
55
+ payment_provider: "worldpay",
56
+ provider_id: "10987654321"
57
57
  }
58
58
  end
59
59
  # rubocop:enable Metrics/MethodLength
@@ -22,64 +22,64 @@ module DefraRubyMocks
22
22
  # rubocop:disable Metrics/MethodLength
23
23
  def response_success
24
24
  {
25
- "amount": 10_501,
26
- "description": "Waste carrier registration upper tier",
27
- "reference": "12345",
28
- "language": "en",
29
- "metadata": {
30
- "ledger_code": "AB100",
31
- "an_internal_reference_number": 200
25
+ amount: 10_501,
26
+ description: "Waste carrier registration upper tier",
27
+ reference: "12345",
28
+ language: "en",
29
+ metadata: {
30
+ ledger_code: "AB100",
31
+ an_internal_reference_number: 200
32
32
  },
33
- "email": "sherlock.holmes@example.com",
34
- "state": {
35
- "status": "success",
36
- "finished": true
33
+ email: "sherlock.holmes@example.com",
34
+ state: {
35
+ status: "success",
36
+ finished: true
37
37
  },
38
- "payment_id": "cnnffa1e6s3u9a6n24u2cp527d",
39
- "payment_provider": "sandbox",
40
- "created_date": "2022-05-18T11:52:13.669Z",
41
- "refund_summary": {
42
- "status": "available",
43
- "amount_available": 10_501,
44
- "amount_submitted": 0
38
+ payment_id: "cnnffa1e6s3u9a6n24u2cp527d",
39
+ payment_provider: "sandbox",
40
+ created_date: "2022-05-18T11:52:13.669Z",
41
+ refund_summary: {
42
+ status: "available",
43
+ amount_available: 10_501,
44
+ amount_submitted: 0
45
45
  },
46
- "settlement_summary": {
47
- "capture_submit_time": "2022-05-18T11:52:39.172Z",
48
- "captured_date": "2022-05-18"
46
+ settlement_summary: {
47
+ capture_submit_time: "2022-05-18T11:52:39.172Z",
48
+ captured_date: "2022-05-18"
49
49
  },
50
- "card_details": {
51
- "last_digits_card_number": "5100",
52
- "first_digits_card_number": "510510",
53
- "cardholder_name": "Sherlock Holmes",
54
- "expiry_date": "01/24",
55
- "billing_address": {
56
- "line1": "221 Baker Street",
57
- "line2": "Flat b",
58
- "postcode": "NW1 6XE",
59
- "city": "London",
60
- "country": "GB"
50
+ card_details: {
51
+ last_digits_card_number: "5100",
52
+ first_digits_card_number: "510510",
53
+ cardholder_name: "Sherlock Holmes",
54
+ expiry_date: "01/24",
55
+ billing_address: {
56
+ line1: "221 Baker Street",
57
+ line2: "Flat b",
58
+ postcode: "NW1 6XE",
59
+ city: "London",
60
+ country: "GB"
61
61
  },
62
- "card_brand": "Mastercard",
63
- "card_type": "debit"
62
+ card_brand: "Mastercard",
63
+ card_type: "debit"
64
64
  },
65
- "delayed_capture": false,
66
- "moto": false,
67
- "provider_id": "9bb0c2c1-d0c5-4a63-8945-f4240e06f8ae",
68
- "return_url": "https://some-wcr-env.defra.gov.uk/completed",
69
- "authorisation_mode": "web",
70
- "card_brand": "Mastercard",
71
- "_links": {
72
- "self": {
73
- "href": "https://publicapi.payments.service.gov.uk/v1/payments/cnnffa1e6s3u9a6n24u2cp527d",
74
- "method": "GET"
65
+ delayed_capture: false,
66
+ moto: false,
67
+ provider_id: "9bb0c2c1-d0c5-4a63-8945-f4240e06f8ae",
68
+ return_url: "https://some-wcr-env.defra.gov.uk/completed",
69
+ authorisation_mode: "web",
70
+ card_brand: "Mastercard",
71
+ _links: {
72
+ self: {
73
+ href: "https://publicapi.payments.service.gov.uk/v1/payments/cnnffa1e6s3u9a6n24u2cp527d",
74
+ method: "GET"
75
75
  },
76
- "events": {
77
- "href": "https://publicapi.payments.service.gov.uk/v1/payments/cnnffa1e6s3u9a6n24u2cp527d/events",
78
- "method": "GET"
76
+ events: {
77
+ href: "https://publicapi.payments.service.gov.uk/v1/payments/cnnffa1e6s3u9a6n24u2cp527d/events",
78
+ method: "GET"
79
79
  },
80
- "refunds": {
81
- "href": "https://publicapi.payments.service.gov.uk/v1/payments/cnnffa1e6s3u9a6n24u2cp527d/refunds",
82
- "method": "GET"
80
+ refunds: {
81
+ href: "https://publicapi.payments.service.gov.uk/v1/payments/cnnffa1e6s3u9a6n24u2cp527d/refunds",
82
+ method: "GET"
83
83
  }
84
84
  }
85
85
  }
@@ -5,12 +5,12 @@ module DefraRubyMocks
5
5
 
6
6
  def run(payment_id:, refund_id:) # rubocop:disable Lint/UnusedMethodArgument
7
7
  {
8
- "amount": 2000,
9
- "created_date": "2019-09-19T16:53:03.213Z",
10
- "refund_id": refund_id,
11
- "status": status,
12
- "settlement_summary": {
13
- "settled_date": "2019-09-21"
8
+ amount: 2000,
9
+ created_date: "2019-09-19T16:53:03.213Z",
10
+ refund_id: refund_id,
11
+ status: status,
12
+ settlement_summary: {
13
+ settled_date: "2019-09-21"
14
14
  }
15
15
  }
16
16
  end
@@ -8,10 +8,10 @@ module DefraRubyMocks
8
8
 
9
9
  # This currently supports only "submitted" status:
10
10
  {
11
- "amount": amount,
12
- "created_date": "2019-09-19T16:53:03.213Z",
13
- "refund_id": SecureRandom.hex(22),
14
- "status": "submitted"
11
+ amount: amount,
12
+ created_date: "2019-09-19T16:53:03.213Z",
13
+ refund_id: SecureRandom.hex(22),
14
+ status: "submitted"
15
15
  }
16
16
  end
17
17
 
data/config/routes.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- DefraRubyMocks::Engine.routes.draw do
3
+ DefraRubyMocks::Engine.routes.draw do # rubocop:disable Metrics/BlockLength
4
4
  get "/company/:id",
5
5
  to: "company#show",
6
6
  as: "company",
@@ -16,6 +16,11 @@ DefraRubyMocks::Engine.routes.draw do
16
16
  as: "govpay_create_payment",
17
17
  constraints: ->(_request) { DefraRubyMocks.configuration.enabled? }
18
18
 
19
+ get "/govpay/v1/payments/secure/:uuid",
20
+ to: "govpay#next_url",
21
+ as: "govpay_next_url",
22
+ constraints: ->(_request) { DefraRubyMocks.configuration.enabled? }
23
+
19
24
  get "/govpay/v1/payments/:payment_id",
20
25
  to: "govpay#payment_details",
21
26
  as: "govpay_payment_details",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DefraRubyMocks
4
- VERSION = "2.4.2"
4
+ VERSION = "4.1.0"
5
5
  end
@@ -12,12 +12,6 @@ module DefraRubyMocks
12
12
  def configuration
13
13
  @configuration ||= Configuration.new
14
14
  end
15
-
16
- # Added for testing. Without we cannot test both a config object with and
17
- # with set values in the same rspec session
18
- def reset_configuration
19
- @configuration = nil
20
- end
21
15
  end
22
16
 
23
17
  def self.configure
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: defra_ruby_mocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Defra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-06 00:00:00.000000000 Z
11
+ date: 2023-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,78 +16,22 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
19
+ version: '7.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '6.0'
26
+ version: '7.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sprockets
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 3.7.2
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 3.7.2
41
- - !ruby/object:Gem::Dependency
42
- name: github_changelog_generator
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: defra_ruby_style
57
29
  requirement: !ruby/object:Gem::Requirement
58
30
  requirements:
59
31
  - - ">="
60
32
  - !ruby/object:Gem::Version
61
33
  version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: pry-byebug
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rails-controller-testing
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
34
+ type: :runtime
91
35
  prerelease: false
92
36
  version_requirements: !ruby/object:Gem::Requirement
93
37
  requirements:
@@ -95,33 +39,19 @@ dependencies:
95
39
  - !ruby/object:Gem::Version
96
40
  version: '0'
97
41
  - !ruby/object:Gem::Dependency
98
- name: rspec-rails
42
+ name: sprockets-rails
99
43
  requirement: !ruby/object:Gem::Requirement
100
44
  requirements:
101
45
  - - ">="
102
46
  - !ruby/object:Gem::Version
103
47
  version: '0'
104
- type: :development
48
+ type: :runtime
105
49
  prerelease: false
106
50
  version_requirements: !ruby/object:Gem::Requirement
107
51
  requirements:
108
52
  - - ">="
109
53
  - !ruby/object:Gem::Version
110
54
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: simplecov
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 0.17.1
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 0.17.1
125
55
  description: A Rails engine which can be used to mock external services when loaded
126
56
  into an application
127
57
  email:
@@ -136,8 +66,6 @@ files:
136
66
  - app/controllers/defra_ruby_mocks/application_controller.rb
137
67
  - app/controllers/defra_ruby_mocks/company_controller.rb
138
68
  - app/controllers/defra_ruby_mocks/govpay_controller.rb
139
- - app/jobs/defra_ruby_mocks/application_job.rb
140
- - app/jobs/defra_ruby_mocks/govpay_payment_callback_job.rb
141
69
  - app/services/defra_ruby_mocks/base_service.rb
142
70
  - app/services/defra_ruby_mocks/companies_house_service.rb
143
71
  - app/services/defra_ruby_mocks/govpay_create_payment_service.rb
@@ -156,73 +84,11 @@ files:
156
84
  - lib/defra_ruby_mocks/version.rb
157
85
  - lib/tasks/changelog.rake
158
86
  - lib/tasks/defra_ruby_mocks_tasks.rake
159
- - spec/defra_ruby_mocks_spec.rb
160
- - spec/dummy/README.rdoc
161
- - spec/dummy/Rakefile
162
- - spec/dummy/app/assets/javascripts/application.js
163
- - spec/dummy/app/assets/stylesheets/application.css
164
- - spec/dummy/app/controllers/application_controller.rb
165
- - spec/dummy/app/helpers/application_helper.rb
166
- - spec/dummy/app/views/layouts/application.html.erb
167
- - spec/dummy/bin/bundle
168
- - spec/dummy/bin/rails
169
- - spec/dummy/bin/rake
170
- - spec/dummy/bin/setup
171
- - spec/dummy/config.ru
172
- - spec/dummy/config/application.rb
173
- - spec/dummy/config/boot.rb
174
- - spec/dummy/config/environment.rb
175
- - spec/dummy/config/environments/development.rb
176
- - spec/dummy/config/environments/production.rb
177
- - spec/dummy/config/environments/test.rb
178
- - spec/dummy/config/initializers/assets.rb
179
- - spec/dummy/config/initializers/backtrace_silencers.rb
180
- - spec/dummy/config/initializers/cookies_serializer.rb
181
- - spec/dummy/config/initializers/filter_parameter_logging.rb
182
- - spec/dummy/config/initializers/inflections.rb
183
- - spec/dummy/config/initializers/mime_types.rb
184
- - spec/dummy/config/initializers/session_store.rb
185
- - spec/dummy/config/initializers/to_time_preserves_timezone.rb
186
- - spec/dummy/config/initializers/wrap_parameters.rb
187
- - spec/dummy/config/locales/en.yml
188
- - spec/dummy/config/routes.rb
189
- - spec/dummy/config/secrets.yml
190
- - spec/dummy/log/test.log
191
- - spec/dummy/public/404.html
192
- - spec/dummy/public/422.html
193
- - spec/dummy/public/500.html
194
- - spec/dummy/public/favicon.ico
195
- - spec/examples.txt
196
- - spec/fixtures/files/govpay/create_payment_created_response.json
197
- - spec/fixtures/files/govpay/create_payment_error_response.json
198
- - spec/fixtures/files/govpay/get_payment_response_cancelled.json
199
- - spec/fixtures/files/govpay/get_payment_response_created.json
200
- - spec/fixtures/files/govpay/get_payment_response_error.json
201
- - spec/fixtures/files/govpay/get_payment_response_failure.json
202
- - spec/fixtures/files/govpay/get_payment_response_not_found.json
203
- - spec/fixtures/files/govpay/get_payment_response_submitted.json
204
- - spec/fixtures/files/govpay/get_payment_response_success.json
205
- - spec/lib/configuration_spec.rb
206
- - spec/rails_helper.rb
207
- - spec/requests/company_spec.rb
208
- - spec/requests/govpay_spec.rb
209
- - spec/requests/officers_spec.rb
210
- - spec/services/companies_house_service_spec.rb
211
- - spec/services/govpay_create_payment_service_spec.rb
212
- - spec/services/govpay_get_payment_service_spec.rb
213
- - spec/services/govpay_refund_details_service_spec.rb
214
- - spec/services/govpay_request_refund_service_spec.rb
215
- - spec/spec_helper.rb
216
- - spec/support/helpers/configuration.rb
217
- - spec/support/helpers/helpers.rb
218
- - spec/support/helpers/waste_carriers_engine.rb
219
- - spec/support/helpers/xml_matchers.rb
220
- - spec/support/pry.rb
221
- - spec/support/simplecov.rb
222
87
  homepage: https://github.com/DEFRA/defra-ruby-mocks
223
88
  licenses:
224
89
  - The Open Government Licence (OGL) Version 3
225
- metadata: {}
90
+ metadata:
91
+ rubygems_mfa_required: 'true'
226
92
  post_install_message:
227
93
  rdoc_options: []
228
94
  require_paths:
@@ -231,78 +97,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
97
  requirements:
232
98
  - - ">="
233
99
  - !ruby/object:Gem::Version
234
- version: '2.4'
100
+ version: 3.2.2
235
101
  required_rubygems_version: !ruby/object:Gem::Requirement
236
102
  requirements:
237
103
  - - ">="
238
104
  - !ruby/object:Gem::Version
239
105
  version: '0'
240
106
  requirements: []
241
- rubygems_version: 3.1.2
107
+ rubygems_version: 3.4.10
242
108
  signing_key:
243
109
  specification_version: 4
244
110
  summary: Defra Ruby on Rails external API mocking engine
245
- test_files:
246
- - spec/spec_helper.rb
247
- - spec/dummy/app/controllers/application_controller.rb
248
- - spec/dummy/app/views/layouts/application.html.erb
249
- - spec/dummy/app/assets/javascripts/application.js
250
- - spec/dummy/app/assets/stylesheets/application.css
251
- - spec/dummy/app/helpers/application_helper.rb
252
- - spec/dummy/bin/rake
253
- - spec/dummy/bin/setup
254
- - spec/dummy/bin/bundle
255
- - spec/dummy/bin/rails
256
- - spec/dummy/config/secrets.yml
257
- - spec/dummy/config/routes.rb
258
- - spec/dummy/config/locales/en.yml
259
- - spec/dummy/config/environments/production.rb
260
- - spec/dummy/config/environments/development.rb
261
- - spec/dummy/config/environments/test.rb
262
- - spec/dummy/config/environment.rb
263
- - spec/dummy/config/application.rb
264
- - spec/dummy/config/boot.rb
265
- - spec/dummy/config/initializers/backtrace_silencers.rb
266
- - spec/dummy/config/initializers/mime_types.rb
267
- - spec/dummy/config/initializers/filter_parameter_logging.rb
268
- - spec/dummy/config/initializers/session_store.rb
269
- - spec/dummy/config/initializers/wrap_parameters.rb
270
- - spec/dummy/config/initializers/assets.rb
271
- - spec/dummy/config/initializers/cookies_serializer.rb
272
- - spec/dummy/config/initializers/to_time_preserves_timezone.rb
273
- - spec/dummy/config/initializers/inflections.rb
274
- - spec/dummy/config.ru
275
- - spec/dummy/Rakefile
276
- - spec/dummy/public/favicon.ico
277
- - spec/dummy/public/422.html
278
- - spec/dummy/public/500.html
279
- - spec/dummy/public/404.html
280
- - spec/dummy/log/test.log
281
- - spec/dummy/README.rdoc
282
- - spec/examples.txt
283
- - spec/defra_ruby_mocks_spec.rb
284
- - spec/requests/govpay_spec.rb
285
- - spec/requests/company_spec.rb
286
- - spec/requests/officers_spec.rb
287
- - spec/support/simplecov.rb
288
- - spec/support/pry.rb
289
- - spec/support/helpers/helpers.rb
290
- - spec/support/helpers/xml_matchers.rb
291
- - spec/support/helpers/configuration.rb
292
- - spec/support/helpers/waste_carriers_engine.rb
293
- - spec/lib/configuration_spec.rb
294
- - spec/fixtures/files/govpay/get_payment_response_submitted.json
295
- - spec/fixtures/files/govpay/get_payment_response_not_found.json
296
- - spec/fixtures/files/govpay/create_payment_created_response.json
297
- - spec/fixtures/files/govpay/get_payment_response_created.json
298
- - spec/fixtures/files/govpay/create_payment_error_response.json
299
- - spec/fixtures/files/govpay/get_payment_response_success.json
300
- - spec/fixtures/files/govpay/get_payment_response_failure.json
301
- - spec/fixtures/files/govpay/get_payment_response_cancelled.json
302
- - spec/fixtures/files/govpay/get_payment_response_error.json
303
- - spec/rails_helper.rb
304
- - spec/services/govpay_get_payment_service_spec.rb
305
- - spec/services/govpay_request_refund_service_spec.rb
306
- - spec/services/companies_house_service_spec.rb
307
- - spec/services/govpay_refund_details_service_spec.rb
308
- - spec/services/govpay_create_payment_service_spec.rb
111
+ test_files: []
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DefraRubyMocks
4
- class ApplicationJob < ActiveJob::Base
5
- end
6
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DefraRubyMocks
4
- class GovpayPaymentCallbackJob < DefraRubyMocks::ApplicationJob
5
- queue_as :default
6
-
7
- def perform(*response_url)
8
- Rails.logger.debug "GovpayPaymentCallbackJob calling response URL #{response_url}"
9
- RestClient::Request.execute(method: :GET, url: response_url[0])
10
- rescue RestClient::ExceptionWithResponse => e
11
- Rails.logger.debug "GovpayPaymentCallbackJob: RestClient received response: #{e}"
12
- rescue StandardError => e
13
- Rails.logger.error("GovpayPaymentCallbackJob: Error sending request to govpay: #{e}")
14
- Airbrake.notify(e, message: "Error on govpay request")
15
- end
16
- end
17
- end