tochka_cyclops_api 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +65 -8
  3. data/Rakefile +0 -4
  4. data/lib/tasks/methods.rake +11 -0
  5. data/lib/tochka_cyclops_api/data_processor.rb +44 -19
  6. data/lib/tochka_cyclops_api/generators/templates/tochka_cyclops_request_model_template.rb +1 -1
  7. data/lib/tochka_cyclops_api/generators/templates/tochka_cyclops_responses_migration_template.rb +1 -1
  8. data/lib/tochka_cyclops_api/methods.rb +198 -5
  9. data/lib/tochka_cyclops_api/request.rb +66 -31
  10. data/lib/tochka_cyclops_api/response.rb +27 -34
  11. data/lib/tochka_cyclops_api/result.rb +33 -0
  12. data/lib/tochka_cyclops_api/schemas/requests/activate_beneficiary.rb +22 -0
  13. data/lib/tochka_cyclops_api/schemas/requests/create_beneficiary_fl.rb +56 -0
  14. data/lib/tochka_cyclops_api/schemas/requests/create_beneficiary_ip.rb +22 -10
  15. data/lib/tochka_cyclops_api/schemas/requests/create_beneficiary_ul.rb +22 -10
  16. data/lib/tochka_cyclops_api/schemas/requests/deactivate_beneficiary.rb +22 -0
  17. data/lib/tochka_cyclops_api/schemas/requests/echo.rb +2 -0
  18. data/lib/tochka_cyclops_api/schemas/requests/get_beneficiary.rb +22 -0
  19. data/lib/tochka_cyclops_api/schemas/requests/list_beneficiary.rb +44 -0
  20. data/lib/tochka_cyclops_api/schemas/requests/update_beneficiary_fl.rb +51 -0
  21. data/lib/tochka_cyclops_api/schemas/requests/update_beneficiary_ip.rb +39 -0
  22. data/lib/tochka_cyclops_api/schemas/requests/update_beneficiary_ul.rb +38 -0
  23. data/lib/tochka_cyclops_api/schemas/responses/activate_beneficiary.rb +24 -0
  24. data/lib/tochka_cyclops_api/schemas/responses/create_beneficiary_fl.rb +24 -0
  25. data/lib/tochka_cyclops_api/schemas/responses/create_beneficiary_ip.rb +10 -1
  26. data/lib/tochka_cyclops_api/schemas/responses/create_beneficiary_ul.rb +9 -9
  27. data/lib/tochka_cyclops_api/schemas/responses/deactivate_beneficiary.rb +24 -0
  28. data/lib/tochka_cyclops_api/schemas/responses/echo.rb +1 -1
  29. data/lib/tochka_cyclops_api/schemas/responses/error.rb +5 -2
  30. data/lib/tochka_cyclops_api/schemas/responses/get_beneficiary.rb +48 -0
  31. data/lib/tochka_cyclops_api/schemas/responses/list_beneficiary.rb +38 -0
  32. data/lib/tochka_cyclops_api/schemas/responses/update_beneficiary_fl.rb +20 -0
  33. data/lib/tochka_cyclops_api/schemas/responses/update_beneficiary_ip.rb +20 -0
  34. data/lib/tochka_cyclops_api/schemas/responses/update_beneficiary_ul.rb +24 -0
  35. data/lib/tochka_cyclops_api/schemas/results/local_error.rb +0 -0
  36. data/lib/tochka_cyclops_api/test.rb +0 -0
  37. data/lib/tochka_cyclops_api/version.rb +1 -1
  38. data/lib/tochka_cyclops_api.rb +5 -2
  39. metadata +22 -2
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TochkaCyclopsApi
4
+ # Displays the result of request
5
+ class Result
6
+ attr_reader :success, :data, :error_message
7
+
8
+ def self.create(success, data = nil, error_message = nil)
9
+ @success = success
10
+ @data = data
11
+ @error_message = error_message
12
+
13
+ display_result
14
+ end
15
+
16
+ def self.success(data)
17
+ Result.create(true, data)
18
+ end
19
+
20
+ def self.failure(error_message)
21
+ Result.create(false, nil, error_message)
22
+ end
23
+
24
+ private
25
+
26
+ def self.display_result
27
+ {
28
+ success: @success,
29
+ data: @data || @error_message
30
+ }
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-validation'
4
+
5
+ module TochkaCyclopsApi
6
+ module Schemas
7
+ module Requests
8
+ # https://api.tochka.com/static/v1/tender-docs/cyclops/main/api_v2.html#api-v2-activate-beneficiary
9
+ class ActivateBeneficiary < Dry::Validation::Contract
10
+ schema do
11
+ required(:beneficiary_id).value(:string)
12
+ end
13
+
14
+ EXAMPLE = "
15
+ {
16
+ beneficiary_id: '981fee11-9969-4e80-9f5f-02af462cb51e'
17
+ }
18
+ "
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-validation'
4
+
5
+ module TochkaCyclopsApi
6
+ module Schemas
7
+ module Requests
8
+ # https://api.tochka.com/static/v1/tender-docs/cyclops/main/api_v2.html#api-v2-create-beneficiary-fl
9
+ class CreateBeneficiaryFl < Dry::Validation::Contract
10
+ # Schema for beneficiary_data field of main schema
11
+ class BeneficiaryData < Dry::Validation::Contract
12
+ params do
13
+ required(:first_name).value(:string)
14
+ required(:last_name).value(:string)
15
+ required(:birth_date).value(:string)
16
+ required(:birth_place).value(:string)
17
+ required(:passport_number).value(:string)
18
+ required(:passport_date).value(:string)
19
+ required(:registration_address).value(:string)
20
+
21
+ optional(:passport_series).value(:string)
22
+ optional(:middle_name).value(:string)
23
+ optional(:resident).value(:bool)
24
+ end
25
+ end
26
+
27
+ schema do
28
+ required(:inn).value(:string)
29
+ required(:beneficiary_data).schema(
30
+ TochkaCyclopsApi::Schemas::Requests::CreateBeneficiaryFl::BeneficiaryData.schema
31
+ )
32
+
33
+ optional(:nominal_account_code).value(:string)
34
+ optional(:nominal_account_bic).value(:string)
35
+ end
36
+
37
+ EXAMPLE ="
38
+ {
39
+ inn: '7925930371',
40
+ nominal_account_code: '000000000000000000000',
41
+ nominal_account_bic: '0000000000',
42
+ beneficiary_data: {
43
+ first_name: 'Иван',
44
+ last_name: 'Иванов',
45
+ birth_date: '1990-01-24',
46
+ birth_place: 'г. Свердловск',
47
+ passport_series: '6509',
48
+ passport_number: '123456',
49
+ passport_date: '2020-01-01',
50
+ registration_address: '683031, г. Петропавловск-Камчатский, пр-кт. Карла Маркса, д. 21/1, офис 305'
51
+ }
52
+ }"
53
+ end
54
+ end
55
+ end
56
+ end
@@ -5,25 +5,37 @@ require 'dry-validation'
5
5
  module TochkaCyclopsApi
