jamm 1.1.2 → 1.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ada445b38feeab360aa3ad5a27c608c63a51ae8cbb2a33fdb0a5c9458212c36
4
- data.tar.gz: 324a55d045fd433b7821b2c89d9fdc388976ad96c325db90c97632015ab00bcc
3
+ metadata.gz: 12442dd1d77bc26366eb9a63dab54e0e57d604045d40dd77f2b4e56fc683f036
4
+ data.tar.gz: be144a15d76a7f74ce3da233688655801bae02c2d0f4b7493eeccfb347804fbd
5
5
  SHA512:
6
- metadata.gz: 8784a2133b145e70664b04246f31b89ff5e48569eaa28d6f7161e747a50693bc736eb207b981eee60240d569a841d37ed7ddb6842aed6745d378bc53b6028211
7
- data.tar.gz: a25c2bd2fc8f61abaa1b24932c8b0fb77863fd2fafc27c87f536c5e18c3b17a797ffad2ebe2bb53bf6b4bc2c17b81eda293affdf7a09c085507d3b6c2eb62b72
6
+ metadata.gz: 44b91232e54fd1614c8c291a81a76b513b78c3a9b7d7123315feebc0bc42644a662fe62accb5fe647531d1782f39ecadea804c945012575a6149573f3df17025
7
+ data.tar.gz: 1756d0212d959e4cd5f7c1460f1c5e4887b79942ba5ce5d5401fd6becb6ae4b4d9132d9a6c3d16f9160c33d17b2b47233493309aef4391ca188489c7b065b8ac
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jamm (1.1.2)
4
+ jamm (1.2.2)
5
5
  rest-client (~> 2.0)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
@@ -325,6 +325,128 @@ module Api
325
325
  [data, status_code, headers]
326
326
  end
327
327
 
