splitit-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 (87) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +154 -0
  4. data/bin/console +15 -0
  5. data/lib/splitit_web_api_v4/api_helper.rb +10 -0
  6. data/lib/splitit_web_api_v4/client.rb +83 -0
  7. data/lib/splitit_web_api_v4/configuration.rb +188 -0
  8. data/lib/splitit_web_api_v4/controllers/base_controller.rb +60 -0
  9. data/lib/splitit_web_api_v4/controllers/installment_plan_controller.rb +242 -0
  10. data/lib/splitit_web_api_v4/controllers/o_auth_authorization_controller.rb +42 -0
  11. data/lib/splitit_web_api_v4/exceptions/api_error_response_exception.rb +51 -0
  12. data/lib/splitit_web_api_v4/exceptions/api_exception.rb +21 -0
  13. data/lib/splitit_web_api_v4/exceptions/o_auth_provider_exception.rb +64 -0
  14. data/lib/splitit_web_api_v4/http/auth/api_key.rb +52 -0
  15. data/lib/splitit_web_api_v4/http/auth/o_auth2.rb +156 -0
  16. data/lib/splitit_web_api_v4/http/http_call_back.rb +10 -0
  17. data/lib/splitit_web_api_v4/http/http_method_enum.rb +10 -0
  18. data/lib/splitit_web_api_v4/http/http_request.rb +10 -0
  19. data/lib/splitit_web_api_v4/http/http_response.rb +10 -0
  20. data/lib/splitit_web_api_v4/http/proxy_settings.rb +22 -0
  21. data/lib/splitit_web_api_v4/models/amount_data.rb +70 -0
  22. data/lib/splitit_web_api_v4/models/api_error_model.rb +93 -0
  23. data/lib/splitit_web_api_v4/models/apr_data.rb +70 -0
  24. data/lib/splitit_web_api_v4/models/authorization_status_enum.rb +40 -0
  25. data/lib/splitit_web_api_v4/models/authorize_authorization_data.rb +154 -0
  26. data/lib/splitit_web_api_v4/models/authorize_request.rb +115 -0
  27. data/lib/splitit_web_api_v4/models/authorize_response.rb +221 -0
  28. data/lib/splitit_web_api_v4/models/base_model.rb +110 -0
  29. data/lib/splitit_web_api_v4/models/billing_address_data.rb +111 -0
  30. data/lib/splitit_web_api_v4/models/card_details.rb +108 -0
  31. data/lib/splitit_web_api_v4/models/card_validity_request.rb +62 -0
  32. data/lib/splitit_web_api_v4/models/card_validity_response.rb +80 -0
  33. data/lib/splitit_web_api_v4/models/checkout_url_data.rb +80 -0
  34. data/lib/splitit_web_api_v4/models/content_segment.rb +90 -0
  35. data/lib/splitit_web_api_v4/models/external_provider_types_enum.rb +48 -0
  36. data/lib/splitit_web_api_v4/models/inline_content.rb +71 -0
  37. data/lib/splitit_web_api_v4/models/installment_item.rb +101 -0
  38. data/lib/splitit_web_api_v4/models/installment_plan_details_response.rb +280 -0
  39. data/lib/splitit_web_api_v4/models/installment_plan_search_details_response.rb +71 -0
  40. data/lib/splitit_web_api_v4/models/installment_plan_search_request.rb +79 -0
  41. data/lib/splitit_web_api_v4/models/installment_plan_status_enum.rb +72 -0
  42. data/lib/splitit_web_api_v4/models/installment_status_enum.rb +60 -0
  43. data/lib/splitit_web_api_v4/models/masked_card_details.rb +82 -0
  44. data/lib/splitit_web_api_v4/models/metadata_item.rb +71 -0
  45. data/lib/splitit_web_api_v4/models/o_auth_provider_error_enum.rb +62 -0
  46. data/lib/splitit_web_api_v4/models/o_auth_scope_o_auth2_enum.rb +26 -0
  47. data/lib/splitit_web_api_v4/models/o_auth_token.rb +96 -0
  48. data/lib/splitit_web_api_v4/models/offer_item.rb +164 -0
  49. data/lib/splitit_web_api_v4/models/offers_billing_address.rb +108 -0
  50. data/lib/splitit_web_api_v4/models/offers_card_details.rb +108 -0
  51. data/lib/splitit_web_api_v4/models/offers_merchant_details.rb +82 -0
  52. data/lib/splitit_web_api_v4/models/offers_payment_method.rb +66 -0
  53. data/lib/splitit_web_api_v4/models/offers_payment_method_response.rb +88 -0
  54. data/lib/splitit_web_api_v4/models/offers_request.rb +145 -0
  55. data/lib/splitit_web_api_v4/models/offers_response.rb +156 -0
  56. data/lib/splitit_web_api_v4/models/offers_shopper_details.rb +112 -0
  57. data/lib/splitit_web_api_v4/models/offers_store_location.rb +108 -0
  58. data/lib/splitit_web_api_v4/models/payment_link_request.rb +195 -0
  59. data/lib/splitit_web_api_v4/models/payment_link_response.rb +107 -0
  60. data/lib/splitit_web_api_v4/models/payment_method.rb +66 -0
  61. data/lib/splitit_web_api_v4/models/payment_method_data.rb +78 -0
  62. data/lib/splitit_web_api_v4/models/payment_method_type_enum.rb +26 -0
  63. data/lib/splitit_web_api_v4/models/pis_error_codes_enum.rb +1021 -0
  64. data/lib/splitit_web_api_v4/models/plan_authorization_data.rb +172 -0
  65. data/lib/splitit_web_api_v4/models/plan_links_data.rb +91 -0
  66. data/lib/splitit_web_api_v4/models/plan_status_enum.rb +48 -0
  67. data/lib/splitit_web_api_v4/models/processing_data.rb +63 -0
  68. data/lib/splitit_web_api_v4/models/purchase_method_enum.rb +52 -0
  69. data/lib/splitit_web_api_v4/models/redirect_urls.rb +81 -0
  70. data/lib/splitit_web_api_v4/models/refund_item.rb +136 -0
  71. data/lib/splitit_web_api_v4/models/refund_request.rb +70 -0
  72. data/lib/splitit_web_api_v4/models/refund_response.rb +105 -0
  73. data/lib/splitit_web_api_v4/models/shipping_status_enum.rb +40 -0
  74. data/lib/splitit_web_api_v4/models/shopper_details_data.rb +113 -0
  75. data/lib/splitit_web_api_v4/models/three_ds_authentication_data.rb +90 -0
  76. data/lib/splitit_web_api_v4/models/three_ds_execute.rb +62 -0
  77. data/lib/splitit_web_api_v4/models/three_ds_redirect_data.rb +93 -0
  78. data/lib/splitit_web_api_v4/models/three_ds_request_data.rb +84 -0
  79. data/lib/splitit_web_api_v4/models/update_offers_payment_method.rb +66 -0
  80. data/lib/splitit_web_api_v4/models/update_offers_request.rb +105 -0
  81. data/lib/splitit_web_api_v4/models/update_order_request.rb +104 -0
  82. data/lib/splitit_web_api_v4/models/update_order_response.rb +126 -0
  83. data/lib/splitit_web_api_v4/models/validation_error.rb +71 -0
  84. data/lib/splitit_web_api_v4/utilities/date_time_helper.rb +11 -0
  85. data/lib/splitit_web_api_v4/utilities/file_wrapper.rb +28 -0
  86. data/lib/splitit_web_api_v4.rb +108 -0
  87. metadata +170 -0
