tikkie-api 0.1.0 → 2.0.0
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 +5 -5
- data/.rubocop.yml +31 -7
- data/.travis.yml +8 -4
- data/Gemfile +3 -1
- data/Gemfile.lock +39 -33
- data/LICENSE.txt +1 -1
- data/README.md +211 -61
- 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 +4 -3
- metadata +69 -44
- data/lib/tikkie/api/access_token.rb +0 -19
- data/lib/tikkie/api/authentication.rb +0 -60
- data/lib/tikkie/api/requests/payment_requests.rb +0 -56
- 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 -53
- 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 -64
- 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 -30
- data/lib/tikkie/api/responses/user.rb +0 -39
- data/lib/tikkie/api/responses/users.rb +0 -34
- 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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
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,29 +1,53 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rspec
|
4
|
+
|
1
5
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
6
|
+
TargetRubyVersion: 2.4
|
3
7
|
DisplayCopNames: true
|
4
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
|
17
|
+
|
5
18
|
|
6
19
|
Metrics/AbcSize:
|
7
|
-
Max:
|
20
|
+
Max: 43
|
8
21
|
|
9
22
|
Metrics/BlockLength:
|
10
23
|
Exclude:
|
11
24
|
- 'spec/**/*'
|
12
25
|
|
13
26
|
Metrics/CyclomaticComplexity:
|
14
|
-
Max:
|
15
|
-
|
16
|
-
Metrics/LineLength:
|
17
|
-
Enabled: false
|
27
|
+
Max: 11
|
18
28
|
|
19
29
|
Metrics/MethodLength:
|
20
30
|
Enabled: false
|
21
31
|
|
32
|
+
Metrics/PerceivedComplexity:
|
33
|
+
Max: 9
|
34
|
+
|
35
|
+
|
36
|
+
RSpec/DescribedClass:
|
37
|
+
EnforcedStyle: explicit
|
38
|
+
|
39
|
+
RSpec/ExampleLength:
|
40
|
+
Max: 12
|
41
|
+
|
42
|
+
RSpec/MultipleExpectations:
|
43
|
+
Max: 8
|
44
|
+
|
45
|
+
|
22
46
|
Style/Documentation:
|
23
47
|
Exclude:
|
24
48
|
- 'spec/**/*'
|
25
49
|
|
26
|
-
Style/
|
50
|
+
Style/FormatStringToken:
|
27
51
|
Enabled: false
|
28
52
|
|
29
53
|
Style/SafeNavigation:
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -7,4 +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.
|
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,51 +1,54 @@
|
|
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
|
-
addressable (2.
|
9
|
+
addressable (2.6.0)
|
11
10
|
public_suffix (>= 2.0.2, < 4.0)
|
12
|
-
ast (2.
|
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
|
-
hashdiff (0.3.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
public_suffix (3.0.
|
15
|
+
hashdiff (0.3.8)
|
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)
|
21
|
+
public_suffix (3.0.3)
|
23
22
|
rainbow (3.0.0)
|
24
|
-
rake (
|
25
|
-
rspec (3.
|
26
|
-
rspec-core (~> 3.
|
27
|
-
rspec-expectations (~> 3.
|
28
|
-
rspec-mocks (~> 3.
|
29
|
-
rspec-core (3.
|
30
|
-
rspec-support (~> 3.
|
31
|
-
rspec-expectations (3.
|
23
|
+
rake (13.0.1)
|
24
|
+
rspec (3.8.0)
|
25
|
+
rspec-core (~> 3.8.0)
|
26
|
+
rspec-expectations (~> 3.8.0)
|
27
|
+
rspec-mocks (~> 3.8.0)
|
28
|
+
rspec-core (3.8.0)
|
29
|
+
rspec-support (~> 3.8.0)
|
30
|
+
rspec-expectations (3.8.2)
|
32
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
-
rspec-support (~> 3.
|
34
|
-
rspec-mocks (3.
|
32
|
+
rspec-support (~> 3.8.0)
|
33
|
+
rspec-mocks (3.8.0)
|
35
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
-
rspec-support (~> 3.
|
37
|
-
rspec-support (3.
|
38
|
-
rubocop (0.
|
35
|
+
rspec-support (~> 3.8.0)
|
36
|
+
rspec-support (3.8.0)
|
37
|
+
rubocop (0.79.0)
|
38
|
+
jaro_winkler (~> 1.5.1)
|
39
39
|
parallel (~> 1.10)
|
40
|
-
parser (>= 2.
|
41
|
-
powerpack (~> 0.1)
|
40
|
+
parser (>= 2.7.0.1)
|
42
41
|
rainbow (>= 2.2.2, < 4.0)
|
43
42
|
ruby-progressbar (~> 1.7)
|
44
|
-
unicode-display_width (
|
45
|
-
|
46
|
-
|
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)
|
49
|
+
safe_yaml (1.0.5)
|
47
50
|
timecop (0.9.1)
|
48
|
-
unicode-display_width (1.
|
51
|
+
unicode-display_width (1.6.1)
|
49
52
|
webmock (2.3.2)
|
50
53
|
addressable (>= 2.3.6)
|
51
54
|
crack (>= 0.3.2)
|
@@ -56,12 +59,15 @@ PLATFORMS
|
|
56
59
|
|
57
60
|
DEPENDENCIES
|
58
61
|
bundler (~> 1.16)
|
59
|
-
|
62
|
+
jwt (>= 1.0)
|
63
|
+
rake (~> 13.0)
|
60
64
|
rspec (~> 3.0)
|
61
|
-
rubocop (~> 0.
|
65
|
+
rubocop (~> 0.79.0)
|
66
|
+
rubocop-performance (~> 1.6.1)
|
67
|
+
rubocop-rspec (~> 1.41.0)
|
62
68
|
tikkie-api!
|
63
69
|
timecop (~> 0.9)
|
64
70
|
webmock (~> 2.3)
|
65
71
|
|
66
72
|
BUNDLED WITH
|
67
|
-
1.
|
73
|
+
1.17.3
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,44 @@
|
|
1
1
|
# Tikkie API
|
2
2
|
|
3
|
-
|
3
|
+
[](https://badge.fury.io/rb/tikkie-api)
|
4
|
+
[](https://travis-ci.org/KentaaNL/tikkie-api)
|
5
|
+
[](https://codeclimate.com/github/KentaaNL/tikkie-api)
|
6
|
+
|
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
|
+
|
4
35
|
|
5
36
|
## Installation
|
6
37
|
|
7
38
|
Add this line to your application's Gemfile:
|
8
39
|
|
9
40
|
```ruby
|
10
|
-
gem 'tikkie-api'
|
41
|
+
gem 'tikkie-api', '~> 2.0'
|
11
42
|
```
|
12
43
|
|
13
44
|
And then execute:
|
@@ -20,121 +51,240 @@ Or install it yourself as:
|
|
20
51
|
|
21
52
|
## Usage
|
22
53
|
|
23
|
-
|
24
|
-
|
25
|
-
First create a Tikkie configuration and specify your API key and the path to your private RSA key. See also the [developer documentation from ABN AMRO](https://developer.abnamro.com/get-started) to get started.
|
26
|
-
|
27
|
-
Use the configuration to initialize a Tikkie client:
|
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
56
|
```ruby
|
30
57
|
require 'tikkie/api'
|
31
58
|
|
32
|
-
|
33
|
-
client = Tikkie::Api::Client.new(config)
|
59
|
+
client = Tikkie::Api::Client.new(api_key: "12345", app_token: "abcdef")
|
34
60
|
```
|
35
61
|
|
36
|
-
|
37
|
-
|
38
|
-
Retrieve all platforms:
|
62
|
+
The client is created for the production environment by default. If you want to use the sandbox environment, then add `sandbox: true`:
|
39
63
|
|
40
64
|
```ruby
|
41
|
-
|
65
|
+
client = Tikkie::Api::Client.new(api_key: "12345", app_token: "abcdef", sandbox: true)
|
42
66
|
```
|
43
67
|
|
44
|
-
|
68
|
+
### Payment requests
|
69
|
+
|
70
|
+
#### Create a Payment request
|
71
|
+
|
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.
|
45
73
|
|
46
74
|
```ruby
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
notification_url: "https://kentaa.nl/tikkie" # optional
|
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"
|
53
80
|
)
|
54
81
|
|
55
|
-
|
82
|
+
payment_request.payment_request_token # => "qzdnzr8hnVWTgXXcFRLUMc"
|
83
|
+
payment_request.url # => "https://tikkie.me/pay/Tikkie/qzdnzr8hnVWTgXXcFRLUMc"
|
84
|
+
payment_request.amount # => BigDecimal("12.50")
|
56
85
|
```
|
57
86
|
|
58
|
-
|
87
|
+
See [Tikkie::Api::Resources::PaymentRequest](lib/tikkie/api/resources/payment_request.rb) for all available properties.
|
59
88
|
|
60
|
-
|
89
|
+
#### List Payment requests
|
90
|
+
|
91
|
+
Retrieves all payment requests.
|
61
92
|
|
62
93
|
```ruby
|
63
|
-
|
94
|
+
payment_requests = client.payment_requests.list
|
64
95
|
```
|
65
96
|
|
66
|
-
|
97
|
+
The payments requests response is paginated. You can iterate through the pages using `payment_requests.next` and checking the result:
|
67
98
|
|
68
99
|
```ruby
|
69
|
-
|
70
|
-
name: "Kentaa",
|
71
|
-
phone_number: "0601234567",
|
72
|
-
iban: "NL02ABNA0123456789",
|
73
|
-
bank_account_label: "Personal account"
|
74
|
-
)
|
100
|
+
payment_requests = client.payment_requests.list
|
75
101
|
|
76
|
-
|
77
|
-
|
102
|
+
loop do
|
103
|
+
# Do something with payment requests
|
104
|
+
|
105
|
+
payment_requests = payment_requests.next
|
106
|
+
break if payment_requests.nil?
|
107
|
+
end
|
78
108
|
```
|
79
109
|
|
80
|
-
|
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.
|
115
|
+
|
116
|
+
```ruby
|
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
|
123
|
+
```
|
81
124
|
|
82
|
-
|
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.
|
83
133
|
|
84
134
|
```ruby
|
85
|
-
|
135
|
+
payments = client.payments.list("payment_request_token")
|
86
136
|
```
|
87
137
|
|
88
|
-
The payments requests response is paginated. You can
|
138
|
+
The payments requests response is paginated. You can iterate through the pages using `payments.next` and checking the result:
|
89
139
|
|
90
140
|
```ruby
|
91
|
-
|
92
|
-
|
141
|
+
payments = client.payments.list("qzdnzr8hnVWTgXXcFRLUMc")
|
142
|
+
|
143
|
+
loop do
|
144
|
+
# Do something with payments
|
93
145
|
|
94
|
-
|
95
|
-
|
96
|
-
payment_requests << response.to_a
|
146
|
+
payments = payments.next
|
147
|
+
break if payments.nil?
|
97
148
|
end
|
98
149
|
```
|
99
150
|
|
100
|
-
|
151
|
+
See [Tikkie::Api::Resources::Payments](lib/tikkie/api/resources/payments.rb) for all available properties.
|
152
|
+
|
153
|
+
#### Get Payment
|
154
|
+
|
155
|
+
Retrieves details of specific payment based on the token value.
|
101
156
|
|
102
157
|
```ruby
|
103
|
-
|
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]
|
104
164
|
```
|
105
165
|
|
106
|
-
|
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.
|
107
173
|
|
108
174
|
```ruby
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
external_id: "Invoice 12345" # optional
|
175
|
+
refund = client.refunds.create("payment_request_token", "payment_token",
|
176
|
+
description: "Test", # mandatory
|
177
|
+
amount: "10.00", # mandatory
|
178
|
+
reference_id: "Invoice 12345"
|
114
179
|
)
|
115
180
|
|
116
|
-
|
117
|
-
|
181
|
+
refund.refund_token # => "abcdzr8hnVWTgXXcFRLUMc"
|
182
|
+
refund.amount # => BigDecimal("10.00")
|
183
|
+
refund.paid? # => true
|
184
|
+
```
|
185
|
+
|
186
|
+
See [Tikkie::Api::Resources::Refund](lib/tikkie/api/resources/refund.rb) for all available properties.
|
187
|
+
|
188
|
+
#### Get Refund
|
189
|
+
|
190
|
+
Retrieves details of a specific refund based on the token value.
|
191
|
+
|
192
|
+
```ruby
|
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
|
118
198
|
```
|
119
199
|
|
120
|
-
|
200
|
+
See [Tikkie::Api::Resources::Refund](lib/tikkie/api/resources/refund.rb) for all available properties.
|
121
201
|
|
122
|
-
|
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.
|
209
|
+
|
210
|
+
```ruby
|
211
|
+
subscription = client.payment_requests_subscription.create(url: "https://www.example.com/notification")
|
212
|
+
|
213
|
+
subscription.subscription_id # => "e0111835-e8df-4070-874a-f12cf3f77e39"
|
214
|
+
```
|
215
|
+
|
216
|
+
See [Tikkie::Api::Resources::PaymentRequestsSubscription](lib/tikkie/api/resources/payment_requests_subscription.rb) for all available properties.
|
217
|
+
|
218
|
+
#### Delete subscription
|
219
|
+
|
220
|
+
Deletes the current subscription.
|
221
|
+
|
222
|
+
```ruby
|
223
|
+
client.payment_requests_subscription.delete
|
224
|
+
```
|
225
|
+
|
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`:
|
231
|
+
|
232
|
+
```ruby
|
233
|
+
client = Tikkie::Api::Client.new(api_key: "12345", sandbox: true)
|
234
|
+
```
|
235
|
+
|
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.
|
123
239
|
|
124
240
|
```ruby
|
125
|
-
|
241
|
+
sandbox_app = client.sandbox_apps.create
|
242
|
+
|
243
|
+
sandbox_app.app_token # => "935059a6-58b3-4f8d-a021-7bdda0d8d6ad"
|
244
|
+
```
|
126
245
|
|
127
|
-
|
128
|
-
# Success handling...
|
246
|
+
See [Tikkie::Api::Resources::SandboxApp](lib/tikkie/api/resources/sandbox_app.rb) for all available properties.
|
129
247
|
|
130
|
-
|
131
|
-
else
|
132
|
-
# Error handling...
|
248
|
+
## Error handling
|
133
249
|
|
134
|
-
|
250
|
+
All responses that are not HTTP status 20x will result in a [Tikkie::Api::RequestError](lib/tikkie/api/exception.rb).
|
251
|
+
|
252
|
+
```ruby
|
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."
|
135
260
|
end
|
136
261
|
```
|
137
262
|
|
263
|
+
## Notifications
|
264
|
+
|
265
|
+
When subscribed to notifications, you can use `Tikkie::Notification.parse` to parse the payload of a callback.
|
266
|
+
|
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"
|
277
|
+
```
|
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
|
+
|
138
288
|
## Development
|
139
289
|
|
140
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.
|