tikkie-api 0.2.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +20 -16
- data/.travis.yml +5 -5
- data/Gemfile +3 -2
- data/Gemfile.lock +23 -24
- data/LICENSE.txt +1 -1
- data/README.md +198 -69
- data/lib/tikkie/api.rb +52 -25
- data/lib/tikkie/api/amount.rb +35 -0
- data/lib/tikkie/api/client.rb +16 -8
- data/lib/tikkie/api/clients/base.rb +16 -0
- data/lib/tikkie/api/clients/payment_requests.rb +25 -0
- data/lib/tikkie/api/clients/payment_requests_subscription.rb +20 -0
- data/lib/tikkie/api/clients/payments.rb +20 -0
- data/lib/tikkie/api/clients/refunds.rb +20 -0
- data/lib/tikkie/api/clients/sandbox_apps.rb +15 -0
- data/lib/tikkie/api/configuration.rb +8 -47
- data/lib/tikkie/api/exception.rb +28 -8
- data/lib/tikkie/api/request.rb +51 -27
- data/lib/tikkie/api/resources/base.rb +66 -0
- data/lib/tikkie/api/{responses → resources}/error.rb +11 -9
- data/lib/tikkie/api/resources/list.rb +52 -0
- data/lib/tikkie/api/resources/payment.rb +68 -0
- data/lib/tikkie/api/resources/payment_request.rb +97 -0
- data/lib/tikkie/api/resources/payment_requests.rb +40 -0
- data/lib/tikkie/api/resources/payment_requests_subscription.rb +24 -0
- data/lib/tikkie/api/resources/payments.rb +48 -0
- data/lib/tikkie/api/resources/refund.rb +71 -0
- data/lib/tikkie/api/resources/sandbox_app.rb +20 -0
- data/lib/tikkie/api/response.rb +64 -0
- data/lib/tikkie/api/v1/access_token.rb +21 -0
- data/lib/tikkie/api/v1/authentication.rb +67 -0
- data/lib/tikkie/api/v1/client.rb +26 -0
- data/lib/tikkie/api/v1/configuration.rb +64 -0
- data/lib/tikkie/api/v1/exception.rb +24 -0
- data/lib/tikkie/api/v1/request.rb +59 -0
- data/lib/tikkie/api/v1/requests/payment_requests.rb +59 -0
- data/lib/tikkie/api/v1/requests/platforms.rb +34 -0
- data/lib/tikkie/api/v1/requests/users.rb +33 -0
- data/lib/tikkie/api/v1/responses/bank_account.rb +24 -0
- data/lib/tikkie/api/v1/responses/base.rb +69 -0
- data/lib/tikkie/api/v1/responses/error.rb +36 -0
- data/lib/tikkie/api/v1/responses/pagination.rb +22 -0
- data/lib/tikkie/api/v1/responses/payment.rb +50 -0
- data/lib/tikkie/api/v1/responses/payment_request.rb +68 -0
- data/lib/tikkie/api/v1/responses/payment_request_created.rb +24 -0
- data/lib/tikkie/api/v1/responses/payment_requests.rb +44 -0
- data/lib/tikkie/api/v1/responses/platform.rb +46 -0
- data/lib/tikkie/api/v1/responses/platforms.rb +34 -0
- data/lib/tikkie/api/v1/responses/user.rb +43 -0
- data/lib/tikkie/api/v1/responses/users.rb +38 -0
- data/lib/tikkie/api/v1/types/payment_request_status.rb +17 -0
- data/lib/tikkie/api/v1/types/payment_status.rb +16 -0
- data/lib/tikkie/api/v1/types/platform_status.rb +14 -0
- data/lib/tikkie/api/v1/types/platform_usage.rb +14 -0
- data/lib/tikkie/api/v1/types/user_status.rb +14 -0
- data/lib/tikkie/api/version.rb +1 -1
- data/lib/tikkie/notification.rb +23 -0
- data/lib/tikkie/notifications/bundle_notification.rb +28 -0
- data/lib/tikkie/notifications/payment_notification.rb +32 -0
- data/lib/tikkie/notifications/refund_notification.rb +36 -0
- data/tikkie-api.gemspec +3 -2
- metadata +69 -43
- data/lib/tikkie/api/access_token.rb +0 -19
- data/lib/tikkie/api/authentication.rb +0 -65
- data/lib/tikkie/api/requests/payment_requests.rb +0 -57
- data/lib/tikkie/api/requests/platforms.rb +0 -32
- data/lib/tikkie/api/requests/users.rb +0 -31
- data/lib/tikkie/api/responses/bank_account.rb +0 -22
- data/lib/tikkie/api/responses/base.rb +0 -67
- data/lib/tikkie/api/responses/pagination.rb +0 -20
- data/lib/tikkie/api/responses/payment.rb +0 -48
- data/lib/tikkie/api/responses/payment_request.rb +0 -66
- data/lib/tikkie/api/responses/payment_request_created.rb +0 -22
- data/lib/tikkie/api/responses/payment_requests.rb +0 -42
- data/lib/tikkie/api/responses/platform.rb +0 -44
- data/lib/tikkie/api/responses/platforms.rb +0 -32
- data/lib/tikkie/api/responses/user.rb +0 -41
- data/lib/tikkie/api/responses/users.rb +0 -36
- data/lib/tikkie/api/types/payment_request_status.rb +0 -15
- data/lib/tikkie/api/types/payment_status.rb +0 -14
- data/lib/tikkie/api/types/platform_status.rb +0 -12
- data/lib/tikkie/api/types/platform_usage.rb +0 -12
- data/lib/tikkie/api/types/user_status.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c22db51585d284e809e24912acf561c023f9063da1669fdc49330dd223039f32
|
4
|
+
data.tar.gz: e7bf5498e81def5bbf47efa0800d9bb8dc1248cb154df1b227004ab7b2fc80f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c99bc7d78ed22482810d6f12042fe0497ed298cee190c5a73404d9028ab408cf4770ad8650a6cab6bbe4b42b78c852b2e877fcdedc77c7d5a3ce5f778a1373b
|
7
|
+
data.tar.gz: b48d40c3a519e24a83582e5ccc1c66f882d09d16a5090f1ac628c4610c5c9e75ee2c5a8442d360adf13a60becf1f182424fe401186e2a07710e0004e37ea977c
|
data/.rubocop.yml
CHANGED
@@ -1,49 +1,53 @@
|
|
1
|
-
require:
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rspec
|
2
4
|
|
3
5
|
AllCops:
|
4
|
-
TargetRubyVersion: 2.
|
6
|
+
TargetRubyVersion: 2.4
|
5
7
|
DisplayCopNames: true
|
6
8
|
DisplayStyleGuide: true
|
9
|
+
Exclude:
|
10
|
+
- 'lib/tikkie/api/v1/**/*'
|
11
|
+
- 'spec/tikkie/api/v1/**/*'
|
12
|
+
- 'vendor/**/*'
|
13
|
+
|
14
|
+
|
15
|
+
Layout/LineLength:
|
16
|
+
Enabled: false
|
7
17
|
|
8
18
|
|
9
19
|
Metrics/AbcSize:
|
10
|
-
Max:
|
20
|
+
Max: 43
|
11
21
|
|
12
22
|
Metrics/BlockLength:
|
13
23
|
Exclude:
|
14
24
|
- 'spec/**/*'
|
15
25
|
|
16
26
|
Metrics/CyclomaticComplexity:
|
17
|
-
Max:
|
18
|
-
|
19
|
-
Metrics/LineLength:
|
20
|
-
Enabled: false
|
27
|
+
Max: 11
|
21
28
|
|
22
29
|
Metrics/MethodLength:
|
23
30
|
Enabled: false
|
24
31
|
|
32
|
+
Metrics/PerceivedComplexity:
|
33
|
+
Max: 9
|
34
|
+
|
25
35
|
|
26
36
|
RSpec/DescribedClass:
|
27
37
|
EnforcedStyle: explicit
|
28
38
|
|
29
39
|
RSpec/ExampleLength:
|
30
|
-
Max:
|
40
|
+
Max: 12
|
31
41
|
|
32
42
|
RSpec/MultipleExpectations:
|
33
|
-
Max:
|
34
|
-
|
35
|
-
RSpec/NamedSubject:
|
36
|
-
Enabled: false
|
43
|
+
Max: 8
|
37
44
|
|
38
45
|
|
39
46
|
Style/Documentation:
|
40
47
|
Exclude:
|
41
48
|
- 'spec/**/*'
|
42
49
|
|
43
|
-
Style/
|
44
|
-
Enabled: false
|
45
|
-
|
46
|
-
Style/IfUnlessModifier:
|
50
|
+
Style/FormatStringToken:
|
47
51
|
Enabled: false
|
48
52
|
|
49
53
|
Style/SafeNavigation:
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -7,5 +7,6 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
7
7
|
# Specify your gem's dependencies in tikkie-api.gemspec
|
8
8
|
gemspec
|
9
9
|
|
10
|
-
gem 'rubocop', '~> 0.
|
11
|
-
gem 'rubocop-
|
10
|
+
gem 'rubocop', '~> 0.79.0'
|
11
|
+
gem 'rubocop-performance', '~> 1.6.1'
|
12
|
+
gem 'rubocop-rspec', '~> 1.41.0'
|
data/Gemfile.lock
CHANGED
@@ -1,29 +1,26 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tikkie-api (0.
|
5
|
-
jwt (>= 1.0)
|
4
|
+
tikkie-api (2.0.0)
|
6
5
|
|
7
6
|
GEM
|
8
7
|
remote: https://rubygems.org/
|
9
8
|
specs:
|
10
9
|
addressable (2.6.0)
|
11
10
|
public_suffix (>= 2.0.2, < 4.0)
|
12
|
-
ast (2.4.
|
11
|
+
ast (2.4.1)
|
13
12
|
crack (0.4.3)
|
14
13
|
safe_yaml (~> 1.0.0)
|
15
14
|
diff-lcs (1.3)
|
16
15
|
hashdiff (0.3.8)
|
17
|
-
jaro_winkler (1.5.
|
18
|
-
jwt (2.
|
19
|
-
parallel (1.
|
20
|
-
parser (2.
|
21
|
-
ast (~> 2.4.
|
22
|
-
powerpack (0.1.2)
|
23
|
-
psych (3.1.0)
|
16
|
+
jaro_winkler (1.5.4)
|
17
|
+
jwt (2.2.2)
|
18
|
+
parallel (1.19.2)
|
19
|
+
parser (2.7.2.0)
|
20
|
+
ast (~> 2.4.1)
|
24
21
|
public_suffix (3.0.3)
|
25
22
|
rainbow (3.0.0)
|
26
|
-
rake (
|
23
|
+
rake (13.0.1)
|
27
24
|
rspec (3.8.0)
|
28
25
|
rspec-core (~> 3.8.0)
|
29
26
|
rspec-expectations (~> 3.8.0)
|
@@ -37,21 +34,21 @@ GEM
|
|
37
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
35
|
rspec-support (~> 3.8.0)
|
39
36
|
rspec-support (3.8.0)
|
40
|
-
rubocop (0.
|
37
|
+
rubocop (0.79.0)
|
41
38
|
jaro_winkler (~> 1.5.1)
|
42
39
|
parallel (~> 1.10)
|
43
|
-
parser (>= 2.
|
44
|
-
powerpack (~> 0.1)
|
45
|
-
psych (>= 3.1.0)
|
40
|
+
parser (>= 2.7.0.1)
|
46
41
|
rainbow (>= 2.2.2, < 4.0)
|
47
42
|
ruby-progressbar (~> 1.7)
|
48
|
-
unicode-display_width (
|
49
|
-
rubocop-
|
50
|
-
rubocop (>= 0.
|
51
|
-
|
43
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
44
|
+
rubocop-performance (1.6.1)
|
45
|
+
rubocop (>= 0.71.0)
|
46
|
+
rubocop-rspec (1.41.0)
|
47
|
+
rubocop (>= 0.68.1)
|
48
|
+
ruby-progressbar (1.10.1)
|
52
49
|
safe_yaml (1.0.5)
|
53
50
|
timecop (0.9.1)
|
54
|
-
unicode-display_width (1.
|
51
|
+
unicode-display_width (1.6.1)
|
55
52
|
webmock (2.3.2)
|
56
53
|
addressable (>= 2.3.6)
|
57
54
|
crack (>= 0.3.2)
|
@@ -62,13 +59,15 @@ PLATFORMS
|
|
62
59
|
|
63
60
|
DEPENDENCIES
|
64
61
|
bundler (~> 1.16)
|
65
|
-
|
62
|
+
jwt (>= 1.0)
|
63
|
+
rake (~> 13.0)
|
66
64
|
rspec (~> 3.0)
|
67
|
-
rubocop (~> 0.
|
68
|
-
rubocop-
|
65
|
+
rubocop (~> 0.79.0)
|
66
|
+
rubocop-performance (~> 1.6.1)
|
67
|
+
rubocop-rspec (~> 1.41.0)
|
69
68
|
tikkie-api!
|
70
69
|
timecop (~> 0.9)
|
71
70
|
webmock (~> 2.3)
|
72
71
|
|
73
72
|
BUNDLED WITH
|
74
|
-
1.17.
|
73
|
+
1.17.3
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -4,14 +4,41 @@
|
|
4
4
|
[![Build Status](https://travis-ci.org/KentaaNL/tikkie-api.svg?branch=master)](https://travis-ci.org/KentaaNL/tikkie-api)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/KentaaNL/tikkie-api/badges/gpa.svg)](https://codeclimate.com/github/KentaaNL/tikkie-api)
|
6
6
|
|
7
|
-
Unofficial Ruby library for communicating with the [Tikkie API](https://developer.abnamro.com/
|
7
|
+
Unofficial Ruby library for communicating with the [Tikkie API](https://developer.abnamro.com/api-products/tikkie).
|
8
|
+
|
9
|
+
## Table of Contents
|
10
|
+
|
11
|
+
- [Installation](#installation)
|
12
|
+
- [Usage](#usage)
|
13
|
+
- [Payment requests](#payment-requests)
|
14
|
+
- [Create a Payment request](#create-a-payment-request)
|
15
|
+
- [List Payment requests](#list-payment-requests)
|
16
|
+
- [Get Payment request](#get-payment-request)
|
17
|
+
- [Payments](#payments)
|
18
|
+
- [List Payments](#list-payments)
|
19
|
+
- [Get Payment](#get-payment)
|
20
|
+
- [Refunds](#refunds)
|
21
|
+
- [Create a Refund](#create-a-refund)
|
22
|
+
- [Get Refund](#get-refund)
|
23
|
+
- [Payment requests notification](#payment-requests-notification)
|
24
|
+
- [Create a subscription](#create-a-subscription)
|
25
|
+
- [Delete subscription](#delete-subscription)
|
26
|
+
- [Sandbox apps](#sandbox-apps)
|
27
|
+
- [Create a Sandbox app](#create-a-sandbox-app)
|
28
|
+
- [Error handling](#error-handling)
|
29
|
+
- [Notifications](#notifications)
|
30
|
+
- [API support](#api-support)
|
31
|
+
- [Development](#development)
|
32
|
+
- [Contributing](#contributing)
|
33
|
+
- [License](#license)
|
34
|
+
|
8
35
|
|
9
36
|
## Installation
|
10
37
|
|
11
38
|
Add this line to your application's Gemfile:
|
12
39
|
|
13
40
|
```ruby
|
14
|
-
gem 'tikkie-api'
|
41
|
+
gem 'tikkie-api', '~> 2.0'
|
15
42
|
```
|
16
43
|
|
17
44
|
And then execute:
|
@@ -24,138 +51,240 @@ Or install it yourself as:
|
|
24
51
|
|
25
52
|
## Usage
|
26
53
|
|
27
|
-
|
54
|
+
Create a Tikkie client using your API key and an App token. If you don't have an App token yet, please read the [documentation about App tokens](https://developer.abnamro.com/api-products/tikkie/reference-documentation#section/Overview/App-token) or use the [Sandbox apps endpoint](#sandbox-apps) to create an App token in the sandbox environment.
|
28
55
|
|
29
|
-
|
30
|
-
|
56
|
+
```ruby
|
57
|
+
require 'tikkie/api'
|
58
|
+
|
59
|
+
client = Tikkie::Api::Client.new(api_key: "12345", app_token: "abcdef")
|
60
|
+
```
|
61
|
+
|
62
|
+
The client is created for the production environment by default. If you want to use the sandbox environment, then add `sandbox: true`:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
client = Tikkie::Api::Client.new(api_key: "12345", app_token: "abcdef", sandbox: true)
|
66
|
+
```
|
31
67
|
|
32
|
-
|
68
|
+
### Payment requests
|
33
69
|
|
34
|
-
|
70
|
+
#### Create a Payment request
|
35
71
|
|
36
|
-
|
72
|
+
Creates a new payment request. When the parameter `amount` is omitted, it will create a payment request with an open amount, where the payer can decide on the amount.
|
37
73
|
|
38
74
|
```ruby
|
39
|
-
|
75
|
+
payment_request = client.payment_requests.create(
|
76
|
+
description: "Test", # mandatory
|
77
|
+
amount: "12.50",
|
78
|
+
expiry_date: "2021-01-01",
|
79
|
+
reference_id: "Invoice 12345"
|
80
|
+
)
|
40
81
|
|
41
|
-
|
42
|
-
|
82
|
+
payment_request.payment_request_token # => "qzdnzr8hnVWTgXXcFRLUMc"
|
83
|
+
payment_request.url # => "https://tikkie.me/pay/Tikkie/qzdnzr8hnVWTgXXcFRLUMc"
|
84
|
+
payment_request.amount # => BigDecimal("12.50")
|
43
85
|
```
|
44
86
|
|
45
|
-
|
87
|
+
See [Tikkie::Api::Resources::PaymentRequest](lib/tikkie/api/resources/payment_request.rb) for all available properties.
|
88
|
+
|
89
|
+
#### List Payment requests
|
90
|
+
|
91
|
+
Retrieves all payment requests.
|
46
92
|
|
47
93
|
```ruby
|
48
|
-
|
94
|
+
payment_requests = client.payment_requests.list
|
49
95
|
```
|
50
96
|
|
51
|
-
|
97
|
+
The payments requests response is paginated. You can iterate through the pages using `payment_requests.next` and checking the result:
|
52
98
|
|
53
|
-
|
99
|
+
```ruby
|
100
|
+
payment_requests = client.payment_requests.list
|
101
|
+
|
102
|
+
loop do
|
103
|
+
# Do something with payment requests
|
104
|
+
|
105
|
+
payment_requests = payment_requests.next
|
106
|
+
break if payment_requests.nil?
|
107
|
+
end
|
108
|
+
```
|
109
|
+
|
110
|
+
See [Tikkie::Api::Resources::PaymentRequests](lib/tikkie/api/resources/payment_requests.rb) for all available properties.
|
111
|
+
|
112
|
+
#### Get Payment request
|
113
|
+
|
114
|
+
Retrieve details of a specific payment request.
|
54
115
|
|
55
116
|
```ruby
|
56
|
-
|
117
|
+
payment_request = client.payment_requests.get("payment_request_token")
|
118
|
+
|
119
|
+
payment_request.payment_request_token # => "qzdnzr8hnVWTgXXcFRLUMc"
|
120
|
+
payment_request.url # => "https://tikkie.me/pay/Tikkie/qzdnzr8hnVWTgXXcFRLUMc"
|
121
|
+
payment_request.amount # => BigDecimal("12.50")
|
122
|
+
payment_request.payments # => Tikkie::Api::Resources::Payments
|
57
123
|
```
|
58
124
|
|
59
|
-
|
125
|
+
See [Tikkie::Api::Resources::PaymentRequest](lib/tikkie/api/resources/payment_request.rb) for all available properties.
|
126
|
+
|
127
|
+
|
128
|
+
### Payments
|
129
|
+
|
130
|
+
#### List Payments
|
131
|
+
|
132
|
+
Retrieves all payments for a specific payment request.
|
60
133
|
|
61
134
|
```ruby
|
62
|
-
|
63
|
-
|
64
|
-
phone_number: "0601234567",
|
65
|
-
platform_usage: Tikkie::Api::Types::PlatformUsage::FOR_MYSELF,
|
66
|
-
email: "info@kentaa.nl", # optional
|
67
|
-
notification_url: "https://kentaa.nl/tikkie" # optional
|
68
|
-
)
|
135
|
+
payments = client.payments.list("payment_request_token")
|
136
|
+
```
|
69
137
|
|
70
|
-
|
138
|
+
The payments requests response is paginated. You can iterate through the pages using `payments.next` and checking the result:
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
payments = client.payments.list("qzdnzr8hnVWTgXXcFRLUMc")
|
142
|
+
|
143
|
+
loop do
|
144
|
+
# Do something with payments
|
145
|
+
|
146
|
+
payments = payments.next
|
147
|
+
break if payments.nil?
|
148
|
+
end
|
71
149
|
```
|
72
150
|
|
73
|
-
|
151
|
+
See [Tikkie::Api::Resources::Payments](lib/tikkie/api/resources/payments.rb) for all available properties.
|
152
|
+
|
153
|
+
#### Get Payment
|
74
154
|
|
75
|
-
|
155
|
+
Retrieves details of specific payment based on the token value.
|
76
156
|
|
77
157
|
```ruby
|
78
|
-
|
158
|
+
payment = client.payments.get("payment_request_token", "payment_token")
|
159
|
+
|
160
|
+
payment.payment_token # => "21ef7413-cc3c-4c80-9272-6710fada28e4"
|
161
|
+
payment.amount # => BigDecimal("12.50")
|
162
|
+
payment.description # => "Test"
|
163
|
+
payment.refunds # => Array[Tikkie::Api::Resources::Refund]
|
79
164
|
```
|
80
165
|
|
81
|
-
|
166
|
+
See [Tikkie::Api::Resources::Payment](lib/tikkie/api/resources/payment.rb) for all available properties.
|
167
|
+
|
168
|
+
### Refunds
|
169
|
+
|
170
|
+
#### Create a Refund
|
171
|
+
|
172
|
+
Creates a refund for a specific payment.
|
82
173
|
|
83
174
|
```ruby
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
bank_account_label: "Personal account"
|
175
|
+
refund = client.refunds.create("payment_request_token", "payment_token",
|
176
|
+
description: "Test", # mandatory
|
177
|
+
amount: "10.00", # mandatory
|
178
|
+
reference_id: "Invoice 12345"
|
89
179
|
)
|
90
180
|
|
91
|
-
|
92
|
-
|
181
|
+
refund.refund_token # => "abcdzr8hnVWTgXXcFRLUMc"
|
182
|
+
refund.amount # => BigDecimal("10.00")
|
183
|
+
refund.paid? # => true
|
93
184
|
```
|
94
185
|
|
95
|
-
|
186
|
+
See [Tikkie::Api::Resources::Refund](lib/tikkie/api/resources/refund.rb) for all available properties.
|
187
|
+
|
188
|
+
#### Get Refund
|
96
189
|
|
97
|
-
|
190
|
+
Retrieves details of a specific refund based on the token value.
|
98
191
|
|
99
192
|
```ruby
|
100
|
-
|
193
|
+
refund = client.refunds.get("payment_request_token", "payment_token", "refund_token")
|
194
|
+
|
195
|
+
refund.refund_token # => "abcdzr8hnVWTgXXcFRLUMc"
|
196
|
+
refund.amount # => BigDecimal("10.00")
|
197
|
+
refund.paid? # => true
|
101
198
|
```
|
102
199
|
|
103
|
-
|
200
|
+
See [Tikkie::Api::Resources::Refund](lib/tikkie/api/resources/refund.rb) for all available properties.
|
201
|
+
|
202
|
+
### Payment requests notification
|
203
|
+
|
204
|
+
See [Notifications](#notifications) for information about parsing the callbacks.
|
205
|
+
|
206
|
+
#### Create a subscription
|
207
|
+
|
208
|
+
Subscribes to payment request related notifications.
|
104
209
|
|
105
210
|
```ruby
|
106
|
-
|
211
|
+
subscription = client.payment_requests_subscription.create(url: "https://www.example.com/notification")
|
107
212
|
|
108
|
-
|
109
|
-
|
213
|
+
subscription.subscription_id # => "e0111835-e8df-4070-874a-f12cf3f77e39"
|
214
|
+
```
|
110
215
|
|
111
|
-
|
216
|
+
See [Tikkie::Api::Resources::PaymentRequestsSubscription](lib/tikkie/api/resources/payment_requests_subscription.rb) for all available properties.
|
112
217
|
|
113
|
-
|
218
|
+
#### Delete subscription
|
114
219
|
|
115
|
-
|
116
|
-
|
220
|
+
Deletes the current subscription.
|
221
|
+
|
222
|
+
```ruby
|
223
|
+
client.payment_requests_subscription.delete
|
117
224
|
```
|
118
225
|
|
119
|
-
|
226
|
+
### Sandbox apps
|
227
|
+
|
228
|
+
A sandbox app is used to make API requests in the sandbox environment.
|
229
|
+
|
230
|
+
You must initialize the Tikkie client by omitting the App token and adding the option `sandbox: true`:
|
120
231
|
|
121
232
|
```ruby
|
122
|
-
|
233
|
+
client = Tikkie::Api::Client.new(api_key: "12345", sandbox: true)
|
123
234
|
```
|
124
235
|
|
125
|
-
Create a
|
236
|
+
#### Create a Sandbox app
|
237
|
+
|
238
|
+
Creates an app in the sandbox. The returned `app_token` should be used for all other API operations.
|
126
239
|
|
127
240
|
```ruby
|
128
|
-
|
129
|
-
amount: "5.00", # optional
|
130
|
-
currency: "EUR",
|
131
|
-
description: "Test",
|
132
|
-
external_id: "Invoice 12345" # mandatory only when platform_usage is set to `FOR_MYSELF`
|
133
|
-
)
|
241
|
+
sandbox_app = client.sandbox_apps.create
|
134
242
|
|
135
|
-
|
136
|
-
payment_request_token = payment_request.payment_request_token
|
243
|
+
sandbox_app.app_token # => "935059a6-58b3-4f8d-a021-7bdda0d8d6ad"
|
137
244
|
```
|
138
245
|
|
139
|
-
|
246
|
+
See [Tikkie::Api::Resources::SandboxApp](lib/tikkie/api/resources/sandbox_app.rb) for all available properties.
|
140
247
|
|
141
|
-
|
248
|
+
## Error handling
|
142
249
|
|
143
|
-
All responses
|
250
|
+
All responses that are not HTTP status 20x will result in a [Tikkie::Api::RequestError](lib/tikkie/api/exception.rb).
|
144
251
|
|
145
252
|
```ruby
|
146
|
-
|
253
|
+
begin
|
254
|
+
client.payment_requests.get("invalid")
|
255
|
+
rescue Tikkie::Api::RequestError => e
|
256
|
+
e.http_code # => 404
|
257
|
+
e.http_message # => Not Found
|
258
|
+
e.errors # => Array[Tikkie::Api::Resources::Error]
|
259
|
+
e.messages # => "No payment request was found for the specified paymentRequestToken."
|
260
|
+
end
|
261
|
+
```
|
147
262
|
|
148
|
-
|
149
|
-
# Success handling...
|
263
|
+
## Notifications
|
150
264
|
|
151
|
-
|
152
|
-
else
|
153
|
-
# Error handling...
|
265
|
+
When subscribed to notifications, you can use `Tikkie::Notification.parse` to parse the payload of a callback.
|
154
266
|
|
155
|
-
|
156
|
-
|
267
|
+
```ruby
|
268
|
+
require 'tikkie/notification'
|
269
|
+
|
270
|
+
notification = Tikkie::Notification.parse(request.raw_post)
|
271
|
+
|
272
|
+
notification # => Tikkie::Notifications::PaymentNotification
|
273
|
+
notification.subscription_id # => "e0111835-e8df-4070-874a-f12cf3f77e39"
|
274
|
+
notification.notification_type # => "PAYMENT"
|
275
|
+
notification.payment_request_token # => "qzdnzr8hnVWTgXXcFRLUMc"
|
276
|
+
notification.payment_token # => "21ef7413-cc3c-4c80-9272-6710fada28e4"
|
157
277
|
```
|
158
278
|
|
279
|
+
See [Tikkie::Notifications](lib/tikkie/notifications/) for all types of notifications.
|
280
|
+
|
281
|
+
## API support
|
282
|
+
|
283
|
+
This gem supports [Tikkie API (v2)](https://developer.abnamro.com/api-products/tikkie) as of release 2.0.0.
|
284
|
+
|
285
|
+
The deprecated [Tikkie Payment Request API (v1)](https://developer.abnamro.com/api-products/tikkie-payment-request) is currently namespaced under [Tikkie::Api::V1](lib/tikkie/api/v1/) to allow migration to Tikkie v2. This code is not supported anymore and will be removed in a future release of this gem.
|
286
|
+
To use the Tikkie v1 code, make sure to include the [jwt gem](https://rubygems.org/gems/jwt) in your code.
|
287
|
+
|
159
288
|
## Development
|
160
289
|
|
161
290
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|