tipalti 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0c0b548e2ff96d153f37ce3070918e7eb5fdf8a22a79f187917928e980b905c2
4
+ data.tar.gz: 998041fc9874697f067e4827a5e3860696d65abf14b7303ff276ac11b57066b5
5
+ SHA512:
6
+ metadata.gz: e9e7d0aea100778e7163c99c22eeb4f03f8e857752613dcd1c596798b6abeae72ccd5640209441f383eb564aea076026cd6feeb0ae198f936d57a46f8b8858d0
7
+ data.tar.gz: 0c6a9a838ddeafb8c3112ff4c30805242f6d5891943117537db9bdacac8fbee006951c5c0d496a6f2082d5550b256db681a177be9e7d2a202309890ab21c5ad4
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in tipalti.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 MagicLinks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # Tipalti Ruby Gem
2
+
3
+ A Ruby interface for Tipalti Payments.
4
+
5
+ ## Installation
6
+
7
+ $ gem install tipalti
8
+
9
+ ## Configuration
10
+
11
+ Create a configuration file
12
+
13
+ ```ruby
14
+ Tipalti.configure do |config|
15
+ config.master_key = "xxx"
16
+ config.url = "https://ui2.sandbox.tipalti.com"
17
+ config.payer = "MagicLinks"
18
+ end
19
+ ```
20
+
21
+ ## Usage Examples
22
+
23
+ ### Tipalti iFrames ###
24
+
25
+ Tipalti uses iFrames to support end user access to registration, invoices and payments history.
26
+
27
+ To generate a valid iFrame url:
28
+
29
+ ```ruby
30
+ Tipalti::Iframe.url(user_params)
31
+ ```
32
+ __Supported iFrame Parameters__
33
+
34
+ The only required parameter is a Payee ID (`idap`).
35
+
36
+ To specify the page to render, send a `page` parameter with one of:
37
+ * `home` (default)
38
+ * `invoices`
39
+ * `payments`
40
+
41
+ ```ruby
42
+ Tipalti::Iframe.url(idap: "user-22579", page: "payments")
43
+ ```
44
+
45
+ All other iFrame parameters supported by Tipalti can be passed as params. See the official documentation for details:
46
+ https://support.tipalti.com/Content/Topics/Development/iFrames/IframeRequestStructure.htm
47
+
48
+ ## Development
49
+
50
+ 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.
51
+
52
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
53
+
54
+ ## License
55
+
56
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,9 @@
1
+ module Tipalti
2
+ class Configuration
3
+
4
+ attr_accessor :master_key
5
+ attr_accessor :url
6
+ attr_accessor :payer
7
+
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ module Tipalti
2
+ class Iframe
3
+
4
+ PAGES = {
5
+ home: "Home",
6
+ invoices: "Invoices",
7
+ payments: "PaymentsHistory"
8
+ }
9
+
10
+ # https://support.tipalti.com/Content/Topics/Development/iFrames/IframeRequestStructure.htm
11
+ def self.url(params = {})
12
+ page = (params.delete(:page) || "home").to_sym
13
+ param_str = params.merge(payer: params[:payer] || Tipalti.configuration.payer, ts: Time.now.to_i).to_query
14
+ hashkey = OpenSSL::HMAC.hexdigest('sha256', Tipalti.configuration.master_key, param_str)
15
+ "#{Tipalti.configuration.url}/PayeeDashboard/#{PAGES[page]}?#{param_str}&hashkey=#{hashkey}"
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tipalti
4
+ VERSION = "0.1.0"
5
+ end
data/lib/tipalti.rb ADDED
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "tipalti/configuration"
4
+ require_relative "tipalti/iframe"
5
+ require_relative "tipalti/version"
6
+
7
+ module Tipalti
8
+ class << self
9
+ # Instantiate the Configuration singleton
10
+ # or return it. Remember that the instance
11
+ # has attribute readers so that we can access
12
+ # the configured values
13
+ def configuration
14
+ @configuration ||= Configuration.new
15
+ end
16
+
17
+ # This is the configure block definition.
18
+ # The configuration method will return the
19
+ # Configuration singleton, which is then yielded
20
+ # to the configure block. Then it's just a matter
21
+ # of using the attribute accessors we previously defined
22
+ def configure
23
+ yield(configuration)
24
+ end
25
+ end
26
+ end
data/sig/tipalti.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Tipalti
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
data/tipalti.gemspec ADDED
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/tipalti/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "tipalti"
7
+ spec.version = Tipalti::VERSION
8
+ spec.authors = ["Aaron Chi"]
9
+ spec.email = ["aaron.chi@magiclinks.com"]
10
+
11
+ spec.summary = "Tipalti toolkit"
12
+ spec.description = "A Ruby toolkit for Tipalti Payments"
13
+ spec.homepage = "https://github.com/magiclinkstech/tipalti-ruby"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.5.1"
16
+
17
+ #spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18
+ #spec.metadata["homepage_uri"] = spec.homepage
19
+ #spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
20
+ #spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(__dir__) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
27
+ end
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ # Uncomment to register a new dependency of your gem
34
+ # spec.add_dependency "example-gem", "~> 1.0"
35
+
36
+ # For more information and examples about making a new gem, check out our
37
+ # guide at: https://bundler.io/guides/creating_gem.html
38
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tipalti
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Aaron Chi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-12-08 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A Ruby toolkit for Tipalti Payments
14
+ email:
15
+ - aaron.chi@magiclinks.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".rspec"
21
+ - Gemfile
22
+ - LICENSE.txt
23
+ - README.md
24
+ - Rakefile
25
+ - lib/tipalti.rb
26
+ - lib/tipalti/configuration.rb
27
+ - lib/tipalti/iframe.rb
28
+ - lib/tipalti/version.rb
29
+ - sig/tipalti.rbs
30
+ - tipalti.gemspec
31
+ homepage: https://github.com/magiclinkstech/tipalti-ruby
32
+ licenses:
33
+ - MIT
34
+ metadata: {}
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 2.5.1
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubygems_version: 3.3.26
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: Tipalti toolkit
54
+ test_files: []