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.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +2186 -0
  4. data/lib/mundi_api.rb +137 -0
  5. data/lib/mundi_api/api_helper.rb +209 -0
  6. data/lib/mundi_api/configuration.rb +25 -0
  7. data/lib/mundi_api/controllers/base_controller.rb +61 -0
  8. data/lib/mundi_api/controllers/charges_controller.rb +359 -0
  9. data/lib/mundi_api/controllers/customers_controller.rb +758 -0
  10. data/lib/mundi_api/controllers/invoices_controller.rb +184 -0
  11. data/lib/mundi_api/controllers/orders_controller.rb +171 -0
  12. data/lib/mundi_api/controllers/plans_controller.rb +387 -0
  13. data/lib/mundi_api/controllers/subscriptions_controller.rb +648 -0
  14. data/lib/mundi_api/controllers/tokens_controller.rb +87 -0
  15. data/lib/mundi_api/exceptions/api_exception.rb +18 -0
  16. data/lib/mundi_api/exceptions/error_exception.rb +37 -0
  17. data/lib/mundi_api/http/auth/basic_auth.rb +20 -0
  18. data/lib/mundi_api/http/faraday_client.rb +55 -0
  19. data/lib/mundi_api/http/http_call_back.rb +22 -0
  20. data/lib/mundi_api/http/http_client.rb +92 -0
  21. data/lib/mundi_api/http/http_context.rb +18 -0
  22. data/lib/mundi_api/http/http_method_enum.rb +11 -0
  23. data/lib/mundi_api/http/http_request.rb +48 -0
  24. data/lib/mundi_api/http/http_response.rb +21 -0
  25. data/lib/mundi_api/models/base_model.rb +34 -0
  26. data/lib/mundi_api/models/create_access_token_request.rb +35 -0
  27. data/lib/mundi_api/models/create_address_request.rb +108 -0
  28. data/lib/mundi_api/models/create_bank_transfer_payment_request.rb +44 -0
  29. data/lib/mundi_api/models/create_boleto_payment_request.rb +83 -0
  30. data/lib/mundi_api/models/create_cancel_charge_request.rb +35 -0
  31. data/lib/mundi_api/models/create_cancel_subscription_request.rb +35 -0
  32. data/lib/mundi_api/models/create_capture_charge_request.rb +45 -0
  33. data/lib/mundi_api/models/create_card_options_request.rb +36 -0
  34. data/lib/mundi_api/models/create_card_request.rb +136 -0
  35. data/lib/mundi_api/models/create_card_token_request.rb +80 -0
  36. data/lib/mundi_api/models/create_charge_request.rb +92 -0
  37. data/lib/mundi_api/models/create_checkout_boleto_payment_request.rb +54 -0
  38. data/lib/mundi_api/models/create_checkout_card_installment_option_request.rb +44 -0
  39. data/lib/mundi_api/models/create_checkout_card_payment_request.rb +51 -0
  40. data/lib/mundi_api/models/create_checkout_payment_request.rb +82 -0
  41. data/lib/mundi_api/models/create_credit_card_payment_request.rb +108 -0
  42. data/lib/mundi_api/models/create_customer_request.rb +108 -0
  43. data/lib/mundi_api/models/create_discount_request.rb +62 -0
  44. data/lib/mundi_api/models/create_order_item_request.rb +71 -0
  45. data/lib/mundi_api/models/create_order_request.rb +114 -0
  46. data/lib/mundi_api/models/create_payment_request.rb +121 -0
  47. data/lib/mundi_api/models/create_phone_request.rb +53 -0
  48. data/lib/mundi_api/models/create_phones_request.rb +46 -0
  49. data/lib/mundi_api/models/create_plan_item_request.rb +81 -0
  50. data/lib/mundi_api/models/create_plan_request.rb +199 -0
  51. data/lib/mundi_api/models/create_price_bracket_request.rb +62 -0
  52. data/lib/mundi_api/models/create_pricing_scheme_request.rb +69 -0
  53. data/lib/mundi_api/models/create_seller_request.rb +90 -0
  54. data/lib/mundi_api/models/create_setup_request.rb +55 -0
  55. data/lib/mundi_api/models/create_shipping_request.rb +81 -0
  56. data/lib/mundi_api/models/create_subscription_item_request.rb +106 -0
  57. data/lib/mundi_api/models/create_subscription_request.rb +269 -0
  58. data/lib/mundi_api/models/create_token_request.rb +44 -0
  59. data/lib/mundi_api/models/create_usage_request.rb +54 -0
  60. data/lib/mundi_api/models/create_voucher_payment_request.rb +72 -0
  61. data/lib/mundi_api/models/get_access_token_response.rb +73 -0
  62. data/lib/mundi_api/models/get_address_response.rb +163 -0
  63. data/lib/mundi_api/models/get_bank_transfer_transaction_response.rb +118 -0
  64. data/lib/mundi_api/models/get_billing_address_response.rb +98 -0
  65. data/lib/mundi_api/models/get_boleto_transaction_response.rb +137 -0
  66. data/lib/mundi_api/models/get_card_response.rb +164 -0
  67. data/lib/mundi_api/models/get_card_token_response.rb +89 -0
  68. data/lib/mundi_api/models/get_charge_response.rb +184 -0
  69. data/lib/mundi_api/models/get_checkout_payment_settings_response.rb +99 -0
  70. data/lib/mundi_api/models/get_credit_card_transaction_response.rb +163 -0
  71. data/lib/mundi_api/models/get_customer_response.rb +145 -0
  72. data/lib/mundi_api/models/get_discount_response.rb +100 -0
  73. data/lib/mundi_api/models/get_invoice_item_response.rb +73 -0
  74. data/lib/mundi_api/models/get_invoice_response.rb +210 -0
  75. data/lib/mundi_api/models/get_order_item_response.rb +63 -0
  76. data/lib/mundi_api/models/get_order_response.rb +167 -0
  77. data/lib/mundi_api/models/get_period_response.rb +73 -0
  78. data/lib/mundi_api/models/get_phone_response.rb +53 -0
  79. data/lib/mundi_api/models/get_phones_response.rb +46 -0
  80. data/lib/mundi_api/models/get_plan_item_response.rb +127 -0
  81. data/lib/mundi_api/models/get_plan_response.rb +223 -0
  82. data/lib/mundi_api/models/get_price_bracket_response.rb +62 -0
  83. data/lib/mundi_api/models/get_pricing_scheme_response.rb +69 -0
  84. data/lib/mundi_api/models/get_safety_pay_transaction_response.rb +109 -0
  85. data/lib/mundi_api/models/get_seller_response.rb +126 -0
  86. data/lib/mundi_api/models/get_setup_response.rb +62 -0
  87. data/lib/mundi_api/models/get_shipping_response.rb +72 -0
  88. data/lib/mundi_api/models/get_subscription_item_response.rb +135 -0
  89. data/lib/mundi_api/models/get_subscription_response.rb +261 -0
  90. data/lib/mundi_api/models/get_token_response.rb +72 -0
  91. data/lib/mundi_api/models/get_transaction_response.rb +136 -0
  92. data/lib/mundi_api/models/get_usage_response.rb +82 -0
  93. data/lib/mundi_api/models/get_voucher_transaction_response.rb +163 -0
  94. data/lib/mundi_api/models/list_access_tokens_response.rb +51 -0
  95. data/lib/mundi_api/models/list_addresses_response.rb +51 -0
  96. data/lib/mundi_api/models/list_cards_response.rb +51 -0
  97. data/lib/mundi_api/models/list_charges_response.rb +51 -0
  98. data/lib/mundi_api/models/list_customers_response.rb +51 -0
  99. data/lib/mundi_api/models/list_invoices_response.rb +51 -0
  100. data/lib/mundi_api/models/list_order_response.rb +51 -0
  101. data/lib/mundi_api/models/list_plans_response.rb +51 -0
  102. data/lib/mundi_api/models/list_subscription_items_response.rb +51 -0
  103. data/lib/mundi_api/models/list_subscriptions_response.rb +51 -0
  104. data/lib/mundi_api/models/list_transactions_response.rb +51 -0
  105. data/lib/mundi_api/models/list_usages_response.rb +51 -0
  106. data/lib/mundi_api/models/paging_response.rb +53 -0
  107. data/lib/mundi_api/models/update_address_request.rb +53 -0
  108. data/lib/mundi_api/models/update_card_request.rb +81 -0
  109. data/lib/mundi_api/models/update_charge_card_request.rb +62 -0
  110. data/lib/mundi_api/models/update_charge_due_date_request.rb +36 -0
  111. data/lib/mundi_api/models/update_charge_payment_method_request.rb +74 -0
  112. data/lib/mundi_api/models/update_customer_request.rb +90 -0
  113. data/lib/mundi_api/models/update_metadata_request.rb +35 -0
  114. data/lib/mundi_api/models/update_plan_item_request.rb +81 -0
  115. data/lib/mundi_api/models/update_plan_request.rb +161 -0
  116. data/lib/mundi_api/models/update_price_bracket_request.rb +62 -0
  117. data/lib/mundi_api/models/update_pricing_scheme_request.rb +69 -0
  118. data/lib/mundi_api/models/update_subscription_billing_date_request.rb +37 -0
  119. data/lib/mundi_api/models/update_subscription_card_request.rb +44 -0
  120. data/lib/mundi_api/models/update_subscription_item_request.rb +81 -0
  121. data/lib/mundi_api/models/update_subscription_payment_method_request.rb +53 -0
  122. data/lib/mundi_api/mundi_api_client.rb +63 -0
  123. metadata +246 -0