6
6
  module Schemas
7
7
  module Requests
8
- # Schema for beneficiary_data field of main schema
9
- class BeneficiaryData < Dry::Validation::Contract
10
- params do
11
- required(:first_name).value(:string)
12
- required(:last_name).value(:string)
13
- optional(:middle_name).value(:string)
14
- end
15
- end
16
-
17
8
  # https://api.tochka.com/static/v1/tender-docs/cyclops/main/api_v2.html#api-v2-create-beneficiary-ip
18
9
  class CreateBeneficiaryIp < Dry::Validation::Contract
10
+ # Schema for beneficiary_data field of main schema
11
+ class BeneficiaryData < Dry::Validation::Contract
12
+ params do
13
+ required(:first_name).value(:string)
14
+ required(:last_name).value(:string)
15
+ optional(:middle_name).value(:string)
16
+ end
17
+ end
18
+
19
19
  schema do
20
20
  required(:inn).value(:string)
21
21
  optional(:nominal_account_code).value(:string)
22
22
  optional(:nominal_account_bic).value(:string)
23
23
  required(:beneficiary_data).schema(
24
- TochkaCyclopsApi::Schemas::Reuqests::BeneficiaryData.schema
24
+ TochkaCyclopsApi::Schemas::Requests::CreateBeneficiaryIp::BeneficiaryData.schema
25
25
  )
26
26
  end
