jamm 2.6.0 → 2.7.0
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 +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +1 -1
- data/README.md +24 -0
- data/Rakefile +7 -1
- data/lib/jamm/api/api/webhook_endpoint_api.rb +294 -0
- data/lib/jamm/api/models/charge_message_api_source.rb +42 -0
- data/lib/jamm/api/models/customer_service_update_customer_body.rb +1 -1
- data/lib/jamm/api/models/v1_buyer.rb +1 -1
- data/lib/jamm/api/models/v1_charge_message.rb +27 -4
- data/lib/jamm/api/models/v1_create_webhook_endpoint_request.rb +225 -0
- data/lib/jamm/api/models/v1_create_webhook_endpoint_response.rb +214 -0
- data/lib/jamm/api/models/v1_error_type.rb +2 -1
- data/lib/jamm/api/models/v1_initial_charge.rb +1 -1
- data/lib/jamm/api/models/v1_message_response.rb +13 -4
- data/lib/jamm/api/models/v1_on_session_payment_request.rb +12 -1
- data/lib/jamm/api/models/v1_promote_webhook_endpoint_response.rb +214 -0
- data/lib/jamm/api/models/v1_refund_info.rb +7 -7
- data/lib/jamm/api/models/v1_refund_webhook_content.rb +224 -0
- data/lib/jamm/api/models/v1_rollback_webhook_endpoint_response.rb +214 -0
- data/lib/jamm/api/models/v1_trigger_webhook_event_request.rb +238 -0
- data/lib/jamm/api/models/v1_trigger_webhook_event_response.rb +214 -0
- data/lib/jamm/api/models/v1_webhook_endpoint.rb +307 -0
- data/lib/jamm/api/models/v1_webhook_endpoint_status.rb +42 -0
- data/lib/jamm/api.rb +11 -0
- data/lib/jamm/api_version.rb +10 -0
- data/lib/jamm/client.rb +13 -1
- data/lib/jamm/version.rb +1 -1
- data/lib/jamm/webhook.rb +17 -3
- data/lib/jamm.rb +24 -2
- metadata +14 -2
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Jamm API
|
|
3
|
+
|
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.9.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Api
|
|
17
|
+
# WebhookEndpoint is a webhook receiver with its pinned API version. WebhookEndpoint は固定されたAPIバージョンを持つWebhook受信先です。
|
|
18
|
+
class WebhookEndpoint
|
|
19
|
+
# Endpoint ID, prefixed with `wep-`. エンドポイントID。`wep-` で始まります。
|
|
20
|
+
attr_accessor :id
|
|
21
|
+
|
|
22
|
+
# URL that receives deliveries. 配信先URL。
|
|
23
|
+
attr_accessor :url
|
|
24
|
+
|
|
25
|
+
attr_accessor :status
|
|
26
|
+
|
|
27
|
+
# API version deliveries are rendered at, as `YYYY-MM-DD`. Unset means the endpoint inherits the merchant's pinned version. 配信の形式を決めるAPIバージョン(`YYYY-MM-DD`)。 未設定の場合は加盟店に固定されたバージョンを継承します。
|
|
28
|
+
attr_accessor :api_version
|
|
29
|
+
|
|
30
|
+
# API version that was live before the last promote. Set only while a rollback is possible. 直前の昇格前に有効だったAPIバージョン。ロールバックが可能な間のみ設定されます。
|
|
31
|
+
attr_accessor :previous_api_version
|
|
32
|
+
|
|
33
|
+
# When the last promote happened. Set only while a rollback is possible. 直前の昇格が行われた時刻。ロールバックが可能な間のみ設定されます。
|
|
34
|
+
attr_accessor :promoted_at
|
|
35
|
+
|
|
36
|
+
attr_accessor :created_at
|
|
37
|
+
|
|
38
|
+
attr_accessor :updated_at
|
|
39
|
+
|
|
40
|
+
class EnumAttributeValidator
|
|
41
|
+
attr_reader :datatype
|
|
42
|
+
attr_reader :allowable_values
|
|
43
|
+
|
|
44
|
+
def initialize(datatype, allowable_values)
|
|
45
|
+
@allowable_values = allowable_values.map do |value|
|
|
46
|
+
case datatype.to_s
|
|
47
|
+
when /Integer/i
|
|
48
|
+
value.to_i
|
|
49
|
+
when /Float/i
|
|
50
|
+
value.to_f
|
|
51
|
+
else
|
|
52
|
+
value
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def valid?(value)
|
|
58
|
+
!value || allowable_values.include?(value)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
63
|
+
def self.attribute_map
|
|
64
|
+
{
|
|
65
|
+
:'id' => :'id',
|
|
66
|
+
:'url' => :'url',
|
|
67
|
+
:'status' => :'status',
|
|
68
|
+
:'api_version' => :'apiVersion',
|
|
69
|
+
:'previous_api_version' => :'previousApiVersion',
|
|
70
|
+
:'promoted_at' => :'promotedAt',
|
|
71
|
+
:'created_at' => :'createdAt',
|
|
72
|
+
:'updated_at' => :'updatedAt'
|
|
73
|
+
}
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Returns all the JSON keys this model knows about
|
|
77
|
+
def self.acceptable_attributes
|
|
78
|
+
attribute_map.values
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Attribute type mapping.
|
|
82
|
+
def self.openapi_types
|
|
83
|
+
{
|
|
84
|
+
:'id' => :'String',
|
|
85
|
+
:'url' => :'String',
|
|
86
|
+
:'status' => :'WebhookEndpointStatus',
|
|
87
|
+
:'api_version' => :'String',
|
|
88
|
+
:'previous_api_version' => :'String',
|
|
89
|
+
:'promoted_at' => :'Time',
|
|
90
|
+
:'created_at' => :'Time',
|
|
91
|
+
:'updated_at' => :'Time'
|
|
92
|
+
}
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# List of attributes with nullable: true
|
|
96
|
+
def self.openapi_nullable
|
|
97
|
+
Set.new([
|
|
98
|
+
])
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Initializes the object
|
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
103
|
+
def initialize(attributes = {})
|
|
104
|
+
if (!attributes.is_a?(Hash))
|
|
105
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Api::WebhookEndpoint` initialize method"
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
109
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
110
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
111
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Api::WebhookEndpoint`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
112
|
+
end
|
|
113
|
+
h[k.to_sym] = v
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if attributes.key?(:'id')
|
|
117
|
+
self.id = attributes[:'id']
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if attributes.key?(:'url')
|
|
121
|
+
self.url = attributes[:'url']
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if attributes.key?(:'status')
|
|
125
|
+
self.status = attributes[:'status']
|
|
126
|
+
else
|
|
127
|
+
self.status = 'WEBHOOK_ENDPOINT_STATUS_UNSPECIFIED'
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'api_version')
|
|
131
|
+
self.api_version = attributes[:'api_version']
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'previous_api_version')
|
|
135
|
+
self.previous_api_version = attributes[:'previous_api_version']
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if attributes.key?(:'promoted_at')
|
|
139
|
+
self.promoted_at = attributes[:'promoted_at']
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if attributes.key?(:'created_at')
|
|
143
|
+
self.created_at = attributes[:'created_at']
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if attributes.key?(:'updated_at')
|
|
147
|
+
self.updated_at = attributes[:'updated_at']
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
152
|
+
# @return Array for valid properties with the reasons
|
|
153
|
+
def list_invalid_properties
|
|
154
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
155
|
+
invalid_properties = Array.new
|
|
156
|
+
invalid_properties
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Check to see if the all the properties in the model are valid
|
|
160
|
+
# @return true if the model is valid
|
|
161
|
+
def valid?
|
|
162
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
163
|
+
true
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Checks equality by comparing each attribute.
|
|
167
|
+
# @param [Object] Object to be compared
|
|
168
|
+
def ==(o)
|
|
169
|
+
return true if self.equal?(o)
|
|
170
|
+
self.class == o.class &&
|
|
171
|
+
id == o.id &&
|
|
172
|
+
url == o.url &&
|
|
173
|
+
status == o.status &&
|
|
174
|
+
api_version == o.api_version &&
|
|
175
|
+
previous_api_version == o.previous_api_version &&
|
|
176
|
+
promoted_at == o.promoted_at &&
|
|
177
|
+
created_at == o.created_at &&
|
|
178
|
+
updated_at == o.updated_at
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# @see the `==` method
|
|
182
|
+
# @param [Object] Object to be compared
|
|
183
|
+
def eql?(o)
|
|
184
|
+
self == o
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Calculates hash code according to all attributes.
|
|
188
|
+
# @return [Integer] Hash code
|
|
189
|
+
def hash
|
|
190
|
+
[id, url, status, api_version, previous_api_version, promoted_at, created_at, updated_at].hash
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Builds the object from hash
|
|
194
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
195
|
+
# @return [Object] Returns the model itself
|
|
196
|
+
def self.build_from_hash(attributes)
|
|
197
|
+
return nil unless attributes.is_a?(Hash)
|
|
198
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
199
|
+
transformed_hash = {}
|
|
200
|
+
openapi_types.each_pair do |key, type|
|
|
201
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
202
|
+
transformed_hash["#{key}"] = nil
|
|
203
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
204
|
+
# check to ensure the input is an array given that the attribute
|
|
205
|
+
# is documented as an array but the input is not
|
|
206
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
207
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
208
|
+
end
|
|
209
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
210
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
new(transformed_hash)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Deserializes the data based on type
|
|
217
|
+
# @param string type Data type
|
|
218
|
+
# @param string value Value to be deserialized
|
|
219
|
+
# @return [Object] Deserialized data
|
|
220
|
+
def self._deserialize(type, value)
|
|
221
|
+
case type.to_sym
|
|
222
|
+
when :Time
|
|
223
|
+
Time.parse(value)
|
|
224
|
+
when :Date
|
|
225
|
+
Date.parse(value)
|
|
226
|
+
when :String
|
|
227
|
+
value.to_s
|
|
228
|
+
when :Integer
|
|
229
|
+
value.to_i
|
|
230
|
+
when :Float
|
|
231
|
+
value.to_f
|
|
232
|
+
when :Boolean
|
|
233
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
234
|
+
true
|
|
235
|
+
else
|
|
236
|
+
false
|
|
237
|
+
end
|
|
238
|
+
when :Object
|
|
239
|
+
# generic object (usually a Hash), return directly
|
|
240
|
+
value
|
|
241
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
242
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
243
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
244
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
245
|
+
k_type = Regexp.last_match[:k_type]
|
|
246
|
+
v_type = Regexp.last_match[:v_type]
|
|
247
|
+
{}.tap do |hash|
|
|
248
|
+
value.each do |k, v|
|
|
249
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
else # model
|
|
253
|
+
# models (e.g. Pet) or oneOf
|
|
254
|
+
klass = Api.const_get(type)
|
|
255
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Returns the string representation of the object
|
|
260
|
+
# @return [String] String presentation of the object
|
|
261
|
+
def to_s
|
|
262
|
+
to_hash.to_s
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
266
|
+
# @return [Hash] Returns the object in the form of hash
|
|
267
|
+
def to_body
|
|
268
|
+
to_hash
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# Returns the object in the form of hash
|
|
272
|
+
# @return [Hash] Returns the object in the form of hash
|
|
273
|
+
def to_hash
|
|
274
|
+
hash = {}
|
|
275
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
276
|
+
value = self.send(attr)
|
|
277
|
+
if value.nil?
|
|
278
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
279
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
hash[param] = _to_hash(value)
|
|
283
|
+
end
|
|
284
|
+
hash
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Outputs non-array value in the form of hash
|
|
288
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
289
|
+
# @param [Object] value Any valid value
|
|
290
|
+
# @return [Hash] Returns the value in the form of hash
|
|
291
|
+
def _to_hash(value)
|
|
292
|
+
if value.is_a?(Array)
|
|
293
|
+
value.compact.map { |v| _to_hash(v) }
|
|
294
|
+
elsif value.is_a?(Hash)
|
|
295
|
+
{}.tap do |hash|
|
|
296
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
297
|
+
end
|
|
298
|
+
elsif value.respond_to? :to_hash
|
|
299
|
+
value.to_hash
|
|
300
|
+
else
|
|
301
|
+
value
|
|
302
|
+
end
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Jamm API
|
|
3
|
+
|
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.9.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Api
|
|
17
|
+
class WebhookEndpointStatus
|
|
18
|
+
UNSPECIFIED = "WEBHOOK_ENDPOINT_STATUS_UNSPECIFIED".freeze
|
|
19
|
+
LIVE = "WEBHOOK_ENDPOINT_STATUS_LIVE".freeze
|
|
20
|
+
TEST = "WEBHOOK_ENDPOINT_STATUS_TEST".freeze
|
|
21
|
+
DISABLED = "WEBHOOK_ENDPOINT_STATUS_DISABLED".freeze
|
|
22
|
+
|
|
23
|
+
def self.all_vars
|
|
24
|
+
@all_vars ||= [UNSPECIFIED, LIVE, TEST, DISABLED].freeze
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Builds the enum from string
|
|
28
|
+
# @param [String] The enum value in the form of the string
|
|
29
|
+
# @return [String] The enum value
|
|
30
|
+
def self.build_from_hash(value)
|
|
31
|
+
new.build_from_hash(value)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Builds the enum from string
|
|
35
|
+
# @param [String] The enum value in the form of the string
|
|
36
|
+
# @return [String] The enum value
|
|
37
|
+
def build_from_hash(value)
|
|
38
|
+
return value if WebhookEndpointStatus.all_vars.include?(value)
|
|
39
|
+
raise "Invalid ENUM value #{value} for class #WebhookEndpointStatus"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
data/lib/jamm/api.rb
CHANGED
|
@@ -19,6 +19,7 @@ require 'jamm/api/configuration'
|
|
|
19
19
|
# Models
|
|
20
20
|
require 'jamm/api/models/apiv1_error'
|
|
21
21
|
require 'jamm/api/models/apiv1_status'
|
|
22
|
+
require 'jamm/api/models/charge_message_api_source'
|
|
22
23
|
require 'jamm/api/models/customer_service_update_customer_body'
|
|
23
24
|
require 'jamm/api/models/googlerpc_status'
|
|
24
25
|
require 'jamm/api/models/protobuf_any'
|
|
@@ -47,6 +48,8 @@ require 'jamm/api/models/v1_create_contract_without_charge_request'
|
|
|
47
48
|
require 'jamm/api/models/v1_create_contract_without_charge_response'
|
|
48
49
|
require 'jamm/api/models/v1_create_customer_request'
|
|
49
50
|
require 'jamm/api/models/v1_create_customer_response'
|
|
51
|
+
require 'jamm/api/models/v1_create_webhook_endpoint_request'
|
|
52
|
+
require 'jamm/api/models/v1_create_webhook_endpoint_response'
|
|
50
53
|
require 'jamm/api/models/v1_customer'
|
|
51
54
|
require 'jamm/api/models/v1_delete_customer_response'
|
|
52
55
|
require 'jamm/api/models/v1_deposit_type'
|
|
@@ -80,14 +83,21 @@ require 'jamm/api/models/v1_pagination'
|
|
|
80
83
|
require 'jamm/api/models/v1_payment_authorization_status'
|
|
81
84
|
require 'jamm/api/models/v1_payment_link'
|
|
82
85
|
require 'jamm/api/models/v1_ping_response'
|
|
86
|
+
require 'jamm/api/models/v1_promote_webhook_endpoint_response'
|
|
83
87
|
require 'jamm/api/models/v1_refund_info'
|
|
84
88
|
require 'jamm/api/models/v1_refund_request'
|
|
85
89
|
require 'jamm/api/models/v1_refund_response'
|
|
90
|
+
require 'jamm/api/models/v1_refund_webhook_content'
|
|
91
|
+
require 'jamm/api/models/v1_rollback_webhook_endpoint_response'
|
|
86
92
|
require 'jamm/api/models/v1_search_banks_response'
|
|
87
93
|
require 'jamm/api/models/v1_search_branches_response'
|
|
94
|
+
require 'jamm/api/models/v1_trigger_webhook_event_request'
|
|
95
|
+
require 'jamm/api/models/v1_trigger_webhook_event_response'
|
|
88
96
|
require 'jamm/api/models/v1_url'
|
|
89
97
|
require 'jamm/api/models/v1_update_customer_response'
|
|
90
98
|
require 'jamm/api/models/v1_user_account_message'
|
|
99
|
+
require 'jamm/api/models/v1_webhook_endpoint'
|
|
100
|
+
require 'jamm/api/models/v1_webhook_endpoint_status'
|
|
91
101
|
require 'jamm/api/models/v1_withdraw_async_request'
|
|
92
102
|
require 'jamm/api/models/v1_withdraw_async_response'
|
|
93
103
|
require 'jamm/api/models/v1_withdraw_async_status_request'
|
|
@@ -99,6 +109,7 @@ require 'jamm/api/models/v1_withdraw_response'
|
|
|
99
109
|
require 'jamm/api/api/customer_api'
|
|
100
110
|
require 'jamm/api/api/healthcheck_api'
|
|
101
111
|
require 'jamm/api/api/payment_api'
|
|
112
|
+
require 'jamm/api/api/webhook_endpoint_api'
|
|
102
113
|
require 'jamm/api/api/webhook_service_api'
|
|
103
114
|
|
|
104
115
|
module Api
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Code generated by make sdkversions. DO NOT EDIT.
|
|
4
|
+
#
|
|
5
|
+
# Bumped only by the release workflow, which checks the API serves it first.
|
|
6
|
+
|
|
7
|
+
module Jamm
|
|
8
|
+
# The Jamm API version this SDK was built against.
|
|
9
|
+
API_VERSION = '2026-08-26'
|
|
10
|
+
end
|
data/lib/jamm/client.rb
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
module Jamm
|
|
4
4
|
module Client
|
|
5
|
+
# Applied after header_params are merged so per-call or default_headers overrides cannot change the version.
|
|
6
|
+
module PinAPIVersion
|
|
7
|
+
def build_request(http_method, path, opts = {})
|
|
8
|
+
request = super
|
|
9
|
+
headers = request.options[:headers]
|
|
10
|
+
headers.delete_if { |k, _| k.to_s.casecmp?('Jamm-API-Version') }
|
|
11
|
+
headers['Jamm-API-Version'] = Jamm.api_version
|
|
12
|
+
request
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
5
16
|
def self.handler(merchant: nil)
|
|
6
17
|
base = Jamm::OpenAPI::ApiClient.new
|
|
7
18
|
|
|
@@ -9,7 +20,8 @@ module Jamm
|
|
|
9
20
|
base.config.host = Jamm.openapi.config.host
|
|
10
21
|
base.config.scheme = Jamm.openapi.config.scheme
|
|
11
22
|
base.default_headers['Authorization'] = "Bearer #{Jamm::OAuth.token}"
|
|
12
|
-
base.default_headers['
|
|
23
|
+
base.default_headers['Jamm-SDK-Version'] = "ruby:#{Jamm::VERSION}"
|
|
24
|
+
base.extend(PinAPIVersion)
|
|
13
25
|
|
|
14
26
|
# Platform feature, optionally set merchant id to call Jamm API
|
|
15
27
|
# on behalf of the merchant.
|
data/lib/jamm/version.rb
CHANGED
data/lib/jamm/webhook.rb
CHANGED
|
@@ -66,11 +66,10 @@ module Jamm
|
|
|
66
66
|
def self.build(klass, attributes)
|
|
67
67
|
return nil if attributes.nil?
|
|
68
68
|
|
|
69
|
-
known = klass.attribute_map
|
|
70
69
|
types = klass.openapi_types
|
|
71
70
|
filtered = attributes.each_with_object({}) do |(key, value), acc|
|
|
72
|
-
sym = key
|
|
73
|
-
next
|
|
71
|
+
sym = attribute_for(klass, key)
|
|
72
|
+
next if sym.nil?
|
|
74
73
|
|
|
75
74
|
acc[sym] = coerce(types[sym], value)
|
|
76
75
|
end
|
|
@@ -78,6 +77,21 @@ module Jamm
|
|
|
78
77
|
klass.new(filtered)
|
|
79
78
|
end
|
|
80
79
|
|
|
80
|
+
# attribute_map is { snake_symbol => jsonCamelName }; accept either
|
|
81
|
+
# spelling. Both cannot arrive together; the last would win.
|
|
82
|
+
def self.attribute_for(klass, key)
|
|
83
|
+
sym = key.to_sym
|
|
84
|
+
return sym if klass.attribute_map.key?(sym)
|
|
85
|
+
|
|
86
|
+
by_serialized(klass)[sym]
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Memoised per class: Hash#key is a linear scan, paid once per field otherwise.
|
|
90
|
+
def self.by_serialized(klass)
|
|
91
|
+
@by_serialized ||= {}
|
|
92
|
+
@by_serialized[klass] ||= klass.attribute_map.invert
|
|
93
|
+
end
|
|
94
|
+
|
|
81
95
|
# Refund webhooks (REFUND_SUCCEEDED / REFUND_FAILED) deliver `content` as a
|
|
82
96
|
# nested { transaction, refund } wrapper instead of a flat ChargeMessage.
|
|
83
97
|
# Flatten it back into a ChargeMessage so callers always receive the same shape.
|
data/lib/jamm.rb
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'date'
|
|
3
4
|
require 'rest-client'
|
|
4
5
|
require 'openssl'
|
|
5
6
|
require 'json'
|
|
6
7
|
|
|
8
|
+
require 'jamm/api_version'
|
|
7
9
|
require 'jamm/client'
|
|
8
10
|
require 'jamm/errors'
|
|
9
11
|
require 'jamm/oauth'
|
|
@@ -38,13 +40,33 @@ module Jamm
|
|
|
38
40
|
@max_retry = 0
|
|
39
41
|
|
|
40
42
|
class << self
|
|
41
|
-
attr_accessor :api, :client_id, :client_secret, :api_base, :environment, :mode, :oauth_base, :
|
|
43
|
+
attr_accessor :api, :client_id, :client_secret, :api_base, :environment, :mode, :oauth_base, :connect_base,
|
|
42
44
|
:openapi, :open_timeout, :read_timeout, :max_retry, :retry_initial_delay, :retry_max_delay
|
|
43
45
|
end
|
|
44
46
|
|
|
47
|
+
# The Jamm-API-Version sent on every request; defaults to the version this SDK was built against.
|
|
48
|
+
def self.api_version
|
|
49
|
+
@api_version || Jamm::API_VERSION
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def self.api_version=(version)
|
|
53
|
+
if version.nil? || version.to_s.empty?
|
|
54
|
+
@api_version = nil
|
|
55
|
+
return
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
version = version.to_s
|
|
59
|
+
raise ArgumentError, "invalid api_version \"#{version}\": expected YYYY-MM-DD" unless version.match?(/\A\d{4}-\d{2}-\d{2}\z/) && Date.valid_date?(*version.split('-').map(&:to_i))
|
|
60
|
+
raise ArgumentError, "api_version #{version} is newer than this SDK supports (#{Jamm::API_VERSION}); upgrade the SDK to use it" if version > Jamm::API_VERSION
|
|
61
|
+
|
|
62
|
+
@api_version = version
|
|
63
|
+
end
|
|
64
|
+
|
|
45
65
|
# Configure SDK with Client ID and Secret.
|
|
46
66
|
# Optionally enable `platform` for platformers to call Jamm API on behalf of their merchant.
|
|
47
|
-
|
|
67
|
+
# Optionally pin `api_version` (YYYY-MM-DD) to an API version older than the one this SDK was built against.
|
|
68
|
+
def self.configure(client_id:, client_secret:, env:, platform: false, api_version: nil)
|
|
69
|
+
self.api_version = api_version
|
|
48
70
|
Jamm.client_id = client_id
|
|
49
71
|
Jamm.client_secret = client_secret
|
|
50
72
|
|
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: 2.
|
|
4
|
+
version: 2.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jamm
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07
|
|
11
|
+
date: 2026-10-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -78,12 +78,14 @@ files:
|
|
|
78
78
|
- lib/jamm/api/api/customer_api.rb
|
|
79
79
|
- lib/jamm/api/api/healthcheck_api.rb
|
|
80
80
|
- lib/jamm/api/api/payment_api.rb
|
|
81
|
+
- lib/jamm/api/api/webhook_endpoint_api.rb
|
|
81
82
|
- lib/jamm/api/api/webhook_service_api.rb
|
|
82
83
|
- lib/jamm/api/api_client.rb
|
|
83
84
|
- lib/jamm/api/api_error.rb
|
|
84
85
|
- lib/jamm/api/configuration.rb
|
|
85
86
|
- lib/jamm/api/models/apiv1_error.rb
|
|
86
87
|
- lib/jamm/api/models/apiv1_status.rb
|
|
88
|
+
- lib/jamm/api/models/charge_message_api_source.rb
|
|
87
89
|
- lib/jamm/api/models/customer_service_update_customer_body.rb
|
|
88
90
|
- lib/jamm/api/models/googlerpc_status.rb
|
|
89
91
|
- lib/jamm/api/models/protobuf_any.rb
|
|
@@ -112,6 +114,8 @@ files:
|
|
|
112
114
|
- lib/jamm/api/models/v1_create_contract_without_charge_response.rb
|
|
113
115
|
- lib/jamm/api/models/v1_create_customer_request.rb
|
|
114
116
|
- lib/jamm/api/models/v1_create_customer_response.rb
|
|
117
|
+
- lib/jamm/api/models/v1_create_webhook_endpoint_request.rb
|
|
118
|
+
- lib/jamm/api/models/v1_create_webhook_endpoint_response.rb
|
|
115
119
|
- lib/jamm/api/models/v1_customer.rb
|
|
116
120
|
- lib/jamm/api/models/v1_delete_customer_response.rb
|
|
117
121
|
- lib/jamm/api/models/v1_deposit_type.rb
|
|
@@ -145,14 +149,21 @@ files:
|
|
|
145
149
|
- lib/jamm/api/models/v1_payment_authorization_status.rb
|
|
146
150
|
- lib/jamm/api/models/v1_payment_link.rb
|
|
147
151
|
- lib/jamm/api/models/v1_ping_response.rb
|
|
152
|
+
- lib/jamm/api/models/v1_promote_webhook_endpoint_response.rb
|
|
148
153
|
- lib/jamm/api/models/v1_refund_info.rb
|
|
149
154
|
- lib/jamm/api/models/v1_refund_request.rb
|
|
150
155
|
- lib/jamm/api/models/v1_refund_response.rb
|
|
156
|
+
- lib/jamm/api/models/v1_refund_webhook_content.rb
|
|
157
|
+
- lib/jamm/api/models/v1_rollback_webhook_endpoint_response.rb
|
|
151
158
|
- lib/jamm/api/models/v1_search_banks_response.rb
|
|
152
159
|
- lib/jamm/api/models/v1_search_branches_response.rb
|
|
160
|
+
- lib/jamm/api/models/v1_trigger_webhook_event_request.rb
|
|
161
|
+
- lib/jamm/api/models/v1_trigger_webhook_event_response.rb
|
|
153
162
|
- lib/jamm/api/models/v1_update_customer_response.rb
|
|
154
163
|
- lib/jamm/api/models/v1_url.rb
|
|
155
164
|
- lib/jamm/api/models/v1_user_account_message.rb
|
|
165
|
+
- lib/jamm/api/models/v1_webhook_endpoint.rb
|
|
166
|
+
- lib/jamm/api/models/v1_webhook_endpoint_status.rb
|
|
156
167
|
- lib/jamm/api/models/v1_withdraw_async_request.rb
|
|
157
168
|
- lib/jamm/api/models/v1_withdraw_async_response.rb
|
|
158
169
|
- lib/jamm/api/models/v1_withdraw_async_status_request.rb
|
|
@@ -161,6 +172,7 @@ files:
|
|
|
161
172
|
- lib/jamm/api/models/v1_withdraw_response.rb
|
|
162
173
|
- lib/jamm/api/version.rb
|
|
163
174
|
- lib/jamm/api_patches.rb
|
|
175
|
+
- lib/jamm/api_version.rb
|
|
164
176
|
- lib/jamm/client.rb
|
|
165
177
|
- lib/jamm/customer.rb
|
|
166
178
|
- lib/jamm/deprecation.rb
|