328
+ # Process payment directly without redirect
329
+ # Execute a payment off-session within your application without redirecting to a payment page.
330
+ # @param body [OffSessionPaymentRequest] This message represents a request to process a payment directly within the application. It contains the customer ID and charge details to be processed.
331
+ # @param [Hash] opts the optional parameters
332
+ # @return [OffSessionPaymentResponse]
333
+ def off_session_payment(body, opts = {})
334
+ data, _status_code, _headers = off_session_payment_with_http_info(body, opts)
335
+ data
336
+ end
337
+
338
+ # Process payment directly without redirect
339
+ # Execute a payment off-session within your application without redirecting to a payment page.
340
+ # @param body [OffSessionPaymentRequest] This message represents a request to process a payment directly within the application. It contains the customer ID and charge details to be processed.
341
+ # @param [Hash] opts the optional parameters
342
+ # @return [Array<(OffSessionPaymentResponse, Integer, Hash)>] OffSessionPaymentResponse data, response status code and response headers
343
+ def off_session_payment_with_http_info(body, opts = {})
344
+ @api_client.config.logger.debug 'Calling API: PaymentApi.off_session_payment ...' if @api_client.config.debugging
345
+ # verify the required parameter 'body' is set
346
+ raise ArgumentError, "Missing the required parameter 'body' when calling PaymentApi.off_session_payment" if @api_client.config.client_side_validation && body.nil?
347
+
348
+ # resource path
349
+ local_var_path = '/v1/payments/off-session'
350
+
351
+ # query parameters
352
+ query_params = opts[:query_params] || {}
353
+
354
+ # header parameters
355
+ header_params = opts[:header_params] || {}
356
+ # HTTP header 'Accept' (if needed)
357
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
358
+ # HTTP header 'Content-Type'
359
+ content_type = @api_client.select_header_content_type(['application/json'])
360
+ header_params['Content-Type'] = content_type unless content_type.nil?
361
+
362
+ # form parameters
363
+ form_params = opts[:form_params] || {}
364
+
365
+ # http body (model)
366
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
367
+
368
+ # return_type
369
+ return_type = opts[:debug_return_type] || 'OffSessionPaymentResponse'
370
+
371
+ # auth_names
372
+ auth_names = opts[:debug_auth_names] || []
373
+
374
+ new_options = opts.merge(
375
+ :operation => :"PaymentApi.off_session_payment",
376
+ :header_params => header_params,
377
+ :query_params => query_params,
378
+ :form_params => form_params,
379
+ :body => post_body,
380
+ :auth_names => auth_names,
381
+ :return_type => return_type
382
+ )
383
+
384
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
385
+ @api_client.config.logger.debug "API called: PaymentApi#off_session_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
386
+ [data, status_code, headers]
387
+ end
388
+
389
+ # Process payment with optional redirect
390
+ # Unified interface for creating payments - supports existing customers, new customers with charges, and contract-only creation.
391
+ # @param body [OnSessionPaymentRequest] Request message for the unified payment interface. The system intelligently routes the request to the appropriate payment method based on the provided parameters.
392
+ # @param [Hash] opts the optional parameters
393
+ # @return [OnSessionPaymentResponse]
394
+ def on_session_payment(body, opts = {})
395
+ data, _status_code, _headers = on_session_payment_with_http_info(body, opts)
396
+ data
397
+ end
398
+
399
+ # Process payment with optional redirect
400
+ # Unified interface for creating payments - supports existing customers, new customers with charges, and contract-only creation.
401
+ # @param body [OnSessionPaymentRequest] Request message for the unified payment interface. The system intelligently routes the request to the appropriate payment method based on the provided parameters.
402
+ # @param [Hash] opts the optional parameters
403
+ # @return [Array<(OnSessionPaymentResponse, Integer, Hash)>] OnSessionPaymentResponse data, response status code and response headers
404
+ def on_session_payment_with_http_info(body, opts = {})
405
+ @api_client.config.logger.debug 'Calling API: PaymentApi.on_session_payment ...' if @api_client.config.debugging
406
+ # verify the required parameter 'body' is set
407
+ raise ArgumentError, "Missing the required parameter 'body' when calling PaymentApi.on_session_payment" if @api_client.config.client_side_validation && body.nil?
408
+
409
+ # resource path
410
+ local_var_path = '/v1/payments/on-session'
411
+
412
+ # query parameters
413
+ query_params = opts[:query_params] || {}
414
+
415
+ # header parameters
416
+ header_params = opts[:header_params] || {}
417
+ # HTTP header 'Accept' (if needed)
418
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
419
+ # HTTP header 'Content-Type'
420
+ content_type = @api_client.select_header_content_type(['application/json'])
421
+ header_params['Content-Type'] = content_type unless content_type.nil?
422
+
423
+ # form parameters
424
+ form_params = opts[:form_params] || {}
425
+
426
+ # http body (model)
427
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
428
+
429
+ # return_type
430
+ return_type = opts[:debug_return_type] || 'OnSessionPaymentResponse'
431
+
432
+ # auth_names
433
+ auth_names = opts[:debug_auth_names] || []
434
+
435
+ new_options = opts.merge(
436
+ :operation => :"PaymentApi.on_session_payment",
437
+ :header_params => header_params,
438
+ :query_params => query_params,
439
+ :form_params => form_params,
440
+ :body => post_body,
441
+ :auth_names => auth_names,
442
+ :return_type => return_type
443
+ )
444
+
445
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
446
+ @api_client.config.logger.debug "API called: PaymentApi#on_session_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
447
+ [data, status_code, headers]
448
+ end
449
+
328
450
  # Withdraw money from customer immediately, without redirect
329
451
  # This call is synchronous. The money will be withdrawn immediately.
330
452
  # @param body [WithdrawRequest] This message represents a request to withdraw money from a customer. It contains the customer ID and the amount to withdraw.
@@ -15,14 +15,36 @@ require 'time'
15
15
 
16
16
  module Api
17
17
  class BankInformation
18
- attr_accessor :account_number, :bank_name, :branch_name
18
+ attr_accessor :account_number, :bank_name, :branch_name, :deposit_type
19
+
20
+ class EnumAttributeValidator
21
+ attr_reader :datatype, :allowable_values
22
+
23
+ def initialize(datatype, allowable_values)
24
+ @allowable_values = allowable_values.map do |value|
25
+ case datatype.to_s
26
+ when /Integer/i
27
+ value.to_i
28
+ when /Float/i
29
+ value.to_f
30
+ else
31
+ value
32
+ end
33
+ end
34
+ end
35
+
36
+ def valid?(value)
37
+ !value || allowable_values.include?(value)
38
+ end
39
+ end
19
40
 
20
41
  # Attribute mapping from ruby-style variable name to JSON key.
21
42
  def self.attribute_map
22
43
  {
23
44
  :account_number => :accountNumber,
24
45
  :bank_name => :bankName,
25
- :branch_name => :branchName
46
+ :branch_name => :branchName,
47
+ :deposit_type => :depositType
26
48
  }
27
49
  end
28
50
 
