mundi_api 0.9.0
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/LICENSE +28 -0
- data/README.md +2186 -0
- data/lib/mundi_api.rb +137 -0
- data/lib/mundi_api/api_helper.rb +209 -0
- data/lib/mundi_api/configuration.rb +25 -0
- data/lib/mundi_api/controllers/base_controller.rb +61 -0
- data/lib/mundi_api/controllers/charges_controller.rb +359 -0
- data/lib/mundi_api/controllers/customers_controller.rb +758 -0
- data/lib/mundi_api/controllers/invoices_controller.rb +184 -0
- data/lib/mundi_api/controllers/orders_controller.rb +171 -0
- data/lib/mundi_api/controllers/plans_controller.rb +387 -0
- data/lib/mundi_api/controllers/subscriptions_controller.rb +648 -0
- data/lib/mundi_api/controllers/tokens_controller.rb +87 -0
- data/lib/mundi_api/exceptions/api_exception.rb +18 -0
- data/lib/mundi_api/exceptions/error_exception.rb +37 -0
- data/lib/mundi_api/http/auth/basic_auth.rb +20 -0
- data/lib/mundi_api/http/faraday_client.rb +55 -0
- data/lib/mundi_api/http/http_call_back.rb +22 -0
- data/lib/mundi_api/http/http_client.rb +92 -0
- data/lib/mundi_api/http/http_context.rb +18 -0
- data/lib/mundi_api/http/http_method_enum.rb +11 -0
- data/lib/mundi_api/http/http_request.rb +48 -0
- data/lib/mundi_api/http/http_response.rb +21 -0
- data/lib/mundi_api/models/base_model.rb +34 -0
- data/lib/mundi_api/models/create_access_token_request.rb +35 -0
- data/lib/mundi_api/models/create_address_request.rb +108 -0
- data/lib/mundi_api/models/create_bank_transfer_payment_request.rb +44 -0
- data/lib/mundi_api/models/create_boleto_payment_request.rb +83 -0
- data/lib/mundi_api/models/create_cancel_charge_request.rb +35 -0
- data/lib/mundi_api/models/create_cancel_subscription_request.rb +35 -0
- data/lib/mundi_api/models/create_capture_charge_request.rb +45 -0
- data/lib/mundi_api/models/create_card_options_request.rb +36 -0
- data/lib/mundi_api/models/create_card_request.rb +136 -0
- data/lib/mundi_api/models/create_card_token_request.rb +80 -0
- data/lib/mundi_api/models/create_charge_request.rb +92 -0
- data/lib/mundi_api/models/create_checkout_boleto_payment_request.rb +54 -0
- data/lib/mundi_api/models/create_checkout_card_installment_option_request.rb +44 -0
- data/lib/mundi_api/models/create_checkout_card_payment_request.rb +51 -0
- data/lib/mundi_api/models/create_checkout_payment_request.rb +82 -0
- data/lib/mundi_api/models/create_credit_card_payment_request.rb +108 -0
- data/lib/mundi_api/models/create_customer_request.rb +108 -0
- data/lib/mundi_api/models/create_discount_request.rb +62 -0
- data/lib/mundi_api/models/create_order_item_request.rb +71 -0
- data/lib/mundi_api/models/create_order_request.rb +114 -0
- data/lib/mundi_api/models/create_payment_request.rb +121 -0
- data/lib/mundi_api/models/create_phone_request.rb +53 -0
- data/lib/mundi_api/models/create_phones_request.rb +46 -0
- data/lib/mundi_api/models/create_plan_item_request.rb +81 -0
- data/lib/mundi_api/models/create_plan_request.rb +199 -0
- data/lib/mundi_api/models/create_price_bracket_request.rb +62 -0
- data/lib/mundi_api/models/create_pricing_scheme_request.rb +69 -0
- data/lib/mundi_api/models/create_seller_request.rb +90 -0
- data/lib/mundi_api/models/create_setup_request.rb +55 -0
- data/lib/mundi_api/models/create_shipping_request.rb +81 -0
- data/lib/mundi_api/models/create_subscription_item_request.rb +106 -0
- data/lib/mundi_api/models/create_subscription_request.rb +269 -0
- data/lib/mundi_api/models/create_token_request.rb +44 -0
- data/lib/mundi_api/models/create_usage_request.rb +54 -0
- data/lib/mundi_api/models/create_voucher_payment_request.rb +72 -0
- data/lib/mundi_api/models/get_access_token_response.rb +73 -0
- data/lib/mundi_api/models/get_address_response.rb +163 -0
- data/lib/mundi_api/models/get_bank_transfer_transaction_response.rb +118 -0
- data/lib/mundi_api/models/get_billing_address_response.rb +98 -0
- data/lib/mundi_api/models/get_boleto_transaction_response.rb +137 -0
- data/lib/mundi_api/models/get_card_response.rb +164 -0
- data/lib/mundi_api/models/get_card_token_response.rb +89 -0
- data/lib/mundi_api/models/get_charge_response.rb +184 -0
- data/lib/mundi_api/models/get_checkout_payment_settings_response.rb +99 -0
- data/lib/mundi_api/models/get_credit_card_transaction_response.rb +163 -0
- data/lib/mundi_api/models/get_customer_response.rb +145 -0
- data/lib/mundi_api/models/get_discount_response.rb +100 -0
- data/lib/mundi_api/models/get_invoice_item_response.rb +73 -0
- data/lib/mundi_api/models/get_invoice_response.rb +210 -0
- data/lib/mundi_api/models/get_order_item_response.rb +63 -0
- data/lib/mundi_api/models/get_order_response.rb +167 -0
- data/lib/mundi_api/models/get_period_response.rb +73 -0
- data/lib/mundi_api/models/get_phone_response.rb +53 -0
- data/lib/mundi_api/models/get_phones_response.rb +46 -0
- data/lib/mundi_api/models/get_plan_item_response.rb +127 -0
- data/lib/mundi_api/models/get_plan_response.rb +223 -0
- data/lib/mundi_api/models/get_price_bracket_response.rb +62 -0
- data/lib/mundi_api/models/get_pricing_scheme_response.rb +69 -0
- data/lib/mundi_api/models/get_safety_pay_transaction_response.rb +109 -0
- data/lib/mundi_api/models/get_seller_response.rb +126 -0
- data/lib/mundi_api/models/get_setup_response.rb +62 -0
- data/lib/mundi_api/models/get_shipping_response.rb +72 -0
- data/lib/mundi_api/models/get_subscription_item_response.rb +135 -0
- data/lib/mundi_api/models/get_subscription_response.rb +261 -0
- data/lib/mundi_api/models/get_token_response.rb +72 -0
- data/lib/mundi_api/models/get_transaction_response.rb +136 -0
- data/lib/mundi_api/models/get_usage_response.rb +82 -0
- data/lib/mundi_api/models/get_voucher_transaction_response.rb +163 -0
- data/lib/mundi_api/models/list_access_tokens_response.rb +51 -0
- data/lib/mundi_api/models/list_addresses_response.rb +51 -0
- data/lib/mundi_api/models/list_cards_response.rb +51 -0
- data/lib/mundi_api/models/list_charges_response.rb +51 -0
- data/lib/mundi_api/models/list_customers_response.rb +51 -0
- data/lib/mundi_api/models/list_invoices_response.rb +51 -0
- data/lib/mundi_api/models/list_order_response.rb +51 -0
- data/lib/mundi_api/models/list_plans_response.rb +51 -0
- data/lib/mundi_api/models/list_subscription_items_response.rb +51 -0
- data/lib/mundi_api/models/list_subscriptions_response.rb +51 -0
- data/lib/mundi_api/models/list_transactions_response.rb +51 -0
- data/lib/mundi_api/models/list_usages_response.rb +51 -0
- data/lib/mundi_api/models/paging_response.rb +53 -0
- data/lib/mundi_api/models/update_address_request.rb +53 -0
- data/lib/mundi_api/models/update_card_request.rb +81 -0
- data/lib/mundi_api/models/update_charge_card_request.rb +62 -0
- data/lib/mundi_api/models/update_charge_due_date_request.rb +36 -0
- data/lib/mundi_api/models/update_charge_payment_method_request.rb +74 -0
- data/lib/mundi_api/models/update_customer_request.rb +90 -0
- data/lib/mundi_api/models/update_metadata_request.rb +35 -0
- data/lib/mundi_api/models/update_plan_item_request.rb +81 -0
- data/lib/mundi_api/models/update_plan_request.rb +161 -0
- data/lib/mundi_api/models/update_price_bracket_request.rb +62 -0
- data/lib/mundi_api/models/update_pricing_scheme_request.rb +69 -0
- data/lib/mundi_api/models/update_subscription_billing_date_request.rb +37 -0
- data/lib/mundi_api/models/update_subscription_card_request.rb +44 -0
- data/lib/mundi_api/models/update_subscription_item_request.rb +81 -0
- data/lib/mundi_api/models/update_subscription_payment_method_request.rb +53 -0
- data/lib/mundi_api/mundi_api_client.rb +63 -0
- metadata +246 -0
@@ -0,0 +1,163 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
require 'date'
|
5
|
+
module MundiApi
|
6
|
+
# Response object for getting an Address
|
7
|
+
class GetAddressResponse < BaseModel
|
8
|
+
# TODO: Write general description for this method
|
9
|
+
# @return [String]
|
10
|
+
attr_accessor :id
|
11
|
+
|
12
|
+
# TODO: Write general description for this method
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :street
|
15
|
+
|
16
|
+
# TODO: Write general description for this method
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :number
|
19
|
+
|
20
|
+
# TODO: Write general description for this method
|
21
|
+
# @return [String]
|
22
|
+
attr_accessor :complement
|
23
|
+
|
24
|
+
# TODO: Write general description for this method
|
25
|
+
# @return [String]
|
26
|
+
attr_accessor :zip_code
|
27
|
+
|
28
|
+
# TODO: Write general description for this method
|
29
|
+
# @return [String]
|
30
|
+
attr_accessor :neighborhood
|
31
|
+
|
32
|
+
# TODO: Write general description for this method
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :city
|
35
|
+
|
36
|
+
# TODO: Write general description for this method
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :state
|
39
|
+
|
40
|
+
# TODO: Write general description for this method
|
41
|
+
# @return [String]
|
42
|
+
attr_accessor :country
|
43
|
+
|
44
|
+
# TODO: Write general description for this method
|
45
|
+
# @return [String]
|
46
|
+
attr_accessor :status
|
47
|
+
|
48
|
+
# TODO: Write general description for this method
|
49
|
+
# @return [DateTime]
|
50
|
+
attr_accessor :created_at
|
51
|
+
|
52
|
+
# TODO: Write general description for this method
|
53
|
+
# @return [DateTime]
|
54
|
+
attr_accessor :updated_at
|
55
|
+
|
56
|
+
# TODO: Write general description for this method
|
57
|
+
# @return [GetCustomerResponse]
|
58
|
+
attr_accessor :customer
|
59
|
+
|
60
|
+
# TODO: Write general description for this method
|
61
|
+
# @return [Array<String, String>]
|
62
|
+
attr_accessor :metadata
|
63
|
+
|
64
|
+
# TODO: Write general description for this method
|
65
|
+
# @return [DateTime]
|
66
|
+
attr_accessor :deleted_at
|
67
|
+
|
68
|
+
# A mapping from model property names to API property names.
|
69
|
+
def self.names
|
70
|
+
if @_hash.nil?
|
71
|
+
@_hash = {}
|
72
|
+
@_hash['id'] = 'id'
|
73
|
+
@_hash['street'] = 'street'
|
74
|
+
@_hash['number'] = 'number'
|
75
|
+
@_hash['complement'] = 'complement'
|
76
|
+
@_hash['zip_code'] = 'zip_code'
|
77
|
+
@_hash['neighborhood'] = 'neighborhood'
|
78
|
+
@_hash['city'] = 'city'
|
79
|
+
@_hash['state'] = 'state'
|
80
|
+
@_hash['country'] = 'country'
|
81
|
+
@_hash['status'] = 'status'
|
82
|
+
@_hash['created_at'] = 'created_at'
|
83
|
+
@_hash['updated_at'] = 'updated_at'
|
84
|
+
@_hash['customer'] = 'customer'
|
85
|
+
@_hash['metadata'] = 'metadata'
|
86
|
+
@_hash['deleted_at'] = 'deleted_at'
|
87
|
+
end
|
88
|
+
@_hash
|
89
|
+
end
|
90
|
+
|
91
|
+
def initialize(id = nil,
|
92
|
+
street = nil,
|
93
|
+
number = nil,
|
94
|
+
complement = nil,
|
95
|
+
zip_code = nil,
|
96
|
+
neighborhood = nil,
|
97
|
+
city = nil,
|
98
|
+
state = nil,
|
99
|
+
country = nil,
|
100
|
+
status = nil,
|
101
|
+
created_at = nil,
|
102
|
+
updated_at = nil,
|
103
|
+
customer = nil,
|
104
|
+
metadata = nil,
|
105
|
+
deleted_at = nil)
|
106
|
+
@id = id
|
107
|
+
@street = street
|
108
|
+
@number = number
|
109
|
+
@complement = complement
|
110
|
+
@zip_code = zip_code
|
111
|
+
@neighborhood = neighborhood
|
112
|
+
@city = city
|
113
|
+
@state = state
|
114
|
+
@country = country
|
115
|
+
@status = status
|
116
|
+
@created_at = created_at
|
117
|
+
@updated_at = updated_at
|
118
|
+
@customer = customer
|
119
|
+
@metadata = metadata
|
120
|
+
@deleted_at = deleted_at
|
121
|
+
end
|
122
|
+
|
123
|
+
# Creates an instance of the object from a hash.
|
124
|
+
def self.from_hash(hash)
|
125
|
+
return nil unless hash
|
126
|
+
|
127
|
+
# Extract variables from the hash.
|
128
|
+
id = hash['id']
|
129
|
+
street = hash['street']
|
130
|
+
number = hash['number']
|
131
|
+
complement = hash['complement']
|
132
|
+
zip_code = hash['zip_code']
|
133
|
+
neighborhood = hash['neighborhood']
|
134
|
+
city = hash['city']
|
135
|
+
state = hash['state']
|
136
|
+
country = hash['country']
|
137
|
+
status = hash['status']
|
138
|
+
created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
|
139
|
+
updated_at = DateTime.rfc3339(hash['updated_at']) if hash['updated_at']
|
140
|
+
customer = GetCustomerResponse.from_hash(hash['customer']) if
|
141
|
+
hash['customer']
|
142
|
+
metadata = hash['metadata']
|
143
|
+
deleted_at = DateTime.rfc3339(hash['deleted_at']) if hash['deleted_at']
|
144
|
+
|
145
|
+
# Create object from extracted values.
|
146
|
+
GetAddressResponse.new(id,
|
147
|
+
street,
|
148
|
+
number,
|
149
|
+
complement,
|
150
|
+
zip_code,
|
151
|
+
neighborhood,
|
152
|
+
city,
|
153
|
+
state,
|
154
|
+
country,
|
155
|
+
status,
|
156
|
+
created_at,
|
157
|
+
updated_at,
|
158
|
+
customer,
|
159
|
+
metadata,
|
160
|
+
deleted_at)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
require 'date'
|
5
|
+
require_relative 'get_transaction_response'
|
6
|
+
|
7
|
+
module MundiApi
|
8
|
+
# Response object for getting a bank transfer transaction
|
9
|
+
class GetBankTransferTransactionResponse < GetTransactionResponse
|
10
|
+
# Payment url
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :url
|
13
|
+
|
14
|
+
# Transaction identifier for the bank
|
15
|
+
# @return [String]
|
16
|
+
attr_accessor :bank_tid
|
17
|
+
|
18
|
+
# Bank
|
19
|
+
# @return [String]
|
20
|
+
attr_accessor :bank
|
21
|
+
|
22
|
+
# Payment date
|
23
|
+
# @return [DateTime]
|
24
|
+
attr_accessor :paid_at
|
25
|
+
|
26
|
+
# Paid amount
|
27
|
+
# @return [Integer]
|
28
|
+
attr_accessor :paid_amount
|
29
|
+
|
30
|
+
# A mapping from model property names to API property names.
|
31
|
+
def self.names
|
32
|
+
if @_hash.nil?
|
33
|
+
@_hash = {}
|
34
|
+
@_hash['url'] = 'url'
|
35
|
+
@_hash['bank_tid'] = 'bank_tid'
|
36
|
+
@_hash['bank'] = 'bank'
|
37
|
+
@_hash['paid_at'] = 'paid_at'
|
38
|
+
@_hash['paid_amount'] = 'paid_amount'
|
39
|
+
@_hash = super().merge(@_hash)
|
40
|
+
end
|
41
|
+
@_hash
|
42
|
+
end
|
43
|
+
|
44
|
+
def initialize(url = nil,
|
45
|
+
bank_tid = nil,
|
46
|
+
bank = nil,
|
47
|
+
gateway_id = nil,
|
48
|
+
amount = nil,
|
49
|
+
status = nil,
|
50
|
+
success = nil,
|
51
|
+
created_at = nil,
|
52
|
+
updated_at = nil,
|
53
|
+
attempt_count = nil,
|
54
|
+
max_attempts = nil,
|
55
|
+
paid_at = nil,
|
56
|
+
paid_amount = nil,
|
57
|
+
next_attempt = nil,
|
58
|
+
transaction_type = nil)
|
59
|
+
@url = url
|
60
|
+
@bank_tid = bank_tid
|
61
|
+
@bank = bank
|
62
|
+
@paid_at = paid_at
|
63
|
+
@paid_amount = paid_amount
|
64
|
+
|
65
|
+
# Call the constructor of the base class
|
66
|
+
super(gateway_id,
|
67
|
+
amount,
|
68
|
+
status,
|
69
|
+
success,
|
70
|
+
created_at,
|
71
|
+
updated_at,
|
72
|
+
attempt_count,
|
73
|
+
max_attempts,
|
74
|
+
next_attempt,
|
75
|
+
transaction_type)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Creates an instance of the object from a hash.
|
79
|
+
def self.from_hash(hash)
|
80
|
+
return nil unless hash
|
81
|
+
|
82
|
+
# Extract variables from the hash.
|
83
|
+
url = hash['url']
|
84
|
+
bank_tid = hash['bank_tid']
|
85
|
+
bank = hash['bank']
|
86
|
+
gateway_id = hash['gateway_id']
|
87
|
+
amount = hash['amount']
|
88
|
+
status = hash['status']
|
89
|
+
success = hash['success']
|
90
|
+
created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
|
91
|
+
updated_at = DateTime.rfc3339(hash['updated_at']) if hash['updated_at']
|
92
|
+
attempt_count = hash['attempt_count']
|
93
|
+
max_attempts = hash['max_attempts']
|
94
|
+
paid_at = DateTime.rfc3339(hash['paid_at']) if hash['paid_at']
|
95
|
+
paid_amount = hash['paid_amount']
|
96
|
+
next_attempt = DateTime.rfc3339(hash['next_attempt']) if
|
97
|
+
hash['next_attempt']
|
98
|
+
transaction_type = hash['transaction_type']
|
99
|
+
|
100
|
+
# Create object from extracted values.
|
101
|
+
GetBankTransferTransactionResponse.new(url,
|
102
|
+
bank_tid,
|
103
|
+
bank,
|
104
|
+
gateway_id,
|
105
|
+
amount,
|
106
|
+
status,
|
107
|
+
success,
|
108
|
+
created_at,
|
109
|
+
updated_at,
|
110
|
+
attempt_count,
|
111
|
+
max_attempts,
|
112
|
+
paid_at,
|
113
|
+
paid_amount,
|
114
|
+
next_attempt,
|
115
|
+
transaction_type)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
5
|
+
# Response object for getting a billing address
|
6
|
+
class GetBillingAddressResponse < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :street
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :number
|
14
|
+
|
15
|
+
# TODO: Write general description for this method
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :zip_code
|
18
|
+
|
19
|
+
# TODO: Write general description for this method
|
20
|
+
# @return [String]
|
21
|
+
attr_accessor :neighborhood
|
22
|
+
|
23
|
+
# TODO: Write general description for this method
|
24
|
+
# @return [String]
|
25
|
+
attr_accessor :city
|
26
|
+
|
27
|
+
# TODO: Write general description for this method
|
28
|
+
# @return [String]
|
29
|
+
attr_accessor :state
|
30
|
+
|
31
|
+
# TODO: Write general description for this method
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :country
|
34
|
+
|
35
|
+
# TODO: Write general description for this method
|
36
|
+
# @return [String]
|
37
|
+
attr_accessor :complement
|
38
|
+
|
39
|
+
# A mapping from model property names to API property names.
|
40
|
+
def self.names
|
41
|
+
if @_hash.nil?
|
42
|
+
@_hash = {}
|
43
|
+
@_hash['street'] = 'street'
|
44
|
+
@_hash['number'] = 'number'
|
45
|
+
@_hash['zip_code'] = 'zip_code'
|
46
|
+
@_hash['neighborhood'] = 'neighborhood'
|
47
|
+
@_hash['city'] = 'city'
|
48
|
+
@_hash['state'] = 'state'
|
49
|
+
@_hash['country'] = 'country'
|
50
|
+
@_hash['complement'] = 'complement'
|
51
|
+
end
|
52
|
+
@_hash
|
53
|
+
end
|
54
|
+
|
55
|
+
def initialize(street = nil,
|
56
|
+
number = nil,
|
57
|
+
zip_code = nil,
|
58
|
+
neighborhood = nil,
|
59
|
+
city = nil,
|
60
|
+
state = nil,
|
61
|
+
country = nil,
|
62
|
+
complement = nil)
|
63
|
+
@street = street
|
64
|
+
@number = number
|
65
|
+
@zip_code = zip_code
|
66
|
+
@neighborhood = neighborhood
|
67
|
+
@city = city
|
68
|
+
@state = state
|
69
|
+
@country = country
|
70
|
+
@complement = complement
|
71
|
+
end
|
72
|
+
|
73
|
+
# Creates an instance of the object from a hash.
|
74
|
+
def self.from_hash(hash)
|
75
|
+
return nil unless hash
|
76
|
+
|
77
|
+
# Extract variables from the hash.
|
78
|
+
street = hash['street']
|
79
|
+
number = hash['number']
|
80
|
+
zip_code = hash['zip_code']
|
81
|
+
neighborhood = hash['neighborhood']
|
82
|
+
city = hash['city']
|
83
|
+
state = hash['state']
|
84
|
+
country = hash['country']
|
85
|
+
complement = hash['complement']
|
86
|
+
|
87
|
+
# Create object from extracted values.
|
88
|
+
GetBillingAddressResponse.new(street,
|
89
|
+
number,
|
90
|
+
zip_code,
|
91
|
+
neighborhood,
|
92
|
+
city,
|
93
|
+
state,
|
94
|
+
country,
|
95
|
+
complement)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
require 'date'
|
5
|
+
require_relative 'get_transaction_response'
|
6
|
+
|
7
|
+
module MundiApi
|
8
|
+
# Response object for getting a boleto transaction
|
9
|
+
class GetBoletoTransactionResponse < GetTransactionResponse
|
10
|
+
# TODO: Write general description for this method
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :url
|
13
|
+
|
14
|
+
# TODO: Write general description for this method
|
15
|
+
# @return [String]
|
16
|
+
attr_accessor :bar_code
|
17
|
+
|
18
|
+
# TODO: Write general description for this method
|
19
|
+
# @return [String]
|
20
|
+
attr_accessor :nosso_numero
|
21
|
+
|
22
|
+
# TODO: Write general description for this method
|
23
|
+
# @return [String]
|
24
|
+
attr_accessor :bank
|
25
|
+
|
26
|
+
# TODO: Write general description for this method
|
27
|
+
# @return [String]
|
28
|
+
attr_accessor :document_number
|
29
|
+
|
30
|
+
# TODO: Write general description for this method
|
31
|
+
# @return [String]
|
32
|
+
attr_accessor :instructions
|
33
|
+
|
34
|
+
# TODO: Write general description for this method
|
35
|
+
# @return [GetBillingAddressResponse]
|
36
|
+
attr_accessor :billing_address
|
37
|
+
|
38
|
+
# A mapping from model property names to API property names.
|
39
|
+
def self.names
|
40
|
+
if @_hash.nil?
|
41
|
+
@_hash = {}
|
42
|
+
@_hash['url'] = 'url'
|
43
|
+
@_hash['bar_code'] = 'bar_code'
|
44
|
+
@_hash['nosso_numero'] = 'nosso_numero'
|
45
|
+
@_hash['bank'] = 'bank'
|
46
|
+
@_hash['document_number'] = 'document_number'
|
47
|
+
@_hash['instructions'] = 'instructions'
|
48
|
+
@_hash['billing_address'] = 'billing_address'
|
49
|
+
@_hash = super().merge(@_hash)
|
50
|
+
end
|
51
|
+
@_hash
|
52
|
+
end
|
53
|
+
|
54
|
+
def initialize(url = nil,
|
55
|
+
bar_code = nil,
|
56
|
+
nosso_numero = nil,
|
57
|
+
bank = nil,
|
58
|
+
document_number = nil,
|
59
|
+
instructions = nil,
|
60
|
+
billing_address = nil,
|
61
|
+
gateway_id = nil,
|
62
|
+
amount = nil,
|
63
|
+
status = nil,
|
64
|
+
success = nil,
|
65
|
+
created_at = nil,
|
66
|
+
updated_at = nil,
|
67
|
+
attempt_count = nil,
|
68
|
+
max_attempts = nil,
|
69
|
+
next_attempt = nil,
|
70
|
+
transaction_type = nil)
|
71
|
+
@url = url
|
72
|
+
@bar_code = bar_code
|
73
|
+
@nosso_numero = nosso_numero
|
74
|
+
@bank = bank
|
75
|
+
@document_number = document_number
|
76
|
+
@instructions = instructions
|
77
|
+
@billing_address = billing_address
|
78
|
+
|
79
|
+
# Call the constructor of the base class
|
80
|
+
super(gateway_id,
|
81
|
+
amount,
|
82
|
+
status,
|
83
|
+
success,
|
84
|
+
created_at,
|
85
|
+
updated_at,
|
86
|
+
attempt_count,
|
87
|
+
max_attempts,
|
88
|
+
next_attempt,
|
89
|
+
transaction_type)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Creates an instance of the object from a hash.
|
93
|
+
def self.from_hash(hash)
|
94
|
+
return nil unless hash
|
95
|
+
|
96
|
+
# Extract variables from the hash.
|
97
|
+
url = hash['url']
|
98
|
+
bar_code = hash['bar_code']
|
99
|
+
nosso_numero = hash['nosso_numero']
|
100
|
+
bank = hash['bank']
|
101
|
+
document_number = hash['document_number']
|
102
|
+
instructions = hash['instructions']
|
103
|
+
billing_address = GetBillingAddressResponse.from_hash(hash['billing_address']) if
|
104
|
+
hash['billing_address']
|
105
|
+
gateway_id = hash['gateway_id']
|
106
|
+
amount = hash['amount']
|
107
|
+
status = hash['status']
|
108
|
+
success = hash['success']
|
109
|
+
created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
|
110
|
+
updated_at = DateTime.rfc3339(hash['updated_at']) if hash['updated_at']
|
111
|
+
attempt_count = hash['attempt_count']
|
112
|
+
max_attempts = hash['max_attempts']
|
113
|
+
next_attempt = DateTime.rfc3339(hash['next_attempt']) if
|
114
|
+
hash['next_attempt']
|
115
|
+
transaction_type = hash['transaction_type']
|
116
|
+
|
117
|
+
# Create object from extracted values.
|
118
|
+
GetBoletoTransactionResponse.new(url,
|
119
|
+
bar_code,
|
120
|
+
nosso_numero,
|
121
|
+
bank,
|
122
|
+
document_number,
|
123
|
+
instructions,
|
124
|
+
billing_address,
|
125
|
+
gateway_id,
|
126
|
+
amount,
|
127
|
+
status,
|
128
|
+
success,
|
129
|
+
created_at,
|
130
|
+
updated_at,
|
131
|
+
attempt_count,
|
132
|
+
max_attempts,
|
133
|
+
next_attempt,
|
134
|
+
transaction_type)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|