moneta-api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/.rspec +3 -0
  4. data/.yardopts +6 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +31 -0
  8. data/Rakefile +2 -0
  9. data/lib/moneta/api/data_mapper.rb +91 -0
  10. data/lib/moneta/api/requests/authorise_transaction_batch_request.rb +9 -0
  11. data/lib/moneta/api/requests/authorise_transaction_request.rb +15 -0
  12. data/lib/moneta/api/requests/cancel_transaction_batch_request.rb +10 -0
  13. data/lib/moneta/api/requests/cancel_transaction_request.rb +14 -0
  14. data/lib/moneta/api/requests/confirm_transaction_batch_request.rb +10 -0
  15. data/lib/moneta/api/requests/confirm_transaction_request.rb +9 -0
  16. data/lib/moneta/api/requests/create_account_request.rb +65 -0
  17. data/lib/moneta/api/requests/find_accounts_list_request.rb +38 -0
  18. data/lib/moneta/api/requests/find_last_operations_list_request.rb +24 -0
  19. data/lib/moneta/api/requests/find_operations_list_request.rb +26 -0
  20. data/lib/moneta/api/requests/forecast_transaction_request.rb +9 -0
  21. data/lib/moneta/api/requests/get_account_payment_password_challenge_request.rb +16 -0
  22. data/lib/moneta/api/requests/invoice_batch_request.rb +10 -0
  23. data/lib/moneta/api/requests/invoice_request.rb +10 -0
  24. data/lib/moneta/api/requests/payment_request.rb +9 -0
  25. data/lib/moneta/api/requests/refund_request.rb +42 -0
  26. data/lib/moneta/api/requests/transfer_request.rb +9 -0
  27. data/lib/moneta/api/requests/verify_payment_request.rb +10 -0
  28. data/lib/moneta/api/requests/verify_transaction_request.rb +51 -0
  29. data/lib/moneta/api/requests/verify_transfer_request.rb +10 -0
  30. data/lib/moneta/api/response_factory.rb +22 -0
  31. data/lib/moneta/api/responses/authorise_transaction_batch_response.rb +17 -0
  32. data/lib/moneta/api/responses/authorise_transaction_response.rb +10 -0
  33. data/lib/moneta/api/responses/cancel_transaction_batch_response.rb +17 -0
  34. data/lib/moneta/api/responses/cancel_transaction_response.rb +10 -0
  35. data/lib/moneta/api/responses/confirm_transaction_batch_response.rb +17 -0
  36. data/lib/moneta/api/responses/confirm_transaction_response.rb +10 -0
  37. data/lib/moneta/api/responses/create_account_response.rb +19 -0
  38. data/lib/moneta/api/responses/find_account_by_alias_response.rb +16 -0
  39. data/lib/moneta/api/responses/find_account_by_id_response.rb +16 -0
  40. data/lib/moneta/api/responses/find_accounts_list_response.rb +15 -0
  41. data/lib/moneta/api/responses/find_last_operations_list_response.rb +12 -0
  42. data/lib/moneta/api/responses/find_operations_list_response.rb +12 -0
  43. data/lib/moneta/api/responses/forecast_transaction_response.rb +16 -0
  44. data/lib/moneta/api/responses/get_account_payment_password_challenge_response.rb +16 -0
  45. data/lib/moneta/api/responses/get_operation_details_by_id_response.rb +15 -0
  46. data/lib/moneta/api/responses/invoice_batch_response.rb +17 -0
  47. data/lib/moneta/api/responses/invoice_response.rb +10 -0
  48. data/lib/moneta/api/responses/payment_response.rb +10 -0
  49. data/lib/moneta/api/responses/refund_response.rb +10 -0
  50. data/lib/moneta/api/responses/transfer_response.rb +9 -0
  51. data/lib/moneta/api/responses/verify_payment_response.rb +10 -0
  52. data/lib/moneta/api/responses/verify_transaction_response.rb +10 -0
  53. data/lib/moneta/api/responses/verify_transfer_response.rb +10 -0
  54. data/lib/moneta/api/service.rb +18 -0
  55. data/lib/moneta/api/service_methods.rb +150 -0
  56. data/lib/moneta/api/types/account_access_info.rb +24 -0
  57. data/lib/moneta/api/types/account_info.rb +72 -0
  58. data/lib/moneta/api/types/authorise_transaction_batch_request_type.rb +47 -0
  59. data/lib/moneta/api/types/authorise_transaction_request_type.rb +19 -0
  60. data/lib/moneta/api/types/cancel_transaction_batch_request_type.rb +42 -0
  61. data/lib/moneta/api/types/cancel_transaction_batch_response_type.rb +29 -0
  62. data/lib/moneta/api/types/cancel_transaction_request_type.rb +24 -0
  63. data/lib/moneta/api/types/cancel_transaction_response_type.rb +20 -0
  64. data/lib/moneta/api/types/confirm_transaction_batch_request_type.rb +47 -0
  65. data/lib/moneta/api/types/confirm_transaction_request_type.rb +53 -0
  66. data/lib/moneta/api/types/entity.rb +15 -0
  67. data/lib/moneta/api/types/find_operations_list_request_filter.rb +102 -0
  68. data/lib/moneta/api/types/forecast_transaction_response_type.rb +52 -0
  69. data/lib/moneta/api/types/invoice_batch_request_type.rb +46 -0
  70. data/lib/moneta/api/types/invoice_request_type.rb +49 -0
  71. data/lib/moneta/api/types/key_value_attribute.rb +18 -0
  72. data/lib/moneta/api/types/operation_info.rb +88 -0
  73. data/lib/moneta/api/types/operation_info_batch_response_type.rb +27 -0
  74. data/lib/moneta/api/types/operation_info_list.rb +41 -0
  75. data/lib/moneta/api/types/pager.rb +22 -0
  76. data/lib/moneta/api/types/payment_request_type.rb +58 -0
  77. data/lib/moneta/api/types/transaction_batch_response_type.rb +29 -0
  78. data/lib/moneta/api/types/transaction_request_type.rb +55 -0
  79. data/lib/moneta/api/types/transaction_response_type.rb +28 -0
  80. data/lib/moneta/api/types/verify_transaction_response_type.rb +18 -0
  81. data/lib/moneta/api/types/verify_transfer_response_type.rb +32 -0
  82. data/lib/moneta/api/version.rb +5 -0
  83. data/lib/moneta/api.rb +23 -0
  84. data/moneta-api.gemspec +31 -0
  85. data/spec/lib/moneta/api/requests/authorise_transaction_batch_request_spec.rb +71 -0
  86. data/spec/lib/moneta/api/requests/authorise_transaction_request_spec.rb +22 -0
  87. data/spec/lib/moneta/api/requests/create_account_request_spec.rb +16 -0
  88. data/spec/lib/moneta/api/requests/find_operations_list_request_spec.rb +23 -0
  89. data/spec/lib/moneta/api/requests/forecast_transaction_request_spec.rb +19 -0
  90. data/spec/lib/moneta/api/requests/get_account_payment_password_challenge_request_spec.rb +15 -0
  91. data/spec/lib/moneta/api/requests/payment_request_spec.rb +22 -0
  92. data/spec/lib/moneta/api/requests/transfer_request_spec.rb +19 -0
  93. data/spec/lib/moneta/api/response/find_account_by_id_spec.rb +10 -0
  94. data/spec/lib/moneta/api/service_spec.rb +9 -0
  95. data/spec/lib/moneta/api/types/operation_info_spec.rb +23 -0
  96. data/spec/spec_helper.rb +36 -0
  97. data/spec/support/matchers.rb +7 -0
  98. data/spec/support/wsdl +7743 -0
  99. data/spec/vcr/moneta_api_requests_authorisetransactionbatchrequest/use_when_one_operation_transaction_transaction_.yml +10790 -0
  100. data/spec/vcr/moneta_api_requests_authorisetransactionbatchrequest/use_when_two_operations_transaction_first_transaction_.yml +10790 -0
  101. data/spec/vcr/moneta_api_requests_authorisetransactionrequest_authorise_transaction/should_success.yml +10790 -0
  102. data/spec/vcr/moneta_api_requests_createaccountrequest/create_account_account_id_.yml +10789 -0
  103. data/spec/vcr/moneta_api_requests_findoperationslistrequest/find_operations_list_account_id_.yml +10794 -0
  104. data/spec/vcr/moneta_api_requests_forecasttransactionrequest/forecast_transaction_payer_currency_.yml +10802 -0
  105. data/spec/vcr/moneta_api_requests_getaccountpaymentpasswordchallengerequest/get_account_payment_password_challenge_.yml +10790 -0
  106. data/spec/vcr/moneta_api_requests_paymentrequest/payment_should_success.yml +10789 -0
  107. data/spec/vcr/moneta_api_requests_transferrequest/transfer_status_.yml +10789 -0
  108. data/spec/vcr/moneta_api_service_find_account_by_id/account_id_.yml +10789 -0
  109. metadata +302 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d1c57b143f1deaff1fd20aab54676724403a76ba
