tipalti-ruby 0.3.0 → 0.4.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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +31 -1
- data/lib/tipalti-ruby/connection.rb +2 -2
- data/lib/tipalti-ruby/error.rb +2 -0
- data/lib/tipalti-ruby/ipn.rb +27 -0
- data/lib/tipalti-ruby/version.rb +1 -1
- data/lib/tipalti-ruby.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c31c8896d94b7f278e2b9dbd549e41a491d99a2321ea35d6589672325575e59
|
4
|
+
data.tar.gz: df548617c330afde839ea4029a3df016a2547646d2dd9441b8be8e8ba395f16b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f593b4f11033f7340b46c441a673ff8e4df3b05ed7331f46ac8dbaa771aa2a0737bbf37eb2a67102960159dd57d1d63f6623320fe3dc410a4636df57dde75d7
|
7
|
+
data.tar.gz: c8589eb5007b3ec5e0f60342ea65902d8de7b40367f9a509ed3dae6b12bfdf197f485f65759d72da3ce6badff6186fd2564e56981ee9f2e01ac68f8756320a9e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -18,6 +18,8 @@ Then `bundle install`.
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
+
### API Client
|
22
|
+
|
21
23
|
The Tipalti API uses OAuth to authenticate API requests.
|
22
24
|
|
23
25
|
First you need ot get an access code externally by following the [Tipalti authorization flow](https://documentation.tipalti.com/docs/authorization-flow).
|
@@ -43,7 +45,7 @@ client = Tipalti::Client.new(
|
|
43
45
|
)
|
44
46
|
```
|
45
47
|
|
46
|
-
### Endpoints
|
48
|
+
### API Endpoints
|
47
49
|
|
48
50
|
For use of each endpoint and available attributes or filtering criteria, please consult the [Tipalti API reference](https://documentation.tipalti.com/reference/introduction).
|
49
51
|
|
@@ -93,6 +95,7 @@ Example: `client.payment_batch_instructions_get('3456789')`
|
|
93
95
|
|
94
96
|
[API docs](https://documentation.tipalti.com/reference/get_api-v1-payments-id)
|
95
97
|
|
98
|
+
|
96
99
|
Example: `client.payment_get('123abc')`
|
97
100
|
|
98
101
|
### Token Management
|
@@ -123,6 +126,33 @@ Any error code returned by the Tipalti API will result in one of the following e
|
|
123
126
|
|503| Tipalti::ServiceUnavailable|
|
124
127
|
|500| Tipalti::ServerError|
|
125
128
|
|
129
|
+
### IPNs
|
130
|
+
|
131
|
+
Tiplati uses an IPN (instance payment notification) messaging service that enables you to receive notifications from Tipalti. Notifications are triggered when defined events occur (e.g., changes in payee details, system events and payment statuses).
|
132
|
+
|
133
|
+
To manage IPNs you will need to instantiate a IPN instance like so.
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
ipn = Tipalti::Ipn.new(
|
137
|
+
payload: '...', # The raw payload received to your server from the Tipalti IPN
|
138
|
+
)
|
139
|
+
```
|
140
|
+
|
141
|
+
You can use the Tipalti sandbox by setting `ipn.sanbox = true` or as part of the initialization
|
142
|
+
|
143
|
+
```ruby
|
144
|
+
ipn = Tipalti::Ipn.new(
|
145
|
+
...
|
146
|
+
sandbox: true
|
147
|
+
)
|
148
|
+
```
|
149
|
+
|
150
|
+
#### Verify
|
151
|
+
|
152
|
+
[API docs](https://support.tipalti.com/Content/Topics/Development/IPNs/ipnprotocol.htm#AcknowledgeAndVerifyIPN)
|
153
|
+
|
154
|
+
Example: `ipn.verify`
|
155
|
+
|
126
156
|
## License
|
127
157
|
|
128
158
|
Copyright (C) 2023 Jordan Ell. See [LICENSE](https://github.com/riipen/tipalti-ruby/blob/master/LICENSE.md) for details.
|
@@ -31,8 +31,6 @@ module Tipalti
|
|
31
31
|
request(:put, path, params)
|
32
32
|
end
|
33
33
|
|
34
|
-
private
|
35
|
-
|
36
34
|
def request(method, path, params)
|
37
35
|
response = connection.public_send(method, path, params) do |request|
|
38
36
|
request.headers["accept"] = "application/json"
|
@@ -46,6 +44,8 @@ module Tipalti
|
|
46
44
|
response.body
|
47
45
|
end
|
48
46
|
|
47
|
+
private
|
48
|
+
|
49
49
|
def connection
|
50
50
|
@connection ||= Faraday.new(url: @url) do |c|
|
51
51
|
c.request :json, content_type: /\bjson$/
|
data/lib/tipalti-ruby/error.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tipalti
|
4
|
+
class Ipn
|
5
|
+
BASE_URL_P = "https://console.tipalti.com"
|
6
|
+
BASE_URL_S = "https://console.sandbox.tipalti.com"
|
7
|
+
|
8
|
+
attr_accessor :sandbox
|
9
|
+
|
10
|
+
def initialize(payload:, sandbox: false)
|
11
|
+
@payload = payload
|
12
|
+
@sandbox = sandbox
|
13
|
+
end
|
14
|
+
|
15
|
+
def base_url
|
16
|
+
@sandbox ? BASE_URL_S : BASE_URL_P
|
17
|
+
end
|
18
|
+
|
19
|
+
def connection
|
20
|
+
Connection.new(url: base_url)
|
21
|
+
end
|
22
|
+
|
23
|
+
def verify
|
24
|
+
connection.request(:post, "/notif/ipn.aspx", @payload)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/tipalti-ruby/version.rb
CHANGED
data/lib/tipalti-ruby.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tipalti-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Ell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '2.0'
|
47
|
-
description:
|
47
|
+
description: Access the Tipalti REST API via OAuth2.
|
48
48
|
email:
|
49
49
|
- me@jordanell.com
|
50
50
|
executables: []
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/tipalti-ruby/client.rb
|
69
69
|
- lib/tipalti-ruby/connection.rb
|
70
70
|
- lib/tipalti-ruby/error.rb
|
71
|
+
- lib/tipalti-ruby/ipn.rb
|
71
72
|
- lib/tipalti-ruby/version.rb
|
72
73
|
homepage: https://github.com/riipen/tipalti-ruby
|
73
74
|
licenses:
|