jamm 1.0.8 → 1.0.10

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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +9 -1
  4. data/Rakefile +5 -0
  5. data/lib/jamm/api/api/customer_api.rb +68 -10
  6. data/lib/jamm/api/api/healthcheck_api.rb +2 -2
  7. data/lib/jamm/api/api/payment_api.rb +145 -20
  8. data/lib/jamm/api/api/webhook_service_api.rb +82 -0
  9. data/lib/jamm/api/api_client.rb +2 -2
  10. data/lib/jamm/api/api_error.rb +2 -2
  11. data/lib/jamm/api/configuration.rb +2 -2
  12. data/lib/jamm/api/models/customer_service_update_customer_body.rb +9 -4
  13. data/lib/jamm/api/models/{rpc_status.rb → googlerpc_status.rb} +5 -5
  14. data/lib/jamm/api/models/protobuf_any.rb +2 -2
  15. data/lib/jamm/api/models/v1_add_charge_request.rb +2 -2
  16. data/lib/jamm/api/models/v1_add_charge_response.rb +2 -2
  17. data/lib/jamm/api/models/v1_buyer.rb +11 -3
  18. data/lib/jamm/api/models/v1_charge.rb +2 -2
  19. data/lib/jamm/api/models/v1_charge_message.rb +297 -0
  20. data/lib/jamm/api/models/v1_charge_message_status.rb +44 -0
  21. data/lib/jamm/api/models/v1_charge_result.rb +285 -0
  22. data/lib/jamm/api/models/v1_contract.rb +2 -2
  23. data/lib/jamm/api/models/v1_contract_message.rb +222 -0
  24. data/lib/jamm/api/models/v1_contract_status.rb +2 -2
  25. data/lib/jamm/api/models/v1_create_contract_with_charge_request.rb +2 -2
  26. data/lib/jamm/api/models/v1_create_contract_with_charge_response.rb +2 -2
  27. data/lib/jamm/api/models/v1_create_contract_without_charge_request.rb +2 -2
  28. data/lib/jamm/api/models/v1_create_contract_without_charge_response.rb +2 -2
  29. data/lib/jamm/api/models/v1_create_customer_request.rb +2 -2
  30. data/lib/jamm/api/models/v1_create_customer_response.rb +2 -2
  31. data/lib/jamm/api/models/v1_customer.rb +9 -4
  32. data/lib/jamm/api/models/v1_delete_customer_response.rb +2 -2
  33. data/lib/jamm/api/models/v1_error.rb +217 -0
  34. data/lib/jamm/api/models/v1_event_type.rb +46 -0
  35. data/lib/jamm/api/models/v1_get_charge_response.rb +212 -0
  36. data/lib/jamm/api/models/v1_get_charges_response.rb +214 -0
  37. data/lib/jamm/api/models/v1_get_contract_response.rb +13 -13
  38. data/lib/jamm/api/models/v1_get_customer_response.rb +2 -2
  39. data/lib/jamm/api/models/v1_initial_charge.rb +2 -2
  40. data/lib/jamm/api/models/v1_merchant.rb +2 -2
  41. data/lib/jamm/api/models/v1_merchant_customer.rb +2 -2
  42. data/lib/jamm/api/models/v1_merchant_webhook_message.rb +259 -0
  43. data/lib/jamm/api/models/v1_message_response.rb +217 -0
  44. data/lib/jamm/api/models/v1_pagination.rb +212 -0
  45. data/lib/jamm/api/models/v1_payment_link.rb +2 -2
  46. data/lib/jamm/api/models/v1_ping_response.rb +2 -2
  47. data/lib/jamm/api/models/v1_update_customer_response.rb +2 -2
  48. data/lib/jamm/api/models/v1_url.rb +2 -2
  49. data/lib/jamm/api/models/v1_withdraw_request.rb +212 -0
  50. data/lib/jamm/api/models/v1_withdraw_response.rb +212 -0
  51. data/lib/jamm/api/version.rb +2 -2
  52. data/lib/jamm/api.rb +17 -3
  53. data/lib/jamm/api_patches.rb +14 -0
  54. data/lib/jamm/charge.rb +43 -0
  55. data/lib/jamm/client.rb +1 -1
  56. data/lib/jamm/contract.rb +35 -0
  57. data/lib/jamm/customer.rb +24 -9
  58. data/lib/jamm/healthcheck.rb +14 -0
  59. data/lib/jamm/openapi.rb +10 -0
  60. data/lib/jamm/version.rb +1 -1
  61. data/lib/jamm/webhook.rb +46 -0
  62. data/lib/jamm.rb +16 -14
  63. metadata +23 -4
  64. data/lib/jamm/payment.rb +0 -27
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # #api/v1/common.proto
3
+ # #Jamm API
4
4
  #