@@ -36,7 +58,8 @@ module Api
36
58
  {
37
59
  :account_number => :String,
38
60
  :bank_name => :String,
39
- :branch_name => :String
61
+ :branch_name => :String,
62
+ :deposit_type => :DepositType
40
63
  }
41
64
  end
42
65
 
@@ -61,9 +84,13 @@ module Api
61
84
 
62
85
  self.bank_name = attributes[:bank_name] if attributes.key?(:bank_name)
63
86
 
64
- return unless attributes.key?(:branch_name)
87
+ self.branch_name = attributes[:branch_name] if attributes.key?(:branch_name)
65
88
 
66
- self.branch_name = attributes[:branch_name]
89
+ self.deposit_type = if attributes.key?(:deposit_type)
90
+ attributes[:deposit_type]
91
+ else
92
+ 'DEPOSIT_TYPE_UNSPECIFIED'
93
+ end
67
94
  end
68
95
 
69
96
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -88,7 +115,8 @@ module Api
88
115
  self.class == other.class &&
89
116
  account_number == other.account_number &&
90
117
  bank_name == other.bank_name &&
91
- branch_name == other.branch_name
118
+ branch_name == other.branch_name &&
119
+ deposit_type == other.deposit_type
92
120
  end
93
121
 
94
122
  # @see the `==` method
@@ -100,7 +128,7 @@ module Api
100
128
  # Calculates hash code according to all attributes.
101
129
  # @return [Integer] Hash code
102
130
  def hash
103
- [account_number, bank_name, branch_name].hash
131
+ [account_number, bank_name, branch_name, deposit_type].hash
104
132
  end
105
133
 
106
134
  # Builds the object from hash
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # #Jamm API
4
+ #
5
+ # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ #
7
+ # The version of the OpenAPI document: 1.0
8
+ #
9
+ # Generated by: https://openapi-generator.tech
10
+ # Generator version: 7.9.0
11
+ #
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Api
17
+ class DepositType
18
+ UNSPECIFIED = 'DEPOSIT_TYPE_UNSPECIFIED'
19
+ SAVINGS = 'DEPOSIT_TYPE_SAVINGS'
20
+ CHECKING = 'DEPOSIT_TYPE_CHECKING'
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [UNSPECIFIED, SAVINGS, CHECKING].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if DepositType.all_vars.include?(value)
38
+
39
+ raise "Invalid ENUM value #{value} for class #DepositType"
40
+ end
41
+ end
42
+ end
@@ -22,10 +22,11 @@ module Api
22
22
  CHARGE_FAIL = 'EVENT_TYPE_CHARGE_FAIL'
23
23
  CHARGE_CANCEL = 'EVENT_TYPE_CHARGE_CANCEL'
24
24
  CONTRACT_ACTIVATED = 'EVENT_TYPE_CONTRACT_ACTIVATED'
25
+ USER_ACCOUNT_DELETED = 'EVENT_TYPE_USER_ACCOUNT_DELETED'
25
26
  TESTING = 'EVENT_TYPE_TESTING'
26
27
 
27
28
  def self.all_vars
28
- @all_vars ||= [UNSPECIFIED, CHARGE_CREATED, CHARGE_UPDATED, CHARGE_SUCCESS, CHARGE_FAIL, CHARGE_CANCEL, CONTRACT_ACTIVATED, TESTING].freeze
29
+ @all_vars ||= [UNSPECIFIED, CHARGE_CREATED, CHARGE_UPDATED, CHARGE_SUCCESS, CHARGE_FAIL, CHARGE_CANCEL, CONTRACT_ACTIVATED, USER_ACCOUNT_DELETED, TESTING].freeze
29
30
  end
30
31
 
31
32
  # Builds the enum from string
@@ -15,14 +15,15 @@ require 'time'
15
15
 
16
16
  module Api
17
17
  class MessageResponse
18
- attr_accessor :merchant_webhook_message, :charge_message, :contract_message
18
+ attr_accessor :merchant_webhook_message, :charge_message, :contract_message, :user_account_message
19
19
 
20
20
  # Attribute mapping from ruby-style variable name to JSON key.
21
21
  def self.attribute_map
22
22
  {
23
23
  :merchant_webhook_message => :merchantWebhookMessage,
24
24
  :charge_message => :chargeMessage,
25
- :contract_message => :contractMessage
25
+ :contract_message => :contractMessage,
26
+ :user_account_message => :userAccountMessage
26
27
  }
27
28
  end
28
29
 