@@ -0,0 +1,172 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module SplititWebApiV4
8
+ # PlanAuthorizationData Model.
9
+ class PlanAuthorizationData < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [AuthorizationStatusEnum]
15
+ attr_accessor :status
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [DateTime]
19
+ attr_accessor :date
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :splitit_error_result_code
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :gateway_transaction_id
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [String]
31
+ attr_accessor :gateway_result_code
32
+
33
+ # TODO: Write general description for this method
34
+ # @return [String]
35
+ attr_accessor :gateway_result_message
36
+
37
+ # TODO: Write general description for this method
38
+ # @return [ThreeDSRedirectData]
39
+ attr_accessor :three_ds_redirect
40
+
41
+ # TODO: Write general description for this method
42
+ # @return [String]
43
+ attr_accessor :cavv
44
+
45
+ # TODO: Write general description for this method
46
+ # @return [String]
47
+ attr_accessor :eci
48
+
49
+ # TODO: Write general description for this method
50
+ # @return [String]
51
+ attr_accessor :gateway_source_response
52
+
53
+ # A mapping from model property names to API property names.
54
+ def self.names
55
+ @_hash = {} if @_hash.nil?
56
+ @_hash['status'] = 'Status'
57
+ @_hash['date'] = 'Date'
58
+ @_hash['splitit_error_result_code'] = 'SplititErrorResultCode'
59
+ @_hash['gateway_transaction_id'] = 'GatewayTransactionID'
60
+ @_hash['gateway_result_code'] = 'GatewayResultCode'
61
+ @_hash['gateway_result_message'] = 'GatewayResultMessage'
62
+ @_hash['three_ds_redirect'] = 'ThreeDSRedirect'
63
+ @_hash['cavv'] = 'CAVV'
64
+ @_hash['eci'] = 'ECI'
65
+ @_hash['gateway_source_response'] = 'GatewaySourceResponse'
66
+ @_hash
67
+ end
68
+
69
+ # An array for optional fields
70
+ def self.optionals
71
+ %w[
72
+ date
73
+ splitit_error_result_code
74
+ gateway_transaction_id
75
+ gateway_result_code
76
+ gateway_result_message
77
+ three_ds_redirect
78
+ cavv
79
+ eci
80
+ gateway_source_response
81
+ ]
82
+ end
83
+
84
+ # An array for nullable fields
85
+ def self.nullables
86
+ []
87
+ end
88
+
89
+ def initialize(status = nil, date = SKIP, splitit_error_result_code = SKIP,
90
+ gateway_transaction_id = SKIP, gateway_result_code = SKIP,
91
+ gateway_result_message = SKIP, three_ds_redirect = SKIP,
92
+ cavv = SKIP, eci = SKIP, gateway_source_response = SKIP)
93
+ @status = status
94
+ @date = date unless date == SKIP
95
+ unless splitit_error_result_code == SKIP
96
+ @splitit_error_result_code =
97
+ splitit_error_result_code
98
+ end
99
+ @gateway_transaction_id = gateway_transaction_id unless gateway_transaction_id == SKIP
100
+ @gateway_result_code = gateway_result_code unless gateway_result_code == SKIP
101
+ @gateway_result_message = gateway_result_message unless gateway_result_message == SKIP
102
+ @three_ds_redirect = three_ds_redirect unless three_ds_redirect == SKIP
103
+ @cavv = cavv unless cavv == SKIP
104
+ @eci = eci unless eci == SKIP
105
+ @gateway_source_response = gateway_source_response unless gateway_source_response == SKIP
106
+ end
107
+
108
+ # Creates an instance of the object from a hash.
109
+ def self.from_hash(hash)
110
+ return nil unless hash
111
+
112
+ # Extract variables from the hash.
113
+ status = hash.key?('Status') ? hash['Status'] : nil
114
+ date = if hash.key?('Date')
115
+ (DateTimeHelper.from_rfc3339(hash['Date']) if hash['Date'])
116
+ else
117
+ SKIP
118
+ end
119
+ splitit_error_result_code =
120
+ hash.key?('SplititErrorResultCode') ? hash['SplititErrorResultCode'] : SKIP
121
+ gateway_transaction_id =
122
+ hash.key?('GatewayTransactionID') ? hash['GatewayTransactionID'] : SKIP
123
+ gateway_result_code =
124
+ hash.key?('GatewayResultCode') ? hash['GatewayResultCode'] : SKIP
125
+ gateway_result_message =
126
+ hash.key?('GatewayResultMessage') ? hash['GatewayResultMessage'] : SKIP
127
+ three_ds_redirect = ThreeDSRedirectData.from_hash(hash['ThreeDSRedirect']) if
128
+ hash['ThreeDSRedirect']
129
+ cavv = hash.key?('CAVV') ? hash['CAVV'] : SKIP
130
+ eci = hash.key?('ECI') ? hash['ECI'] : SKIP
131
+ gateway_source_response =
132
+ hash.key?('GatewaySourceResponse') ? hash['GatewaySourceResponse'] : SKIP
133
+
134
+ # Create object from extracted values.
135
+ PlanAuthorizationData.new(status,
136
+ date,
137
+ splitit_error_result_code,
138
+ gateway_transaction_id,
139
+ gateway_result_code,
140
+ gateway_result_message,
141
+ three_ds_redirect,
142
+ cavv,
143
+ eci,
144
+ gateway_source_response)
145
+ end
146
+
147
+ def to_custom_date
148
+ DateTimeHelper.to_rfc3339(date)
149
+ end
150
+
151
+ # Provides a human-readable string representation of the object.
152
+ def to_s
153
+ class_name = self.class.name.split('::').last
154
+ "<#{class_name} status: #{@status}, date: #{@date}, splitit_error_result_code:"\
155
+ " #{@splitit_error_result_code}, gateway_transaction_id: #{@gateway_transaction_id},"\
156
+ " gateway_result_code: #{@gateway_result_code}, gateway_result_message:"\
157
+ " #{@gateway_result_message}, three_ds_redirect: #{@three_ds_redirect}, cavv: #{@cavv}, eci:"\
158
+ " #{@eci}, gateway_source_response: #{@gateway_source_response}>"
159
+ end
160
+
161
+ # Provides a debugging-friendly string with detailed object information.
162
+ def inspect
163
+ class_name = self.class.name.split('::').last
164
+ "<#{class_name} status: #{@status.inspect}, date: #{@date.inspect},"\
165
+ " splitit_error_result_code: #{@splitit_error_result_code.inspect}, gateway_transaction_id:"\
166
+ " #{@gateway_transaction_id.inspect}, gateway_result_code: #{@gateway_result_code.inspect},"\
167
+ " gateway_result_message: #{@gateway_result_message.inspect}, three_ds_redirect:"\
168
+ " #{@three_ds_redirect.inspect}, cavv: #{@cavv.inspect}, eci: #{@eci.inspect},"\
169
+ " gateway_source_response: #{@gateway_source_response.inspect}>"
170
+ end
171
+ end
172
+ end
@@ -0,0 +1,91 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # PlanLinksData Model.
8
+ class PlanLinksData < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :key
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :label
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :value
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :description
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['key'] = 'Key'
32
+ @_hash['label'] = 'Label'
33
+ @_hash['value'] = 'Value'
34
+ @_hash['description'] = 'Description'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ key
42
+ label
43
+ value
44
+ description
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def self.nullables
50
+ []
51
+ end
52
+
53
+ def initialize(key = SKIP, label = SKIP, value = SKIP, description = SKIP)
54
+ @key = key unless key == SKIP
55
+ @label = label unless label == SKIP
56
+ @value = value unless value == SKIP
57
+ @description = description unless description == SKIP
58
+ end
59
+
60
+ # Creates an instance of the object from a hash.
61
+ def self.from_hash(hash)
62
+ return nil unless hash
63
+
64
+ # Extract variables from the hash.
65
+ key = hash.key?('Key') ? hash['Key'] : SKIP
66
+ label = hash.key?('Label') ? hash['Label'] : SKIP
67
+ value = hash.key?('Value') ? hash['Value'] : SKIP
68
+ description = hash.key?('Description') ? hash['Description'] : SKIP
69
+
70
+ # Create object from extracted values.
71
+ PlanLinksData.new(key,
72
+ label,
73
+ value,
74
+ description)
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} key: #{@key}, label: #{@label}, value: #{@value}, description:"\
81
+ " #{@description}>"
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}, label: #{@label.inspect}, value: #{@value.inspect},"\
88
+ " description: #{@description.inspect}>"
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,48 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # PlanStatus.
8
+ class PlanStatusEnum
9
+ PLAN_STATUS_ENUM = [
10
+ # TODO: Write general description for INITIALIZED
11
+ INITIALIZED = 'Initialized'.freeze,
12
+
13
+ # TODO: Write general description for PENDINGCAPTURE
14
+ PENDINGCAPTURE = 'PendingCapture'.freeze,
15
+
16
+ # TODO: Write general description for ACTIVE
17
+ ACTIVE = 'Active'.freeze,
18
+
19
+ # TODO: Write general description for CLEARED
20
+ CLEARED = 'Cleared'.freeze,
21
+
22
+ # TODO: Write general description for CANCELED
23
+ CANCELED = 'Canceled'.freeze
24
+ ].freeze
25
+
26
+ def self.validate(value)
27
+ return false if value.nil?
28
+
29
+ PLAN_STATUS_ENUM.include?(value)
30
+ end
31
+
32
+ def self.from_value(value, default_value = INITIALIZED)
33
+ return default_value if value.nil?
34
+
35
+ str = value.to_s.strip
36
+
37
+ case str.downcase
38
+ when 'initialized' then INITIALIZED
39
+ when 'pendingcapture' then PENDINGCAPTURE
40
+ when 'active' then ACTIVE
41
+ when 'cleared' then CLEARED
42
+ when 'canceled' then CANCELED
43
+ else
44
+ default_value
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,63 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # ProcessingData Model.
8
+ class ProcessingData < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :soft_descriptor
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['soft_descriptor'] = 'SoftDescriptor'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ soft_descriptor
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(soft_descriptor = SKIP)
36
+ @soft_descriptor = soft_descriptor unless soft_descriptor == SKIP
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
+ soft_descriptor =
45
+ hash.key?('SoftDescriptor') ? hash['SoftDescriptor'] : SKIP
46
+
47
+ # Create object from extracted values.
48
+ ProcessingData.new(soft_descriptor)
49
+ end
50
+
51
+ # Provides a human-readable string representation of the object.
52
+ def to_s
53
+ class_name = self.class.name.split('::').last
54
+ "<#{class_name} soft_descriptor: #{@soft_descriptor}>"
55
+ end
56
+
57
+ # Provides a debugging-friendly string with detailed object information.
58
+ def inspect
59
+ class_name = self.class.name.split('::').last
60
+ "<#{class_name} soft_descriptor: #{@soft_descriptor.inspect}>"
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,52 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # PurchaseMethod.
8
+ class PurchaseMethodEnum
9
+ PURCHASE_METHOD_ENUM = [
10
+ # TODO: Write general description for INSTORE
11
+ INSTORE = 'InStore'.freeze,
12
+
13
+ # TODO: Write general description for PHONEORDER
14
+ PHONEORDER = 'PhoneOrder'.freeze,
15
+
16
+ # TODO: Write general description for ECOMMERCE
17
+ ECOMMERCE = 'ECommerce'.freeze,
18
+
19
+ # TODO: Write general description for MOTO
20
+ MOTO = 'Moto'.freeze,
21
+
22
+ # TODO: Write general description for INSTOREVCC
23
+ INSTOREVCC = 'InStoreVcc'.freeze,
24
+
25
+ # TODO: Write general description for ECOMMERCEVCC
26
+ ECOMMERCEVCC = 'ECommerceVcc'.freeze
27
+ ].freeze
28
+
29
+ def self.validate(value)
30
+ return false if value.nil?
31
+
32
+ PURCHASE_METHOD_ENUM.include?(value)
33
+ end
34
+
35
+ def self.from_value(value, default_value = INSTORE)
36
+ return default_value if value.nil?
37
+
38
+ str = value.to_s.strip
39
+
40
+ case str.downcase
41
+ when 'instore' then INSTORE
42
+ when 'phoneorder' then PHONEORDER
43
+ when 'ecommerce' then ECOMMERCE
44
+ when 'moto' then MOTO
45
+ when 'instorevcc' then INSTOREVCC
46
+ when 'ecommercevcc' then ECOMMERCEVCC
47
+ else
48
+ default_value
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,81 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module SplititWebApiV4
7
+ # RedirectUrls Model.
8
+ class RedirectUrls < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :success_url
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :failure_url
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :cancel_url
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['success_url'] = 'SuccessUrl'
28
+ @_hash['failure_url'] = 'FailureUrl'
29
+ @_hash['cancel_url'] = 'CancelUrl'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ failure_url
37
+ cancel_url
38
+ ]
39
+ end
40
+
41
+ # An array for nullable fields
42
+ def self.nullables
43
+ []
44
+ end
45
+
46
+ def initialize(success_url = nil, failure_url = SKIP, cancel_url = SKIP)
47
+ @success_url = success_url
48
+ @failure_url = failure_url unless failure_url == SKIP
49
+ @cancel_url = cancel_url unless cancel_url == SKIP
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ success_url = hash.key?('SuccessUrl') ? hash['SuccessUrl'] : nil
58
+ failure_url = hash.key?('FailureUrl') ? hash['FailureUrl'] : SKIP
59
+ cancel_url = hash.key?('CancelUrl') ? hash['CancelUrl'] : SKIP
60
+
61
+ # Create object from extracted values.
62
+ RedirectUrls.new(success_url,
63
+ failure_url,
64
+ cancel_url)
65
+ end
66
+
67
+ # Provides a human-readable string representation of the object.
68
+ def to_s
69
+ class_name = self.class.name.split('::').last
70
+ "<#{class_name} success_url: #{@success_url}, failure_url: #{@failure_url}, cancel_url:"\
71
+ " #{@cancel_url}>"
72
+ end
73
+
74
+ # Provides a debugging-friendly string with detailed object information.
75
+ def inspect
76
+ class_name = self.class.name.split('::').last
77
+ "<#{class_name} success_url: #{@success_url.inspect}, failure_url: #{@failure_url.inspect},"\
78
+ " cancel_url: #{@cancel_url.inspect}>"
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,136 @@
1
+ # splitit_web_api_v4
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module SplititWebApiV4
8
+ # RefundItem Model.
9
+ class RefundItem < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [DateTime]
15
+ attr_accessor :submit_date
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [Float]
19
+ attr_accessor :requested_amount
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :status
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [Float]
27
+ attr_accessor :non_credit_refund_amount
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [Float]
31
+ attr_accessor :credit_refund_amount
32
+
33
+ # TODO: Write general description for this method
34
+ # @return [String]
35
+ attr_accessor :refund_id
36
+
37
+ # TODO: Write general description for this method
38
+ # @return [String]
39
+ attr_accessor :reference_id
40
+
41
+ # A mapping from model property names to API property names.
42
+ def self.names
43
+ @_hash = {} if @_hash.nil?
44
+ @_hash['submit_date'] = 'SubmitDate'
45
+ @_hash['requested_amount'] = 'RequestedAmount'
46
+ @_hash['status'] = 'Status'
47
+ @_hash['non_credit_refund_amount'] = 'NonCreditRefundAmount'
48
+ @_hash['credit_refund_amount'] = 'CreditRefundAmount'
49
+ @_hash['refund_id'] = 'RefundId'
50
+ @_hash['reference_id'] = 'ReferenceId'
51
+ @_hash
52
+ end
53
+
54
+ # An array for optional fields
55
+ def self.optionals
56
+ %w[
57
+ submit_date
58
+ status
59
+ non_credit_refund_amount
60
+ credit_refund_amount
61
+ refund_id
62
+ reference_id
63
+ ]
64
+ end
65
+
66
+ # An array for nullable fields
67
+ def self.nullables
68
+ []
69
+ end
70
+
71
+ def initialize(requested_amount = nil, submit_date = SKIP, status = SKIP,
72
+ non_credit_refund_amount = SKIP, credit_refund_amount = SKIP,
73
+ refund_id = SKIP, reference_id = SKIP)
74
+ @submit_date = submit_date unless submit_date == SKIP
75
+ @requested_amount = requested_amount
76
+ @status = status unless status == SKIP
77
+ @non_credit_refund_amount = non_credit_refund_amount unless non_credit_refund_amount == SKIP
78
+ @credit_refund_amount = credit_refund_amount unless credit_refund_amount == SKIP
79
+ @refund_id = refund_id unless refund_id == SKIP
80
+ @reference_id = reference_id unless reference_id == SKIP
81
+ end
82
+
83
+ # Creates an instance of the object from a hash.
84
+ def self.from_hash(hash)
85
+ return nil unless hash
86
+
87
+ # Extract variables from the hash.
88
+ requested_amount =
89
+ hash.key?('RequestedAmount') ? hash['RequestedAmount'] : nil
90
+ submit_date = if hash.key?('SubmitDate')
91
+ (DateTimeHelper.from_rfc3339(hash['SubmitDate']) if hash['SubmitDate'])
92
+ else
93
+ SKIP
94
+ end
95
+ status = hash.key?('Status') ? hash['Status'] : SKIP
96
+ non_credit_refund_amount =
97
+ hash.key?('NonCreditRefundAmount') ? hash['NonCreditRefundAmount'] : SKIP
98
+ credit_refund_amount =
99
+ hash.key?('CreditRefundAmount') ? hash['CreditRefundAmount'] : SKIP
100
+ refund_id = hash.key?('RefundId') ? hash['RefundId'] : SKIP
101
+ reference_id = hash.key?('ReferenceId') ? hash['ReferenceId'] : SKIP
102
+
103
+ # Create object from extracted values.
104
+ RefundItem.new(requested_amount,
105
+ submit_date,
106
+ status,
107
+ non_credit_refund_amount,
108
+ credit_refund_amount,
109
+ refund_id,
110
+ reference_id)
111
+ end
112
+
113
+ def to_custom_submit_date
114
+ DateTimeHelper.to_rfc3339(submit_date)
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} submit_date: #{@submit_date}, requested_amount: #{@requested_amount},"\
121
+ " status: #{@status}, non_credit_refund_amount: #{@non_credit_refund_amount},"\
122
+ " credit_refund_amount: #{@credit_refund_amount}, refund_id: #{@refund_id}, reference_id:"\
123
+ " #{@reference_id}>"
124
+ end
125
+
126
+ # Provides a debugging-friendly string with detailed object information.
127
+ def inspect
128
+ class_name = self.class.name.split('::').last
129
+ "<#{class_name} submit_date: #{@submit_date.inspect}, requested_amount:"\
130
+ " #{@requested_amount.inspect}, status: #{@status.inspect}, non_credit_refund_amount:"\
131
+ " #{@non_credit_refund_amount.inspect}, credit_refund_amount:"\
132
+ " #{@credit_refund_amount.inspect}, refund_id: #{@refund_id.inspect}, reference_id:"\
133
+ " #{@reference_id.inspect}>"
134
+ end
135
+ end
136
+ end