27
+
28
+ EXAMPLE =
29
+ "{
30
+ inn: '7743745038',
31
+ nominal_account_code: '40702810338170022645',
32
+ nominal_account_bic: '044525225',
33
+ beneficiary_data: {
34
+ first_name: 'Иван',
35
+ last_name: 'Иванов',
36
+ middle_name: 'Иванович'
37
+ }
38
+ }"
27
39
  end
28
40
  end
29
41
  end
@@ -5,25 +5,37 @@ require 'dry-validation'
5
5
  module TochkaCyclopsApi
6
6
  module Schemas
7
7
  module Requests
8
- # Schema for beneficiary_data field of main schema
9
- class BeneficiaryData < Dry::Validation::Contract
10
- params do
11
- required(:name).value(:string)
12
- required(:kpp).value(:string)
13
- optional(:ogrn).value(:string)
14
- end
15
- end
16
-
17
8
  # https://api.tochka.com/static/v1/tender-docs/cyclops/main/api_v2.html#api-v2-create-beneficiary-ul
18
9
  class CreateBeneficiaryUl < Dry::Validation::Contract
10
+ # Schema for beneficiary_data field of main schema
11
+ class BeneficiaryData < Dry::Validation::Contract
12
+ params do
13
+ required(:name).value(:string)
14
+ required(:kpp).value(:string)
15
+ optional(:ogrn).value(:string)
16
+ end
17
+ end
18
+
19
19
  schema do
20
20
  required(:inn).value(:string)
21
21
  optional(:nominal_account_code).value(:string)
22
22
  optional(:nominal_account_bic).value(:string)
23
23
  required(:beneficiary_data).schema(
24
- TochkaCyclopsApi::Schemas::Requests::BeneficiaryData.schema
24
+ TochkaCyclopsApi::Schemas::Requests::CreateBeneficiaryUl::BeneficiaryData.schema
25
25
  )
26
26
  end
27
+
28
+ EXAMPLE =
29
+ "{
30
+ inn: '7743745038',
31
+ nominal_account_code: '40702810338170022645',
32
+ nominal_account_bic: '044525225',
33
+ beneficiary_data: {
34
+ name: 'ООО «ТК ИнжСтройКомплект»',
35
+ kpp: '773401001',
36
+ ogrn: '1097746324169'
37
+ }
38
+ }"
27
39
  end
28
40
  end
29
41
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-validation'
4
+
5
+ module TochkaCyclopsApi
6
+ module Schemas
7
+ module Requests
8
+ # https://api.tochka.com/static/v1/tender-docs/cyclops/main/api_v2.html#api-v2-deactivate-beneficiary
9
+ class DeactivateBeneficiary < Dry::Validation::Contract
10
+ schema do
11
+ required(:beneficiary_id).value(:string)
12
+ end
13
+
14
+ EXAMPLE = "
15
+ {
16
+ beneficiary_id: '981fee11-9969-4e80-9f5f-02af462cb51e'
17
+ }
18
+ "
19
+ end
20
+ end
21
+ end
22
+ end
@@ -10,6 +10,8 @@ module TochkaCyclopsApi
10
10
  schema do
11
11
  required(:text).value(:string)
12
12
  end
13
+
14
+ EXAMPLE = "{ text: 'Echo' }"
13
15
  end
14
16
  end
