processout 2.15.1 → 2.18.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb661115b31fe6f519aaa707172d1115061d104be3dad6cbe17bc7c1b5c04783
4
- data.tar.gz: e7463ad8c7ea97f0821a281dac0670d7260920584db647f14d027bf0bb8713b1
3
+ metadata.gz: 27b11eb99ae81e5f9f2b0548cf1d122ad3d210b777c50d5a5ea072416541c33b
4
+ data.tar.gz: 5f0dfb0c460e4b93dc90e0c7cf486584cd6fec31059698fc5a76a8bfe79001b6
5
5
  SHA512:
6
- metadata.gz: 499aa6e52d76fdbdb169aeaae24c22a9ffddc59a57245fe1e6da7f3b94a2c83517a7d5004d3d8b9f027b107e1218eb5a833f1ff561054341db90ea116381796a
7
- data.tar.gz: f5dd9a0e7f8e5a0485408610024fd1d703639c7cbab5c753b8e09f819dacd90a0f44653012b16ad72f35065757c84327fe1115932963a782beac97b9e7977de2
6
+ metadata.gz: b12f0e60dea5c538335f2b533829a875515465285efd9108f5011fd72b96d39b07a040288a9d3781e13ee59ffcbc2721599edb2bc86fac95c226232f0f444452
7
+ data.tar.gz: 87733574f8d0aabbfaccfadd427f287950eca22c9058ba853b832ffba5da5b6e57dfde441255c6b906d434067ef4349d933574c9e5c17f4361847418127c5e5b
@@ -0,0 +1,81 @@
1
+ # The content of this file was automatically generated
2
+
3
+ require "cgi"
4
+ require "json"
5
+ require "processout/networking/request"
6
+ require "processout/networking/response"
7
+
8
+ module ProcessOut
9
+ class Balance
10
+
11
+ attr_reader :amount
12
+ attr_reader :currency
13
+
14
+
15
+ def amount=(val)
16
+ @amount = val
17
+ end
18
+
19
+ def currency=(val)
20
+ @currency = val
21
+ end
22
+
23
+
24
+ # Initializes the Balance object
25
+ # Params:
26
+ # +client+:: +ProcessOut+ client instance
27
+ # +data+:: data that can be used to fill the object
28
+ def initialize(client, data = {})
29
+ @client = client
30
+
31
+ self.amount = data.fetch(:amount, nil)
32
+ self.currency = data.fetch(:currency, nil)
33
+
34
+ end
35
+
36
+ # Create a new Balance using the current client
37
+ def new(data = {})
38
+ Balance.new(@client, data)
39
+ end
40
+
41
+ # Overrides the JSON marshaller to only send the fields we want
42
+ def to_json(options)
43
+ {
44
+ "amount": self.amount,
45
+ "currency": self.currency,
46
+ }.to_json
47
+ end
48
+
49
+ # Fills the object with data coming from the API
50
+ # Params:
51
+ # +data+:: +Hash+ of data coming from the API
52
+ def fill_with_data(data)
53
+ if data.nil?
54
+ return self
55
+ end
56
+ if data.include? "amount"
57
+ self.amount = data["amount"]
58
+ end
59
+ if data.include? "currency"
60
+ self.currency = data["currency"]
61
+ end
62
+
63
+ self
64
+ end
65
+
66
+ # Prefills the object with the data passed as parameters
67
+ # Params:
68
+ # +data+:: +Hash+ of data
69
+ def prefill(data)
70
+ if data.nil?
71
+ return self
72
+ end
73
+ self.amount = data.fetch(:amount, self.amount)
74
+ self.currency = data.fetch(:currency, self.currency)
75
+
76
+ self
77
+ end
78
+
79
+
80
+ end
81
+ end
@@ -0,0 +1,111 @@
1
+ # The content of this file was automatically generated
2
+
3
+ require "cgi"
4
+ require "json"
5
+ require "processout/networking/request"
6
+ require "processout/networking/response"
7
+
8
+ module ProcessOut
9
+ class Balances
10
+
11
+ attr_reader :vouchers
12
+
13
+
14
+ def vouchers=(val)
15
+ if val.nil?
16
+ @vouchers = []
17
+ return
18
+ end
19
+
20
+ if val.length > 0 and val[0].instance_of? Balance
21
+ @vouchers = val
22
+ else
23
+ l = Array.new
24
+ for v in val
25
+ obj = Balance.new(@client)
26
+ obj.fill_with_data(v)
27
+ l.push(obj)
28
+ end
29
+ @vouchers = l
30
+ end
31
+
32
+ end
33
+
34
+
35
+ # Initializes the Balances object
36
+ # Params:
37
+ # +client+:: +ProcessOut+ client instance
38
+ # +data+:: data that can be used to fill the object
39
+ def initialize(client, data = {})
40
+ @client = client
41
+
42
+ self.vouchers = data.fetch(:vouchers, nil)
43
+
44
+ end
45
+
46
+ # Create a new Balances using the current client
47
+ def new(data = {})
48
+ Balances.new(@client, data)
49
+ end
50
+
51
+ # Overrides the JSON marshaller to only send the fields we want
52
+ def to_json(options)
53
+ {
54
+ "vouchers": self.vouchers,
55
+ }.to_json
56
+ end
57
+
58
+ # Fills the object with data coming from the API
59
+ # Params:
60
+ # +data+:: +Hash+ of data coming from the API
61
+ def fill_with_data(data)
62
+ if data.nil?
63
+ return self
64
+ end
65
+ if data.include? "vouchers"
66
+ self.vouchers = data["vouchers"]
67
+ end
68
+
69
+ self
70
+ end
71
+
72
+ # Prefills the object with the data passed as parameters
73
+ # Params:
74
+ # +data+:: +Hash+ of data
75
+ def prefill(data)
76
+ if data.nil?
77
+ return self
78
+ end
79
+ self.vouchers = data.fetch(:vouchers, self.vouchers)
80
+
81
+ self
82
+ end
83
+
84
+ # Fetch a customer token's balance
85
+ # Params:
86
+ # +token_id+:: ID of the customer's token
87
+ # +options+:: +Hash+ of options
88
+ def find(token_id, options = {})
89
+ self.prefill(options)
90
+
91
+ request = Request.new(@client)
92
+ path = "/balances/tokens/" + CGI.escape(token_id) + ""
93
+ data = {
94
+
95
+ }
96
+
97
+ response = Response.new(request.get(path, data, options))
98
+ return_values = Array.new
99
+
100
+ body = response.body
101
+ body = body["balances"]
102
+ balances = Balances.new(@client)
103
+ return_values.push(balances.fill_with_data(body))
104
+
105
+
106
+ return_values[0]
107
+ end
108
+
109
+
110
+ end
111
+ end
@@ -13,7 +13,7 @@ module ProcessOut
13
13
  req.basic_auth @client.project_id, @client.project_secret
