stone-ruby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 633888b0d27b8ce4ccaffb787889afd713d47a5b
4
+ data.tar.gz: 5bc15e895db5941481d56ef3c80dcddd5a69e74d
5
+ SHA512:
6
+ metadata.gz: 7ede62e66ad0bc5a22ac12a34bdc35155a92dd3dbfaa6ca56fcc6445c07095ff9ab6f4262b17838bd1115f41e3d019ccda132d2a7adff23c2701145073aa44f9
7
+ data.tar.gz: c972ba5b05ddbc0e6b6a16dacdd2d1b14819427c297c318f26ea250c9e5627fe69a04c155c3cd13f8c1e4e1f2c048200aeeb63ce77bff349ee6659bde778e9e6
Binary file
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Datasource local storage ignored files
5
+ /dataSources/
6
+ /dataSources.local.xml
7
+ # Editor-based HTTP Client requests
8
+ /httpRequests/
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build stone-payments-0.0.1.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install stone-payments-0.0.1.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install stone-payments-0.0.1.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.0.1 and build and push stone-payments-0.0.1.gem to TODO: Set to 'http://mygemserver.com'" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptSettings">
4
+ <option name="languageLevel" value="ES6" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="asdf: 2.3.1" project-jdk-type="RUBY_SDK" />
7
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/stone-payments.iml" filepath="$PROJECT_DIR$/.idea/stone-payments.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="inheritedJdk" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.3, asdf: 2.3.1) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.6, asdf: 2.3.1) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, asdf: 2.3.1) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="dry-configurable (v0.8.3, asdf: 2.3.1) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="dry-core (v0.4.9, asdf: 2.3.1) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="ethon (v0.12.0, asdf: 2.3.1) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="ffi (v1.13.1, asdf: 2.3.1) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, asdf: 2.3.1) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, asdf: 2.3.1) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.9.2, asdf: 2.3.1) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.9.2, asdf: 2.3.1) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.9.1, asdf: 2.3.1) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.9.3, asdf: 2.3.1) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="typhoeus (v1.0.2, asdf: 2.3.1) [gem]" level="application" />
28
+ </component>
29
+ </module>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1 @@
1
+ ruby 2.3.1
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.3.1
7
+ before_install: gem install bundler -v 1.17.3
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in stone-ruby.gemspec
6
+ gemspec
@@ -0,0 +1,48 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ stone-ruby (0.0.1)
5
+ dry-configurable (~> 0.8.3)
6
+ typhoeus (~> 1.0.2)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ concurrent-ruby (1.1.6)
12
+ diff-lcs (1.3)
13
+ dry-configurable (0.8.3)
14
+ concurrent-ruby (~> 1.0)
15
+ dry-core (~> 0.4, >= 0.4.7)
16
+ dry-core (0.4.9)
17
+ concurrent-ruby (~> 1.0)
18
+ ethon (0.12.0)
19
+ ffi (>= 1.3.0)
20
+ ffi (1.13.1)
21
+ rake (10.5.0)
22
+ rspec (3.9.0)
23
+ rspec-core (~> 3.9.0)
24
+ rspec-expectations (~> 3.9.0)
25
+ rspec-mocks (~> 3.9.0)
26
+ rspec-core (3.9.2)
27
+ rspec-support (~> 3.9.3)
28
+ rspec-expectations (3.9.2)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.9.0)
31
+ rspec-mocks (3.9.1)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.9.0)
34
+ rspec-support (3.9.3)
35
+ typhoeus (1.0.2)
36
+ ethon (>= 0.9.0)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ bundler (~> 1.17)
43
+ rake (~> 10.0)
44
+ rspec (~> 3.0)
45
+ stone-ruby!
46
+
47
+ BUNDLED WITH
48
+ 1.17.3
@@ -0,0 +1,35 @@
1
+ # Stone::Payments
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/stone/payments`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'stone-payments'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install stone-payments
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ 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.
30
+
31
+ 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/stone-payments.
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "stone/payments"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
Binary file
@@ -0,0 +1 @@
1
+ require 'stone'
@@ -0,0 +1,30 @@
1
+ require 'dry-configurable'
2
+ require 'typhoeus'
3
+ require 'stone/version'
4
+
5
+ module Stone
6
+ extend Dry::Configurable
7
+
8
+ autoload :Siclos, 'stone/siclos'
9
+ autoload :Conciliation, 'stone/conciliation'
10
+
11
+ setting :siclos do
12
+ setting :api_key, ENV.fetch('STONE_SICLOS_API_KEY', nil)
13
+ setting :api_endpoint, ENV.fetch('STONE_SICLOS_ENDPOINT_URL', 'https://api.siclospag.com.br/connect-split/v1')
14
+ setting :mcc, ENV.fetch('STONE_SICLOS_MCC', nil)
15
+ setting :partner_stone_id, ENV.fetch('STONE_SICLOS_PARTNER_ID', nil)
16
+ setting :use_exception, true
17
+ end
18
+
19
+ setting :conciliation do
20
+ setting :app_key, ENV.fetch('STONE_CONCILIATION_APP_KEY', nil)
21
+ setting :app_secret, ENV.fetch('STONE_CONCILIATION_APP_SECRET', nil)
22
+ setting :auth_endpoint, ENV.fetch('STONE_CONCILIATION_AUTH_ENDPOINT', 'https://conciliation.stone.com.br/v1/merchant/{{stone_code}}/access-authorization')
23
+ setting :file_endpoint, ENV.fetch('STONE_CONCILIATION_FILE_ENDPOINT', 'https://conciliation.stone.com.br/conciliation-file/v2.2/{{referenceDate}}')
24
+ end
25
+
26
+ def self.configure
27
+ yield self.config
28
+ end
29
+
30
+ end
@@ -0,0 +1,6 @@
1
+ module Stone
2
+ module Conciliation
3
+ autoload :Client, 'stone/conciliation/client'
4
+ autoload :Error, 'stone/conciliation/error'
5
+ end
6
+ end
@@ -0,0 +1,59 @@
1
+ module Stone::Siclos
2
+ module Client
3
+
4
+
5
+ class Response
6
+ def initialize(code, data)
7
+ @code = code
8
+ ap data
9
+ @data = JSON.parse(data, symbolize_names: true)
10
+ raise_exception unless @data[:success]
11
+ end
12
+ attr_reader :data
13
+ attr_reader :code
14
+
15
+ def success?
16
+ @data[:success]
17
+ end
18
+
19
+ private
20
+ def raise_exception
21
+ return unless Stone.config.siclos.use_exception
22
+
23
+ raise Stone::Siclos::Error, "#{@data[:error]} - #{@data[:msg]}"
24
+ end
25
+ end
26
+
27
+ class Base
28
+
29
+ def initialize
30
+ @token = Stone.config.siclos.api_key
31
+ end
32
+
33
+ def parse_endpoint(path)
34
+ path = path[1..-1] if path.starts_with?('/')
35
+ endpoint = Stone.config.siclos.api_endpoint
36
+ endpoint = "#{endpoint}/" unless endpoint.end_with?('/')
37
+ URI.join(endpoint, path)
38
+ end
39
+
40
+ def request(method, path, data = nil, params = nil)
41
+ response = Typhoeus::Request.new(
42
+ parse_endpoint(path),
43
+ method: method,
44
+ body: data ? data.to_json : nil,
45
+ params: params,
46
+ headers: {
47
+ :'Content-Type'=> 'application/json',
48
+ :Authorization => "Bearer #{@token}"
49
+ }
50
+ ).run
51
+ Response.new(response.response_code, response.response_body)
52
+ end
53
+ end
54
+
55
+ class << self
56
+
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,7 @@
1
+ module Stone::Conciliation::Client
2
+ class AccessAuthorization
3
+ def self.call(stone_code)
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Stone::Conciliation
2
+ class Error < StandardError
3
+ class TokenError < Error; end
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ module Stone
2
+ module Siclos
3
+ autoload :Client, 'stone/siclos/client'
4
+ autoload :Error, 'stone/siclos/error'
5
+ end
6
+ end
@@ -0,0 +1,123 @@
1
+ module Stone::Siclos
2
+ module Client
3
+
4
+ autoload :Token, 'stone/siclos/client/token'
5
+ autoload :Establishment, 'stone/siclos/client/establishment'
6
+ autoload :Recipient, 'stone/siclos/client/recipient'
7
+ autoload :Pos, 'stone/siclos/client/pos'
8
+ autoload :PreTransaction, 'stone/siclos/client/pre_transaction'
9
+ autoload :Transaction, 'stone/siclos/client/transaction'
10
+ autoload :Finance, 'stone/siclos/client/finance'
11
+ autoload :Danfe, 'stone/siclos/client/danfe'
12
+ autoload :ClaimCheck, 'stone/siclos/client/claim_check'
13
+ autoload :Webhook, 'stone/siclos/client/webhook'
14
+
15
+ class Response
16
+ def initialize(code, data)
17
+ @code = code
18
+ ap data
19
+ @data = JSON.parse(data, symbolize_names: true)
20
+ raise_exception unless @data[:success]
21
+ end
22
+ attr_reader :data
23
+ attr_reader :code
24
+
25
+ def success?
26
+ @data[:success]
27
+ end
28
+
29
+ private
30
+ def raise_exception
31
+ return unless Stone.config.siclos.use_exception
32
+
33
+ raise Stone::Siclos::Error, "#{@data[:error]} - #{@data[:msg]}"
34
+ end
35
+ end
36
+
37
+ class Base
38
+
39
+ def initialize
40
+ @token = Stone.config.siclos.api_key
41
+ end
42
+
43
+ def parse_endpoint(path)
44
+ path = path[1..-1] if path.starts_with?('/')
45
+ endpoint = Stone.config.siclos.api_endpoint
46
+ endpoint = "#{endpoint}/" unless endpoint.end_with?('/')
47
+ URI.join(endpoint, path)
48
+ end
49
+
50
+ def request(method, path, data = nil, params = nil)
51
+ response = Typhoeus::Request.new(
52
+ parse_endpoint(path),
53
+ method: method,
54
+ body: data ? data.to_json : nil,
55
+ params: params,
56
+ headers: {
57
+ :'Content-Type'=> 'application/json',
58
+ :Authorization => "Bearer #{@token}"
59
+ }
60
+ ).run
61
+ Response.new(response.response_code, response.response_body)
62
+ end
63
+ end
64
+
65
+ class << self
66
+ def token
67
+ @token ||= Token.new
68
+ end
69
+
70
+ def establishment
71
+ @establishment ||= Establishment.new
72
+ end
73
+
74
+ def recipient
75
+ @recipient ||= Recipient.new
76
+ end
77
+
78
+ def pos
79
+ @pos ||= Pos.new
80
+ end
81
+
82
+ def pre_transaction
83
+ @pre_transaction ||= PreTransaction.new
84
+ end
85
+
86
+ def transaction
87
+ @transaction ||= Transaction.new
88
+ end
89
+
90
+ def finance
91
+ @finance ||= Finance.new
92
+ end
93
+
94
+ def danfe
95
+ @danfe ||= Danfe.new
96
+ end
97
+
98
+ def claim_check
99
+ @claim_check ||= ClaimCheck.new
100
+ end
101
+
102
+ def webhook
103
+ @webhook ||= Webhook.new
104
+ end
105
+
106
+ def with_token
107
+ cached_token = Stone.config.siclos.api_key
108
+ authentication_token = token.token
109
+
110
+ if authentication_token.success?
111
+ Stone.config.siclos.api_key = authentication_token.data[:token]
112
+ result = yield(self)
113
+ Stone.config.siclos.api_key = cached_token
114
+ result
115
+ else
116
+ raise Stone::Siclos::Error::TokenError, authentication_token.data[:msg]
117
+ end
118
+ ensure
119
+ Stone.config.siclos.api_key = cached_token
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,19 @@
1
+ module Stone::Siclos
2
+ module Client
3
+ class ClaimCheck < Base
4
+
5
+ def create data
6
+ request(:post, "/claim-check/create", data)
7
+ end
8
+
9
+ def consult claim_check_id
10
+ request(:get, "/claim-check/consult", claim_check_id)
11
+ end
12
+
13
+ def delete claim_check_id
14
+ request(:delete, "/claim-check/delete", claim_check_id)
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Stone::Siclos
2
+ module Client
3
+ class Danfe < Base
4
+
5
+ def create data
6
+ request(:post, "/danfe/create", data)
7
+ end
8
+
9
+ def consult danfe_id
10
+ request(:get, "/danfe/consult", danfe_id)
11
+ end
12
+
13
+ def delete danfe_id
14
+ request(:delete, "/danfe/delete", danfe_id)
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,31 @@
1
+ module Stone::Siclos
2
+ module Client
3
+ class Establishment < Base
4
+
5
+ def create data
6
+ request(:post, "/establishment/create", data)
7
+ end
8
+
9
+ def create_existing_stone data
10
+ request(:post, "/establishment/create-existing-stone", data)
11
+ end
12
+
13
+ def deactivate_establishment(id)
14
+ request(:delete, "/establishment/deactivate-establishment/#{id}")
15
+ end
16
+
17
+ def reactivate_establishment(data)
18
+ request(:put, "/establishment/reactivate-establishment/", data)
19
+ end
20
+
21
+ def get_all
22
+ request(:get, '/establishment/get-all')
23
+ end
24
+
25
+ def get_single(id)
26
+ request(:get, "/establishment/get-single/#{id}")
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,11 @@
1
+ module Stone::Siclos
2
+ module Client
3
+ class Finance < Base
4
+
5
+ def extract data
6
+ request :post, '/finance/extract', data
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,27 @@
1
+ module Stone::Siclos
2
+ module Client
3
+ class Pos < Base
4
+
5
+ def control_configuration data
6
+ request(:post, "/pos/control-configuration", data)
7
+ end
8
+
9
+ def get_control_configuration establishment_id
10
+ request(:get, "/pos/control-configuration/#{establishment_id}")
11
+ end
12
+
13
+ def get_available_pos establishment_id
14
+ request(:get, "/pos/get-available-pos/#{establishment_id}")
15
+ end
16
+
17
+ def activate_pos_link data
18
+ request(:post, "/pos/active-pos-link", data)
19
+ end
20
+
21
+ def deactivate_pos_link pos_reference_id
22
+ request(:put, "/pos/deactivate-pos-link", pos_reference_id)
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,23 @@
1
+ module Stone::Siclos
2
+ module Client
3
+ class PreTransaction < Base
4
+
5
+ def create data
6
+ request(:post, "/pre-transaction/create", data)
7
+ end
8
+
9
+ def single pre_transaction_id
10
+ request(:get, "/pre-transaction/single/#{pre_transaction_id}")
11
+ end
12
+
13
+ def date data
14
+ request(:post, "/pre-transaction/date", data)
15
+ end
16
+
17
+ def delete pre_transaction_id
18
+ request(:delete, "/pre-transaction/delete/#{pre_transaction_id}")
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,31 @@
1
+ module Stone::Siclos
2
+ module Client
3
+ class Recipient < Base
4
+
5
+ def create data
6
+ request(:post, "/recipient/create", data)
7
+ end
8
+
9
+ def create_existing_stone data
10
+ request(:post, "/recipient/create-existing-stone", data)
11
+ end
12
+
13
+ def deactivate_recipient(recipient_id)
14
+ request(:delete, "/recipient/deactivate-recipient/#{recipient_id}")
15
+ end
16
+
17
+ def reactivate_recipient(data)
18
+ request(:put, "/recipient/reactivate-recipient/", data)
19
+ end
20
+
21
+ def get_all_establishment_recipients
22
+ request(:get, "/recipient/get-all-establishment-recipients/#{establishment_id}")
23
+ end
24
+
25
+ def get_single(recipient_id)
26
+ request(:get, "/recipient/get-single/#{recipient_id}")
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,9 @@
1
+ module Stone::Siclos
2
+ module Client
3
+ class Token < Base
4
+ def token
5
+ request(:get, '/token')
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,23 @@
1
+ module Stone::Siclos
2
+ module Client
3
+ class Transaction < Base
4
+
5
+ def single_siclos siclos_transaction_id
6
+ request(:get, "/transactions/single/siclos/#{siclos_transaction_id}")
7
+ end
8
+
9
+ def single_stone stone_transaction_id
10
+ request(:get, "/transactions/single/stone/#{stone_transaction_id}")
11
+ end
12
+
13
+ def single_pre_transaction pre_transaction_id
14
+ request(:get, "/transactions/single/pre-transaction/#{pre_transaction_id}")
15
+ end
16
+
17
+ def list_provider data
18
+ request(:post, "/transactions/list/provider", data)
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,35 @@
1
+ module Stone::Siclos
2
+ module Client
3
+ class Webhook < Base
4
+
5
+ def pre_transaction_status data
6
+ request(:post, "/webhook/pre-transaction-status", data)
7
+ end
8
+
9
+ def processed_transaction data
10
+ request(:post, "/webhook/processed-transaction", data)
11
+ end
12
+
13
+ def status_split data
14
+ request(:post, "/webhook/status-split", data)
15
+ end
16
+
17
+ def print_note_status data
18
+ request(:post, "/webhook/print-note-status", data)
19
+ end
20
+
21
+ def enabled_split data
22
+ request(:post, "/webhook/enabled-split", data)
23
+ end
24
+
25
+ def pos_application data
26
+ request(:post, "/webhook/pos-application", data)
27
+ end
28
+
29
+ def webhook
30
+ request(:get, "/webhook")
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,5 @@
1
+ module Stone::Siclos
2
+ class Error < StandardError
3
+ class TokenError < Error; end
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Stone
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,45 @@
1
+
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ require 'stone/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'stone-ruby'
9
+ spec.version = Stone::VERSION
10
+ spec.authors = ['Marcos Junior']
11
+ spec.email = ['marcos.junior@rhsoftware.com.br']
12
+
13
+ spec.summary = 'API Wrapper for Stone Payments'
14
+ spec.description = 'API Wrapper for Stone Payments'
15
+ spec.homepage = "https://github.com/marcosgugs/stone-ruby"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ #
22
+ # spec.metadata['homepage_uri'] = spec.homepage
23
+ # spec.metadata['source_code_uri'] = "TODO: Put your gem's public repo URL here."
24
+ # spec.metadata['changelog_uri'] = "TODO: Put your gem's CHANGELOG.md URL here."
25
+ # else
26
+ # raise 'RubyGems 2.0 or newer is required to protect against ' \
27
+ # 'public gem pushes.'
28
+ # end
29
+
30
+ # Specify which files should be added to the gem when it is released.
31
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
33
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
34
+ end
35
+ spec.bindir = 'exe'
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ['lib']
38
+
39
+ spec.add_dependency 'dry-configurable', '~> 0.8.3'
40
+ spec.add_dependency 'typhoeus', '~> 1.0.2'
41
+
42
+ spec.add_development_dependency 'bundler', '~> 1.17'
43
+ spec.add_development_dependency 'rake', '~> 10.0'
44
+ spec.add_development_dependency 'rspec', '~> 3.0'
45
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stone-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Marcos Junior
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dry-configurable
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.8.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: typhoeus
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.17'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.17'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ description: API Wrapper for Stone Payments
84
+ email:
85
+ - marcos.junior@rhsoftware.com.br
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".DS_Store"
91
+ - ".gitignore"
92
+ - ".idea/.gitignore"
93
+ - ".idea/.rakeTasks"
94
+ - ".idea/misc.xml"
95
+ - ".idea/modules.xml"
96
+ - ".idea/stone-payments.iml"
97
+ - ".idea/vcs.xml"
98
+ - ".rakeTasks"
99
+ - ".rspec"
100
+ - ".tool-versions"
101
+ - ".travis.yml"
102
+ - Gemfile
103
+ - Gemfile.lock
104
+ - README.md
105
+ - Rakefile
106
+ - bin/console
107
+ - bin/setup
108
+ - lib/.DS_Store
109
+ - lib/stone-ruby.rb
110
+ - lib/stone.rb
111
+ - lib/stone/conciliation.rb
112
+ - lib/stone/conciliation/client.rb
113
+ - lib/stone/conciliation/client/access_authorization.rb
114
+ - lib/stone/conciliation/error.rb
115
+ - lib/stone/siclos.rb
116
+ - lib/stone/siclos/client.rb
117
+ - lib/stone/siclos/client/claim_check.rb
118
+ - lib/stone/siclos/client/danfe.rb
119
+ - lib/stone/siclos/client/establishment.rb
120
+ - lib/stone/siclos/client/finance.rb
121
+ - lib/stone/siclos/client/pos.rb
122
+ - lib/stone/siclos/client/pre_transaction.rb
123
+ - lib/stone/siclos/client/recipient.rb
124
+ - lib/stone/siclos/client/token.rb
125
+ - lib/stone/siclos/client/transaction.rb
126
+ - lib/stone/siclos/client/webhook.rb
127
+ - lib/stone/siclos/error.rb
128
+ - lib/stone/version.rb
129
+ - stone-ruby.gemspec
130
+ homepage: https://github.com/marcosgugs/stone-ruby
131
+ licenses: []
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.5.1
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: API Wrapper for Stone Payments
153
+ test_files: []
154
+ has_rdoc: