processout 2.14.4 → 2.15.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: 0ca11711f3387a3bebf5c64eb3d8e3dd60c6147b669a0d967ce88f1753f9c2f6
4
- data.tar.gz: 95ce72ee215524f276bbb5da6926b289574ea63589e6c6ef4f0c133364aed1ca
3
+ metadata.gz: 9230ecb6a7d95dd4e7329fc8dedcc36c804544bc581e69eb674db3cd3d8226c7
4
+ data.tar.gz: dd343d3e96053c300e3b5deeff8339700f6ac87873b8bacc5b07e38bb823c2a6
5
5
  SHA512:
6
- metadata.gz: 28925f1ea68596b08723735d06006c90efe6cb53da284b6a751bddb88bcff2783d59b33c94619a8c30571e9bc5b5bee00d407a6578e5c7d4a356ca423b0c984b
7
- data.tar.gz: 9aaa5b1e7dd5d8d869c459fccd71f9346fa114d827fe9c9895e9a9569148fc156e01be413c16e3268dd5b3cd4ac84902287da32fac8068a56ee9189758159ed2
6
+ metadata.gz: b4be5572ec3ff1c99ccbc30c69dfe5441d46ddd1cceed0f0142bbe20a0ca964ca3eb4ed8934f3e79077d801908f94fc45e7248400b0b93beccecf34755b262c5
7
+ data.tar.gz: 2486f46a2d6196910626c46079562f228cb259fc2843409a751eb576af45524881299f2c650faec6d63d6bc6b27e6ea816640a91d73c5009d8f7a0ef62c9a12d
data/lib/processout.rb CHANGED
@@ -14,6 +14,7 @@ require "processout/event"
14
14
  require "processout/gateway"
15
15
  require "processout/gateway_configuration"
16
16
  require "processout/invoice"
17
+ require "processout/invoice_tax"
17
18
  require "processout/invoice_external_fraud_tools"
18
19
  require "processout/invoice_risk"
19
20
  require "processout/invoice_device"
@@ -118,6 +119,11 @@ module ProcessOut
118
119
  obj = Invoice.new(self, data)
119
120
  end
120
121
 
122
+ # Create a new InvoiceTax instance
123
+ def invoice_tax(data = {})
124
+ obj = InvoiceTax.new(self, data)
125
+ end
126
+
121
127
  # Create a new InvoiceExternalFraudTools instance
122
128
  def invoice_external_fraud_tools(data = {})
123
129
  obj = InvoiceExternalFraudTools.new(self, data)
@@ -45,6 +45,8 @@ module ProcessOut
45
45
  attr_reader :exemption_reason_3ds2
46
46
  attr_reader :sca_exemption_reason
47
47
  attr_reader :challenge_indicator
48
+ attr_reader :incremental
49
+ attr_reader :tax
48
50
 
49
51
 
50
52
  def id=(val)
@@ -319,6 +321,26 @@ module ProcessOut
319
321
  @challenge_indicator = val
320
322
  end
321
323
 
324
+ def incremental=(val)
325
+ @incremental = val
326
+ end
327
+
328
+ def tax=(val)
329
+ if val.nil?
330
+ @tax = val
331
+ return
332
+ end
333
+
334
+ if val.instance_of? InvoiceTax
335
+ @tax = val
336
+ else
337
+ obj = InvoiceTax.new(@client)
338
+ obj.fill_with_data(val)
339
+ @tax = obj
340
+ end
341
+
342
+ end
343
+
322
344
 
323
345
  # Initializes the Invoice object
324
346
  # Params:
@@ -364,6 +386,8 @@ module ProcessOut
364
386
  self.exemption_reason_3ds2 = data.fetch(:exemption_reason_3ds2, nil)
365
387
  self.sca_exemption_reason = data.fetch(:sca_exemption_reason, nil)
366
388
  self.challenge_indicator = data.fetch(:challenge_indicator, nil)
389
+ self.incremental = data.fetch(:incremental, nil)
390
+ self.tax = data.fetch(:tax, nil)
367
391
 
368
392
  end
369
393
 
@@ -412,6 +436,8 @@ module ProcessOut
412
436
  "exemption_reason_3ds2": self.exemption_reason_3ds2,
413
437
  "sca_exemption_reason": self.sca_exemption_reason,
414
438
  "challenge_indicator": self.challenge_indicator,
439
+ "incremental": self.incremental,
440
+ "tax": self.tax,
415
441
  }.to_json
416
442
  end
417
443
 
@@ -533,6 +559,12 @@ module ProcessOut
533
559
  if data.include? "challenge_indicator"
534
560
  self.challenge_indicator = data["challenge_indicator"]
535
561
  end
562
+ if data.include? "incremental"
563
+ self.incremental = data["incremental"]
564
+ end
565
+ if data.include? "tax"
566
+ self.tax = data["tax"]
567
+ end
536
568
 