@@ -0,0 +1,136 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Card data
6
+ class CreateCardRequest < BaseModel
7
+ # Credit card number
8
+ # @return [String]
9
+ attr_accessor :number
10
+
11
+ # Holder name, as written on the card
12
+ # @return [String]
13
+ attr_accessor :holder_name
14
+
15
+ # The expiration month
16
+ # @return [Integer]
17
+ attr_accessor :exp_month
18
+
19
+ # The expiration year, that can be informed with 2 or 4 digits
20
+ # @return [Integer]
21
+ attr_accessor :exp_year
22
+
23
+ # The card's security code
24
+ # @return [String]
25
+ attr_accessor :cvv
26
+
27
+ # Card's billing address
28
+ # @return [CreateAddressRequest]
29
+ attr_accessor :billing_address
30
+
31
+ # Card brand
32
+ # @return [String]
33
+ attr_accessor :brand
34
+
35
+ # The address id for the billing address
36
+ # @return [String]
37
+ attr_accessor :billing_address_id
38
+
39
+ # Metadata
40
+ # @return [Array<String, String>]
41
+ attr_accessor :metadata
42
+
43
+ # Card type
44
+ # @return [String]
45
+ attr_accessor :type
46
+
47
+ # Options for creating the card
48
+ # @return [CreateCardOptionsRequest]
49
+ attr_accessor :options
50
+
51
+ # Document number for the card's holder
52
+ # @return [String]
53
+ attr_accessor :holder_document
54
+
55
+ # A mapping from model property names to API property names.
56
+ def self.names
57
+ if @_hash.nil?
58
+ @_hash = {}
59
+ @_hash['number'] = 'number'
60
+ @_hash['holder_name'] = 'holder_name'
61
+ @_hash['exp_month'] = 'exp_month'
62
+ @_hash['exp_year'] = 'exp_year'
63
+ @_hash['cvv'] = 'cvv'
64
+ @_hash['billing_address'] = 'billing_address'
65
+ @_hash['brand'] = 'brand'
66
+ @_hash['billing_address_id'] = 'billing_address_id'
67
+ @_hash['metadata'] = 'metadata'
68
+ @_hash['type'] = 'type'
69
+ @_hash['options'] = 'options'
70
+ @_hash['holder_document'] = 'holder_document'
71
+ end
72
+ @_hash
73
+ end
74
+
75
+ def initialize(number = nil,
76
+ holder_name = nil,
77
+ exp_month = nil,
78
+ exp_year = nil,
79
+ cvv = nil,
80
+ billing_address = nil,
81
+ brand = nil,
82
+ billing_address_id = nil,
83
+ metadata = nil,
84
+ type = 'credit',
85
+ options = nil,
86
+ holder_document = nil)
87
+ @number = number
88
+ @holder_name = holder_name
89
+ @exp_month = exp_month
90
+ @exp_year = exp_year
91
+ @cvv = cvv
92
+ @billing_address = billing_address
93
+ @brand = brand
94
+ @billing_address_id = billing_address_id
95
+ @metadata = metadata
96
+ @type = type
97
+ @options = options
98
+ @holder_document = holder_document
99
+ end
100
+
101
+ # Creates an instance of the object from a hash.
102
+ def self.from_hash(hash)
103
+ return nil unless hash
104
+
105
+ # Extract variables from the hash.
106
+ number = hash['number']
107
+ holder_name = hash['holder_name']
108
+ exp_month = hash['exp_month']
109
+ exp_year = hash['exp_year']
110
+ cvv = hash['cvv']
111
+ billing_address = CreateAddressRequest.from_hash(hash['billing_address']) if
112
+ hash['billing_address']
113
+ brand = hash['brand']
114
+ billing_address_id = hash['billing_address_id']
115
+ metadata = hash['metadata']
116
+ type = hash['type'] ||= 'credit'
117
+ options = CreateCardOptionsRequest.from_hash(hash['options']) if
118
+ hash['options']
119
+ holder_document = hash['holder_document']
120
+
121
+ # Create object from extracted values.
122
+ CreateCardRequest.new(number,
123
+ holder_name,
124
+ exp_month,
125
+ exp_year,
126
+ cvv,
127
+ billing_address,
128
+ brand,
129
+ billing_address_id,
130
+ metadata,
131
+ type,
132
+ options,
133
+ holder_document)
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,80 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Card token data
6
+ class CreateCardTokenRequest < BaseModel
7
+ # Credit card number
8
+ # @return [String]
9
+ attr_accessor :number
10
+
11
+ # Holder name, as written on the card
12
+ # @return [String]
13
+ attr_accessor :holder_name
14
+
15
+ # The expiration month
16
+ # @return [Integer]
17
+ attr_accessor :exp_month
18
+
19
+ # The expiration year, that can be informed with 2 or 4 digits
20
+ # @return [Integer]
21
+ attr_accessor :exp_year
22
+
23
+ # The card's security code
24
+ # @return [String]
25
+ attr_accessor :cvv
26
+
27
+ # Card brand
28
+ # @return [String]
29
+ attr_accessor :brand
30
+
31
+ # A mapping from model property names to API property names.
32
+ def self.names
33
+ if @_hash.nil?
34
+ @_hash = {}
35
+ @_hash['number'] = 'number'
36
+ @_hash['holder_name'] = 'holder_name'
37
+ @_hash['exp_month'] = 'exp_month'
38
+ @_hash['exp_year'] = 'exp_year'
39
+ @_hash['cvv'] = 'cvv'
40
+ @_hash['brand'] = 'brand'
41
+ end
42
+ @_hash
43
+ end
44
+
45
+ def initialize(number = nil,
46
+ holder_name = nil,
47
+ exp_month = nil,
48
+ exp_year = nil,
49
+ cvv = nil,
50
+ brand = nil)
51
+ @number = number
52
+ @holder_name = holder_name
53
+ @exp_month = exp_month
54
+ @exp_year = exp_year
55
+ @cvv = cvv
56
+ @brand = brand
57
+ end
58
+
59
+ # Creates an instance of the object from a hash.
60
+ def self.from_hash(hash)
61
+ return nil unless hash
62
+
63
+ # Extract variables from the hash.
64
+ number = hash['number']
65
+ holder_name = hash['holder_name']
66
+ exp_month = hash['exp_month']
67
+ exp_year = hash['exp_year']
68
+ cvv = hash['cvv']
69
+ brand = hash['brand']
70
+
71
+ # Create object from extracted values.
72
+ CreateCardTokenRequest.new(number,
73
+ holder_name,
74
+ exp_month,
75
+ exp_year,
76
+ cvv,
77
+ brand)
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,92 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ module MundiApi
6
+ # Request for creating a new charge
7
+ class CreateChargeRequest < BaseModel
8
+ # Code
9
+ # @return [String]
10
+ attr_accessor :code
11
+
12
+ # The amount of the charge, in cents
13
+ # @return [Integer]
14
+ attr_accessor :amount
15
+
16
+ # The customer's id
17
+ # @return [String]
18
+ attr_accessor :customer_id
19
+
20
+ # Customer data
21
+ # @return [CreateCustomerRequest]
22
+ attr_accessor :customer
23
+
24
+ # Payment data
25
+ # @return [CreatePaymentRequest]
26
+ attr_accessor :payment
27
+
28
+ # Metadata
29
+ # @return [Array<String, String>]
30
+ attr_accessor :metadata
31
+
32
+ # The charge due date
33
+ # @return [DateTime]
34
+ attr_accessor :due_at
35
+
36
+ # A mapping from model property names to API property names.
37
+ def self.names
38
+ if @_hash.nil?
39
+ @_hash = {}
40
+ @_hash['code'] = 'code'
41
+ @_hash['amount'] = 'amount'
42
+ @_hash['customer_id'] = 'customer_id'
43
+ @_hash['customer'] = 'customer'
44
+ @_hash['payment'] = 'payment'
45
+ @_hash['metadata'] = 'metadata'
46
+ @_hash['due_at'] = 'due_at'
47
+ end
48
+ @_hash
49
+ end
50
+
51
+ def initialize(code = nil,
52
+ amount = nil,
53
+ customer_id = nil,
54
+ customer = nil,
55
+ payment = nil,
56
+ metadata = nil,
57
+ due_at = nil)
58
+ @code = code
59
+ @amount = amount
60
+ @customer_id = customer_id
61
+ @customer = customer
62
+ @payment = payment
63
+ @metadata = metadata
64
+ @due_at = due_at
65
+ end
66
+
67
+ # Creates an instance of the object from a hash.
68
+ def self.from_hash(hash)
69
+ return nil unless hash
70
+
71
+ # Extract variables from the hash.
72
+ code = hash['code']
73
+ amount = hash['amount']
74
+ customer_id = hash['customer_id']
75
+ customer = CreateCustomerRequest.from_hash(hash['customer']) if
76
+ hash['customer']
77
+ payment = CreatePaymentRequest.from_hash(hash['payment']) if
78
+ hash['payment']
79
+ metadata = hash['metadata']
80
+ due_at = DateTime.rfc3339(hash['due_at']) if hash['due_at']
81
+
82
+ # Create object from extracted values.
83
+ CreateChargeRequest.new(code,
84
+ amount,
85
+ customer_id,
86
+ customer,
87
+ payment,
88
+ metadata,
89
+ due_at)
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,54 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ module MundiApi
6
+ # CreateCheckoutBoletoPaymentRequest Model.
7
+ class CreateCheckoutBoletoPaymentRequest < BaseModel
8
+ # Bank identifier
9
+ # @return [String]
10
+ attr_accessor :bank
11
+
12
+ # Instructions
13
+ # @return [String]
14
+ attr_accessor :instructions
15
+
16
+ # Due date
17
+ # @return [DateTime]
18
+ attr_accessor :due_at
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ if @_hash.nil?
23
+ @_hash = {}
24
+ @_hash['bank'] = 'bank'
25
+ @_hash['instructions'] = 'instructions'
26
+ @_hash['due_at'] = 'due_at'
27
+ end
28
+ @_hash
29
+ end
30
+
31
+ def initialize(bank = nil,
32
+ instructions = nil,
33
+ due_at = nil)
34
+ @bank = bank
35
+ @instructions = instructions
36
+ @due_at = due_at
37
+ end
38
+
39
+ # Creates an instance of the object from a hash.
40
+ def self.from_hash(hash)
41
+ return nil unless hash
42
+
43
+ # Extract variables from the hash.
44
+ bank = hash['bank']
45
+ instructions = hash['instructions']
46
+ due_at = DateTime.rfc3339(hash['due_at']) if hash['due_at']
47
+
48
+ # Create object from extracted values.
49
+ CreateCheckoutBoletoPaymentRequest.new(bank,
50
+ instructions,
51
+ due_at)
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,44 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Options for card installment
6
+ class CreateCheckoutCardInstallmentOptionRequest < BaseModel
7
+ # Installment quantity
8
+ # @return [Integer]
9
+ attr_accessor :number
10
+
11
+ # Total amount
12
+ # @return [Integer]
13
+ attr_accessor :total
14
+
15
+ # A mapping from model property names to API property names.
16
+ def self.names
17
+ if @_hash.nil?
18
+ @_hash = {}
19
+ @_hash['number'] = 'number'
20
+ @_hash['total'] = 'total'
21
+ end
22
+ @_hash
23
+ end
24
+
25
+ def initialize(number = nil,
26
+ total = nil)
27
+ @number = number
28
+ @total = total
29
+ end
30
+
31
+ # Creates an instance of the object from a hash.
32
+ def self.from_hash(hash)
33
+ return nil unless hash
34
+
35
+ # Extract variables from the hash.
36
+ number = hash['number']
37
+ total = hash['total']
38
+
39
+ # Create object from extracted values.
40
+ CreateCheckoutCardInstallmentOptionRequest.new(number,
41
+ total)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,51 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Checkout card payment request
6
+ class CreateCheckoutCardPaymentRequest < BaseModel
7
+ # Card invoice text descriptor
8
+ # @return [String]
9
+ attr_accessor :statement_descriptor
10
+
11
+ # Payment installment options
12
+ # @return [List of CreateCheckoutCardInstallmentOptionRequest]
13
+ attr_accessor :installments
14
+
15
+ # A mapping from model property names to API property names.
16
+ def self.names
17
+ if @_hash.nil?
18
+ @_hash = {}
19
+ @_hash['statement_descriptor'] = 'statement_descriptor'
20
+ @_hash['installments'] = 'installments'
21
+ end
22
+ @_hash
23
+ end
24
+
25
+ def initialize(statement_descriptor = nil,
26
+ installments = nil)
27
+ @statement_descriptor = statement_descriptor
28
+ @installments = installments
29
+ end
30
+
31
+ # Creates an instance of the object from a hash.
32
+ def self.from_hash(hash)
33
+ return nil unless hash
34
+
35
+ # Extract variables from the hash.
36
+ statement_descriptor = hash['statement_descriptor']
37
+ # Parameter is an array, so we need to iterate through it
38
+ installments = nil
39
+ unless hash['installments'].nil?
40
+ installments = []
41
+ hash['installments'].each do |structure|
42
+ installments << (CreateCheckoutCardInstallmentOptionRequest.from_hash(structure) if structure)
43
+ end
44
+ end
45
+
46
+ # Create object from extracted values.
47
+ CreateCheckoutCardPaymentRequest.new(statement_descriptor,
48
+ installments)
49
+ end
50
+ end
51
+ end