solidus_inter 1.2.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/solidus_inter/inter_pix.rb +11 -6
- data/lib/generators/solidus_inter/install/install_generator.rb +0 -4
- data/lib/solidus_inter/version.rb +1 -1
- data/lib/solidus_inter.rb +17 -1
- metadata +2 -4
- data/lib/generators/solidus_inter/install/templates/initializer.rb +0 -6
- data/lib/solidus_inter/configuration.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 957754646243516550899ecf9188af8861397cabc81ead4de232a30fc8fae356
|
4
|
+
data.tar.gz: 1f66bfb313ac868989c798b6fb40be5a93ba5a26991172a3f380ece3e7389687
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
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.
|
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-
|
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,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
|