jamm 2.0.0 → 2.2.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 +66 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +7 -4
- data/jamm.gemspec +1 -0
- data/lib/jamm/api/api/payment_api.rb +78 -78
- data/lib/jamm/api/models/v1_buyer.rb +1 -1
- data/lib/jamm/api/models/v1_charge.rb +1 -1
- data/lib/jamm/api/models/v1_charge_error.rb +226 -0
- data/lib/jamm/api/models/v1_charge_message.rb +58 -4
- data/lib/jamm/api/models/v1_charge_message_status.rb +2 -1
- data/lib/jamm/api/models/v1_charge_result.rb +13 -4
- data/lib/jamm/api/models/v1_error_type.rb +3 -1
- data/lib/jamm/api/models/v1_event_type.rb +3 -2
- data/lib/jamm/api/models/v1_initial_charge.rb +13 -3
- data/lib/jamm/api/models/v1_message_response.rb +13 -4
- data/lib/jamm/api/models/v1_off_session_payment_async_request.rb +15 -5
- data/lib/jamm/api/models/v1_off_session_payment_request.rb +1 -1
- data/lib/jamm/api/models/v1_on_session_payment_request.rb +1 -1
- data/lib/jamm/api/models/v1_refund_info.rb +275 -0
- data/lib/jamm/api/models/v1_refund_request.rb +15 -5
- data/lib/jamm/api/models/v1_withdraw_async_request.rb +15 -5
- data/lib/jamm/api/models/v1_withdraw_request.rb +1 -1
- data/lib/jamm/api.rb +2 -0
- data/lib/jamm/payment.rb +24 -0
- data/lib/jamm/version.rb +1 -1
- data/lib/jamm/webhook.rb +5 -1
- metadata +19 -2
|
@@ -0,0 +1,275 @@
|
|
|
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
|
+
# RefundInfo contains refund-specific details for refund and refund_failed webhook events.
|
|
18
|
+
class RefundInfo
|
|
19
|
+
# External refund identifier (rfd-*).
|
|
20
|
+
attr_accessor :refund_id
|
|
21
|
+
|
|
22
|
+
# Amount refunded for this event.
|
|
23
|
+
attr_accessor :amount_refunded
|
|
24
|
+
|
|
25
|
+
# Jamm fee for this refund event.
|
|
26
|
+
attr_accessor :jamm_fee
|
|
27
|
+
|
|
28
|
+
# Consumption tax (10% of the Jamm fee).
|
|
29
|
+
attr_accessor :consumption_tax
|
|
30
|
+
|
|
31
|
+
# Whether the original transaction's Jamm fee was waived (true for same-day cancel).
|
|
32
|
+
attr_accessor :original_transaction_fee_waived
|
|
33
|
+
|
|
34
|
+
attr_accessor :error
|
|
35
|
+
|
|
36
|
+
# When the refund was processed (not present on refund_failed events).
|
|
37
|
+
attr_accessor :processed_at
|
|
38
|
+
|
|
39
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
40
|
+
def self.attribute_map
|
|
41
|
+
{
|
|
42
|
+
:'refund_id' => :'refundId',
|
|
43
|
+
:'amount_refunded' => :'amountRefunded',
|
|
44
|
+
:'jamm_fee' => :'jammFee',
|
|
45
|
+
:'consumption_tax' => :'consumptionTax',
|
|
46
|
+
:'original_transaction_fee_waived' => :'originalTransactionFeeWaived',
|
|
47
|
+
:'error' => :'error',
|
|
48
|
+
:'processed_at' => :'processedAt'
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Returns all the JSON keys this model knows about
|
|
53
|
+
def self.acceptable_attributes
|
|
54
|
+
attribute_map.values
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Attribute type mapping.
|
|
58
|
+
def self.openapi_types
|
|
59
|
+
{
|
|
60
|
+
:'refund_id' => :'String',
|
|
61
|
+
:'amount_refunded' => :'Integer',
|
|
62
|
+
:'jamm_fee' => :'Integer',
|
|
63
|
+
:'consumption_tax' => :'Integer',
|
|
64
|
+
:'original_transaction_fee_waived' => :'Boolean',
|
|
65
|
+
:'error' => :'Apiv1Error',
|
|
66
|
+
:'processed_at' => :'String'
|
|
67
|
+
}
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# List of attributes with nullable: true
|
|
71
|
+
def self.openapi_nullable
|
|
72
|
+
Set.new([
|
|
73
|
+
])
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Initializes the object
|
|
77
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
78
|
+
def initialize(attributes = {})
|
|
79
|
+
if (!attributes.is_a?(Hash))
|
|
80
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Api::RefundInfo` initialize method"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
84
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
85
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
86
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Api::RefundInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
87
|
+
end
|
|
88
|
+
h[k.to_sym] = v
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if attributes.key?(:'refund_id')
|
|
92
|
+
self.refund_id = attributes[:'refund_id']
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'amount_refunded')
|
|
96
|
+
self.amount_refunded = attributes[:'amount_refunded']
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if attributes.key?(:'jamm_fee')
|
|
100
|
+
self.jamm_fee = attributes[:'jamm_fee']
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if attributes.key?(:'consumption_tax')
|
|
104
|
+
self.consumption_tax = attributes[:'consumption_tax']
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
if attributes.key?(:'original_transaction_fee_waived')
|
|
108
|
+
self.original_transaction_fee_waived = attributes[:'original_transaction_fee_waived']
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if attributes.key?(:'error')
|
|
112
|
+
self.error = attributes[:'error']
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if attributes.key?(:'processed_at')
|
|
116
|
+
self.processed_at = attributes[:'processed_at']
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
121
|
+
# @return Array for valid properties with the reasons
|
|
122
|
+
def list_invalid_properties
|
|
123
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
124
|
+
invalid_properties = Array.new
|
|
125
|
+
invalid_properties
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Check to see if the all the properties in the model are valid
|
|
129
|
+
# @return true if the model is valid
|
|
130
|
+
def valid?
|
|
131
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
132
|
+
true
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Checks equality by comparing each attribute.
|
|
136
|
+
# @param [Object] Object to be compared
|
|
137
|
+
def ==(o)
|
|
138
|
+
return true if self.equal?(o)
|
|
139
|
+
self.class == o.class &&
|
|
140
|
+
refund_id == o.refund_id &&
|
|
141
|
+
amount_refunded == o.amount_refunded &&
|
|
142
|
+
jamm_fee == o.jamm_fee &&
|
|
143
|
+
consumption_tax == o.consumption_tax &&
|
|
144
|
+
original_transaction_fee_waived == o.original_transaction_fee_waived &&
|
|
145
|
+
error == o.error &&
|
|
146
|
+
processed_at == o.processed_at
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# @see the `==` method
|
|
150
|
+
# @param [Object] Object to be compared
|
|
151
|
+
def eql?(o)
|
|
152
|
+
self == o
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Calculates hash code according to all attributes.
|
|
156
|
+
# @return [Integer] Hash code
|
|
157
|
+
def hash
|
|
158
|
+
[refund_id, amount_refunded, jamm_fee, consumption_tax, original_transaction_fee_waived, error, processed_at].hash
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Builds the object from hash
|
|
162
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
163
|
+
# @return [Object] Returns the model itself
|
|
164
|
+
def self.build_from_hash(attributes)
|
|
165
|
+
return nil unless attributes.is_a?(Hash)
|
|
166
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
167
|
+
transformed_hash = {}
|
|
168
|
+
openapi_types.each_pair do |key, type|
|
|
169
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
170
|
+
transformed_hash["#{key}"] = nil
|
|
171
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
172
|
+
# check to ensure the input is an array given that the attribute
|
|
173
|
+
# is documented as an array but the input is not
|
|
174
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
175
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
176
|
+
end
|
|
177
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
178
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
new(transformed_hash)
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Deserializes the data based on type
|
|
185
|
+
# @param string type Data type
|
|
186
|
+
# @param string value Value to be deserialized
|
|
187
|
+
# @return [Object] Deserialized data
|
|
188
|
+
def self._deserialize(type, value)
|
|
189
|
+
case type.to_sym
|
|
190
|
+
when :Time
|
|
191
|
+
Time.parse(value)
|
|
192
|
+
when :Date
|
|
193
|
+
Date.parse(value)
|
|
194
|
+
when :String
|
|
195
|
+
value.to_s
|
|
196
|
+
when :Integer
|
|
197
|
+
value.to_i
|
|
198
|
+
when :Float
|
|
199
|
+
value.to_f
|
|
200
|
+
when :Boolean
|
|
201
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
202
|
+
true
|
|
203
|
+
else
|
|
204
|
+
false
|
|
205
|
+
end
|
|
206
|
+
when :Object
|
|
207
|
+
# generic object (usually a Hash), return directly
|
|
208
|
+
value
|
|
209
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
210
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
211
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
212
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
213
|
+
k_type = Regexp.last_match[:k_type]
|
|
214
|
+
v_type = Regexp.last_match[:v_type]
|
|
215
|
+
{}.tap do |hash|
|
|
216
|
+
value.each do |k, v|
|
|
217
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
else # model
|
|
221
|
+
# models (e.g. Pet) or oneOf
|
|
222
|
+
klass = Api.const_get(type)
|
|
223
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Returns the string representation of the object
|
|
228
|
+
# @return [String] String presentation of the object
|
|
229
|
+
def to_s
|
|
230
|
+
to_hash.to_s
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
234
|
+
# @return [Hash] Returns the object in the form of hash
|
|
235
|
+
def to_body
|
|
236
|
+
to_hash
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Returns the object in the form of hash
|
|
240
|
+
# @return [Hash] Returns the object in the form of hash
|
|
241
|
+
def to_hash
|
|
242
|
+
hash = {}
|
|
243
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
244
|
+
value = self.send(attr)
|
|
245
|
+
if value.nil?
|
|
246
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
247
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
hash[param] = _to_hash(value)
|
|
251
|
+
end
|
|
252
|
+
hash
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Outputs non-array value in the form of hash
|
|
256
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
257
|
+
# @param [Object] value Any valid value
|
|
258
|
+
# @return [Hash] Returns the value in the form of hash
|
|
259
|
+
def _to_hash(value)
|
|
260
|
+
if value.is_a?(Array)
|
|
261
|
+
value.compact.map { |v| _to_hash(v) }
|
|
262
|
+
elsif value.is_a?(Hash)
|
|
263
|
+
{}.tap do |hash|
|
|
264
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
265
|
+
end
|
|
266
|
+
elsif value.respond_to? :to_hash
|
|
267
|
+
value.to_hash
|
|
268
|
+
else
|
|
269
|
+
value
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
end
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Api
|
|
17
|
-
# Request message for refunding a charge. The refund is always processed asynchronously. The final result is delivered via webhook (`
|
|
17
|
+
# Request message for refunding a charge. The refund is always processed asynchronously. The final result is delivered via webhook (`refund_succeeded`).
|
|
18
18
|
class RefundRequest
|
|
19
19
|
# The charge ID to refund. 返金する決済のID。 @gotags: validate:\"required\"
|
|
20
20
|
attr_accessor :charge_id
|
|
@@ -22,11 +22,15 @@ module Api
|
|
|
22
22
|
# Optional refund amount in JPY. If omitted, the full refundable amount is used. 返金金額(日本円)。 省略した場合、全額返金となります。
|
|
23
23
|
attr_accessor :amount
|
|
24
24
|
|
|
25
|
+
# When true, only attempts cancellation without falling back to bank transfer refund. Defaults to false (fallback enabled). trueの場合、キャンセルのみを試行し、銀行振込返金への フォールバックを行いません。デフォルトはfalse(フォールバック有効)。
|
|
26
|
+
attr_accessor :cancel_only
|
|
27
|
+
|
|
25
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
26
29
|
def self.attribute_map
|
|
27
30
|
{
|
|
28
31
|
:'charge_id' => :'chargeId',
|
|
29
|
-
:'amount' => :'amount'
|
|
32
|
+
:'amount' => :'amount',
|
|
33
|
+
:'cancel_only' => :'cancelOnly'
|
|
30
34
|
}
|
|
31
35
|
end
|
|
32
36
|
|
|
@@ -39,7 +43,8 @@ module Api
|
|
|
39
43
|
def self.openapi_types
|
|
40
44
|
{
|
|
41
45
|
:'charge_id' => :'String',
|
|
42
|
-
:'amount' => :'Integer'
|
|
46
|
+
:'amount' => :'Integer',
|
|
47
|
+
:'cancel_only' => :'Boolean'
|
|
43
48
|
}
|
|
44
49
|
end
|
|
45
50
|
|
|
@@ -71,6 +76,10 @@ module Api
|
|
|
71
76
|
if attributes.key?(:'amount')
|
|
72
77
|
self.amount = attributes[:'amount']
|
|
73
78
|
end
|
|
79
|
+
|
|
80
|
+
if attributes.key?(:'cancel_only')
|
|
81
|
+
self.cancel_only = attributes[:'cancel_only']
|
|
82
|
+
end
|
|
74
83
|
end
|
|
75
84
|
|
|
76
85
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -94,7 +103,8 @@ module Api
|
|
|
94
103
|
return true if self.equal?(o)
|
|
95
104
|
self.class == o.class &&
|
|
96
105
|
charge_id == o.charge_id &&
|
|
97
|
-
amount == o.amount
|
|
106
|
+
amount == o.amount &&
|
|
107
|
+
cancel_only == o.cancel_only
|
|
98
108
|
end
|
|
99
109
|
|
|
100
110
|
# @see the `==` method
|
|
@@ -106,7 +116,7 @@ module Api
|
|
|
106
116
|
# Calculates hash code according to all attributes.
|
|
107
117
|
# @return [Integer] Hash code
|
|
108
118
|
def hash
|
|
109
|
-
[charge_id, amount].hash
|
|
119
|
+
[charge_id, amount, cancel_only].hash
|
|
110
120
|
end
|
|
111
121
|
|
|
112
122
|
# Builds the object from hash
|
|
@@ -14,17 +14,21 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Api
|
|
17
|
-
# This message represents a request to withdraw money from a customer asynchronously. It contains the customer ID and the amount to withdraw.
|
|
17
|
+
# This message represents a request to withdraw money from a customer asynchronously. It contains the customer ID and the amount to withdraw. Supports triggerError in charge.metadata for test error simulation. See InitialCharge.metadata.
|
|
18
18
|
class WithdrawAsyncRequest
|
|
19
19
|
attr_accessor :customer
|
|
20
20
|
|
|
21
21
|
attr_accessor :charge
|
|
22
22
|
|
|
23
|
+
# Merchant-supplied idempotency key for retry safety. When present, a retry with the same (merchant, idempotency_key) returns the original charge instead of creating a new one. When absent (empty), the server generates a UUID per call (current behavior). ASCII only, 1-255 chars matching ^[a-zA-Z0-9_\\-]{1,255}$.
|
|
24
|
+
attr_accessor :idempotency_key
|
|
25
|
+
|
|
23
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
24
27
|
def self.attribute_map
|
|
25
28
|
{
|
|
26
29
|
:'customer' => :'customer',
|
|
27
|
-
:'charge' => :'charge'
|
|
30
|
+
:'charge' => :'charge',
|
|
31
|
+
:'idempotency_key' => :'idempotencyKey'
|
|
28
32
|
}
|
|
29
33
|
end
|
|
30
34
|
|
|
@@ -37,7 +41,8 @@ module Api
|
|
|
37
41
|
def self.openapi_types
|
|
38
42
|
{
|
|
39
43
|
:'customer' => :'String',
|
|
40
|
-
:'charge' => :'InitialCharge'
|
|
44
|
+
:'charge' => :'InitialCharge',
|
|
45
|
+
:'idempotency_key' => :'String'
|
|
41
46
|
}
|
|
42
47
|
end
|
|
43
48
|
|
|
@@ -69,6 +74,10 @@ module Api
|
|
|
69
74
|
if attributes.key?(:'charge')
|
|
70
75
|
self.charge = attributes[:'charge']
|
|
71
76
|
end
|
|
77
|
+
|
|
78
|
+
if attributes.key?(:'idempotency_key')
|
|
79
|
+
self.idempotency_key = attributes[:'idempotency_key']
|
|
80
|
+
end
|
|
72
81
|
end
|
|
73
82
|
|
|
74
83
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -92,7 +101,8 @@ module Api
|
|
|
92
101
|
return true if self.equal?(o)
|
|
93
102
|
self.class == o.class &&
|
|
94
103
|
customer == o.customer &&
|
|
95
|
-
charge == o.charge
|
|
104
|
+
charge == o.charge &&
|
|
105
|
+
idempotency_key == o.idempotency_key
|
|
96
106
|
end
|
|
97
107
|
|
|
98
108
|
# @see the `==` method
|
|
@@ -104,7 +114,7 @@ module Api
|
|
|
104
114
|
# Calculates hash code according to all attributes.
|
|
105
115
|
# @return [Integer] Hash code
|
|
106
116
|
def hash
|
|
107
|
-
[customer, charge].hash
|
|
117
|
+
[customer, charge, idempotency_key].hash
|
|
108
118
|
end
|
|
109
119
|
|
|
110
120
|
# Builds the object from hash
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Api
|
|
17
|
-
# This message represents a request to withdraw money from a customer. It contains the customer ID and the amount to withdraw.
|
|
17
|
+
# This message represents a request to withdraw money from a customer. It contains the customer ID and the amount to withdraw. Supports triggerError in charge.metadata for test error simulation. See InitialCharge.metadata.
|
|
18
18
|
class WithdrawRequest
|
|
19
19
|
attr_accessor :customer
|
|
20
20
|
|
data/lib/jamm/api.rb
CHANGED
|
@@ -33,6 +33,7 @@ require 'jamm/api/models/v1_bank_quota'
|
|
|
33
33
|
require 'jamm/api/models/v1_bank_scheduled_maintenance_period'
|
|
34
34
|
require 'jamm/api/models/v1_buyer'
|
|
35
35
|
require 'jamm/api/models/v1_charge'
|
|
36
|
+
require 'jamm/api/models/v1_charge_error'
|
|
36
37
|
require 'jamm/api/models/v1_charge_message'
|
|
37
38
|
require 'jamm/api/models/v1_charge_message_status'
|
|
38
39
|
require 'jamm/api/models/v1_charge_result'
|
|
@@ -79,6 +80,7 @@ require 'jamm/api/models/v1_pagination'
|
|
|
79
80
|
require 'jamm/api/models/v1_payment_authorization_status'
|
|
80
81
|
require 'jamm/api/models/v1_payment_link'
|
|
81
82
|
require 'jamm/api/models/v1_ping_response'
|
|
83
|
+
require 'jamm/api/models/v1_refund_info'
|
|
82
84
|
require 'jamm/api/models/v1_refund_request'
|
|
83
85
|
require 'jamm/api/models/v1_refund_response'
|
|
84
86
|
require 'jamm/api/models/v1_search_banks_response'
|
data/lib/jamm/payment.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require 'rest-client'
|
|
4
4
|
require 'json'
|
|
5
5
|
require 'base64'
|
|
6
|
+
require 'securerandom'
|
|
6
7
|
require 'jamm/errors'
|
|
7
8
|
|
|
8
9
|
module Jamm
|
|
@@ -50,6 +51,29 @@ module Jamm
|
|
|
50
51
|
raise Jamm::ApiError.from_error(e)
|
|
51
52
|
end
|
|
52
53
|
|
|
54
|
+
# Auto-fills idempotency_key with a UUID when the caller did not supply one,
|
|
55
|
+
# so every async charge is retry-safe by default. A caller-supplied key is
|
|
56
|
+
# left untouched so explicit retries reuse the same value.
|
|
57
|
+
def self.off_session_async(customer:, charge:, idempotency_key: nil, merchant: nil)
|
|
58
|
+
key =
|
|
59
|
+
if idempotency_key.nil? || idempotency_key.strip.empty?
|
|
60
|
+
SecureRandom.uuid
|
|
61
|
+
else
|
|
62
|
+
idempotency_key
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
request = Jamm::OpenAPI::OffSessionPaymentAsyncRequest.new(
|
|
66
|
+
customer: customer,
|
|
67
|
+
charge: charge,
|
|
68
|
+
idempotency_key: key
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
handler = Jamm::Client.handler(merchant: merchant)
|
|
72
|
+
Jamm::OpenAPI::PaymentApi.new(handler).async_off_session_payment(request)
|
|
73
|
+
rescue Jamm::OpenAPI::ApiError => e
|
|
74
|
+
raise Jamm::ApiError.from_error(e)
|
|
75
|
+
end
|
|
76
|
+
|
|
53
77
|
def self.get(charge_id, merchant: nil)
|
|
54
78
|
handler = Jamm::Client.handler(merchant: merchant)
|
|
55
79
|
|
data/lib/jamm/version.rb
CHANGED
data/lib/jamm/webhook.rb
CHANGED
|
@@ -22,7 +22,11 @@ module Jamm
|
|
|
22
22
|
out.content = Jamm::OpenAPI::ChargeMessage.new(json[:content])
|
|
23
23
|
return out
|
|
24
24
|
|
|
25
|
-
when Jamm::OpenAPI::EventType::
|
|
25
|
+
when Jamm::OpenAPI::EventType::REFUND_SUCCEEDED
|
|
26
|
+
out.content = Jamm::OpenAPI::ChargeMessage.new(json[:content])
|
|
27
|
+
return out
|
|
28
|
+
|
|
29
|
+
when Jamm::OpenAPI::EventType::REFUND_FAILED
|
|
26
30
|
out.content = Jamm::OpenAPI::ChargeMessage.new(json[:content])
|
|
27
31
|
return out
|
|
28
32
|
|
metadata
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jamm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.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-
|
|
11
|
+
date: 2026-05-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: base64
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0.2'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0.2'
|
|
13
27
|
- !ruby/object:Gem::Dependency
|
|
14
28
|
name: rest-client
|
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -52,6 +66,7 @@ extra_rdoc_files: []
|
|
|
52
66
|
files:
|
|
53
67
|
- ".gitignore"
|
|
54
68
|
- ".rubocop.yml"
|
|
69
|
+
- CHANGELOG.md
|
|
55
70
|
- Gemfile
|
|
56
71
|
- Gemfile.lock
|
|
57
72
|
- LICENSE
|
|
@@ -83,6 +98,7 @@ files:
|
|
|
83
98
|
- lib/jamm/api/models/v1_bank_scheduled_maintenance_period.rb
|
|
84
99
|
- lib/jamm/api/models/v1_buyer.rb
|
|
85
100
|
- lib/jamm/api/models/v1_charge.rb
|
|
101
|
+
- lib/jamm/api/models/v1_charge_error.rb
|
|
86
102
|
- lib/jamm/api/models/v1_charge_message.rb
|
|
87
103
|
- lib/jamm/api/models/v1_charge_message_status.rb
|
|
88
104
|
- lib/jamm/api/models/v1_charge_result.rb
|
|
@@ -129,6 +145,7 @@ files:
|
|
|
129
145
|
- lib/jamm/api/models/v1_payment_authorization_status.rb
|
|
130
146
|
- lib/jamm/api/models/v1_payment_link.rb
|
|
131
147
|
- lib/jamm/api/models/v1_ping_response.rb
|
|
148
|
+
- lib/jamm/api/models/v1_refund_info.rb
|
|
132
149
|
- lib/jamm/api/models/v1_refund_request.rb
|
|
133
150
|
- lib/jamm/api/models/v1_refund_response.rb
|
|
134
151
|
- lib/jamm/api/models/v1_search_banks_response.rb
|