tipalti-ruby 0.2.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 +61 -1
- data/lib/tipalti-ruby/actions/payment.rb +11 -0
- data/lib/tipalti-ruby/actions/payment_batch.rb +15 -0
- data/lib/tipalti-ruby/client.rb +2 -0
- 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 +3 -0
- metadata +6 -4
- data/tipalti-ruby-0.1.0.gem +0 -0
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
|
|
@@ -65,6 +67,37 @@ Example: `client.payee_get('123abc')`
|
|
65
67
|
|
66
68
|
Example: `client.payee_list(filter: 'status=="ACTIVE"')`
|
67
69
|
|
70
|
+
#### Payment batches create
|
71
|
+
|
72
|
+
[API docs](https://documentation.tipalti.com/reference/post_api-v1-payment-batches)
|
73
|
+
|
74
|
+
Example:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
client.payment_batch_create({
|
78
|
+
paymentInstructions: [
|
79
|
+
{
|
80
|
+
payeeId: '123456',
|
81
|
+
amountSubmitted: { amount: 5, currency: 'USD' },
|
82
|
+
refCode: '123ref'
|
83
|
+
}
|
84
|
+
]
|
85
|
+
})
|
86
|
+
```
|
87
|
+
|
88
|
+
#### Payment batches instructions get
|
89
|
+
|
90
|
+
[API docs](https://documentation.tipalti.com/reference/get_api-v1-payment-batches-id-instructions)
|
91
|
+
|
92
|
+
Example: `client.payment_batch_instructions_get('3456789')`
|
93
|
+
|
94
|
+
#### Payments get
|
95
|
+
|
96
|
+
[API docs](https://documentation.tipalti.com/reference/get_api-v1-payments-id)
|
97
|
+
|
98
|
+
|
99
|
+
Example: `client.payment_get('123abc')`
|
100
|
+
|
68
101
|
### Token Management
|
69
102
|
|
70
103
|
#### Refresh
|
@@ -93,6 +126,33 @@ Any error code returned by the Tipalti API will result in one of the following e
|
|
93
126
|
|503| Tipalti::ServiceUnavailable|
|
94
127
|
|500| Tipalti::ServerError|
|
95
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
|
+
|
96
156
|
## License
|
97
157
|
|
98
158
|
Copyright (C) 2023 Jordan Ell. See [LICENSE](https://github.com/riipen/tipalti-ruby/blob/master/LICENSE.md) for details.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tipalti
|
4
|
+
module Actions
|
5
|
+
module PaymentBatch
|
6
|
+
def payment_batch_create(**params)
|
7
|
+
connection.post("/api/v1/payment-batches", **params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def payment_batch_instructions_get(id)
|
11
|
+
connection.get("/api/v1/payment-batches/#{id}/instructions")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/tipalti-ruby/client.rb
CHANGED
@@ -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
@@ -3,8 +3,11 @@
|
|
3
3
|
$LOAD_PATH.unshift File.dirname(__FILE__)
|
4
4
|
|
5
5
|
require "tipalti-ruby/actions/payee"
|
6
|
+
require "tipalti-ruby/actions/payment"
|
7
|
+
require "tipalti-ruby/actions/payment_batch"
|
6
8
|
require "tipalti-ruby/actions/token"
|
7
9
|
require "tipalti-ruby/client"
|
8
10
|
require "tipalti-ruby/connection"
|
9
11
|
require "tipalti-ruby/error"
|
12
|
+
require "tipalti-ruby/ipn"
|
10
13
|
require "tipalti-ruby/version"
|
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: []
|
@@ -62,12 +62,14 @@ files:
|
|
62
62
|
- Rakefile
|
63
63
|
- lib/tipalti-ruby.rb
|
64
64
|
- lib/tipalti-ruby/actions/payee.rb
|
65
|
+
- lib/tipalti-ruby/actions/payment.rb
|
66
|
+
- lib/tipalti-ruby/actions/payment_batch.rb
|
65
67
|
- lib/tipalti-ruby/actions/token.rb
|
66
68
|
- lib/tipalti-ruby/client.rb
|
67
69
|
- lib/tipalti-ruby/connection.rb
|
68
70
|
- lib/tipalti-ruby/error.rb
|
71
|
+
- lib/tipalti-ruby/ipn.rb
|
69
72
|
- lib/tipalti-ruby/version.rb
|
70
|
-
- tipalti-ruby-0.1.0.gem
|
71
73
|
homepage: https://github.com/riipen/tipalti-ruby
|
72
74
|
licenses:
|
73
75
|
- MIT
|
data/tipalti-ruby-0.1.0.gem
DELETED
Binary file
|