jamm 1.1.2 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ada445b38feeab360aa3ad5a27c608c63a51ae8cbb2a33fdb0a5c9458212c36
4
- data.tar.gz: 324a55d045fd433b7821b2c89d9fdc388976ad96c325db90c97632015ab00bcc
3
+ metadata.gz: afa7b2f5a3762d463b26345bff77488597b3941dceb65ee6f9a0fa16638c02a8
4
+ data.tar.gz: 02be4ae94c06829f9932630417ee6151c1bcc89313582fc73cb1d3b87b0c8997
5
5
  SHA512:
6
- metadata.gz: 8784a2133b145e70664b04246f31b89ff5e48569eaa28d6f7161e747a50693bc736eb207b981eee60240d569a841d37ed7ddb6842aed6745d378bc53b6028211
7
- data.tar.gz: a25c2bd2fc8f61abaa1b24932c8b0fb77863fd2fafc27c87f536c5e18c3b17a797ffad2ebe2bb53bf6b4bc2c17b81eda293affdf7a09c085507d3b6c2eb62b72
6
+ metadata.gz: eee877ac3ebff328de9ca1f5d05befe67ecd982a8e8a4c3bfa6cdd1e3827f5b42e822be23e90839674e8909c5a62afe56ebb11a176e02c74643147e6791fde67
7
+ data.tar.gz: 18fabb3a90d641390efbfb12c4d4e4022e69ee828ef5f9dc6bbd6398de69c67bfc4bee3f50e5b1a5115477d1b417fdd17c05d2f3bf6cb64a5269cbd706f72eb6
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.1)
5
5
  rest-client (~> 2.0)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
@@ -325,6 +325,67 @@ 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
+
328
389
  # Withdraw money from customer immediately, without redirect
329
390
  # This call is synchronous. The money will be withdrawn immediately.
330
391
  # @param body [WithdrawRequest] This message represents a request to withdraw money from a customer. It contains the customer ID and the amount to withdraw.
@@ -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
@@ -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 the response after processing an OffSessionPaymentRequest. It contains information about the created charge, customer details and the payment result.
18
+ class OffSessionPaymentResponse
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 => :Customer,
38
+ :charge => :ChargeResult
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::OffSessionPaymentResponse` 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::OffSessionPaymentResponse`. 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
data/lib/jamm/api.rb CHANGED
@@ -52,6 +52,8 @@ require 'jamm/api/models/v1_merchant'
52
52
  require 'jamm/api/models/v1_merchant_customer'
53
53
  require 'jamm/api/models/v1_merchant_webhook_message'
54
54
  require 'jamm/api/models/v1_message_response'
55
+ require 'jamm/api/models/v1_off_session_payment_request'
56
+ require 'jamm/api/models/v1_off_session_payment_response'
55
57
  require 'jamm/api/models/v1_pagination'
56
58
  require 'jamm/api/models/v1_payment_authorization_status'
57
59
  require 'jamm/api/models/v1_payment_link'
data/lib/jamm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jamm
4
- VERSION = '1.1.2'
4
+ VERSION = '1.2.1'
5
5
  end
data/lib/jamm.rb CHANGED
@@ -39,7 +39,7 @@ module Jamm
39
39
  Jamm.client_secret = client_secret
40
40
 
41
41
  case env
42
- when 'prod'
42
+ when 'prd', 'prod', 'production'
43
43
  self.oauth_base = 'https://merchant-identity.jamm-pay.jp'
44
44
 
45
45
  self.openapi = Jamm::OpenAPI::ApiClient.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jamm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-16 00:00:00.000000000 Z
11
+ date: 2025-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -102,6 +102,8 @@ files:
102
102
  - lib/jamm/api/models/v1_merchant_customer.rb
103
103
  - lib/jamm/api/models/v1_merchant_webhook_message.rb
104
104
  - lib/jamm/api/models/v1_message_response.rb
105
+ - lib/jamm/api/models/v1_off_session_payment_request.rb
106
+ - lib/jamm/api/models/v1_off_session_payment_response.rb
105
107
  - lib/jamm/api/models/v1_pagination.rb
106
108
  - lib/jamm/api/models/v1_payment_authorization_status.rb
107
109
  - lib/jamm/api/models/v1_payment_link.rb