khipu 1.3.3 → 1.3.4

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.
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - jruby-19mode
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # khipu
2
2
 
3
+ [![Build Status](https://travis-ci.org/khipu/lib-ruby.png)](https://travis-ci.org/khipu/lib-ruby)
4
+
3
5
  [khipu - Yo pago, Yo cobro](https://khipu.com)
4
6
 
5
7
  Gema Ruby para utilizar los servicios de Khipu.com
@@ -29,7 +31,8 @@ Esta biblioteca implementa los siguientes servicios de khipu:
29
31
  4. Crear una página de Pago (autenticado).
30
32
  5. Crear un pago y obtener us URL.
31
33
  6. Crear un pago y obtener us URL (autenticado).
32
- 7. Recibir y validar la notificación de un pago.
34
+ 7.1. Recibir y validar la notificación de un pago (API de notificación 1.3 o superior).
35
+ 7.2. Recibir y validar la notificación de un pago (API de notificación 1.2 o inferior).
33
36
  8. Verificar el estado de una cuenta de cobro.
34
37
  9. Verificar el estado de un pago.
35
38
  10. Marcar un pago como pagado.
@@ -121,8 +124,25 @@ para pagar debe estar asociada al RUT indicado.
121
124
  puts error.message
122
125
  end
123
126
  ```
124
- Se puede obtener una
125
- ### 7) Validar la notificación de un pago.
127
+
128
+ ### 7.1) Validar la notificación de un pago (API de notificación 1.3 o superior)
129
+
130
+ Este ejemplo contacta a khipu para obtener la notificación de un pago a partir de un token de notificación.
131
+ El resultado contiene el receiver_id, transaction_id, amount, currency, etc con lo que se debe el pago contra el backend.
132
+ En este ejemplo los parámetros se configuran a mano, pero en producción los datos deben obtenerse desde el request _request html_.
133
+
134
+ ```Ruby
135
+ begin
136
+ service = Khipu.create_khipu_api(ID_DEL_COBRADOR, SECRET_DEL_COBRADOR)
137
+ params = {notification_token: 'j8kPBHaPNy3PkCh...hhLvQbenpGjA'}
138
+ map = service.get_payment_notification(params)
139
+ rescue Khipu::ApiError => error
140
+ puts error.type
141
+ puts error.message
142
+ end
143
+ ``````
144
+
145
+ ### 7.2) Validar la notificación de un pago (API de notificación 1.2 o inferior).
126
146
 
127
147
  Este ejemplo contacta a khipu para validar los datos de una transacción. Para usar
128
148
  este servicio no es necesario configurar el SECRET del cobrador. Se retorna true si la información del la notificación
@@ -173,11 +173,20 @@ module Khipu
173
173
  currency: args[:currency] || 'CLP',
174
174
  transaction_id: args[:transaction_id] || '',
175
175
  payer_email: args[:payer_email] || '',
176
- custom: args[:custom] || '',
176
+ custom: args[:custom] || ''
177
177
  }
178
178
  verify_signature(params, args[:notification_signature])
179
179
  end
180
180
 
181
+ def get_payment_notification(args)
182
+ endpoint = 'getPaymentNotification'
183
+ check_arguments(args, [:api_version, :notification_token])
184
+ params = {
185
+ notification_token: args[:notification_token]
186
+ }
187
+ execute(endpoint, params)
188
+ end
189
+
181
190
  # Integrator API
182
191
 
183
192
  def create_receiver(args)
data/lib/khipu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Khipu
2
- VERSION = "1.3.3"
2
+ VERSION = "1.3.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: khipu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-22 00:00:00.000000000 Z
12
+ date: 2015-01-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -83,6 +83,7 @@ extensions: []
83
83
  extra_rdoc_files: []
84
84
  files:
85
85
  - .gitignore
86
+ - .travis.yml
86
87
  - Gemfile
87
88
  - LICENSE.txt
88
89
  - README.md