14
14
  req.content_type = "application/json"
15
15
  req["API-Version"] = "1.4.0.0"
16
- req["User-Agent"] = "ProcessOut Ruby-Bindings/2.15.1"
16
+ req["User-Agent"] = "ProcessOut Ruby-Bindings/2.18.0"
17
17
 
18
18
  unless options.nil?
19
19
  req["Idempotency-Key"] = options.fetch(:idempotency_key, "")
@@ -27,6 +27,9 @@ module ProcessOut
27
27
  attr_reader :description
28
28
  attr_reader :invoice
29
29
  attr_reader :invoice_id
30
+ attr_reader :manual_invoice_cancellation
31
+ attr_reader :verification_status
32
+ attr_reader :can_get_balance
30
33
 
31
34
 
32
35
  def id=(val)
@@ -153,6 +156,18 @@ module ProcessOut
153
156
  @invoice_id = val
154
157
  end
155
158
 
159
+ def manual_invoice_cancellation=(val)
160
+ @manual_invoice_cancellation = val
161
+ end
162
+
163
+ def verification_status=(val)
164
+ @verification_status = val
165
+ end
166
+
167
+ def can_get_balance=(val)
168
+ @can_get_balance = val
169
+ end
170
+
156
171
 
157
172
  # Initializes the Token object
158
173
  # Params:
@@ -180,6 +195,9 @@ module ProcessOut
180
195
  self.description = data.fetch(:description, nil)
181
196
  self.invoice = data.fetch(:invoice, nil)
