defra_ruby_mocks 1.0.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +90 -2
- data/Rakefile +0 -2
- data/app/controllers/defra_ruby_mocks/company_controller.rb +1 -1
- data/app/controllers/defra_ruby_mocks/worldpay_controller.rb +51 -0
- data/app/services/defra_ruby_mocks/worldpay_payment_service.rb +47 -0
- data/app/services/defra_ruby_mocks/worldpay_refund_service.rb +37 -0
- data/app/services/defra_ruby_mocks/worldpay_request_handler_service.rb +40 -0
- data/app/services/defra_ruby_mocks/worldpay_resource_service.rb +55 -0
- data/app/services/defra_ruby_mocks/worldpay_response_service.rb +92 -0
- data/app/views/defra_ruby_mocks/worldpay/payment_request.xml.erb +4 -0
- data/app/views/defra_ruby_mocks/worldpay/refund_request.xml.erb +4 -0
- data/app/views/defra_ruby_mocks/worldpay/stuck.html.erb +37 -0
- data/config/routes.rb +11 -0
- data/lib/defra_ruby_mocks/configuration.rb +2 -0
- data/lib/defra_ruby_mocks/engine.rb +3 -0
- data/lib/defra_ruby_mocks/invalid_config_error.rb +9 -0
- data/lib/defra_ruby_mocks/missing_resource_error.rb +9 -0
- data/lib/defra_ruby_mocks/unrecognised_worldpay_request_error.rb +5 -0
- data/lib/defra_ruby_mocks/version.rb +1 -1
- data/spec/dummy/log/development.log +180 -0
- data/spec/dummy/log/test.log +679 -99
- data/spec/examples.txt +83 -30
- data/spec/fixtures/payment_request_invalid.xml +6 -0
- data/spec/fixtures/payment_request_valid.xml +30 -0
- data/spec/fixtures/refund_request_invalid.xml +6 -0
- data/spec/fixtures/refund_request_valid.xml +11 -0
- data/spec/fixtures/unrecognised_request.xml +6 -0
- data/spec/requests/company_spec.rb +3 -3
- data/spec/requests/worldpay_spec.rb +142 -0
- data/spec/services/worldpay_payment_service_spec.rb +95 -0
- data/spec/services/worldpay_refund_service_spec.rb +68 -0
- data/spec/services/worldpay_request_handler_service_spec.rb +79 -0
- data/spec/services/worldpay_resource_service_spec.rb +112 -0
- data/spec/services/worldpay_response_service_spec.rb +156 -0
- data/spec/spec_helper.rb +3 -2
- data/spec/support/helpers/configuration.rb +1 -0
- data/spec/support/helpers/helpers.rb +13 -0
- data/spec/support/helpers/waste_carriers_engine.rb +10 -0
- data/spec/support/helpers/xml_matchers.rb +19 -0
- metadata +75 -8
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails_helper"
|
4
|
+
|
5
|
+
module DefraRubyMocks
|
6
|
+
RSpec.describe WorldpayRequestHandlerService do
|
7
|
+
describe ".run" do
|
8
|
+
context "when a request is made" do
|
9
|
+
|
10
|
+
let(:merchant_code) { "MERCHME" }
|
11
|
+
let(:args) { { merchant_code: merchant_code, xml: xml } }
|
12
|
+
|
13
|
+
context "and it's for a payment" do
|
14
|
+
before do
|
15
|
+
allow_any_instance_of(WorldpayPaymentService).to receive(:generate_id) { order_id }
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:xml) { Nokogiri::XML(File.read("spec/fixtures/payment_request_valid.xml")) }
|
19
|
+
let(:order_id) { "1234567890" }
|
20
|
+
let(:request_type) { { request_type: :payment } }
|
21
|
+
let(:response_values) do
|
22
|
+
{
|
23
|
+
merchant_code: merchant_code,
|
24
|
+
order_code: "1577726052",
|
25
|
+
id: order_id,
|
26
|
+
url: "http://example.com"
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
it "correctly determines the request service to use" do
|
31
|
+
expect(WorldpayPaymentService).to receive(:run).with(args) { response_values }
|
32
|
+
|
33
|
+
described_class.run(xml)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns the values the controller needs to handle the request" do
|
37
|
+
expect(WorldpayPaymentService).to receive(:run).with(args) { response_values }
|
38
|
+
|
39
|
+
expect(described_class.run(xml)).to eq(request_type.merge(response_values))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "and it's for a refund" do
|
44
|
+
let(:xml) { Nokogiri::XML(File.read("spec/fixtures/refund_request_valid.xml")) }
|
45
|
+
let(:request_type) { { request_type: :refund } }
|
46
|
+
let(:response_values) do
|
47
|
+
{
|
48
|
+
merchant_code: merchant_code,
|
49
|
+
order_code: "1579644835",
|
50
|
+
refund_value: "2500",
|
51
|
+
currency_code: "GBP",
|
52
|
+
exponent: "2"
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
it "correctly determines the request service to use" do
|
57
|
+
expect(WorldpayRefundService).to receive(:run).with(args) { response_values }
|
58
|
+
|
59
|
+
described_class.run(xml)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "returns the values the controller needs to handle the request" do
|
63
|
+
expect(WorldpayRefundService).to receive(:run).with(args) { response_values }
|
64
|
+
|
65
|
+
expect(described_class.run(xml)).to eq(request_type.merge(response_values))
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context "but it's not recognised" do
|
70
|
+
let(:xml) { Nokogiri::XML(File.read("spec/fixtures/unrecognised_request.xml")) }
|
71
|
+
|
72
|
+
it "raises a 'UnrecognisedWorldpayRequestError'" do
|
73
|
+
expect { described_class.run(xml) }.to raise_error UnrecognisedWorldpayRequestError
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails_helper"
|
4
|
+
|
5
|
+
module DefraRubyMocks
|
6
|
+
RSpec.describe WorldpayResourceService do
|
7
|
+
before(:each) do
|
8
|
+
allow(::WasteCarriersEngine::TransientRegistration).to receive(:where) { transient_relation }
|
9
|
+
allow(::WasteCarriersEngine::Registration).to receive(:where) { registration_relation }
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:reference) { "12345" }
|
13
|
+
let(:company_name) { "Pay for the thing" }
|
14
|
+
|
15
|
+
let(:resource) { double(:resource, finance_details: finance_details, company_name: company_name) }
|
16
|
+
let(:finance_details) { double(:finance_details, orders: orders) }
|
17
|
+
let(:orders) { double(:orders, order_by: sorted_orders) }
|
18
|
+
let(:sorted_orders) { double(:sorted_orders, first: order) }
|
19
|
+
let(:order) { double(:order) }
|
20
|
+
|
21
|
+
let(:args) { { reference: reference } }
|
22
|
+
|
23
|
+
describe ".run" do
|
24
|
+
|
25
|
+
context "when the resource is a TransientRegistration" do
|
26
|
+
let(:transient_relation) { double(:relation, first: resource) }
|
27
|
+
|
28
|
+
it "will only search transient registrations" do
|
29
|
+
described_class.run(args)
|
30
|
+
|
31
|
+
expect(::WasteCarriersEngine::TransientRegistration).to have_received(:where).with(token: reference)
|
32
|
+
|
33
|
+
expect(::WasteCarriersEngine::Registration).not_to have_received(:where).with(reg_uuid: reference)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns an object with the matching resource" do
|
37
|
+
expect(described_class.run(args).resource).to eq(resource)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "returns an object with the expected order" do
|
41
|
+
expect(described_class.run(args).order).to eq(order)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "returns an object with the expected company name" do
|
45
|
+
expect(described_class.run(args).company_name).to eq(company_name.downcase)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "when the resource is a Registration" do
|
50
|
+
let(:transient_relation) { double(:relation, first: nil) }
|
51
|
+
let(:registration_relation) { double(:relation, first: resource) }
|
52
|
+
|
53
|
+
it "will search transient registrations first, then registrations" do
|
54
|
+
described_class.run(args)
|
55
|
+
|
56
|
+
expect(::WasteCarriersEngine::TransientRegistration).to have_received(:where).with(token: reference)
|
57
|
+
|
58
|
+
expect(::WasteCarriersEngine::Registration).to have_received(:where).with(reg_uuid: reference)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "returns an object with the matching resource" do
|
62
|
+
expect(described_class.run(args).resource).to eq(resource)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "returns an object with the expected order" do
|
66
|
+
expect(described_class.run(args).order).to eq(order)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "returns an object with the expected company name" do
|
70
|
+
expect(described_class.run(args).company_name).to eq(company_name.downcase)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context "when the resource is a OrderCopyCardsRegistration" do
|
75
|
+
before do
|
76
|
+
# Because we do not copy the company name to
|
77
|
+
# `OrderCopyCardsRegistration` instances when we create them in WCR
|
78
|
+
# we need to locate the orignal registration they are based on. We
|
79
|
+
# determine in the class if the 'resource' is an instance of one by
|
80
|
+
# comparing the result of resource.class.to_s to
|
81
|
+
# "WasteCarriersEngine::OrderCopyCardsRegistration". The problem is
|
82
|
+
# when testing 'resource' is actually an instance of
|
83
|
+
# `RSpec::Mocks::Double`! So we subvert the call to class on
|
84
|
+
# RSpec::Mocks::Double to return "WasteCarriersEngine::OrderCopyCardsRegistration"
|
85
|
+
# just in this spec. We can then test that the service does indeed
|
86
|
+
# locate the original registration for a company name
|
87
|
+
allow_any_instance_of(RSpec::Mocks::Double).to receive(:class)
|
88
|
+
.and_return("WasteCarriersEngine::OrderCopyCardsRegistration")
|
89
|
+
end
|
90
|
+
|
91
|
+
let(:copy_card_resource) { double(:resource, finance_details: finance_details, reg_identifier: "CBDU123") }
|
92
|
+
let(:transient_relation) { double(:relation, first: copy_card_resource) }
|
93
|
+
let(:registration_relation) { double(:relation, first: resource) }
|
94
|
+
|
95
|
+
it "locates the original registration to grab the company name" do
|
96
|
+
expect(described_class.run(args).company_name).to eq(company_name.downcase)
|
97
|
+
|
98
|
+
expect(::WasteCarriersEngine::Registration).to have_received(:where).with(reg_identifier: "CBDU123")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context "when the resource does not exist" do
|
103
|
+
let(:transient_relation) { double(:relation, first: nil) }
|
104
|
+
let(:registration_relation) { double(:relation, first: nil) }
|
105
|
+
|
106
|
+
it "causes an error" do
|
107
|
+
expect { described_class.run(args) }.to raise_error MissingResourceError
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails_helper"
|
4
|
+
|
5
|
+
module DefraRubyMocks
|
6
|
+
|
7
|
+
RSpec.describe WorldpayResponseService do
|
8
|
+
before(:each) do
|
9
|
+
Helpers::Configuration.prep_for_tests
|
10
|
+
DefraRubyMocks.configure do |config|
|
11
|
+
config.worldpay_admin_code = admin_code
|
12
|
+
config.worldpay_merchant_code = merchant_code
|
13
|
+
config.worldpay_mac_secret = mac_secret
|
14
|
+
end
|
15
|
+
|
16
|
+
allow(WorldpayResourceService).to receive(:run) { resource }
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:resource) { double(:resource, order: order, company_name: company_name.downcase) }
|
20
|
+
|
21
|
+
let(:admin_code) { "admincode1" }
|
22
|
+
let(:merchant_code) { "merchantcode1" }
|
23
|
+
let(:mac_secret) { "mac1" }
|
24
|
+
let(:reference) { "12345" }
|
25
|
+
let(:order_code) { "54321" }
|
26
|
+
let(:order_key) { "#{admin_code}^#{merchant_code}^#{order_code}" }
|
27
|
+
let(:order_value) { 105_00 }
|
28
|
+
let(:payment_status) { :AUTHORISED }
|
29
|
+
let(:company_name) { "Pay for the thing" }
|
30
|
+
|
31
|
+
let(:order) { double(:order, order_code: order_code, total_amount: order_value) }
|
32
|
+
|
33
|
+
let(:mac) do
|
34
|
+
data = [
|
35
|
+
order_key,
|
36
|
+
order_value,
|
37
|
+
"GBP",
|
38
|
+
payment_status,
|
39
|
+
mac_secret
|
40
|
+
]
|
41
|
+
|
42
|
+
Digest::MD5.hexdigest(data.join).to_s
|
43
|
+
end
|
44
|
+
|
45
|
+
let(:query_string) do
|
46
|
+
[
|
47
|
+
"orderKey=#{order_key}",
|
48
|
+
"paymentStatus=#{payment_status}",
|
49
|
+
"paymentAmount=#{order_value}",
|
50
|
+
"paymentCurrency=GBP",
|
51
|
+
"mac=#{mac}",
|
52
|
+
"source=WP"
|
53
|
+
].join("&")
|
54
|
+
end
|
55
|
+
|
56
|
+
let(:args) { { success_url: success_url, failure_url: failure_url } }
|
57
|
+
|
58
|
+
describe ".run" do
|
59
|
+
context "when the request comes from the waste-carriers-front-office" do
|
60
|
+
let(:success_url) { "http://example.com/fo/#{reference}/worldpay/success" }
|
61
|
+
let(:failure_url) { "http://example.com/fo/#{reference}/worldpay/failure" }
|
62
|
+
|
63
|
+
context "and is valid" do
|
64
|
+
let(:relation) { double(:relation, first: registration) }
|
65
|
+
|
66
|
+
it "can extract the reference from the `success_url`" do
|
67
|
+
expect(described_class.run(args).reference).to eq(reference)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "can generate a valid order key" do
|
71
|
+
expect(described_class.run(args).order_key).to eq(order_key)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "can generate a valid mac" do
|
75
|
+
expect(described_class.run(args).mac).to eq(mac)
|
76
|
+
end
|
77
|
+
|
78
|
+
context "and is for a successful payment" do
|
79
|
+
it "returns a url in the expected format" do
|
80
|
+
expected_response_url = "#{success_url}?#{query_string}"
|
81
|
+
|
82
|
+
expect(described_class.run(args).url).to eq(expected_response_url)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context "and is for a rejected payment" do
|
87
|
+
let(:payment_status) { :REFUSED }
|
88
|
+
let(:company_name) { "Reject for the thing" }
|
89
|
+
|
90
|
+
it "returns a url in the expected format" do
|
91
|
+
expected_response_url = "#{failure_url}?#{query_string}"
|
92
|
+
|
93
|
+
expect(described_class.run(args).url).to eq(expected_response_url)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context "and is for a stuck payment" do
|
98
|
+
let(:company_name) { "Give me a stuck thing" }
|
99
|
+
|
100
|
+
it "returns a status of :STUCK" do
|
101
|
+
expect(described_class.run(args).status).to eq(:STUCK)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context "when the request comes from the waste-carriers-frontend" do
|
108
|
+
let(:success_url) { "http://example.com/your-registration/#{reference}/worldpay/success/54321/NEWREG?locale=en" }
|
109
|
+
let(:failure_url) { "http://example.com/your-registration/#{reference}/worldpay/failure/54321/NEWREG?locale=en" }
|
110
|
+
|
111
|
+
context "and is valid" do
|
112
|
+
let(:relation) { double(:relation, first: registration) }
|
113
|
+
|
114
|
+
it "can extract the reference from the `success_url`" do
|
115
|
+
expect(described_class.run(args).reference).to eq(reference)
|
116
|
+
end
|
117
|
+
|
118
|
+
it "can generate a valid order key" do
|
119
|
+
expect(described_class.run(args).order_key).to eq(order_key)
|
120
|
+
end
|
121
|
+
|
122
|
+
it "can generate a valid mac" do
|
123
|
+
expect(described_class.run(args).mac).to eq(mac)
|
124
|
+
end
|
125
|
+
|
126
|
+
context "and is for a successful payment" do
|
127
|
+
it "returns a url in the expected format" do
|
128
|
+
expected_response_url = "#{success_url}&#{query_string}"
|
129
|
+
|
130
|
+
expect(described_class.run(args).url).to eq(expected_response_url)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
context "and is for a rejected payment" do
|
135
|
+
let(:payment_status) { :REFUSED }
|
136
|
+
let(:company_name) { "Reject for the thing" }
|
137
|
+
|
138
|
+
it "returns a url in the expected format" do
|
139
|
+
expected_response_url = "#{failure_url}&#{query_string}"
|
140
|
+
|
141
|
+
expect(described_class.run(args).url).to eq(expected_response_url)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
context "and is for a stuck payment" do
|
146
|
+
let(:company_name) { "Give me a stuck thing" }
|
147
|
+
|
148
|
+
it "returns a status of :STUCK" do
|
149
|
+
expect(described_class.run(args).status).to eq(:STUCK)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# Require and run our simplecov initializer as the very first thing we do.
|
4
|
+
# This is as per its docs https://github.com/colszowka/simplecov#getting-started
|
5
|
+
require "./spec/support/simplecov"
|
5
6
|
|
6
7
|
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
7
8
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rspec/expectations"
|
4
|
+
|
5
|
+
RSpec::Matchers.define :be_xml do
|
6
|
+
match do
|
7
|
+
begin
|
8
|
+
Nokogiri::XML(actual, &:strict)
|
9
|
+
|
10
|
+
true
|
11
|
+
rescue Nokogiri::XML::SyntaxError
|
12
|
+
false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
failure_message do |actual|
|
17
|
+
"expected that \"#{actual}\" would be a valid XML document"
|
18
|
+
end
|
19
|
+
end
|
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: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Defra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.2.11.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
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: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: github_changelog_generator
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +112,16 @@ dependencies:
|
|
84
112
|
name: simplecov
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
86
114
|
requirements:
|
87
|
-
- - "
|
115
|
+
- - "~>"
|
88
116
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
117
|
+
version: 0.17.1
|
90
118
|
type: :development
|
91
119
|
prerelease: false
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
93
121
|
requirements:
|
94
|
-
- - "
|
122
|
+
- - "~>"
|
95
123
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
124
|
+
version: 0.17.1
|
97
125
|
description: A Rails engine which can be used to mock external services when loaded
|
98
126
|
into an application
|
99
127
|
email:
|
@@ -107,14 +135,26 @@ files:
|
|
107
135
|
- Rakefile
|
108
136
|
- app/controllers/defra_ruby_mocks/application_controller.rb
|
109
137
|
- app/controllers/defra_ruby_mocks/company_controller.rb
|
138
|
+
- app/controllers/defra_ruby_mocks/worldpay_controller.rb
|
110
139
|
- app/services/defra_ruby_mocks/base_service.rb
|
111
140
|
- app/services/defra_ruby_mocks/companies_house_service.rb
|
141
|
+
- app/services/defra_ruby_mocks/worldpay_payment_service.rb
|
142
|
+
- app/services/defra_ruby_mocks/worldpay_refund_service.rb
|
143
|
+
- app/services/defra_ruby_mocks/worldpay_request_handler_service.rb
|
144
|
+
- app/services/defra_ruby_mocks/worldpay_resource_service.rb
|
145
|
+
- app/services/defra_ruby_mocks/worldpay_response_service.rb
|
112
146
|
- app/views/defra_ruby_mocks/company/not_found.json.erb
|
113
147
|
- app/views/defra_ruby_mocks/company/show.json.erb
|
148
|
+
- app/views/defra_ruby_mocks/worldpay/payment_request.xml.erb
|
149
|
+
- app/views/defra_ruby_mocks/worldpay/refund_request.xml.erb
|
150
|
+
- app/views/defra_ruby_mocks/worldpay/stuck.html.erb
|
114
151
|
- config/routes.rb
|
115
152
|
- lib/defra_ruby_mocks.rb
|
116
153
|
- lib/defra_ruby_mocks/configuration.rb
|
117
154
|
- lib/defra_ruby_mocks/engine.rb
|
155
|
+
- lib/defra_ruby_mocks/invalid_config_error.rb
|
156
|
+
- lib/defra_ruby_mocks/missing_resource_error.rb
|
157
|
+
- lib/defra_ruby_mocks/unrecognised_worldpay_request_error.rb
|
118
158
|
- lib/defra_ruby_mocks/version.rb
|
119
159
|
- lib/tasks/changelog.rake
|
120
160
|
- lib/tasks/defra_ruby_mocks_tasks.rake
|
@@ -156,12 +196,26 @@ files:
|
|
156
196
|
- spec/dummy/public/500.html
|
157
197
|
- spec/dummy/public/favicon.ico
|
158
198
|
- spec/examples.txt
|
199
|
+
- spec/fixtures/payment_request_invalid.xml
|
200
|
+
- spec/fixtures/payment_request_valid.xml
|
201
|
+
- spec/fixtures/refund_request_invalid.xml
|
202
|
+
- spec/fixtures/refund_request_valid.xml
|
203
|
+
- spec/fixtures/unrecognised_request.xml
|
159
204
|
- spec/lib/configuration_spec.rb
|
160
205
|
- spec/rails_helper.rb
|
161
206
|
- spec/requests/company_spec.rb
|
207
|
+
- spec/requests/worldpay_spec.rb
|
162
208
|
- spec/services/companies_house_service_spec.rb
|
209
|
+
- spec/services/worldpay_payment_service_spec.rb
|
210
|
+
- spec/services/worldpay_refund_service_spec.rb
|
211
|
+
- spec/services/worldpay_request_handler_service_spec.rb
|
212
|
+
- spec/services/worldpay_resource_service_spec.rb
|
213
|
+
- spec/services/worldpay_response_service_spec.rb
|
163
214
|
- spec/spec_helper.rb
|
164
215
|
- spec/support/helpers/configuration.rb
|
216
|
+
- spec/support/helpers/helpers.rb
|
217
|
+
- spec/support/helpers/waste_carriers_engine.rb
|
218
|
+
- spec/support/helpers/xml_matchers.rb
|
165
219
|
- spec/support/pry.rb
|
166
220
|
- spec/support/simplecov.rb
|
167
221
|
homepage: https://github.com/DEFRA/defra-ruby-mocks
|
@@ -183,8 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
237
|
- !ruby/object:Gem::Version
|
184
238
|
version: '0'
|
185
239
|
requirements: []
|
186
|
-
|
187
|
-
rubygems_version: 2.6.13
|
240
|
+
rubygems_version: 3.0.0
|
188
241
|
signing_key:
|
189
242
|
specification_version: 4
|
190
243
|
summary: Defra Ruby on Rails external API mocking engine
|
@@ -229,9 +282,23 @@ test_files:
|
|
229
282
|
- spec/examples.txt
|
230
283
|
- spec/defra_ruby_mocks_spec.rb
|
231
284
|
- spec/requests/company_spec.rb
|
285
|
+
- spec/requests/worldpay_spec.rb
|
232
286
|
- spec/support/simplecov.rb
|
233
287
|
- spec/support/pry.rb
|
288
|
+
- spec/support/helpers/helpers.rb
|
289
|
+
- spec/support/helpers/xml_matchers.rb
|
234
290
|
- spec/support/helpers/configuration.rb
|
291
|
+
- spec/support/helpers/waste_carriers_engine.rb
|
235
292
|
- spec/lib/configuration_spec.rb
|
293
|
+
- spec/fixtures/unrecognised_request.xml
|
294
|
+
- spec/fixtures/payment_request_invalid.xml
|
295
|
+
- spec/fixtures/refund_request_valid.xml
|
296
|
+
- spec/fixtures/payment_request_valid.xml
|
297
|
+
- spec/fixtures/refund_request_invalid.xml
|
236
298
|
- spec/rails_helper.rb
|
299
|
+
- spec/services/worldpay_response_service_spec.rb
|
300
|
+
- spec/services/worldpay_resource_service_spec.rb
|
237
301
|
- spec/services/companies_house_service_spec.rb
|
302
|
+
- spec/services/worldpay_payment_service_spec.rb
|
303
|
+
- spec/services/worldpay_refund_service_spec.rb
|
304
|
+
- spec/services/worldpay_request_handler_service_spec.rb
|