jamm 1.2.1 → 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: afa7b2f5a3762d463b26345bff77488597b3941dceb65ee6f9a0fa16638c02a8
4
- data.tar.gz: 02be4ae94c06829f9932630417ee6151c1bcc89313582fc73cb1d3b87b0c8997
3
+ metadata.gz: 12442dd1d77bc26366eb9a63dab54e0e57d604045d40dd77f2b4e56fc683f036
4
+ data.tar.gz: be144a15d76a7f74ce3da233688655801bae02c2d0f4b7493eeccfb347804fbd
5
5
  SHA512:
6
- metadata.gz: eee877ac3ebff328de9ca1f5d05befe67ecd982a8e8a4c3bfa6cdd1e3827f5b42e822be23e90839674e8909c5a62afe56ebb11a176e02c74643147e6791fde67
7
- data.tar.gz: 18fabb3a90d641390efbfb12c4d4e4022e69ee828ef5f9dc6bbd6398de69c67bfc4bee3f50e5b1a5115477d1b417fdd17c05d2f3bf6cb64a5269cbd706f72eb6
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.2.1)
4
+ jamm (1.2.2)
5
5
  rest-client (~> 2.0)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
@@ -386,6 +386,67 @@ module Api
386
386
  [data, status_code, headers]
387
387
  end
388
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
+
389
450
  # Withdraw money from customer immediately, without redirect
390
451
  # This call is synchronous. The money will be withdrawn immediately.
391
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,222 @@
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 OnSessionPaymentData
18
+ attr_accessor :contract, :charge, :customer, :payment_link
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :contract => :contract,
24
+ :charge => :charge,
25
+ :customer => :customer,
26
+ :payment_link => :paymentLink
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :contract => :Contract,
39
+ :charge => :Charge,
40
+ :customer => :Customer,
41
+ :payment_link => :PaymentLink
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Api::OnSessionPaymentData` initialize method' unless attributes.is_a?(Hash)
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) do |(k, v), h|
57
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Api::OnSessionPaymentData`. 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)
58
+
59
+ h[k.to_sym] = v
60
+ end
61
+
62
+ self.contract = attributes[:contract] if attributes.key?(:contract)
63
+
64
+ self.charge = attributes[:charge] if attributes.key?(:charge)
65
+
66
+ self.customer = attributes[:customer] if attributes.key?(:customer)
67
+
68
+ return unless attributes.key?(:payment_link)
69
+
70
+ self.payment_link = attributes[:payment_link]
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ []
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ warn '[DEPRECATED] the `valid?` method is obsolete'
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(other)
90
+ return true if equal?(other)
91
+
92
+ self.class == other.class &&
93
+ contract == other.contract &&
94
+ charge == other.charge &&
95
+ customer == other.customer &&
96
+ payment_link == other.payment_link
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(other)
102
+ self == other
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Integer] Hash code
107
+ def hash
108
+ [contract, charge, customer, payment_link].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def self.build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+
117
+ attributes = attributes.transform_keys(&:to_sym)
118
+ transformed_hash = {}
119
+ openapi_types.each_pair do |key, type|
120
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
121
+ transformed_hash[key.to_s] = nil
122
+ elsif type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ 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)
126
+ elsif !attributes[attribute_map[key]].nil?
127
+ transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
128
+ end
129
+ end
130
+ new(transformed_hash)
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def self._deserialize(type, value)
138
+ case type.to_sym
139
+ when :Time
140
+ Time.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ # models (e.g. Pet) or oneOf
171
+ klass = Api.const_get(type)
172
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = send(attr)
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+ end
222
+ end