5
5
  # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
6
  #
7
- # The version of the OpenAPI document: version not set
7
+ # The version of the OpenAPI document: 1.0
8
8
  #
9
9
  # Generated by: https://openapi-generator.tech
10
10
  # Generator version: 7.9.0
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # #api/v1/common.proto
3
+ # #Jamm API
4
4
  #
5
5
  # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
6
  #
7
- # The version of the OpenAPI document: version not set
7
+ # The version of the OpenAPI document: 1.0
8
8
  #
9
9
  # Generated by: https://openapi-generator.tech
10
10
  # Generator version: 7.9.0
@@ -40,6 +40,9 @@ module Api
40
40
  # Gender of the customer. Customerの性別。
41
41
  attr_accessor :gender
42
42
 
43
+ # Merchant can optionally set the expiry date for the contract. Defaults to 90 minutes if not specified. 決済の有効期限。未指定の場合は90分後に自動失効します。
44
+ attr_accessor :expires_at
45
+
43
46
  # Arbitrary key-value additional information about the customer. You can see this information in our merchant dashboard. Customerに関する任意のキーと値の追加情報。 加盟店ダッシュボードで確認できます。
44
47
  attr_accessor :metadata
45
48
 
@@ -54,6 +57,7 @@ module Api
54
57
  :address => :address,
55
58
  :birth_date => :birthDate,
56
59
  :gender => :gender,
60
+ :expires_at => :expiresAt,
57
61
  :metadata => :metadata
58
62
  }
59
63
  end
@@ -74,6 +78,7 @@ module Api
74
78
  :address => :String,
75
79
  :birth_date => :String,
76
80
  :gender => :String,
81
+ :expires_at => :Time,
77
82
  :metadata => :'Hash<String, String>'
78
83
  }
79
84
  end
@@ -111,6 +116,8 @@ module Api
111
116
 
112
117
  self.gender = attributes[:gender] if attributes.key?(:gender)
113
118
 
119
+ self.expires_at = attributes[:expires_at] if attributes.key?(:expires_at)
120
+
114
121
  return unless attributes.key?(:metadata)
115
122
  return unless (value = attributes[:metadata]).is_a?(Hash)
116
123
 
@@ -145,6 +152,7 @@ module Api
145
152
  address == other.address &&
146
153
  birth_date == other.birth_date &&
147
154
  gender == other.gender &&
155
+ expires_at == other.expires_at &&
148
156
  metadata == other.metadata
149
157
  end
150
158
 
@@ -157,7 +165,7 @@ module Api
157
165
  # Calculates hash code according to all attributes.
158
166
  # @return [Integer] Hash code
159
167
  def hash
160
- [email, force_kyc, name, katakana_last_name, katakana_first_name, address, birth_date, gender, metadata].hash
168
+ [email, force_kyc, name, katakana_last_name, katakana_first_name, address, birth_date, gender, expires_at, metadata].hash
161
169
  end
162
170
 
163
171
  # Builds the object from hash
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # #api/v1/common.proto
3
+ # #Jamm API
4
4
  #
5
5
  # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
6
  #
7
- # The version of the OpenAPI document: version not set
7
+ # The version of the OpenAPI document: 1.0
8
8
  #
9
9
  # Generated by: https://openapi-generator.tech
10
10
  # Generator version: 7.9.0
