bb_payments 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +11 -0
  3. data/Gemfile.lock +82 -0
  4. data/README.md +391 -0
  5. data/Rakefile +8 -0
  6. data/bb_payments.gemspec +30 -0
  7. data/docs/BankSlipsApi.md +178 -0
  8. data/docs/BarcodeCollectionFormsIDResponseObject.md +6 -0
  9. data/docs/BarcodeCollectionFormsIDResponseObjectListaGuiaCodigoBarra.md +10 -0
  10. data/docs/BarcodeCollectionFormsIDResponseObjectListaOcorrencia.md +9 -0
  11. data/docs/BarcodeCollectionFormsRequestObject.md +12 -0
  12. data/docs/BarcodecollectionformsCollectionFormDetailsList.md +12 -0
  13. data/docs/BatchtransfersPaymentsList.md +22 -0
  14. data/docs/BatchtransferscancelPaymentIds.md +7 -0
  15. data/docs/Body.md +13 -0
  16. data/docs/CancelApi.md +63 -0
  17. data/docs/CollectionFormsApi.md +184 -0
  18. data/docs/Error.md +7 -0
  19. data/docs/ErrorErrors.md +8 -0
  20. data/docs/ErrorOAuthUnauthorized.md +10 -0
  21. data/docs/ErrorOAuthUnauthorizedAttributes.md +7 -0
  22. data/docs/InlineResponse200.md +13 -0
  23. data/docs/InlineResponse2001.md +29 -0
  24. data/docs/InlineResponse2001OcurrencesList.md +9 -0
  25. data/docs/InlineResponse2002.md +12 -0
  26. data/docs/InlineResponse2002PaymentsList.md +26 -0
  27. data/docs/InlineResponse2003.md +26 -0
  28. data/docs/InlineResponse2003ListaBoleto.md +24 -0
  29. data/docs/InlineResponse2003ListaDevolucao.md +9 -0
  30. data/docs/InlineResponse200PaymentsList.md +15 -0
  31. data/docs/InlineResponse201.md +13 -0
  32. data/docs/InlineResponse2011.md +13 -0
  33. data/docs/InlineResponse2011PaymentsList.md +16 -0
  34. data/docs/InlineResponse201PaymentsList.md +26 -0
  35. data/docs/InlineResponse400.md +7 -0
  36. data/docs/InlineResponse401.md +10 -0
  37. data/docs/ReturnedsApi.md +78 -0
  38. data/docs/RootTypeForBankSlipList.md +29 -0
  39. data/docs/RootTypeForBankSlipsBatchPayment.md +12 -0
  40. data/docs/RootTypeForBankSlipsBatchPaymentResponseObject.md +12 -0
  41. data/docs/RootTypeForBatchTransferGETResponseObject.md +9 -0
  42. data/docs/RootTypeForBatchTransferPaymentsListGET.md +21 -0
  43. data/docs/RootTypeForBatchTransfersCancelPaymentsListObject.md +10 -0
  44. data/docs/RootTypeForBatchTransfersCancelRequestObject.md +12 -0
  45. data/docs/RootTypeForBatchTransfersCancelResponseObject.md +7 -0
  46. data/docs/RootTypeForReturnedPaymentsDetails.md +33 -0
  47. data/docs/RootTypeForReturnedPaymentsResponseObject.md +10 -0
  48. data/docs/RootTypeForSlipsDetailsObject.md +23 -0
  49. data/docs/TransfersApi.md +309 -0
  50. data/lib/bb_payments/api/base.rb +10 -0
  51. data/lib/bb_payments/api/base_api.rb +63 -0
  52. data/lib/bb_payments/api/batch_payments_api.rb +50 -0
  53. data/lib/bb_payments/api/payments.rb +114 -0
  54. data/lib/bb_payments/api/transfers.rb +33 -0
  55. data/lib/bb_payments/api/transfers_pix.rb +52 -0
  56. data/lib/bb_payments/api_client.rb +414 -0
  57. data/lib/bb_payments/api_error.rb +57 -0
  58. data/lib/bb_payments/configuration.rb +246 -0
  59. data/lib/bb_payments/models/base_model.rb +177 -0
  60. data/lib/bb_payments/models/batch_pix_body.rb +30 -0
  61. data/lib/bb_payments/models/batch_pix_response.rb +69 -0
  62. data/lib/bb_payments/models/batch_transfers_body.rb +30 -0
  63. data/lib/bb_payments/models/batch_transfers_response.rb +64 -0
  64. data/lib/bb_payments/models/batchtransfers_payments_list.rb +362 -0
  65. data/lib/bb_payments/models/batchtransferscancel_payment_ids.rb +212 -0
  66. data/lib/bb_payments/models/body.rb +274 -0
  67. data/lib/bb_payments/models/error.rb +210 -0
  68. data/lib/bb_payments/models/error_errors.rb +227 -0
  69. data/lib/bb_payments/models/error_o_auth_unauthorized.rb +257 -0
  70. data/lib/bb_payments/models/error_o_auth_unauthorized_attributes.rb +213 -0
  71. data/lib/bb_payments/models/find_batch_payment.rb +93 -0
  72. data/lib/bb_payments/models/find_batch_response.rb +71 -0
  73. data/lib/bb_payments/models/inline_response_200.rb +270 -0
  74. data/lib/bb_payments/models/inline_response_200_1.rb +430 -0
  75. data/lib/bb_payments/models/inline_response_200_1_ocurrences_list.rb +227 -0
  76. data/lib/bb_payments/models/inline_response_200_2.rb +260 -0
  77. data/lib/bb_payments/models/inline_response_200_2_payments_list.rb +399 -0
  78. data/lib/bb_payments/models/inline_response_200_3.rb +487 -0
  79. data/lib/bb_payments/models/inline_response_200_3_lista_boleto.rb +377 -0
  80. data/lib/bb_payments/models/inline_response_200_3_lista_devolucao.rb +227 -0
  81. data/lib/bb_payments/models/inline_response_200_payments_list.rb +289 -0
  82. data/lib/bb_payments/models/inline_response_201.rb +270 -0
  83. data/lib/bb_payments/models/inline_response_201_1.rb +270 -0
  84. data/lib/bb_payments/models/inline_response_201_1_payments_list.rb +299 -0
  85. data/lib/bb_payments/models/inline_response_201_payments_list.rb +399 -0
  86. data/lib/bb_payments/models/inline_response_400.rb +210 -0
  87. data/lib/bb_payments/models/inline_response_401.rb +257 -0
  88. data/lib/bb_payments/models/root_type_for_bank_slip_list.rb +430 -0
  89. data/lib/bb_payments/models/root_type_for_bank_slips_batch_payment.rb +270 -0
  90. data/lib/bb_payments/models/root_type_for_bank_slips_batch_payment_response_object.rb +260 -0
  91. data/lib/bb_payments/models/root_type_for_batch_transfer_get_response_object.rb +230 -0
  92. data/lib/bb_payments/models/root_type_for_batch_transfer_payments_list_get.rb +348 -0
  93. data/lib/bb_payments/models/root_type_for_batch_transfers_cancel_payments_list_object.rb +238 -0
  94. data/lib/bb_payments/models/root_type_for_batch_transfers_cancel_request_object.rb +275 -0
  95. data/lib/bb_payments/models/root_type_for_batch_transfers_cancel_response_object.rb +210 -0
  96. data/lib/bb_payments/models/root_type_for_returned_payments_details.rb +468 -0
  97. data/lib/bb_payments/models/root_type_for_returned_payments_response_object.rb +240 -0
  98. data/lib/bb_payments/models/root_type_for_slips_details_object.rb +408 -0
  99. data/lib/bb_payments/models/transfer_base.rb +128 -0
  100. data/lib/bb_payments/models/transfer_pix.rb +34 -0
  101. data/lib/bb_payments/models/transfer_pix_base.rb +146 -0
  102. data/lib/bb_payments/version.rb +3 -0
  103. data/lib/bb_payments.rb +85 -0
  104. data/spec/api/batch_payments_api_spec.rb +113 -0
  105. data/spec/api_client_spec.rb +225 -0
  106. data/spec/base_object_spec.rb +109 -0
  107. data/spec/configuration_spec.rb +41 -0
  108. data/spec/models/body_spec.rb +76 -0
  109. data/spec/models/error_errors_spec.rb +46 -0
  110. data/spec/models/error_o_auth_unauthorized_attributes_spec.rb +40 -0
  111. data/spec/models/error_o_auth_unauthorized_spec.rb +58 -0
  112. data/spec/models/error_spec.rb +40 -0
  113. data/spec/models/inline_response_200_1_ocurrences_list_spec.rb +52 -0
  114. data/spec/models/inline_response_200_1_spec.rb +172 -0
  115. data/spec/models/inline_response_200_2_payments_list_spec.rb +154 -0
  116. data/spec/models/inline_response_200_2_spec.rb +70 -0
  117. data/spec/models/inline_response_200_3_lista_boleto_spec.rb +142 -0
  118. data/spec/models/inline_response_200_3_lista_devolucao_spec.rb +52 -0
  119. data/spec/models/inline_response_200_3_spec.rb +154 -0
  120. data/spec/models/inline_response_200_payments_list_spec.rb +88 -0
  121. data/spec/models/inline_response_200_spec.rb +76 -0
  122. data/spec/models/inline_response_201_1_payments_list_spec.rb +94 -0
  123. data/spec/models/inline_response_201_1_spec.rb +76 -0
  124. data/spec/models/inline_response_201_payments_list_spec.rb +154 -0
  125. data/spec/models/inline_response_201_spec.rb +76 -0
  126. data/spec/models/inline_response_400_spec.rb +40 -0
  127. data/spec/models/inline_response_401_spec.rb +58 -0
  128. data/spec/models/root_type_for_bank_slip_list_spec.rb +172 -0
  129. data/spec/models/root_type_for_bank_slips_batch_payment_response_object_spec.rb +70 -0
  130. data/spec/models/root_type_for_bank_slips_batch_payment_spec.rb +70 -0
  131. data/spec/models/root_type_for_batch_transfer_get_response_object_spec.rb +52 -0
  132. data/spec/models/root_type_for_batch_transfer_payments_list_get_spec.rb +124 -0
  133. data/spec/models/root_type_for_batch_transfers_cancel_payments_list_object_spec.rb +58 -0
  134. data/spec/models/root_type_for_batch_transfers_cancel_request_object_spec.rb +70 -0
  135. data/spec/models/root_type_for_batch_transfers_cancel_response_object_spec.rb +40 -0
  136. data/spec/models/root_type_for_returned_payments_details_spec.rb +196 -0
  137. data/spec/models/root_type_for_returned_payments_response_object_spec.rb +58 -0
  138. data/spec/models/root_type_for_slips_details_object_spec.rb +136 -0
  139. data/spec/spec_helper.rb +110 -0
  140. metadata +292 -0
