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,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
+ # Describes an SMS to be sent from the client device.
8
+ class SendSms < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Destination address (short-code or phone number) to send the message to
13
+ # @return [String]
14
+ attr_accessor :destination
15
+
16
+ # Body of the message to be sent, containing placeholders that must be
17
+ # replaced before using
18
+ # @return [String]
19
+ attr_accessor :value
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['destination'] = 'destination'
25
+ @_hash['value'] = 'value'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ %w[
32
+ destination
33
+ value
34
+ ]
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def self.nullables
39
+ []
40
+ end
41
+
42
+ def initialize(destination = SKIP, value = SKIP)
43
+ @destination = destination unless destination == SKIP
44
+ @value = value unless value == 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
+ destination = hash.key?('destination') ? hash['destination'] : SKIP
53
+ value = hash.key?('value') ? hash['value'] : SKIP
54
+
55
+ # Create object from extracted values.
56
+ SendSms.new(destination,
57
+ value)
58
+ end
59
+
60
+ def self.from_element(root)
61
+ destination = XmlUtilities.from_attribute(root, 'destination', String)
62
+ value = XmlUtilities.from_element(root, 'value', String)
63
+
64
+ new(destination,
65
+ value)
66
+ end
67
+
68
+ def to_xml_element(doc, root_name)
69
+ root = doc.create_element(root_name)
70
+
71
+ XmlUtilities.add_as_attribute(root, 'destination', destination)
72
+ XmlUtilities.add_as_subelement(doc, root, 'value', value)
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} destination: #{@destination}, value: #{@value}>"
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} destination: #{@destination.inspect}, value: #{@value.inspect}>"
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,126 @@
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.** Element containing settlement
10
+ # information about the original charge.
11
+ class Settlement < BaseModel
12
+ SKIP = Object.new
13
+ private_constant :SKIP
14
+
15
+ # Merchant-supplied identifier used to route funds to the appropriate
16
+ # settlement bank account for the transaction.
17
+ # @return [String]
18
+ attr_accessor :account_id
19
+
20
+ # ISO 4217 three-letter settlement currency code.
21
+ # @return [String]
22
+ attr_accessor :currency
23
+
24
+ # This is the exchange rate that is used to calculate the gross merchant
25
+ # amount.
26
+ # gross merchant amount = local currency (charge amount) * exchange rate
27
+ # @return [Float]
28
+ attr_accessor :exchange_rate
29
+
30
+ # Gross transaction amount converted to desired settlement currency
31
+ # @return [Float]
32
+ attr_accessor :gross_merchant_amount
33
+
34
+ # A mapping from model property names to API property names.
35
+ def self.names
36
+ @_hash = {} if @_hash.nil?
37
+ @_hash['account_id'] = 'account-id'
38
+ @_hash['currency'] = 'currency'
39
+ @_hash['exchange_rate'] = 'exchange-rate'
40
+ @_hash['gross_merchant_amount'] = 'gross-merchant-amount'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ %w[
47
+ account_id
48
+ currency
49
+ exchange_rate
50
+ gross_merchant_amount
51
+ ]
52
+ end
53
+
54
+ # An array for nullable fields
55
+ def self.nullables
56
+ []
57
+ end
58
+
59
+ def initialize(account_id = SKIP, currency = SKIP, exchange_rate = SKIP,
60
+ gross_merchant_amount = SKIP)
61
+ @account_id = account_id unless account_id == SKIP
62
+ @currency = currency unless currency == SKIP
63
+ @exchange_rate = exchange_rate unless exchange_rate == SKIP
64
+ @gross_merchant_amount = gross_merchant_amount unless gross_merchant_amount == SKIP
65
+ end
66
+
67
+ # Creates an instance of the object from a hash.
68
+ def self.from_hash(hash)
69
+ return nil unless hash
70
+
71
+ # Extract variables from the hash.
72
+ account_id = hash.key?('account-id') ? hash['account-id'] : SKIP
73
+ currency = hash.key?('currency') ? hash['currency'] : SKIP
74
+ exchange_rate = hash.key?('exchange-rate') ? hash['exchange-rate'] : SKIP
75
+ gross_merchant_amount =
76
+ hash.key?('gross-merchant-amount') ? hash['gross-merchant-amount'] : SKIP
77
+
78
+ # Create object from extracted values.
79
+ Settlement.new(account_id,
80
+ currency,
81
+ exchange_rate,
82
+ gross_merchant_amount)
83
+ end
84
+
85
+ def self.from_element(root)
86
+ account_id = XmlUtilities.from_element(root, 'account-id', String)
87
+ currency = XmlUtilities.from_element(root, 'currency', String)
88
+ exchange_rate = XmlUtilities.from_element(root, 'exchange-rate', Float)
89
+ gross_merchant_amount = XmlUtilities.from_element(root,
90
+ 'gross-merchant-amount',
91
+ Float)
92
+
93
+ new(account_id,
94
+ currency,
95
+ exchange_rate,
96
+ gross_merchant_amount)
97
+ end
98
+
99
+ def to_xml_element(doc, root_name)
100
+ root = doc.create_element(root_name)
101
+
102
+ XmlUtilities.add_as_subelement(doc, root, 'account-id', account_id)
103
+ XmlUtilities.add_as_subelement(doc, root, 'currency', currency)
104
+ XmlUtilities.add_as_subelement(doc, root, 'exchange-rate', exchange_rate)
105
+ XmlUtilities.add_as_subelement(doc, root, 'gross-merchant-amount',
106
+ gross_merchant_amount)
107
+
108
+ root
109
+ end
110
+
111
+ # Provides a human-readable string representation of the object.
112
+ def to_s
113
+ class_name = self.class.name.split('::').last
114
+ "<#{class_name} account_id: #{@account_id}, currency: #{@currency}, exchange_rate:"\
115
+ " #{@exchange_rate}, gross_merchant_amount: #{@gross_merchant_amount}>"
116
+ end
117
+
118
+ # Provides a debugging-friendly string with detailed object information.
119
+ def inspect
120
+ class_name = self.class.name.split('::').last
121
+ "<#{class_name} account_id: #{@account_id.inspect}, currency: #{@currency.inspect},"\
122
+ " exchange_rate: #{@exchange_rate.inspect}, gross_merchant_amount:"\
123
+ " #{@gross_merchant_amount.inspect}>"
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,78 @@
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.** Indicates that this network
10
+ # supports "silent MO" based opt-in verification, and gives instructions on
11
+ # the MO to send.
12
+ class SilentMo < BaseModel
13
+ SKIP = Object.new
14
+ private_constant :SKIP
15
+
16
+ # Describes an SMS to be sent from the client device.
17
+ # @return [SendSms]
18
+ attr_accessor :send_sms
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['send_sms'] = 'send-sms'
24
+ @_hash
25
+ end
26
+
27
+ # An array for optional fields
28
+ def self.optionals
29
+ []
30
+ end
31
+
32
+ # An array for nullable fields
33
+ def self.nullables
34
+ []
35
+ end
36
+
37
+ def initialize(send_sms = nil)
38
+ @send_sms = send_sms
39
+ end
40
+
41
+ # Creates an instance of the object from a hash.
42
+ def self.from_hash(hash)
43
+ return nil unless hash
44
+
45
+ # Extract variables from the hash.
46
+ send_sms = SendSms.from_hash(hash['send-sms']) if hash['send-sms']
47
+
48
+ # Create object from extracted values.
49
+ SilentMo.new(send_sms)
50
+ end
51
+
52
+ def self.from_element(root)
53
+ send_sms = XmlUtilities.from_element(root, 'SendSms', SendSms)
54
+
55
+ new(send_sms)
56
+ end
57
+
58
+ def to_xml_element(doc, root_name)
59
+ root = doc.create_element(root_name)
60
+
61
+ XmlUtilities.add_as_subelement(doc, root, 'SendSms', send_sms)
62
+
63
+ root
64
+ end
65
+
66
+ # Provides a human-readable string representation of the object.
67
+ def to_s
68
+ class_name = self.class.name.split('::').last
69
+ "<#{class_name} send_sms: #{@send_sms}>"
70
+ end
71
+
72
+ # Provides a debugging-friendly string with detailed object information.
73
+ def inspect
74
+ class_name = self.class.name.split('::').last
75
+ "<#{class_name} send_sms: #{@send_sms.inspect}>"
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,40 @@
1
+ # boku_direct_payments_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module BokuDirectPaymentsApi
7
+ # Status.
8
+ class StatusEnum
9
+ STATUS_ENUM = [
10
+ # TODO: Write general description for APPROVED
11
+ APPROVED = 'approved'.freeze,
12
+
13
+ # TODO: Write general description for PENDING
14
+ PENDING = 'pending'.freeze,
15
+
16
+ # TODO: Write general description for DISABLED
17
+ DISABLED = 'disabled'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ STATUS_ENUM.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = APPROVED)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'approved' then APPROVED
33
+ when 'pending' then PENDING
34
+ when 'disabled' then DISABLED
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,105 @@
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
+ # Subscription Model.
8
+ class Subscription < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # True if the charge is for a subscription, false otherwise
13
+ # @return [TrueClass | FalseClass]
14
+ attr_accessor :is_subscription
15
+
16
+ # The period of the subscription (at which interval the consumer is being
17
+ # charged)
18
+ # @return [Period]
19
+ attr_accessor :period
20
+
21
+ # False if this is the first charge in a subscription, true if the charge is
22
+ # a renewal (second period onwards)
23
+ # @return [TrueClass | FalseClass]
24
+ attr_accessor :renewal
25
+
26
+ # A mapping from model property names to API property names.
27
+ def self.names
28
+ @_hash = {} if @_hash.nil?
29
+ @_hash['is_subscription'] = 'is-subscription'
30
+ @_hash['period'] = 'period'
31
+ @_hash['renewal'] = 'renewal'
32
+ @_hash
33
+ end
34
+
35
+ # An array for optional fields
36
+ def self.optionals
37
+ %w[
38
+ period
39
+ renewal
40
+ ]
41
+ end
42
+
43
+ # An array for nullable fields
44
+ def self.nullables
45
+ []
46
+ end
47
+
48
+ def initialize(is_subscription = nil, period = SKIP, renewal = SKIP)
49
+ @is_subscription = is_subscription
50
+ @period = period unless period == SKIP
51
+ @renewal = renewal unless renewal == SKIP
52
+ end
53
+
54
+ # Creates an instance of the object from a hash.
55
+ def self.from_hash(hash)
56
+ return nil unless hash
57
+
58
+ # Extract variables from the hash.
59
+ is_subscription =
60
+ hash.key?('is-subscription') ? hash['is-subscription'] : nil
61
+ period = Period.from_hash(hash['period']) if hash['period']
62
+ renewal = hash.key?('renewal') ? hash['renewal'] : SKIP
63
+
64
+ # Create object from extracted values.
65
+ Subscription.new(is_subscription,
66
+ period,
67
+ renewal)
68
+ end
69
+
70
+ def self.from_element(root)
71
+ is_subscription = XmlUtilities.from_attribute(root, 'is-subscription',
72
+ TrueClass)
73
+ period = XmlUtilities.from_element(root, 'period', Period)
74
+ renewal = XmlUtilities.from_element(root, 'renewal', TrueClass)
75
+
76
+ new(is_subscription,
77
+ period,
78
+ renewal)
79
+ end
80
+
81
+ def to_xml_element(doc, root_name)
82
+ root = doc.create_element(root_name)
83
+
84
+ XmlUtilities.add_as_attribute(root, 'is-subscription', is_subscription)
85
+ XmlUtilities.add_as_subelement(doc, root, 'period', period)
86
+ XmlUtilities.add_as_subelement(doc, root, 'renewal', renewal)
87
+
88
+ root
89
+ end
90
+
91
+ # Provides a human-readable string representation of the object.
92
+ def to_s
93
+ class_name = self.class.name.split('::').last
94
+ "<#{class_name} is_subscription: #{@is_subscription}, period: #{@period}, renewal:"\
95
+ " #{@renewal}>"
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} is_subscription: #{@is_subscription.inspect}, period: #{@period.inspect},"\
102
+ " renewal: #{@renewal.inspect}>"
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,75 @@
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
+ # Specifies how long to block waiting for a response
8
+ class Timeout < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Maximum time to block before returning a response, in milliseconds. The
13
+ # value `0` means do not block, and there is no way to specify infinity.
14
+ # @return [Integer]
15
+ attr_accessor :after
16
+
17
+ # A mapping from model property names to API property names.
18
+ def self.names
19
+ @_hash = {} if @_hash.nil?
20
+ @_hash['after'] = 'after'
21
+ @_hash
22
+ end
23
+
24
+ # An array for optional fields
25
+ def self.optionals
26
+ []
27
+ end
28
+
29
+ # An array for nullable fields
30
+ def self.nullables
31
+ []
32
+ end
33
+
34
+ def initialize(after = 0)
35
+ @after = after
36
+ end
37
+
38
+ # Creates an instance of the object from a hash.
39
+ def self.from_hash(hash)
40
+ return nil unless hash
41
+
42
+ # Extract variables from the hash.
43
+ after = hash['after'] ||= 0
44
+
45
+ # Create object from extracted values.
46
+ Timeout.new(after)
47
+ end
48
+
49
+ def self.from_element(root)
50
+ after = XmlUtilities.from_attribute(root, 'after', Integer)
51
+
52
+ new(after)
53
+ end
54
+
55
+ def to_xml_element(doc, root_name)
56
+ root = doc.create_element(root_name)
57
+
58
+ XmlUtilities.add_as_attribute(root, 'after', after)
59
+
60
+ root
61
+ end
62
+
63
+ # Provides a human-readable string representation of the object.
64
+ def to_s
65
+ class_name = self.class.name.split('::').last
66
+ "<#{class_name} after: #{@after}>"
67
+ end
68
+
69
+ # Provides a debugging-friendly string with detailed object information.
70
+ def inspect
71
+ class_name = self.class.name.split('::').last
72
+ "<#{class_name} after: #{@after.inspect}>"
73
+ end
74
+ end
75
+ 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
+ # Type.
8
+ class TypeEnum
9
+ TYPE_ENUM = [
10
+ # TODO: Write general description for QRCONTENT
11
+ QRCONTENT = 'qr-content'.freeze,
12
+
13
+ # TODO: Write general description for QRIMAGELINK
14
+ QRIMAGELINK = 'qr-image-link'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ TYPE_ENUM.include?(value)
21
+ end
22
+
23
+ def self.from_value(value, default_value = QRCONTENT)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'qrcontent' then QRCONTENT
30
+ when 'qrimagelink' then QRIMAGELINK
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end