182
197
  self.invoice_id = data.fetch(:invoice_id, nil)
198
+ self.manual_invoice_cancellation = data.fetch(:manual_invoice_cancellation, nil)
199
+ self.verification_status = data.fetch(:verification_status, nil)
200
+ self.can_get_balance = data.fetch(:can_get_balance, nil)
183
201
 
184
202
  end
185
203
 
@@ -210,6 +228,9 @@ module ProcessOut
210
228
  "description": self.description,
211
229
  "invoice": self.invoice,
212
230
  "invoice_id": self.invoice_id,
231
+ "manual_invoice_cancellation": self.manual_invoice_cancellation,
232
+ "verification_status": self.verification_status,
233
+ "can_get_balance": self.can_get_balance,
213
234
  }.to_json
214
235
  end
215
236
 
@@ -277,6 +298,15 @@ module ProcessOut
277
298
  if data.include? "invoice_id"
278
299
  self.invoice_id = data["invoice_id"]
279
300
  end
301
+ if data.include? "manual_invoice_cancellation"
302
+ self.manual_invoice_cancellation = data["manual_invoice_cancellation"]
303
+ end
304
+ if data.include? "verification_status"
305
+ self.verification_status = data["verification_status"]
306
+ end
307
+ if data.include? "can_get_balance"
308
+ self.can_get_balance = data["can_get_balance"]
309
+ end
280
310
 
281
311
  self
282
312
  end
@@ -307,6 +337,9 @@ module ProcessOut
307
337
  self.description = data.fetch(:description, self.description)
308
338
  self.invoice = data.fetch(:invoice, self.invoice)
309
339
  self.invoice_id = data.fetch(:invoice_id, self.invoice_id)
340
+ self.manual_invoice_cancellation = data.fetch(:manual_invoice_cancellation, self.manual_invoice_cancellation)
341
+ self.verification_status = data.fetch(:verification_status, self.verification_status)
342
+ self.can_get_balance = data.fetch(:can_get_balance, self.can_get_balance)
310
343
 
311
344
  self
312
345
  end
@@ -384,6 +417,8 @@ module ProcessOut
384
417
  "return_url" => @return_url,
385
418
  "cancel_url" => @cancel_url,
386
419
  "description" => @description,
420
+ "invoice_id" => @invoice_id,
421
+ "manual_invoice_cancellation" => @manual_invoice_cancellation,
387
422
  "source" => options.fetch(:source, nil),
388
423
  "settings" => options.fetch(:settings, nil),
389
424
  "device" => options.fetch(:device, nil),
@@ -1,3 +1,3 @@
1
1
  module ProcessOut
2
- VERSION = "2.15.1"
2
+ VERSION = "2.18.0"
3
3
  end
data/lib/processout.rb CHANGED
@@ -4,6 +4,8 @@ require "processout/activity"
4
4
  require "processout/addon"
5
5
  require "processout/api_request"
6
6
  require "processout/api_version"
7
+ require "processout/balances"
8
+ require "processout/balance"
7
9
  require "processout/card"
8
10
  require "processout/card_information"
9
11
  require "processout/coupon"
@@ -69,6 +71,16 @@ module ProcessOut
69
71
  obj = APIVersion.new(self, data)
70
72
  end
71
73
 
74
+ # Create a new Balances instance
75
+ def balances(data = {})
76
+ obj = Balances.new(self, data)
77
+ end
78
+
79
+ # Create a new Balance instance
80
+ def balance(data = {})
81
+ obj = Balance.new(self, data)
82
+ end
83
+
72
84
  # Create a new Card instance
73
85
  def card(data = {})
74
86
  obj = Card.new(self, data)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: processout
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.1
4
+ version: 2.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel HUEZ
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-13 00:00:00.000000000 Z
11
+ date: 2022-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,6 +75,8 @@ files:
75
75
  - lib/processout/addon.rb
76
76
  - lib/processout/api_request.rb
77
77
  - lib/processout/api_version.rb
78
+ - lib/processout/balance.rb
79
+ - lib/processout/balances.rb
78
80
  - lib/processout/card.rb
79
81
  - lib/processout/card_information.rb
80
82
  - lib/processout/coupon.rb