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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +155 -0
- data/bin/console +15 -0
- data/lib/batches/api_helper.rb +10 -0
- data/lib/batches/apis/base_api.rb +67 -0
- data/lib/batches/apis/close_a_batch_api.rb +111 -0
- data/lib/batches/apis/get_a_batch_api.rb +70 -0
- data/lib/batches/apis/get_transactions_within_a_batch_api.rb +69 -0
- data/lib/batches/client.rb +72 -0
- data/lib/batches/configuration.rb +166 -0
- data/lib/batches/exceptions/api_exception.rb +21 -0
- data/lib/batches/exceptions/batches400_error_exception.rb +61 -0
- data/lib/batches/exceptions/batches401_error_exception.rb +61 -0
- data/lib/batches/exceptions/batches403_error_exception.rb +61 -0
- data/lib/batches/exceptions/batches500_error_exception.rb +61 -0
- data/lib/batches/exceptions/batches501_error_exception.rb +61 -0
- data/lib/batches/exceptions/batches502_error_exception.rb +62 -0
- data/lib/batches/exceptions/batches504_error_exception.rb +61 -0
- data/lib/batches/exceptions/batches_transactions400_error_exception.rb +61 -0
- data/lib/batches/exceptions/batches_transactions401_error_exception.rb +61 -0
- data/lib/batches/exceptions/batches_transactions403_error_exception.rb +61 -0
- data/lib/batches/exceptions/batches_transactions500_error_exception.rb +61 -0
- data/lib/batches/exceptions/batches_transactions501_error_exception.rb +61 -0
- data/lib/batches/exceptions/batches_transactions502_error_exception.rb +62 -0
- data/lib/batches/exceptions/batches_transactions504_error_exception.rb +61 -0
- data/lib/batches/http/api_response.rb +19 -0
- data/lib/batches/http/http_call_back.rb +10 -0
- data/lib/batches/http/http_method_enum.rb +10 -0
- data/lib/batches/http/http_request.rb +10 -0
- data/lib/batches/http/http_response.rb +10 -0
- data/lib/batches/http/proxy_settings.rb +22 -0
- data/lib/batches/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/batches/logging/sdk_logger.rb +17 -0
- data/lib/batches/models/action.rb +125 -0
- data/lib/batches/models/authentication_invalid401.rb +102 -0
- data/lib/batches/models/avs_address_result_batches_transactions_payment_method_card_avs_address_result.rb +40 -0
- data/lib/batches/models/avs_postal_code_result_batches_transactions_payment_method_card_avs_postal_code_result.rb +40 -0
- data/lib/batches/models/base_model.rb +110 -0
- data/lib/batches/models/batches_request.rb +142 -0
- data/lib/batches/models/brand_batches_brand_breakdown_brand.rb +56 -0
- data/lib/batches/models/brand_batches_transactions_payment_method_card_brand.rb +56 -0
- data/lib/batches/models/brand_breakdown_item.rb +159 -0
- data/lib/batches/models/card.rb +170 -0
- data/lib/batches/models/channel_batches_channel.rb +44 -0
- data/lib/batches/models/close_response.rb +356 -0
- data/lib/batches/models/currency_batches_transactions_currency.rb +60 -0
- data/lib/batches/models/cvv_result_batches_transactions_payment_method_card_cvv_result.rb +40 -0
- data/lib/batches/models/detailed_error_code.rb +26 -0
- data/lib/batches/models/detailed_error_code1.rb +36 -0
- data/lib/batches/models/detailed_error_code2.rb +36 -0
- data/lib/batches/models/detailed_error_code3.rb +26 -0
- data/lib/batches/models/detailed_error_code4.rb +26 -0
- data/lib/batches/models/detailed_error_code5.rb +26 -0
- data/lib/batches/models/detailed_error_code6.rb +26 -0
- data/lib/batches/models/entry_mode_batches_transactions_payment_method_entry_mode.rb +104 -0
- data/lib/batches/models/error_code.rb +52 -0
- data/lib/batches/models/error_code1.rb +26 -0
- data/lib/batches/models/error_code2.rb +26 -0
- data/lib/batches/models/error_code3.rb +26 -0
- data/lib/batches/models/error_code4.rb +26 -0
- data/lib/batches/models/error_code5.rb +27 -0
- data/lib/batches/models/error_code6.rb +26 -0
- data/lib/batches/models/filter.rb +76 -0
- data/lib/batches/models/funding_batches_transactions_payment_method_card_funding.rb +59 -0
- data/lib/batches/models/funding_credit.rb +85 -0
- data/lib/batches/models/funding_credit1.rb +85 -0
- data/lib/batches/models/funding_credit5.rb +85 -0
- data/lib/batches/models/funding_debit.rb +85 -0
- data/lib/batches/models/funding_debit1.rb +85 -0
- data/lib/batches/models/funding_debit5.rb +85 -0
- data/lib/batches/models/get_response.rb +331 -0
- data/lib/batches/models/host_breakdown_item.rb +128 -0
- data/lib/batches/models/not_authorized403.rb +102 -0
- data/lib/batches/models/obj_request_invalid400.rb +102 -0
- data/lib/batches/models/payment_method.rb +167 -0
- data/lib/batches/models/payment_method2.rb +52 -0
- data/lib/batches/models/payment_methods_batches_payment_method.rb +52 -0
- data/lib/batches/models/refunds.rb +85 -0
- data/lib/batches/models/refunds1.rb +85 -0
- data/lib/batches/models/result_code_batches_action_result_code.rb +26 -0
- data/lib/batches/models/sales.rb +85 -0
- data/lib/batches/models/sales1.rb +85 -0
- data/lib/batches/models/server_error500.rb +102 -0
- data/lib/batches/models/server_timeout504.rb +102 -0
- data/lib/batches/models/status_batches_status.rb +38 -0
- data/lib/batches/models/status_batches_transactions_status.rb +39 -0
- data/lib/batches/models/transaction.rb +205 -0
- data/lib/batches/models/transaction_batch_response.rb +198 -0
- data/lib/batches/models/type_batches_action_type.rb +40 -0
- data/lib/batches/models/type_batches_transactions_type.rb +40 -0
- data/lib/batches/models/unknown_platform_error502.rb +103 -0
- data/lib/batches/models/unknown_server_error501.rb +102 -0
- data/lib/batches/utilities/date_time_helper.rb +11 -0
- data/lib/batches/utilities/file_wrapper.rb +28 -0
- data/lib/batches.rb +128 -0
- metadata +180 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# batches
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module Batches
|
|
7
|
+
# Action Model.
|
|
8
|
+
class Action < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# A unique identifier generated by the platform to identify an action.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :id
|
|
15
|
+
|
|
16
|
+
# Indicates the specific action taken.
|
|
17
|
+
# @return [TypeBatchesActionType]
|
|
18
|
+
attr_accessor :type
|
|
19
|
+
|
|
20
|
+
# Time indicating when the object was created in ISO-8601 format.
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :time_created
|
|
23
|
+
|
|
24
|
+
# The result of the action executed.
|
|
25
|
+
# @return [ResultCodeBatchesActionResultCode]
|
|
26
|
+
attr_accessor :result_code
|
|
27
|
+
|
|
28
|
+
# The id of the app that was used to create the token.
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :app_id
|
|
31
|
+
|
|
32
|
+
# The name of the app the user gave to the application.
|
|
33
|
+
# @return [String]
|
|
34
|
+
attr_accessor :app_name
|
|
35
|
+
|
|
36
|
+
# A mapping from model property names to API property names.
|
|
37
|
+
def self.names
|
|
38
|
+
@_hash = {} if @_hash.nil?
|
|
39
|
+
@_hash['id'] = 'id'
|
|
40
|
+
@_hash['type'] = 'type'
|
|
41
|
+
@_hash['time_created'] = 'time_created'
|
|
42
|
+
@_hash['result_code'] = 'result_code'
|
|
43
|
+
@_hash['app_id'] = 'app_id'
|
|
44
|
+
@_hash['app_name'] = 'app_name'
|
|
45
|
+
@_hash
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# An array for optional fields
|
|
49
|
+
def self.optionals
|
|
50
|
+
%w[
|
|
51
|
+
id
|
|
52
|
+
type
|
|
53
|
+
time_created
|
|
54
|
+
result_code
|
|
55
|
+
app_id
|
|
56
|
+
app_name
|
|
57
|
+
]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# An array for nullable fields
|
|
61
|
+
def self.nullables
|
|
62
|
+
[]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def initialize(id: SKIP, type: SKIP, time_created: SKIP, result_code: SKIP,
|
|
66
|
+
app_id: SKIP, app_name: SKIP, additional_properties: nil)
|
|
67
|
+
# Add additional model properties to the instance
|
|
68
|
+
additional_properties = {} if additional_properties.nil?
|
|
69
|
+
|
|
70
|
+
@id = id unless id == SKIP
|
|
71
|
+
@type = type unless type == SKIP
|
|
72
|
+
@time_created = time_created unless time_created == SKIP
|
|
73
|
+
@result_code = result_code unless result_code == SKIP
|
|
74
|
+
@app_id = app_id unless app_id == SKIP
|
|
75
|
+
@app_name = app_name unless app_name == SKIP
|
|
76
|
+
@additional_properties = additional_properties
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Creates an instance of the object from a hash.
|
|
80
|
+
def self.from_hash(hash)
|
|
81
|
+
return nil unless hash
|
|
82
|
+
|
|
83
|
+
# Extract variables from the hash.
|
|
84
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
|
85
|
+
type = hash.key?('type') ? hash['type'] : SKIP
|
|
86
|
+
time_created = hash.key?('time_created') ? hash['time_created'] : SKIP
|
|
87
|
+
result_code = hash.key?('result_code') ? hash['result_code'] : SKIP
|
|
88
|
+
app_id = hash.key?('app_id') ? hash['app_id'] : SKIP
|
|
89
|
+
app_name = hash.key?('app_name') ? hash['app_name'] : SKIP
|
|
90
|
+
|
|
91
|
+
# Create a new hash for additional properties, removing known properties.
|
|
92
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
93
|
+
|
|
94
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
95
|
+
new_hash, proc { |value| value }
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
# Create object from extracted values.
|
|
99
|
+
Action.new(id: id,
|
|
100
|
+
type: type,
|
|
101
|
+
time_created: time_created,
|
|
102
|
+
result_code: result_code,
|
|
103
|
+
app_id: app_id,
|
|
104
|
+
app_name: app_name,
|
|
105
|
+
additional_properties: additional_properties)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Provides a human-readable string representation of the object.
|
|
109
|
+
def to_s
|
|
110
|
+
class_name = self.class.name.split('::').last
|
|
111
|
+
"<#{class_name} id: #{@id}, type: #{@type}, time_created: #{@time_created}, result_code:"\
|
|
112
|
+
" #{@result_code}, app_id: #{@app_id}, app_name: #{@app_name}, additional_properties:"\
|
|
113
|
+
" #{@additional_properties}>"
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
117
|
+
def inspect
|
|
118
|
+
class_name = self.class.name.split('::').last
|
|
119
|
+
"<#{class_name} id: #{@id.inspect}, type: #{@type.inspect}, time_created:"\
|
|
120
|
+
" #{@time_created.inspect}, result_code: #{@result_code.inspect}, app_id:"\
|
|
121
|
+
" #{@app_id.inspect}, app_name: #{@app_name.inspect}, additional_properties:"\
|
|
122
|
+
" #{@additional_properties}>"
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
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 Authenticated
|
|
8
|
+
class AuthenticationInvalid401 < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# This action failed as token in the request is not valid.
|
|
13
|
+
# @return [ErrorCode1]
|
|
14
|
+
attr_accessor :error_code
|
|
15
|
+
|
|
16
|
+
# Unique reference to identify the error.
|
|
17
|
+
# @return [DetailedErrorCode1]
|
|
18
|
+
attr_accessor :detailed_error_code
|
|
19
|
+
|
|
20
|
+
# Unique Text describing the specific error.
|
|
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
|
+
AuthenticationInvalid401.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
|
|
@@ -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
|
+
# The result of the AVS address check.
|
|
8
|
+
class AvsAddressResultBatchesTransactionsPaymentMethodCardAvsAddressResult
|
|
9
|
+
AVS_ADDRESS_RESULT_BATCHES_TRANSACTIONS_PAYMENT_METHOD_CARD_AVS_ADDRESS_RESULT = [
|
|
10
|
+
# TODO: Write general description for MATCHED
|
|
11
|
+
MATCHED = 'MATCHED'.freeze,
|
|
12
|
+
|
|
13
|
+
# TODO: Write general description for NOT_MATCHED
|
|
14
|
+
NOT_MATCHED = 'NOT_MATCHED'.freeze,
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for NOT_CHECKED
|
|
17
|
+
NOT_CHECKED = 'NOT_CHECKED'.freeze
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.validate(value)
|
|
21
|
+
return false if value.nil?
|
|
22
|
+
|
|
23
|
+
AVS_ADDRESS_RESULT_BATCHES_TRANSACTIONS_PAYMENT_METHOD_CARD_AVS_ADDRESS_RESULT.include?(value)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.from_value(value, default_value = MATCHED)
|
|
27
|
+
return default_value if value.nil?
|
|
28
|
+
|
|
29
|
+
str = value.to_s.strip
|
|
30
|
+
|
|
31
|
+
case str.downcase
|
|
32
|
+
when 'matched' then MATCHED
|
|
33
|
+
when 'not_matched' then NOT_MATCHED
|
|
34
|
+
when 'not_checked' then NOT_CHECKED
|
|
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
|
+
# The result of the AVS postal code check.
|
|
8
|
+
class AvsPostalCodeResultBatchesTransactionsPaymentMethodCardAvsPostalCodeResult
|
|
9
|
+
AVS_POSTAL_CODE_RESULT_BATCHES_TRANSACTIONS_PAYMENT_METHOD_CARD_AVS_POSTAL_CODE_RESULT = [
|
|
10
|
+
# TODO: Write general description for MATCHED
|
|
11
|
+
MATCHED = 'MATCHED'.freeze,
|
|
12
|
+
|
|
13
|
+
# TODO: Write general description for NOT_MATCHED
|
|
14
|
+
NOT_MATCHED = 'NOT_MATCHED'.freeze,
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for NOT_CHECKED
|
|
17
|
+
NOT_CHECKED = 'NOT_CHECKED'.freeze
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.validate(value)
|
|
21
|
+
return false if value.nil?
|
|
22
|
+
|
|
23
|
+
AVS_POSTAL_CODE_RESULT_BATCHES_TRANSACTIONS_PAYMENT_METHOD_CARD_AVS_POSTAL_CODE_RESULT.include?(value)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.from_value(value, default_value = MATCHED)
|
|
27
|
+
return default_value if value.nil?
|
|
28
|
+
|
|
29
|
+
str = value.to_s.strip
|
|
30
|
+
|
|
31
|
+
case str.downcase
|
|
32
|
+
when 'matched' then MATCHED
|
|
33
|
+
when 'not_matched' then NOT_MATCHED
|
|
34
|
+
when 'not_checked' then NOT_CHECKED
|
|
35
|
+
else
|
|
36
|
+
default_value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# batches
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module Batches
|
|
7
|
+
# Base model.
|
|
8
|
+
# rubocop:disable all
|
|
9
|
+
class BaseModel < CoreLibrary::BaseModel
|
|
10
|
+
# Returns a Hash representation of the current object.
|
|
11
|
+
def to_hash
|
|
12
|
+
# validating the model being serialized
|
|
13
|
+
self.class.validate(self) if self.class.respond_to?(:validate)
|
|
14
|
+
|
|
15
|
+
hash = {}
|
|
16
|
+
instance_variables.each do |name|
|
|
17
|
+
value = instance_variable_get(name)
|
|
18
|
+
name = name[1..]
|
|
19
|
+
if name == 'additional_properties'
|
|
20
|
+
additional_properties = process_additional_properties(value, self.class.names)
|
|
21
|
+
hash.merge!(additional_properties)
|
|
22
|
+
else
|
|
23
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
|
24
|
+
optional_fields = self.class.optionals
|
|
25
|
+
nullable_fields = self.class.nullables
|
|
26
|
+
if value.nil?
|
|
27
|
+
next unless nullable_fields.include?(name)
|
|
28
|
+
|
|
29
|
+
if !optional_fields.include?(name) && !nullable_fields.include?(name)
|
|
30
|
+
raise ArgumentError,
|
|
31
|
+
"`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
hash[key] = nil
|
|
36
|
+
unless value.nil?
|
|
37
|
+
if respond_to?("to_custom_#{name}")
|
|
38
|
+
if (value.instance_of? Array) || (value.instance_of? Hash)
|
|
39
|
+
params = [hash, key]
|
|
40
|
+
hash[key] = send("to_custom_#{name}", *params)
|
|
41
|
+
else
|
|
42
|
+
hash[key] = send("to_custom_#{name}")
|
|
43
|
+
end
|
|
44
|
+
elsif respond_to?("to_union_type_#{name}")
|
|
45
|
+
hash[key] = send("to_union_type_#{name}")
|
|
46
|
+
elsif value.instance_of? Array
|
|
47
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
|
48
|
+
elsif value.instance_of? Hash
|
|
49
|
+
hash[key] = {}
|
|
50
|
+
value.each do |k, v|
|
|
51
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
|
52
|
+
end
|
|
53
|
+
else
|
|
54
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
hash
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Processes additional properties, ensuring no conflicts with existing properties.
|
|
63
|
+
def process_additional_properties(additional_properties, existing_prop_names)
|
|
64
|
+
hash = {}
|
|
65
|
+
additional_properties.each do |name, value|
|
|
66
|
+
check_for_conflict(name, existing_prop_names)
|
|
67
|
+
|
|
68
|
+
hash[name] = if value.is_a?(Array)
|
|
69
|
+
process_array(value)
|
|
70
|
+
elsif value.is_a?(Hash)
|
|
71
|
+
process_hash(value)
|
|
72
|
+
else
|
|
73
|
+
process_basic_value(value)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
hash
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Checks if an additional property conflicts with a model's existing property.
|
|
80
|
+
def check_for_conflict(name, existing_prop_names)
|
|
81
|
+
return unless existing_prop_names.key?(name)
|
|
82
|
+
|
|
83
|
+
raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Processes an array of values, recursively calling `to_hash` on BaseModel objects.
|
|
87
|
+
def process_array(value)
|
|
88
|
+
value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
|
|
92
|
+
def process_hash(value)
|
|
93
|
+
value.transform_values do |v|
|
|
94
|
+
v.is_a?(BaseModel) ? v.to_hash : v
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Processes a basic value (non-array, non-hash).
|
|
99
|
+
def process_basic_value(value)
|
|
100
|
+
value.is_a?(BaseModel) ? value.to_hash : value
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Returns a JSON representation of the curent object.
|
|
104
|
+
def to_json(options = {})
|
|
105
|
+
hash = to_hash
|
|
106
|
+
hash.to_json(options)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
# rubocop:enable all
|
|
110
|
+
end
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# batches
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module Batches
|
|
7
|
+
# BatchesRequest Model.
|
|
8
|
+
class BatchesRequest < 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. This id is used when actioning or referencing a specific
|
|
14
|
+
# account. Begins with the three letters, TRA.
|
|
15
|
+
# @return [String]
|
|
16
|
+
attr_accessor :account_id
|
|
17
|
+
|
|
18
|
+
# A meaningful label that better identifies the account.
|
|
19
|
+
# @return [String]
|
|
20
|
+
attr_accessor :account_name
|
|
21
|
+
|
|
22
|
+
# Describes whether the transaction was processed in a face to face(CP)
|
|
23
|
+
# scenario or a Customer Not Present (CNP) scenario.
|
|
24
|
+
# * `CP` - A Customer Present transaction is when the payer
|
|
25
|
+
# and the merchant are in direct face to face contact when exchanging
|
|
26
|
+
# payment method information to fulfill a transaction. e.g. in a store and
|
|
27
|
+
# paying at the counter that is attended by a clerk.
|
|
28
|
+
# * `CNP` - A Customer NOT Present transaction is when the
|
|
29
|
+
# payer and the merchant are not together when exchanging payment method
|
|
30
|
+
# information to fulfill a transaction. e.g. a transaction executed from a
|
|
31
|
+
# merchant's website or over the phone
|
|
32
|
+
# @return [ChannelBatchesChannel]
|
|
33
|
+
attr_accessor :channel
|
|
34
|
+
|
|
35
|
+
# The currency of the amount in ISO-4217(alpha-3)
|
|
36
|
+
# @return [String]
|
|
37
|
+
attr_accessor :currency
|
|
38
|
+
|
|
39
|
+
# This is the country the merchant is domiciled in. For example, if the
|
|
40
|
+
# merchant is based in Canada it must be set to CA.if the merchant is based
|
|
41
|
+
# in England it must be set to GB.if the merchant is based in USA it must be
|
|
42
|
+
# set to US.The country in ISO-3166-1(alpha-2 code) format.
|
|
43
|
+
# @return [String]
|
|
44
|
+
attr_accessor :country
|
|
45
|
+
|
|
46
|
+
# Indicates the Payment Methods used to carry out the transactions in the
|
|
47
|
+
# batch
|
|
48
|
+
# @return [Array[PaymentMethod2]]
|
|
49
|
+
attr_accessor :payment_methods
|
|
50
|
+
|
|
51
|
+
# A mapping from model property names to API property names.
|
|
52
|
+
def self.names
|
|
53
|
+
@_hash = {} if @_hash.nil?
|
|
54
|
+
@_hash['account_id'] = 'account_id'
|
|
55
|
+
@_hash['account_name'] = 'account_name'
|
|
56
|
+
@_hash['channel'] = 'channel'
|
|
57
|
+
@_hash['currency'] = 'currency'
|
|
58
|
+
@_hash['country'] = 'country'
|
|
59
|
+
@_hash['payment_methods'] = 'payment_methods'
|
|
60
|
+
@_hash
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# An array for optional fields
|
|
64
|
+
def self.optionals
|
|
65
|
+
%w[
|
|
66
|
+
account_id
|
|
67
|
+
account_name
|
|
68
|
+
channel
|
|
69
|
+
currency
|
|
70
|
+
country
|
|
71
|
+
payment_methods
|
|
72
|
+
]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# An array for nullable fields
|
|
76
|
+
def self.nullables
|
|
77
|
+
[]
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def initialize(account_id: SKIP, account_name: SKIP, channel: SKIP,
|
|
81
|
+
currency: SKIP, country: SKIP, payment_methods: SKIP,
|
|
82
|
+
additional_properties: nil)
|
|
83
|
+
# Add additional model properties to the instance
|
|
84
|
+
additional_properties = {} if additional_properties.nil?
|
|
85
|
+
|
|
86
|
+
@account_id = account_id unless account_id == SKIP
|
|
87
|
+
@account_name = account_name unless account_name == SKIP
|
|
88
|
+
@channel = channel unless channel == SKIP
|
|
89
|
+
@currency = currency unless currency == SKIP
|
|
90
|
+
@country = country unless country == SKIP
|
|
91
|
+
@payment_methods = payment_methods unless payment_methods == SKIP
|
|
92
|
+
@additional_properties = additional_properties
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Creates an instance of the object from a hash.
|
|
96
|
+
def self.from_hash(hash)
|
|
97
|
+
return nil unless hash
|
|
98
|
+
|
|
99
|
+
# Extract variables from the hash.
|
|
100
|
+
account_id = hash.key?('account_id') ? hash['account_id'] : SKIP
|
|
101
|
+
account_name = hash.key?('account_name') ? hash['account_name'] : SKIP
|
|
102
|
+
channel = hash.key?('channel') ? hash['channel'] : SKIP
|
|
103
|
+
currency = hash.key?('currency') ? hash['currency'] : SKIP
|
|
104
|
+
country = hash.key?('country') ? hash['country'] : SKIP
|
|
105
|
+
payment_methods =
|
|
106
|
+
hash.key?('payment_methods') ? hash['payment_methods'] : SKIP
|
|
107
|
+
|
|
108
|
+
# Create a new hash for additional properties, removing known properties.
|
|
109
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
110
|
+
|
|
111
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
112
|
+
new_hash, proc { |value| value }
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# Create object from extracted values.
|
|
116
|
+
BatchesRequest.new(account_id: account_id,
|
|
117
|
+
account_name: account_name,
|
|
118
|
+
channel: channel,
|
|
119
|
+
currency: currency,
|
|
120
|
+
country: country,
|
|
121
|
+
payment_methods: payment_methods,
|
|
122
|
+
additional_properties: additional_properties)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Provides a human-readable string representation of the object.
|
|
126
|
+
def to_s
|
|
127
|
+
class_name = self.class.name.split('::').last
|
|
128
|
+
"<#{class_name} account_id: #{@account_id}, account_name: #{@account_name}, channel:"\
|
|
129
|
+
" #{@channel}, currency: #{@currency}, country: #{@country}, payment_methods:"\
|
|
130
|
+
" #{@payment_methods}, additional_properties: #{@additional_properties}>"
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
134
|
+
def inspect
|
|
135
|
+
class_name = self.class.name.split('::').last
|
|
136
|
+
"<#{class_name} account_id: #{@account_id.inspect}, account_name: #{@account_name.inspect},"\
|
|
137
|
+
" channel: #{@channel.inspect}, currency: #{@currency.inspect}, country:"\
|
|
138
|
+
" #{@country.inspect}, payment_methods: #{@payment_methods.inspect}, additional_properties:"\
|
|
139
|
+
" #{@additional_properties}>"
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
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 card brand that this batch summary pertains to.
|
|
8
|
+
class BrandBatchesBrandBreakdownBrand
|
|
9
|
+
BRAND_BATCHES_BRAND_BREAKDOWN_BRAND = [
|
|
10
|
+
# TODO: Write general description for VISA
|
|
11
|
+
VISA = 'VISA'.freeze,
|
|
12
|
+
|
|
13
|
+
# TODO: Write general description for MASTERCARD
|
|
14
|
+
MASTERCARD = 'MASTERCARD'.freeze,
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for AMEX
|
|
17
|
+
AMEX = 'AMEX'.freeze,
|
|
18
|
+
|
|
19
|
+
# TODO: Write general description for DINERS
|
|
20
|
+
DINERS = 'DINERS'.freeze,
|
|
21
|
+
|
|
22
|
+
# TODO: Write general description for DISCOVER
|
|
23
|
+
DISCOVER = 'DISCOVER'.freeze,
|
|
24
|
+
|
|
25
|
+
# TODO: Write general description for JCB
|
|
26
|
+
JCB = 'JCB'.freeze,
|
|
27
|
+
|
|
28
|
+
# TODO: Write general description for CUP
|
|
29
|
+
CUP = 'CUP'.freeze
|
|
30
|
+
].freeze
|
|
31
|
+
|
|
32
|
+
def self.validate(value)
|
|
33
|
+
return false if value.nil?
|
|
34
|
+
|
|
35
|
+
BRAND_BATCHES_BRAND_BREAKDOWN_BRAND.include?(value)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.from_value(value, default_value = VISA)
|
|
39
|
+
return default_value if value.nil?
|
|
40
|
+
|
|
41
|
+
str = value.to_s.strip
|
|
42
|
+
|
|
43
|
+
case str.downcase
|
|
44
|
+
when 'visa' then VISA
|
|
45
|
+
when 'mastercard' then MASTERCARD
|
|
46
|
+
when 'amex' then AMEX
|
|
47
|
+
when 'diners' then DINERS
|
|
48
|
+
when 'discover' then DISCOVER
|
|
49
|
+
when 'jcb' then JCB
|
|
50
|
+
when 'cup' then CUP
|
|
51
|
+
else
|
|
52
|
+
default_value
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
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 card brand that issued the card.
|
|
8
|
+
class BrandBatchesTransactionsPaymentMethodCardBrand
|
|
9
|
+
BRAND_BATCHES_TRANSACTIONS_PAYMENT_METHOD_CARD_BRAND = [
|
|
10
|
+
# TODO: Write general description for VISA
|
|
11
|
+
VISA = 'VISA'.freeze,
|
|
12
|
+
|
|
13
|
+
# TODO: Write general description for MASTERCARD
|
|
14
|
+
MASTERCARD = 'MASTERCARD'.freeze,
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for AMEX
|
|
17
|
+
AMEX = 'AMEX'.freeze,
|
|
18
|
+
|
|
19
|
+
# TODO: Write general description for DINERS
|
|
20
|
+
DINERS = 'DINERS'.freeze,
|
|
21
|
+
|
|
22
|
+
# TODO: Write general description for DISCOVER
|
|
23
|
+
DISCOVER = 'DISCOVER'.freeze,
|
|
24
|
+
|
|
25
|
+
# TODO: Write general description for JCB
|
|
26
|
+
JCB = 'JCB'.freeze,
|
|
27
|
+
|
|
28
|
+
# TODO: Write general description for CUP
|
|
29
|
+
CUP = 'CUP'.freeze
|
|
30
|
+
].freeze
|
|
31
|
+
|
|
32
|
+
def self.validate(value)
|
|
33
|
+
return false if value.nil?
|
|
34
|
+
|
|
35
|
+
BRAND_BATCHES_TRANSACTIONS_PAYMENT_METHOD_CARD_BRAND.include?(value)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.from_value(value, default_value = VISA)
|
|
39
|
+
return default_value if value.nil?
|
|
40
|
+
|
|
41
|
+
str = value.to_s.strip
|
|
42
|
+
|
|
43
|
+
case str.downcase
|
|
44
|
+
when 'visa' then VISA
|
|
45
|
+
when 'mastercard' then MASTERCARD
|
|
46
|
+
when 'amex' then AMEX
|
|
47
|
+
when 'diners' then DINERS
|
|
48
|
+
when 'discover' then DISCOVER
|
|
49
|
+
when 'jcb' then JCB
|
|
50
|
+
when 'cup' then CUP
|
|
51
|
+
else
|
|
52
|
+
default_value
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|