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,253 @@
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' Response - General Elements
8
+ class ChargeResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Boku-assigned merchant ID.
13
+ # @return [String]
14
+ attr_accessor :merchant_id
15
+
16
+ # Merchant-assigned unique request ID.
17
+ # @return [String]
18
+ attr_accessor :merchant_request_id
19
+
20
+ # Merchant-assigned transaction ID.
21
+ # _***Boku recommends merchants send this ID for future reference.**_
22
+ # @return [String]
23
+ attr_accessor :merchant_transaction_id
24
+
25
+ # Boku-assigned consumer opt-in ID.
26
+ # @return [String]
27
+ attr_accessor :optin_id
28
+
29
+ # The 'result' element is defined in every response type. It is used to
30
+ # convey the outcome of an API request.
31
+ # @return [Result]
32
+ attr_accessor :result
33
+
34
+ # Boku-generated unique ID for the charge.
35
+ # If null, no charge was created (e.g., because the request was rejected).
36
+ # @return [String]
37
+ attr_accessor :charge_id
38
+
39
+ # Status of the charge at the time this response was returned.
40
+ # If 'in-progress' is returned, the charge call should be re-issued with the
41
+ # same request ID until a final status is reached.
42
+ # If null, no charge was created (e.g., because the request was rejected).
43
+ # @return [ChargeStatusEnum]
44
+ attr_accessor :charge_status
45
+
46
+ # ISO 3166-1 alpha-2 country code.
47
+ # @return [String]
48
+ attr_accessor :country
49
+
50
+ # Merchant-supplied metadata.
51
+ # @return [String]
52
+ attr_accessor :merchant_data
53
+
54
+ # Issuer's Network ID.
55
+ # @return [String]
56
+ attr_accessor :network_id
57
+
58
+ # Optin and Charge Request API can be made for specific Seller of Record
59
+ # previously registered with Boku.
60
+ # @return [SellerOfRecord]
61
+ attr_accessor :seller_of_record
62
+
63
+ # **DISCLAIMER: This API or element is use-case specific and not needed for
64
+ # generic usage of our payment product. Please disregard unless otherwise
65
+ # directed to include in your integration.**
66
+ # Element containing settlement information about the original charge.
67
+ # @return [Settlement]
68
+ attr_accessor :settlement
69
+
70
+ # Time the request was received (format: 'YYYY-MM-DD hh:mm:ss').
71
+ # All timestamps are in UTC.
72
+ # @return [String]
73
+ attr_accessor :timestamp
74
+
75
+ # A mapping from model property names to API property names.
76
+ def self.names
77
+ @_hash = {} if @_hash.nil?
78
+ @_hash['merchant_id'] = 'merchant-id'
79
+ @_hash['merchant_request_id'] = 'merchant-request-id'
80
+ @_hash['merchant_transaction_id'] = 'merchant-transaction-id'
81
+ @_hash['optin_id'] = 'optin-id'
82
+ @_hash['result'] = 'result'
83
+ @_hash['charge_id'] = 'charge-id'
84
+ @_hash['charge_status'] = 'charge-status'
85
+ @_hash['country'] = 'country'
86
+ @_hash['merchant_data'] = 'merchant-data'
87
+ @_hash['network_id'] = 'network-id'
88
+ @_hash['seller_of_record'] = 'seller-of-record'
89
+ @_hash['settlement'] = 'settlement'
90
+ @_hash['timestamp'] = 'timestamp'
91
+ @_hash
92
+ end
93
+
94
+ # An array for optional fields
95
+ def self.optionals
96
+ %w[
97
+ charge_id
98
+ charge_status
99
+ country
100
+ merchant_data
101
+ network_id
102
+ seller_of_record
103
+ settlement
104
+ timestamp
105
+ ]
106
+ end
107
+
108
+ # An array for nullable fields
109
+ def self.nullables
110
+ []
111
+ end
112
+
113
+ def initialize(merchant_id = nil, merchant_request_id = nil,
114
+ merchant_transaction_id = nil, optin_id = nil, result = nil,
115
+ charge_id = SKIP, charge_status = SKIP, country = SKIP,
116
+ merchant_data = SKIP, network_id = SKIP,
117
+ seller_of_record = SKIP, settlement = SKIP, timestamp = SKIP)
118
+ @merchant_id = merchant_id
119
+ @merchant_request_id = merchant_request_id
120
+ @merchant_transaction_id = merchant_transaction_id
121
+ @optin_id = optin_id
122
+ @result = result
123
+ @charge_id = charge_id unless charge_id == SKIP
124
+ @charge_status = charge_status unless charge_status == SKIP
125
+ @country = country unless country == SKIP
126
+ @merchant_data = merchant_data unless merchant_data == SKIP
127
+ @network_id = network_id unless network_id == SKIP
128
+ @seller_of_record = seller_of_record unless seller_of_record == SKIP
129
+ @settlement = settlement unless settlement == SKIP
130
+ @timestamp = timestamp unless timestamp == SKIP
131
+ end
132
+
133
+ # Creates an instance of the object from a hash.
134
+ def self.from_hash(hash)
135
+ return nil unless hash
136
+
137
+ # Extract variables from the hash.
138
+ merchant_id = hash.key?('merchant-id') ? hash['merchant-id'] : nil
139
+ merchant_request_id =
140
+ hash.key?('merchant-request-id') ? hash['merchant-request-id'] : nil
141
+ merchant_transaction_id =
142
+ hash.key?('merchant-transaction-id') ? hash['merchant-transaction-id'] : nil
143
+ optin_id = hash.key?('optin-id') ? hash['optin-id'] : nil
144
+ result = Result.from_hash(hash['result']) if hash['result']
145
+ charge_id = hash.key?('charge-id') ? hash['charge-id'] : SKIP
146
+ charge_status = hash.key?('charge-status') ? hash['charge-status'] : SKIP
147
+ country = hash.key?('country') ? hash['country'] : SKIP
148
+ merchant_data = hash.key?('merchant-data') ? hash['merchant-data'] : SKIP
149
+ network_id = hash.key?('network-id') ? hash['network-id'] : SKIP
150
+ seller_of_record = SellerOfRecord.from_hash(hash['seller-of-record']) if
151
+ hash['seller-of-record']
152
+ settlement = Settlement.from_hash(hash['settlement']) if hash['settlement']
153
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
154
+
155
+ # Create object from extracted values.
156
+ ChargeResponse.new(merchant_id,
157
+ merchant_request_id,
158
+ merchant_transaction_id,
159
+ optin_id,
160
+ result,
161
+ charge_id,
162
+ charge_status,
163
+ country,
164
+ merchant_data,
165
+ network_id,
166
+ seller_of_record,
167
+ settlement,
168
+ timestamp)
169
+ end
170
+
171
+ def self.from_element(root)
172
+ merchant_id = XmlUtilities.from_element(root, 'merchant-id', String)
173
+ merchant_request_id = XmlUtilities.from_element(root,
174
+ 'merchant-request-id',
175
+ String)
176
+ merchant_transaction_id = XmlUtilities.from_element(
177
+ root, 'merchant-transaction-id', String
178
+ )
179
+ optin_id = XmlUtilities.from_element(root, 'optin-id', String)
180
+ result = XmlUtilities.from_element(root, 'result', Result)
181
+ charge_id = XmlUtilities.from_element(root, 'charge-id', String)
182
+ charge_status = XmlUtilities.from_element(root, 'charge-status', String)
183
+ country = XmlUtilities.from_element(root, 'country', String)
184
+ merchant_data = XmlUtilities.from_element(root, 'merchant-data', String)
185
+ network_id = XmlUtilities.from_element(root, 'network-id', String)
186
+ seller_of_record = XmlUtilities.from_element(root, 'seller-of-record',
187
+ SellerOfRecord)
188
+ settlement = XmlUtilities.from_element(root, 'Settlement', Settlement)
189
+ timestamp = XmlUtilities.from_element(root, 'timestamp', String)
190
+
191
+ new(merchant_id,
192
+ merchant_request_id,
193
+ merchant_transaction_id,
194
+ optin_id,
195
+ result,
196
+ charge_id,
197
+ charge_status,
198
+ country,
199
+ merchant_data,
200
+ network_id,
201
+ seller_of_record,
202
+ settlement,
203
+ timestamp)
204
+ end
205
+
206
+ def to_xml_element(doc, root_name)
207
+ root = doc.create_element(root_name)
208
+
209
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-id', merchant_id)
210
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-request-id',
211
+ merchant_request_id)
212
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-transaction-id',
213
+ merchant_transaction_id)
214
+ XmlUtilities.add_as_subelement(doc, root, 'optin-id', optin_id)
215
+ XmlUtilities.add_as_subelement(doc, root, 'result', result)
216
+ XmlUtilities.add_as_subelement(doc, root, 'charge-id', charge_id)
217
+ XmlUtilities.add_as_subelement(doc, root, 'charge-status', charge_status)
218
+ XmlUtilities.add_as_subelement(doc, root, 'country', country)
219
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-data', merchant_data)
220
+ XmlUtilities.add_as_subelement(doc, root, 'network-id', network_id)
221
+ XmlUtilities.add_as_subelement(doc, root, 'seller-of-record',
222
+ seller_of_record)
223
+ XmlUtilities.add_as_subelement(doc, root, 'Settlement', settlement)
224
+ XmlUtilities.add_as_subelement(doc, root, 'timestamp', timestamp)
225
+
226
+ root
227
+ end
228
+
229
+ # Provides a human-readable string representation of the object.
230
+ def to_s
231
+ class_name = self.class.name.split('::').last
232
+ "<#{class_name} merchant_id: #{@merchant_id}, merchant_request_id: #{@merchant_request_id},"\
233
+ " merchant_transaction_id: #{@merchant_transaction_id}, optin_id: #{@optin_id}, result:"\
234
+ " #{@result}, charge_id: #{@charge_id}, charge_status: #{@charge_status}, country:"\
235
+ " #{@country}, merchant_data: #{@merchant_data}, network_id: #{@network_id},"\
236
+ " seller_of_record: #{@seller_of_record}, settlement: #{@settlement}, timestamp:"\
237
+ " #{@timestamp}>"
238
+ end
239
+
240
+ # Provides a debugging-friendly string with detailed object information.
241
+ def inspect
242
+ class_name = self.class.name.split('::').last
243
+ "<#{class_name} merchant_id: #{@merchant_id.inspect}, merchant_request_id:"\
244
+ " #{@merchant_request_id.inspect}, merchant_transaction_id:"\
245
+ " #{@merchant_transaction_id.inspect}, optin_id: #{@optin_id.inspect}, result:"\
246
+ " #{@result.inspect}, charge_id: #{@charge_id.inspect}, charge_status:"\
247
+ " #{@charge_status.inspect}, country: #{@country.inspect}, merchant_data:"\
248
+ " #{@merchant_data.inspect}, network_id: #{@network_id.inspect}, seller_of_record:"\
249
+ " #{@seller_of_record.inspect}, settlement: #{@settlement.inspect}, timestamp:"\
250
+ " #{@timestamp.inspect}>"
251
+ end
252
+ end
253
+ end
@@ -0,0 +1,43 @@
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
+ # Status of the charge at the time this response was returned. If
8
+ # 'in-progress' is returned, the charge call should be re-issued with the same
9
+ # request ID until a final status is reached. If null, no charge was created
10
+ # (e.g., because the request was rejected).
11
+ class ChargeStatusEnum
12
+ CHARGE_STATUS_ENUM = [
13
+ # TODO: Write general description for SUCCESS
14
+ SUCCESS = 'success'.freeze,
15
+
16
+ # TODO: Write general description for FAILED
17
+ FAILED = 'failed'.freeze,
18
+
19
+ # TODO: Write general description for INPROGRESS
20
+ INPROGRESS = 'in-progress'.freeze
21
+ ].freeze
22
+
23
+ def self.validate(value)
24
+ return false if value.nil?
25
+
26
+ CHARGE_STATUS_ENUM.include?(value)
27
+ end
28
+
29
+ def self.from_value(value, default_value = SUCCESS)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'success' then SUCCESS
36
+ when 'failed' then FAILED
37
+ when 'inprogress' then INPROGRESS
38
+ else
39
+ default_value
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,117 @@
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
+ # 'check-eligibility' Request - General Parameters
8
+ class CheckEligibilityRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Boku-assigned merchant ID.
13
+ # @return [String]
14
+ attr_accessor :merchant_id
15
+
16
+ # ISO 3166-1 alpha-2 country code.
17
+ # @return [String]
18
+ attr_accessor :country
19
+
20
+ # Merchant-assigned unique opt-in ID.
21
+ # @return [String]
22
+ attr_accessor :merchant_optin_id
23
+
24
+ # Boku-assigned consumer opt-in ID.
25
+ # @return [String]
26
+ attr_accessor :optin_id
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['merchant_id'] = 'merchant-id'
32
+ @_hash['country'] = 'country'
33
+ @_hash['merchant_optin_id'] = 'merchant-optin-id'
34
+ @_hash['optin_id'] = 'optin-id'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ country
42
+ merchant_optin_id
43
+ optin_id
44
+ ]
45
+ end
46
+
47
+ # An array for nullable fields
48
+ def self.nullables
49
+ []
50
+ end
51
+
52
+ def initialize(merchant_id = nil, country = SKIP, merchant_optin_id = SKIP,
53
+ optin_id = SKIP)
54
+ @merchant_id = merchant_id
55
+ @country = country unless country == SKIP
56
+ @merchant_optin_id = merchant_optin_id unless merchant_optin_id == SKIP
57
+ @optin_id = optin_id unless optin_id == SKIP
58
+ end
59
+
60
+ # Creates an instance of the object from a hash.
61
+ def self.from_hash(hash)
62
+ return nil unless hash
63
+
64
+ # Extract variables from the hash.
65
+ merchant_id = hash.key?('merchant-id') ? hash['merchant-id'] : nil
66
+ country = hash.key?('country') ? hash['country'] : SKIP
67
+ merchant_optin_id =
68
+ hash.key?('merchant-optin-id') ? hash['merchant-optin-id'] : SKIP
69
+ optin_id = hash.key?('optin-id') ? hash['optin-id'] : SKIP
70
+
71
+ # Create object from extracted values.
72
+ CheckEligibilityRequest.new(merchant_id,
73
+ country,
74
+ merchant_optin_id,
75
+ optin_id)
76
+ end
77
+
78
+ def self.from_element(root)
79
+ merchant_id = XmlUtilities.from_element(root, 'merchant-id', String)
80
+ country = XmlUtilities.from_element(root, 'country', String)
81
+ merchant_optin_id = XmlUtilities.from_element(root, 'merchant-optin-id',
82
+ String)
83
+ optin_id = XmlUtilities.from_element(root, 'optin-id', String)
84
+
85
+ new(merchant_id,
86
+ country,
87
+ merchant_optin_id,
88
+ optin_id)
89
+ end
90
+
91
+ def to_xml_element(doc, root_name)
92
+ root = doc.create_element(root_name)
93
+
94
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-id', merchant_id)
95
+ XmlUtilities.add_as_subelement(doc, root, 'country', country)
96
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-optin-id',
97
+ merchant_optin_id)
98
+ XmlUtilities.add_as_subelement(doc, root, 'optin-id', optin_id)
99
+
100
+ root
101
+ end
102
+
103
+ # Provides a human-readable string representation of the object.
104
+ def to_s
105
+ class_name = self.class.name.split('::').last
106
+ "<#{class_name} merchant_id: #{@merchant_id}, country: #{@country}, merchant_optin_id:"\
107
+ " #{@merchant_optin_id}, optin_id: #{@optin_id}>"
108
+ end
109
+
110
+ # Provides a debugging-friendly string with detailed object information.
111
+ def inspect
112
+ class_name = self.class.name.split('::').last
113
+ "<#{class_name} merchant_id: #{@merchant_id.inspect}, country: #{@country.inspect},"\
114
+ " merchant_optin_id: #{@merchant_optin_id.inspect}, optin_id: #{@optin_id.inspect}>"
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,116 @@
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
+ # 'check-eligibility' Response - General Elements
8
+ class CheckEligibilityResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Boku-assigned merchant ID.
13
+ # @return [String]
14
+ attr_accessor :merchant_id
15
+
16
+ # Boku-assigned consumer opt-in ID.
17
+ # @return [String]
18
+ attr_accessor :optin_id
19
+
20
+ # The 'result' element is defined in every response type. It is used to
21
+ # convey the outcome of an API request.
22
+ # @return [Result]
23
+ attr_accessor :result
24
+
25
+ # Eligibility status of the consumer. Provided if result.status == OK.
26
+ # @return [EligibilityStatusEnum]
27
+ attr_accessor :eligibility_status
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['merchant_id'] = 'merchant-id'
33
+ @_hash['optin_id'] = 'optin-id'
34
+ @_hash['result'] = 'result'
35
+ @_hash['eligibility_status'] = 'eligibility-status'
36
+ @_hash
37
+ end
38
+
39
+ # An array for optional fields
40
+ def self.optionals
41
+ %w[
42
+ eligibility_status
43
+ ]
44
+ end
45
+
46
+ # An array for nullable fields
47
+ def self.nullables
48
+ []
49
+ end
50
+
51
+ def initialize(merchant_id = nil, optin_id = nil, result = nil,
52
+ eligibility_status = SKIP)
53
+ @merchant_id = merchant_id
54
+ @optin_id = optin_id
55
+ @result = result
56
+ @eligibility_status = eligibility_status unless eligibility_status == SKIP
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
+ merchant_id = hash.key?('merchant-id') ? hash['merchant-id'] : nil
65
+ optin_id = hash.key?('optin-id') ? hash['optin-id'] : nil
66
+ result = Result.from_hash(hash['result']) if hash['result']
67
+ eligibility_status =
68
+ hash.key?('eligibility-status') ? hash['eligibility-status'] : SKIP
69
+
70
+ # Create object from extracted values.
71
+ CheckEligibilityResponse.new(merchant_id,
72
+ optin_id,
73
+ result,
74
+ eligibility_status)
75
+ end
76
+
77
+ def self.from_element(root)
78
+ merchant_id = XmlUtilities.from_element(root, 'merchant-id', String)
79
+ optin_id = XmlUtilities.from_element(root, 'optin-id', String)
80
+ result = XmlUtilities.from_element(root, 'result', Result)
81
+ eligibility_status = XmlUtilities.from_element(root, 'eligibility-status',
82
+ String)
83
+
84
+ new(merchant_id,
85
+ optin_id,
86
+ result,
87
+ eligibility_status)
88
+ end
89
+
90
+ def to_xml_element(doc, root_name)
91
+ root = doc.create_element(root_name)
92
+
93
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-id', merchant_id)
94
+ XmlUtilities.add_as_subelement(doc, root, 'optin-id', optin_id)
95
+ XmlUtilities.add_as_subelement(doc, root, 'result', result)
96
+ XmlUtilities.add_as_subelement(doc, root, 'eligibility-status',
97
+ eligibility_status)
98
+
99
+ root
100
+ end
101
+
102
+ # Provides a human-readable string representation of the object.
103
+ def to_s
104
+ class_name = self.class.name.split('::').last
105
+ "<#{class_name} merchant_id: #{@merchant_id}, optin_id: #{@optin_id}, result: #{@result},"\
106
+ " eligibility_status: #{@eligibility_status}>"
107
+ end
108
+
109
+ # Provides a debugging-friendly string with detailed object information.
110
+ def inspect
111
+ class_name = self.class.name.split('::').last
112
+ "<#{class_name} merchant_id: #{@merchant_id.inspect}, optin_id: #{@optin_id.inspect},"\
113
+ " result: #{@result.inspect}, eligibility_status: #{@eligibility_status.inspect}>"
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,91 @@
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
+ # Describes a HTTP call to be made from the client device via cellular data
8
+ # network as part of the opt-in. If absent from an optin-info carrier-gw
9
+ # element, indicates that though carrier-gw is supported, the URL must be
10
+ # generated on a per-request basis via a call to `optin`.
11
+ class ClientCall < BaseModel
12
+ SKIP = Object.new
13
+ private_constant :SKIP
14
+
15
+ # URL to be called, containing placeholders that must be replaced before
16
+ # using
17
+ # @return [String]
18
+ attr_accessor :url
19
+
20
+ # HTTP method to use for the call, usually 'GET'
21
+ # @return [MethodEnum]
22
+ attr_accessor :method
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['url'] = 'url'
28
+ @_hash['method'] = 'method'
29
+ @_hash
30
+ end
31
+
32
+ # An array for optional fields
33
+ def self.optionals
34
+ %w[
35
+ method
36
+ ]
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def self.nullables
41
+ []
42
+ end
43
+
44
+ def initialize(url = nil, method = SKIP)
45
+ @url = url
46
+ @method = method unless method == SKIP
47
+ end
48
+
49
+ # Creates an instance of the object from a hash.
50
+ def self.from_hash(hash)
51
+ return nil unless hash
52
+
53
+ # Extract variables from the hash.
54
+ url = hash.key?('url') ? hash['url'] : nil
55
+ method = hash.key?('method') ? hash['method'] : SKIP
56
+
57
+ # Create object from extracted values.
58
+ ClientCall.new(url,
59
+ method)
60
+ end
61
+
62
+ def self.from_element(root)
63
+ url = XmlUtilities.from_attribute(root, 'url', String)
64
+ method = XmlUtilities.from_attribute(root, 'method', String)
65
+
66
+ new(url,
67
+ method)
68
+ end
69
+
70
+ def to_xml_element(doc, root_name)
71
+ root = doc.create_element(root_name)
72
+
73
+ XmlUtilities.add_as_attribute(root, 'url', url)
74
+ XmlUtilities.add_as_attribute(root, 'method', method)
75
+
76
+ root
77
+ end
78
+
79
+ # Provides a human-readable string representation of the object.
80
+ def to_s
81
+ class_name = self.class.name.split('::').last
82
+ "<#{class_name} url: #{@url}, method: #{@method}>"
83
+ end
84
+
85
+ # Provides a debugging-friendly string with detailed object information.
86
+ def inspect
87
+ class_name = self.class.name.split('::').last
88
+ "<#{class_name} url: #{@url.inspect}, method: #{@method.inspect}>"
89
+ end
90
+ end
91
+ end