bb_payments 0.1.1
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.
- checksums.yaml +7 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +82 -0
- data/README.md +391 -0
- data/Rakefile +8 -0
- data/bb_payments.gemspec +30 -0
- data/docs/BankSlipsApi.md +178 -0
- data/docs/BarcodeCollectionFormsIDResponseObject.md +6 -0
- data/docs/BarcodeCollectionFormsIDResponseObjectListaGuiaCodigoBarra.md +10 -0
- data/docs/BarcodeCollectionFormsIDResponseObjectListaOcorrencia.md +9 -0
- data/docs/BarcodeCollectionFormsRequestObject.md +12 -0
- data/docs/BarcodecollectionformsCollectionFormDetailsList.md +12 -0
- data/docs/BatchtransfersPaymentsList.md +22 -0
- data/docs/BatchtransferscancelPaymentIds.md +7 -0
- data/docs/Body.md +13 -0
- data/docs/CancelApi.md +63 -0
- data/docs/CollectionFormsApi.md +184 -0
- data/docs/Error.md +7 -0
- data/docs/ErrorErrors.md +8 -0
- data/docs/ErrorOAuthUnauthorized.md +10 -0
- data/docs/ErrorOAuthUnauthorizedAttributes.md +7 -0
- data/docs/InlineResponse200.md +13 -0
- data/docs/InlineResponse2001.md +29 -0
- data/docs/InlineResponse2001OcurrencesList.md +9 -0
- data/docs/InlineResponse2002.md +12 -0
- data/docs/InlineResponse2002PaymentsList.md +26 -0
- data/docs/InlineResponse2003.md +26 -0
- data/docs/InlineResponse2003ListaBoleto.md +24 -0
- data/docs/InlineResponse2003ListaDevolucao.md +9 -0
- data/docs/InlineResponse200PaymentsList.md +15 -0
- data/docs/InlineResponse201.md +13 -0
- data/docs/InlineResponse2011.md +13 -0
- data/docs/InlineResponse2011PaymentsList.md +16 -0
- data/docs/InlineResponse201PaymentsList.md +26 -0
- data/docs/InlineResponse400.md +7 -0
- data/docs/InlineResponse401.md +10 -0
- data/docs/ReturnedsApi.md +78 -0
- data/docs/RootTypeForBankSlipList.md +29 -0
- data/docs/RootTypeForBankSlipsBatchPayment.md +12 -0
- data/docs/RootTypeForBankSlipsBatchPaymentResponseObject.md +12 -0
- data/docs/RootTypeForBatchTransferGETResponseObject.md +9 -0
- data/docs/RootTypeForBatchTransferPaymentsListGET.md +21 -0
- data/docs/RootTypeForBatchTransfersCancelPaymentsListObject.md +10 -0
- data/docs/RootTypeForBatchTransfersCancelRequestObject.md +12 -0
- data/docs/RootTypeForBatchTransfersCancelResponseObject.md +7 -0
- data/docs/RootTypeForReturnedPaymentsDetails.md +33 -0
- data/docs/RootTypeForReturnedPaymentsResponseObject.md +10 -0
- data/docs/RootTypeForSlipsDetailsObject.md +23 -0
- data/docs/TransfersApi.md +309 -0
- data/lib/bb_payments/api/base.rb +10 -0
- data/lib/bb_payments/api/base_api.rb +63 -0
- data/lib/bb_payments/api/batch_payments_api.rb +50 -0
- data/lib/bb_payments/api/payments.rb +114 -0
- data/lib/bb_payments/api/transfers.rb +33 -0
- data/lib/bb_payments/api/transfers_pix.rb +52 -0
- data/lib/bb_payments/api_client.rb +414 -0
- data/lib/bb_payments/api_error.rb +57 -0
- data/lib/bb_payments/configuration.rb +246 -0
- data/lib/bb_payments/models/base_model.rb +177 -0
- data/lib/bb_payments/models/batch_pix_body.rb +30 -0
- data/lib/bb_payments/models/batch_pix_response.rb +69 -0
- data/lib/bb_payments/models/batch_transfers_body.rb +30 -0
- data/lib/bb_payments/models/batch_transfers_response.rb +64 -0
- data/lib/bb_payments/models/batchtransfers_payments_list.rb +362 -0
- data/lib/bb_payments/models/batchtransferscancel_payment_ids.rb +212 -0
- data/lib/bb_payments/models/body.rb +274 -0
- data/lib/bb_payments/models/error.rb +210 -0
- data/lib/bb_payments/models/error_errors.rb +227 -0
- data/lib/bb_payments/models/error_o_auth_unauthorized.rb +257 -0
- data/lib/bb_payments/models/error_o_auth_unauthorized_attributes.rb +213 -0
- data/lib/bb_payments/models/find_batch_payment.rb +93 -0
- data/lib/bb_payments/models/find_batch_response.rb +71 -0
- data/lib/bb_payments/models/inline_response_200.rb +270 -0
- data/lib/bb_payments/models/inline_response_200_1.rb +430 -0
- data/lib/bb_payments/models/inline_response_200_1_ocurrences_list.rb +227 -0
- data/lib/bb_payments/models/inline_response_200_2.rb +260 -0
- data/lib/bb_payments/models/inline_response_200_2_payments_list.rb +399 -0
- data/lib/bb_payments/models/inline_response_200_3.rb +487 -0
- data/lib/bb_payments/models/inline_response_200_3_lista_boleto.rb +377 -0
- data/lib/bb_payments/models/inline_response_200_3_lista_devolucao.rb +227 -0
- data/lib/bb_payments/models/inline_response_200_payments_list.rb +289 -0
- data/lib/bb_payments/models/inline_response_201.rb +270 -0
- data/lib/bb_payments/models/inline_response_201_1.rb +270 -0
- data/lib/bb_payments/models/inline_response_201_1_payments_list.rb +299 -0
- data/lib/bb_payments/models/inline_response_201_payments_list.rb +399 -0
- data/lib/bb_payments/models/inline_response_400.rb +210 -0
- data/lib/bb_payments/models/inline_response_401.rb +257 -0
- data/lib/bb_payments/models/root_type_for_bank_slip_list.rb +430 -0
- data/lib/bb_payments/models/root_type_for_bank_slips_batch_payment.rb +270 -0
- data/lib/bb_payments/models/root_type_for_bank_slips_batch_payment_response_object.rb +260 -0
- data/lib/bb_payments/models/root_type_for_batch_transfer_get_response_object.rb +230 -0
- data/lib/bb_payments/models/root_type_for_batch_transfer_payments_list_get.rb +348 -0
- data/lib/bb_payments/models/root_type_for_batch_transfers_cancel_payments_list_object.rb +238 -0
- data/lib/bb_payments/models/root_type_for_batch_transfers_cancel_request_object.rb +275 -0
- data/lib/bb_payments/models/root_type_for_batch_transfers_cancel_response_object.rb +210 -0
- data/lib/bb_payments/models/root_type_for_returned_payments_details.rb +468 -0
- data/lib/bb_payments/models/root_type_for_returned_payments_response_object.rb +240 -0
- data/lib/bb_payments/models/root_type_for_slips_details_object.rb +408 -0
- data/lib/bb_payments/models/transfer_base.rb +128 -0
- data/lib/bb_payments/models/transfer_pix.rb +34 -0
- data/lib/bb_payments/models/transfer_pix_base.rb +146 -0
- data/lib/bb_payments/version.rb +3 -0
- data/lib/bb_payments.rb +85 -0
- data/spec/api/batch_payments_api_spec.rb +113 -0
- data/spec/api_client_spec.rb +225 -0
- data/spec/base_object_spec.rb +109 -0
- data/spec/configuration_spec.rb +41 -0
- data/spec/models/body_spec.rb +76 -0
- data/spec/models/error_errors_spec.rb +46 -0
- data/spec/models/error_o_auth_unauthorized_attributes_spec.rb +40 -0
- data/spec/models/error_o_auth_unauthorized_spec.rb +58 -0
- data/spec/models/error_spec.rb +40 -0
- data/spec/models/inline_response_200_1_ocurrences_list_spec.rb +52 -0
- data/spec/models/inline_response_200_1_spec.rb +172 -0
- data/spec/models/inline_response_200_2_payments_list_spec.rb +154 -0
- data/spec/models/inline_response_200_2_spec.rb +70 -0
- data/spec/models/inline_response_200_3_lista_boleto_spec.rb +142 -0
- data/spec/models/inline_response_200_3_lista_devolucao_spec.rb +52 -0
- data/spec/models/inline_response_200_3_spec.rb +154 -0
- data/spec/models/inline_response_200_payments_list_spec.rb +88 -0
- data/spec/models/inline_response_200_spec.rb +76 -0
- data/spec/models/inline_response_201_1_payments_list_spec.rb +94 -0
- data/spec/models/inline_response_201_1_spec.rb +76 -0
- data/spec/models/inline_response_201_payments_list_spec.rb +154 -0
- data/spec/models/inline_response_201_spec.rb +76 -0
- data/spec/models/inline_response_400_spec.rb +40 -0
- data/spec/models/inline_response_401_spec.rb +58 -0
- data/spec/models/root_type_for_bank_slip_list_spec.rb +172 -0
- data/spec/models/root_type_for_bank_slips_batch_payment_response_object_spec.rb +70 -0
- data/spec/models/root_type_for_bank_slips_batch_payment_spec.rb +70 -0
- data/spec/models/root_type_for_batch_transfer_get_response_object_spec.rb +52 -0
- data/spec/models/root_type_for_batch_transfer_payments_list_get_spec.rb +124 -0
- data/spec/models/root_type_for_batch_transfers_cancel_payments_list_object_spec.rb +58 -0
- data/spec/models/root_type_for_batch_transfers_cancel_request_object_spec.rb +70 -0
- data/spec/models/root_type_for_batch_transfers_cancel_response_object_spec.rb +40 -0
- data/spec/models/root_type_for_returned_payments_details_spec.rb +196 -0
- data/spec/models/root_type_for_returned_payments_response_object_spec.rb +58 -0
- data/spec/models/root_type_for_slips_details_object_spec.rb +136 -0
- data/spec/spec_helper.rb +110 -0
- metadata +292 -0
|
@@ -0,0 +1,270 @@
|
|
|
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
|
+
# Resposta para o Pagamento de guias com código de barra
|
|
16
|
+
class InlineResponse2011
|
|
17
|
+
# Identificação da solicitação de pagamento. É um número único, não sequencial, controlado pelo cliente, cujo valor vai de 1 a 999999.
|
|
18
|
+
attr_accessor :request_identification
|
|
19
|
+
|
|
20
|
+
# Código do estado da requisição a ser pesquisada: 1 - Requisição com todos os lançamentos com dados consistentes; 2 - Requisição com ao menos um dos lançamentos com dados inconsistentes; 3 - Requisição com todos os lançamentos com dados inconsistentes; 4 - Requisição pendente de ação pelo Conveniado - falta autorizar o pagamento; 5 - Requisição em processamento pelo Banco; 6 - Requisição Processada; 7 - Requisição Rejeitada, 8 - Preparando remessa não liberada, 9 - Requisição liberada via API, 10 - Preparando remessa liberada. As situações 1, 2 e 8 são transitórias e não requerem qualquer ação do Cliente Conveniado. situação 3 sempre será migrada para situação 7. A situação 4 Significa que, ao menos um lançamento, depende de ação do Cliente Conveniado, seja liberando ou cancelando os pagamentos. As situações 5, 6, 7, 9 e 10 não requerem qualquer ação do Cliente Conveniado. A situação 5 significa que, ao menos um lançamento, está agendado. As situações 6 e 7 são definitivas não havendo alteração posterior da situação da requisição.
|
|
21
|
+
attr_accessor :request_status
|
|
22
|
+
|
|
23
|
+
# Quantidade total de Guias de Recolhimento
|
|
24
|
+
attr_accessor :payment_quantity
|
|
25
|
+
|
|
26
|
+
# Valor total das Guias de Recolhimento (formato 0.00)
|
|
27
|
+
attr_accessor :payment_amount
|
|
28
|
+
|
|
29
|
+
# Quantidade total de lançamentos válidos
|
|
30
|
+
attr_accessor :valid_payment_quantity
|
|
31
|
+
|
|
32
|
+
# Valor total dos lançamentos válidos (formato 0.00).
|
|
33
|
+
attr_accessor :valid_payment_amount
|
|
34
|
+
|
|
35
|
+
# Lista de pagamentos a serem processados em lote.
|
|
36
|
+
attr_accessor :payments_list
|
|
37
|
+
|
|
38
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
39
|
+
def self.attribute_map
|
|
40
|
+
{
|
|
41
|
+
:'request_identification' => :'requestIdentification',
|
|
42
|
+
:'request_status' => :'requestStatus',
|
|
43
|
+
:'payment_quantity' => :'paymentQuantity',
|
|
44
|
+
:'payment_amount' => :'paymentAmount',
|
|
45
|
+
:'valid_payment_quantity' => :'validPaymentQuantity',
|
|
46
|
+
:'valid_payment_amount' => :'validPaymentAmount',
|
|
47
|
+
:'payments_list' => :'paymentsList'
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Attribute type mapping.
|
|
52
|
+
def self.openapi_types
|
|
53
|
+
{
|
|
54
|
+
:'request_identification' => :'Object',
|
|
55
|
+
:'request_status' => :'Object',
|
|
56
|
+
:'payment_quantity' => :'Object',
|
|
57
|
+
:'payment_amount' => :'Object',
|
|
58
|
+
:'valid_payment_quantity' => :'Object',
|
|
59
|
+
:'valid_payment_amount' => :'Object',
|
|
60
|
+
:'payments_list' => :'Object'
|
|
61
|
+
}
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# List of attributes with nullable: true
|
|
65
|
+
def self.openapi_nullable
|
|
66
|
+
Set.new([
|
|
67
|
+
])
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Initializes the object
|
|
71
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
72
|
+
def initialize(attributes = {})
|
|
73
|
+
if (!attributes.is_a?(Hash))
|
|
74
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BancoBrasilPayments::InlineResponse2011` initialize method"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
78
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
79
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
80
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BancoBrasilPayments::InlineResponse2011`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
81
|
+
end
|
|
82
|
+
h[k.to_sym] = v
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if attributes.key?(:'request_identification')
|
|
86
|
+
self.request_identification = attributes[:'request_identification']
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
if attributes.key?(:'request_status')
|
|
90
|
+
self.request_status = attributes[:'request_status']
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
if attributes.key?(:'payment_quantity')
|
|
94
|
+
self.payment_quantity = attributes[:'payment_quantity']
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if attributes.key?(:'payment_amount')
|
|
98
|
+
self.payment_amount = attributes[:'payment_amount']
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:'valid_payment_quantity')
|
|
102
|
+
self.valid_payment_quantity = attributes[:'valid_payment_quantity']
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if attributes.key?(:'valid_payment_amount')
|
|
106
|
+
self.valid_payment_amount = attributes[:'valid_payment_amount']
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if attributes.key?(:'payments_list')
|
|
110
|
+
if (value = attributes[:'payments_list']).is_a?(Array)
|
|
111
|
+
self.payments_list = value
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
117
|
+
# @return Array for valid properties with the reasons
|
|
118
|
+
def list_invalid_properties
|
|
119
|
+
invalid_properties = Array.new
|
|
120
|
+
invalid_properties
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Check to see if the all the properties in the model are valid
|
|
124
|
+
# @return true if the model is valid
|
|
125
|
+
def valid?
|
|
126
|
+
true
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Checks equality by comparing each attribute.
|
|
130
|
+
# @param [Object] Object to be compared
|
|
131
|
+
def ==(o)
|
|
132
|
+
return true if self.equal?(o)
|
|
133
|
+
self.class == o.class &&
|
|
134
|
+
request_identification == o.request_identification &&
|
|
135
|
+
request_status == o.request_status &&
|
|
136
|
+
payment_quantity == o.payment_quantity &&
|
|
137
|
+
payment_amount == o.payment_amount &&
|
|
138
|
+
valid_payment_quantity == o.valid_payment_quantity &&
|
|
139
|
+
valid_payment_amount == o.valid_payment_amount &&
|
|
140
|
+
payments_list == o.payments_list
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# @see the `==` method
|
|
144
|
+
# @param [Object] Object to be compared
|
|
145
|
+
def eql?(o)
|
|
146
|
+
self == o
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Calculates hash code according to all attributes.
|
|
150
|
+
# @return [Integer] Hash code
|
|
151
|
+
def hash
|
|
152
|
+
[request_identification, request_status, payment_quantity, payment_amount, valid_payment_quantity, valid_payment_amount, payments_list].hash
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Builds the object from hash
|
|
156
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
157
|
+
# @return [Object] Returns the model itself
|
|
158
|
+
def self.build_from_hash(attributes)
|
|
159
|
+
new.build_from_hash(attributes)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Builds the object from hash
|
|
163
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
164
|
+
# @return [Object] Returns the model itself
|
|
165
|
+
def build_from_hash(attributes)
|
|
166
|
+
return nil unless attributes.is_a?(Hash)
|
|
167
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
168
|
+
if type =~ /\AArray<(.*)>/i
|
|
169
|
+
# check to ensure the input is an array given that the attribute
|
|
170
|
+
# is documented as an array but the input is not
|
|
171
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
172
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
173
|
+
end
|
|
174
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
175
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
176
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
177
|
+
self.send("#{key}=", nil)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
self
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Deserializes the data based on type
|
|
185
|
+
# @param string type Data type
|
|
186
|
+
# @param string value Value to be deserialized
|
|
187
|
+
# @return [Object] Deserialized data
|
|
188
|
+
def _deserialize(type, value)
|
|
189
|
+
case type.to_sym
|
|
190
|
+
when :DateTime
|
|
191
|
+
DateTime.parse(value)
|
|
192
|
+
when :Date
|
|
193
|
+
Date.parse(value)
|
|
194
|
+
when :String
|
|
195
|
+
value.to_s
|
|
196
|
+
when :Integer
|
|
197
|
+
value.to_i
|
|
198
|
+
when :Float
|
|
199
|
+
value.to_f
|
|
200
|
+
when :Boolean
|
|
201
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
202
|
+
true
|
|
203
|
+
else
|
|
204
|
+
false
|
|
205
|
+
end
|
|
206
|
+
when :Object
|
|
207
|
+
# generic object (usually a Hash), return directly
|
|
208
|
+
value
|
|
209
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
210
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
211
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
212
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
213
|
+
k_type = Regexp.last_match[:k_type]
|
|
214
|
+
v_type = Regexp.last_match[:v_type]
|
|
215
|
+
{}.tap do |hash|
|
|
216
|
+
value.each do |k, v|
|
|
217
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
else # model
|
|
221
|
+
BancoBrasilPayments.const_get(type).build_from_hash(value)
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Returns the string representation of the object
|
|
226
|
+
# @return [String] String presentation of the object
|
|
227
|
+
def to_s
|
|
228
|
+
to_hash.to_s
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
232
|
+
# @return [Hash] Returns the object in the form of hash
|
|
233
|
+
def to_body
|
|
234
|
+
to_hash
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Returns the object in the form of hash
|
|
238
|
+
# @return [Hash] Returns the object in the form of hash
|
|
239
|
+
def to_hash
|
|
240
|
+
hash = {}
|
|
241
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
242
|
+
value = self.send(attr)
|
|
243
|
+
if value.nil?
|
|
244
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
245
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
hash[param] = _to_hash(value)
|
|
249
|
+
end
|
|
250
|
+
hash
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
# Outputs non-array value in the form of hash
|
|
254
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
255
|
+
# @param [Object] value Any valid value
|
|
256
|
+
# @return [Hash] Returns the value in the form of hash
|
|
257
|
+
def _to_hash(value)
|
|
258
|
+
if value.is_a?(Array)
|
|
259
|
+
value.compact.map { |v| _to_hash(v) }
|
|
260
|
+
elsif value.is_a?(Hash)
|
|
261
|
+
{}.tap do |hash|
|
|
262
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
263
|
+
end
|
|
264
|
+
elsif value.respond_to? :to_hash
|
|
265
|
+
value.to_hash
|
|
266
|
+
else
|
|
267
|
+
value
|
|
268
|
+
end
|
|
269
|
+
end end
|
|
270
|
+
end
|
|
@@ -0,0 +1,299 @@
|
|
|
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
|
+
class InlineResponse2011PaymentsList
|
|
16
|
+
# Código identificador do pagamento.
|
|
17
|
+
attr_accessor :payment_id
|
|
18
|
+
|
|
19
|
+
# Nome do convenente.
|
|
20
|
+
attr_accessor :covenanter_name
|
|
21
|
+
|
|
22
|
+
# Define o código de barras numérico da Guia de Recolhimento.
|
|
23
|
+
attr_accessor :numeric_bar_code
|
|
24
|
+
|
|
25
|
+
# Data em que deverá ser efetivado o pagamento (formato: ddmmaaaa)
|
|
26
|
+
attr_accessor :payment_date
|
|
27
|
+
|
|
28
|
+
# Valor do pagamento em reais (formato 0.00)
|
|
29
|
+
attr_accessor :payment_value
|
|
30
|
+
|
|
31
|
+
# Código personalizado usado para identificar um débito no extrato bancário do cliente. Pode ser usado para agrupar débitos similares
|
|
32
|
+
attr_accessor :debit_code
|
|
33
|
+
|
|
34
|
+
# Nº de uso livre pelo cliente conveniado. Equivalente ao Seu Número (Limitado a 20 caracteres).
|
|
35
|
+
attr_accessor :your_number
|
|
36
|
+
|
|
37
|
+
# Descrição do pagamento. Pode ser preenchido livremente pelo cliente como forma de identificação para o pagamento.
|
|
38
|
+
attr_accessor :customer_description
|
|
39
|
+
|
|
40
|
+
# Indicador de pagamento consistente, descrito a seguir: “S” significa que o pagamento pretendido é consistente; \"\"N\"\" significa que o pagamento pretendido é inconsistente e há pelo menos um erro. Se o valor for igual a \"\"N\"\", os possíveis erros serão mostrados em errorCodes da matriz.
|
|
41
|
+
attr_accessor :consistent_payment_indicator
|
|
42
|
+
|
|
43
|
+
# Lista de códigos de erros, descrito a seguir: 1 - Agência de crédito está zerada. Informe o nº da Agência de Crédito. 2 - Conta de crédito informada não é numérica. Informe apenas números. 3 - Dígito da conta de crédito não informado. Informe o DV da conta de crédito. 4 - CPF informado não é numérico. Informe apenas números. 5 - CNPJ informado não é numérico. Informe apenas números. 6 - Data do pagamento não informada. Informe a data do pagamento. 7 - Data do pagamento inválida. Verifique o dado informado. 8 - Valor do pagamento informado não é númerico. Informe apenas números. 9 - Valor do pagamento está zerado. Informe o valor do pagamento. 10 - Ambos os campos Número Compensação e Número ISPB não foram informados. Informe um dos campos. 11 - Ambos os campos Número Compensação e Número ISPB foram informados. Informe apenas um dos campos. 12 - Ambos os campos Finalidade DOC e Finalidade TED não foram informados. Informe um dos campos. 13 - Ambos os campos Finalidade DOC e Finalidade TED foram informados. Informe apenas um dos campos. 14 - Número de depósito judicial não informado. Informe o número do depósito judicial. 15 - Digito da conta de crédito inválido. Verifique o dado informado. 16 - Ambos os campos CPF e CNPJ foram informados. Informe apenas um dos campos. Caso informado os 2 campos, nas consultas será exibido apenas os dados do CPF. 17 - Ambos os campos CPF e CNPJ não foram informados. Informe um dos campos. 18 - Dígito do CPF inválido. Verifique o dado informado. 19 - Dígito do CNPJ inválido. Verifique o dado informado. 20 - Agência e conta de crédito estão iguais às de débito. Opção não permitida. 21 - Número Compensação inválido. Verifique o dado informado. 22 - Número ISPB diferente de zeros. Não informe o nº ISPB. 23 - Conta de crédito não informada. Informe o número da conta de crédito. 24 - CPF não informado. Informe o nº do CPF. 25 - CNPJ foi informado. Não informe CNPJ. 26 - Conta de crédito foi informada. Não informe Conta de crédito. 27 - Dígito da conta de crédito foi informado. Não informe dígito da conta de crédito. 28 - Finalidade do DOC foi informada. Não informe finalidade do DOC. 29 - Finalidade da TED foi informada. Não informe finalidade da TED. 30 - Número Depósito Judicial informado. Não informe finalidade Depósito Judicial. 31 - Número do documento de crédito informado não é numérico. Informe apenas números. 32 - Número do documento de débito não é numérico. Informe apenas números. 33 - CPF não encontrado na base da receita federal. Verifique o dado informado. 34 - CNPJ não encontrado na base da receita federal. Verifique o dado informado. 35 - Conta poupança não permitido para \"Pagamento ao Fornecedor\". Para creditar em conta poupança utilize o recurso para efetivação de \"Pagamentos Diversos\". 36 - Código COMPE deve ser igual a 1 37 - Código ISPB deve ser igual a 0 38 - Código de barras não é numérico. Informe apenas números. 39 - Código de barras igual a zeros. Informe apenas números. 40 - Número de inscrição do pagador não é numérico. Informe apenas números. 41 - Número de inscrição do beneficiário não é numérico. Informe apenas números. 42 - Número de inscrição do avalista não é numérico. Informe apenas números. 43 - Digito do CPF para o pagador inválido. Verifique o dado informado. 44 - Digito do CPF para o beneficiário inválido. Verifique o dado informado. 45 - Digito do CPF para o avalista inválido. Verifique o dado informado. 46 - Digito do CNPJ para o pagador inválido. Verifique o dado informado. 47 - Digito do CNPJ para o beneficiário inválido. Verifique o dado informado. 48 - Digito do CNPJ para o avalista inválido.Verifique o dado informado. 49 - Data do vencimento inválida. Verifique o dado informado. 50 - Valor nominal não é numérico. Informe apenas números. 51 - Valor de desconto não é numérico. Informe apenas números; 52 - Valor de mora não é numérico. Informe apenas números. 53 - Data do pagamento deve ser maior ou igual ao dia atual. 54 - Número do documento de débito não informado. Informe o nº do doc de débito. 55 - Data do vencimento não informada. Informe a data de vencimento. 56 - Nome do beneficiário não informado. Informe o nome do beneficiário. 57 - Número de inscrição do beneficiário não informado. Informe o CPF ou o CNPJ do beneficiário. 58 - Conta pagamento foi informada. Não informe conta pagamento. 59 - Ambos os campos conta de crédito e conta pagamento foram informados. Informe apenas um dos campos. 99 - Consultar o Banco para detalhar o erro 200 - Insuficiência de Fundos - Débito Não Efetuado 201 - Crédito ou Débito Cancelado pelo Pagador 202 - Débito Autorizado pela Agência - Efetuado 203 - Controle Inválido. Verificar campos 01, 02 e 03 do header ou segmento A, B, C, J, J52, N, O ou W do Arquivo CNAB240. 204 - Tipo de Operação Inválido. Verificar campo 04.1 do header de lote. Valor default = \"C\" 205 - Tipo de Serviço Inválido. Utilize 20 para Pagamento a Fornecedores, 30 Pagamento de Salários ou 98 Pagamentos Diversos no header de Lote, campo 05.1, do CNAB240 206 - Forma de Lançamento Inválida. Para crédito em Poupança utilize Pagamentos Diversos. Para crédito em Conta Pagamento utilize Pagamentos Diversos ou Pagamento a Fornecedores. Para Pagamento de salário a conta de crédito deve ser do BB. 207 - Tipo/Número de Inscrição Inválido. CPF ou CNPJ inválido. Verifique dados informados. 208 - Código de Convênio Inválido. Verifique dados informados. 209 - Agência/Conta Corrente/DV Inválido. Verifique dados informados. 210 - Nº Seqüencial do Registro no Lote Inválido. Verifique dado informado. 211 - Código de Segmento de Detalhe Inválido. Verifique dado informado. 212 - Lançamento inconsistente, rejeitado na prévia. Corrigir os dados do lançamento e enviar novo pagamento. 213 - Nº Compe do Banco para crédito Inválido. Verifique dado informado. 214 - Nº do ISPB Banco, Instituição de Pagamento para crédito Inválido. Verifique dado informado. 215 - Agência Mantenedora da Conta Corrente do Favorecido Inválida. Verifique dado informado. 216 - Conta Corrente/DV/Conta de Pagamento do Favorecido Inválido. Verifique dado informado. 217 - Nome do Favorecido não Informado. Informe o nome do favorecido. 218 - Data Lançamento Inválido. Verifique dado informado. 219 - Tipo/Quantidade da Moeda Inválido. Verifique dado informado. 220 - Valor do Lançamento Inválido. Verifique dado informado. 221 - Aviso ao Favorecido - Identificação Inválida. 222 - Tipo/Número de Inscrição do Favorecido Inválido. CPF ou CNPJ do favorecido inválido. Arquivo: Verifique o campo 07.3B - registro detalhe do segmento B. 223 - Logradouro do Favorecido não Informado. Informe o logradouro do favorecido. 224 - Nº do Local do Favorecido não Informado. Informe o nº do local do favorecido. 225 - Cidade do Favorecido não Informada. Informe a cidade do favorecido. 226 - CEP/Complemento do Favorecido Inválido. Verifique dado informado. 227 - Sigla do Estado do Favorecido Inválida. Verifique dado informado. 228 - Nº do Banco para crédito Inválido. Verifique dado informado. 229 - Código/Nome da Agência Depositária não Informado. Informe o dado solicitado. 230 - Seu Número Inválido. Verifique dado informado. 231 - Nosso Número Inválido. Verifique dado informado. 232 - Inclusão Efetuada com Sucesso 233 - Alteração Efetuada com Sucesso 234 - Exclusão Efetuada com Sucesso 235 - Agência/Conta Impedida Legalmente 236 - Empresa não pagou salário. Conta de crédito só aceita pagamento de salário 237 - Falecimento do mutuário. 238 - Empresa não enviou remessa do mutuário 239 - Empresa não enviou remessa no vencimento 240 - Valor da parcela inválida. Verifique dado informado. 241 - Identificação do contrato inválida. Verifique dado informado. 242 - Operação de Consignação Incluída com Sucesso 243 - Operação de Consignação Alterada com Sucesso 244 - Operação de Consignação Excluída com Sucesso 245 - Operação de Consignação Liquidada com Sucesso 246 - Reativação Efetuada com Sucesso 247 - Suspensão Efetuada com Sucesso 248 - Código de Barras - Código do Banco Inválido. 249 - Código de Barras - Código da Moeda Inválido 250 - Código de Barras - Dígito Verificador Geral Inválido 251 - Código de Barras - Valor do Título Inválido 252 - Código de Barras - Campo Livre Inválido 253 - Valor do Documento Inválido. Verifique dado informado. 254 - Valor do Abatimento Inválido. Verifique dado informado. 255 - Valor do Desconto Inválido. Verifique dado informado. 256 - Valor de Mora Inválido. Verifique dado informado. 257 - Valor da Multa Inválido. Verifique dado informado. 258 - Valor do IR Inválido. Verifique dado informado. 259 - Valor do ISS Inválido. Verifique dado informado. 260 - Valor do IOF Inválido. Verifique dado informado. 261 - Valor de Outras Deduções Inválido. Verifique dado informado. 262 - Valor de Outros Acréscimos Inválido. Verifique dado informado. 263 - Valor do INSS Inválido. Verifique dado informado. 264 - Lote Não Aceito. Reenvie os documentos. 265 - Inscrição da Empresa Inválida para o Contrato 266 - Convênio com a Empresa Inexistente/Inválido para o Contrato 267 - Agência/Conta Corrente da Empresa Inexistente/Inválido para o Contrato. Verifique dado informado. 268 - Tipo de Serviço Inválido para o Contrato. Para contrato de Pagamentos, utilize 20 para Pagamento a Fornecedores, 30 Pagamento de Salários ou 98 Pagamentos Diversos no header de Lote, campo 05.1, do CNAB240 269 - Conta Corrente da Empresa com Saldo Insuficiente. 270 - Lote de Serviço Fora de Seqüência 271 - Lote de Serviço Inválido 272 - Arquivo não aceito 273 - Tipo de Registro Inválido 274 - Código Remessa / Retorno Inválido 275 - Versão de layout inválida 276 - Mutuário não identificado 277 - Tipo do beneficio não permite empréstimo 278 - Beneficio cessado/suspenso 279 - Beneficio possui representante legal 280 - Beneficio é do tipo PA (Pensão alimentícia) 281 - Quantidade de contratos permitida excedida 282 - Beneficio não pertence ao Banco informado 283 - Início do desconto informado já ultrapassado 284 - Número da parcela inválida. Verifique dado informado. 285 - Quantidade de parcela inválida. Verifique dado informado. 286 - Margem consignável excedida para o mutuário dentro do prazo do contrato. Verifique suas margens disponíveis. 287 - Empréstimo já cadastrado 288 - Empréstimo inexistente 289 - Empréstimo já encerrado 290 - Arquivo sem trailer 291 - Mutuário sem crédito na competência 292 - Não descontado – outros motivos 293 - Retorno de Crédito não pago 294 - Cancelamento de empréstimo retroativo 295 - Outros Motivos de Glosa 296 - Margem consignável excedida para o mutuário acima do prazo do contrato 297 - Mutuário desligado do empregador. Pagamento não permitido. 298 - Mutuário afastado por licença. Pagamento não permitido. 299 - Primeiro nome do mutuário diferente do primeiro nome do movimento do censo ou diferente da base de Titular do Benefício. Verificar necessidade de ajustes. 300 - Benefício suspenso/cessado pela APS ou Sisobi 301 - Benefício suspenso por dependência de cálculo 302 - Benefício suspenso/cessado pela inspetoria/auditoria 303 - Benefício bloqueado para empréstimo pelo beneficiário 304 - Benefício bloqueado para empréstimo por TBM 305 - Benefício está em fase de concessão de PA ou desdobramento. 306 - Benefício cessado por óbito. 307 - Benefício cessado por fraude. 308 - Benefício cessado por concessão de outro benefício. 309 - Benefício cessado: estatutário transferido para órgão de origem. 310 - Empréstimo suspenso pela APS. 311 - Empréstimo cancelado pelo banco. 312 - Crédito transformado em PAB. 313 - Término da consignação foi alterado. 314 - Fim do empréstimo ocorreu durante período de suspensão ou concessão. 315 - Empréstimo suspenso pelo banco. 316 - Não averbação de contrato – quantidade de parcelas/competências informadas ultrapassou a data limite da extinção de cota do dependente titular de benefícios 317 - Lote Não Aceito - Totais do Lote com Diferença 318 - Título Não Encontrado 319 - Identificador Registro Opcional Inválido. Verifique dado informado. 320 - Código Padrão Inválido. Verifique dado informado. 321 - Código de Ocorrência Inválido. Verifique dado informado. 322 - Complemento de Ocorrência Inválido. Verifique dado informado. 323 - Alegação já Informada 324 - Agência / Conta do Favorecido Substituída. . Verifique dado informado. 325 - Divergência entre o primeiro e último nome do beneficiário versus primeiro e último nome na Receita Federal. Verificar com beneficiário necessidade de ajustes. 326 - Confirmação de Antecipação de Valor 327 - Antecipação parcial de valor 328 - Boleto bloqueado na base. Não passível de pagamento. 329 - Sistema em contingência – Boleto valor maior que referência. Consulte o beneficiário ou tente efetuar o pagamento mais tarde. 330 - Sistema em contingência – Boleto vencido. Consulte o beneficiário ou tente efetuar o pagamento mais tarde. 331 - Sistema em contingência – Boleto indexado. Consulte o beneficiário ou tente efetuar o pagamento mais tarde. 332 - Beneficiário divergente. Verifique dado informado. 333 - Limite de pagamentos parciais do boleto excedido. Consulte o Beneficiário do boleto. 334 - Boleto já liquidado. Não passível de pagamento. 999 - Consultar o Banco para detalhar o erro.
|
|
44
|
+
attr_accessor :error_codes
|
|
45
|
+
|
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
47
|
+
def self.attribute_map
|
|
48
|
+
{
|
|
49
|
+
:'payment_id' => :'paymentId',
|
|
50
|
+
:'covenanter_name' => :'covenanterName',
|
|
51
|
+
:'numeric_bar_code' => :'numericBarCode',
|
|
52
|
+
:'payment_date' => :'paymentDate',
|
|
53
|
+
:'payment_value' => :'paymentValue',
|
|
54
|
+
:'debit_code' => :'debitCode',
|
|
55
|
+
:'your_number' => :'yourNumber',
|
|
56
|
+
:'customer_description' => :'customerDescription',
|
|
57
|
+
:'consistent_payment_indicator' => :'consistentPaymentIndicator',
|
|
58
|
+
:'error_codes' => :'errorCodes'
|
|
59
|
+
}
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Attribute type mapping.
|
|
63
|
+
def self.openapi_types
|
|
64
|
+
{
|
|
65
|
+
:'payment_id' => :'Object',
|
|
66
|
+
:'covenanter_name' => :'Object',
|
|
67
|
+
:'numeric_bar_code' => :'Object',
|
|
68
|
+
:'payment_date' => :'Object',
|
|
69
|
+
:'payment_value' => :'Object',
|
|
70
|
+
:'debit_code' => :'Object',
|
|
71
|
+
:'your_number' => :'Object',
|
|
72
|
+
:'customer_description' => :'Object',
|
|
73
|
+
:'consistent_payment_indicator' => :'Object',
|
|
74
|
+
:'error_codes' => :'Object'
|
|
75
|
+
}
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# List of attributes with nullable: true
|
|
79
|
+
def self.openapi_nullable
|
|
80
|
+
Set.new([
|
|
81
|
+
])
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Initializes the object
|
|
85
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
86
|
+
def initialize(attributes = {})
|
|
87
|
+
if (!attributes.is_a?(Hash))
|
|
88
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `BancoBrasilPayments::InlineResponse2011PaymentsList` initialize method"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
92
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
93
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
94
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `BancoBrasilPayments::InlineResponse2011PaymentsList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
95
|
+
end
|
|
96
|
+
h[k.to_sym] = v
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if attributes.key?(:'payment_id')
|
|
100
|
+
self.payment_id = attributes[:'payment_id']
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if attributes.key?(:'covenanter_name')
|
|
104
|
+
self.covenanter_name = attributes[:'covenanter_name']
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
if attributes.key?(:'numeric_bar_code')
|
|
108
|
+
self.numeric_bar_code = attributes[:'numeric_bar_code']
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if attributes.key?(:'payment_date')
|
|
112
|
+
self.payment_date = attributes[:'payment_date']
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if attributes.key?(:'payment_value')
|
|
116
|
+
self.payment_value = attributes[:'payment_value']
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
if attributes.key?(:'debit_code')
|
|
120
|
+
self.debit_code = attributes[:'debit_code']
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'your_number')
|
|
124
|
+
self.your_number = attributes[:'your_number']
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'customer_description')
|
|
128
|
+
self.customer_description = attributes[:'customer_description']
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'consistent_payment_indicator')
|
|
132
|
+
self.consistent_payment_indicator = attributes[:'consistent_payment_indicator']
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if attributes.key?(:'error_codes')
|
|
136
|
+
if (value = attributes[:'error_codes']).is_a?(Array)
|
|
137
|
+
self.error_codes = value
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
143
|
+
# @return Array for valid properties with the reasons
|
|
144
|
+
def list_invalid_properties
|
|
145
|
+
invalid_properties = Array.new
|
|
146
|
+
invalid_properties
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Check to see if the all the properties in the model are valid
|
|
150
|
+
# @return true if the model is valid
|
|
151
|
+
def valid?
|
|
152
|
+
true
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Checks equality by comparing each attribute.
|
|
156
|
+
# @param [Object] Object to be compared
|
|
157
|
+
def ==(o)
|
|
158
|
+
return true if self.equal?(o)
|
|
159
|
+
self.class == o.class &&
|
|
160
|
+
payment_id == o.payment_id &&
|
|
161
|
+
covenanter_name == o.covenanter_name &&
|
|
162
|
+
numeric_bar_code == o.numeric_bar_code &&
|
|
163
|
+
payment_date == o.payment_date &&
|
|
164
|
+
payment_value == o.payment_value &&
|
|
165
|
+
debit_code == o.debit_code &&
|
|
166
|
+
your_number == o.your_number &&
|
|
167
|
+
customer_description == o.customer_description &&
|
|
168
|
+
consistent_payment_indicator == o.consistent_payment_indicator &&
|
|
169
|
+
error_codes == o.error_codes
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# @see the `==` method
|
|
173
|
+
# @param [Object] Object to be compared
|
|
174
|
+
def eql?(o)
|
|
175
|
+
self == o
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Calculates hash code according to all attributes.
|
|
179
|
+
# @return [Integer] Hash code
|
|
180
|
+
def hash
|
|
181
|
+
[payment_id, covenanter_name, numeric_bar_code, payment_date, payment_value, debit_code, your_number, customer_description, consistent_payment_indicator, error_codes].hash
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Builds the object from hash
|
|
185
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
186
|
+
# @return [Object] Returns the model itself
|
|
187
|
+
def self.build_from_hash(attributes)
|
|
188
|
+
new.build_from_hash(attributes)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Builds the object from hash
|
|
192
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
193
|
+
# @return [Object] Returns the model itself
|
|
194
|
+
def build_from_hash(attributes)
|
|
195
|
+
return nil unless attributes.is_a?(Hash)
|
|
196
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
197
|
+
if type =~ /\AArray<(.*)>/i
|
|
198
|
+
# check to ensure the input is an array given that the attribute
|
|
199
|
+
# is documented as an array but the input is not
|
|
200
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
201
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
202
|
+
end
|
|
203
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
204
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
205
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
206
|
+
self.send("#{key}=", nil)
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
self
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Deserializes the data based on type
|
|
214
|
+
# @param string type Data type
|
|
215
|
+
# @param string value Value to be deserialized
|
|
216
|
+
# @return [Object] Deserialized data
|
|
217
|
+
def _deserialize(type, value)
|
|
218
|
+
case type.to_sym
|
|
219
|
+
when :DateTime
|
|
220
|
+
DateTime.parse(value)
|
|
221
|
+
when :Date
|
|
222
|
+
Date.parse(value)
|
|
223
|
+
when :String
|
|
224
|
+
value.to_s
|
|
225
|
+
when :Integer
|
|
226
|
+
value.to_i
|
|
227
|
+
when :Float
|
|
228
|
+
value.to_f
|
|
229
|
+
when :Boolean
|
|
230
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
231
|
+
true
|
|
232
|
+
else
|
|
233
|
+
false
|
|
234
|
+
end
|
|
235
|
+
when :Object
|
|
236
|
+
# generic object (usually a Hash), return directly
|
|
237
|
+
value
|
|
238
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
239
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
240
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
241
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
242
|
+
k_type = Regexp.last_match[:k_type]
|
|
243
|
+
v_type = Regexp.last_match[:v_type]
|
|
244
|
+
{}.tap do |hash|
|
|
245
|
+
value.each do |k, v|
|
|
246
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
else # model
|
|
250
|
+
BancoBrasilPayments.const_get(type).build_from_hash(value)
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# Returns the string representation of the object
|
|
255
|
+
# @return [String] String presentation of the object
|
|
256
|
+
def to_s
|
|
257
|
+
to_hash.to_s
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
261
|
+
# @return [Hash] Returns the object in the form of hash
|
|
262
|
+
def to_body
|
|
263
|
+
to_hash
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Returns the object in the form of hash
|
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
|
268
|
+
def to_hash
|
|
269
|
+
hash = {}
|
|
270
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
271
|
+
value = self.send(attr)
|
|
272
|
+
if value.nil?
|
|
273
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
274
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
hash[param] = _to_hash(value)
|
|
278
|
+
end
|
|
279
|
+
hash
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Outputs non-array value in the form of hash
|
|
283
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
284
|
+
# @param [Object] value Any valid value
|
|
285
|
+
# @return [Hash] Returns the value in the form of hash
|
|
286
|
+
def _to_hash(value)
|
|
287
|
+
if value.is_a?(Array)
|
|
288
|
+
value.compact.map { |v| _to_hash(v) }
|
|
289
|
+
elsif value.is_a?(Hash)
|
|
290
|
+
{}.tap do |hash|
|
|
291
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
292
|
+
end
|
|
293
|
+
elsif value.respond_to? :to_hash
|
|
294
|
+
value.to_hash
|
|
295
|
+
else
|
|
296
|
+
value
|
|
297
|
+
end
|
|
298
|
+
end end
|
|
299
|
+
end
|