apimatic-gp-sdk 0.0.1

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 (97) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +155 -0
  4. data/bin/console +15 -0
  5. data/lib/batches/api_helper.rb +10 -0
  6. data/lib/batches/apis/base_api.rb +67 -0
  7. data/lib/batches/apis/close_a_batch_api.rb +111 -0
  8. data/lib/batches/apis/get_a_batch_api.rb +70 -0
  9. data/lib/batches/apis/get_transactions_within_a_batch_api.rb +69 -0
  10. data/lib/batches/client.rb +72 -0
  11. data/lib/batches/configuration.rb +166 -0
  12. data/lib/batches/exceptions/api_exception.rb +21 -0
  13. data/lib/batches/exceptions/batches400_error_exception.rb +61 -0
  14. data/lib/batches/exceptions/batches401_error_exception.rb +61 -0
  15. data/lib/batches/exceptions/batches403_error_exception.rb +61 -0
  16. data/lib/batches/exceptions/batches500_error_exception.rb +61 -0
  17. data/lib/batches/exceptions/batches501_error_exception.rb +61 -0
  18. data/lib/batches/exceptions/batches502_error_exception.rb +62 -0
  19. data/lib/batches/exceptions/batches504_error_exception.rb +61 -0
  20. data/lib/batches/exceptions/batches_transactions400_error_exception.rb +61 -0
  21. data/lib/batches/exceptions/batches_transactions401_error_exception.rb +61 -0
  22. data/lib/batches/exceptions/batches_transactions403_error_exception.rb +61 -0
  23. data/lib/batches/exceptions/batches_transactions500_error_exception.rb +61 -0
  24. data/lib/batches/exceptions/batches_transactions501_error_exception.rb +61 -0
  25. data/lib/batches/exceptions/batches_transactions502_error_exception.rb +62 -0
  26. data/lib/batches/exceptions/batches_transactions504_error_exception.rb +61 -0
  27. data/lib/batches/http/api_response.rb +19 -0
  28. data/lib/batches/http/http_call_back.rb +10 -0
  29. data/lib/batches/http/http_method_enum.rb +10 -0
  30. data/lib/batches/http/http_request.rb +10 -0
  31. data/lib/batches/http/http_response.rb +10 -0
  32. data/lib/batches/http/proxy_settings.rb +22 -0
  33. data/lib/batches/logging/configuration/api_logging_configuration.rb +186 -0
  34. data/lib/batches/logging/sdk_logger.rb +17 -0
  35. data/lib/batches/models/action.rb +125 -0
  36. data/lib/batches/models/authentication_invalid401.rb +102 -0
  37. data/lib/batches/models/avs_address_result_batches_transactions_payment_method_card_avs_address_result.rb +40 -0
  38. data/lib/batches/models/avs_postal_code_result_batches_transactions_payment_method_card_avs_postal_code_result.rb +40 -0
  39. data/lib/batches/models/base_model.rb +110 -0
  40. data/lib/batches/models/batches_request.rb +142 -0
  41. data/lib/batches/models/brand_batches_brand_breakdown_brand.rb +56 -0
  42. data/lib/batches/models/brand_batches_transactions_payment_method_card_brand.rb +56 -0
  43. data/lib/batches/models/brand_breakdown_item.rb +159 -0
  44. data/lib/batches/models/card.rb +170 -0
  45. data/lib/batches/models/channel_batches_channel.rb +44 -0
  46. data/lib/batches/models/close_response.rb +356 -0
  47. data/lib/batches/models/currency_batches_transactions_currency.rb +60 -0
  48. data/lib/batches/models/cvv_result_batches_transactions_payment_method_card_cvv_result.rb +40 -0
  49. data/lib/batches/models/detailed_error_code.rb +26 -0
  50. data/lib/batches/models/detailed_error_code1.rb +36 -0
  51. data/lib/batches/models/detailed_error_code2.rb +36 -0
  52. data/lib/batches/models/detailed_error_code3.rb +26 -0
  53. data/lib/batches/models/detailed_error_code4.rb +26 -0
  54. data/lib/batches/models/detailed_error_code5.rb +26 -0
  55. data/lib/batches/models/detailed_error_code6.rb +26 -0
  56. data/lib/batches/models/entry_mode_batches_transactions_payment_method_entry_mode.rb +104 -0
  57. data/lib/batches/models/error_code.rb +52 -0
  58. data/lib/batches/models/error_code1.rb +26 -0
  59. data/lib/batches/models/error_code2.rb +26 -0
  60. data/lib/batches/models/error_code3.rb +26 -0
  61. data/lib/batches/models/error_code4.rb +26 -0
  62. data/lib/batches/models/error_code5.rb +27 -0
  63. data/lib/batches/models/error_code6.rb +26 -0
  64. data/lib/batches/models/filter.rb +76 -0
  65. data/lib/batches/models/funding_batches_transactions_payment_method_card_funding.rb +59 -0
  66. data/lib/batches/models/funding_credit.rb +85 -0
  67. data/lib/batches/models/funding_credit1.rb +85 -0
  68. data/lib/batches/models/funding_credit5.rb +85 -0
  69. data/lib/batches/models/funding_debit.rb +85 -0
  70. data/lib/batches/models/funding_debit1.rb +85 -0
  71. data/lib/batches/models/funding_debit5.rb +85 -0
  72. data/lib/batches/models/get_response.rb +331 -0
  73. data/lib/batches/models/host_breakdown_item.rb +128 -0
  74. data/lib/batches/models/not_authorized403.rb +102 -0
  75. data/lib/batches/models/obj_request_invalid400.rb +102 -0
  76. data/lib/batches/models/payment_method.rb +167 -0
  77. data/lib/batches/models/payment_method2.rb +52 -0
  78. data/lib/batches/models/payment_methods_batches_payment_method.rb +52 -0
  79. data/lib/batches/models/refunds.rb +85 -0
  80. data/lib/batches/models/refunds1.rb +85 -0
  81. data/lib/batches/models/result_code_batches_action_result_code.rb +26 -0
  82. data/lib/batches/models/sales.rb +85 -0
  83. data/lib/batches/models/sales1.rb +85 -0
  84. data/lib/batches/models/server_error500.rb +102 -0
  85. data/lib/batches/models/server_timeout504.rb +102 -0
  86. data/lib/batches/models/status_batches_status.rb +38 -0
  87. data/lib/batches/models/status_batches_transactions_status.rb +39 -0
  88. data/lib/batches/models/transaction.rb +205 -0
  89. data/lib/batches/models/transaction_batch_response.rb +198 -0
  90. data/lib/batches/models/type_batches_action_type.rb +40 -0
  91. data/lib/batches/models/type_batches_transactions_type.rb +40 -0
  92. data/lib/batches/models/unknown_platform_error502.rb +103 -0
  93. data/lib/batches/models/unknown_server_error501.rb +102 -0
  94. data/lib/batches/utilities/date_time_helper.rb +11 -0
  95. data/lib/batches/utilities/file_wrapper.rb +28 -0
  96. data/lib/batches.rb +128 -0
  97. metadata +180 -0
