companies_house_input_gateway 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/lib/base.rb +9 -0
  3. data/lib/companies_house_input_gateway/client.rb +46 -0
  4. data/lib/companies_house_input_gateway/config.rb +35 -0
  5. data/lib/companies_house_input_gateway/constants.rb +21 -0
  6. data/lib/companies_house_input_gateway/errors/api_error.rb +18 -0
  7. data/lib/companies_house_input_gateway/errors/companies_house_gateway_error.rb +20 -0
  8. data/lib/companies_house_input_gateway/errors/invalid_request_error.rb +12 -0
  9. data/lib/companies_house_input_gateway/errors/invalid_response_error.rb +6 -0
  10. data/lib/companies_house_input_gateway/form_validator.rb +29 -0
  11. data/lib/companies_house_input_gateway/forms/form_abstract_builder.rb +61 -0
  12. data/lib/companies_house_input_gateway/forms/form_company_data_request.rb +20 -0
  13. data/lib/companies_house_input_gateway/forms/form_confirmation_statement.rb +21 -0
  14. data/lib/companies_house_input_gateway/forms/form_get_submission_status.rb +21 -0
  15. data/lib/companies_house_input_gateway/forms/form_returnof_allotment_shares.rb +21 -0
  16. data/lib/companies_house_input_gateway/forms/form_submission.rb +39 -0
  17. data/lib/companies_house_input_gateway/middleware/check_response.rb +30 -0
  18. data/lib/companies_house_input_gateway/request.rb +57 -0
  19. data/lib/companies_house_input_gateway/requests/abstract_performer.rb +52 -0
  20. data/lib/companies_house_input_gateway/requests/company_data_request.rb +9 -0
  21. data/lib/companies_house_input_gateway/requests/confirmation_statement.rb +11 -0
  22. data/lib/companies_house_input_gateway/requests/get_submission_status.rb +9 -0
  23. data/lib/companies_house_input_gateway/requests/returnof_allotment_shares.rb +11 -0
  24. data/lib/companies_house_input_gateway/util.rb +28 -0
  25. data/lib/companies_house_input_gateway/validations/company_data_request.rb +20 -0
  26. data/lib/companies_house_input_gateway/validations/confirmation_statement.rb +96 -0
  27. data/lib/companies_house_input_gateway/validations/form_submission.rb +23 -0
  28. data/lib/companies_house_input_gateway/validations/get_submission_status.rb +24 -0
  29. data/lib/companies_house_input_gateway/validations/returnof_allotment_shares.rb +41 -0
  30. data/lib/companies_house_input_gateway/version.rb +5 -0
  31. data/lib/companies_house_input_gateway/xml_forms_binder.rb +81 -0
  32. data/lib/companies_house_input_gateway.rb +76 -0
  33. data/spec/client_spec.rb +59 -0
  34. data/spec/companies_house_input_gateway_spec.rb +47 -0
  35. data/spec/data_samples.rb +147 -0
  36. data/spec/fixtures/bad_response.xml +35 -0
  37. data/spec/fixtures/response_company_data_request.xml +330 -0
  38. data/spec/fixtures/response_confirmation_statement.xml +28 -0
  39. data/spec/fixtures/response_get_submission_status.xml +40 -0
  40. data/spec/fixtures/response_returnof_allotment_shares.xml +28 -0
  41. data/spec/form_validator_spec.rb +61 -0
  42. data/spec/request_spec.rb +132 -0
  43. data/spec/spec_helper.rb +32 -0
  44. metadata +206 -0
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CompaniesHouseInputGateway
4
+ module Validations
5
+ ConfirmationStatement = Dry::Validation.Schema do
6
+ configure do
7
+ config.messages_file = File.join(Base.root, './errors.yml')
8
+
9
+ def shareholders_names_presence?(shareholdings)
10
+ check = shareholdings.map do |holdings|
11
+ holdings[:shareholders].any? do |i|
12
+ ((i[:name][:surname] && i[:name][:forename]) && !i[:name][:amalgamated_name]) ||
13
+ (!(i[:name][:surname] || i[:name][:forename]) && i[:name][:amalgamated_name])
14
+ end
15
+ end
16
+ check.all?
17
+ end
18
+
19
+ def other_foreign_country?(shareholdings)
20
+ check = shareholdings.map do |holdings|
21
+ check = holdings[:shareholders].any? do |i|
22
+ next true unless i[:address]
23
+
24
+ !(i[:address][:country] && i[:address][:other_foreign_country])
25
+ end
26
+ end
27
+ check.all?
28
+ end
29
+ end
30
+
31
+ optional(:trading_on_market).filled(:bool?)
32
+ optional(:dtr_5_applies).filled(:bool?)
33
+ optional(:psc_exempt_as_trading_on_regulated_market).filled(:bool?)
34
+ optional(:psc_exempt_as_shares_admitted_on_market).filled(:bool?)
35
+ optional(:psc_exempt_as_trading_on_uk_regulated_market).filled(:bool?)
36
+ required(:review_date).filled(:date?)
37
+
38
+ optional(:sic_codes).schema do
39
+ required(:sic_code).each(:str?)
40
+ end
41
+ # optional(:statement_of_capital).schema do
42
+ # required(:capital).each do
43
+ # schema do
44
+ # required(:total_amount_unpaid).filled(:decimal?)
45
+ # required(:total_number_of_issued_shares).filled(:decimal?)
46
+ # required(:share_currency).filled(:str?)
47
+ # required(:total_aggregate_nominal_value).filled(:decimal?)
48
+ # required(:shares).each do
49
+ # schema do
50
+ # required(:share_class).filled(:str?)
51
+ # required(:prescribed_particulars).filled(:str?)
52
+ # required(:num_shares).filled(:decimal?)
53
+ # required(:aggregate_nominal_value).filled(:decimal?)
54
+ # end
55
+ # end
56
+ # end
57
+ # end
58
+ # end
59
+
60
+ # required(:shareholdings).each do
61
+ # schema do
62
+ # required(:share_class).filled(:str?)
63
+ # required(:number_held).filled(:decimal?)
64
+ # required(:transfers).each do
65
+ # schema do
66
+ # required(:date_of_transfer).filled(:date?)
67
+ # required(:number_shares_transferred).filled(:decimal?)
68
+ # end
69
+ # end
70
+ #
71
+ # optional(:shareholders).each do
72
+ # schema do
73
+ # required(:name).schema do
74
+ # optional(:surname).filled(:str?)
75
+ # optional(:forename).filled(:str?)
76
+ # optional(:amalgamated_name).filled(:str?)
77
+ # end
78
+ # optional(:address).schema do
79
+ # required(:premise).filled(:str?)
80
+ # required(:street).filled(:str?)
81
+ # required(:thoroughfare).filled(:str?)
82
+ # required(:post_town).filled(:str?)
83
+ # required(:county).filled(:str?)
84
+ # optional(:country).filled(included_in?: CompaniesHouseInputGateway::Constants::COUNTRIES)
85
+ # optional(:other_foreign_country).filled(:str?)
86
+ # end
87
+ # end
88
+ # end
89
+ # end
90
+ # end
91
+ required(:state_confirmation).filled(:bool?)
92
+ # required(:shareholdings).filled(:shareholders_names_presence?)
93
+ # required(:shareholdings).filled(:other_foreign_country?)
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CompaniesHouseInputGateway
4
+ module Validations
5
+ FormSubmission = Dry::Validation.Schema do
6
+ configure do
7
+ config.messages_file = File.join(Base.root, './errors.yml')
8
+
9
+ def company_number_format?(value)
10
+ value ? value.match(/^([\d]*\d){8}$/) : true
11
+ end
12
+ end
13
+
14
+ required(:date_signed).filled(:date?)
15
+ required(:company_number).filled(:str?)
16
+ required(:company_name).filled(:str?)
17
+ required(:company_authentication_code).filled(:str?)
18
+ required(:package_reference).filled(:str?)
19
+ required(:submission_number).filled(:str?, size?: 6)
20
+ required(:company_number).filled(:company_number_format?)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CompaniesHouseInputGateway
4
+ module Validations
5
+ GetSubmissionStatus = Dry::Validation.Schema do
6
+ configure do
7
+ config.messages_file = File.join(Base.root, './errors.yml')
8
+
9
+ def company_number_format?(value)
10
+ value ? value.match(/^([\d]*\d){8}$/) : true
11
+ end
12
+ end
13
+
14
+ optional(:company_number).maybe(:str?)
15
+ optional(:submission_number).filled(:str?)
16
+ required(:presenter_id).filled(:str?)
17
+ optional(:company_number).filled(:company_number_format?)
18
+
19
+ rule(company_number_or_submission_number_presence: %i[company_number submission_number]) do |company_number, submission_number|
20
+ company_number.filled?.then(submission_number.none?) & submission_number.filled?.then(company_number.none?)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CompaniesHouseInputGateway
4
+ module Validations
5
+ ReturnofAllotmentShares = Dry::Validation.Schema do
6
+ required(:start_period_shares_allotted).filled(:date?)
7
+ optional(:end_period_shares_allotted).filled(:date?)
8
+
9
+ required(:statement_of_capital).schema do
10
+ required(:capital).each do
11
+ schema do
12
+ required(:total_amount_unpaid).filled(:str?)
13
+ required(:total_number_of_issued_shares).filled(:str?)
14
+ required(:share_currency).filled(:str?)
15
+ required(:total_aggregate_nominal_value).filled(:str?)
16
+ required(:shares).each do
17
+ schema do
18
+ required(:share_class).filled(:str?)
19
+ required(:prescribed_particulars).filled(:str?)
20
+ required(:num_shares).filled(:str?)
21
+ required(:aggregate_nominal_value).filled(:str?)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ required(:allotment).each do
29
+ schema do
30
+ required(:share_class).filled(:str?)
31
+ required(:num_shares).filled(:str?)
32
+ required(:amount_paid_due_per_share).filled(:str?)
33
+ required(:amount_unpaid_per_share).filled(:str?)
34
+ required(:share_currency).filled(:str?)
35
+ required(:share_value).filled(:str?)
36
+ optional(:consideration).filled(:str?)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CompaniesHouseInputGateway
4
+ VERSION = '0.0.6'
5
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CompaniesHouseInputGateway
4
+ class XmlFormsBinder
5
+ def initialize(request_type, config, request_data = {})
6
+ @request_type = request_type
7
+ @request_data = request_data
8
+ @config = config
9
+ end
10
+
11
+ def build_request_xml(submission_form, transaction_id = (Time.now.to_f * 100).to_i)
12
+ # transaction_id = (Time.now.to_f * 100).to_i
13
+ builder = Nokogiri::XML::Builder.new do |xml|
14
+ xml.GovTalkMessage(header_namespace) do
15
+ xml.EnvelopeVersion '1.0'
16
+ xml.Header do
17
+ message_details(xml, request_type, transaction_id)
18
+ sender_authentication(xml)
19
+ end
20
+ xml.GovTalkDetails do
21
+ xml.Keys
22
+ end
23
+ xml.Body do
24
+ build_form(xml, request_type, @request_data, submission_form)
25
+ end
26
+ end
27
+ end
28
+ builder.doc
29
+ end
30
+
31
+ private
32
+
33
+ attr_reader :request_type, :request_data, :config
34
+
35
+ def header_namespace
36
+ {
37
+ 'xmlns' => 'http://www.govtalk.gov.uk/CM/envelope',
38
+ 'xmlns:dsig' => 'http://www.w3.org/2000/09/xmldsig#',
39
+ 'xmlns:gt' => 'http://www.govtalk.gov.uk/schemas/govtalk/core',
40
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
41
+ 'xsi:schemaLocation' => 'http://www.govtalk.gov.uk/CM/envelope http://xmlgw.companieshouse.gov.uk/v2-1/schema/Egov_ch-v2-0.xsd'
42
+ }
43
+ end
44
+
45
+ def build_form(xml, request_type, _request_data, submission_form)
46
+ request_form = Forms.const_get(:"Form#{Util.camelize request_type}").new(xml: xml, data: @request_data[:request_data])
47
+
48
+ if submission_form
49
+ submission_form = Forms::FormSubmission.new(xml: xml, data: @request_data[:submission_data])
50
+ return submission_form.build_form(request_type, request_form)
51
+ end
52
+
53
+ request_form.build_form(request_type, xml)
54
+ end
55
+
56
+ def message_details(xml, request_type, transaction_id)
57
+ request_class = Util.camelize(request_type)
58
+ request_class = request_class == 'ReturnofAllotmentShares' ? 'ReturnOfAllotmentShares' : request_class
59
+
60
+ xml.MessageDetails do
61
+ xml.Class request_class
62
+ xml.Qualifier 'request'
63
+ xml.TransactionID transaction_id
64
+ xml.GatewayTest @config[:gateway].to_i
65
+ end
66
+ end
67
+
68
+ def sender_authentication(xml)
69
+ xml.SenderDetails do
70
+ xml.IDAuthentication do
71
+ xml.SenderID Util.create_digest(@config[:sender_id])
72
+ xml.Authentication do
73
+ xml.Method 'clear'
74
+ xml.Value Util.create_digest(@config[:password])
75
+ end
76
+ end
77
+ xml.EmailAddress @config[:email] if @config[:email]
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday_middleware'
4
+ require 'nokogiri'
5
+ require 'dry-validation'
6
+
7
+ require 'base'
8
+ require 'companies_house_input_gateway/version'
9
+ require 'companies_house_input_gateway/constants'
10
+ require 'companies_house_input_gateway/util'
11
+ require 'companies_house_input_gateway/config'
12
+ require 'companies_house_input_gateway/request'
13
+ require 'companies_house_input_gateway/client'
14
+ require 'companies_house_input_gateway/form_validator'
15
+ require 'companies_house_input_gateway/xml_forms_binder'
16
+ require 'companies_house_input_gateway/middleware/check_response'
17
+
18
+ require 'companies_house_input_gateway/errors/companies_house_gateway_error'
19
+ require 'companies_house_input_gateway/errors/invalid_request_error'
20
+ require 'companies_house_input_gateway/errors/invalid_response_error'
21
+ require 'companies_house_input_gateway/errors/api_error'
22
+
23
+ require 'companies_house_input_gateway/requests/abstract_performer'
24
+ require 'companies_house_input_gateway/requests/returnof_allotment_shares'
25
+ require 'companies_house_input_gateway/requests/confirmation_statement'
26
+ require 'companies_house_input_gateway/requests/get_submission_status'
27
+ require 'companies_house_input_gateway/requests/company_data_request'
28
+
29
+ require 'companies_house_input_gateway/forms/form_abstract_builder'
30
+ require 'companies_house_input_gateway/forms/form_submission'
31
+ require 'companies_house_input_gateway/forms/form_returnof_allotment_shares'
32
+ require 'companies_house_input_gateway/forms/form_confirmation_statement'
33
+ require 'companies_house_input_gateway/forms/form_get_submission_status'
34
+ require 'companies_house_input_gateway/forms/form_company_data_request'
35
+
36
+ require 'companies_house_input_gateway/validations/returnof_allotment_shares'
37
+ require 'companies_house_input_gateway/validations/form_submission'
38
+ require 'companies_house_input_gateway/validations/confirmation_statement'
39
+ require 'companies_house_input_gateway/validations/get_submission_status'
40
+ require 'companies_house_input_gateway/validations/company_data_request'
41
+
42
+ module CompaniesHouseInputGateway
43
+ def self.configure(&block)
44
+ @config = Config.new(&block)
45
+ end
46
+
47
+ def self.perform_check(*args)
48
+ client.perform_check(*args)
49
+ end
50
+
51
+ Constants::SUPPORTED_REQUESTS.each do |name|
52
+ class_eval <<-EOM
53
+ def self.#{Util.underscore(name)}(*args)
54
+ client.send(:#{Util.underscore(name)}, *args)
55
+ end
56
+ EOM
57
+ end
58
+
59
+ # Require configuration before use
60
+ def self.config
61
+ if @config
62
+ @config
63
+ else
64
+ msg = 'No config found. Use CompaniesHouseGateway.configure to set '
65
+ 'username and password. See ' \
66
+ 'https://github.com/irbux/companies_house_input_gateway' \
67
+ 'for details.'
68
+ raise CompaniesHouseGatewayError, msg
69
+ end
70
+ end
71
+
72
+ def self.client
73
+ @client ||= Client.new(config)
74
+ end
75
+ private_class_method :client
76
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ shared_examples 'it delegates to the check' do |method_name|
6
+ it "delegates #{method_name} to " +
7
+ CompaniesHouseInputGateway::Util.camelize(method_name).to_s do
8
+ expect_any_instance_of(CompaniesHouseInputGateway::Requests
9
+ .const_get(CompaniesHouseInputGateway::Util.camelize(method_name)))
10
+ .to receive(:perform).once
11
+ client.send(method_name, {})
12
+ end
13
+ end
14
+
15
+ describe CompaniesHouseInputGateway::Client do
16
+ let(:client) { described_class.new(config) }
17
+ let(:config) { CompaniesHouseInputGateway::Config.new }
18
+
19
+ describe '#new' do
20
+ context 'without a config' do
21
+ before { configure_companies_house_input_gateway }
22
+ subject(:new_client) { described_class.new }
23
+
24
+ describe '#config' do
25
+ subject { super().config }
26
+ it { should_not == CompaniesHouseInputGateway.config }
27
+ end
28
+ it 'has the attributes of the global config' do
29
+ new_client.config[:sender_id] ==
30
+ CompaniesHouseInputGateway.config[:sender_id]
31
+ end
32
+ end
33
+
34
+ context 'with a config' do
35
+ before { config[:first_name] = 'test' }
36
+ subject(:new_client) { described_class.new(config) }
37
+
38
+ describe '#config' do
39
+ subject { super().config }
40
+ it { should_not == config }
41
+ end
42
+ it 'has the attributes of the passed in config' do
43
+ new_client.config[:sender_id] == config[:sender_id]
44
+ end
45
+ end
46
+ end
47
+
48
+ describe '#perform_check' do
49
+ it 'delegates to an instance of Request' do
50
+ expect_any_instance_of(CompaniesHouseInputGateway::Request)
51
+ .to receive(:perform).once
52
+ client.perform_check({}, {})
53
+ end
54
+ end
55
+
56
+ it_behaves_like 'it delegates to the check', :returnof_allotment_shares
57
+ it_behaves_like 'it delegates to the check', :confirmation_statement
58
+ it_behaves_like 'it delegates to the check', :get_submission_status
59
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ shared_examples 'it delegates to the client' do |method_name|
6
+ before { configure_companies_house_input_gateway }
7
+ let(:data) { 'data' }
8
+
9
+ it "delegates #{method_name} to the client" do
10
+ expect_any_instance_of(CompaniesHouseInputGateway::Client)
11
+ .to receive(method_name).with(data)
12
+ CompaniesHouseInputGateway.send(method_name, data)
13
+ end
14
+ end
15
+
16
+ describe CompaniesHouseInputGateway do
17
+ before { CompaniesHouseInputGateway.instance_variable_set(:@config, nil) }
18
+
19
+ describe '#configure' do
20
+ subject { CompaniesHouseInputGateway.config }
21
+ CompaniesHouseInputGateway::Config::DEFAULT_OPTIONS.keys.each do |key|
22
+ context "setting #{key}" do
23
+ before do
24
+ CompaniesHouseInputGateway.configure { |config| config[key] = key }
25
+ end
26
+
27
+ describe [key] do
28
+ subject { super()[key] }
29
+ it { should == key }
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ describe '#config' do
36
+ subject(:config) { CompaniesHouseInputGateway.config }
37
+
38
+ it "raises an error if CompaniesHouseInputGateway hasn't been configured" do
39
+ expect { config }
40
+ .to raise_error CompaniesHouseInputGateway::CompaniesHouseGatewayError
41
+ end
42
+ end
43
+
44
+ it_behaves_like 'it delegates to the client', :returnof_allotment_shares
45
+ it_behaves_like 'it delegates to the client', :confirmation_statement
46
+ it_behaves_like 'it delegates to the client', :get_submission_status
47
+ end
@@ -0,0 +1,147 @@
1
+ # frozen_string_literal: true
2
+
3
+ returnof_allotment_shares = {
4
+ submission_data: {
5
+ date_signed: Date.parse('2015-07-01'),
6
+ company_number: '11111111',
7
+ company_name: 'EXAMPLE COMPANY',
8
+ company_authentication_code: '123456',
9
+ package_reference: '0012',
10
+ submission_number: '100068'
11
+ },
12
+ request_data: {
13
+ start_period_shares_allotted: Date.parse('2016-05-13'),
14
+ end_period_shares_allotted: Date.parse('2016-05-13'),
15
+ statement_of_capital: {
16
+ capital: [{
17
+ total_amount_unpaid: 50.to_s,
18
+ total_number_of_issued_shares: 200.to_s,
19
+ share_currency: 'GBP',
20
+ total_aggregate_nominal_value: 224.6912.to_s,
21
+ shares: [
22
+ { share_class: 'Ordinary A', prescribed_particulars: 'A Particulars', num_shares: 100.to_s, aggregate_nominal_value: 112.3456.to_s },
23
+ { share_class: 'Ordinary B', prescribed_particulars: 'B Particulars', num_shares: 100.to_s, aggregate_nominal_value: 112.3456.to_s }
24
+ ]
25
+ }]
26
+ },
27
+ allotment: [
28
+ {
29
+ share_class: 'Ordinary A',
30
+ num_shares: 100.to_s,
31
+ amount_paid_due_per_share: 6.to_s,
32
+ amount_unpaid_per_share: 4.to_s,
33
+ share_currency: 'GBP',
34
+ share_value: 1.123456.to_s,
35
+ consideration: 'Text for A Consideration'
36
+ },
37
+ { share_class: 'Ordinary B',
38
+ num_shares: 100.to_s,
39
+ amount_paid_due_per_share: 6.to_s,
40
+ amount_unpaid_per_share: 4.to_s,
41
+ share_currency: 'GBP',
42
+ share_value: 1.123456.to_s,
43
+ consideration: 'Text for B Consideration' }
44
+ ]
45
+ }
46
+ }
47
+
48
+ confirmation_statement = {
49
+ submission_data: {
50
+ date_signed: Date.parse('2015-07-01'),
51
+ company_number: '11111111',
52
+ company_name: 'EXAMPLE COMPANY',
53
+ company_authentication_code: '123456',
54
+ package_reference: '0012',
55
+ submission_number: '100070'
56
+ },
57
+ request_data: {
58
+ trading_on_market: true,
59
+ dtr_5_applies: false,
60
+ psc_exempt_as_trading_on_regulated_market: false,
61
+ psc_exempt_as_shares_admitted_on_market: false,
62
+ psc_exempt_as_trading_on_uk_regulated_market: false,
63
+ review_date: Time.now.to_date,
64
+ sic_codes: { sic_code: %w[10410 01130] },
65
+ statement_of_capital: {
66
+ capital: [{
67
+ total_amount_unpaid: 50.to_d,
68
+ total_number_of_issued_shares: 100.to_d,
69
+ share_currency: 'GBP',
70
+ total_aggregate_nominal_value: 112.3456.to_d,
71
+ shares: [{
72
+ share_class: 'Ordinary A',
73
+ prescribed_particulars: 'A Particulars',
74
+ num_shares: 200.to_d,
75
+ aggregate_nominal_value: 112.3456.to_d
76
+ }]
77
+ }]
78
+ },
79
+ shareholdings: [
80
+ {
81
+ share_class: 'Ordinary A',
82
+ number_held: 100.to_d,
83
+ transfers: [
84
+ { date_of_transfer: Time.now.to_date, number_shares_transferred: 1000.to_d }
85
+ ],
86
+ shareholders: [
87
+ {
88
+ name: { surname: 'Master', forename: 'Ruby' },
89
+ address: {
90
+ premise: 'AddressLine 1',
91
+ street: 'AddressLine2',
92
+ thoroughfare: 'AddressLine3',
93
+ post_town: 'PostCode12345',
94
+ county: 'Address County',
95
+ country: 'POL'
96
+ }
97
+ }
98
+ ]
99
+
100
+ },
101
+ {
102
+ share_class: 'Ordinary A',
103
+ number_held: 100.to_d,
104
+ transfers: [
105
+ { date_of_transfer: Time.now.to_date, number_shares_transferred: 1000.to_d }
106
+ ],
107
+ shareholders: [
108
+ {
109
+ name: { amalgamated_name: 'Mater Go Lang' },
110
+ address: {
111
+ premise: 'AddressLine 1',
112
+ street: 'AddressLine2',
113
+ thoroughfare: 'AddressLine3',
114
+ post_town: 'PostCode12345',
115
+ county: 'Address County',
116
+ country: 'POL'
117
+ }
118
+ }
119
+ ]
120
+ }
121
+ ],
122
+ state_confirmation: true
123
+ }
124
+ }
125
+
126
+ get_submission_status = {
127
+ request_data: {
128
+ # company_number: "11111111", # we can request either by company number or by particular submission number
129
+ submission_number: '100086',
130
+ presenter_id: '74d3658da6d7cecf1cfdb1b413c661f2'
131
+ }
132
+ }
133
+
134
+ company_data_request = {
135
+ request_data: {
136
+ company_number: '11111111',
137
+ company_authentication_code: '100031',
138
+ made_up_date: Date.parse('2016-05-13')
139
+ }
140
+ }
141
+
142
+ REQUEST_DATA = {
143
+ returnof_allotment_shares: returnof_allotment_shares,
144
+ confirmation_statement: confirmation_statement,
145
+ get_submission_status: get_submission_status,
146
+ company_data_request: company_data_request
147
+ }.freeze
@@ -0,0 +1,35 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <GovTalkMessage xsi:schemaLocation="http://www.govtalk.gov.uk/CM/envelope http://xmlgw.companieshouse.gov.uk/v1-1/schema/Egov_ch-v2-0.xsd" xmlns="http://www.govtalk.gov.uk/CM/envelope" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:gt="http://www.govtalk.gov.uk/schemas/govtalk/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
3
+ <EnvelopeVersion>1.0</EnvelopeVersion>
4
+ <Header>
5
+ <MessageDetails>
6
+ <Class>Document</Class>
7
+ <Qualifier>error</Qualifier>
8
+ <TransactionID>139335771961</TransactionID>
9
+ <GatewayTimestamp>2014-02-25T19:48:40-00:00</GatewayTimestamp>
10
+ </MessageDetails>
11
+ <SenderDetails>
12
+ <IDAuthentication>
13
+ <SenderID>XMLGatewayTestUserID</SenderID>
14
+ <Authentication>
15
+ <Method>CHMD5</Method>
16
+ <Value>760b2d181e070027c70761eaf1e93f05</Value>
17
+ </Authentication>
18
+ </IDAuthentication>
19
+ </SenderDetails>
20
+ </Header>
21
+ <GovTalkDetails>
22
+ <Keys/>
23
+ <GovTalkErrors>
24
+ <Error>
25
+ <RaisedBy>Document</RaisedBy>
26
+ <Number>604</Number>
27
+ <Type>fatal</Type>
28
+ <Text>Error text</Text>
29
+ <Location></Location>
30
+ </Error>
31
+ </GovTalkErrors>
32
+ </GovTalkDetails>
33
+ <Body>
34
+ </Body>
35
+ </GovTalkMessage>