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,159 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # BrandBreakdownItem Model.
8
+ class BrandBreakdownItem < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Indicates the card brand that this batch summary pertains to.
13
+ # @return [BrandBatchesBrandBreakdownBrand]
14
+ attr_accessor :brand
15
+
16
+ # The batch amount that is an aggregation of all the transactions' amounts
17
+ # in the batch for this brand. It is always represented in the lowest
18
+ # denomination of the related currency.
19
+ # @return [String]
20
+ attr_accessor :amount
21
+
22
+ # The number of transactions in the batch for this brand.
23
+ # @return [Float]
24
+ attr_accessor :count
25
+
26
+ # The amount that is an aggregation of all the transactions' gratuity
27
+ # amounts in the batch for this brand. It is always represented in the
28
+ # lowest denomination of the related currency.
29
+ # @return [String]
30
+ attr_accessor :gratuity_amount
31
+
32
+ # The amount that is an aggregation of all the transactions' gratuity
33
+ # amounts in the batch for this brand. It is always represented in the
34
+ # lowest denomination of the related currency.
35
+ # @return [Sales1]
36
+ attr_accessor :sales
37
+
38
+ # The amount that is an aggregation of all the transactions' gratuity
39
+ # amounts in the batch for this brand. It is always represented in the
40
+ # lowest denomination of the related currency.
41
+ # @return [Refunds1]
42
+ attr_accessor :refunds
43
+
44
+ # The amount that is an aggregation of all the transactions' gratuity
45
+ # amounts in the batch for this brand. It is always represented in the
46
+ # lowest denomination of the related currency.
47
+ # @return [FundingDebit1]
48
+ attr_accessor :funding_debit
49
+
50
+ # The amount that is an aggregation of all the transactions' gratuity
51
+ # amounts in the batch for this brand. It is always represented in the
52
+ # lowest denomination of the related currency.
53
+ # @return [FundingCredit1]
54
+ attr_accessor :funding_credit
55
+
56
+ # A mapping from model property names to API property names.
57
+ def self.names
58
+ @_hash = {} if @_hash.nil?
59
+ @_hash['brand'] = 'brand'
60
+ @_hash['amount'] = 'amount'
61
+ @_hash['count'] = 'count'
62
+ @_hash['gratuity_amount'] = 'gratuity_amount'
63
+ @_hash['sales'] = 'sales'
64
+ @_hash['refunds'] = 'refunds'
65
+ @_hash['funding_debit'] = 'funding_debit'
66
+ @_hash['funding_credit'] = 'funding_credit'
67
+ @_hash
68
+ end
69
+
70
+ # An array for optional fields
71
+ def self.optionals
72
+ %w[
73
+ brand
74
+ amount
75
+ count
76
+ gratuity_amount
77
+ sales
78
+ refunds
79
+ funding_debit
80
+ funding_credit
81
+ ]
82
+ end
83
+
84
+ # An array for nullable fields
85
+ def self.nullables
86
+ []
87
+ end
88
+
89
+ def initialize(brand: SKIP, amount: SKIP, count: SKIP,
90
+ gratuity_amount: SKIP, sales: SKIP, refunds: SKIP,
91
+ funding_debit: SKIP, funding_credit: SKIP,
92
+ additional_properties: nil)
93
+ # Add additional model properties to the instance
94
+ additional_properties = {} if additional_properties.nil?
95
+
96
+ @brand = brand unless brand == SKIP
97
+ @amount = amount unless amount == SKIP
98
+ @count = count unless count == SKIP
99
+ @gratuity_amount = gratuity_amount unless gratuity_amount == SKIP
100
+ @sales = sales unless sales == SKIP
101
+ @refunds = refunds unless refunds == SKIP
102
+ @funding_debit = funding_debit unless funding_debit == SKIP
103
+ @funding_credit = funding_credit unless funding_credit == SKIP
104
+ @additional_properties = additional_properties
105
+ end
106
+
107
+ # Creates an instance of the object from a hash.
108
+ def self.from_hash(hash)
109
+ return nil unless hash
110
+
111
+ # Extract variables from the hash.
112
+ brand = hash.key?('brand') ? hash['brand'] : SKIP
113
+ amount = hash.key?('amount') ? hash['amount'] : SKIP
114
+ count = hash.key?('count') ? hash['count'] : SKIP
115
+ gratuity_amount =
116
+ hash.key?('gratuity_amount') ? hash['gratuity_amount'] : SKIP
117
+ sales = Sales1.from_hash(hash['sales']) if hash['sales']
118
+ refunds = Refunds1.from_hash(hash['refunds']) if hash['refunds']
119
+ funding_debit = FundingDebit1.from_hash(hash['funding_debit']) if hash['funding_debit']
120
+ funding_credit = FundingCredit1.from_hash(hash['funding_credit']) if hash['funding_credit']
121
+
122
+ # Create a new hash for additional properties, removing known properties.
123
+ new_hash = hash.reject { |k, _| names.value?(k) }
124
+
125
+ additional_properties = APIHelper.get_additional_properties(
126
+ new_hash, proc { |value| value }
127
+ )
128
+
129
+ # Create object from extracted values.
130
+ BrandBreakdownItem.new(brand: brand,
131
+ amount: amount,
132
+ count: count,
133
+ gratuity_amount: gratuity_amount,
134
+ sales: sales,
135
+ refunds: refunds,
136
+ funding_debit: funding_debit,
137
+ funding_credit: funding_credit,
138
+ additional_properties: additional_properties)
139
+ end
140
+
141
+ # Provides a human-readable string representation of the object.
142
+ def to_s
143
+ class_name = self.class.name.split('::').last
144
+ "<#{class_name} brand: #{@brand}, amount: #{@amount}, count: #{@count}, gratuity_amount:"\
145
+ " #{@gratuity_amount}, sales: #{@sales}, refunds: #{@refunds}, funding_debit:"\
146
+ " #{@funding_debit}, funding_credit: #{@funding_credit}, additional_properties:"\
147
+ " #{@additional_properties}>"
148
+ end
149
+
150
+ # Provides a debugging-friendly string with detailed object information.
151
+ def inspect
152
+ class_name = self.class.name.split('::').last
153
+ "<#{class_name} brand: #{@brand.inspect}, amount: #{@amount.inspect}, count:"\
154
+ " #{@count.inspect}, gratuity_amount: #{@gratuity_amount.inspect}, sales: #{@sales.inspect},"\
155
+ " refunds: #{@refunds.inspect}, funding_debit: #{@funding_debit.inspect}, funding_credit:"\
156
+ " #{@funding_credit.inspect}, additional_properties: #{@additional_properties}>"
157
+ end
158
+ end
159
+ end
@@ -0,0 +1,170 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Card Model.
8
+ class Card < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Indicates how the card is funded:
13
+ # * `DEBIT` - indicates the card is a debit card
14
+ # where the funds may be present in an account to fulfill the transaction
15
+ # amount.
16
+ # * `CREDIT` - indicates the card is a credit
17
+ # card where the funds may be available on credit to the payer to fulfill
18
+ # the transaction amount.
19
+ # * `FOOD_STAMP` - indicates the card is an,
20
+ # Electronic Benefits Transfer, for food stamps.
21
+ # * `CASH_BENEFITS` - indicates the card is an,
22
+ # Electronic Benefits Transfer, for cash benefits.
23
+ # * `PREPAID` - indicates the card is a prepaid
24
+ # card where the funds are loaded to the card account to fulfill the
25
+ # transaction amount. Unlike a debit card, a prepaid is not linked to a bank
26
+ # account.
27
+ # @return [FundingBatchesTransactionsPaymentMethodCardFunding]
28
+ attr_accessor :funding
29
+
30
+ # Indicates the card brand that issued the card.
31
+ # @return [BrandBatchesTransactionsPaymentMethodCardBrand]
32
+ attr_accessor :brand
33
+
34
+ # Masked card number with the front 6 and last 4 digits visible.
35
+ # @return [String]
36
+ attr_accessor :masked_number_first6last4
37
+
38
+ # Code generated by the card provider when the card is successfully
39
+ # authorized.
40
+ # @return [String]
41
+ attr_accessor :authcode
42
+
43
+ # The result of the CVV check.
44
+ # @return [CvvResultBatchesTransactionsPaymentMethodCardCvvResult]
45
+ attr_accessor :cvv_result
46
+
47
+ # First line of the address associated with the card.
48
+ # @return [String]
49
+ attr_accessor :avs_address
50
+
51
+ # The result of the AVS address check.
52
+ # @return [AvsAddressResultBatchesTransactionsPaymentMethodCardAvsAddressResult]
53
+ attr_accessor :avs_address_result
54
+
55
+ # The result of the AVS postal code check.
56
+ # @return [AvsPostalCodeResultBatchesTransactionsPaymentMethodCardAvsPostalCodeResult]
57
+ attr_accessor :avs_postal_code_result
58
+
59
+ # A mapping from model property names to API property names.
60
+ def self.names
61
+ @_hash = {} if @_hash.nil?
62
+ @_hash['funding'] = 'funding'
63
+ @_hash['brand'] = 'brand'
64
+ @_hash['masked_number_first6last4'] = 'masked_number_first6last4'
65
+ @_hash['authcode'] = 'authcode'
66
+ @_hash['cvv_result'] = 'cvv_result'
67
+ @_hash['avs_address'] = 'avs_address'
68
+ @_hash['avs_address_result'] = 'avs_address_result'
69
+ @_hash['avs_postal_code_result'] = 'avs_postal_code_result'
70
+ @_hash
71
+ end
72
+
73
+ # An array for optional fields
74
+ def self.optionals
75
+ %w[
76
+ funding
77
+ brand
78
+ masked_number_first6last4
79
+ authcode
80
+ cvv_result
81
+ avs_address
82
+ avs_address_result
83
+ avs_postal_code_result
84
+ ]
85
+ end
86
+
87
+ # An array for nullable fields
88
+ def self.nullables
89
+ []
90
+ end
91
+
92
+ def initialize(funding: SKIP, brand: SKIP, masked_number_first6last4: SKIP,
93
+ authcode: SKIP, cvv_result: SKIP, avs_address: SKIP,
94
+ avs_address_result: SKIP, avs_postal_code_result: SKIP,
95
+ additional_properties: nil)
96
+ # Add additional model properties to the instance
97
+ additional_properties = {} if additional_properties.nil?
98
+
99
+ @funding = funding unless funding == SKIP
100
+ @brand = brand unless brand == SKIP
101
+ unless masked_number_first6last4 == SKIP
102
+ @masked_number_first6last4 =
103
+ masked_number_first6last4
104
+ end
105
+ @authcode = authcode unless authcode == SKIP
106
+ @cvv_result = cvv_result unless cvv_result == SKIP
107
+ @avs_address = avs_address unless avs_address == SKIP
108
+ @avs_address_result = avs_address_result unless avs_address_result == SKIP
109
+ @avs_postal_code_result = avs_postal_code_result unless avs_postal_code_result == SKIP
110
+ @additional_properties = additional_properties
111
+ end
112
+
113
+ # Creates an instance of the object from a hash.
114
+ def self.from_hash(hash)
115
+ return nil unless hash
116
+
117
+ # Extract variables from the hash.
118
+ funding = hash.key?('funding') ? hash['funding'] : SKIP
119
+ brand = hash.key?('brand') ? hash['brand'] : SKIP
120
+ masked_number_first6last4 =
121
+ hash.key?('masked_number_first6last4') ? hash['masked_number_first6last4'] : SKIP
122
+ authcode = hash.key?('authcode') ? hash['authcode'] : SKIP
123
+ cvv_result = hash.key?('cvv_result') ? hash['cvv_result'] : SKIP
124
+ avs_address = hash.key?('avs_address') ? hash['avs_address'] : SKIP
125
+ avs_address_result =
126
+ hash.key?('avs_address_result') ? hash['avs_address_result'] : SKIP
127
+ avs_postal_code_result =
128
+ hash.key?('avs_postal_code_result') ? hash['avs_postal_code_result'] : SKIP
129
+
130
+ # Create a new hash for additional properties, removing known properties.
131
+ new_hash = hash.reject { |k, _| names.value?(k) }
132
+
133
+ additional_properties = APIHelper.get_additional_properties(
134
+ new_hash, proc { |value| value }
135
+ )
136
+
137
+ # Create object from extracted values.
138
+ Card.new(funding: funding,
139
+ brand: brand,
140
+ masked_number_first6last4: masked_number_first6last4,
141
+ authcode: authcode,
142
+ cvv_result: cvv_result,
143
+ avs_address: avs_address,
144
+ avs_address_result: avs_address_result,
145
+ avs_postal_code_result: avs_postal_code_result,
146
+ additional_properties: additional_properties)
147
+ end
148
+
149
+ # Provides a human-readable string representation of the object.
150
+ def to_s
151
+ class_name = self.class.name.split('::').last
152
+ "<#{class_name} funding: #{@funding}, brand: #{@brand}, masked_number_first6last4:"\
153
+ " #{@masked_number_first6last4}, authcode: #{@authcode}, cvv_result: #{@cvv_result},"\
154
+ " avs_address: #{@avs_address}, avs_address_result: #{@avs_address_result},"\
155
+ " avs_postal_code_result: #{@avs_postal_code_result}, additional_properties:"\
156
+ " #{@additional_properties}>"
157
+ end
158
+
159
+ # Provides a debugging-friendly string with detailed object information.
160
+ def inspect
161
+ class_name = self.class.name.split('::').last
162
+ "<#{class_name} funding: #{@funding.inspect}, brand: #{@brand.inspect},"\
163
+ " masked_number_first6last4: #{@masked_number_first6last4.inspect}, authcode:"\
164
+ " #{@authcode.inspect}, cvv_result: #{@cvv_result.inspect}, avs_address:"\
165
+ " #{@avs_address.inspect}, avs_address_result: #{@avs_address_result.inspect},"\
166
+ " avs_postal_code_result: #{@avs_postal_code_result.inspect}, additional_properties:"\
167
+ " #{@additional_properties}>"
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,44 @@
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 was processed in a face to face(CP)
8
+ # scenario or a Customer Not Present (CNP) scenario. * `CP` -
9
+ # A Customer Present transaction is when the payer and the merchant are in
10
+ # direct face to face contact when exchanging payment method information to
11
+ # fulfill a transaction. e.g. in a store and paying at the counter that is
12
+ # attended by a clerk. * `CNP` - A Customer NOT Present
13
+ # transaction is when the payer and the merchant are not together when
14
+ # exchanging payment method information to fulfill a transaction. e.g. a
15
+ # transaction executed from a merchant's website or over the phone
16
+ class ChannelBatchesChannel
17
+ CHANNEL_BATCHES_CHANNEL = [
18
+ # TODO: Write general description for CP
19
+ CP = 'CP'.freeze,
20
+
21
+ # TODO: Write general description for CNP
22
+ CNP = 'CNP'.freeze
23
+ ].freeze
24
+
25
+ def self.validate(value)
26
+ return false if value.nil?
27
+
28
+ CHANNEL_BATCHES_CHANNEL.include?(value)
29
+ end
30
+
31
+ def self.from_value(value, default_value = CP)
32
+ return default_value if value.nil?
33
+
34
+ str = value.to_s.strip
35
+
36
+ case str.downcase
37
+ when 'cp' then CP
38
+ when 'cnp' then CNP
39
+ else
40
+ default_value
41
+ end
42
+ end
43
+ end
44
+ end