@@ -0,0 +1,205 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Transaction Model.
8
+ class Transaction < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A unique identifier that is used to identify and reference an instance of
13
+ # this resource. It is generated by Global Payments to identify the
14
+ # transaction and must be used to action that transaction in future.
15
+ # @return [String]
16
+ attr_accessor :id
17
+
18
+ # Time indicating when the transaction was created in ISO-8601 format.
19
+ # @return [String]
20
+ attr_accessor :time_created
21
+
22
+ # Indicates where a transaction is in its lifecycle.
23
+ # * `BATCHED `- A Transaction has been successfully Batched
24
+ # * `CAPTURED` - A Transaction has been successfully authorized and
25
+ # captured. The funding process will commence once the transaction remains
26
+ # in this status.
27
+ # @return [StatusBatchesTransactionsStatus]
28
+ attr_accessor :status
29
+
30
+ # Describes whether the transaction is a SALE, that moves funds from Payer
31
+ # to Merchant, or a REFUND where funds move from Merchant to Payer.
32
+ # * `SALE` - indicates the movement, or the attempt to
33
+ # move, funds from payer to a merchant.
34
+ # * `REFUND` - indicates the movement, or the attempt to
35
+ # move, funds from merchant to the payer.
36
+ # @return [TypeBatchesTransactionsType]
37
+ attr_accessor :type
38
+
39
+ # The amount to transfer between Payer and Merchant for a SALE or a REFUND.
40
+ # It is always represented in the lowest denomination of the related
41
+ # currency. and with no decimal point.
42
+ # @return [String]
43
+ attr_accessor :amount
44
+
45
+ # The total amount of tax charges associated with this transaction.
46
+ # @return [String]
47
+ attr_accessor :tax_amount
48
+
49
+ # The currency of the amount in ISO-4217(alpha-3).
50
+ # @return [CurrencyBatchesTransactionsCurrency]
51
+ attr_accessor :currency
52
+
53
+ # The amount of the gratuity for a transaction.
54
+ # @return [String]
55
+ attr_accessor :gratuity_amount
56
+
57
+ # The amount that reflects the additional charge the merchant applied to the
58
+ # transaction for using a specific payment method.
59
+ # @return [String]
60
+ attr_accessor :surcharge_amount
61
+
62
+ # The amount of the transaction that relates to cashback.
63
+ # @return [String]
64
+ attr_accessor :cashback_amount
65
+
66
+ # Merchant defined field to reference the transaction.
67
+ # @return [String]
68
+ attr_accessor :reference
69
+
70
+ # Merchant defined field to reference the transaction.
71
+ # @return [PaymentMethod]
72
+ attr_accessor :payment_method
73
+
74
+ # A mapping from model property names to API property names.
75
+ def self.names
76
+ @_hash = {} if @_hash.nil?
77
+ @_hash['id'] = 'id'
78
+ @_hash['time_created'] = 'time_created'
79
+ @_hash['status'] = 'status'
80
+ @_hash['type'] = 'type'
81
+ @_hash['amount'] = 'amount'
82
+ @_hash['tax_amount'] = 'tax_amount'
83
+ @_hash['currency'] = 'currency'
84
+ @_hash['gratuity_amount'] = 'gratuity_amount'
85
+ @_hash['surcharge_amount'] = 'surcharge_amount'
86
+ @_hash['cashback_amount'] = 'cashback_amount'
87
+ @_hash['reference'] = 'reference'
88
+ @_hash['payment_method'] = 'payment_method'
89
+ @_hash
90
+ end
91
+
92
+ # An array for optional fields
93
+ def self.optionals
94
+ %w[
95
+ id
96
+ time_created
97
+ status
98
+ type
99
+ amount
100
+ tax_amount
101
+ currency
102
+ gratuity_amount
103
+ surcharge_amount
104
+ cashback_amount
105
+ reference
106
+ payment_method
107
+ ]
108
+ end
109
+
110
+ # An array for nullable fields
111
+ def self.nullables
112
+ []
113
+ end
114
+
115
+ def initialize(id: SKIP, time_created: SKIP, status: SKIP,
116
+ type: TypeBatchesTransactionsType::SALE, amount: SKIP,
117
+ tax_amount: SKIP, currency: SKIP, gratuity_amount: SKIP,
118
+ surcharge_amount: SKIP, cashback_amount: SKIP,
119
+ reference: SKIP, payment_method: SKIP,
120
+ additional_properties: nil)
121
+ # Add additional model properties to the instance
122
+ additional_properties = {} if additional_properties.nil?
123
+
124
+ @id = id unless id == SKIP
125
+ @time_created = time_created unless time_created == SKIP
126
+ @status = status unless status == SKIP
127
+ @type = type unless type == SKIP
128
+ @amount = amount unless amount == SKIP
129
+ @tax_amount = tax_amount unless tax_amount == SKIP
130
+ @currency = currency unless currency == SKIP
131
+ @gratuity_amount = gratuity_amount unless gratuity_amount == SKIP
132
+ @surcharge_amount = surcharge_amount unless surcharge_amount == SKIP
133
+ @cashback_amount = cashback_amount unless cashback_amount == SKIP
134
+ @reference = reference unless reference == SKIP
135
+ @payment_method = payment_method unless payment_method == SKIP
136
+ @additional_properties = additional_properties
137
+ end
138
+
139
+ # Creates an instance of the object from a hash.
140
+ def self.from_hash(hash)
141
+ return nil unless hash
142
+
143
+ # Extract variables from the hash.
144
+ id = hash.key?('id') ? hash['id'] : SKIP
145
+ time_created = hash.key?('time_created') ? hash['time_created'] : SKIP
146
+ status = hash.key?('status') ? hash['status'] : SKIP
147
+ type = hash['type'] ||= TypeBatchesTransactionsType::SALE
148
+ amount = hash.key?('amount') ? hash['amount'] : SKIP
149
+ tax_amount = hash.key?('tax_amount') ? hash['tax_amount'] : SKIP
150
+ currency = hash.key?('currency') ? hash['currency'] : SKIP
151
+ gratuity_amount =
152
+ hash.key?('gratuity_amount') ? hash['gratuity_amount'] : SKIP
153
+ surcharge_amount =
154
+ hash.key?('surcharge_amount') ? hash['surcharge_amount'] : SKIP
155
+ cashback_amount =
156
+ hash.key?('cashback_amount') ? hash['cashback_amount'] : SKIP
157
+ reference = hash.key?('reference') ? hash['reference'] : SKIP
158
+ payment_method = PaymentMethod.from_hash(hash['payment_method']) if hash['payment_method']
159
+
160
+ # Create a new hash for additional properties, removing known properties.
161
+ new_hash = hash.reject { |k, _| names.value?(k) }
162
+
163
+ additional_properties = APIHelper.get_additional_properties(
164
+ new_hash, proc { |value| value }
165
+ )
166
+
167
+ # Create object from extracted values.
168
+ Transaction.new(id: id,
169
+ time_created: time_created,
170
+ status: status,
171
+ type: type,
172
+ amount: amount,
173
+ tax_amount: tax_amount,
174
+ currency: currency,
175
+ gratuity_amount: gratuity_amount,
176
+ surcharge_amount: surcharge_amount,
177
+ cashback_amount: cashback_amount,
178
+ reference: reference,
179
+ payment_method: payment_method,
180
+ additional_properties: additional_properties)
181
+ end
182
+
183
+ # Provides a human-readable string representation of the object.
184
+ def to_s
185
+ class_name = self.class.name.split('::').last
186
+ "<#{class_name} id: #{@id}, time_created: #{@time_created}, status: #{@status}, type:"\
187
+ " #{@type}, amount: #{@amount}, tax_amount: #{@tax_amount}, currency: #{@currency},"\
188
+ " gratuity_amount: #{@gratuity_amount}, surcharge_amount: #{@surcharge_amount},"\
189
+ " cashback_amount: #{@cashback_amount}, reference: #{@reference}, payment_method:"\
190
+ " #{@payment_method}, additional_properties: #{@additional_properties}>"
191
+ end
192
+
193
+ # Provides a debugging-friendly string with detailed object information.
194
+ def inspect
195
+ class_name = self.class.name.split('::').last
196
+ "<#{class_name} id: #{@id.inspect}, time_created: #{@time_created.inspect}, status:"\
197
+ " #{@status.inspect}, type: #{@type.inspect}, amount: #{@amount.inspect}, tax_amount:"\
198
+ " #{@tax_amount.inspect}, currency: #{@currency.inspect}, gratuity_amount:"\
199
+ " #{@gratuity_amount.inspect}, surcharge_amount: #{@surcharge_amount.inspect},"\
200
+ " cashback_amount: #{@cashback_amount.inspect}, reference: #{@reference.inspect},"\
201
+ " payment_method: #{@payment_method.inspect}, additional_properties:"\
202
+ " #{@additional_properties}>"
203
+ end
204
+ end
205
+ end
@@ -0,0 +1,198 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # TransactionBatchResponse Model.
8
+ class TransactionBatchResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The total number of records across all pages for the search filter. When
13
+ # searching for a collection of resoures, this is returned on the first page
14
+ # only and when the date range is a month or less.
15
+ # @return [Float]
16
+ attr_accessor :total_record_count
17
+
18
+ # The number of transactions in the batch.
19
+ # @return [Float]
20
+ attr_accessor :batch_transaction_count
21
+
22
+ # A unique identifier that is used to identify and reference an instance of
23
+ # this resource. This id is used when actioning or referencing a specific
24
+ # merchant. Begins with the three letters, MER.
25
+ # @return [String]
26
+ attr_accessor :merchant_id
27
+
28
+ # A meaningful label that better identifies the merchant.
29
+ # @return [String]
30
+ attr_accessor :merchant_name
31
+
32
+ # A unique identifier that is used to identify and reference an instance of
33
+ # this resource. This id is used when actioning or referencing a specific
34
+ # account. Begins with the three letters, TRA.
35
+ # @return [String]
36
+ attr_accessor :account_id
37
+
38
+ # A meaningful label that better identifies the account.
39
+ # @return [String]
40
+ attr_accessor :account_name
41
+
42
+ # A reference for the location that created the batch.
43
+ # @return [String]
44
+ attr_accessor :site_reference
45
+
46
+ # A reference for the device that created the batch
47
+ # @return [String]
48
+ attr_accessor :device_reference
49
+
50
+ # A reference for the device that created the batch
51
+ # @return [Filter]
52
+ attr_accessor :filter
53
+
54
+ # A reference for the device that created the batch
55
+ # @return [Array[Transaction]]
56
+ attr_accessor :transactions
57
+
58
+ # A reference for the device that created the batch
59
+ # @return [Action]
60
+ attr_accessor :action
61
+
62
+ # A mapping from model property names to API property names.
63
+ def self.names
64
+ @_hash = {} if @_hash.nil?
65
+ @_hash['total_record_count'] = 'total_record_count'
66
+ @_hash['batch_transaction_count'] = 'batch_transaction_count'
67
+ @_hash['merchant_id'] = 'merchant_id'
68
+ @_hash['merchant_name'] = 'merchant_name'
69
+ @_hash['account_id'] = 'account_id'
70
+ @_hash['account_name'] = 'account_name'
71
+ @_hash['site_reference'] = 'site_reference'
72
+ @_hash['device_reference'] = 'device_reference'
73
+ @_hash['filter'] = 'filter'
74
+ @_hash['transactions'] = 'transactions'
75
+ @_hash['action'] = 'action'
76
+ @_hash
77
+ end
78
+
79
+ # An array for optional fields
80
+ def self.optionals
81
+ %w[
82
+ total_record_count
83
+ batch_transaction_count
84
+ merchant_id
85
+ merchant_name
86
+ account_id
87
+ account_name
88
+ site_reference
89
+ device_reference
90
+ filter
91
+ transactions
92
+ action
93
+ ]
94
+ end
95
+
96
+ # An array for nullable fields
97
+ def self.nullables
98
+ []
99
+ end
100
+
101
+ def initialize(total_record_count: SKIP, batch_transaction_count: SKIP,
102
+ merchant_id: SKIP, merchant_name: SKIP, account_id: SKIP,
103
+ account_name: SKIP, site_reference: SKIP,
104
+ device_reference: SKIP, filter: SKIP, transactions: SKIP,
105
+ action: SKIP, additional_properties: nil)
106
+ # Add additional model properties to the instance
107
+ additional_properties = {} if additional_properties.nil?
108
+
109
+ @total_record_count = total_record_count unless total_record_count == SKIP
110
+ @batch_transaction_count = batch_transaction_count unless batch_transaction_count == SKIP
111
+ @merchant_id = merchant_id unless merchant_id == SKIP
112
+ @merchant_name = merchant_name unless merchant_name == SKIP
113
+ @account_id = account_id unless account_id == SKIP
114
+ @account_name = account_name unless account_name == SKIP
115
+ @site_reference = site_reference unless site_reference == SKIP
116
+ @device_reference = device_reference unless device_reference == SKIP
117
+ @filter = filter unless filter == SKIP
118
+ @transactions = transactions unless transactions == SKIP
119
+ @action = action unless action == SKIP
120
+ @additional_properties = additional_properties
121
+ end
122
+
123
+ # Creates an instance of the object from a hash.
124
+ def self.from_hash(hash)
125
+ return nil unless hash
126
+
127
+ # Extract variables from the hash.
128
+ total_record_count =
129
+ hash.key?('total_record_count') ? hash['total_record_count'] : SKIP
130
+ batch_transaction_count =
131
+ hash.key?('batch_transaction_count') ? hash['batch_transaction_count'] : SKIP
132
+ merchant_id = hash.key?('merchant_id') ? hash['merchant_id'] : SKIP
133
+ merchant_name = hash.key?('merchant_name') ? hash['merchant_name'] : SKIP
134
+ account_id = hash.key?('account_id') ? hash['account_id'] : SKIP
135
+ account_name = hash.key?('account_name') ? hash['account_name'] : SKIP
136
+ site_reference =
137
+ hash.key?('site_reference') ? hash['site_reference'] : SKIP
138
+ device_reference =
139
+ hash.key?('device_reference') ? hash['device_reference'] : SKIP
140
+ filter = Filter.from_hash(hash['filter']) if hash['filter']
141
+ # Parameter is an array, so we need to iterate through it
142
+ transactions = nil
143
+ unless hash['transactions'].nil?
144
+ transactions = []
145
+ hash['transactions'].each do |structure|
146
+ transactions << (Transaction.from_hash(structure) if structure)
147
+ end
148
+ end
149
+
150
+ transactions = SKIP unless hash.key?('transactions')
151
+ action = Action.from_hash(hash['action']) if hash['action']
152
+
153
+ # Create a new hash for additional properties, removing known properties.
154
+ new_hash = hash.reject { |k, _| names.value?(k) }
155
+
156
+ additional_properties = APIHelper.get_additional_properties(
157
+ new_hash, proc { |value| value }
158
+ )
159
+
160
+ # Create object from extracted values.
161
+ TransactionBatchResponse.new(total_record_count: total_record_count,
162
+ batch_transaction_count: batch_transaction_count,
163
+ merchant_id: merchant_id,
164
+ merchant_name: merchant_name,
165
+ account_id: account_id,
166
+ account_name: account_name,
167
+ site_reference: site_reference,
168
+ device_reference: device_reference,
169
+ filter: filter,
170
+ transactions: transactions,
171
+ action: action,
172
+ additional_properties: additional_properties)
173
+ end
174
+
175
+ # Provides a human-readable string representation of the object.
176
+ def to_s
177
+ class_name = self.class.name.split('::').last
178
+ "<#{class_name} total_record_count: #{@total_record_count}, batch_transaction_count:"\
179
+ " #{@batch_transaction_count}, merchant_id: #{@merchant_id}, merchant_name:"\
180
+ " #{@merchant_name}, account_id: #{@account_id}, account_name: #{@account_name},"\
181
+ " site_reference: #{@site_reference}, device_reference: #{@device_reference}, filter:"\
182
+ " #{@filter}, transactions: #{@transactions}, action: #{@action}, additional_properties:"\
183
+ " #{@additional_properties}>"
184
+ end
185
+
186
+ # Provides a debugging-friendly string with detailed object information.
187
+ def inspect
188
+ class_name = self.class.name.split('::').last
189
+ "<#{class_name} total_record_count: #{@total_record_count.inspect},"\
190
+ " batch_transaction_count: #{@batch_transaction_count.inspect}, merchant_id:"\
191
+ " #{@merchant_id.inspect}, merchant_name: #{@merchant_name.inspect}, account_id:"\
192
+ " #{@account_id.inspect}, account_name: #{@account_name.inspect}, site_reference:"\
193
+ " #{@site_reference.inspect}, device_reference: #{@device_reference.inspect}, filter:"\
194
+ " #{@filter.inspect}, transactions: #{@transactions.inspect}, action: #{@action.inspect},"\
195
+ " additional_properties: #{@additional_properties}>"
196
+ end
197
+ end
198
+ end
@@ -0,0 +1,40 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Indicates the specific action taken.
8
+ class TypeBatchesActionType
9
+ TYPE_BATCHES_ACTION_TYPE = [
10
+ # TODO: Write general description for BATCH_SINGLE
11
+ BATCH_SINGLE = 'BATCH_SINGLE'.freeze,
12
+
13
+ # TODO: Write general description for CLOSE
14
+ CLOSE = 'CLOSE'.freeze,
15
+
16
+ # TODO: Write general description for BATCH_LIST
17
+ BATCH_LIST = 'BATCH_LIST'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ TYPE_BATCHES_ACTION_TYPE.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = BATCH_SINGLE)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'batch_single' then BATCH_SINGLE
33
+ when 'close' then CLOSE
34
+ when 'batch_list' then BATCH_LIST
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Describes whether the transaction is a SALE, that moves funds from Payer to
8
+ # Merchant, or a REFUND where funds move from Merchant to Payer.
9
+ # * `SALE` - indicates the movement, or the attempt to move, funds from
10
+ # payer to a merchant. * `REFUND` - indicates the movement,
11
+ # or the attempt to move, funds from merchant to the payer.
12
+ class TypeBatchesTransactionsType
13
+ TYPE_BATCHES_TRANSACTIONS_TYPE = [
14
+ # TODO: Write general description for SALE
15
+ SALE = 'SALE'.freeze,
16
+
17
+ # TODO: Write general description for REFUND
18
+ REFUND = 'REFUND'.freeze
19
+ ].freeze
20
+
21
+ def self.validate(value)
22
+ return false if value.nil?
23
+
24
+ TYPE_BATCHES_TRANSACTIONS_TYPE.include?(value)
25
+ end
26
+
27
+ def self.from_value(value, default_value = SALE)
28
+ return default_value if value.nil?
29
+
30
+ str = value.to_s.strip
31
+
32
+ case str.downcase
33
+ when 'sale' then SALE
34
+ when 'refund' then REFUND
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,103 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Bad Gateway
8
+ class UnknownPlatformError502 < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # This is an error indicating there was an issue connecting to a partner
13
+ # system..
14
+ # @return [ErrorCode5]
15
+ attr_accessor :error_code
16
+
17
+ # Unique reference to identify the error.
18
+ # @return [DetailedErrorCode5]
19
+ attr_accessor :detailed_error_code
20
+
21
+ # Authentication error—Verify and correct credentials.
22
+ # @return [String]
23
+ attr_accessor :detailed_error_description
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['error_code'] = 'error_code'
29
+ @_hash['detailed_error_code'] = 'detailed_error_code'
30
+ @_hash['detailed_error_description'] = 'detailed_error_description'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ %w[
37
+ error_code
38
+ detailed_error_code
39
+ detailed_error_description
40
+ ]
41
+ end
42
+
43
+ # An array for nullable fields
44
+ def self.nullables
45
+ []
46
+ end
47
+
48
+ def initialize(error_code: SKIP, detailed_error_code: SKIP,
49
+ detailed_error_description: SKIP, additional_properties: nil)
50
+ # Add additional model properties to the instance
51
+ additional_properties = {} if additional_properties.nil?
52
+
53
+ @error_code = error_code unless error_code == SKIP
54
+ @detailed_error_code = detailed_error_code unless detailed_error_code == SKIP
55
+ unless detailed_error_description == SKIP
56
+ @detailed_error_description =
57
+ detailed_error_description
58
+ end
59
+ @additional_properties = additional_properties
60
+ end
61
+
62
+ # Creates an instance of the object from a hash.
63
+ def self.from_hash(hash)
64
+ return nil unless hash
65
+
66
+ # Extract variables from the hash.
67
+ error_code = hash.key?('error_code') ? hash['error_code'] : SKIP
68
+ detailed_error_code =
69
+ hash.key?('detailed_error_code') ? hash['detailed_error_code'] : SKIP
70
+ detailed_error_description =
71
+ hash.key?('detailed_error_description') ? hash['detailed_error_description'] : SKIP
72
+
73
+ # Create a new hash for additional properties, removing known properties.
74
+ new_hash = hash.reject { |k, _| names.value?(k) }
75
+
76
+ additional_properties = APIHelper.get_additional_properties(
77
+ new_hash, proc { |value| value }
78
+ )
79
+
80
+ # Create object from extracted values.
81
+ UnknownPlatformError502.new(error_code: error_code,
82
+ detailed_error_code: detailed_error_code,
83
+ detailed_error_description: detailed_error_description,
84
+ additional_properties: additional_properties)
85
+ end
86
+
87
+ # Provides a human-readable string representation of the object.
88
+ def to_s
89
+ class_name = self.class.name.split('::').last
90
+ "<#{class_name} error_code: #{@error_code}, detailed_error_code: #{@detailed_error_code},"\
91
+ " detailed_error_description: #{@detailed_error_description}, additional_properties:"\
92
+ " #{@additional_properties}>"
93
+ end
94
+
95
+ # Provides a debugging-friendly string with detailed object information.
96
+ def inspect
97
+ class_name = self.class.name.split('::').last
98
+ "<#{class_name} error_code: #{@error_code.inspect}, detailed_error_code:"\
99
+ " #{@detailed_error_code.inspect}, detailed_error_description:"\
100
+ " #{@detailed_error_description.inspect}, additional_properties: #{@additional_properties}>"
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,102 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Not implemented
8
+ class UnknownServerError501 < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # This is an error not yet handled or mapped properly.
13
+ # @return [ErrorCode4]
14
+ attr_accessor :error_code
15
+
16
+ # Unique reference to identify the error.
17
+ # @return [DetailedErrorCode4]
18
+ attr_accessor :detailed_error_code
19
+
20
+ # Unique Text describing the specific error not yet handled.
21
+ # @return [String]
22
+ attr_accessor :detailed_error_description
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['error_code'] = 'error_code'
28
+ @_hash['detailed_error_code'] = 'detailed_error_code'
29
+ @_hash['detailed_error_description'] = 'detailed_error_description'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ error_code
37
+ detailed_error_code
38
+ detailed_error_description
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(error_code: SKIP, detailed_error_code: SKIP,
48
+ detailed_error_description: SKIP, additional_properties: nil)
49
+ # Add additional model properties to the instance
50
+ additional_properties = {} if additional_properties.nil?
51
+
52
+ @error_code = error_code unless error_code == SKIP
53
+ @detailed_error_code = detailed_error_code unless detailed_error_code == SKIP
54
+ unless detailed_error_description == SKIP
55
+ @detailed_error_description =
56
+ detailed_error_description
57
+ end
58
+ @additional_properties = additional_properties
59
+ end
60
+
61
+ # Creates an instance of the object from a hash.
62
+ def self.from_hash(hash)
63
+ return nil unless hash
64
+
65
+ # Extract variables from the hash.
66
+ error_code = hash.key?('error_code') ? hash['error_code'] : SKIP
67
+ detailed_error_code =
68
+ hash.key?('detailed_error_code') ? hash['detailed_error_code'] : SKIP
69
+ detailed_error_description =
70
+ hash.key?('detailed_error_description') ? hash['detailed_error_description'] : SKIP
71
+
72
+ # Create a new hash for additional properties, removing known properties.
73
+ new_hash = hash.reject { |k, _| names.value?(k) }
74
+
75
+ additional_properties = APIHelper.get_additional_properties(
76
+ new_hash, proc { |value| value }
77
+ )
78
+
79
+ # Create object from extracted values.
80
+ UnknownServerError501.new(error_code: error_code,
81
+ detailed_error_code: detailed_error_code,
82
+ detailed_error_description: detailed_error_description,
83
+ additional_properties: additional_properties)
84
+ end
85
+
86
+ # Provides a human-readable string representation of the object.
87
+ def to_s
88
+ class_name = self.class.name.split('::').last
89
+ "<#{class_name} error_code: #{@error_code}, detailed_error_code: #{@detailed_error_code},"\
90
+ " detailed_error_description: #{@detailed_error_description}, additional_properties:"\
91
+ " #{@additional_properties}>"
92
+ end
93
+
94
+ # Provides a debugging-friendly string with detailed object information.
95
+ def inspect
96
+ class_name = self.class.name.split('::').last
97
+ "<#{class_name} error_code: #{@error_code.inspect}, detailed_error_code:"\
98
+ " #{@detailed_error_code.inspect}, detailed_error_description:"\
99
+ " #{@detailed_error_description.inspect}, additional_properties: #{@additional_properties}>"
100
+ end
101
+ end
102
+ end