@@ -0,0 +1,238 @@
1
+ =begin
2
+ #Payments-VPN
3
+
4
+ #Esta API fornece os serviços de pagamento do Banco do Brasil.
5
+
6
+ OpenAPI spec version: 3.5
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.24
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module BancoBrasilPayments
15
+ # Objeto interno do objeto BatchTransfersCancelResponseObject
16
+ class RootTypeForBatchTransfersCancelPaymentsListObject
17
+ # Identificação do pagamento. Representa o número do protocolo por meio do qual o beneficiário pode verificar a situação do crédito, se necessário.
18
+ attr_accessor :payment_id
19
+
20
+ # Indica se o pagamento foi cancelado ou não
21
+ attr_accessor :cancel_indicator
22
+
23
+ # Descrição da situação do pagamento: Domínios: - Consistente (pagamento recebido pelo banco, cumprem as regras de preenchimento dos campos mas ainda irá para validação e processamento) - Inconsistente (pagamento não aceito pelo banco por dados de entrada inconsistentes - não cumpre as regras de preenchimento dos campos) - Pago (pagamento efetuado ao favorecido) - Pendente (pagamento validado - pendência de autorização do pagamento por parte do pagador) - Aguardando saldo (débito não efetivado e em verificação de saldo até o horário limite da teimosinha). - Agendado (pagamento autorizado, porém aguardando a data de efetivação do pagamento ou horário de processamento) - Rejeitado (dados do pagamento não passaram na validações físicas e/ou lógicas, precisam ser corrigidos e reenviados. Ex: agência e conta não existem, conta não pertence ao CPF informado) - Cancelado (pagamento cancelado pelo pagador antes da data de efetivação do crédito) - Bloqueado (Débito na conta do pagador não efetivado por ocorrência no convênio, inconsistência de data/float ou falta de saldo) - Devolvido (pagamento efetuado e posteriormente devolvido pelo favorecido ou instituição recebedora. O valor é devolvido para a conta corrente onde ocorreu o débito da requisição)\" - Debitado (pagamento debitado na conta do pagador e pendente de crédito ao favorecido)
24
+ attr_accessor :payment_status
25
+
26
+ # Descrição do estado da requisição de cancelamento da transferência
27
+ attr_accessor :processing_message
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'payment_id' => :'paymentId',
33
+ :'cancel_indicator' => :'cancelIndicator',
34
+ :'payment_status' => :'paymentStatus',
35
+ :'processing_message' => :'processingMessage'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'payment_id' => :'Object',
43
+ :'cancel_indicator' => :'Object',
44
+ :'payment_status' => :'Object',
45
+ :'processing_message' => :'Object'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BancoBrasilPayments::RootTypeForBatchTransfersCancelPaymentsListObject` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BancoBrasilPayments::RootTypeForBatchTransfersCancelPaymentsListObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'payment_id')
71
+ self.payment_id = attributes[:'payment_id']
72
+ end
73
+
74
+ if attributes.key?(:'cancel_indicator')
75
+ self.cancel_indicator = attributes[:'cancel_indicator']
76
+ end
77
+
78
+ if attributes.key?(:'payment_status')
79
+ self.payment_status = attributes[:'payment_status']
80
+ end
81
+
82
+ if attributes.key?(:'processing_message')
83
+ self.processing_message = attributes[:'processing_message']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ payment_id == o.payment_id &&
106
+ cancel_indicator == o.cancel_indicator &&
107
+ payment_status == o.payment_status &&
108
+ processing_message == o.processing_message
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [payment_id, cancel_indicator, payment_status, processing_message].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ new.build_from_hash(attributes)
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.openapi_types.each_pair do |key, type|
136
+ if type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
141
+ end
142
+ elsif !attributes[self.class.attribute_map[key]].nil?
143
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
145
+ self.send("#{key}=", nil)
146
+ end
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :DateTime
159
+ DateTime.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ BancoBrasilPayments.const_get(type).build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end end
238
+ end
@@ -0,0 +1,275 @@
1
+ =begin
2
+ #Payments-VPN
3
+
4
+ #Esta API fornece os serviços de pagamento do Banco do Brasil.
5
+
6
+ OpenAPI spec version: 3.5
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.24
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module BancoBrasilPayments
15
+ # Objeto de Requisição do recurso Batch Transfers Cancel
16
+ class RootTypeForBatchTransfersCancelRequestObject
17
+ # Código da agência para débito. Não é necessário quando a solicitação é acessada pelo código de autorização no fluxo do OAuth.
18
+ attr_accessor :debit_branch_office
19
+
20
+ # Current account for debit; Conta Corrente para débito.
21
+ attr_accessor :debit_current_account
22
+
23
+ # Check digits of current account for debit; Dígito verificador da conta para débito.
24
+ attr_accessor :check_digit_debit_current_account
25
+
26
+ # pt-BR: Contract of payment between the third party and Banco do Brasil. Optionally when not informed it will be considered the contract bound to internal identification of the customer. pt-BR: Contrato de pagamento entre o terceiro e o Banco do Brasil. Opcionalmente, quando não informado, será considerado o contrato vinculado à identificação interna do cliente.
27
+ attr_accessor :payment_contract
28
+
29
+ # en-US: Quantity of intended payments to be processed in batch. pt-BR: Quantidade de pagamentos pretendidos a serem processados​em lote.
30
+ attr_accessor :payments_quantity
31
+
32
+ # Lista de cancelamentos a serem processados em lote. (Atenção!! As transferências poderão ser canceladas até que a remessa de solicitação do pagamento esteja PROCESSADA. Após o processamento, cancelamentos não serão possíveis)
33
+ attr_accessor :payment_ids
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'debit_branch_office' => :'debitBranchOffice',
39
+ :'debit_current_account' => :'debitCurrentAccount',
40
+ :'check_digit_debit_current_account' => :'checkDigitDebitCurrentAccount',
41
+ :'payment_contract' => :'paymentContract',
42
+ :'payments_quantity' => :'paymentsQuantity',
43
+ :'payment_ids' => :'paymentIds'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'debit_branch_office' => :'Object',
51
+ :'debit_current_account' => :'Object',
52
+ :'check_digit_debit_current_account' => :'Object',
53
+ :'payment_contract' => :'Object',
54
+ :'payments_quantity' => :'Object',
55
+ :'payment_ids' => :'Object'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BancoBrasilPayments::RootTypeForBatchTransfersCancelRequestObject` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BancoBrasilPayments::RootTypeForBatchTransfersCancelRequestObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'debit_branch_office')
81
+ self.debit_branch_office = attributes[:'debit_branch_office']
82
+ end
83
+
84
+ if attributes.key?(:'debit_current_account')
85
+ self.debit_current_account = attributes[:'debit_current_account']
86
+ end
87
+
88
+ if attributes.key?(:'check_digit_debit_current_account')
89
+ self.check_digit_debit_current_account = attributes[:'check_digit_debit_current_account']
90
+ end
91
+
92
+ if attributes.key?(:'payment_contract')
93
+ self.payment_contract = attributes[:'payment_contract']
94
+ end
95
+
96
+ if attributes.key?(:'payments_quantity')
97
+ self.payments_quantity = attributes[:'payments_quantity']
98
+ end
99
+
100
+ if attributes.key?(:'payment_ids')
101
+ if (value = attributes[:'payment_ids']).is_a?(Array)
102
+ self.payment_ids = value
103
+ end
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ invalid_properties = Array.new
111
+ if @payment_contract.nil?
112
+ invalid_properties.push('invalid value for "payment_contract", payment_contract cannot be nil.')
113
+ end
114
+
115
+ if @payments_quantity.nil?
116
+ invalid_properties.push('invalid value for "payments_quantity", payments_quantity cannot be nil.')
117
+ end
118
+
119
+ if @payment_ids.nil?
120
+ invalid_properties.push('invalid value for "payment_ids", payment_ids cannot be nil.')
121
+ end
122
+
123
+ invalid_properties
124
+ end
125
+
126
+ # Check to see if the all the properties in the model are valid
127
+ # @return true if the model is valid
128
+ def valid?
129
+ return false if @payment_contract.nil?
130
+ return false if @payments_quantity.nil?
131
+ return false if @payment_ids.nil?
132
+ true
133
+ end
134
+
135
+ # Checks equality by comparing each attribute.
136
+ # @param [Object] Object to be compared
137
+ def ==(o)
138
+ return true if self.equal?(o)
139
+ self.class == o.class &&
140
+ debit_branch_office == o.debit_branch_office &&
141
+ debit_current_account == o.debit_current_account &&
142
+ check_digit_debit_current_account == o.check_digit_debit_current_account &&
143
+ payment_contract == o.payment_contract &&
144
+ payments_quantity == o.payments_quantity &&
145
+ payment_ids == o.payment_ids
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Integer] Hash code
156
+ def hash
157
+ [debit_branch_office, debit_current_account, check_digit_debit_current_account, payment_contract, payments_quantity, payment_ids].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def self.build_from_hash(attributes)
164
+ new.build_from_hash(attributes)
165
+ end
166
+
167
+ # Builds the object from hash
168
+ # @param [Hash] attributes Model attributes in the form of hash
169
+ # @return [Object] Returns the model itself
170
+ def build_from_hash(attributes)
171
+ return nil unless attributes.is_a?(Hash)
172
+ self.class.openapi_types.each_pair do |key, type|
173
+ if type =~ /\AArray<(.*)>/i
174
+ # check to ensure the input is an array given that the attribute
175
+ # is documented as an array but the input is not
176
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
177
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
178
+ end
179
+ elsif !attributes[self.class.attribute_map[key]].nil?
180
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
181
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
182
+ self.send("#{key}=", nil)
183
+ end
184
+ end
185
+
186
+ self
187
+ end
188
+
189
+ # Deserializes the data based on type
190
+ # @param string type Data type
191
+ # @param string value Value to be deserialized
192
+ # @return [Object] Deserialized data
193
+ def _deserialize(type, value)
194
+ case type.to_sym
195
+ when :DateTime
196
+ DateTime.parse(value)
197
+ when :Date
198
+ Date.parse(value)
199
+ when :String
200
+ value.to_s
201
+ when :Integer
202
+ value.to_i
203
+ when :Float
204
+ value.to_f
205
+ when :Boolean
206
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
207
+ true
208
+ else
209
+ false
210
+ end
211
+ when :Object
212
+ # generic object (usually a Hash), return directly
213
+ value
214
+ when /\AArray<(?<inner_type>.+)>\z/
215
+ inner_type = Regexp.last_match[:inner_type]
216
+ value.map { |v| _deserialize(inner_type, v) }
217
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
218
+ k_type = Regexp.last_match[:k_type]
219
+ v_type = Regexp.last_match[:v_type]
220
+ {}.tap do |hash|
221
+ value.each do |k, v|
222
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
223
+ end
224
+ end
225
+ else # model
226
+ BancoBrasilPayments.const_get(type).build_from_hash(value)
227
+ end
228
+ end
229
+
230
+ # Returns the string representation of the object
231
+ # @return [String] String presentation of the object
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_hash (backward compatibility)
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_body
239
+ to_hash
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ if value.nil?
249
+ is_nullable = self.class.openapi_nullable.include?(attr)
250
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
251
+ end
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ # Outputs non-array value in the form of hash
259
+ # For object, use to_hash. Otherwise, just return the value
260
+ # @param [Object] value Any valid value
261
+ # @return [Hash] Returns the value in the form of hash
262
+ def _to_hash(value)
263
+ if value.is_a?(Array)
264
+ value.compact.map { |v| _to_hash(v) }
265
+ elsif value.is_a?(Hash)
266
+ {}.tap do |hash|
267
+ value.each { |k, v| hash[k] = _to_hash(v) }
268
+ end
269
+ elsif value.respond_to? :to_hash
270
+ value.to_hash
271
+ else
272
+ value
273
+ end
274
+ end end
275
+ end