@@ -0,0 +1,297 @@
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 ChargeMessage
18
+ attr_accessor :id, :customer, :status, :description, :merchant_name, :initial_amount, :discount, :final_amount, :amount_refunded, :currency, :processed_at, :created_at, :updated_at, :error
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
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :id => :id,
45
+ :customer => :customer,
46
+ :status => :status,
47
+ :description => :description,
48
+ :merchant_name => :merchantName,
49
+ :initial_amount => :initialAmount,
50
+ :discount => :discount,
51
+ :final_amount => :finalAmount,
52
+ :amount_refunded => :amountRefunded,
53
+ :currency => :currency,
54
+ :processed_at => :processedAt,
55
+ :created_at => :createdAt,
56
+ :updated_at => :updatedAt,
57
+ :error => :error
58
+ }
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :id => :String,
70
+ :customer => :String,
71
+ :status => :ChargeMessageStatus,
72
+ :description => :String,
73
+ :merchant_name => :String,
74
+ :initial_amount => :Integer,
75
+ :discount => :Integer,
76
+ :final_amount => :Integer,
77
+ :amount_refunded => :Integer,
78
+ :currency => :String,
79
+ :processed_at => :String,
80
+ :created_at => :String,
81
+ :updated_at => :String,
82
+ :error => :Error
83
+ }
84
+ end
85
+
86
+ # List of attributes with nullable: true
87
+ def self.openapi_nullable
88
+ Set.new([])
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Api::ChargeMessage` initialize method' unless attributes.is_a?(Hash)
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) do |(k, v), h|
98
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Api::ChargeMessage`. 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)
99
+
100
+ h[k.to_sym] = v
101
+ end
102
+
103
+ self.id = attributes[:id] if attributes.key?(:id)
104
+
105
+ self.customer = attributes[:customer] if attributes.key?(:customer)
106
+
107
+ self.status = if attributes.key?(:status)
108
+ attributes[:status]
109
+ else
110
+ 'STATUS_UNSPECIFIED'
111
+ end
112
+
113
+ self.description = attributes[:description] if attributes.key?(:description)
114
+
115
+ self.merchant_name = attributes[:merchant_name] if attributes.key?(:merchant_name)
116
+
117
+ self.initial_amount = attributes[:initial_amount] if attributes.key?(:initial_amount)
118
+
119
+ self.discount = attributes[:discount] if attributes.key?(:discount)
120
+
121
+ self.final_amount = attributes[:final_amount] if attributes.key?(:final_amount)
122
+
123
+ self.amount_refunded = attributes[:amount_refunded] if attributes.key?(:amount_refunded)
124
+
125
+ self.currency = attributes[:currency] if attributes.key?(:currency)
126
+
127
+ self.processed_at = attributes[:processed_at] if attributes.key?(:processed_at)
128
+
129
+ self.created_at = attributes[:created_at] if attributes.key?(:created_at)
130
+
131
+ self.updated_at = attributes[:updated_at] if attributes.key?(:updated_at)
132
+
133
+ return unless attributes.key?(:error)
134
+
135
+ self.error = attributes[:error]
136
+ end
137
+
138
+ # Show invalid properties with the reasons. Usually used together with valid?
139
+ # @return Array for valid properties with the reasons
140
+ def list_invalid_properties
141
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
142
+ []
143
+ end
144
+
145
+ # Check to see if the all the properties in the model are valid
146
+ # @return true if the model is valid
147
+ def valid?
148
+ warn '[DEPRECATED] the `valid?` method is obsolete'
149
+ true
150
+ end
151
+
152
+ # Checks equality by comparing each attribute.
153
+ # @param [Object] Object to be compared
154
+ def ==(other)
155
+ return true if equal?(other)
156
+
157
+ self.class == other.class &&
158
+ id == other.id &&
159
+ customer == other.customer &&
160
+ status == other.status &&
161
+ description == other.description &&
162
+ merchant_name == other.merchant_name &&
163
+ initial_amount == other.initial_amount &&
164
+ discount == other.discount &&
165
+ final_amount == other.final_amount &&
166
+ amount_refunded == other.amount_refunded &&
167
+ currency == other.currency &&
168
+ processed_at == other.processed_at &&
169
+ created_at == other.created_at &&
170
+ updated_at == other.updated_at &&
171
+ error == other.error
172
+ end
173
+
174
+ # @see the `==` method
175
+ # @param [Object] Object to be compared
176
+ def eql?(other)
177
+ self == other
178
+ end
179
+
180
+ # Calculates hash code according to all attributes.
181
+ # @return [Integer] Hash code
182
+ def hash
183
+ [id, customer, status, description, merchant_name, initial_amount, discount, final_amount, amount_refunded, currency, processed_at, created_at, updated_at, error].hash
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def self.build_from_hash(attributes)
190
+ return nil unless attributes.is_a?(Hash)
191
+
192
+ attributes = attributes.transform_keys(&:to_sym)
193
+ transformed_hash = {}
194
+ openapi_types.each_pair do |key, type|
195
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
196
+ transformed_hash[key.to_s] = nil
197
+ elsif type =~ /\AArray<(.*)>/i
198
+ # check to ensure the input is an array given that the attribute
199
+ # is documented as an array but the input is not
200
+ 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)
201
+ elsif !attributes[attribute_map[key]].nil?
202
+ transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
203
+ end
204
+ end
205
+ new(transformed_hash)
206
+ end
207
+
208
+ # Deserializes the data based on type
209
+ # @param string type Data type
210
+ # @param string value Value to be deserialized
211
+ # @return [Object] Deserialized data
212
+ def self._deserialize(type, value)
213
+ case type.to_sym
214
+ when :Time
215
+ Time.parse(value)
216
+ when :Date
217
+ Date.parse(value)
218
+ when :String
219
+ value.to_s
220
+ when :Integer
221
+ value.to_i
222
+ when :Float
223
+ value.to_f
224
+ when :Boolean
225
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
226
+ true
227
+ else
228
+ false
229
+ end
230
+ when :Object
231
+ # generic object (usually a Hash), return directly
232
+ value
233
+ when /\AArray<(?<inner_type>.+)>\z/
234
+ inner_type = Regexp.last_match[:inner_type]
235
+ value.map { |v| _deserialize(inner_type, v) }
236
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
237
+ k_type = Regexp.last_match[:k_type]
238
+ v_type = Regexp.last_match[:v_type]
239
+ {}.tap do |hash|
240
+ value.each do |k, v|
241
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
242
+ end
243
+ end
244
+ else # model
245
+ # models (e.g. Pet) or oneOf
246
+ klass = Api.const_get(type)
247
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
248
+ end
249
+ end
250
+
251
+ # Returns the string representation of the object
252
+ # @return [String] String presentation of the object
253
+ def to_s
254
+ to_hash.to_s
255
+ end
256
+
257
+ # to_body is an alias to to_hash (backward compatibility)
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_body
260
+ to_hash
261
+ end
262
+
263
+ # Returns the object in the form of hash
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_hash
266
+ hash = {}
267
+ self.class.attribute_map.each_pair do |attr, param|
268
+ value = send(attr)
269
+ if value.nil?
270
+ is_nullable = self.class.openapi_nullable.include?(attr)
271
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
272
+ end
273
+
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map { |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+ end
297
+ end
@@ -0,0 +1,44 @@
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 ChargeMessageStatus
18
+ UNSPECIFIED = 'STATUS_UNSPECIFIED'
19
+ SUCCESS = 'STATUS_SUCCESS'
20
+ FAILURE = 'STATUS_FAILURE'
21
+ WAITING_EKYC = 'STATUS_WAITING_EKYC'
22
+ BLOCKING = 'STATUS_BLOCKING'
23
+
24
+ def self.all_vars
25
+ @all_vars ||= [UNSPECIFIED, SUCCESS, FAILURE, WAITING_EKYC, BLOCKING].freeze
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def self.build_from_hash(value)
32
+ new.build_from_hash(value)
33
+ end
34
+
35
+ # Builds the enum from string
36
+ # @param [String] The enum value in the form of the string
37
+ # @return [String] The enum value
38
+ def build_from_hash(value)
39
+ return value if ChargeMessageStatus.all_vars.include?(value)
40
+
41
+ raise "Invalid ENUM value #{value} for class #ChargeMessageStatus"
42
+ end
43
+ end
44
+ end