braspag-rest 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/braspag-rest/payment.rb +1 -0
- data/lib/braspag-rest/request.rb +3 -3
- data/lib/braspag-rest/sale.rb +5 -4
- data/lib/braspag-rest/version.rb +1 -1
- metadata +21 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f63d40567c9dd1e0a798074c0c3d93903832c24a
|
4
|
+
data.tar.gz: 303f10898e36daba8745417a77807dffa0564200
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e135a57ae5e29ee9807ba814f1b40f066f364a667aaa66e3f2790220a416c81d64bba872a80983fa2a44fe7398db09d06ba64d5dc699c80e4223616fb997111d
|
7
|
+
data.tar.gz: 6c397b73e59d89d324a11edaed98652bd691871941f290b553ca09c45451c48473adb0570aff8aa0019a62cd2e1c4231c74e468b32a9c8d100730253fc77d581
|
data/lib/braspag-rest/payment.rb
CHANGED
@@ -18,6 +18,7 @@ module BraspagRest
|
|
18
18
|
property :proof_of_sale, from: 'ProofOfSale'
|
19
19
|
property :reason_code, from: 'ReasonCode'
|
20
20
|
property :reason_message, from: 'ReasonMessage'
|
21
|
+
property :voided_amount, from: 'VoidedAmount'
|
21
22
|
|
22
23
|
coerce_key :credit_card, BraspagRest::CreditCard
|
23
24
|
|
data/lib/braspag-rest/request.rb
CHANGED
@@ -13,7 +13,7 @@ module BraspagRest
|
|
13
13
|
|
14
14
|
def void(request_id, payment_id, amount)
|
15
15
|
execute_braspag_request do
|
16
|
-
RestClient.put(void_url(payment_id
|
16
|
+
RestClient.put(void_url(payment_id, amount), nil, default_headers.merge('RequestId' => request_id))
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -49,8 +49,8 @@ module BraspagRest
|
|
49
49
|
config.url + SALE_ENDPOINT
|
50
50
|
end
|
51
51
|
|
52
|
-
def void_url(payment_id)
|
53
|
-
sale_url + payment_id.to_s + VOID_ENDPOINT
|
52
|
+
def void_url(payment_id, amount)
|
53
|
+
sale_url + payment_id.to_s + VOID_ENDPOINT + (amount ? "?amount=#{amount}" : '')
|
54
54
|
end
|
55
55
|
|
56
56
|
def search_sale_url(payment_id)
|
data/lib/braspag-rest/sale.rb
CHANGED
@@ -31,15 +31,16 @@ module BraspagRest
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def cancel(amount = nil)
|
34
|
-
response = BraspagRest::Request.void(request_id, payment.id,
|
34
|
+
response = BraspagRest::Request.void(request_id, payment.id, amount)
|
35
35
|
|
36
36
|
if response.success?
|
37
|
-
|
37
|
+
voided_amount = amount ? payment.voided_amount.to_i + amount : payment.amount
|
38
|
+
self.payment.initialize_attributes(voided_amount: voided_amount)
|
38
39
|
else
|
39
|
-
initialize_errors(response.parsed_body)
|
40
|
+
initialize_errors(response.parsed_body)
|
40
41
|
end
|
41
42
|
|
42
|
-
|
43
|
+
response.success?
|
43
44
|
end
|
44
45
|
|
45
46
|
def capture(amount = nil)
|
data/lib/braspag-rest/version.rb
CHANGED
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braspag-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dinda Dev Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: hashie
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.10'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.10'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '10.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: pry-nav
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: Gem to use Braspag gateway in his REST version
|
@@ -117,9 +117,9 @@ executables:
|
|
117
117
|
extensions: []
|
118
118
|
extra_rdoc_files: []
|
119
119
|
files:
|
120
|
-
-
|
121
|
-
-
|
122
|
-
-
|
120
|
+
- .gitignore
|
121
|
+
- .rspec
|
122
|
+
- .travis.yml
|
123
123
|
- Gemfile
|
124
124
|
- LICENSE.txt
|
125
125
|
- README.md
|
@@ -149,12 +149,12 @@ require_paths:
|
|
149
149
|
- lib
|
150
150
|
required_ruby_version: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
|
-
- -
|
152
|
+
- - '>='
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: '0'
|
155
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - '>='
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|