@@ -36,7 +37,8 @@ module Api
36
37
  {
37
38
  :merchant_webhook_message => :MerchantWebhookMessage,
38
39
  :charge_message => :ChargeMessage,
39
- :contract_message => :ContractMessage
40
+ :contract_message => :ContractMessage,
41
+ :user_account_message => :UserAccountMessage
40
42
  }
41
43
  end
42
44
 
@@ -61,9 +63,11 @@ module Api
61
63
 
62
64
  self.charge_message = attributes[:charge_message] if attributes.key?(:charge_message)
63
65
 
64
- return unless attributes.key?(:contract_message)
66
+ self.contract_message = attributes[:contract_message] if attributes.key?(:contract_message)
65
67
 
66
- self.contract_message = attributes[:contract_message]
68
+ return unless attributes.key?(:user_account_message)
69
+
70
+ self.user_account_message = attributes[:user_account_message]
67
71
  end
68
72
 
69
73
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -88,7 +92,8 @@ module Api
88
92
  self.class == other.class &&
89
93
  merchant_webhook_message == other.merchant_webhook_message &&
90
94
  charge_message == other.charge_message &&
91
- contract_message == other.contract_message
95
+ contract_message == other.contract_message &&
96
+ user_account_message == other.user_account_message
92
97
  end
93
98
 
94
99
  # @see the `==` method
@@ -100,7 +105,7 @@ module Api
100
105
  # Calculates hash code according to all attributes.
101
106
  # @return [Integer] Hash code
102
107
  def hash
103
- [merchant_webhook_message, charge_message, contract_message].hash
108
+ [merchant_webhook_message, charge_message, contract_message, user_account_message].hash
104
109
  end
105
110
 
106
111
  # Builds the object from hash
@@ -0,0 +1,213 @@
1
+ # frozen_string_literal: true
2
+
3
+ # #Jamm API
4
+ #
5
+ # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ #
7
+ # The version of the OpenAPI document: 1.0
8
+ #
9
+ # Generated by: https://openapi-generator.tech
10
+ # Generator version: 7.9.0
11
+ #
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Api
17
+ # This message represents a request to process a payment directly within the application. It contains the customer ID and charge details to be processed.
18
+ class OffSessionPaymentRequest
19
+ attr_accessor :customer, :charge
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :customer => :customer,
25
+ :charge => :charge
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :customer => :String,
38
+ :charge => :InitialCharge
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Api::OffSessionPaymentRequest` initialize method' unless attributes.is_a?(Hash)
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) do |(k, v), h|
54
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Api::OffSessionPaymentRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym)
55
+
56
+ h[k.to_sym] = v
57
+ end
58
+
59
+ self.customer = attributes[:customer] if attributes.key?(:customer)
60
+
61
+ return unless attributes.key?(:charge)
62
+
63
+ self.charge = attributes[:charge]
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
70
+ []
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ warn '[DEPRECATED] the `valid?` method is obsolete'
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(other)
83
+ return true if equal?(other)
84
+
85
+ self.class == other.class &&
86
+ customer == other.customer &&
87
+ charge == other.charge
88
+ end
89
+
90
+ # @see the `==` method
91
+ # @param [Object] Object to be compared
92
+ def eql?(other)
93
+ self == other
94
+ end
95
+
96
+ # Calculates hash code according to all attributes.
97
+ # @return [Integer] Hash code
98
+ def hash
99
+ [customer, charge].hash
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def self.build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+
108
+ attributes = attributes.transform_keys(&:to_sym)
109
+ transformed_hash = {}
110
+ openapi_types.each_pair do |key, type|
111
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
112
+ transformed_hash[key.to_s] = nil
113
+ elsif type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the attribute
115
+ # is documented as an array but the input is not
116
+ transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) } if attributes[attribute_map[key]].is_a?(Array)
117
+ elsif !attributes[attribute_map[key]].nil?
118
+ transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
119
+ end
120
+ end
121
+ new(transformed_hash)
122
+ end
123
+
124
+ # Deserializes the data based on type
125
+ # @param string type Data type
126
+ # @param string value Value to be deserialized
127
+ # @return [Object] Deserialized data
128
+ def self._deserialize(type, value)
129
+ case type.to_sym
130
+ when :Time
131
+ Time.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :Boolean
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ # models (e.g. Pet) or oneOf
162
+ klass = Api.const_get(type)
163
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = send(attr)
185
+ if value.nil?
186
+ is_nullable = self.class.openapi_nullable.include?(attr)
187
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
+ end
189
+
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+ end
213
+ end