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,154 @@
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
+ # The 'result' element is defined in every response type. It is used to convey
8
+ # the outcome of an API request.
9
+ class Result < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Description of the reason code
14
+ # @return [String]
15
+ attr_accessor :message
16
+
17
+ # Provides additional information for the status
18
+ # @return [Integer]
19
+ attr_accessor :reason_code
20
+
21
+ # **true** if the request can be retried; **false** otherwise
22
+ # @return [TrueClass | FalseClass]
23
+ attr_accessor :retriable
24
+
25
+ # The status of the operation
26
+ # @return [ResultStatusEnum]
27
+ attr_accessor :status
28
+
29
+ # The status of the operation
30
+ # @return [Array[InvalidRequestField]]
31
+ attr_accessor :invalid_request_fields
32
+
33
+ # Minimum milliseconds to delay before re-trying request
34
+ # @return [Integer]
35
+ attr_accessor :retry_delay
36
+
37
+ # A mapping from model property names to API property names.
38
+ def self.names
39
+ @_hash = {} if @_hash.nil?
40
+ @_hash['message'] = 'message'
41
+ @_hash['reason_code'] = 'reason-code'
42
+ @_hash['retriable'] = 'retriable'
43
+ @_hash['status'] = 'status'
44
+ @_hash['invalid_request_fields'] = 'invalid-request-fields'
45
+ @_hash['retry_delay'] = 'retry-delay'
46
+ @_hash
47
+ end
48
+
49
+ # An array for optional fields
50
+ def self.optionals
51
+ %w[
52
+ invalid_request_fields
53
+ retry_delay
54
+ ]
55
+ end
56
+
57
+ # An array for nullable fields
58
+ def self.nullables
59
+ []
60
+ end
61
+
62
+ def initialize(message = nil, reason_code = nil, retriable = nil,
63
+ status = nil, invalid_request_fields = SKIP,
64
+ retry_delay = SKIP)
65
+ @message = message
66
+ @reason_code = reason_code
67
+ @retriable = retriable
68
+ @status = status
69
+ @invalid_request_fields = invalid_request_fields unless invalid_request_fields == SKIP
70
+ @retry_delay = retry_delay unless retry_delay == SKIP
71
+ end
72
+
73
+ # Creates an instance of the object from a hash.
74
+ def self.from_hash(hash)
75
+ return nil unless hash
76
+
77
+ # Extract variables from the hash.
78
+ message = hash.key?('message') ? hash['message'] : nil
79
+ reason_code = hash.key?('reason-code') ? hash['reason-code'] : nil
80
+ retriable = hash.key?('retriable') ? hash['retriable'] : nil
81
+ status = hash.key?('status') ? hash['status'] : nil
82
+ # Parameter is an array, so we need to iterate through it
83
+ invalid_request_fields = nil
84
+ unless hash['invalid-request-fields'].nil?
85
+ invalid_request_fields = []
86
+ hash['invalid-request-fields'].each do |structure|
87
+ invalid_request_fields << (InvalidRequestField.from_hash(structure) if structure)
88
+ end
89
+ end
90
+
91
+ invalid_request_fields = SKIP unless hash.key?('invalid-request-fields')
92
+ retry_delay = hash.key?('retry-delay') ? hash['retry-delay'] : SKIP
93
+
94
+ # Create object from extracted values.
95
+ Result.new(message,
96
+ reason_code,
97
+ retriable,
98
+ status,
99
+ invalid_request_fields,
100
+ retry_delay)
101
+ end
102
+
103
+ def self.from_element(root)
104
+ message = XmlUtilities.from_element(root, 'message', String)
105
+ reason_code = XmlUtilities.from_element(root, 'reason-code', Integer)
106
+ retriable = XmlUtilities.from_element(root, 'retriable', TrueClass)
107
+ status = XmlUtilities.from_attribute(root, 'status', String)
108
+ invalid_request_fields = XmlUtilities.from_element_to_array(
109
+ root, 'field', InvalidRequestField,
110
+ wrapping_element_name: 'invalid-request-fields'
111
+ )
112
+ retry_delay = XmlUtilities.from_element(root, 'retry-delay', Integer)
113
+
114
+ new(message,
115
+ reason_code,
116
+ retriable,
117
+ status,
118
+ invalid_request_fields,
119
+ retry_delay)
120
+ end
121
+
122
+ def to_xml_element(doc, root_name)
123
+ root = doc.create_element(root_name)
124
+
125
+ XmlUtilities.add_as_subelement(doc, root, 'message', message)
126
+ XmlUtilities.add_as_subelement(doc, root, 'reason-code', reason_code)
127
+ XmlUtilities.add_as_subelement(doc, root, 'retriable', retriable)
128
+ XmlUtilities.add_as_attribute(root, 'status', status)
129
+ XmlUtilities.add_array_as_subelement(
130
+ doc, root, 'field', invalid_request_fields,
131
+ wrapping_element_name: 'invalid-request-fields'
132
+ )
133
+ XmlUtilities.add_as_subelement(doc, root, 'retry-delay', retry_delay)
134
+
135
+ root
136
+ end
137
+
138
+ # Provides a human-readable string representation of the object.
139
+ def to_s
140
+ class_name = self.class.name.split('::').last
141
+ "<#{class_name} message: #{@message}, reason_code: #{@reason_code}, retriable:"\
142
+ " #{@retriable}, status: #{@status}, invalid_request_fields: #{@invalid_request_fields},"\
143
+ " retry_delay: #{@retry_delay}>"
144
+ end
145
+
146
+ # Provides a debugging-friendly string with detailed object information.
147
+ def inspect
148
+ class_name = self.class.name.split('::').last
149
+ "<#{class_name} message: #{@message.inspect}, reason_code: #{@reason_code.inspect},"\
150
+ " retriable: #{@retriable.inspect}, status: #{@status.inspect}, invalid_request_fields:"\
151
+ " #{@invalid_request_fields.inspect}, retry_delay: #{@retry_delay.inspect}>"
152
+ end
153
+ end
154
+ end
@@ -0,0 +1,36 @@
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
+ # The status of the operation
8
+ class ResultStatusEnum
9
+ RESULT_STATUS_ENUM = [
10
+ # The request was processed successfully
11
+ OK = 'OK'.freeze,
12
+
13
+ # A problem occurred while processing the request
14
+ ERROR = 'ERROR'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ RESULT_STATUS_ENUM.include?(value)
21
+ end
22
+
23
+ def self.from_value(value, default_value = OK)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'ok' then OK
30
+ when 'error' then ERROR
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,89 @@
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
+ # Contains information about the reversal status of this transaction. If
8
+ # present, charge may be considered reversed. If not present, no reversal
9
+ # request has been received.
10
+ class Reversal < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # Boku-assigned reversal ID allocated at the time of the original reversal
15
+ # request
16
+ # @return [String]
17
+ attr_accessor :reversal_id
18
+
19
+ # Time original reverse-charge request was received ("YYYY-MM-DD hh:mm:ss").
20
+ # All timestamps are in UTC.
21
+ # @return [String]
22
+ attr_accessor :timestamp
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['reversal_id'] = 'reversal-id'
28
+ @_hash['timestamp'] = 'timestamp'
29
+ @_hash
30
+ end
31
+
32
+ # An array for optional fields
33
+ def self.optionals
34
+ []
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def self.nullables
39
+ []
40
+ end
41
+
42
+ def initialize(reversal_id = nil, timestamp = nil)
43
+ @reversal_id = reversal_id
44
+ @timestamp = timestamp
45
+ end
46
+
47
+ # Creates an instance of the object from a hash.
48
+ def self.from_hash(hash)
49
+ return nil unless hash
50
+
51
+ # Extract variables from the hash.
52
+ reversal_id = hash.key?('reversal-id') ? hash['reversal-id'] : nil
53
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : nil
54
+
55
+ # Create object from extracted values.
56
+ Reversal.new(reversal_id,
57
+ timestamp)
58
+ end
59
+
60
+ def self.from_element(root)
61
+ reversal_id = XmlUtilities.from_element(root, 'reversal-id', String)
62
+ timestamp = XmlUtilities.from_element(root, 'timestamp', String)
63
+
64
+ new(reversal_id,
65
+ timestamp)
66
+ end
67
+
68
+ def to_xml_element(doc, root_name)
69
+ root = doc.create_element(root_name)
70
+
71
+ XmlUtilities.add_as_subelement(doc, root, 'reversal-id', reversal_id)
72
+ XmlUtilities.add_as_subelement(doc, root, 'timestamp', timestamp)
73
+
74
+ root
75
+ end
76
+
77
+ # Provides a human-readable string representation of the object.
78
+ def to_s
79
+ class_name = self.class.name.split('::').last
80
+ "<#{class_name} reversal_id: #{@reversal_id}, timestamp: #{@timestamp}>"
81
+ end
82
+
83
+ # Provides a debugging-friendly string with detailed object information.
84
+ def inspect
85
+ class_name = self.class.name.split('::').last
86
+ "<#{class_name} reversal_id: #{@reversal_id.inspect}, timestamp: #{@timestamp.inspect}>"
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,104 @@
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
+ # 'reverse-charge' Request - General Parameters
8
+ class ReverseChargeRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # ISO 3166-1 alpha-2 country code of the original charge to be reversed
13
+ # (same value as the original charge request).
14
+ # @return [String]
15
+ attr_accessor :country
16
+
17
+ # Boku-assigned merchant ID.
18
+ # @return [String]
19
+ attr_accessor :merchant_id
20
+
21
+ # Merchant-assigned request ID of the original charge request being
22
+ # reversed.
23
+ # @return [String]
24
+ attr_accessor :merchant_request_id
25
+
26
+ # A mapping from model property names to API property names.
27
+ def self.names
28
+ @_hash = {} if @_hash.nil?
29
+ @_hash['country'] = 'country'
30
+ @_hash['merchant_id'] = 'merchant-id'
31
+ @_hash['merchant_request_id'] = 'merchant-request-id'
32
+ @_hash
33
+ end
34
+
35
+ # An array for optional fields
36
+ def self.optionals
37
+ []
38
+ end
39
+
40
+ # An array for nullable fields
41
+ def self.nullables
42
+ []
43
+ end
44
+
45
+ def initialize(country = nil, merchant_id = nil, merchant_request_id = nil)
46
+ @country = country
47
+ @merchant_id = merchant_id
48
+ @merchant_request_id = merchant_request_id
49
+ end
50
+
51
+ # Creates an instance of the object from a hash.
52
+ def self.from_hash(hash)
53
+ return nil unless hash
54
+
55
+ # Extract variables from the hash.
56
+ country = hash.key?('country') ? hash['country'] : nil
57
+ merchant_id = hash.key?('merchant-id') ? hash['merchant-id'] : nil
58
+ merchant_request_id =
59
+ hash.key?('merchant-request-id') ? hash['merchant-request-id'] : nil
60
+
61
+ # Create object from extracted values.
62
+ ReverseChargeRequest.new(country,
63
+ merchant_id,
64
+ merchant_request_id)
65
+ end
66
+
67
+ def self.from_element(root)
68
+ country = XmlUtilities.from_element(root, 'country', String)
69
+ merchant_id = XmlUtilities.from_element(root, 'merchant-id', String)
70
+ merchant_request_id = XmlUtilities.from_element(root,
71
+ 'merchant-request-id',
72
+ String)
73
+
74
+ new(country,
75
+ merchant_id,
76
+ merchant_request_id)
77
+ end
78
+
79
+ def to_xml_element(doc, root_name)
80
+ root = doc.create_element(root_name)
81
+
82
+ XmlUtilities.add_as_subelement(doc, root, 'country', country)
83
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-id', merchant_id)
84
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-request-id',
85
+ merchant_request_id)
86
+
87
+ root
88
+ end
89
+
90
+ # Provides a human-readable string representation of the object.
91
+ def to_s
92
+ class_name = self.class.name.split('::').last
93
+ "<#{class_name} country: #{@country}, merchant_id: #{@merchant_id}, merchant_request_id:"\
94
+ " #{@merchant_request_id}>"
95
+ end
96
+
97
+ # Provides a debugging-friendly string with detailed object information.
98
+ def inspect
99
+ class_name = self.class.name.split('::').last
100
+ "<#{class_name} country: #{@country.inspect}, merchant_id: #{@merchant_id.inspect},"\
101
+ " merchant_request_id: #{@merchant_request_id.inspect}>"
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,157 @@
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
+ # 'reverse-charge' Response - General Elements
8
+ class ReverseChargeResponse < 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
+ # Boku-assigned merchant ID.
17
+ # @return [String]
18
+ attr_accessor :merchant_id
19
+
20
+ # Merchant-assigned request ID.
21
+ # @return [String]
22
+ attr_accessor :merchant_request_id
23
+
24
+ # The 'result' element is defined in every response type. It is used to
25
+ # convey the outcome of an API request.
26
+ # @return [Result]
27
+ attr_accessor :result
28
+
29
+ # Unique ID for each charge generated by Boku.
30
+ # @return [String]
31
+ attr_accessor :charge_id
32
+
33
+ # Boku-assigned reversal ID.
34
+ # @return [String]
35
+ attr_accessor :reversal_id
36
+
37
+ # Time request was received ("YYYY-MM-DD hh:mm:ss").
38
+ # All timestamps are in UTC.
39
+ # @return [String]
40
+ attr_accessor :timestamp
41
+
42
+ # A mapping from model property names to API property names.
43
+ def self.names
44
+ @_hash = {} if @_hash.nil?
45
+ @_hash['country'] = 'country'
46
+ @_hash['merchant_id'] = 'merchant-id'
47
+ @_hash['merchant_request_id'] = 'merchant-request-id'
48
+ @_hash['result'] = 'result'
49
+ @_hash['charge_id'] = 'charge-id'
50
+ @_hash['reversal_id'] = 'reversal-id'
51
+ @_hash['timestamp'] = 'timestamp'
52
+ @_hash
53
+ end
54
+
55
+ # An array for optional fields
56
+ def self.optionals
57
+ %w[
58
+ charge_id
59
+ reversal_id
60
+ timestamp
61
+ ]
62
+ end
63
+
64
+ # An array for nullable fields
65
+ def self.nullables
66
+ []
67
+ end
68
+
69
+ def initialize(country = nil, merchant_id = nil, merchant_request_id = nil,
70
+ result = nil, charge_id = SKIP, reversal_id = SKIP,
71
+ timestamp = SKIP)
72
+ @country = country
73
+ @merchant_id = merchant_id
74
+ @merchant_request_id = merchant_request_id
75
+ @result = result
76
+ @charge_id = charge_id unless charge_id == SKIP
77
+ @reversal_id = reversal_id unless reversal_id == SKIP
78
+ @timestamp = timestamp unless timestamp == SKIP
79
+ end
80
+
81
+ # Creates an instance of the object from a hash.
82
+ def self.from_hash(hash)
83
+ return nil unless hash
84
+
85
+ # Extract variables from the hash.
86
+ country = hash.key?('country') ? hash['country'] : nil
87
+ merchant_id = hash.key?('merchant-id') ? hash['merchant-id'] : nil
88
+ merchant_request_id =
89
+ hash.key?('merchant-request-id') ? hash['merchant-request-id'] : nil
90
+ result = Result.from_hash(hash['result']) if hash['result']
91
+ charge_id = hash.key?('charge-id') ? hash['charge-id'] : SKIP
92
+ reversal_id = hash.key?('reversal-id') ? hash['reversal-id'] : SKIP
93
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
94
+
95
+ # Create object from extracted values.
96
+ ReverseChargeResponse.new(country,
97
+ merchant_id,
98
+ merchant_request_id,
99
+ result,
100
+ charge_id,
101
+ reversal_id,
102
+ timestamp)
103
+ end
104
+
105
+ def self.from_element(root)
106
+ country = XmlUtilities.from_element(root, 'country', String)
107
+ merchant_id = XmlUtilities.from_element(root, 'merchant-id', String)
108
+ merchant_request_id = XmlUtilities.from_element(root,
109
+ 'merchant-request-id',
110
+ String)
111
+ result = XmlUtilities.from_element(root, 'result', Result)
112
+ charge_id = XmlUtilities.from_element(root, 'charge-id', String)
113
+ reversal_id = XmlUtilities.from_element(root, 'reversal-id', String)
114
+ timestamp = XmlUtilities.from_element(root, 'timestamp', String)
115
+
116
+ new(country,
117
+ merchant_id,
118
+ merchant_request_id,
119
+ result,
120
+ charge_id,
121
+ reversal_id,
122
+ timestamp)
123
+ end
124
+
125
+ def to_xml_element(doc, root_name)
126
+ root = doc.create_element(root_name)
127
+
128
+ XmlUtilities.add_as_subelement(doc, root, 'country', country)
129
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-id', merchant_id)
130
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-request-id',
131
+ merchant_request_id)
132
+ XmlUtilities.add_as_subelement(doc, root, 'result', result)
133
+ XmlUtilities.add_as_subelement(doc, root, 'charge-id', charge_id)
134
+ XmlUtilities.add_as_subelement(doc, root, 'reversal-id', reversal_id)
135
+ XmlUtilities.add_as_subelement(doc, root, 'timestamp', timestamp)
136
+
137
+ root
138
+ end
139
+
140
+ # Provides a human-readable string representation of the object.
141
+ def to_s
142
+ class_name = self.class.name.split('::').last
143
+ "<#{class_name} country: #{@country}, merchant_id: #{@merchant_id}, merchant_request_id:"\
144
+ " #{@merchant_request_id}, result: #{@result}, charge_id: #{@charge_id}, reversal_id:"\
145
+ " #{@reversal_id}, timestamp: #{@timestamp}>"
146
+ end
147
+
148
+ # Provides a debugging-friendly string with detailed object information.
149
+ def inspect
150
+ class_name = self.class.name.split('::').last
151
+ "<#{class_name} country: #{@country.inspect}, merchant_id: #{@merchant_id.inspect},"\
152
+ " merchant_request_id: #{@merchant_request_id.inspect}, result: #{@result.inspect},"\
153
+ " charge_id: #{@charge_id.inspect}, reversal_id: #{@reversal_id.inspect}, timestamp:"\
154
+ " #{@timestamp.inspect}>"
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,76 @@
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
+ # Optin and Charge Request API can be made for specific Seller of Record
8
+ # previously registered with Boku.
9
+ class SellerOfRecord < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Unique identifier for the Seller of Record, previously registered with
14
+ # Boku. The ID is a 24-character alphanumeric string generated by Boku.
15
+ # @return [String]
16
+ attr_accessor :id
17
+
18
+ # A mapping from model property names to API property names.
19
+ def self.names
20
+ @_hash = {} if @_hash.nil?
21
+ @_hash['id'] = 'id'
22
+ @_hash
23
+ end
24
+
25
+ # An array for optional fields
26
+ def self.optionals
27
+ []
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(id = nil)
36
+ @id = id
37
+ end
38
+
39
+ # Creates an instance of the object from a hash.
40
+ def self.from_hash(hash)
41
+ return nil unless hash
42
+
43
+ # Extract variables from the hash.
44
+ id = hash.key?('id') ? hash['id'] : nil
45
+
46
+ # Create object from extracted values.
47
+ SellerOfRecord.new(id)
48
+ end
49
+
50
+ def self.from_element(root)
51
+ id = XmlUtilities.from_element(root, 'id', String)
52
+
53
+ new(id)
54
+ end
55
+
56
+ def to_xml_element(doc, root_name)
57
+ root = doc.create_element(root_name)
58
+
59
+ XmlUtilities.add_as_subelement(doc, root, 'id', id)
60
+
61
+ root
62
+ end
63
+
64
+ # Provides a human-readable string representation of the object.
65
+ def to_s
66
+ class_name = self.class.name.split('::').last
67
+ "<#{class_name} id: #{@id}>"
68
+ end
69
+
70
+ # Provides a debugging-friendly string with detailed object information.
71
+ def inspect
72
+ class_name = self.class.name.split('::').last
73
+ "<#{class_name} id: #{@id.inspect}>"
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,44 @@
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
+ # The status of Seller Of Record
8
+ class SellerOfRecordStatusEnum
9
+ SELLER_OF_RECORD_STATUS_ENUM = [
10
+ # TODO: Write general description for PENDING
11
+ PENDING = 'pending'.freeze,
12
+
13
+ # TODO: Write general description for APPROVED
14
+ APPROVED = 'approved'.freeze,
15
+
16
+ # TODO: Write general description for REJECTED
17
+ REJECTED = 'rejected'.freeze,
18
+
19
+ # TODO: Write general description for SUSPENDED
20
+ SUSPENDED = 'suspended'.freeze
21
+ ].freeze
22
+
23
+ def self.validate(value)
24
+ return false if value.nil?
25
+
26
+ SELLER_OF_RECORD_STATUS_ENUM.include?(value)
27
+ end
28
+
29
+ def self.from_value(value, default_value = PENDING)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'pending' then PENDING
36
+ when 'approved' then APPROVED
37
+ when 'rejected' then REJECTED
38
+ when 'suspended' then SUSPENDED
39
+ else
40
+ default_value
41
+ end
42
+ end
43
+ end
44
+ end