solidus_inter 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7aa0fdda876bf2dd7b36faa4f0ee3de9e37846e83f234efc222f935d89831417
4
- data.tar.gz: 25d93553c05adf4a56fad8ca46ac5eb5a98966daceed65a222572589e5c9eaae
3
+ metadata.gz: 957754646243516550899ecf9188af8861397cabc81ead4de232a30fc8fae356
4
+ data.tar.gz: 1f66bfb313ac868989c798b6fb40be5a93ba5a26991172a3f380ece3e7389687
5
5
  SHA512:
6
- metadata.gz: 4df48e93c2cd5df49a9e14d309bf8320a6f8af512a24f4e9745cb2a32fc457992214b7184ca631d034515864d4ec91b10e65212c23be82410fca7941b7bba60b
7
- data.tar.gz: 0c37bd2d1bb18d24609d29fa90d4e56815570a068442b62c0e66e7a418ade329482d1c054e23cc932abad31bed630477e64a9afe6b25d0bde325b25388ce032d
6
+ metadata.gz: f8f297a6e54665c27d67f930cb4c42298c20ee7053cf6a0214aeb0cbb3fbd53bbb5ebf1523e16ada85d95af5fe381d97b2acb011fe3c3758d6c031bd8b88038c
7
+ data.tar.gz: 7409e9d3f619b59a8c08fe367502772002a97d1da92f323dc703c5980ab3e8c17be0822c7ba5e3b4aac2ca98f034e0bd6da99fa5bb0839ed8d3536dc385deade
@@ -62,6 +62,14 @@ module SolidusInter
62
62
  true
63
63
  end
64
64
 
65
+ def pay_test_payment payment
66
+ return false unless payment && payment.source.txid
67
+ inter_payment = find_payment(payment.source.txid)
68
+ return false if inter_payment.paid?
69
+ client = set_api_client
70
+ client.pay_pix(inter_payment.txid, inter_payment.valor_original)
71
+ end
72
+
65
73
  def purchase(money, source, options = {})
66
74
  inter_payment = find_payment(source.txid)
67
75
  if inter_payment.paid?
@@ -74,11 +82,7 @@ module SolidusInter
74
82
 
75
83
  def should_skip_processing?(source)
76
84
  inter_payment = find_payment(source.txid)
77
- if inter_payment.paid?
78
- false
79
- else
80
- true
81
- end
85
+ !inter_payment.paid?
82
86
  end
83
87
 
84
88
  private
@@ -93,7 +97,8 @@ module SolidusInter
93
97
  crt: temp_file(preferences[:crt]).path,
94
98
  key: temp_file(preferences[:key]).path,
95
99
  token: account&.token,
96
- token_expires_at: account&.expires_at
100
+ token_expires_at: account&.expires_at,
101
+ test_mode: preferences[:test_mode]
97
102
  )
98
103
  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
104
  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.2.0"
4
+ VERSION = "1.4.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.2.0
4
+ version: 1.4.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-09-13 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
@@ -123,9 +123,7 @@ files:
123
123
  - db/migrate/20240527193953_create_solidus_inter_pix_payment_sources.rb
124
124
  - db/migrate/20240603132203_create_solidus_inter_accounts.rb
125
125
  - lib/generators/solidus_inter/install/install_generator.rb
126
- - lib/generators/solidus_inter/install/templates/initializer.rb
127
126
  - lib/solidus_inter.rb
128
- - lib/solidus_inter/configuration.rb
129
127
  - lib/solidus_inter/engine.rb
130
128
  - lib/solidus_inter/testing_support/factories.rb
131
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