solidus_inter 1.1.2 → 1.3.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: b1a371d784fd2c853bc8d38e9f6c008e16dc756c74647f93c9b5c7db445c6df3
4
- data.tar.gz: 890ccdc769f966922e4540ba629b92e9c309473bca3aabd02769a96dac019e48
3
+ metadata.gz: 3d3f4f88f750274042d3b1bd94367712b3dd24b8a17fd9cd122849b0f8cd9b40
4
+ data.tar.gz: f8e470ebe491c5c6cfa92f08efe915652962a1a36c44aa0b0bdaefbd303614eb
5
5
  SHA512:
6
- metadata.gz: af861a189d69b52c400327912635366b300ba7602498f91beeb02873c09341d044d69403713e7aa76897b3e8885887a319a70b638af3eec9401dd3e8a8650c6b
7
- data.tar.gz: de0f66f6af98367fd4aa0a5de6b41f601f73f1ef4c2b8314befa9cdab4a4e186a5bd81abd42c52ad2ed92dd20f346eb1f7c796171dfb3e53b82074498dfeac62
6
+ metadata.gz: 9dcabfbb7137fb2a2aa98d647ee892faf7a778f6478cd6fe291be91194a3b3ab5ada12d3b96ed413cb40e843e2aba94204909da9435d10d154e4f18e31eb69ab
7
+ data.tar.gz: 8ab1645e4c3883dc5450284b2e29170bca5d49b059cf8c70d722d3fffa60163422fd983fbc3c069fdc79f759b056ea4f4d24e277dca2180ac4e90e0f06f8b6d1
@@ -0,0 +1,20 @@
1
+ module SolidusInter
2
+ class Gateway
3
+ def initialize options
4
+ end
5
+
6
+ def void(transaction_id, options = {})
7
+ # Respondendo sempre com successful_response para funcionar o botão de "Cancelar" do pedido. Reembolso deve ser feito por fora.
8
+ successful_response("Pedido cancelado. Se necessário, realize o reembolso.", transaction_id)
9
+ end
10
+
11
+ def successful_response message, transaction_id
12
+ ActiveMerchant::Billing::Response.new(
13
+ true,
14
+ message,
15
+ {},
16
+ authorization: transaction_id
17
+ )
18
+ end
19
+ end
20
+ end
@@ -12,7 +12,7 @@ module SolidusInter
12
12
  end
13
13
 
14
14
  def gateway_class
15
- InterPix
15
+ Gateway
16
16
  end
17
17
 
18
18
  def supports?(source)
@@ -74,11 +74,7 @@ module SolidusInter
74
74
 
75
75
  def should_skip_processing?(source)
76
76
  inter_payment = find_payment(source.txid)
77
- if inter_payment.paid?
78
- false
79
- else
80
- true
81
- end
77
+ !inter_payment.paid?
82
78
  end
83
79
 
84
80
  private
@@ -93,7 +89,8 @@ module SolidusInter
93
89
  crt: temp_file(preferences[:crt]).path,
94
90
  key: temp_file(preferences[:key]).path,
95
91
  token: account&.token,
96
- token_expires_at: account&.expires_at
92
+ token_expires_at: account&.expires_at,
93
+ test_mode: preferences[:test_mode]
97
94
  )
98
95
  SolidusInter::Account.upsert({token: client.token, expires_at: client.token_expires_at, chave_pix: client.chave_pix, spree_payment_method_id: id}, unique_by: :chave_pix)
99
96
  client
@@ -10,10 +10,6 @@ module SolidusInter
10
10
  true
11
11
  end
12
12
 
13
- def copy_initializer
14
- template "initializer.rb", "config/initializers/solidus_inter.rb"
15
- end
16
-
17
13
  def add_migrations
18
14
  run "bin/rails railties:install:migrations FROM=solidus_inter"
19
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusInter
4
- VERSION = "1.1.2"
4
+ VERSION = "1.3.0"
5
5
  end
data/lib/solidus_inter.rb CHANGED
@@ -1,6 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "solidus_inter/configuration"
4
3
  require "solidus_inter/version"
5
4
  require "solidus_inter/engine"
6
5
  require "inter_api"
6
+
7
+ module SolidusInter
8
+ class Error < StandardError; end
9
+
10
+ class Configuration
11
+ # mattr_accessor :api_key
12
+ # @@api_key = nil
13
+
14
+ # def initialize
15
+ # raise "Do not instatiate this class. Access configuration variables directly: SolidusInter::Configuration.api_key"
16
+ # end
17
+ end
18
+
19
+ def self.configure
20
+ yield(Configuration)
21
+ end
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_inter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ulysses
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-05 00:00:00.000000000 Z
11
+ date: 2024-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -105,6 +105,7 @@ files:
105
105
  - README.md
106
106
  - Rakefile
107
107
  - app/models/solidus_inter/account.rb
108
+ - app/models/solidus_inter/gateway.rb
108
109
  - app/models/solidus_inter/inter_pix.rb
109
110
  - app/models/solidus_inter/pix_payment_source.rb
110
111
  - app/views/spree/admin/payments/source_forms/_inter_pix.html.erb
@@ -122,9 +123,7 @@ files:
122
123
  - db/migrate/20240527193953_create_solidus_inter_pix_payment_sources.rb
123
124
  - db/migrate/20240603132203_create_solidus_inter_accounts.rb
124
125
  - lib/generators/solidus_inter/install/install_generator.rb
125
- - lib/generators/solidus_inter/install/templates/initializer.rb
126
126
  - lib/solidus_inter.rb
127
- - lib/solidus_inter/configuration.rb
128
127
  - lib/solidus_inter/engine.rb
129
128
  - lib/solidus_inter/testing_support/factories.rb
130
129
  - lib/solidus_inter/version.rb
@@ -1,6 +0,0 @@
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
@@ -1,21 +0,0 @@
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