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,249 @@
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
+ # Refund Model.
8
+ class Refund < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # ID of the charge being refunded
13
+ # @return [String]
14
+ attr_accessor :charge_id
15
+
16
+ # ISO 3166-1 alpha-2 country code.
17
+ # @return [String]
18
+ attr_accessor :country
19
+
20
+ # ISO 4217 three-letter currency code.
21
+ # @return [String]
22
+ attr_accessor :currency
23
+
24
+ # Boku-assigned merchant ID.
25
+ # @return [String]
26
+ attr_accessor :merchant_id
27
+
28
+ # Merchant-assigned refund ID.
29
+ # _***Boku recommends merchants send this ID for future reference**_
30
+ # @return [String]
31
+ attr_accessor :merchant_refund_id
32
+
33
+ # The merchant transaction ID of the charge being refunded if it was
34
+ # provided in the original charge request. Otherwise, the merchant request
35
+ # ID of the charge being refunded.
36
+ # _***Boku recommends merchants send this ID for future reference**_
37
+ # @return [String]
38
+ attr_accessor :merchant_transaction_id
39
+
40
+ # Issuer's Network ID.
41
+ # @return [String]
42
+ attr_accessor :network_id
43
+
44
+ # Boku refund reason code
45
+ # @return [Integer]
46
+ attr_accessor :reason_code
47
+
48
+ # Total amount refunded or attempted to refund, including tax.
49
+ # @return [Float]
50
+ attr_accessor :refund_amount
51
+
52
+ # Unique ID for the refund generated by Boku.
53
+ # @return [String]
54
+ attr_accessor :refund_id
55
+
56
+ # Status of the refund at the time this response was returned.
57
+ # If 'in-progress' is returned, the refund call should be re-issued with the
58
+ # same request ID until a final status is reached.
59
+ # If null, no refund was created, e.g. because the request was rejected.
60
+ # @return [RefundStatusEnum]
61
+ attr_accessor :refund_status
62
+
63
+ # The 'result' element is defined in every response type. It is used to
64
+ # convey the outcome of an API request.
65
+ # @return [Result]
66
+ attr_accessor :result
67
+
68
+ # Time original refund request was received ("YYYY-MM-DD hh:mm:ss").
69
+ # All timestamps are in UTC.
70
+ # @return [String]
71
+ attr_accessor :timestamp
72
+
73
+ # Indicates whether refund is a regular refund or chargeback
74
+ # @return [RefundTypeEnum]
75
+ attr_accessor :type
76
+
77
+ # A mapping from model property names to API property names.
78
+ def self.names
79
+ @_hash = {} if @_hash.nil?
80
+ @_hash['charge_id'] = 'charge-id'
81
+ @_hash['country'] = 'country'
82
+ @_hash['currency'] = 'currency'
83
+ @_hash['merchant_id'] = 'merchant-id'
84
+ @_hash['merchant_refund_id'] = 'merchant-refund-id'
85
+ @_hash['merchant_transaction_id'] = 'merchant-transaction-id'
86
+ @_hash['network_id'] = 'network-id'
87
+ @_hash['reason_code'] = 'reason-code'
88
+ @_hash['refund_amount'] = 'refund-amount'
89
+ @_hash['refund_id'] = 'refund-id'
90
+ @_hash['refund_status'] = 'refund-status'
91
+ @_hash['result'] = 'result'
92
+ @_hash['timestamp'] = 'timestamp'
93
+ @_hash['type'] = 'type'
94
+ @_hash
95
+ end
96
+
97
+ # An array for optional fields
98
+ def self.optionals
99
+ []
100
+ end
101
+
102
+ # An array for nullable fields
103
+ def self.nullables
104
+ []
105
+ end
106
+
107
+ def initialize(charge_id = nil, country = nil, currency = nil,
108
+ merchant_id = nil, merchant_refund_id = nil,
109
+ merchant_transaction_id = nil, network_id = nil,
110
+ reason_code = nil, refund_amount = nil, refund_id = nil,
111
+ refund_status = nil, result = nil, timestamp = nil,
112
+ type = nil)
113
+ @charge_id = charge_id
114
+ @country = country
115
+ @currency = currency
116
+ @merchant_id = merchant_id
117
+ @merchant_refund_id = merchant_refund_id
118
+ @merchant_transaction_id = merchant_transaction_id
119
+ @network_id = network_id
120
+ @reason_code = reason_code
121
+ @refund_amount = refund_amount
122
+ @refund_id = refund_id
123
+ @refund_status = refund_status
124
+ @result = result
125
+ @timestamp = timestamp
126
+ @type = type
127
+ end
128
+
129
+ # Creates an instance of the object from a hash.
130
+ def self.from_hash(hash)
131
+ return nil unless hash
132
+
133
+ # Extract variables from the hash.
134
+ charge_id = hash.key?('charge-id') ? hash['charge-id'] : nil
135
+ country = hash.key?('country') ? hash['country'] : nil
136
+ currency = hash.key?('currency') ? hash['currency'] : nil
137
+ merchant_id = hash.key?('merchant-id') ? hash['merchant-id'] : nil
138
+ merchant_refund_id =
139
+ hash.key?('merchant-refund-id') ? hash['merchant-refund-id'] : nil
140
+ merchant_transaction_id =
141
+ hash.key?('merchant-transaction-id') ? hash['merchant-transaction-id'] : nil
142
+ network_id = hash.key?('network-id') ? hash['network-id'] : nil
143
+ reason_code = hash.key?('reason-code') ? hash['reason-code'] : nil
144
+ refund_amount = hash.key?('refund-amount') ? hash['refund-amount'] : nil
145
+ refund_id = hash.key?('refund-id') ? hash['refund-id'] : nil
146
+ refund_status = hash.key?('refund-status') ? hash['refund-status'] : nil
147
+ result = Result.from_hash(hash['result']) if hash['result']
148
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : nil
149
+ type = hash.key?('type') ? hash['type'] : nil
150
+
151
+ # Create object from extracted values.
152
+ Refund.new(charge_id,
153
+ country,
154
+ currency,
155
+ merchant_id,
156
+ merchant_refund_id,
157
+ merchant_transaction_id,
158
+ network_id,
159
+ reason_code,
160
+ refund_amount,
161
+ refund_id,
162
+ refund_status,
163
+ result,
164
+ timestamp,
165
+ type)
166
+ end
167
+
168
+ def self.from_element(root)
169
+ charge_id = XmlUtilities.from_element(root, 'charge-id', String)
170
+ country = XmlUtilities.from_element(root, 'country', String)
171
+ currency = XmlUtilities.from_element(root, 'currency', String)
172
+ merchant_id = XmlUtilities.from_element(root, 'merchant-id', String)
173
+ merchant_refund_id = XmlUtilities.from_element(root, 'merchant-refund-id',
174
+ String)
175
+ merchant_transaction_id = XmlUtilities.from_element(
176
+ root, 'merchant-transaction-id', String
177
+ )
178
+ network_id = XmlUtilities.from_element(root, 'network-id', String)
179
+ reason_code = XmlUtilities.from_element(root, 'reason-code', Integer)
180
+ refund_amount = XmlUtilities.from_element(root, 'refund-amount', Float)
181
+ refund_id = XmlUtilities.from_element(root, 'refund-id', String)
182
+ refund_status = XmlUtilities.from_element(root, 'refund-status', String)
183
+ result = XmlUtilities.from_element(root, 'result', Result)
184
+ timestamp = XmlUtilities.from_element(root, 'timestamp', String)
185
+ type = XmlUtilities.from_element(root, 'type', String)
186
+
187
+ new(charge_id,
188
+ country,
189
+ currency,
190
+ merchant_id,
191
+ merchant_refund_id,
192
+ merchant_transaction_id,
193
+ network_id,
194
+ reason_code,
195
+ refund_amount,
196
+ refund_id,
197
+ refund_status,
198
+ result,
199
+ timestamp,
200
+ type)
201
+ end
202
+
203
+ def to_xml_element(doc, root_name)
204
+ root = doc.create_element(root_name)
205
+
206
+ XmlUtilities.add_as_subelement(doc, root, 'charge-id', charge_id)
207
+ XmlUtilities.add_as_subelement(doc, root, 'country', country)
208
+ XmlUtilities.add_as_subelement(doc, root, 'currency', currency)
209
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-id', merchant_id)
210
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-refund-id',
211
+ merchant_refund_id)
212
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-transaction-id',
213
+ merchant_transaction_id)
214
+ XmlUtilities.add_as_subelement(doc, root, 'network-id', network_id)
215
+ XmlUtilities.add_as_subelement(doc, root, 'reason-code', reason_code)
216
+ XmlUtilities.add_as_subelement(doc, root, 'refund-amount', refund_amount)
217
+ XmlUtilities.add_as_subelement(doc, root, 'refund-id', refund_id)
218
+ XmlUtilities.add_as_subelement(doc, root, 'refund-status', refund_status)
219
+ XmlUtilities.add_as_subelement(doc, root, 'result', result)
220
+ XmlUtilities.add_as_subelement(doc, root, 'timestamp', timestamp)
221
+ XmlUtilities.add_as_subelement(doc, root, 'type', type)
222
+
223
+ root
224
+ end
225
+
226
+ # Provides a human-readable string representation of the object.
227
+ def to_s
228
+ class_name = self.class.name.split('::').last
229
+ "<#{class_name} charge_id: #{@charge_id}, country: #{@country}, currency: #{@currency},"\
230
+ " merchant_id: #{@merchant_id}, merchant_refund_id: #{@merchant_refund_id},"\
231
+ " merchant_transaction_id: #{@merchant_transaction_id}, network_id: #{@network_id},"\
232
+ " reason_code: #{@reason_code}, refund_amount: #{@refund_amount}, refund_id: #{@refund_id},"\
233
+ " refund_status: #{@refund_status}, result: #{@result}, timestamp: #{@timestamp}, type:"\
234
+ " #{@type}>"
235
+ end
236
+
237
+ # Provides a debugging-friendly string with detailed object information.
238
+ def inspect
239
+ class_name = self.class.name.split('::').last
240
+ "<#{class_name} charge_id: #{@charge_id.inspect}, country: #{@country.inspect}, currency:"\
241
+ " #{@currency.inspect}, merchant_id: #{@merchant_id.inspect}, merchant_refund_id:"\
242
+ " #{@merchant_refund_id.inspect}, merchant_transaction_id:"\
243
+ " #{@merchant_transaction_id.inspect}, network_id: #{@network_id.inspect}, reason_code:"\
244
+ " #{@reason_code.inspect}, refund_amount: #{@refund_amount.inspect}, refund_id:"\
245
+ " #{@refund_id.inspect}, refund_status: #{@refund_status.inspect}, result:"\
246
+ " #{@result.inspect}, timestamp: #{@timestamp.inspect}, type: #{@type.inspect}>"
247
+ end
248
+ end
249
+ end
@@ -0,0 +1,88 @@
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
+ # RefundChargeNotification Model.
8
+ class RefundChargeNotification < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Flag to indicate if a notification should be sent for this refund.
13
+ # @return [TrueClass | FalseClass]
14
+ attr_accessor :send
15
+
16
+ # Supplies the URL for Boku to send a notification once the refund is
17
+ # complete.
18
+ # @return [String]
19
+ attr_accessor :url
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['send'] = 'send'
25
+ @_hash['url'] = 'url'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ %w[
32
+ url
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(send = false, url = SKIP)
42
+ @send = send
43
+ @url = url unless url == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ send = hash['send'] ||= false
52
+ url = hash.key?('url') ? hash['url'] : SKIP
53
+
54
+ # Create object from extracted values.
55
+ RefundChargeNotification.new(send,
56
+ url)
57
+ end
58
+
59
+ def self.from_element(root)
60
+ send = XmlUtilities.from_attribute(root, 'send', TrueClass)
61
+ url = XmlUtilities.from_attribute(root, 'url', String)
62
+
63
+ new(send,
64
+ url)
65
+ end
66
+
67
+ def to_xml_element(doc, root_name)
68
+ root = doc.create_element(root_name)
69
+
70
+ XmlUtilities.add_as_attribute(root, 'send', send)
71
+ XmlUtilities.add_as_attribute(root, 'url', url)
72
+
73
+ root
74
+ end
75
+
76
+ # Provides a human-readable string representation of the object.
77
+ def to_s
78
+ class_name = self.class.name.split('::').last
79
+ "<#{class_name} send: #{@send}, url: #{@url}>"
80
+ end
81
+
82
+ # Provides a debugging-friendly string with detailed object information.
83
+ def inspect
84
+ class_name = self.class.name.split('::').last
85
+ "<#{class_name} send: #{@send.inspect}, url: #{@url.inspect}>"
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,231 @@
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
+ # 'refund-charge' Request - General Parameters
8
+ class RefundChargeRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # ID of the charge being refunded
13
+ # @return [String]
14
+ attr_accessor :charge_id
15
+
16
+ # Boku-assigned merchant ID.
17
+ # @return [String]
18
+ attr_accessor :merchant_id
19
+
20
+ # Merchant-assigned refund ID
21
+ # _***Boku recommends merchants send this ID for future reference**_
22
+ # @return [String]
23
+ attr_accessor :merchant_refund_id
24
+
25
+ # Merchant-assigned unique request ID.
26
+ # Multiple requests received with the same merchant-request-id will be
27
+ # handled idempotently within the idempotency window.
28
+ # @return [String]
29
+ attr_accessor :merchant_request_id
30
+
31
+ # [Boku refund reason code](page:refund-reason-codes)
32
+ # @return [Integer]
33
+ attr_accessor :reason_code
34
+
35
+ # ISO 3166-1 alpha-2 country code.
36
+ # @return [String]
37
+ attr_accessor :country
38
+
39
+ # ISO 4217 three-letter currency code
40
+ # @return [String]
41
+ attr_accessor :currency
42
+
43
+ # ISO 4217 three-letter currency code
44
+ # @return [RefundChargeNotification]
45
+ attr_accessor :notification
46
+
47
+ # Refund amount. Defaults to the original charge request's total-amount.
48
+ # @return [Float]
49
+ attr_accessor :refund_amount
50
+
51
+ # **DISCLAIMER: This API or element is use-case specific and not needed for
52
+ # generic usage of our payment product. Please disregard unless otherwise
53
+ # directed to include in your integration.**
54
+ # Element containing settlement information about the original charge.
55
+ # @return [Settlement]
56
+ attr_accessor :settlement
57
+
58
+ # Flag to indicate if Boku automated retry logic should be skipped for this
59
+ # refund.
60
+ # @return [TrueClass | FalseClass]
61
+ attr_accessor :skip_retry
62
+
63
+ # Specifies how long to block waiting for a response
64
+ # @return [Timeout]
65
+ attr_accessor :timeout
66
+
67
+ # A mapping from model property names to API property names.
68
+ def self.names
69
+ @_hash = {} if @_hash.nil?
70
+ @_hash['charge_id'] = 'charge-id'
71
+ @_hash['merchant_id'] = 'merchant-id'
72
+ @_hash['merchant_refund_id'] = 'merchant-refund-id'
73
+ @_hash['merchant_request_id'] = 'merchant-request-id'
74
+ @_hash['reason_code'] = 'reason-code'
75
+ @_hash['country'] = 'country'
76
+ @_hash['currency'] = 'currency'
77
+ @_hash['notification'] = 'notification'
78
+ @_hash['refund_amount'] = 'refund-amount'
79
+ @_hash['settlement'] = 'settlement'
80
+ @_hash['skip_retry'] = 'skip-retry'
81
+ @_hash['timeout'] = 'timeout'
82
+ @_hash
83
+ end
84
+
85
+ # An array for optional fields
86
+ def self.optionals
87
+ %w[
88
+ country
89
+ currency
90
+ notification
91
+ refund_amount
92
+ settlement
93
+ skip_retry
94
+ timeout
95
+ ]
96
+ end
97
+
98
+ # An array for nullable fields
99
+ def self.nullables
100
+ []
101
+ end
102
+
103
+ def initialize(charge_id = nil, merchant_id = nil, merchant_refund_id = nil,
104
+ merchant_request_id = nil, reason_code = nil, country = SKIP,
105
+ currency = SKIP, notification = SKIP, refund_amount = SKIP,
106
+ settlement = SKIP, skip_retry = false, timeout = SKIP)
107
+ @charge_id = charge_id
108
+ @merchant_id = merchant_id
109
+ @merchant_refund_id = merchant_refund_id
110
+ @merchant_request_id = merchant_request_id
111
+ @reason_code = reason_code
112
+ @country = country unless country == SKIP
113
+ @currency = currency unless currency == SKIP
114
+ @notification = notification unless notification == SKIP
115
+ @refund_amount = refund_amount unless refund_amount == SKIP
116
+ @settlement = settlement unless settlement == SKIP
117
+ @skip_retry = skip_retry unless skip_retry == SKIP
118
+ @timeout = timeout unless timeout == SKIP
119
+ end
120
+
121
+ # Creates an instance of the object from a hash.
122
+ def self.from_hash(hash)
123
+ return nil unless hash
124
+
125
+ # Extract variables from the hash.
126
+ charge_id = hash.key?('charge-id') ? hash['charge-id'] : nil
127
+ merchant_id = hash.key?('merchant-id') ? hash['merchant-id'] : nil
128
+ merchant_refund_id =
129
+ hash.key?('merchant-refund-id') ? hash['merchant-refund-id'] : nil
130
+ merchant_request_id =
131
+ hash.key?('merchant-request-id') ? hash['merchant-request-id'] : nil
132
+ reason_code = hash.key?('reason-code') ? hash['reason-code'] : nil
133
+ country = hash.key?('country') ? hash['country'] : SKIP
134
+ currency = hash.key?('currency') ? hash['currency'] : SKIP
135
+ notification = RefundChargeNotification.from_hash(hash['notification']) if
136
+ hash['notification']
137
+ refund_amount = hash.key?('refund-amount') ? hash['refund-amount'] : SKIP
138
+ settlement = Settlement.from_hash(hash['settlement']) if hash['settlement']
139
+ skip_retry = hash['skip-retry'] ||= false
140
+ timeout = Timeout.from_hash(hash['timeout']) if hash['timeout']
141
+
142
+ # Create object from extracted values.
143
+ RefundChargeRequest.new(charge_id,
144
+ merchant_id,
145
+ merchant_refund_id,
146
+ merchant_request_id,
147
+ reason_code,
148
+ country,
149
+ currency,
150
+ notification,
151
+ refund_amount,
152
+ settlement,
153
+ skip_retry,
154
+ timeout)
155
+ end
156
+
157
+ def self.from_element(root)
158
+ charge_id = XmlUtilities.from_element(root, 'charge-id', String)
159
+ merchant_id = XmlUtilities.from_element(root, 'merchant-id', String)
160
+ merchant_refund_id = XmlUtilities.from_element(root, 'merchant-refund-id',
161
+ String)
162
+ merchant_request_id = XmlUtilities.from_element(root,
163
+ 'merchant-request-id',
164
+ String)
165
+ reason_code = XmlUtilities.from_element(root, 'reason-code', Integer)
166
+ country = XmlUtilities.from_element(root, 'country', String)
167
+ currency = XmlUtilities.from_element(root, 'currency', String)
168
+ notification = XmlUtilities.from_element(root, 'notification',
169
+ RefundChargeNotification)
170
+ refund_amount = XmlUtilities.from_element(root, 'refund-amount', Float)
171
+ settlement = XmlUtilities.from_element(root, 'Settlement', Settlement)
172
+ skip_retry = XmlUtilities.from_element(root, 'skip-retry', TrueClass)
173
+ timeout = XmlUtilities.from_element(root, 'timeout', Timeout)
174
+
175
+ new(charge_id,
176
+ merchant_id,
177
+ merchant_refund_id,
178
+ merchant_request_id,
179
+ reason_code,
180
+ country,
181
+ currency,
182
+ notification,
183
+ refund_amount,
184
+ settlement,
185
+ skip_retry,
186
+ timeout)
187
+ end
188
+
189
+ def to_xml_element(doc, root_name)
190
+ root = doc.create_element(root_name)
191
+
192
+ XmlUtilities.add_as_subelement(doc, root, 'charge-id', charge_id)
193
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-id', merchant_id)
194
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-refund-id',
195
+ merchant_refund_id)
196
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-request-id',
197
+ merchant_request_id)
198
+ XmlUtilities.add_as_subelement(doc, root, 'reason-code', reason_code)
199
+ XmlUtilities.add_as_subelement(doc, root, 'country', country)
200
+ XmlUtilities.add_as_subelement(doc, root, 'currency', currency)
201
+ XmlUtilities.add_as_subelement(doc, root, 'notification', notification)
202
+ XmlUtilities.add_as_subelement(doc, root, 'refund-amount', refund_amount)
203
+ XmlUtilities.add_as_subelement(doc, root, 'Settlement', settlement)
204
+ XmlUtilities.add_as_subelement(doc, root, 'skip-retry', skip_retry)
205
+ XmlUtilities.add_as_subelement(doc, root, 'timeout', timeout)
206
+
207
+ root
208
+ end
209
+
210
+ # Provides a human-readable string representation of the object.
211
+ def to_s
212
+ class_name = self.class.name.split('::').last
213
+ "<#{class_name} charge_id: #{@charge_id}, merchant_id: #{@merchant_id}, merchant_refund_id:"\
214
+ " #{@merchant_refund_id}, merchant_request_id: #{@merchant_request_id}, reason_code:"\
215
+ " #{@reason_code}, country: #{@country}, currency: #{@currency}, notification:"\
216
+ " #{@notification}, refund_amount: #{@refund_amount}, settlement: #{@settlement},"\
217
+ " skip_retry: #{@skip_retry}, timeout: #{@timeout}>"
218
+ end
219
+
220
+ # Provides a debugging-friendly string with detailed object information.
221
+ def inspect
222
+ class_name = self.class.name.split('::').last
223
+ "<#{class_name} charge_id: #{@charge_id.inspect}, merchant_id: #{@merchant_id.inspect},"\
224
+ " merchant_refund_id: #{@merchant_refund_id.inspect}, merchant_request_id:"\
225
+ " #{@merchant_request_id.inspect}, reason_code: #{@reason_code.inspect}, country:"\
226
+ " #{@country.inspect}, currency: #{@currency.inspect}, notification:"\
227
+ " #{@notification.inspect}, refund_amount: #{@refund_amount.inspect}, settlement:"\
228
+ " #{@settlement.inspect}, skip_retry: #{@skip_retry.inspect}, timeout: #{@timeout.inspect}>"
229
+ end
230
+ end
231
+ end