solidus_inter 0.0.1

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: 7c20812d9870dfa0ae087e0cec27ed902b67762ac634a5c43c1dd3ebf68245fd
4
+ data.tar.gz: 9fd3d083b2e038f7f824bc3172af422bfbb4941d6ef4b14b311b8140150839b0
5
+ SHA512:
6
+ metadata.gz: e3265f529f8c1be4e788994d4cf6ae127691aba0991fcffc77184e6e043d83f5fed0c38407f7643591b5b3f2b8a10dc2e7d809deca5cffabee9576fdbb1b2e8f
7
+ data.tar.gz: 9bd964dcd2df8d35cb7b226932c17c9479b6005209d04cd502b1f8b02214031bd7695954f3eb2e7ed64203f23c4fe95f2cad9c42292d92341f90671d802a53d9
@@ -0,0 +1,53 @@
1
+ version: 2.1
2
+
3
+ orbs:
4
+ # Required for feature specs.
5
+ browser-tools: circleci/browser-tools@1.1
6
+
7
+ # Always take the latest version of the orb, this allows us to
8
+ # run specs against Solidus supported versions only without the need
9
+ # to change this configuration every time a Solidus version is released
10
+ # or goes EOL.
11
+ solidusio_extensions: solidusio/extensions@volatile
12
+
13
+ jobs:
14
+ run-specs-with-sqlite:
15
+ executor: solidusio_extensions/sqlite
16
+ steps:
17
+ - browser-tools/install-chrome
18
+ - solidusio_extensions/run-tests
19
+ run-specs-with-postgres:
20
+ executor: solidusio_extensions/postgres
21
+ steps:
22
+ - browser-tools/install-chrome
23
+ - solidusio_extensions/run-tests
24
+ run-specs-with-mysql:
25
+ executor: solidusio_extensions/mysql
26
+ steps:
27
+ - browser-tools/install-chrome
28
+ - solidusio_extensions/run-tests
29
+ lint-code:
30
+ executor: solidusio_extensions/sqlite-memory
31
+ steps:
32
+ - solidusio_extensions/lint-code
33
+
34
+ workflows:
35
+ "Run specs on supported Solidus versions":
36
+ jobs:
37
+ - run-specs-with-sqlite
38
+ - run-specs-with-postgres
39
+ - run-specs-with-mysql
40
+ - lint-code
41
+
42
+ "Weekly run specs against main":
43
+ triggers:
44
+ - schedule:
45
+ cron: "0 0 * * 4" # every Thursday
46
+ filters:
47
+ branches:
48
+ only:
49
+ - main
50
+ jobs:
51
+ - run-specs-with-sqlite
52
+ - run-specs-with-postgres
53
+ - run-specs-with-mysql
data/.gem_release.yml ADDED
@@ -0,0 +1,5 @@
1
+ bump:
2
+ recurse: false
3
+ file: 'lib/solidus_inter/version.rb'
4
+ message: Bump SolidusInter to %{version}
5
+ tag: true
data/.github/stale.yml ADDED
@@ -0,0 +1 @@
1
+ _extends: .github
@@ -0,0 +1,2 @@
1
+ issues=false
2
+ exclude-labels=infrastructure
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ \#*
3
+ *~
4
+ .#*
5
+ .DS_Store
6
+ .idea
7
+ .project
8
+ .sass-cache
9
+ coverage
10
+ Gemfile.lock
11
+ Gemfile-local
12
+ tmp
13
+ nbproject
14
+ pkg
15
+ *.swp
16
+ spec/dummy
17
+ spec/examples.txt
18
+ /sandbox
19
+ .rvmrc
20
+ .ruby-version
21
+ .ruby-gemset
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ require:
2
+ - solidus_dev_support/rubocop
3
+
4
+ AllCops:
5
+ NewCops: disable
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # Changelog
2
+
3
+ See https://github.com/solidusio-contrib/solidus_inter/releases or OLD_CHANGELOG.md for older versions.
data/Gemfile ADDED
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
+
6
+ branch = ENV.fetch("SOLIDUS_BRANCH", "main")
7
+ gem "solidus", github: "solidusio/solidus", branch: branch
8
+
9
+ # The solidus_frontend gem has been pulled out since v3.2
10
+ if branch >= "v3.2"
11
+ gem "solidus_frontend"
12
+ elsif branch == "main"
13
+ gem "solidus_frontend", github: "solidusio/solidus_frontend"
14
+ else
15
+ gem "solidus_frontend", github: "solidusio/solidus", branch: branch
16
+ end
17
+
18
+ # Needed to help Bundler figure out how to resolve dependencies,
19
+ # otherwise it takes forever to resolve them.
20
+ # See https://github.com/bundler/bundler/issues/6677
21
+ gem "rails", ">0.a"
22
+
23
+ # Provides basic authentication functionality for testing parts of your engine
24
+ gem "solidus_auth_devise"
25
+
26
+ case ENV.fetch("DB", nil)
27
+ when "mysql"
28
+ gem "mysql2"
29
+ when "postgresql"
30
+ gem "pg"
31
+ else
32
+ gem "sqlite3"
33
+ end
34
+
35
+ # While we still support Ruby < 3 we need to workaround a limitation in
36
+ # the 'async' gem that relies on the latest ruby, since RubyGems doesn't
37
+ # resolve gems based on the required ruby version.
38
+ gem "async", "< 3" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3")
39
+
40
+ gemspec
41
+
42
+ # Use a local Gemfile to include development dependencies that might not be
43
+ # relevant for the project or for other contributors, e.g. pry-byebug.
44
+ #
45
+ # We use `send` instead of calling `eval_gemfile` to work around an issue with
46
+ # how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
47
+ send(:eval_gemfile, "Gemfile-local") if File.exist? "Gemfile-local"
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2024 ulysses
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Solidus nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # Solidus Inter
2
+
3
+ [![CircleCI](https://circleci.com/gh/solidusio-contrib/solidus_inter.svg?style=shield)](https://circleci.com/gh/solidusio-contrib/solidus_inter)
4
+ [![codecov](https://codecov.io/gh/solidusio-contrib/solidus_inter/branch/main/graph/badge.svg)](https://codecov.io/gh/solidusio-contrib/solidus_inter)
5
+
6
+ <!-- Explain what your extension does. -->
7
+
8
+ ## Installation
9
+
10
+ Add solidus_inter to your Gemfile:
11
+
12
+ ```ruby
13
+ gem 'solidus_inter'
14
+ ```
15
+
16
+ Bundle your dependencies and run the installation generator:
17
+
18
+ ```shell
19
+ bin/rails generate solidus_inter:install
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ <!-- Explain how to use your extension once it's been installed. -->
25
+
26
+ ## Development
27
+
28
+ ### Testing the extension
29
+
30
+ First bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy
31
+ app if it does not exist, then it will run specs. The dummy app can be regenerated by using
32
+ `bin/rake extension:test_app`.
33
+
34
+ ```shell
35
+ bin/rake
36
+ ```
37
+
38
+ To run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run
39
+
40
+ ```shell
41
+ bundle exec rubocop
42
+ ```
43
+
44
+ When testing your application's integration with this extension you may use its factories.
45
+ You can load Solidus core factories along with this extension's factories using this statement:
46
+
47
+ ```ruby
48
+ SolidusDevSupport::TestingSupport::Factories.load_for(SolidusInter::Engine)
49
+ ```
50
+
51
+ ### Running the sandbox
52
+
53
+ To run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for
54
+ the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to
55
+ `sandbox/bin/rails`.
56
+
57
+ Here's an example:
58
+
59
+ ```
60
+ $ bin/rails server
61
+ => Booting Puma
62
+ => Rails 6.0.2.1 application starting in development
63
+ * Listening on tcp://127.0.0.1:3000
64
+ Use Ctrl-C to stop
65
+ ```
66
+
67
+ ### Releasing new versions
68
+
69
+ Please refer to the [dedicated page](https://github.com/solidusio/solidus/wiki/How-to-release-extensions) in the Solidus wiki.
70
+
71
+ ## License
72
+
73
+ Copyright (c) 2024 ulysses, released under the New BSD License.
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "solidus_dev_support/rake_tasks"
5
+ SolidusDevSupport::RakeTasks.install
6
+
7
+ task default: "extension:specs"
@@ -0,0 +1,110 @@
1
+ module SolidusInter
2
+ class InterPix < Spree::PaymentMethod
3
+ preference :client_id, :string
4
+ preference :client_secret, :string
5
+ preference :chave_pix, :string
6
+ preference :conta_corrente, :string
7
+ preference :crt, :text
8
+ preference :key, :text
9
+
10
+ def payment_source_class
11
+ PixPaymentSource
12
+ end
13
+
14
+ def gateway_class
15
+ InterPix
16
+ end
17
+
18
+ def supports?(source)
19
+ source.is_a?(payment_source_class)
20
+ end
21
+
22
+ def auto_capture?
23
+ true
24
+ end
25
+
26
+ def partial_name
27
+ "inter_pix"
28
+ end
29
+
30
+ def create_payment(payment)
31
+ client = set_api_client
32
+ inter_payment = client.create_payment(
33
+ amount: payment.amount,
34
+ payer_tax_id: payment.source.payer_tax_id,
35
+ payer_name: payment.source.payer_name,
36
+ expiration: 3000
37
+ )
38
+ payment.response_code = inter_payment.txid
39
+ payment.source.assign_attributes(
40
+ txid: inter_payment.txid,
41
+ pix_code: inter_payment.copia_e_cola,
42
+ qr_code_svg: inter_payment.qr_code,
43
+ status: inter_payment.status,
44
+ expiration: inter_payment.expiracao,
45
+ internal_error: inter_payment.internal_error
46
+ )
47
+ payment.log_entries.new(parsed_payment_response_details_with_fallback: failure_response(inter_payment.internal_error)) if inter_payment.internal_error
48
+ inter_payment
49
+ end
50
+
51
+ def find_payment(txid)
52
+ client = set_api_client
53
+ client.get_payment(txid)
54
+ end
55
+
56
+ def invalidate_payment(payment)
57
+ return unless payment && payment.source.txid
58
+ inter_payment = find_payment(payment.source.txid)
59
+ inter_payment.invalidate!
60
+ payment.log_entries.create!(parsed_payment_response_details_with_fallback: failure_response("Pagamento cancelado"))
61
+ end
62
+
63
+ def purchase(money, source, options = {})
64
+ client = set_api_client
65
+ inter_payment = client.get_payment(source.txid)
66
+ if inter_payment.paid?
67
+ source.update(status: "approved")
68
+ successful_response("Pagamento realizado", inter_payment.txid)
69
+ else
70
+ failure_response(inter_payment.internal_error || "Ocorreu um erro no pagamento.")
71
+ end
72
+ end
73
+
74
+ private
75
+
76
+ def set_api_client
77
+ ::InterApi::Client.new(
78
+ client_id: preferences[:client_id],
79
+ client_secret: preferences[:client_secret],
80
+ chave_pix: preferences[:chave_pix],
81
+ conta_corrente: preferences[:conta_corrente],
82
+ crt: temp_file(preferences[:crt]).path,
83
+ key: temp_file(preferences[:key]).path
84
+ )
85
+ end
86
+
87
+ def temp_file content
88
+ t = Tempfile.new
89
+ t << content
90
+ t.close
91
+ t
92
+ end
93
+
94
+ def successful_response message, transaction_id
95
+ ActiveMerchant::Billing::Response.new(
96
+ true,
97
+ message,
98
+ {},
99
+ authorization: transaction_id
100
+ )
101
+ end
102
+
103
+ def failure_response message
104
+ ActiveMerchant::Billing::Response.new(
105
+ false,
106
+ message
107
+ )
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,27 @@
1
+ module SolidusInter
2
+ class PixPaymentSource < Spree::PaymentSource
3
+ def actions
4
+ %w[]
5
+ end
6
+
7
+ def can_capture?(payment)
8
+ payment.pending? || payment.checkout?
9
+ end
10
+
11
+ def can_void?(payment)
12
+ payment.can_void?
13
+ end
14
+
15
+ def can_credit?(payment)
16
+ payment.completed? && payment.credit_allowed > 0
17
+ end
18
+
19
+ def usable?
20
+ txid.present? && expiration.future?
21
+ end
22
+
23
+ def expired?
24
+ expiration.past?
25
+ end
26
+ end
27
+ end
@@ -0,0 +1 @@
1
+ ID do pagamento: <%= payment.source.txid %>
data/bin/console ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require "bundler/setup"
6
+ require "solidus_inter"
7
+
8
+ # You can add fixtures and/or initialization code here to make experimenting
9
+ # with your gem easier. You can also use a different console, if you like.
10
+ $LOAD_PATH.unshift(*Dir["#{__dir__}/../app/*"])
11
+
12
+ # (If you use this, don't forget to add pry to your Gemfile!)
13
+ # require "pry"
14
+ # Pry.start
15
+
16
+ require "irb"
17
+ IRB.start(__FILE__)
data/bin/rails ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if %w[g generate].include? ARGV.first
4
+ exec "#{__dir__}/rails-engine", *ARGV
5
+ else
6
+ exec "#{__dir__}/rails-sandbox", *ARGV
7
+ end
data/bin/rails-engine ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path('..', __dir__)
6
+ ENGINE_PATH = File.expand_path('../lib/solidus_inter/engine', __dir__)
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
10
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
11
+
12
+ require 'rails/all'
13
+ require 'rails/engine/commands'
data/bin/rails-sandbox ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ app_root = 'sandbox'
4
+
5
+ unless File.exist? "#{app_root}/bin/rails"
6
+ warn 'Creating the sandbox app...'
7
+ Dir.chdir "#{__dir__}/.." do
8
+ system "#{__dir__}/sandbox" or begin
9
+ warn 'Automatic creation of the sandbox app failed'
10
+ exit 1
11
+ end
12
+ end
13
+ end
14
+
15
+ Dir.chdir app_root
16
+ exec 'bin/rails', *ARGV
data/bin/rake ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "rubygems"
5
+ require "bundler/setup"
6
+
7
+ load Gem.bin_path("rake", "rake")
data/bin/sandbox ADDED
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+ test -z "${DEBUG+empty_string}" || set -x
5
+
6
+ test "$DB" = "sqlite" && export DB="sqlite3"
7
+
8
+ if [ -z "$PAYMENT_METHOD" ]
9
+ then
10
+ PAYMENT_METHOD="none"
11
+ fi
12
+
13
+ if [ -z "$SOLIDUS_BRANCH" ]
14
+ then
15
+ echo "~~> Use 'export SOLIDUS_BRANCH=[main|v4.0|...]' to control the Solidus branch"
16
+ SOLIDUS_BRANCH="main"
17
+ fi
18
+ echo "~~> Using branch $SOLIDUS_BRANCH of solidus"
19
+
20
+ extension_name="solidus_inter"
21
+
22
+ # Stay away from the bundler env of the containing extension.
23
+ function unbundled {
24
+ ruby -rbundler -e'
25
+ Bundler.with_unbundled_env {system *ARGV}' -- \
26
+ env BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES=true $@
27
+ }
28
+
29
+ echo "~~~> Removing the old sandbox"
30
+ rm -rf ./sandbox
31
+
32
+ echo "~~~> Creating a pristine Rails app"
33
+ rails new sandbox \
34
+ --database="${DB:-sqlite3}" \
35
+ --skip-git \
36
+ --skip-keeps \
37
+ --skip-rc \
38
+ --skip-bootsnap \
39
+ --skip-test
40
+
41
+ if [ ! -d "sandbox" ]; then
42
+ echo 'sandbox rails application failed'
43
+ exit 1
44
+ fi
45
+
46
+ echo "~~~> Adding solidus (with i18n) to the Gemfile"
47
+ cd ./sandbox
48
+ cat <<RUBY >> Gemfile
49
+ gem 'solidus', github: 'solidusio/solidus', branch: '$SOLIDUS_BRANCH'
50
+ gem 'rails-i18n'
51
+ gem 'solidus_i18n'
52
+ gem 'solidus_auth_devise'
53
+
54
+ gem '$extension_name', path: '..'
55
+
56
+ group :test, :development do
57
+ platforms :mri do
58
+ gem 'pry-byebug'
59
+ end
60
+ end
61
+ RUBY
62
+
63
+ unbundled bundle install --gemfile Gemfile
64
+
65
+ unbundled bundle exec rake db:drop db:create
66
+
67
+ unbundled bundle exec rails generate solidus:install \
68
+ --auto-accept \
69
+ $@
70
+
71
+ unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations
72
+ unbundled bundle exec rails generate ${extension_name}:install --auto-run-migrations
73
+
74
+ echo
75
+ echo "🚀 Sandbox app successfully created for $extension_name!"
76
+ echo "🧪 This app is intended for test purposes."
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ gem install bundler --conservative
7
+ bundle update
8
+ bin/rake clobber
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: Hello world
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Spree::Core::Engine.routes.draw do
4
+ # Add your extension routes here
5
+ end
@@ -0,0 +1,19 @@
1
+ class CreateSolidusInterPixPaymentSources < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :solidus_inter_pix_payment_sources do |t|
4
+ t.string :txid
5
+ t.string :pix_code
6
+ t.string :qr_code_svg
7
+ t.string :status
8
+ t.decimal :amount
9
+ t.decimal :paid_amount
10
+ t.datetime :expiration
11
+ t.string :payer_name
12
+ t.string :payer_tax_id
13
+ t.string :internal_error
14
+ t.integer :payment_method_id
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusInter
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ class_option :auto_run_migrations, type: :boolean, default: false
7
+ source_root File.expand_path("templates", __dir__)
8
+
9
+ def self.exit_on_failure?
10
+ true
11
+ end
12
+
13
+ def copy_initializer
14
+ template "initializer.rb", "config/initializers/solidus_inter.rb"
15
+ end
16
+
17
+ def add_migrations
18
+ run "bin/rails railties:install:migrations FROM=solidus_inter"
19
+ end
20
+
21
+ def run_migrations
22
+ run_migrations = options[:auto_run_migrations] || ["", "y", "Y"].include?(ask("Would you like to run the migrations now? [Y/n]")) # rubocop:disable Layout/LineLength
23
+ if run_migrations
24
+ run "bin/rails db:migrate"
25
+ else
26
+ puts "Skipping bin/rails db:migrate, don't forget to run it!" # rubocop:disable Rails/Output
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ SolidusInter.configure do |config|
4
+ # TODO: Remember to change this with the actual preferences you have implemented!
5
+ # config.sample_preference = 'sample_value'
6
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusInter
4
+ class Configuration
5
+ # Define here the settings for this extension, e.g.:
6
+ #
7
+ # attr_accessor :my_setting
8
+ end
9
+
10
+ class << self
11
+ def configuration
12
+ @configuration ||= Configuration.new
13
+ end
14
+
15
+ alias_method :config, :configuration
16
+
17
+ def configure
18
+ yield configuration
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "solidus_core"
4
+ require "solidus_support"
5
+
6
+ module SolidusInter
7
+ class Engine < Rails::Engine
8
+ include SolidusSupport::EngineExtensions
9
+
10
+ isolate_namespace SolidusInter
11
+
12
+ engine_name "solidus_inter"
13
+
14
+ initializer "solidus_inter.add_payment_method", after: "spree.register.payment_methods" do |app|
15
+ app.config.spree.payment_methods << "SolidusInter::InterPix"
16
+ end
17
+
18
+ # use rspec for tests
19
+ config.generators do |g|
20
+ g.test_framework :rspec
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ FactoryBot.define do
4
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusInter
4
+ VERSION = "0.0.1"
5
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "solidus_inter/configuration"
4
+ require "solidus_inter/version"
5
+ require "solidus_inter/engine"
6
+ require "inter_api"
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/solidus_inter/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "solidus_inter"
7
+ spec.version = SolidusInter::VERSION
8
+ spec.authors = ["ulysses"]
9
+ spec.email = "ulyssesh.20@gmail.com"
10
+
11
+ spec.summary = ""
12
+ spec.description = ""
13
+ spec.homepage = "https://github.com/ulysses-bull/solidus_inter#readme"
14
+ spec.license = "BSD-3-Clause"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/ulysses-bull/solidus_inter"
18
+ spec.metadata["changelog_uri"] = "https://github.com/ulysses-bull/solidus_inter/blob/main/CHANGELOG.md"
19
+
20
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5", "< 4")
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
+ files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
25
+
26
+ spec.files = files.grep_v(%r{^(test|spec|features)/})
27
+ spec.bindir = "exe"
28
+ spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_dependency "solidus_core", [">= 2.0.0", "< 5"]
32
+ spec.add_dependency "solidus_support", "~> 0.5"
33
+ spec.add_dependency "inter_api"
34
+ spec.add_dependency "solidus_brazilian_adaptations"
35
+
36
+ spec.add_development_dependency "solidus_dev_support", "~> 2.9"
37
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: solidus_inter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - ulysses
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-05-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: solidus_core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5'
33
+ - !ruby/object:Gem::Dependency
34
+ name: solidus_support
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.5'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.5'
47
+ - !ruby/object:Gem::Dependency
48
+ name: inter_api
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: solidus_brazilian_adaptations
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: solidus_dev_support
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '2.9'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '2.9'
89
+ description: ''
90
+ email: ulyssesh.20@gmail.com
91
+ executables: []
92
+ extensions: []
93
+ extra_rdoc_files: []
94
+ files:
95
+ - ".circleci/config.yml"
96
+ - ".gem_release.yml"
97
+ - ".github/stale.yml"
98
+ - ".github_changelog_generator"
99
+ - ".gitignore"
100
+ - ".rspec"
101
+ - ".rubocop.yml"
102
+ - CHANGELOG.md
103
+ - Gemfile
104
+ - LICENSE
105
+ - README.md
106
+ - Rakefile
107
+ - app/models/solidus_inter/inter_pix.rb
108
+ - app/models/solidus_inter/pix_payment_source.rb
109
+ - app/views/spree/admin/payments/source_forms/_inter_pix.html.erb
110
+ - app/views/spree/admin/payments/source_views/_inter_pix.html.erb
111
+ - app/views/spree/api/payments/source_views/_inter_pix.jbuilder
112
+ - bin/console
113
+ - bin/rails
114
+ - bin/rails-engine
115
+ - bin/rails-sandbox
116
+ - bin/rake
117
+ - bin/sandbox
118
+ - bin/setup
119
+ - config/locales/en.yml
120
+ - config/routes.rb
121
+ - db/migrate/20240527193953_create_solidus_inter_pix_payment_sources.rb
122
+ - lib/generators/solidus_inter/install/install_generator.rb
123
+ - lib/generators/solidus_inter/install/templates/initializer.rb
124
+ - lib/solidus_inter.rb
125
+ - lib/solidus_inter/configuration.rb
126
+ - lib/solidus_inter/engine.rb
127
+ - lib/solidus_inter/testing_support/factories.rb
128
+ - lib/solidus_inter/version.rb
129
+ - solidus_inter.gemspec
130
+ homepage: https://github.com/ulysses-bull/solidus_inter#readme
131
+ licenses:
132
+ - BSD-3-Clause
133
+ metadata:
134
+ homepage_uri: https://github.com/ulysses-bull/solidus_inter#readme
135
+ source_code_uri: https://github.com/ulysses-bull/solidus_inter
136
+ changelog_uri: https://github.com/ulysses-bull/solidus_inter/blob/main/CHANGELOG.md
137
+ post_install_message:
138
+ rdoc_options: []
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '2.5'
146
+ - - "<"
147
+ - !ruby/object:Gem::Version
148
+ version: '4'
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ requirements: []
155
+ rubygems_version: 3.5.10
156
+ signing_key:
157
+ specification_version: 4
158
+ summary: ''
159
+ test_files: []