tipalti-ruby 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03acb5dc31ac3a0e27fa741be01e2907a530f7aae8eb1bd595b2102fa252157a
4
- data.tar.gz: 9c8f59917796065a0f429d512c57a3f58075ce162d95be2088584ed087c1599c
3
+ metadata.gz: 6c31c8896d94b7f278e2b9dbd549e41a491d99a2321ea35d6589672325575e59
4
+ data.tar.gz: df548617c330afde839ea4029a3df016a2547646d2dd9441b8be8e8ba395f16b
5
5
  SHA512:
6
- metadata.gz: ceb685c7bd0d0d340be0615905b96778144bf9877c5be553da23eb3a65f56e6449ab1448d6327b574e9f858b1ba84b772311e2ca35e456fbb84b90678b9fef44
7
- data.tar.gz: e39a013089b6ba6ee17d192f2a72fda89c49ab979d6efd7058a092c2df386bf6fcb03c883b84d71f1fdefccbd2a8afdd82c921735ed743a44eb82d944cb53297
6
+ metadata.gz: 0f593b4f11033f7340b46c441a673ff8e4df3b05ed7331f46ac8dbaa771aa2a0737bbf37eb2a67102960159dd57d1d63f6623320fe3dc410a4636df57dde75d7
7
+ data.tar.gz: c8589eb5007b3ec5e0f60342ea65902d8de7b40367f9a509ed3dae6b12bfdf197f485f65759d72da3ce6badff6186fd2564e56981ee9f2e01ac68f8756320a9e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## v0.4.0
2
+
3
+ - Added IPN verification
4
+
5
+ ## v0.3.0
6
+
7
+ - Added payment get endpoint
8
+ - Added payment batch create endpoint
9
+ - Added payment batch instructions get endpoint
10
+
1
11
  ## v0.2.0
2
12
 
3
13
  - Added payees get endpoint
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$/
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Tipalti
4
4
  class Error < StandardError
5
+ attr_reader :response
6
+
5
7
  def self.from_response(response) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength:
6
8
  klass =
7
9
  case response.status
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tipalti
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/tipalti-ruby.rb CHANGED
@@ -9,4 +9,5 @@ require "tipalti-ruby/actions/token"
9
9
  require "tipalti-ruby/client"
10
10
  require "tipalti-ruby/connection"
11
11
  require "tipalti-ruby/error"
12
+ require "tipalti-ruby/ipn"
12
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.3.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-10 00:00:00.000000000 Z
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: An API client for Tipalti in ruby.
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: