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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c32b84f0cc282c466eb9eff837a770e9f893d94f
4
- data.tar.gz: ef83916d2cefdd177693703f3f127fdb6f3f7079
3
+ metadata.gz: 7c5b2c845c158e1ab7e91505cc0c54d2752865cd
4
+ data.tar.gz: 0273b77ccecd106ab8c12b9c2104044ffd2365df
5
5
  SHA512:
6
- metadata.gz: a9e3b36d02e1f3907be1dc80f1f0f64e116fa9671bbe71bc14db34ede69cc5781a6c98c970cb83f7d32ae1577a951af50e727c5752955a6af48500935854b219
7
- data.tar.gz: be29417634b753bf4ed3b79768626b2814b1cfc613511dad0f3920a2c2ffe1395f6ec5bbb8850b40dcecbe0c38fa1cf633fe6ae8daab191faad074879f1bb431
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 :amount, length: { maximum: 3 }
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/request"
44
+ def self.endpoint payment_id
45
+ "payments/credit/#{payment_id}/cancel"
52
46
  end
53
47
  end
54
- end
48
+ end
@@ -3,7 +3,7 @@ module GetnetApi
3
3
  module Version
4
4
  MAJOR = 1
5
5
  MINOR = 0
6
- PATCH = 0
6
+ PATCH = 1
7
7
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
8
8
  end
9
9
  end
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.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-25 00:00:00.000000000 Z
11
+ date: 2020-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client