15
17
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-validation'
4
+
5
+ module TochkaCyclopsApi
6
+ module Schemas
7
+ module Requests
8
+ # https://api.tochka.com/static/v1/tender-docs/cyclops/main/api_v2.html#api-v2-get-beneficiary
9
+ class GetBeneficiary < Dry::Validation::Contract
10
+ schema do
11
+ required(:beneficiary_id).value(:string)
12
+ end
13
+
14
+ EXAMPLE = "
15
+ {
16
+ beneficiary_id: '981fee11-9969-4e80-9f5f-02af462cb51e'
17
+ }
18
+ "
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-validation'
4
+
5
+ module TochkaCyclopsApi
6
+ module Schemas
7
+ module Requests
8
+ # https://api.tochka.com/static/v1/tender-docs/cyclops/main/api_v2.html#api-v2-list-beneficiary
9
+ class ListBeneficiary < Dry::Validation::Contract
10
+ # Schema for beneficiary_data field of main schema
11
+ class Filters < Dry::Validation::Contract
12
+ params do
13
+ optional(:inn).value(:string)
14
+ optional(:is_active).value(:bool)
15
+ optional(:legal_type).value(:string)
16
+ optional(:nominal_account_code).value(:string)
17
+ optional(:nominal_account_bic).value(:string)
18
+ end
19
+ end
20
+
21
+ schema do
22
+ optional(:page).value(:integer)
23
+ optional(:per_page).value(:integer)
24
+ optional(:filters).schema(
25
+ TochkaCyclopsApi::Schemas::Requests::ListBeneficiary::Filters.schema
26
+ )
27
+ end
28
+
29
+ EXAMPLE = "
30
+ {
31
+ page: 2,
32
+ per_page: 20,
33
+ filters: {
34
+ is_active: true,
35
+ legal_type: 'F',
36
+ nominal_account_code: '000000000000000000000',
37
+ nominal_account_bic: '0000000000',
38
+ }
39
+ }
40
+ "
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-validation'
4
+
5
+ module TochkaCyclopsApi
6
+ module Schemas
7
+ module Requests
8
+ # https://api.tochka.com/static/v1/tender-docs/cyclops/main/api_v2.html#api-v2-update-beneficiary-fl
9
+ class UpdateBeneficiaryFl < Dry::Validation::Contract
10
+ # Schema for beneficiary_data field of main schema
11
+ class BeneficiaryData < Dry::Validation::Contract
12
+ params do
13
+ required(:first_name).value(:string)
14
+ required(:last_name).value(:string)
15
+ required(:birth_date).value(:string)
16
+ required(:birth_place).value(:string)
17
+ required(:passport_number).value(:string)
18
+ required(:passport_date).value(:string)
19
+ required(:registration_address).value(:string)
20
+
21
+ optional(:passport_series).value(:string)
22
+ optional(:middle_name).value(:string)
23
+ optional(:resident).value(:bool)
24
+ end
25
+ end
26
+
27
+ schema do
28
+ required(:beneficiary_id).value(:string)
29
+ required(:beneficiary_data).schema(
30
+ TochkaCyclopsApi::Schemas::Requests::UpdateBeneficiaryFl::BeneficiaryData.schema
31
+ )
32
+ end
33
+
34
+ EXAMPLE = "
35
+ {
36
+ beneficiary_id: '981fee11-9969-4e80-9f5f-02af462cb51e',
37
+ beneficiary_data: {
38
+ first_name: 'Иван',
39
+ last_name: 'Иванов',
40
+ birth_date: '1990-01-24',
41
+ birth_place: 'г. Свердловск',
42
+ passport_series: '6509',
43
+ passport_number: '123456',
44
+ passport_date: '2020-01-01',
45
+ registration_address: '683031, г. Петропавловск-Камчатский, пр-кт. Карла Маркса, д. 21/1, офис 305'
46
+ }
47
+ }"
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-validation'
4
+
5
+ module TochkaCyclopsApi
6
+ module Schemas
7
+ module Requests
8
+ # https://api.tochka.com/static/v1/tender-docs/cyclops/main/api_v2.html#api-v2-update-beneficiary-ip
9
+ class UpdateBeneficiaryIp < Dry::Validation::Contract
10
+ # Schema for beneficiary_data field of main schema
11
+ class BeneficiaryData < Dry::Validation::Contract
12
+ params do
13
+ required(:first_name).value(:string)
14
+ required(:last_name).value(:string)
15
+ optional(:middle_name).value(:string)
16
+ end
17
+ end
18
+
19
+ schema do
20
+ required(:beneficiary_id).value(:string)
21
+ required(:beneficiary_data).schema(
22
+ TochkaCyclopsApi::Schemas::Requests::UpdateBeneficiaryIp::BeneficiaryData.schema
23
+ )
24
+ end
25
+
26
+ EXAMPLE = "
27
+ {
28
+ beneficiary_id: 981fee11-9969-4e80-9f5f-02af462cb51e,
29
+ beneficiary_data: {
30
+ first_name: 'Иван',
31
+ middle_name: 'Иванович',
32
+ last_name: 'Иванов'
33
+ }
34
+ }
35
+ "
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-validation'
4
+
5
+ module TochkaCyclopsApi
6
+ module Schemas
7
+ module Requests
8
+ # https://api.tochka.com/static/v1/tender-docs/cyclops/main/api_v2.html#api-v2-update-beneficiary-ul
9
+ class UpdateBeneficiaryUl < Dry::Validation::Contract
10
+ # Schema for beneficiary_data field of main schema
11
+ class BeneficiaryData < Dry::Validation::Contract
12
+ params do
13
+ required(:name).value(:string)
14
+ required(:kpp).value(:string)
15
+ optional(:ogrn).value(:string)
16
+ end
17
+ end
18
+
19
+ schema do
20
+ required(:beneficiary_id).value(:string)
21
+ required(:beneficiary_data).schema(
22
+ TochkaCyclopsApi::Schemas::Requests::UpdateBeneficiaryUl::BeneficiaryData.schema
23
+ )
24
+ end
25
+
26
+ EXAMPLE = "
27
+ {
28
+ beneficiary_id: '981fee11-9969-4e80-9f5f-02af462cb51e',
29
+ beneficiary_data: {
30
+ name: 'ООО \"Рога и Копыта\"',
31
+ kpp: '246301001'
32
+ }
33
+ }
34
+ "
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-struct'
4
+
5
+ module Types
6
+ include Dry.Types()
7
+ end
8
+
9
+ module TochkaCyclopsApi
10
+ module Schemas
11
+ module Responses
12
+ # Response schema for activate_beneficiary request
13
+ class ActivateBeneficicary < Dry::Struct
14
+ # Schema for beneficiary field of main response
15
+ class BeneficiaryData < Dry::Struct
16
+ attribute :inn, Types::Strict::String
17
+ attribute :id, Types::Strict::String
18
+ end
19
+
20
+ attribute :beneficiary, BeneficiaryData
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require 'dry-struct'
2
+
3
+ module Types
4
+ include Dry.Types()
5
+ end
6
+
7
+ module TochkaCyclopsApi
8
+ module Schemas
9
+ module Responses
10
+ # Response schema for create_beneficiary_fl request
11
+ class CreateBeneficiaryFl < Dry::Struct
12
+ # Schema for beneficiary field of main response
13
+ class BeneficiaryData < Dry::Struct
14
+ attribute :inn, Types::Strict::String
15
+ attribute :id, Types::Strict::String
16
+ attribute :nominal_account_code, Types::Strict::String.optional
17
+ attribute :nominal_account_bic, Types::Strict::String.optional
18
+ end
19
+
20
+ attribute :beneficiary, BeneficiaryData
21
+ end
22
+ end
23
+ end
24
+ end
@@ -5,8 +5,17 @@ require 'dry-struct'
5
5
  module TochkaCyclopsApi