4
+ data.tar.gz: 1c2ace8fff474fb919bb77dca1a145b3a243fa14
5
+ SHA512:
6
+ metadata.gz: c3b2b4bb3223ab341c26536bd36f98c777c8f10254ffef902db9d24e52ff26336faa758d5aa6d2d51fa2f5d2ee4c47f7a3a4d3755973feba121d03ea61f80638
7
+ data.tar.gz: 71ddfcf91f937a1cd72ce54a1fdbbbd58be77d71fa14a35bba2d6853635f36173ad02bede4f087111725e55af70b9aa29c8b6c0d15bf1b722c4acec9b307aab3
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ .idea
16
+ spec/support/moneta.yml
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --colour
3
+ --format documentation
data/.yardopts ADDED
@@ -0,0 +1,6 @@
1
+ --no-private
2
+ --exclude features
3
+ --markup markdown
4
+ --hide-void-return
5
+ -
6
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in moneta-api.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 ssnikolay
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Moneta::Api
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'moneta-api'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install moneta-api
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/moneta-api/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,91 @@
1
+ module Moneta
2
+ module Api
3
+ module DataMapper
4
+ def self.included(base)
5
+ base.extend ClassMethods
6
+
7
+ base.class_eval do
8
+ def fill(data)
9
+ properties.each do |property, type|
10
+ value = data[ property ]
11
+ if value
12
+ property_value = type.nil? ? value : build_complex_value(type, value)
13
+ instance_variable_set("@#{ property }", property_value)
14
+ end
15
+ end
16
+
17
+ self
18
+ end
19
+
20
+ def to_hash
21
+ properties.each_with_object({}) do |(property, _), hash|
22
+ value = send(property)
23
+ unless value.nil?
24
+ hash[ classify_with_lower(property.to_s) ] = to_hash_complex_value(value)
25
+ end
26
+ end
27
+ end
28
+
29
+ def classify_with_lower(str)
30
+ str = classify(str)
31
+ str[0] = str[0].downcase
32
+
33
+ str
34
+ end
35
+
36
+ def classify(str)
37
+ str.split('_').map(&:capitalize).join
38
+ end
39
+
40
+ private
41
+
42
+ def build_complex_value(type, value)
43
+ value.kind_of?(Array) ?
44
+ value.map { |v| type.build(v) } :
45
+ type.build(value)
46
+ end
47
+
48
+ def to_hash_complex_value(value)
49
+ if value.kind_of?(Array)
50
+ value.map(&:to_hash)
51
+ elsif value.respond_to?(:to_hash)
52
+ value.to_hash
53
+ else
54
+ value
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+ module ClassMethods
61
+ def property(name, base_type=nil)
62
+ attr_accessor(name)
63
+
64
+ # Сохраняем свойста и перезаписываем instance метод
65
+ current_properties = instance_variable_get('@properties') || {}
66
+ properties = instance_variable_set('@properties',
67
+ current_properties.merge(name => base_type).merge(parents_properties)
68
+ )
69
+
70
+ send(:define_method, :properties) { properties }
71
+ end
72
+
73
+ def build(data)
74
+ self.new.tap { |object| object.fill(data) }
75
+ end
76
+
77
+ private
78
+
79
+ def parents_properties
80
+ instance_variable_get('@parents_properties') ||
81
+ instance_variable_set('@parents_properties', ancestors.each_with_object({}) do |klass, hash|
82
+ if klass.name.match(/Moneta::Api::(Types|Requests|Responses)/)
83
+ hash.merge!(klass.instance_variable_get('@properties') || {})
84
+ end
85
+ end
86
+ )
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,9 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос на регистрацию операции с блокировкой средств на счете плательщика в пакетном режиме.
5
+ # Request for transactions registration and debiting funds from payer's account in batch processing mode.
6
+ class AuthoriseTransactionBatchRequest < Types::AuthoriseTransactionBatchRequestType; end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос на регистрацию операции с блокировкой средств на счете плательщика.
5
+ # Завершить (подтвердить) операцию можно с помощью ConfirmTransactionRequest.
6
+ # Если операция не будет закончена с помощью ConfirmTransactionRequest, то
7
+ # операция будет отменена автоматически по истечению срока блокировки.
8
+ # Request for transaction registration and debiting funds from payer's account.
9
+ # To finish (confirm) this transaction use ConfirmTransactionRequest.
10
+ # Authorised but not cofirmed transactions are cancelled automaticaly after authorisation expiry.
11
+
12
+ class AuthoriseTransactionRequest < Types::AuthoriseTransactionRequestType; end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,10 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос на отмену операций в пакетном режиме.
5
+ # Transactions cancelation request in batch processing mode.
6
+
7
+ class CancelTransactionBatchRequest < Types::CancelTransactionBatchRequestType; end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ module Moneta
2
+ module Api
3
+ module Request
4
+ # Запрос на отмену операции. Отменять операцию можно при выполнении всех условий:
5
+ # незавершенные операции;
6
+ # если есть доступ к счету плательщика и счету получателя (то есть свои внутренние операции).
7
+ # Transaction cancelation request if transasction fulfils following conditions:
8
+ # transaction is in processing (incompleted);
9
+ # principal has an access to both (payer and payee) accounts.
10
+
11
+ class CancelTransactionRequest < Types::CancelTransactionRequestType; end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос на завершение (подтверждение) операций в пакетном режиме.
5
+ # Transactions confirmation request in batch processing mode.
6
+
7
+ class ConfirmTransactionBatchRequest < Types::ConfirmTransactionBatchRequestType; end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос на завершение (подтверждение) операции.
5
+ # Transaction confirmation request.
6
+ class ConfirmTransactionRequest < Types::ConfirmTransactionRequestType; end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,65 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос на создание счета.
5
+ # Счет создается для указанного пользователя или,
6
+ # если это поле не указано, - для текущего пользователя.
7
+ # Account creation request. Account is created for given structure element (unitId) or for authenticated user's structure if unitId is omitted.
8
+
9
+ class CreateAccountRequest
10
+ include Moneta::Api::DataMapper
11
+ # @return [String] Валюта счета
12
+ # / Currency of account
13
+ property :currency
14
+
15
+ # @return [String] Название счета.
16
+ # Название счета должно быть уникальным среди счетов одного пользователя.
17
+ # Необязательное поле.
18
+ # / Alias of account. Must be unique among accounts of given user. Optional.
19
+ property :alias
20
+
21
+ # @return [String] Платежный пароль. Минимальная длина - 5 символов
22
+ # / Payment password. Minimum length is 5 symbols.
23
+ property :payment_password
24
+
25
+ # @return [Integer] Пользователь, которому будет принадлежать данный счет.
26
+ # Если это поле не задано, то счет создается для текущего пользователя.
27
+ # Необязательное поле.
28
+ # / Structure element, where the account belongs to. If omitted authenticated user's structure is used. Optional.
29
+ property :unit_id
30
+
31
+ # @return [String] URL после списания средств. Необязательное поле.
32
+ # / URL on debiting. Optional.
33
+ property :on_successful_debit_url
34
+
35
+ # @return [String] URL после зачисления средств. Необязательное поле.
36
+ # / URL on crediting. Optional.
37
+ property :on_successful_credit_url
38
+
39
+ # @return [String] Код проверки целостности данных. Необязательное поле.
40
+ # / Mandatory payment form signature. Optional.
41
+ property :signature
42
+
43
+ # @return [Float] Если баланс счета меньше данного значения, то раз в сутки уходит уведомление об этом событии. Необязательное поле.
44
+ # / Daily notifications if balance is less than threshold. Optional.
45
+ property :low_balance_threshold
46
+
47
+ # @return [Float] Если баланс счета больше данного значения, то раз в сутки уходит уведомление об этом событии. Необязательное поле.
48
+ # / Daily notifications if balance is greater than threshold. Optional.
49
+ property :high_balance_threshold
50
+
51
+ # @return [Integer] Счет-прототип с которого берутся свойства "по умолчанию". Необязательное поле.
52
+ # / Prototype account for default properties values. Optional.
53
+ property :prototype_account_id
54
+
55
+ # @return [String] URL после отмены списания средств. Необязательное поле.
56
+ # / URL on cancelled debit. Optional.
57
+ property :on_cancelled_debit_url
58
+
59
+ # @return [String] URL после отмены зачисления средств. Необязательное поле.
60
+ # / URL on cancelled credit. Optional.
61
+ property :on_cancelled_credit_url
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,38 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос на получение списка счетов по заданным условиям поиска.
5
+ # Accounts searching by given filter.
6
+
7
+ class FindAccountsListRequest
8
+ include Moneta::Api::DataMapper
9
+
10
+ # @return [Integer] Пользователь, которому принадлежат счета.
11
+ # Если это поле не задано, то используется текущий пользователь.
12
+ # Необязательное поле.
13
+ # / Structure element, where accounts belong to. If omitted authenticated user's structure is used. Optional.
14
+ property :unit_id
15
+
16
+ # @return [String] Название счета. Поиск происходит по прямому совпадению.
17
+ # Для задания маски можно указать спец-символы "*" или "?".
18
+ # Необязательное поле.
19
+ # / Alias of account. Wildcards "*" and "?" may be used. Optional.
20
+ property :alias
21
+
22
+ # @return [String] Валюта счета. Необязательное поле.
23
+ # / Currency of account. Optional.
24
+ property :currency
25
+
26
+ # @return [Boolean] Является ли счет делегированным. Необязательное поле.
27
+ # - поле не указано - выбрать все счета
28
+ # - false - выбрать только неделегированные счета
29
+ # - true - выбрать только делегированные счета
30
+ # / The boolean flag indicating if account is deligated. Optional.
31
+ # - select all accounts if omitted
32
+ # - false - select only non-delegated (owned) accounts
33
+ # - true - select only delegated accounts
34
+ property :is_delegated_account
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,24 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос на получение списка последних операций.
5
+ # Если данные не найдены, то size в ответе равен 0.
6
+ # Last transactions searching.
7
+ # Response element "size" is 0 if no data found.
8
+
9
+ class FindLastOperationsListRequest
10
+ include Moneta::Api::DataMapper
11
+
12
+ # @return [Integer] ID пользователя в системе МОНЕТА.РУ.
13
+ # Если это поле не задано, то используется текущий пользователь.
14
+ # Необязательное поле.
15
+ # / Structure identificator in MONETA.RU. If omitted authenticated user's structure is used. Optional.
16
+ property :unit_id
17
+
18
+ # @return [Integer] Количество операций. Необязательное поле.
19
+ # / Transactions quantity. Optional.
20
+ property :transactions_quantity
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,26 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос на получение списка операций по заданному фильтру.
5
+ # Обязательными в фильтре являются только поля с датами периода.
6
+ # Все остальные поля в фильтре необязательные.
7
+ # Если данные не найдены, то size в ответе равен 0.
8
+ # Transaction searching by given filter.
9
+ # Filter requires date period values to be set.
10
+ # Other parameters are optional.
11
+ # Response element "size" is 0 if no data found.
12
+
13
+ class FindOperationsListRequest
14
+ include Moneta::Api::DataMapper
15
+
16
+ # @return [Moneta::Api::Types::Pager] Настройки страницы данных. Необязательное поле.
17
+ # / Paging settings. Optional.
18
+ property :pager
19
+
20
+ # @return [Moneta::Api::Types::FindOperationsListRequestFilter] Фильтр, по которому ищем операции.
21
+ # / Transactions filter.
22
+ property :filter
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос предварительного расчета сумм и комиссий по параметрам операции.
5
+ # Request for amount and fee preliminary calculation by transaction parameters.
6
+ class Moneta::Api::Requests::ForecastTransactionRequest < Types::TransactionRequestType; end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Получить запрос для платежного пароля
5
+ # Receive challenge for payment password
6
+
7
+ class GetAccountPaymentPasswordChallengeRequest
8
+ include Moneta::Api::DataMapper
9
+
10
+ # @return [Integer] Номер счета
11
+ # / Account number
12
+ property :account_id
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Выставление счета к оплате в пакетном режиме.
5
+ # Making new invoice (request for payment) in batch processing mode.
6
+
7
+ class InvoiceBatchRequest < Types::InvoiceBatchRequestType; end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Выставление счета к оплате.
5
+ # Making new invoice (request for payment).
6
+
7
+ class InvoiceRequest < Types::InvoiceRequestType; end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос на перевод денежных средств. Отличается от TransferRequest тем, что в качестве получателя можно указывать не только номер счета.
5
+ # Money Transfer Request. The difference from TransferRequest is that payee may be addressed not only by account number rather than transaction ID, e-mail address or phone number.
6
+ class PaymentRequest < Types::PaymentRequestType; end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,42 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Возврат средств по указанной операции.
5
+ # Refund given transaction.
6
+
7
+ class RefundRequest
8
+ include Moneta::Api::DataMapper
9
+
10
+ # @return [Integer] Номер операции в системе МОНЕТА.РУ, по которой необходимо вернуть деньги
11
+ # / Transaction ID in Moneta.ru
12
+ property :transaction_id
13
+
14
+ # @return [Float] Сумма, которую необходимо возвратить.
15
+ # Если сумма не указана, то сумма для возврата берется из указанной операции.
16
+ # Необязательное поле.
17
+ # / Amount to refund in source transaction payee's currency. If omitted the source transaction payees' amount is used. Optional.
18
+ property :amount
19
+
20
+ # @return [String] Платежный пароль
21
+ # / Payment password for payer account
22
+ property :payment_password
23
+
24
+ # @return [String] Внешний номер операции
25
+ # / External transaction ID
26
+ property :client_transaction
27
+
28
+ # @return [String] Описание операции
29
+ # / Transaction description or comments
30
+ property :description
31
+
32
+ # @return [Moneta::Api::Types::OperationInfo] Набор полей, которые необходимо сохранить в качестве атрибутов операции. Значения дат в формате dd.MM.yyyy HH:mm:ss
33
+ # / Key-value pairs that will be saved as a transaction attributes. Use format dd.MM.yyyy HH:mm:ss for date values
34
+ property :operation_info, Types::OperationInfo
35
+
36
+ # @return [String] Запрос для платежного пароля
37
+ # / Payment password challenge
38
+ property :payment_password_challenge
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,9 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос на перевод денежных средств.
5
+ # Money Transfer Request.
6
+ class TransferRequest < Types::TransactionRequestType; end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос возможности провести операцию в системе МОНЕТА.РУ. Отличается от VerifyTransferRequest тем, что в качестве получателя можно указывать не только номер счета.
5
+ # Transaction verification request. The difference from VerifyTransferRequest is that payee may be addressed not only by account number rather than transaction ID, e-mail address or phone number.
6
+
7
+ class VerifyPaymentRequest < Types::PaymentRequestType; end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,51 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос возможности провести операцию в системе МОНЕТА.РУ.
5
+ # Transaction verification request.
6
+
7
+ class VerifyTransactionRequest < Moneta::Api::Types::Entity
8
+ # @return [Integer] Идентификатор операции в системе МОНЕТА.РУ, которую надо проверить.
9
+ # / The identifier of transaction which has to be verified.
10
+ property :transaction_id
11
+
12
+ # @return [Integer] Номер счета плательщика
13
+ # / Payer account number
14
+ property :payer
15
+
16
+ # @return [Float] Сумма операции.
17
+ # Если флаг isPayerAmount отсутствует
18
+ # и пользователь имеет доступ только к счету плательщика,
19
+ # то интерпретируется как сумма к списанию (в валюте плательщика).
20
+ # Если флаг isPayerAmount отсутствует
21
+ # и пользователь имеет доступ только к счету получателя,
22
+ # то интерпретируется как сумма к зачислению (в валюте получателя).
23
+ # / Transaction amount. If isPayerAmount is omitted and user has access only to payer account, then is interpreted as debit amount (in payer's currency). If isPayerAmount is omitted and user has access only to payee account, then is interpreted as credit amount (in payee's currency).
24
+ property :amount
25
+
26
+ # @return [Boolean] Если пользователь имеет доступ как к счету плательщика, так и счету получателя,
27
+ # то флаг isPayerAmount обязателен.
28
+ # Если флаг isPayerAmount установлен (true), то amount используется как сумма к списанию (в валюте плательщика).
29
+ # Если флаг isPayerAmount сброшен (false), то amount используется как сумма к зачислению (в валюте получателя).
30
+ # / If user has access to both accounts, then isPayerAmount flag is obligatory. If isPayerAmount flag is "true", then amount is used as debit amount (in payer's currency). If isPayerAmount flag is "false", then amount is used as credit amount (in payee's currency).
31
+ property :is_payer_amount
32
+
33
+ # @return [Moneta::Api::Types::OperationInfo] Набор полей, которые необходимо использовать в качестве атрибутов операции. Значения дат в формате dd.MM.yyyy HH:mm:ss
34
+ # / Key-value pairs that will be used as a transaction attributes. Use format dd.MM.yyyy HH:mm:ss for date values
35
+ property :operation_info, Moneta::Api::Types::OperationInfo
36
+
37
+ # @return [String] Платежный пароль счета плательщика
38
+ # / Payment password for payer account
39
+ property :payment_password
40
+
41
+ # @return [String] Запрос для платежного пароля
42
+ # / Payment password challenge
43
+ property :payment_password_challenge
44
+
45
+ # @return [String] Внешний номер операции
46
+ # / External transaction ID
47
+ property :client_transaction
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,10 @@
1
+ module Moneta
2
+ module Api
3
+ module Requests
4
+ # Запрос возможности провести операцию в системе МОНЕТА.РУ.
5
+ # Transaction verification request.
6
+
7
+ class VerifyTransferRequest < Types::TransactionRequestType; end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,22 @@
1
+ module Moneta
2
+ module Api
3
+ class ResponseFactory
4
+ class << self
5
+ # @param [Savon::Response]
6
+ # @return [Moneta::Api::Responses::*]
7
+ def build(response)
8
+ klass, data = response.to_hash.to_a.first
9
+ klass = classify(klass)
10
+
11
+ Object.const_get("Moneta::Api::Responses::#{ klass }").build(data)
12
+ end
13
+
14
+ private
15
+
16
+ def classify(str)
17
+ str.to_s.split('_').map(&:capitalize).join
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end