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