maytes-api-client-rb 0.1.5 → 0.1.7

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: 61b1e45e8514262fe4419ede71361f35f2d320a4b68d3a217914c54fa2b06b12
4
- data.tar.gz: e1941d493e9ca0ec36c5383ddd7bcb7518c1769b2580e7726ad20a01827b1b98
3
+ metadata.gz: 1a9514629d2a505c5a9495b6603e2e2b260d618ec1fadd5b96a81d5cb40c9369
4
+ data.tar.gz: 5fb939659ca9d73e437d207d844899bd8f338807af89c57953088ce486a39448
5
5
  SHA512:
6
- metadata.gz: e23bab9048ecb4b8eea187bcfffbe3b512210d5b21df517a3ae82d36654d0001ca892c5ee331ab2a8592c57acd41a5e9e5458b5fd9150c605105280f6d4fe338
7
- data.tar.gz: 3b1cdaa8c86b6c9c86953371b5175a735db58c63784a5b12c22b26b865e0c3bad5ef2dda4de3dc5be11e01ce103324026e595c8aea8ec3ecc05339e144fbaea9
6
+ metadata.gz: c1f559ca0b54dd5f8bca9b486881239d3abb56e8a9a6dbc1137b08e0074cc065ce837124ef8e487c6e9482dbb7863d147a5135c4ca0f6e7c99fe4819e876c74b
7
+ data.tar.gz: 5421374a8653c2679ada8f0522a0d7e051e4b9d8cbc9da0cc796d76bffd67f0b48713bfc8fe4ddf682b8ae186be421715d2d9ebb18d67eca714acd4814b98d2f
data/docs/Checkout.md CHANGED
@@ -17,6 +17,7 @@
17
17
  | **currency** | **String** | | |
18
18
  | **service_fee** | [**Fee**](Fee.md) | | |
19
19
  | **refunded_amount** | **Integer** | | |
20
+ | **remaining_amount** | **Integer** | | |
20
21
  | **merchant_processor_fee** | **Integer** | | |
21
22
  | **merchant_service_fee** | **Integer** | | |
22
23
  | **last_refund_at** | **Time** | | |