6
6
  module Schemas
7
7
  module Responses
8
- # Response chema for create_beneficiary_ip request
8
+ # Response schema for create_beneficiary_ip request
9
9
  class CreateBeneficiaryIp < Dry::Struct
10
+ # Schema for beneficiary field of main response
11
+ class BeneficiaryData < Dry::Struct
12
+ attribute :inn, Types::Strict::String
13
+ attribute :id, Types::Strict::String
14
+ attribute :nominal_account_code, Types::Strict::String.optional
15
+ attribute :nominal_account_bic, Types::Strict::String.optional
16
+ end
17
+
18
+ attribute :beneficiary, BeneficiaryData
10
19
  end
11
20
  end
12
21
  end
@@ -9,16 +9,16 @@ end
9
9
  module TochkaCyclopsApi
10
10
  module Schemas
11
11
  module Responses
12
- # Schema for beneficiary field of main response
13
- class BeneficiaryData < Dry::Struct
14
- attribute :inn, Types::Strict::String
15
- attribute :id, Types::Strict::String
16
- attribute :nominal_account_code, Types::Strict::String.optional
17
- attribute :nominal_account_bic, Types::Strict::String.optional
18
- end
19
-
20
- # Response chema for create_beneficiary_ul request
12
+ # Response schema for create_beneficiary_ul request
21
13
  class CreateBeneficiaryUl < Dry::Struct
14
+ # Schema for beneficiary field of main response
15
+ class BeneficiaryData < Dry::Struct
16
+ attribute :inn, Types::Strict::String
17
+ attribute :id, Types::Strict::String
18
+ attribute :nominal_account_code, Types::Strict::String.optional
19
+ attribute :nominal_account_bic, Types::Strict::String.optional
20
+ end
21
+
22
22
  attribute :beneficiary, BeneficiaryData
