bk-apimatic-sdk 1.0.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 (140) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +203 -0
  4. data/bin/console +15 -0
  5. data/lib/boku_direct_payments_api/api_helper.rb +10 -0
  6. data/lib/boku_direct_payments_api/client.rb +99 -0
  7. data/lib/boku_direct_payments_api/configuration.rb +168 -0
  8. data/lib/boku_direct_payments_api/controllers/account_resources_controller.rb +45 -0
  9. data/lib/boku_direct_payments_api/controllers/base_controller.rb +60 -0
  10. data/lib/boku_direct_payments_api/controllers/charge_controller.rb +247 -0
  11. data/lib/boku_direct_payments_api/controllers/config_resources_controller.rb +50 -0
  12. data/lib/boku_direct_payments_api/controllers/consumer_registration_controller.rb +428 -0
  13. data/lib/boku_direct_payments_api/controllers/forex_controller.rb +38 -0
  14. data/lib/boku_direct_payments_api/controllers/fund_check_controller.rb +39 -0
  15. data/lib/boku_direct_payments_api/controllers/refund_controller.rb +80 -0
  16. data/lib/boku_direct_payments_api/controllers/seller_of_record_controller.rb +69 -0
  17. data/lib/boku_direct_payments_api/exceptions/api_exception.rb +21 -0
  18. data/lib/boku_direct_payments_api/http/http_call_back.rb +10 -0
  19. data/lib/boku_direct_payments_api/http/http_method_enum.rb +10 -0
  20. data/lib/boku_direct_payments_api/http/http_request.rb +10 -0
  21. data/lib/boku_direct_payments_api/http/http_response.rb +10 -0
  22. data/lib/boku_direct_payments_api/http/proxy_settings.rb +22 -0
  23. data/lib/boku_direct_payments_api/models/account_profile.rb +122 -0
  24. data/lib/boku_direct_payments_api/models/account_profile_attribute.rb +90 -0
  25. data/lib/boku_direct_payments_api/models/account_profile_request.rb +131 -0
  26. data/lib/boku_direct_payments_api/models/account_profile_response.rb +104 -0
  27. data/lib/boku_direct_payments_api/models/account_profile_response_record.rb +142 -0
  28. data/lib/boku_direct_payments_api/models/account_profile_result_status_enum.rb +47 -0
  29. data/lib/boku_direct_payments_api/models/account_profile_selector.rb +132 -0
  30. data/lib/boku_direct_payments_api/models/base_model.rb +110 -0
  31. data/lib/boku_direct_payments_api/models/begin_single_charge_request.rb +360 -0
  32. data/lib/boku_direct_payments_api/models/begin_single_charge_request_hosted.rb +110 -0
  33. data/lib/boku_direct_payments_api/models/begin_single_charge_request_qr_info.rb +74 -0
  34. data/lib/boku_direct_payments_api/models/begin_single_charge_response.rb +254 -0
  35. data/lib/boku_direct_payments_api/models/begin_single_charge_response_hosted.rb +90 -0
  36. data/lib/boku_direct_payments_api/models/begin_single_charge_response_qr_info.rb +85 -0
  37. data/lib/boku_direct_payments_api/models/business_details.rb +209 -0
  38. data/lib/boku_direct_payments_api/models/cancel_optin_request.rb +123 -0
  39. data/lib/boku_direct_payments_api/models/cancel_optin_response.rb +143 -0
  40. data/lib/boku_direct_payments_api/models/carrier_gw.rb +82 -0
  41. data/lib/boku_direct_payments_api/models/charge.rb +288 -0
  42. data/lib/boku_direct_payments_api/models/charge_msisdn_request.rb +233 -0
  43. data/lib/boku_direct_payments_api/models/charge_plus_optin_request.rb +390 -0
  44. data/lib/boku_direct_payments_api/models/charge_plus_optin_request_hosted.rb +96 -0
  45. data/lib/boku_direct_payments_api/models/charge_plus_optin_response.rb +278 -0
  46. data/lib/boku_direct_payments_api/models/charge_plus_optin_response_hosted.rb +75 -0
  47. data/lib/boku_direct_payments_api/models/charge_request.rb +332 -0
  48. data/lib/boku_direct_payments_api/models/charge_response.rb +253 -0
  49. data/lib/boku_direct_payments_api/models/charge_status_enum.rb +43 -0
  50. data/lib/boku_direct_payments_api/models/check_eligibility_request.rb +117 -0
  51. data/lib/boku_direct_payments_api/models/check_eligibility_response.rb +116 -0
  52. data/lib/boku_direct_payments_api/models/client_call.rb +91 -0
  53. data/lib/boku_direct_payments_api/models/confirm_optin_request.rb +141 -0
  54. data/lib/boku_direct_payments_api/models/confirm_optin_response.rb +211 -0
  55. data/lib/boku_direct_payments_api/models/confirm_verify_device_request.rb +161 -0
  56. data/lib/boku_direct_payments_api/models/confirm_verify_device_response.rb +137 -0
  57. data/lib/boku_direct_payments_api/models/eligibility_status_enum.rb +40 -0
  58. data/lib/boku_direct_payments_api/models/forex_request.rb +97 -0
  59. data/lib/boku_direct_payments_api/models/forex_response.rb +127 -0
  60. data/lib/boku_direct_payments_api/models/fund_check_request.rb +132 -0
  61. data/lib/boku_direct_payments_api/models/fund_check_response.rb +89 -0
  62. data/lib/boku_direct_payments_api/models/invalid_request_field.rb +93 -0
  63. data/lib/boku_direct_payments_api/models/mandate_constraint.rb +92 -0
  64. data/lib/boku_direct_payments_api/models/mandate_period_enum.rb +48 -0
  65. data/lib/boku_direct_payments_api/models/mcc_mnc_mapping.rb +85 -0
  66. data/lib/boku_direct_payments_api/models/method_enum.rb +36 -0
  67. data/lib/boku_direct_payments_api/models/msisdn_network_request.rb +97 -0
  68. data/lib/boku_direct_payments_api/models/msisdn_network_response.rb +116 -0
  69. data/lib/boku_direct_payments_api/models/network_info.rb +84 -0
  70. data/lib/boku_direct_payments_api/models/network_info_network.rb +168 -0
  71. data/lib/boku_direct_payments_api/models/optin_accept_networks.rb +87 -0
  72. data/lib/boku_direct_payments_api/models/optin_info.rb +99 -0
  73. data/lib/boku_direct_payments_api/models/optin_info_optin_network.rb +104 -0
  74. data/lib/boku_direct_payments_api/models/optin_info_optin_types.rb +128 -0
  75. data/lib/boku_direct_payments_api/models/optin_network.rb +115 -0
  76. data/lib/boku_direct_payments_api/models/optin_purpose_enum.rb +62 -0
  77. data/lib/boku_direct_payments_api/models/optin_request.rb +338 -0
  78. data/lib/boku_direct_payments_api/models/optin_request_hosted.rb +110 -0
  79. data/lib/boku_direct_payments_api/models/optin_request_qr_info.rb +75 -0
  80. data/lib/boku_direct_payments_api/models/optin_response.rb +220 -0
  81. data/lib/boku_direct_payments_api/models/optin_response_hosted.rb +87 -0
  82. data/lib/boku_direct_payments_api/models/optin_response_qr_info.rb +85 -0
  83. data/lib/boku_direct_payments_api/models/optin_state.rb +164 -0
  84. data/lib/boku_direct_payments_api/models/optin_status_enum.rb +51 -0
  85. data/lib/boku_direct_payments_api/models/optin_terms.rb +214 -0
  86. data/lib/boku_direct_payments_api/models/optin_type_enum.rb +45 -0
  87. data/lib/boku_direct_payments_api/models/payment_method_status_enum.rb +44 -0
  88. data/lib/boku_direct_payments_api/models/period.rb +89 -0
  89. data/lib/boku_direct_payments_api/models/period_unit_enum.rb +46 -0
  90. data/lib/boku_direct_payments_api/models/query_charge_request.rb +149 -0
  91. data/lib/boku_direct_payments_api/models/query_charge_response.rb +101 -0
  92. data/lib/boku_direct_payments_api/models/query_optin_request.rb +104 -0
  93. data/lib/boku_direct_payments_api/models/query_optin_response.rb +129 -0
  94. data/lib/boku_direct_payments_api/models/query_refund_request.rb +122 -0
  95. data/lib/boku_direct_payments_api/models/query_refund_response.rb +101 -0
  96. data/lib/boku_direct_payments_api/models/refund.rb +249 -0
  97. data/lib/boku_direct_payments_api/models/refund_charge_notification.rb +88 -0
  98. data/lib/boku_direct_payments_api/models/refund_charge_request.rb +231 -0
  99. data/lib/boku_direct_payments_api/models/refund_charge_response.rb +203 -0
  100. data/lib/boku_direct_payments_api/models/refund_status_enum.rb +43 -0
  101. data/lib/boku_direct_payments_api/models/refund_type_enum.rb +36 -0
  102. data/lib/boku_direct_payments_api/models/register_payment_method_request.rb +152 -0
  103. data/lib/boku_direct_payments_api/models/register_payment_method_response.rb +172 -0
  104. data/lib/boku_direct_payments_api/models/register_seller_of_record_request.rb +118 -0
  105. data/lib/boku_direct_payments_api/models/register_seller_of_record_response.rb +156 -0
  106. data/lib/boku_direct_payments_api/models/resend_otp_request.rb +167 -0
  107. data/lib/boku_direct_payments_api/models/resend_otp_response.rb +118 -0
  108. data/lib/boku_direct_payments_api/models/result.rb +154 -0
  109. data/lib/boku_direct_payments_api/models/result_status_enum.rb +36 -0
  110. data/lib/boku_direct_payments_api/models/reversal.rb +89 -0
  111. data/lib/boku_direct_payments_api/models/reverse_charge_request.rb +104 -0
  112. data/lib/boku_direct_payments_api/models/reverse_charge_response.rb +157 -0
  113. data/lib/boku_direct_payments_api/models/seller_of_record.rb +76 -0
  114. data/lib/boku_direct_payments_api/models/seller_of_record_status_enum.rb +44 -0
  115. data/lib/boku_direct_payments_api/models/send_sms.rb +89 -0
  116. data/lib/boku_direct_payments_api/models/settlement.rb +126 -0
  117. data/lib/boku_direct_payments_api/models/silent_mo.rb +78 -0
  118. data/lib/boku_direct_payments_api/models/status_enum.rb +40 -0
  119. data/lib/boku_direct_payments_api/models/subscription.rb +105 -0
  120. data/lib/boku_direct_payments_api/models/timeout.rb +75 -0
  121. data/lib/boku_direct_payments_api/models/type_enum.rb +36 -0
  122. data/lib/boku_direct_payments_api/models/validate_optin_request.rb +179 -0
  123. data/lib/boku_direct_payments_api/models/validate_optin_response.rb +195 -0
  124. data/lib/boku_direct_payments_api/models/verify_device_request.rb +135 -0
  125. data/lib/boku_direct_payments_api/models/verify_device_response.rb +137 -0
  126. data/lib/boku_direct_payments_api/utilities/date_time_helper.rb +11 -0
  127. data/lib/boku_direct_payments_api/utilities/file_wrapper.rb +28 -0
  128. data/lib/boku_direct_payments_api/utilities/xml_utilities.rb +12 -0
  129. data/lib/boku_direct_payments_api.rb +166 -0
  130. data/test/controllers/controller_test_base.rb +23 -0
  131. data/test/controllers/test_account_resources_controller.rb +44 -0
  132. data/test/controllers/test_charge_controller.rb +159 -0
  133. data/test/controllers/test_config_resources_controller.rb +47 -0
  134. data/test/controllers/test_consumer_registration_controller.rb +262 -0
  135. data/test/controllers/test_forex_controller.rb +40 -0
  136. data/test/controllers/test_fund_check_controller.rb +41 -0
  137. data/test/controllers/test_refund_controller.rb +76 -0
  138. data/test/controllers/test_seller_of_record_controller.rb +72 -0
  139. data/test/http_response_catcher.rb +19 -0
  140. metadata +255 -0