@@ -40,6 +41,7 @@ instance = MaytesApiClient::Checkout.new(
40
41
  currency: null,
41
42
  service_fee: null,
42
43
  refunded_amount: null,
44
+ remaining_amount: null,
43
45
  merchant_processor_fee: null,
44
46
  merchant_service_fee: null,
45
47
  last_refund_at: null
@@ -0,0 +1,26 @@
1
+ # MaytesApiClient::CheckoutFriend
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **name** | **String** | | |
8
+ | **mobile** | **String** | E.164, e.g. +61412345678 | |
9
+ | **email** | **String** | | [optional] |
10
+ | **amount** | **Integer** | This friend’s share in minor units. Give it for every friend or for none. | [optional] |
11
+ | **items** | [**Array<CheckoutFriendItem>**](CheckoutFriendItem.md) | The cart lines this friend pays for (item_assignment only). Give it for every friend or for none. | [optional] |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'maytes_api_client'
17
+
18
+ instance = MaytesApiClient::CheckoutFriend.new(
19
+ name: null,
20
+ mobile: null,
21
+ email: null,
22
+ amount: null,
23
+ items: null
24
+ )
25
+ ```
26
+
@@ -0,0 +1,20 @@
1
+ # MaytesApiClient::CheckoutFriendItem
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **item_ref** | **String** | | |
8
+ | **quantity** | **Integer** | How many units of this line this friend pays for. Omit for the whole line. | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'maytes_api_client'
14
+
15
+ instance = MaytesApiClient::CheckoutFriendItem.new(
16
+ item_ref: null,
17
+ quantity: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,20 @@
1
+ # MaytesApiClient::CheckoutFriends
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **count** | **Integer** | How many friends will split, not counting the customer. Give this or `people`. | [optional] |
8
+ | **people** | [**Array<CheckoutFriend>**](CheckoutFriend.md) | The friends, optionally with their shares. Give this or `count`. | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'maytes_api_client'
14
+
15
+ instance = MaytesApiClient::CheckoutFriends.new(
16
+ count: null,
17
+ people: null
18
+ )
19
+ ```
20
+
@@ -18,6 +18,7 @@
18
18
  | **customer_data** | [**CustomerData**](CustomerData.md) | | [optional] |
19
19
  | **metadata** | **Hash<String, Object>** | | [optional] |
20
20
  | **allocation_model** | **String** | | [optional] |
21
+ | **friends** | [**CheckoutFriends**](CheckoutFriends.md) | Who the customer is expected to split with. Pre-fills their share and allocation screens; the customer can still change it. Personal data — send it only when you hold it. | [optional] |
21
22
 
22
23
  ## Example
23
24
 
@@ -38,7 +39,8 @@ instance = MaytesApiClient::CreateCheckoutRequest.new(
38
39
  shipping_amount: null,
39
40
  customer_data: null,
40
41
  metadata: null,
41
- allocation_model: null
42
+ allocation_model: null,
43
+ friends: null
42
44
  )
43
45
  ```
44
46
 
@@ -41,6 +41,8 @@ module MaytesApiClient
41
41
 
42
42
  attr_accessor :refunded_amount
43
43
 
44
+ attr_accessor :remaining_amount
45
+
44
46
  attr_accessor :merchant_processor_fee
45
47
 
46
48
  attr_accessor :merchant_service_fee
@@ -63,6 +65,7 @@ module MaytesApiClient
63
65
  :'currency' => :'currency',
64
66
  :'service_fee' => :'service_fee',
65
67
  :'refunded_amount' => :'refunded_amount',
68
+ :'remaining_amount' => :'remaining_amount',
66
69
  :'merchant_processor_fee' => :'merchant_processor_fee',
67
70
  :'merchant_service_fee' => :'merchant_service_fee',
68
71
  :'last_refund_at' => :'last_refund_at'
@@ -95,6 +98,7 @@ module MaytesApiClient
95
98
  :'currency' => :'String',
96
99
  :'service_fee' => :'Fee',
97
100
  :'refunded_amount' => :'Integer',
101
+ :'remaining_amount' => :'Integer',
98
102
  :'merchant_processor_fee' => :'Integer',
99
103
  :'merchant_service_fee' => :'Integer',
100
104
  :'last_refund_at' => :'Time'
@@ -208,6 +212,12 @@ module MaytesApiClient
208
212
  self.refunded_amount = nil
209
213
  end
210
214
 
215
+ if attributes.key?(:'remaining_amount')
216
+ self.remaining_amount = attributes[:'remaining_amount']
217
+ else
218
+ self.remaining_amount = nil
219
+ end
220
+
211
221
  if attributes.key?(:'merchant_processor_fee')
212
222
  self.merchant_processor_fee = attributes[:'merchant_processor_fee']
213
223
  else
@@ -264,6 +274,14 @@ module MaytesApiClient
264
274
  invalid_properties.push('invalid value for "refunded_amount", must be greater than or equal to 0.')
265
275
  end
266
276
 
277
+ if @remaining_amount.nil?
278
+ invalid_properties.push('invalid value for "remaining_amount", remaining_amount cannot be nil.')
279
+ end
280
+
281
+ if @remaining_amount < 0
282
+ invalid_properties.push('invalid value for "remaining_amount", must be greater than or equal to 0.')
283
+ end
284
+
267
285
  if @merchant_processor_fee.nil?
268
286
  invalid_properties.push('invalid value for "merchant_processor_fee", merchant_processor_fee cannot be nil.')
269
287
  end
@@ -295,6 +313,8 @@ module MaytesApiClient
295
313
  return false if @service_fee.nil?
296
314
  return false if @refunded_amount.nil?
297
315
  return false if @refunded_amount < 0
316
+ return false if @remaining_amount.nil?
317
+ return false if @remaining_amount < 0
298
318
  return false if @merchant_processor_fee.nil?
299
319
  return false if @merchant_processor_fee < 0
300
320
  return false if @merchant_service_fee.nil?
@@ -376,6 +396,20 @@ module MaytesApiClient
376
396
  @refunded_amount = refunded_amount
377
397
  end
378
398
 
399
+ # Custom attribute writer method with validation
400
+ # @param [Object] remaining_amount Value to be assigned
401
+ def remaining_amount=(remaining_amount)
402
+ if remaining_amount.nil?
403
+ fail ArgumentError, 'remaining_amount cannot be nil'
404
+ end
405
+
406
+ if remaining_amount < 0
407
+ fail ArgumentError, 'invalid value for "remaining_amount", must be greater than or equal to 0.'
408
+ end
409
+
410
+ @remaining_amount = remaining_amount
411
+ end
412
+
379
413
  # Custom attribute writer method with validation
380
414
  # @param [Object] merchant_processor_fee Value to be assigned
381
415
  def merchant_processor_fee=(merchant_processor_fee)
@@ -422,6 +456,7 @@ module MaytesApiClient
422
456
  currency == o.currency &&
423
457
  service_fee == o.service_fee &&
424
458
  refunded_amount == o.refunded_amount &&
459
+ remaining_amount == o.remaining_amount &&
425
460
  merchant_processor_fee == o.merchant_processor_fee &&
426
461
  merchant_service_fee == o.merchant_service_fee &&
427
462
  last_refund_at == o.last_refund_at
@@ -436,7 +471,7 @@ module MaytesApiClient
436
471
  # Calculates hash code according to all attributes.
437
472
  # @return [Integer] Hash code
438
473
  def hash
439
- [checkout_uuid, merchant_order_id, status, transaction_ref, checkout_url, merchant_expires_at, captured_at, return_url, cancel_url, amount, currency, service_fee, refunded_amount, merchant_processor_fee, merchant_service_fee, last_refund_at].hash
474
+ [checkout_uuid, merchant_order_id, status, transaction_ref, checkout_url, merchant_expires_at, captured_at, return_url, cancel_url, amount, currency, service_fee, refunded_amount, remaining_amount, merchant_processor_fee, merchant_service_fee, last_refund_at].hash
440
475
  end
441
476
 
442
477
  # Builds the object from hash
@@ -0,0 +1,314 @@
1
+ =begin
2
+ #Maytes 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.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MaytesApiClient
17
+ class CheckoutFriend < ApiModelBase
18
+ attr_accessor :name
19
+
20
+ # E.164, e.g. +61412345678
21
+ attr_accessor :mobile
22
+
23
+ attr_accessor :email
24
+
25
+ # This friend’s share in minor units. Give it for every friend or for none.
26
+ attr_accessor :amount
27
+
28
+ # The cart lines this friend pays for (item_assignment only). Give it for every friend or for none.
29
+ attr_accessor :items
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'name' => :'name',
35
+ :'mobile' => :'mobile',
36
+ :'email' => :'email',
37
+ :'amount' => :'amount',
38
+ :'items' => :'items'
39
+ }
40
+ end
41
+
42
+ # Returns attribute mapping this model knows about
43
+ def self.acceptable_attribute_map
44
+ attribute_map
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ acceptable_attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'name' => :'String',
56
+ :'mobile' => :'String',
57
+ :'email' => :'String',
58
+ :'amount' => :'Integer',
59
+ :'items' => :'Array<CheckoutFriendItem>'
60
+ }
61
+ end
62
+
63
+ # List of attributes with nullable: true
64
+ def self.openapi_nullable
65
+ Set.new([
66
+ :'email',
67
+ ])
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MaytesApiClient::CheckoutFriend` initialize method"
75
+ end
76
+
77
+ # check to see if the attribute exists and convert string to symbol for hash key
78
+ acceptable_attribute_map = self.class.acceptable_attribute_map
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!acceptable_attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MaytesApiClient::CheckoutFriend`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'name')
87
+ self.name = attributes[:'name']
88
+ else
89
+ self.name = nil
90
+ end
91
+
92
+ if attributes.key?(:'mobile')
93
+ self.mobile = attributes[:'mobile']
94
+ else
95
+ self.mobile = nil
96
+ end
97
+
98
+ if attributes.key?(:'email')
99
+ self.email = attributes[:'email']
100
+ end
101
+
102
+ if attributes.key?(:'amount')
103
+ self.amount = attributes[:'amount']
104
+ end
105
+
106
+ if attributes.key?(:'items')
107
+ if (value = attributes[:'items']).is_a?(Array)
108
+ self.items = value
109
+ end
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
117
+ invalid_properties = Array.new
118
+ if @name.nil?
119
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
120
+ end
121
+
122
+ if @name.to_s.length > 200
123
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 200.')
124
+ end
125
+
126
+ if @name.to_s.length < 1
127
+ invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
128
+ end
129
+
130
+ if @mobile.nil?
131
+ invalid_properties.push('invalid value for "mobile", mobile cannot be nil.')
132
+ end
133
+
134
+ if @mobile.to_s.length > 20
135
+ invalid_properties.push('invalid value for "mobile", the character length must be smaller than or equal to 20.')
136
+ end
137
+
138
+ if @mobile.to_s.length < 3
139
+ invalid_properties.push('invalid value for "mobile", the character length must be greater than or equal to 3.')
140
+ end
141
+
142
+ pattern = Regexp.new(/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/)
143
+ if !@email.nil? && @email !~ pattern
144
+ invalid_properties.push("invalid value for \"email\", must conform to the pattern #{pattern}.")
145
+ end
146
+
147
+ if !@amount.nil? && @amount <= 0
148
+ invalid_properties.push('invalid value for "amount", must be greater than 0.')
149
+ end
150
+
151
+ if !@items.nil? && @items.length < 1
152
+ invalid_properties.push('invalid value for "items", number of items must be greater than or equal to 1.')
153
+ end
154
+
155
+ invalid_properties
156
+ end
157
+
158
+ # Check to see if the all the properties in the model are valid
159
+ # @return true if the model is valid
160
+ def valid?
161
+ warn '[DEPRECATED] the `valid?` method is obsolete'
162
+ return false if @name.nil?
163
+ return false if @name.to_s.length > 200
164
+ return false if @name.to_s.length < 1
165
+ return false if @mobile.nil?
166
+ return false if @mobile.to_s.length > 20
167
+ return false if @mobile.to_s.length < 3
168
+ return false if !@email.nil? && @email !~ Regexp.new(/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/)
169
+ return false if !@amount.nil? && @amount <= 0
170
+ return false if !@items.nil? && @items.length < 1
171
+ true
172
+ end
173
+
174
+ # Custom attribute writer method with validation
175
+ # @param [Object] name Value to be assigned
176
+ def name=(name)
177
+ if name.nil?
178
+ fail ArgumentError, 'name cannot be nil'
179
+ end
180
+
181
+ if name.to_s.length > 200
182
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 200.'
183
+ end
184
+
185
+ if name.to_s.length < 1
186
+ fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
187
+ end
188
+
189
+ @name = name
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] mobile Value to be assigned
194
+ def mobile=(mobile)
195
+ if mobile.nil?
196
+ fail ArgumentError, 'mobile cannot be nil'
197
+ end
198
+
199
+ if mobile.to_s.length > 20
200
+ fail ArgumentError, 'invalid value for "mobile", the character length must be smaller than or equal to 20.'
201
+ end
202
+
203
+ if mobile.to_s.length < 3
204
+ fail ArgumentError, 'invalid value for "mobile", the character length must be greater than or equal to 3.'
205
+ end
206
+
207
+ @mobile = mobile
208
+ end
209
+
210
+ # Custom attribute writer method with validation
211
+ # @param [Object] email Value to be assigned
212
+ def email=(email)
213
+ pattern = Regexp.new(/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/)
214
+ if !email.nil? && email !~ pattern
215
+ fail ArgumentError, "invalid value for \"email\", must conform to the pattern #{pattern}."
216
+ end
217
+
218
+ @email = email
219
+ end
220
+
221
+ # Custom attribute writer method with validation
222
+ # @param [Object] amount Value to be assigned
223
+ def amount=(amount)
224
+ if amount.nil?
225
+ fail ArgumentError, 'amount cannot be nil'
226
+ end
227
+
228
+ if amount <= 0
229
+ fail ArgumentError, 'invalid value for "amount", must be greater than 0.'
230
+ end
231
+
232
+ @amount = amount
233
+ end
234
+
235
+ # Custom attribute writer method with validation
236
+ # @param [Object] items Value to be assigned
237
+ def items=(items)
238
+ if items.nil?
239
+ fail ArgumentError, 'items cannot be nil'
240
+ end
241
+
242
+ if items.length < 1
243
+ fail ArgumentError, 'invalid value for "items", number of items must be greater than or equal to 1.'
244
+ end
245
+
246
+ @items = items
247
+ end
248
+
249
+ # Checks equality by comparing each attribute.
250
+ # @param [Object] Object to be compared
251
+ def ==(o)
252
+ return true if self.equal?(o)
253
+ self.class == o.class &&
254
+ name == o.name &&
255
+ mobile == o.mobile &&
256
+ email == o.email &&
257
+ amount == o.amount &&
258
+ items == o.items
259
+ end
260
+
261
+ # @see the `==` method
262
+ # @param [Object] Object to be compared
263
+ def eql?(o)
264
+ self == o
265
+ end
266
+
267
+ # Calculates hash code according to all attributes.
268
+ # @return [Integer] Hash code
269
+ def hash
270
+ [name, mobile, email, amount, items].hash
271
+ end
272
+
273
+ # Builds the object from hash
274
+ # @param [Hash] attributes Model attributes in the form of hash
275
+ # @return [Object] Returns the model itself
276
+ def self.build_from_hash(attributes)
277
+ return nil unless attributes.is_a?(Hash)
278
+ attributes = attributes.transform_keys(&:to_sym)
279
+ transformed_hash = {}
280
+ openapi_types.each_pair do |key, type|
281
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
282
+ transformed_hash["#{key}"] = nil
283
+ elsif type =~ /\AArray<(.*)>/i
284
+ # check to ensure the input is an array given that the attribute
285
+ # is documented as an array but the input is not
286
+ if attributes[attribute_map[key]].is_a?(Array)
287
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
288
+ end
289
+ elsif !attributes[attribute_map[key]].nil?
290
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
291
+ end
292
+ end
293
+ new(transformed_hash)
294
+ end
295
+
296
+ # Returns the object in the form of hash
297
+ # @return [Hash] Returns the object in the form of hash
298
+ def to_hash
299
+ hash = {}
300
+ self.class.attribute_map.each_pair do |attr, param|
301
+ value = self.send(attr)
302
+ if value.nil?
303
+ is_nullable = self.class.openapi_nullable.include?(attr)
304
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
305
+ end
306
+
307
+ hash[param] = _to_hash(value)
308
+ end
309
+ hash
310
+ end
311
+
312
+ end
313
+
314
+ end