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,21 @@
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
+ # Class for exceptions when there is a network error, status code error, etc.
8
+ class APIException < CoreLibrary::ApiException
9
+ # Provides a human-readable string representation of the object.
10
+ def to_s
11
+ class_name = self.class.name.split('::').last
12
+ "<#{class_name} status_code: #{@response_code}, reason: #{@reason}>"
13
+ end
14
+
15
+ # Provides a debugging-friendly string with detailed object information.
16
+ def inspect
17
+ class_name = self.class.name.split('::').last
18
+ "<#{class_name} status_code: #{@response_code.inspect}, reason: #{@reason.inspect}>"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,10 @@
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
+ # HttpCallBack allows defining callables for pre and post API calls.
8
+ class HttpCallBack < CoreLibrary::HttpCallback
9
+ end
10
+ end
@@ -0,0 +1,10 @@
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
+ # HTTP Methods Enumeration.
8
+ class HttpMethodEnum < CoreLibrary::HttpMethod
9
+ end
10
+ end
@@ -0,0 +1,10 @@
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
+ # Represents a single Http Request.
8
+ class HttpRequest < CoreLibrary::HttpRequest
9
+ end
10
+ end
@@ -0,0 +1,10 @@
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
+ # Http response received.
8
+ class HttpResponse < CoreLibrary::HttpResponse
9
+ end
10
+ end
@@ -0,0 +1,22 @@
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
+ ##
8
+ # ProxySettings encapsulates HTTP proxy configuration for Faraday,
9
+ # including optional basic authentication.
10
+ #
11
+ class ProxySettings < CoreLibrary::ProxySettings
12
+ def self.from_env
13
+ address = ENV['PROXY_ADDRESS']
14
+ port = ENV['PROXY_PORT']
15
+ username = ENV['PROXY_USERNAME']
16
+ password = ENV['PROXY_PASSWORD']
17
+ return nil if address.nil? || address.strip.empty?
18
+
19
+ new(address: address, port: port, username: username, password: password)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,122 @@
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
+ # **DISCLAIMER: This API or element is use-case specific and not needed for
8
+ # generic usage of our payment product. Please disregard unless otherwise
9
+ # directed to include in your integration.** Returned if result.status == OK
10
+ # and the include-account-profile flag in the request is not explicitly set to
11
+ # false.
12
+ class AccountProfile < BaseModel
13
+ SKIP = Object.new
14
+ private_constant :SKIP
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Array[AccountProfileAttribute]]
18
+ attr_accessor :carrier_data
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Array[AccountProfileAttribute]]
22
+ attr_accessor :local_data
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['carrier_data'] = 'carrier-data'
28
+ @_hash['local_data'] = 'local-data'
29
+ @_hash
30
+ end
31
+
32
+ # An array for optional fields
33
+ def self.optionals
34
+ %w[
35
+ carrier_data
36
+ local_data
37
+ ]
38
+ end
39
+
40
+ # An array for nullable fields
41
+ def self.nullables
42
+ []
43
+ end
44
+
45
+ def initialize(carrier_data = SKIP, local_data = SKIP)
46
+ @carrier_data = carrier_data unless carrier_data == SKIP
47
+ @local_data = local_data unless local_data == SKIP
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ # Parameter is an array, so we need to iterate through it
56
+ carrier_data = nil
57
+ unless hash['carrier-data'].nil?
58
+ carrier_data = []
59
+ hash['carrier-data'].each do |structure|
60
+ carrier_data << (AccountProfileAttribute.from_hash(structure) if structure)
61
+ end
62
+ end
63
+
64
+ carrier_data = SKIP unless hash.key?('carrier-data')
65
+ # Parameter is an array, so we need to iterate through it
66
+ local_data = nil
67
+ unless hash['local-data'].nil?
68
+ local_data = []
69
+ hash['local-data'].each do |structure|
70
+ local_data << (AccountProfileAttribute.from_hash(structure) if structure)
71
+ end
72
+ end
73
+
74
+ local_data = SKIP unless hash.key?('local-data')
75
+
76
+ # Create object from extracted values.
77
+ AccountProfile.new(carrier_data,
78
+ local_data)
79
+ end
80
+
81
+ def self.from_element(root)
82
+ carrier_data = XmlUtilities.from_element_to_array(
83
+ root, 'AccountProfileAttribute', AccountProfileAttribute,
84
+ wrapping_element_name: 'carrier-data'
85
+ )
86
+ local_data = XmlUtilities.from_element_to_array(
87
+ root, 'AccountProfileAttribute', AccountProfileAttribute,
88
+ wrapping_element_name: 'local-data'
89
+ )
90
+
91
+ new(carrier_data,
92
+ local_data)
93
+ end
94
+
95
+ def to_xml_element(doc, root_name)
96
+ root = doc.create_element(root_name)
97
+
98
+ XmlUtilities.add_array_as_subelement(
99
+ doc, root, 'AccountProfileAttribute', carrier_data,
100
+ wrapping_element_name: 'carrier-data'
101
+ )
102
+ XmlUtilities.add_array_as_subelement(doc, root, 'AccountProfileAttribute',
103
+ local_data,
104
+ wrapping_element_name: 'local-data')
105
+
106
+ root
107
+ end
108
+
109
+ # Provides a human-readable string representation of the object.
110
+ def to_s
111
+ class_name = self.class.name.split('::').last
112
+ "<#{class_name} carrier_data: #{@carrier_data}, local_data: #{@local_data}>"
113
+ end
114
+
115
+ # Provides a debugging-friendly string with detailed object information.
116
+ def inspect
117
+ class_name = self.class.name.split('::').last
118
+ "<#{class_name} carrier_data: #{@carrier_data.inspect}, local_data:"\
119
+ " #{@local_data.inspect}>"
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,90 @@
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
+ # **DISCLAIMER: This API or element is use-case specific and not needed for
8
+ # generic usage of our payment product. Please disregard unless otherwise
9
+ # directed to include in your integration.**
10
+ class AccountProfileAttribute < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # TODO: Write general description for this method
15
+ # @return [String]
16
+ attr_accessor :key
17
+
18
+ # TODO: Write general description for this method
19
+ # @return [String]
20
+ attr_accessor :value
21
+
22
+ # A mapping from model property names to API property names.
23
+ def self.names
24
+ @_hash = {} if @_hash.nil?
25
+ @_hash['key'] = 'key'
26
+ @_hash['value'] = 'value'
27
+ @_hash
28
+ end
29
+
30
+ # An array for optional fields
31
+ def self.optionals
32
+ %w[
33
+ key
34
+ value
35
+ ]
36
+ end
37
+
38
+ # An array for nullable fields
39
+ def self.nullables
40
+ []
41
+ end
42
+
43
+ def initialize(key = SKIP, value = SKIP)
44
+ @key = key unless key == SKIP
45
+ @value = value unless value == SKIP
46
+ end
47
+
48
+ # Creates an instance of the object from a hash.
49
+ def self.from_hash(hash)
50
+ return nil unless hash
51
+
52
+ # Extract variables from the hash.
53
+ key = hash.key?('key') ? hash['key'] : SKIP
54
+ value = hash.key?('value') ? hash['value'] : SKIP
55
+
56
+ # Create object from extracted values.
57
+ AccountProfileAttribute.new(key,
58
+ value)
59
+ end
60
+
61
+ def self.from_element(root)
62
+ key = XmlUtilities.from_attribute(root, 'key', String)
63
+ value = XmlUtilities.from_element(root, 'value', String)
64
+
65
+ new(key,
66
+ value)
67
+ end
68
+
69
+ def to_xml_element(doc, root_name)
70
+ root = doc.create_element(root_name)
71
+
72
+ XmlUtilities.add_as_attribute(root, 'key', key)
73
+ XmlUtilities.add_as_subelement(doc, root, 'value', value)
74
+
75
+ root
76
+ end
77
+
78
+ # Provides a human-readable string representation of the object.
79
+ def to_s
80
+ class_name = self.class.name.split('::').last
81
+ "<#{class_name} key: #{@key}, value: #{@value}>"
82
+ end
83
+
84
+ # Provides a debugging-friendly string with detailed object information.
85
+ def inspect
86
+ class_name = self.class.name.split('::').last
87
+ "<#{class_name} key: #{@key.inspect}, value: #{@value.inspect}>"
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,131 @@
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
+ # 'account-profile-request' Request general elements
8
+ class AccountProfileRequest < 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
+ # Container element for a list of account profile selectors.
21
+ # @return [Array[AccountProfileSelector]]
22
+ attr_accessor :selectors
23
+
24
+ # true (default) to include carrier profile data in the response; false only
25
+ # include data local to Boku
26
+ # @return [TrueClass | FalseClass]
27
+ attr_accessor :include_carrier_data
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['country'] = 'country'
33
+ @_hash['merchant_id'] = 'merchant-id'
34
+ @_hash['selectors'] = 'selectors'
35
+ @_hash['include_carrier_data'] = 'include-carrier-data'
36
+ @_hash
37
+ end
38
+
39
+ # An array for optional fields
40
+ def self.optionals
41
+ %w[
42
+ include_carrier_data
43
+ ]
44
+ end
45
+
46
+ # An array for nullable fields
47
+ def self.nullables
48
+ []
49
+ end
50
+
51
+ def initialize(country = nil, merchant_id = nil, selectors = nil,
52
+ include_carrier_data = SKIP)
53
+ @country = country
54
+ @merchant_id = merchant_id
55
+ @selectors = selectors
56
+ @include_carrier_data = include_carrier_data unless include_carrier_data == 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
+ country = hash.key?('country') ? hash['country'] : nil
65
+ merchant_id = hash.key?('merchant-id') ? hash['merchant-id'] : nil
66
+ # Parameter is an array, so we need to iterate through it
67
+ selectors = nil
68
+ unless hash['selectors'].nil?
69
+ selectors = []
70
+ hash['selectors'].each do |structure|
71
+ selectors << (AccountProfileSelector.from_hash(structure) if structure)
72
+ end
73
+ end
74
+
75
+ selectors = nil unless hash.key?('selectors')
76
+ include_carrier_data =
77
+ hash.key?('include-carrier-data') ? hash['include-carrier-data'] : SKIP
78
+
79
+ # Create object from extracted values.
80
+ AccountProfileRequest.new(country,
81
+ merchant_id,
82
+ selectors,
83
+ include_carrier_data)
84
+ end
85
+
86
+ def self.from_element(root)
87
+ country = XmlUtilities.from_element(root, 'country', String)
88
+ merchant_id = XmlUtilities.from_element(root, 'merchant-id', String)
89
+ selectors = XmlUtilities.from_element_to_array(
90
+ root, 'AccountProfileSelector', AccountProfileSelector,
91
+ wrapping_element_name: 'selectors'
92
+ )
93
+ include_carrier_data = XmlUtilities.from_element(root,
94
+ 'include-carrier-data',
95
+ TrueClass)
96
+
97
+ new(country,
98
+ merchant_id,
99
+ selectors,
100
+ include_carrier_data)
101
+ end
102
+
103
+ def to_xml_element(doc, root_name)
104
+ root = doc.create_element(root_name)
105
+
106
+ XmlUtilities.add_as_subelement(doc, root, 'country', country)
107
+ XmlUtilities.add_as_subelement(doc, root, 'merchant-id', merchant_id)
108
+ XmlUtilities.add_array_as_subelement(doc, root, 'AccountProfileSelector',
109
+ selectors,
110
+ wrapping_element_name: 'selectors')
111
+ XmlUtilities.add_as_subelement(doc, root, 'include-carrier-data',
112
+ include_carrier_data)
113
+
114
+ root
115
+ end
116
+
117
+ # Provides a human-readable string representation of the object.
118
+ def to_s
119
+ class_name = self.class.name.split('::').last
120
+ "<#{class_name} country: #{@country}, merchant_id: #{@merchant_id}, selectors:"\
121
+ " #{@selectors}, include_carrier_data: #{@include_carrier_data}>"
122
+ end
123
+
124
+ # Provides a debugging-friendly string with detailed object information.
125
+ def inspect
126
+ class_name = self.class.name.split('::').last
127
+ "<#{class_name} country: #{@country.inspect}, merchant_id: #{@merchant_id.inspect},"\
128
+ " selectors: #{@selectors.inspect}, include_carrier_data: #{@include_carrier_data.inspect}>"
129
+ end
130
+ end
131
+ 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
+ # 'account-profile' Response - General Elements
8
+ class AccountProfileResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The 'result' element is defined in every response type. It is used to
13
+ # convey the outcome of an API request.
14
+ # @return [Result]
15
+ attr_accessor :result
16
+
17
+ # Container element for a list of returned record elements. Provided if
18
+ # result status == OK.
19
+ # @return [Array[AccountProfileResponseRecord]]
20
+ attr_accessor :records
21
+
22
+ # A mapping from model property names to API property names.
23
+ def self.names
24
+ @_hash = {} if @_hash.nil?
25
+ @_hash['result'] = 'result'
26
+ @_hash['records'] = 'records'
27
+ @_hash
28
+ end
29
+
30
+ # An array for optional fields
31
+ def self.optionals
32
+ %w[
33
+ records
34
+ ]
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def self.nullables
39
+ []
40
+ end
41
+
42
+ def initialize(result = nil, records = SKIP)
43
+ @result = result
44
+ @records = records unless records == SKIP
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
+ result = Result.from_hash(hash['result']) if hash['result']
53
+ # Parameter is an array, so we need to iterate through it
54
+ records = nil
55
+ unless hash['records'].nil?
56
+ records = []
57
+ hash['records'].each do |structure|
58
+ records << (AccountProfileResponseRecord.from_hash(structure) if structure)
59
+ end
60
+ end
61
+
62
+ records = SKIP unless hash.key?('records')
63
+
64
+ # Create object from extracted values.
65
+ AccountProfileResponse.new(result,
66
+ records)
67
+ end
68
+
69
+ def self.from_element(root)
70
+ result = XmlUtilities.from_element(root, 'result', Result)
71
+ records = XmlUtilities.from_element_to_array(
72
+ root, 'AccountProfileResponseRecord',
73
+ AccountProfileResponseRecord, wrapping_element_name: 'records'
74
+ )
75
+
76
+ new(result,
77
+ records)
78
+ end
79
+
80
+ def to_xml_element(doc, root_name)
81
+ root = doc.create_element(root_name)
82
+
83
+ XmlUtilities.add_as_subelement(doc, root, 'result', result)
84
+ XmlUtilities.add_array_as_subelement(doc, root,
85
+ 'AccountProfileResponseRecord',
86
+ records,
87
+ wrapping_element_name: 'records')
88
+
89
+ root
90
+ end
91
+
92
+ # Provides a human-readable string representation of the object.
93
+ def to_s
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} result: #{@result}, records: #{@records}>"
96
+ end
97
+
98
+ # Provides a debugging-friendly string with detailed object information.
99
+ def inspect
100
+ class_name = self.class.name.split('::').last
101
+ "<#{class_name} result: #{@result.inspect}, records: #{@records.inspect}>"
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,142 @@
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
+ # Container element for a list of returned record elements. Provided if result
8
+ # status == OK.
9
+ class AccountProfileResponseRecord < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # The status of the operation
14
+ # @return [AccountProfileResultStatusEnum]
15
+ attr_accessor :result
16
+
17
+ # Account Profile Selector - General elements
18
+ # @return [AccountProfileSelector]
19
+ attr_accessor :selector
20
+
21
+ # **DISCLAIMER: This API or element is use-case specific and not needed for
22
+ # generic usage of
23
+ # our payment product. Please disregard unless otherwise directed to include
24
+ # in your integration.**
25
+ # Returned if result.status == OK and the include-account-profile flag in
26
+ # the request is not explicitly set to false.
27
+ # @return [AccountProfile]
28
+ attr_accessor :account_profile
29
+
30
+ # **DISCLAIMER: This API or element is use-case specific and not needed for
31
+ # generic usage of
32
+ # our payment product. Please disregard unless otherwise directed to include
33
+ # in your integration.**
34
+ # Returned if result.status == OK and the include-account-profile flag in
35
+ # the request is not explicitly set to false.
36
+ # @return [String]
37
+ attr_accessor :optin_id
38
+
39
+ # Gives the state of the opt-in at the time this response was returned
40
+ # @return [OptinState]
41
+ attr_accessor :optin_state
42
+
43
+ # A mapping from model property names to API property names.
44
+ def self.names
45
+ @_hash = {} if @_hash.nil?
46
+ @_hash['result'] = 'result'
47
+ @_hash['selector'] = 'selector'
48
+ @_hash['account_profile'] = 'account-profile'
49
+ @_hash['optin_id'] = 'optin-id'
50
+ @_hash['optin_state'] = 'optin-state'
51
+ @_hash
52
+ end
53
+
54
+ # An array for optional fields
55
+ def self.optionals
56
+ %w[
57
+ account_profile
58
+ optin_id
59
+ optin_state
60
+ ]
61
+ end
62
+
63
+ # An array for nullable fields
64
+ def self.nullables
65
+ []
66
+ end
67
+
68
+ def initialize(result = nil, selector = nil, account_profile = SKIP,
69
+ optin_id = SKIP, optin_state = SKIP)
70
+ @result = result
71
+ @selector = selector
72
+ @account_profile = account_profile unless account_profile == SKIP
73
+ @optin_id = optin_id unless optin_id == SKIP
74
+ @optin_state = optin_state unless optin_state == SKIP
75
+ end
76
+
77
+ # Creates an instance of the object from a hash.
78
+ def self.from_hash(hash)
79
+ return nil unless hash
80
+
81
+ # Extract variables from the hash.
82
+ result = hash.key?('result') ? hash['result'] : nil
83
+ selector = AccountProfileSelector.from_hash(hash['selector']) if hash['selector']
84
+ account_profile = AccountProfile.from_hash(hash['account-profile']) if
85
+ hash['account-profile']
86
+ optin_id = hash.key?('optin-id') ? hash['optin-id'] : SKIP
87
+ optin_state = OptinState.from_hash(hash['optin-state']) if hash['optin-state']
88
+
89
+ # Create object from extracted values.
90
+ AccountProfileResponseRecord.new(result,
91
+ selector,
92
+ account_profile,
93
+ optin_id,
94
+ optin_state)
95
+ end
96
+
97
+ def self.from_element(root)
98
+ result = XmlUtilities.from_element(root, 'result', String)
99
+ selector = XmlUtilities.from_element(root, 'AccountProfileSelector',
100
+ AccountProfileSelector)
101
+ account_profile = XmlUtilities.from_element(root, 'AccountProfile',
102
+ AccountProfile)
103
+ optin_id = XmlUtilities.from_element(root, 'optin-id', String)
104
+ optin_state = XmlUtilities.from_element(root, 'optin-state', OptinState)
105
+
106
+ new(result,
107
+ selector,
108
+ account_profile,
109
+ optin_id,
110
+ optin_state)
111
+ end
112
+
113
+ def to_xml_element(doc, root_name)
114
+ root = doc.create_element(root_name)
115
+
116
+ XmlUtilities.add_as_subelement(doc, root, 'result', result)
117
+ XmlUtilities.add_as_subelement(doc, root, 'AccountProfileSelector',
118
+ selector)
119
+ XmlUtilities.add_as_subelement(doc, root, 'AccountProfile',
120
+ account_profile)
121
+ XmlUtilities.add_as_subelement(doc, root, 'optin-id', optin_id)
122
+ XmlUtilities.add_as_subelement(doc, root, 'optin-state', optin_state)
123
+
124
+ root
125
+ end
126
+
127
+ # Provides a human-readable string representation of the object.
128
+ def to_s
129
+ class_name = self.class.name.split('::').last
130
+ "<#{class_name} result: #{@result}, selector: #{@selector}, account_profile:"\
131
+ " #{@account_profile}, optin_id: #{@optin_id}, optin_state: #{@optin_state}>"
132
+ end
133
+
134
+ # Provides a debugging-friendly string with detailed object information.
135
+ def inspect
136
+ class_name = self.class.name.split('::').last
137
+ "<#{class_name} result: #{@result.inspect}, selector: #{@selector.inspect},"\
138
+ " account_profile: #{@account_profile.inspect}, optin_id: #{@optin_id.inspect}, optin_state:"\
139
+ " #{@optin_state.inspect}>"
140
+ end
141
+ end
142
+ end