23
23
  end
24
24
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-struct'
4
+
5
+ module Types
6
+ include Dry.Types()
7
+ end
8
+
9
+ module TochkaCyclopsApi
10
+ module Schemas
11
+ module Responses
12
+ # Response schema for deactivate_beneficiary request
13
+ class DeactivateBeneficicary < Dry::Struct
14
+ # Schema for beneficiary field of main response
15
+ class BeneficiaryData < Dry::Struct
16
+ attribute :inn, Types::Strict::String
17
+ attribute :id, Types::Strict::String
18
+ end
19
+
20
+ attribute :beneficiary, BeneficiaryData
21
+ end
22
+ end
23
+ end
24
+ end
@@ -5,7 +5,7 @@ require 'dry-struct'
5
5
  module TochkaCyclopsApi
6
6
  module Schemas
7
7
  module Responses
8
- # Response chema for echo request
8
+ # Response schema for echo request
9
9
  class Echo
10
10
  attr_accessor :text
11
11
 
@@ -5,11 +5,14 @@ require 'dry-struct'
5
5
  module TochkaCyclopsApi
6
6
  module Schemas
7
7
  module Responses
8
- # Response chema for bank's api errors
8
+ module Types
9
+ include Dry.Types()
10
+ end
11
+ # Response schema for bank's api errors
9
12
  class Error < Dry::Struct
10
13
  attribute :code, Types::Strict::Integer
11
14
  attribute :message, Types::Strict::String
12
- attribute :meta, Types::Strict::Array
15
+ attribute :meta, Types::Strict::Array.optional
13
16
  end
14
17
  end
15
18
  end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-struct'
4
+
5
+ module Types
6
+ include Dry.Types()
7
+ end
8
+
9
+ module TochkaCyclopsApi
10
+ module Schemas
11
+ module Responses
12
+ # Response schema for get_beneficiary request
13
+ class ListBeneficicary < Dry::Struct
14
+ class LastContractOffer < Dry::Struct
15
+ attribute :id, ::Types::String
16
+ attribute :type, ::Types::String
17
+ attribute :success_added, ::Types::Bool
18
+ attribute :success_added_desc, ::Types::String
19
+ end
20
+
21
+ class NominalAccount < Dry::Struct
22
+ attribute :bic, ::Types::String
23
+ attribute :code, ::Types::String
24
+ end
25
+
26
+ class BeneficiaryData < Dry::Struct
27
+ attribute :name, ::Types::String
28
+ end
29
+
30
+ class Beneficiary < Dry::Struct
31
+ attribute :inn, Types::String
32
+ attribute :id, Types::String
33
+ attribute :is_active, Types::Bool
34
+ attribute :legal_type, Types::String
35
+ attribute :ogrn, Types::String
36
+ attribute :beneficiary_data, BeneficiaryData
37
+ end
38
+
39
+ attribute :beneficiary, Beneficiary
40
+ attribute :nominal_account, NominalAccount
41
+ attribute :last_contract_offer, LastContractOffer
42
+ attribute :permission, Types::Bool
43
+ attribute :permission_description, Types::String
44
+ attribute :meta, Meta
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry-struct'
4
+
5
+ module Types
6
+ include Dry.Types()
7
+ end
8
+
9
+ module TochkaCyclopsApi
10
+ module Schemas
11
+ module Responses
12
+ # Response schema for list_beneficiary request
13
+ class ListBeneficicary < Dry::Struct
14
+ class Beneficiary < Dry::Struct
15
+ attribute :inn, Types::String
16
+ attribute :id, Types::String
17
+ attribute :is_active, Types::Bool
18
+ attribute :legal_type, Types::String
19
+ attribute :nominal_account_code, Types::String
20
+ attribute :nominal_account_bic, Types::String
21
+ end
22
+
23
+ class Page < Dry::Struct
24
+ attribute :current_page, Types::Integer
25
+ attribute :per_page, Types::Integer
26
+ end
27
+
28
+ class Meta < Dry::Struct
29
+ attribute :total, Types::Integer
30
+ attribute :page, Page
31
+ end
32
+
33
+ attribute :beneficiaries, Types::Array.of(Beneficiary)
34
+ attribute :meta, Meta
35
+ end
36
+ end
37
+ end
38
+ end