@@ -0,0 +1,288 @@
1
+ # boku_direct_payments_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module BokuDirectPaymentsApi
7
+ # Charge Model.
8
+ class Charge < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Boku-generated unique ID for the charge.
13
+ # @return [String]
14
+ attr_accessor :charge_id
15
+
16
+ # Status of the charge at the time this response was returned.
17
+ # If 'in-progress' is returned, the charge call should be re-issued with the
18
+ # same request ID until a final status is reached.
19
+ # If null, no charge was created (e.g., because the request was rejected).
20
+ # @return [ChargeStatusEnum]
21
+ attr_accessor :charge_status
22
+
23
+ # ISO 3166-1 alpha-2 country code.
24
+ # @return [String]
25
+ attr_accessor :country
26
+
27
+ # ISO 4217 three-letter currency code.
28
+ # @return [String]
29
+ attr_accessor :currency
30
+
31
+ # Boku-assigned merchant ID.
32
+ # @return [String]
33
+ attr_accessor :merchant_id
34
+
35
+ # A short purchase description that appears on the consumer bill.
36
+ # @return [String]
37
+ attr_accessor :merchant_item_description
38
+
39
+ # Merchant-assigned transaction ID.
40
+ # _***Boku recommends merchants send this ID for future reference**_
41
+ # @return [String]
42
+ attr_accessor :merchant_transaction_id
43
+
44
+ # Issuer's Network ID.
45
+ # @return [String]
46
+ attr_accessor :network_id
47
+
48
+ # The 'result' element is defined in every response type. It is used to
49
+ # convey the outcome of an API request.
50
+ # @return [Result]
51
+ attr_accessor :result
52
+
53
+ # Time original charge request was received ("YYYY-MM-DD hh:mm:ss").
54
+ # All timestamps are in UTC.
55
+ # @return [String]
56
+ attr_accessor :timestamp
57
+
58
+ # Total amount charged or attempted to charge, including tax.
59
+ # @return [Float]
60
+ attr_accessor :total_amount
61
+
62
+ # **DISCLAIMER: This API or element is use-case specific and not needed for
63
+ # generic usage of our payment product. Please disregard unless otherwise
64
+ # directed to include in your integration.**
65
+ # Issuer Transaction Reference
66
+ # @return [String]
67
+ attr_accessor :issuer_transaction_reference
68
+
69
+ # **DISCLAIMER: This API or element is use-case specific and not needed for
70
+ # generic usage of our payment product. Please disregard unless otherwise
71
+ # directed to include in your integration.**
72
+ # Unique user ID provided by the payment provider. This value could be an
73
+ # ID that is not recognizable to the user.
74
+ # @return [String]
75
+ attr_accessor :issuer_unique_user_id
76
+
77
+ # Merchant-supplied metadata
78
+ # @return [String]
79
+ attr_accessor :merchant_data
80
+
81
+ # Contains information about the reversal status of this transaction.
82
+ # If present, charge may be considered reversed. If not present, no reversal
83
+ # request has been received.
84
+ # @return [Reversal]
85
+ attr_accessor :reversal
86
+
87
+ # A mapping from model property names to API property names.
88
+ def self.names
89
+ @_hash = {} if @_hash.nil?
90
+ @_hash['charge_id'] = 'charge-id'
91
+ @_hash['charge_status'] = 'charge-status'
92
+ @_hash['country'] = 'country'
93
+ @_hash['currency'] = 'currency'
94
+ @_hash['merchant_id'] = 'merchant-id'
95
+ @_hash['merchant_item_description'] = 'merchant-item-description'
96
+ @_hash['merchant_transaction_id'] = 'merchant-transaction-id'
97
+ @_hash['network_id'] = 'network-id'
98
+ @_hash['result'] = 'result'
99
+ @_hash['timestamp'] = 'timestamp'
100
+ @_hash['total_amount'] = 'total-amount'
101
+ @_hash['issuer_transaction_reference'] = 'issuer-transaction-reference'
102
+ @_hash['issuer_unique_user_id'] = 'issuer-unique-user-id'
103
+ @_hash['merchant_data'] = 'merchant-data'
104
+ @_hash['reversal'] = 'reversal'
105
+ @_hash
106
+ end
107
+
108
+ # An array for optional fields
109
+ def self.optionals
110
+ %w[
111
+ issuer_transaction_reference
112
+ issuer_unique_user_id
113
+ merchant_data
114
+ reversal
115
+ ]
116
+ end
117
+
118
+ # An array for nullable fields
119
+ def self.nullables
120
+ []
121
+ end
122
+
123
+ def initialize(charge_id = nil, charge_status = nil, country = nil,
124
+ currency = nil, merchant_id = nil,
125
+ merchant_item_description = nil,
126
+ merchant_transaction_id = nil, network_id = nil,
127
+ result = nil, timestamp = nil, total_amount = nil,
128
+ issuer_transaction_reference = SKIP,
129
+ issuer_unique_user_id = SKIP, merchant_data = SKIP,
130
+ reversal = SKIP)
131
+ @charge_id = charge_id
132
+ @charge_status = charge_status
133
+ @country = country
134
+ @currency = currency
135
+ @merchant_id = merchant_id
136
+ @merchant_item_description = merchant_item_description
137
+ @merchant_transaction_id = merchant_transaction_id
138
+ @network_id = network_id
139
+ @result = result
140
+ @timestamp = timestamp
141
+ @total_amount = total_amount
142
+ unless issuer_transaction_reference == SKIP
143
+ @issuer_transaction_reference =
144
+ issuer_transaction_reference
145
+ end
146
+ @issuer_unique_user_id = issuer_unique_user_id unless issuer_unique_user_id == SKIP
147
+ @merchant_data = merchant_data unless merchant_data == SKIP
148
+ @reversal = reversal unless reversal == SKIP
149
+ end
150
+
151
+ # Creates an instance of the object from a hash.
152
+ def self.from_hash(hash)
153
+ return nil unless hash
154
+
155
+ # Extract variables from the hash.
156
+ charge_id = hash.key?('charge-id') ? hash['charge-id'] : nil
157
+ charge_status = hash.key?('charge-status') ? hash['charge-status'] : nil
158
+ country = hash.key?('country') ? hash['country'] : nil
159
+ currency = hash.key?('currency') ? hash['currency'] : nil
160
+ merchant_id = hash.key?('merchant-id') ? hash['merchant-id'] : nil
161
+ merchant_item_description =
162
+ hash.key?('merchant-item-description') ? hash['merchant-item-description'] : nil
163
+ merchant_transaction_id =
164
+ hash.key?('merchant-transaction-id') ? hash['merchant-transaction-id'] : nil
165
+ network_id = hash.key?('network-id') ? hash['network-id'] : nil
166
+ result = Result.from_hash(hash['result']) if hash['result']
167
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : nil
168
+ total_amount = hash.key?('total-amount') ? hash['total-amount'] : nil
169
+ issuer_transaction_reference =
170
+ hash.key?('issuer-transaction-reference') ? hash['issuer-transaction-reference'] : SKIP
171
+ issuer_unique_user_id =
172
+ hash.key?('issuer-unique-user-id') ? hash['issuer-unique-user-id'] : SKIP
173
+ merchant_data = hash.key?('merchant-data') ? hash['merchant-data'] : SKIP
174
+ reversal = Reversal.from_hash(hash['reversal']) if hash['reversal']
175
+
176
+ # Create object from extracted values.
177
+ Charge.new(charge_id,
178
+ charge_status,
179
+ country,
180
+ currency,
181
+ merchant_id,
182
+ merchant_item_description,
183
+ merchant_transaction_id,
184
+ network_id,
185
+ result,
186
+ timestamp,
187
+ total_amount,
188
+ issuer_transaction_reference,
189
+ issuer_unique_user_id,
190
+ merchant_data,
191
+ reversal)
192
+ end
193
+
194
+ def self.from_element(root)
195
+ charge_id = XmlUtilities.from_element(root, 'charge-id', String)
196
+ charge_status = XmlUtilities.from_element(root, 'charge-status', String)
197
+ country = XmlUtilities.from_element(root, 'country', String)
198
+ currency = XmlUtilities.from_element(root, 'currency', String)
199
+ merchant_id = XmlUtilities.from_element(root, 'merchant-id', String)
200
+ merchant_item_description = XmlUtilities.from_element(
201
+ root, 'merchant-item-description', String
202
+ )
203
+ merchant_transaction_id = XmlUtilities.from_element(
204
+ root, 'merchant-transaction-id', String
205
+ )
206
+ network_id = XmlUtilities.from_element(root, 'network-id', String)
207
+ result = XmlUtilities.from_element(root, 'result', Result)
208
+ timestamp = XmlUtilities.from_element(root, 'timestamp', String)
209
+ total_amount = XmlUtilities.from_element(root, 'total-amount', Float)
210
+ issuer_transaction_reference = XmlUtilities.from_element(
211
+ root, 'issuer-transaction-reference', String
212
+ )
213
+ issuer_unique_user_id = XmlUtilities.from_element(root,
214
+ 'issuer-unique-user-id',
215
+ String)
216
+ merchant_data = XmlUtilities.from_element(root, 'merchant-data', String)
217
+ reversal = XmlUtilities.from_element(root, 'reversal', Reversal)
218
+
219
+ new(charge_id,
220
+ charge_status,
221
+ country,
222
+ currency,
223
+ merchant_id,
224
+ merchant_item_description,
225
+ merchant_transaction_id,
226
+ network_id,
227
+ result,
228
+ timestamp,
229
+ total_amount,
230
+ issuer_transaction_reference,
231
+ issuer_unique_user_id,
232
+ merchant_data,
233
+ reversal)
234
+ end
235
+
236
+ def to_xml_element(doc, root_name)
237
+ root = doc.create_element(root_name)
238
+
239
+ XmlUtilities.add_as_subelement(doc, root, 'charge-id', charge_id)
240
+ XmlUtilities.add_as_subelement(doc, root, 'charge-status', charge_status)
241
+ XmlUtilities.add_as_subelement(doc, root, 'country', country)
242
+ XmlUtilities.add_as_subelement(doc, root, 'currency', currency)
243
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-id', merchant_id)
244
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-item-description',
245
+ merchant_item_description)
246
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-transaction-id',
247
+ merchant_transaction_id)
248
+ XmlUtilities.add_as_subelement(doc, root, 'network-id', network_id)
249
+ XmlUtilities.add_as_subelement(doc, root, 'result', result)
250
+ XmlUtilities.add_as_subelement(doc, root, 'timestamp', timestamp)
251
+ XmlUtilities.add_as_subelement(doc, root, 'total-amount', total_amount)
252
+ XmlUtilities.add_as_subelement(doc, root, 'issuer-transaction-reference',
253
+ issuer_transaction_reference)
254
+ XmlUtilities.add_as_subelement(doc, root, 'issuer-unique-user-id',
255
+ issuer_unique_user_id)
256
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-data', merchant_data)
257
+ XmlUtilities.add_as_subelement(doc, root, 'reversal', reversal)
258
+
259
+ root
260
+ end
261
+
262
+ # Provides a human-readable string representation of the object.
263
+ def to_s
264
+ class_name = self.class.name.split('::').last
265
+ "<#{class_name} charge_id: #{@charge_id}, charge_status: #{@charge_status}, country:"\
266
+ " #{@country}, currency: #{@currency}, merchant_id: #{@merchant_id},"\
267
+ " merchant_item_description: #{@merchant_item_description}, merchant_transaction_id:"\
268
+ " #{@merchant_transaction_id}, network_id: #{@network_id}, result: #{@result}, timestamp:"\
269
+ " #{@timestamp}, total_amount: #{@total_amount}, issuer_transaction_reference:"\
270
+ " #{@issuer_transaction_reference}, issuer_unique_user_id: #{@issuer_unique_user_id},"\
271
+ " merchant_data: #{@merchant_data}, reversal: #{@reversal}>"
272
+ end
273
+
274
+ # Provides a debugging-friendly string with detailed object information.
275
+ def inspect
276
+ class_name = self.class.name.split('::').last
277
+ "<#{class_name} charge_id: #{@charge_id.inspect}, charge_status: #{@charge_status.inspect},"\
278
+ " country: #{@country.inspect}, currency: #{@currency.inspect}, merchant_id:"\
279
+ " #{@merchant_id.inspect}, merchant_item_description: #{@merchant_item_description.inspect},"\
280
+ " merchant_transaction_id: #{@merchant_transaction_id.inspect}, network_id:"\
281
+ " #{@network_id.inspect}, result: #{@result.inspect}, timestamp: #{@timestamp.inspect},"\
282
+ " total_amount: #{@total_amount.inspect}, issuer_transaction_reference:"\
283
+ " #{@issuer_transaction_reference.inspect}, issuer_unique_user_id:"\
284
+ " #{@issuer_unique_user_id.inspect}, merchant_data: #{@merchant_data.inspect}, reversal:"\
285
+ " #{@reversal.inspect}>"
286
+ end
287
+ end
288
+ end
@@ -0,0 +1,233 @@
1
+ # boku_direct_payments_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module BokuDirectPaymentsApi
7
+ # ChargeMsisdnRequest Model.
8
+ class ChargeMsisdnRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # ISO 3166-1 alpha-2 country code.
13
+ # @return [String]
14
+ attr_accessor :country
15
+
16
+ # ISO 4217 three-letter currency code.
17
+ # @return [String]
18
+ attr_accessor :currency
19
+
20
+ # Boku-assigned merchant ID.
21
+ # @return [String]
22
+ attr_accessor :merchant_id
23
+
24
+ # A short purchase description that appears on the consumer bill. A string
25
+ # longer than 20 characters will be truncated.
26
+ # @return [String]
27
+ attr_accessor :merchant_item_description
28
+
29
+ # Merchant-assigned unique request ID.
30
+ # @return [String]
31
+ attr_accessor :merchant_request_id
32
+
33
+ # Merchant-assigned transaction ID.
34
+ # _***Boku recommends merchants send this ID for future reference**_
35
+ # @return [String]
36
+ attr_accessor :merchant_transaction_id
37
+
38
+ # Consumer's mobile phone number.
39
+ # @return [String]
40
+ attr_accessor :msisdn
41
+
42
+ # Alphanumeric code for the Carrier's Network ID. Any alphabetical
43
+ # characters must be in lower case (i.e. a-z)
44
+ # @return [String]
45
+ attr_accessor :network
46
+
47
+ # Total amount to charge, including tax.
48
+ # @return [Float]
49
+ attr_accessor :total_amount
50
+
51
+ # Merchant-supplied metadata. This metadata is returned in the 'charge'
52
+ # response and can be available in merchant reports.
53
+ # @return [String]
54
+ attr_accessor :merchant_data
55
+
56
+ # Merchant-supplied metadata. This metadata is returned in the 'charge'
57
+ # response and can be available in merchant reports.
58
+ # @return [String]
59
+ attr_accessor :notification_url
60
+
61
+ # Specifies how long to block waiting for a response
62
+ # @return [Timeout]
63
+ attr_accessor :timeout
64
+
65
+ # A mapping from model property names to API property names.
66
+ def self.names
67
+ @_hash = {} if @_hash.nil?
68
+ @_hash['country'] = 'country'
69
+ @_hash['currency'] = 'currency'
70
+ @_hash['merchant_id'] = 'merchant-id'
71
+ @_hash['merchant_item_description'] = 'merchant-item-description'
72
+ @_hash['merchant_request_id'] = 'merchant-request-id'
73
+ @_hash['merchant_transaction_id'] = 'merchant-transaction-id'
74
+ @_hash['msisdn'] = 'msisdn'
75
+ @_hash['network'] = 'network'
76
+ @_hash['total_amount'] = 'total-amount'
77
+ @_hash['merchant_data'] = 'merchant-data'
78
+ @_hash['notification_url'] = 'notification-url'
79
+ @_hash['timeout'] = 'timeout'
80
+ @_hash
81
+ end
82
+
83
+ # An array for optional fields
84
+ def self.optionals
85
+ %w[
86
+ merchant_data
87
+ notification_url
88
+ timeout
89
+ ]
90
+ end
91
+
92
+ # An array for nullable fields
93
+ def self.nullables
94
+ []
95
+ end
96
+
97
+ def initialize(country = nil, currency = nil, merchant_id = nil,
98
+ merchant_item_description = nil, merchant_request_id = nil,
99
+ merchant_transaction_id = nil, msisdn = nil, network = nil,
100
+ total_amount = nil, merchant_data = SKIP,
101
+ notification_url = SKIP, timeout = SKIP)
102
+ @country = country
103
+ @currency = currency
104
+ @merchant_id = merchant_id
105
+ @merchant_item_description = merchant_item_description
106
+ @merchant_request_id = merchant_request_id
107
+ @merchant_transaction_id = merchant_transaction_id
108
+ @msisdn = msisdn
109
+ @network = network
110
+ @total_amount = total_amount
111
+ @merchant_data = merchant_data unless merchant_data == SKIP
112
+ @notification_url = notification_url unless notification_url == SKIP
113
+ @timeout = timeout unless timeout == SKIP
114
+ end
115
+
116
+ # Creates an instance of the object from a hash.
117
+ def self.from_hash(hash)
118
+ return nil unless hash
119
+
120
+ # Extract variables from the hash.
121
+ country = hash.key?('country') ? hash['country'] : nil
122
+ currency = hash.key?('currency') ? hash['currency'] : nil
123
+ merchant_id = hash.key?('merchant-id') ? hash['merchant-id'] : nil
124
+ merchant_item_description =
125
+ hash.key?('merchant-item-description') ? hash['merchant-item-description'] : nil
126
+ merchant_request_id =
127
+ hash.key?('merchant-request-id') ? hash['merchant-request-id'] : nil
128
+ merchant_transaction_id =
129
+ hash.key?('merchant-transaction-id') ? hash['merchant-transaction-id'] : nil
130
+ msisdn = hash.key?('msisdn') ? hash['msisdn'] : nil
131
+ network = hash.key?('network') ? hash['network'] : nil
132
+ total_amount = hash.key?('total-amount') ? hash['total-amount'] : nil
133
+ merchant_data = hash.key?('merchant-data') ? hash['merchant-data'] : SKIP
134
+ notification_url =
135
+ hash.key?('notification-url') ? hash['notification-url'] : SKIP
136
+ timeout = Timeout.from_hash(hash['timeout']) if hash['timeout']
137
+
138
+ # Create object from extracted values.
139
+ ChargeMsisdnRequest.new(country,
140
+ currency,
141
+ merchant_id,
142
+ merchant_item_description,
143
+ merchant_request_id,
144
+ merchant_transaction_id,
145
+ msisdn,
146
+ network,
147
+ total_amount,
148
+ merchant_data,
149
+ notification_url,
150
+ timeout)
151
+ end
152
+
153
+ def self.from_element(root)
154
+ country = XmlUtilities.from_element(root, 'country', String)
155
+ currency = XmlUtilities.from_element(root, 'currency', String)
156
+ merchant_id = XmlUtilities.from_element(root, 'merchant-id', String)
157
+ merchant_item_description = XmlUtilities.from_element(
158
+ root, 'merchant-item-description', String
159
+ )
160
+ merchant_request_id = XmlUtilities.from_element(root,
161
+ 'merchant-request-id',
162
+ String)
163
+ merchant_transaction_id = XmlUtilities.from_element(
164
+ root, 'merchant-transaction-id', String
165
+ )
166
+ msisdn = XmlUtilities.from_element(root, 'msisdn', String)
167
+ network = XmlUtilities.from_element(root, 'network', String)
168
+ total_amount = XmlUtilities.from_element(root, 'total-amount', Float)
169
+ merchant_data = XmlUtilities.from_element(root, 'merchant-data', String)
170
+ notification_url = XmlUtilities.from_element(root, 'notification-url',
171
+ String)
172
+ timeout = XmlUtilities.from_element(root, 'timeout', Timeout)
173
+
174
+ new(country,
175
+ currency,
176
+ merchant_id,
177
+ merchant_item_description,
178
+ merchant_request_id,
179
+ merchant_transaction_id,
180
+ msisdn,
181
+ network,
182
+ total_amount,
183
+ merchant_data,
184
+ notification_url,
185
+ timeout)
186
+ end
187
+
188
+ def to_xml_element(doc, root_name)
189
+ root = doc.create_element(root_name)
190
+
191
+ XmlUtilities.add_as_subelement(doc, root, 'country', country)
192
+ XmlUtilities.add_as_subelement(doc, root, 'currency', currency)
193
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-id', merchant_id)
194
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-item-description',
195
+ merchant_item_description)
196
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-request-id',
197
+ merchant_request_id)
198
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-transaction-id',
199
+ merchant_transaction_id)
200
+ XmlUtilities.add_as_subelement(doc, root, 'msisdn', msisdn)
201
+ XmlUtilities.add_as_subelement(doc, root, 'network', network)
202
+ XmlUtilities.add_as_subelement(doc, root, 'total-amount', total_amount)
203
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-data', merchant_data)
204
+ XmlUtilities.add_as_subelement(doc, root, 'notification-url',
205
+ notification_url)
206
+ XmlUtilities.add_as_subelement(doc, root, 'timeout', timeout)
207
+
208
+ root
209
+ end
210
+
211
+ # Provides a human-readable string representation of the object.
212
+ def to_s
213
+ class_name = self.class.name.split('::').last
214
+ "<#{class_name} country: #{@country}, currency: #{@currency}, merchant_id: #{@merchant_id},"\
215
+ " merchant_item_description: #{@merchant_item_description}, merchant_request_id:"\
216
+ " #{@merchant_request_id}, merchant_transaction_id: #{@merchant_transaction_id}, msisdn:"\
217
+ " #{@msisdn}, network: #{@network}, total_amount: #{@total_amount}, merchant_data:"\
218
+ " #{@merchant_data}, notification_url: #{@notification_url}, timeout: #{@timeout}>"
219
+ end
220
+
221
+ # Provides a debugging-friendly string with detailed object information.
222
+ def inspect
223
+ class_name = self.class.name.split('::').last
224
+ "<#{class_name} country: #{@country.inspect}, currency: #{@currency.inspect}, merchant_id:"\
225
+ " #{@merchant_id.inspect}, merchant_item_description: #{@merchant_item_description.inspect},"\
226
+ " merchant_request_id: #{@merchant_request_id.inspect}, merchant_transaction_id:"\
227
+ " #{@merchant_transaction_id.inspect}, msisdn: #{@msisdn.inspect}, network:"\
228
+ " #{@network.inspect}, total_amount: #{@total_amount.inspect}, merchant_data:"\
229
+ " #{@merchant_data.inspect}, notification_url: #{@notification_url.inspect}, timeout:"\
230
+ " #{@timeout.inspect}>"
231
+ end
232
+ end
233
+ end