processout 2.15.1 → 2.16.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: 779ee1846ec8e9b73d6723ca8a356dc0bec6c6c1789365d0e7e3c46d99a04fa2
4
+ data.tar.gz: 4d1876dd17cc8913ee449c35909ea8c27f63aa39aa1c4b9562c426c6091827f2
5
5
  SHA512:
6
- metadata.gz: 499aa6e52d76fdbdb169aeaae24c22a9ffddc59a57245fe1e6da7f3b94a2c83517a7d5004d3d8b9f027b107e1218eb5a833f1ff561054341db90ea116381796a
7
- data.tar.gz: f5dd9a0e7f8e5a0485408610024fd1d703639c7cbab5c753b8e09f819dacd90a0f44653012b16ad72f35065757c84327fe1115932963a782beac97b9e7977de2
6
+ metadata.gz: dd40187eb822037e6914d2a43c28e4e1a7f4c60bf4c7e4d6e36fd4bfcd46817feca556a13d9deb779031d570816be5967145a620ac205fad1a7878a73ffd37bc
7
+ data.tar.gz: fe2ac4474ef41366774350e8c3c63dfc8d46fb562b4c373e2612541912774a6053f0b7d2c9e40f44c2aa948f7aa68818c8f5a3c0946464bf6009e1bbc0ef6e39
@@ -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.16.0"
17
17
 
18
18
  unless options.nil?
19
19
  req["Idempotency-Key"] = options.fetch(:idempotency_key, "")
@@ -27,6 +27,7 @@ module ProcessOut
27
27
  attr_reader :description
28
28
  attr_reader :invoice
29
29
  attr_reader :invoice_id
30
+ attr_reader :manual_invoice_cancellation
30
31
 
31
32
 
32
33
  def id=(val)
@@ -153,6 +154,10 @@ module ProcessOut
153
154
  @invoice_id = val
154
155
  end
155
156
 
157
+ def manual_invoice_cancellation=(val)
158
+ @manual_invoice_cancellation = val
159
+ end
160
+
156
161
 
157
162
  # Initializes the Token object
158
163
  # Params:
@@ -180,6 +185,7 @@ module ProcessOut
180
185
  self.description = data.fetch(:description, nil)
181
186
  self.invoice = data.fetch(:invoice, nil)
182
187
  self.invoice_id = data.fetch(:invoice_id, nil)
188
+ self.manual_invoice_cancellation = data.fetch(:manual_invoice_cancellation, nil)
183
189
 
184
190
  end
185
191
 
@@ -210,6 +216,7 @@ module ProcessOut
210
216
  "description": self.description,
211
217
  "invoice": self.invoice,
212
218
  "invoice_id": self.invoice_id,
219
+ "manual_invoice_cancellation": self.manual_invoice_cancellation,
213
220
  }.to_json
214
221
  end
215
222
 
@@ -277,6 +284,9 @@ module ProcessOut
277
284
  if data.include? "invoice_id"
278
285
  self.invoice_id = data["invoice_id"]
279
286
  end
287
+ if data.include? "manual_invoice_cancellation"
288
+ self.manual_invoice_cancellation = data["manual_invoice_cancellation"]
289
+ end
280
290
 
281
291
  self
282
292
  end
@@ -307,6 +317,7 @@ module ProcessOut
307
317
  self.description = data.fetch(:description, self.description)
308
318
  self.invoice = data.fetch(:invoice, self.invoice)
309
319
  self.invoice_id = data.fetch(:invoice_id, self.invoice_id)
320
+ self.manual_invoice_cancellation = data.fetch(:manual_invoice_cancellation, self.manual_invoice_cancellation)
310
321
 
311
322
  self
312
323
  end
@@ -384,6 +395,8 @@ module ProcessOut
384
395
  "return_url" => @return_url,
385
396
  "cancel_url" => @cancel_url,
386
397
  "description" => @description,
398
+ "invoice_id" => @invoice_id,
399
+ "manual_invoice_cancellation" => @manual_invoice_cancellation,
387
400
  "source" => options.fetch(:source, nil),
388
401
  "settings" => options.fetch(:settings, nil),
389
402
  "device" => options.fetch(:device, nil),
@@ -1,3 +1,3 @@
1
1
  module ProcessOut
2
- VERSION = "2.15.1"
2
+ VERSION = "2.16.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.16.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-02-02 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