537
569
  self
538
570
  end
@@ -581,10 +613,37 @@ module ProcessOut
581
613
  self.exemption_reason_3ds2 = data.fetch(:exemption_reason_3ds2, self.exemption_reason_3ds2)
582
614
  self.sca_exemption_reason = data.fetch(:sca_exemption_reason, self.sca_exemption_reason)
583
615
  self.challenge_indicator = data.fetch(:challenge_indicator, self.challenge_indicator)
616
+ self.incremental = data.fetch(:incremental, self.incremental)
617
+ self.tax = data.fetch(:tax, self.tax)
584
618
 
585
619
  self
586
620
  end
587
621
 
622
+ # Create an incremental authorization
623
+ # Params:
624
+ # +amount+:: Amount to increment authorization by
625
+ # +options+:: +Hash+ of options
626
+ def increment authorization(amount, options = {})
627
+ self.prefill(options)
628
+
629
+ request = Request.new(@client)
630
+ path = "/invoices/" + CGI.escape(@id) + "/increment_authorization"
631
+ data = {
632
+ "amount" => amount
633
+ }
634
+
635
+ response = Response.new(request.post(path, data, options))
636
+ return_values = Array.new
637
+
638
+ body = response.body
639
+ body = body["transaction"]
640
+ transaction = Transaction.new(@client)
641
+ return_values.push(transaction.fill_with_data(body))
642
+
643
+
644
+ return_values[0]
645
+ end
646
+
588
647
  # Authorize the invoice using the given source (customer or token)
589
648
  # Params:
590
649
  # +source+:: Source used to authorization the payment. Can be a card, a token or a gateway request
@@ -596,6 +655,7 @@ module ProcessOut
596
655
  path = "/invoices/" + CGI.escape(@id) + "/authorize"
597
656
  data = {
598
657
  "device" => @device,
658
+ "incremental" => @incremental,
599
659
  "synchronous" => options.fetch(:synchronous, nil),
600
660
  "retry_drop_liability_shift" => options.fetch(:retry_drop_liability_shift, nil),
601
661
  "capture_amount" => options.fetch(:capture_amount, nil),
@@ -627,6 +687,7 @@ module ProcessOut
627
687
  path = "/invoices/" + CGI.escape(@id) + "/capture"
628
688
  data = {
629
689
  "device" => @device,
690
+ "incremental" => @incremental,
630
691
  "authorize_only" => options.fetch(:authorize_only, nil),
631
692
  "synchronous" => options.fetch(:synchronous, nil),
632
693
  "retry_drop_liability_shift" => options.fetch(:retry_drop_liability_shift, nil),
@@ -833,7 +894,8 @@ module ProcessOut
833
894
  "shipping" => @shipping,
834
895
  "device" => @device,
835
896
  "require_backend_capture" => @require_backend_capture,
836
- "external_fraud_tools" => @external_fraud_tools
897
+ "external_fraud_tools" => @external_fraud_tools,
898
+ "tax" => @tax
837
899
  }
838
900
 
839
901
  response = Response.new(request.post(path, data, options))
@@ -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 InvoiceTax
10
+
11
+ attr_reader :amount
12
+ attr_reader :rate
13
+
14
+
15
+ def amount=(val)
16
+ @amount = val
17
+ end
18
+
19
+ def rate=(val)
20
+ @rate = val
21
+ end
22
+
23
+
24
+ # Initializes the InvoiceTax 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.rate = data.fetch(:rate, nil)
33
+
34
+ end
35
+
36
+ # Create a new InvoiceTax using the current client
37
+ def new(data = {})
38
+ InvoiceTax.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
+ "rate": self.rate,
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? "rate"
60
+ self.rate = data["rate"]
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.rate = data.fetch(:rate, self.rate)
75
+
76
+ self
77
+ end
78
+
79
+
80
+ end
81
+ 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.14.4"
16
+ req["User-Agent"] = "ProcessOut Ruby-Bindings/2.15.0"
17
17
 
18
18
  unless options.nil?
19
19
  req["Idempotency-Key"] = options.fetch(:idempotency_key, "")
@@ -1,3 +1,3 @@
1
1
  module ProcessOut
2
- VERSION = "2.14.4"
2
+ VERSION = "2.15.0"
3
3
  end
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.14.4
4
+ version: 2.15.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-02-05 00:00:00.000000000 Z
11
+ date: 2021-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -97,6 +97,7 @@ files:
97
97
  - lib/processout/invoice_external_fraud_tools.rb
98
98
  - lib/processout/invoice_risk.rb
99
99
  - lib/processout/invoice_shipping.rb
100
+ - lib/processout/invoice_tax.rb
100
101
  - lib/processout/networking/request.rb
101
102
  - lib/processout/networking/response.rb
102
103
  - lib/processout/payment_data_network_authentication.rb