getnet_api 1.0.0 → 1.0.1
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 +4 -4
- data/README.md +14 -0
- data/lib/getnet_api/payment_cancel.rb +5 -11
- data/lib/getnet_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c5b2c845c158e1ab7e91505cc0c54d2752865cd
|
4
|
+
data.tar.gz: 0273b77ccecd106ab8c12b9c2104044ffd2365df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b93a71d52cd550134424729541532596f53a4bc908077516063164da66a84dbe5027778e3adb47a6fd75ca91e2df573560ce0c8e5880d2732be32244fa18f87
|
7
|
+
data.tar.gz: 6b44db903d6c05a36e6c2223d09f12280f721c8881c1c1562a3bb2165e86b999e8af2b4c671aa7a59353b092e7aea3416b5fa98c586074ef4b6661ca8a15ed94
|
data/README.md
CHANGED
@@ -157,6 +157,19 @@ obj_boleto = GetnetApi::Boleto.new ({
|
|
157
157
|
novo_pagamento = GetnetApi::Payment.create obj_pagamento, obj_boleto, :boleto
|
158
158
|
```
|
159
159
|
|
160
|
+
## Criando um cancelamento de cartão de crédito
|
161
|
+
|
162
|
+
### Montar [Cancelamento](https://www.rubydoc.info/gems/getnet_api/GetnetApi/PaymentCancel)
|
163
|
+
```ruby
|
164
|
+
obj_cancelamento = GetnetApi::PaymentCancel.new ({
|
165
|
+
payment_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
166
|
+
cancel_amount: 1000
|
167
|
+
})
|
168
|
+
|
169
|
+
# GetnetApi::PaymentCancel.create(GetnetApi::PaymentCancel)
|
170
|
+
cancelamento = GetnetApi::PaymentCancel.create obj_cancelamento
|
171
|
+
```
|
172
|
+
|
160
173
|
---
|
161
174
|
|
162
175
|
|
@@ -165,6 +178,7 @@ novo_pagamento = GetnetApi::Payment.create obj_pagamento, obj_boleto, :boleto
|
|
165
178
|
- [QW3 Software & Marketing](http://qw3.com.br)
|
166
179
|
- [Leandro dos Santos Falcão](https://www.linkedin.com/in/lsfalcao)
|
167
180
|
- [Victor Barreiros](www.linkedin.com/in/victor-barreiros)
|
181
|
+
- [Daniel B. Brumazzi](https://www.linkedin.com/in/daniel-brumazzi-2153707b/)
|
168
182
|
|
169
183
|
## Copyright
|
170
184
|
|
@@ -10,15 +10,10 @@ module GetnetApi
|
|
10
10
|
# Valor do pagamento em centavos
|
11
11
|
attr_accessor :cancel_amount
|
12
12
|
|
13
|
-
# cancel_custom_key
|
14
|
-
# string <= 32 characters
|
15
|
-
# Chave do cliente utilizada para identificar uma solicitação de cancelamento.
|
16
|
-
attr_accessor :cancel_custom_key
|
17
|
-
|
18
13
|
# Validações do Rails 3
|
19
14
|
include ActiveModel::Validations
|
20
15
|
|
21
|
-
validates :
|
16
|
+
validates :cancel_amount, length: { maximum: 10 }
|
22
17
|
|
23
18
|
def initialize campos={}
|
24
19
|
campos.each do |campo, valor|
|
@@ -33,7 +28,6 @@ module GetnetApi
|
|
33
28
|
pay_cancel = {
|
34
29
|
payment_id: self.payment_id,
|
35
30
|
cancel_amount: self.cancel_amount,
|
36
|
-
cancel_custom_key: self.cancel_custom_key
|
37
31
|
}
|
38
32
|
end
|
39
33
|
|
@@ -41,14 +35,14 @@ module GetnetApi
|
|
41
35
|
def self.create payment_cancel
|
42
36
|
hash = payment_cancel.to_request
|
43
37
|
|
44
|
-
response = self.build_request self.endpoint, "post", hash
|
38
|
+
response = self.build_request self.endpoint(hash[:payment_id]), "post", hash
|
45
39
|
|
46
40
|
return JSON.parse(response.read_body)
|
47
41
|
end
|
48
42
|
|
49
43
|
private
|
50
|
-
def self.endpoint
|
51
|
-
"cancel
|
44
|
+
def self.endpoint payment_id
|
45
|
+
"payments/credit/#{payment_id}/cancel"
|
52
46
|
end
|
53
47
|
end
|
54
|
-
end
|
48
|
+
end
|
data/lib/getnet_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getnet_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- QW3 Software & Marketing
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|