paidy 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60b7d42b64dfcec3324ca3cafadc777d1e74182d54ae8569cfb59c3eca7ddedc
4
- data.tar.gz: 1f0e3bcccbb0057c8bb9b2f964a0a44306850d205391d9e0766e44c327eaf0b8
3
+ metadata.gz: b598dcd67cc7e2f5ba91404c3fa6515ffe44702120c296d5751f574a53b6cc59
4
+ data.tar.gz: 040edc35501d9fe29610adec285a3ba3cab63649f0ec802956eeb3a9858f3394
5
5
  SHA512:
6
- metadata.gz: cce61e83e5a263a032b8c09464c2a0e6a9b938d2f7e6081a8310acea635d86404130d0c58f321fd3ea16f4daa984aba15f7b5f8a0d052d931d2dc40c3bfd00d8
7
- data.tar.gz: c652a90eb5301997e503bbe6435aa275c7219cc9da2bc2fc0966e6f79f5beec0713796829910b78504ffba8d3721ae9ecbad0df90d98bc01acfa8c2ad97437cc
6
+ metadata.gz: e381b27251118a69a41cbfcecb44532984fc9cca42d9b08711fd805ed3ff956f96786726c579e1614faccab00a0912bc7a0ed909e035b8dba58505e752b0171b
7
+ data.tar.gz: 10f52eeab0afd30af5c922dd845aa4a11749c35515fd502a9052db66e451a3ff004e1c829a30003f609eb3866a9a479e07f409d69fe6a28ef3644850fe7ae8da
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.6
1
+ 3.2.1
data/Gemfile.lock CHANGED
@@ -1,26 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paidy (0.0.3)
4
+ paidy (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- diff-lcs (1.3)
10
- rake (13.0.1)
11
- rspec (3.9.0)
12
- rspec-core (~> 3.9.0)
13
- rspec-expectations (~> 3.9.0)
14
- rspec-mocks (~> 3.9.0)
15
- rspec-core (3.9.2)
16
- rspec-support (~> 3.9.3)
17
- rspec-expectations (3.9.2)
9
+ diff-lcs (1.5.0)
10
+ rake (13.0.6)
11
+ rspec (3.12.0)
12
+ rspec-core (~> 3.12.0)
13
+ rspec-expectations (~> 3.12.0)
14
+ rspec-mocks (~> 3.12.0)
15
+ rspec-core (3.12.2)
16
+ rspec-support (~> 3.12.0)
17
+ rspec-expectations (3.12.3)
18
18
  diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.9.0)
20
- rspec-mocks (3.9.1)
19
+ rspec-support (~> 3.12.0)
20
+ rspec-mocks (3.12.6)
21
21
  diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.9.0)
23
- rspec-support (3.9.3)
22
+ rspec-support (~> 3.12.0)
23
+ rspec-support (3.12.1)
24
24
 
25
25
  PLATFORMS
26
26
  ruby
@@ -32,4 +32,4 @@ DEPENDENCIES
32
32
  rspec (~> 3.0)
33
33
 
34
34
  BUNDLED WITH
35
- 2.1.4
35
+ 2.4.19
data/lib/paidy/charge.rb CHANGED
@@ -18,9 +18,10 @@ module Paidy
18
18
  def initialize(id)
19
19
  @id = id
20
20
  @capture_id = nil
21
+ @amount = nil
21
22
  end
22
23
 
23
- attr_reader :id, :capture_id, :status
24
+ attr_reader :id, :capture_id, :amount
24
25
 
25
26
  def capture
26
27
  res = Paidy.request(:post, "#{base_path}/captures", {}, {})
@@ -35,23 +36,29 @@ module Paidy
35
36
  self
36
37
  end
37
38
 
38
- def refund
39
- res = Paidy.request(:post, "#{base_path}/refund", { capture_id: capture_id }, {})
39
+ def refund(amount: nil, refund_reason: nil)
40
+ params = { capture_id: capture_id }
41
+ params[:amount] = amount if amount.present?
42
+ params[:reason] = refund_reason if refund_reason.present?
43
+
44
+ res = Paidy.request(:post, "#{base_path}/refunds", params, {})
40
45
 
41
46
  self
42
47
  end
43
48
 
44
- def refund_or_close
49
+ def refund_or_close(amount: nil, refund_reason: nil)
45
50
  if capture_id.nil?
46
51
  close
47
52
  else
48
- refund
53
+ refund(amount: amount, refund_reason: refund_reason)
49
54
  end
50
55
  end
51
56
 
52
57
  def refresh
53
58
  res = Paidy.request(:get, "payments/#{id}")
54
59
 
60
+ @amount = res['amount']
61
+
55
62
  if res['status'] == 'closed' && res['captures'].present?
56
63
  @capture_id = res['captures'][0]['id']
57
64
  end
data/lib/paidy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Paidy
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paidy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - rn0rno
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-15 00:00:00.000000000 Z
11
+ date: 2023-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -85,7 +85,7 @@ licenses:
85
85
  metadata:
86
86
  homepage_uri: https://github.com/rn0rno
87
87
  source_code_uri: https://github.com/rn0rno/paidy-ruby
88
- post_install_message:
88
+ post_install_message:
89
89
  rdoc_options: []
90
90
  require_paths:
91
91
  - lib
@@ -100,8 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.0.3
104
- signing_key:
103
+ rubygems_version: 3.4.6
104
+ signing_key:
105
105
  specification_version: 4
106
106
  summary: Ruby bindings for the Paidy API
107
107
  test_files: []