khipu-api-client 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -27
- data/khipu-api-client-2.2.0.gem +0 -0
- data/lib/khipu-api-client/models/base_object.rb +1 -1
- data/lib/khipu-api-client/models/payment_response.rb +25 -1
- data/lib/khipu-api-client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f9c2cfae445433e200e8c7f9e5af43cdfa8a0d9
|
4
|
+
data.tar.gz: aeff41070c1661cdda886b57f135a7f14b8bba78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c595c66ad2ce11601b05b5b73e00d597ccde2e3eae1db1c328b2c0420cb5373d38c2a5c770d8ea5da50baadf410ccf785d33f8a43c88bc55b144149dfaa66be0
|
7
|
+
data.tar.gz: b6ea8b1076e19afb00725f54c574108a5d7ca084a9783b7cd9597e9b42a2338ad45b1c667d172d95784bdfc3cc1d75b07b6f9a46667bed67afc248520e923aa7
|
data/README.md
CHANGED
@@ -1,52 +1,53 @@
|
|
1
1
|
## Installation
|
2
2
|
|
3
|
-
```
|
3
|
+
```sh
|
4
4
|
gem install khipu-api-client
|
5
5
|
```
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
9
9
|
### Basic configuration
|
10
|
-
```
|
10
|
+
```ruby
|
11
11
|
require 'khipu-api-client'
|
12
12
|
|
13
13
|
Khipu.configure do |c|
|
14
|
-
c.secret
|
15
|
-
c.receiver_id
|
14
|
+
c.secret = 'abc123'
|
15
|
+
c.receiver_id = 1234
|
16
|
+
c.platform = 'my-ecomerce' # (optional) please let us know :)
|
17
|
+
c.platform_version = '1.0'
|
16
18
|
end
|
17
19
|
```
|
18
20
|
|
19
21
|
### Basic usage
|
20
22
|
|
21
23
|
#### Create a new payment
|
22
|
-
```
|
24
|
+
```ruby
|
23
25
|
api = Khipu::PaymentsApi.new()
|
24
26
|
options = {
|
25
|
-
expires_date:
|
26
|
-
send_email: true,
|
27
|
+
expires_date: Time.now + (24*60*60) # 1 day from now
|
28
|
+
send_email: true,
|
27
29
|
payer_name: "payer",
|
28
30
|
payer_email: "payer@mail.com"
|
29
|
-
|
31
|
+
}
|
30
32
|
response = api.payments_post("Test de api nueva", "CLP", 1, options)
|
31
33
|
|
32
34
|
print response
|
33
|
-
# response keys:
|
35
|
+
# response keys:
|
34
36
|
# [:payment_id, :payment_url, :simplified_transfer_url, :transfer_url, :app_url]
|
35
|
-
|
36
37
|
```
|
37
38
|
|
38
39
|
There are a more params you can send in each request. You might want to consider adding these to the options:
|
39
40
|
|
40
|
-
```
|
41
|
-
transaction_id
|
42
|
-
return_url
|
43
|
-
cancel_url
|
44
|
-
notify_url
|
45
|
-
notify_api_version
|
41
|
+
```ruby
|
42
|
+
transaction_id # transaction id in your system
|
43
|
+
return_url # after (potential) success, the client will be redirected to this url
|
44
|
+
cancel_url # if the payment is canceled, the client will be redirected to this url
|
45
|
+
notify_url # khipu will send a notification to this url - the client will not see this request
|
46
|
+
notify_api_version # "1.3"
|
46
47
|
```
|
47
48
|
|
48
49
|
#### Ask for payment status
|
49
|
-
```
|
50
|
+
```ruby
|
50
51
|
api = Khipu::PaymentsApi.new()
|
51
52
|
status = api.payments_id_get(response.payment_id)
|
52
53
|
print status
|
@@ -54,9 +55,9 @@ print status
|
|
54
55
|
|
55
56
|
|
56
57
|
#### Confirm a payment
|
57
|
-
If you send a notification_url when creating the payment or if you have set it up on your account configuration, Khipu will sent you a request with a notification_token and a api_version. You can use the notification_token param to get the payment information from the khipu service.
|
58
|
+
If you send a notification_url when creating the payment or if you have set it up on your account configuration, Khipu will sent you a request with a notification_token and a api_version. You can use the notification_token param to get the payment information from the khipu service.
|
58
59
|
|
59
|
-
```
|
60
|
+
```ruby
|
60
61
|
notification_token = params["notification_token"]
|
61
62
|
client = Khipu::PaymentsApi.new
|
62
63
|
response = client.payments_get(notification_token)
|
@@ -68,14 +69,19 @@ if response.status == 'done'
|
|
68
69
|
end
|
69
70
|
|
70
71
|
print response
|
71
|
-
# response keys:
|
72
|
+
# response keys:
|
72
73
|
# [
|
73
|
-
# :payment_id, :payment_url, :simplified_transfer_url, :transfer_url,
|
74
|
-
# :app_url, :ready_for_terminal, :subject, :amount, :currency, :status,
|
75
|
-
# :status_detail, :body, :picture_url, :receipt_url, :return_url,
|
76
|
-
# :cancel_url, :notify_url, :notify_api_version, :expires_date,
|
77
|
-
# :attachment_urls, :bank, :bank_id, :payer_name, :payer_email,
|
78
|
-
# :personal_identifier, :bank_account_number, :out_of_date_conciliation,
|
74
|
+
# :payment_id, :payment_url, :simplified_transfer_url, :transfer_url,
|
75
|
+
# :app_url, :ready_for_terminal, :subject, :amount, :currency, :status,
|
76
|
+
# :status_detail, :body, :picture_url, :receipt_url, :return_url,
|
77
|
+
# :cancel_url, :notify_url, :notify_api_version, :expires_date,
|
78
|
+
# :attachment_urls, :bank, :bank_id, :payer_name, :payer_email,
|
79
|
+
# :personal_identifier, :bank_account_number, :out_of_date_conciliation,
|
79
80
|
# :transaction_id, :custom, :responsible_user_email, :send_reminders, :send_email
|
80
|
-
# ]
|
81
|
+
# ]
|
81
82
|
```
|
83
|
+
|
84
|
+
### Documentation
|
85
|
+
|
86
|
+
- [API docs](https://khipu.com/page/api)
|
87
|
+
- [gem docs](http://www.rubydoc.info/gems/khipu-api-client/)
|
Binary file
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Khipu
|
2
2
|
#
|
3
3
|
class PaymentResponse < BaseObject
|
4
|
-
attr_accessor :payment_id, :payment_url, :simplified_transfer_url, :transfer_url, :app_url, :ready_for_terminal, :subject, :amount, :currency, :status, :status_detail, :body, :picture_url, :receipt_url, :return_url, :cancel_url, :notify_url, :notify_api_version, :expires_date, :attachment_urls, :bank, :bank_id, :payer_name, :payer_email, :personal_identifier, :bank_account_number, :out_of_date_conciliation, :transaction_id, :custom, :responsible_user_email, :send_reminders, :send_email
|
4
|
+
attr_accessor :payment_id, :payment_url, :simplified_transfer_url, :transfer_url, :app_url, :ready_for_terminal, :notification_token, :receiver_id, :conciliation_date, :subject, :amount, :currency, :status, :status_detail, :body, :picture_url, :receipt_url, :return_url, :cancel_url, :notify_url, :notify_api_version, :expires_date, :attachment_urls, :bank, :bank_id, :payer_name, :payer_email, :personal_identifier, :bank_account_number, :out_of_date_conciliation, :transaction_id, :custom, :responsible_user_email, :send_reminders, :send_email
|
5
5
|
# attribute mapping from ruby-style variable name to JSON key
|
6
6
|
def self.attribute_map
|
7
7
|
{
|
@@ -24,6 +24,15 @@ module Khipu
|
|
24
24
|
#
|
25
25
|
:'ready_for_terminal' => :'ready_for_terminal',
|
26
26
|
|
27
|
+
#
|
28
|
+
:'notification_token' => :'notification_token',
|
29
|
+
|
30
|
+
#
|
31
|
+
:'receiver_id' => :'receiver_id',
|
32
|
+
|
33
|
+
#
|
34
|
+
:'conciliation_date' => :'conciliation_date',
|
35
|
+
|
27
36
|
#
|
28
37
|
:'subject' => :'subject',
|
29
38
|
|
@@ -114,6 +123,9 @@ module Khipu
|
|
114
123
|
:'transfer_url' => :'String',
|
115
124
|
:'app_url' => :'String',
|
116
125
|
:'ready_for_terminal' => :'BOOLEAN',
|
126
|
+
:'notification_token' => :'String',
|
127
|
+
:'receiver_id' => :'Float',
|
128
|
+
:'conciliation_date' => :'DateTime',
|
117
129
|
:'subject' => :'String',
|
118
130
|
:'amount' => :'Float',
|
119
131
|
:'currency' => :'String',
|
@@ -175,6 +187,18 @@ module Khipu
|
|
175
187
|
self.ready_for_terminal = attributes[:'ready_for_terminal']
|
176
188
|
end
|
177
189
|
|
190
|
+
if attributes[:'notification_token']
|
191
|
+
self.notification_token = attributes[:'notification_token']
|
192
|
+
end
|
193
|
+
|
194
|
+
if attributes[:'receiver_id']
|
195
|
+
self.receiver_id = attributes[:'receiver_id']
|
196
|
+
end
|
197
|
+
|
198
|
+
if attributes[:'conciliation_date']
|
199
|
+
self.conciliation_date = attributes[:'conciliation_date']
|
200
|
+
end
|
201
|
+
|
178
202
|
if attributes[:'subject']
|
179
203
|
self.subject = attributes[:'subject']
|
180
204
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: khipu-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- khipu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -199,6 +199,7 @@ extra_rdoc_files: []
|
|
199
199
|
files:
|
200
200
|
- LICENSE
|
201
201
|
- README.md
|
202
|
+
- khipu-api-client-2.2.0.gem
|
202
203
|
- khipu-api-client.gemspec
|
203
204
|
- lib/khipu-api-client.rb
|
204
205
|
- lib/khipu-api-client/api/banks_api.rb
|