flowcommerce-solidus 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/static/app/flow/flow.rb +10 -12
- data/static/app/flow/flow/error.rb +2 -2
- data/static/app/flow/flow/order.rb +2 -0
- data/static/app/flow/flow/pay_pal.rb +1 -1
- data/static/app/flow/flow/session.rb +1 -1
- metadata +2 -3
- data/static/app/flow/flow/simple_crypt.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62942081ca63c1cb57bc7afe28472d1bfef9dc0c
|
4
|
+
data.tar.gz: 6ba9ee41350c15edf9359b9f3ead5be1a6f5c224
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eacbef2a5892adf9e098de565af1a58acc400c5177df427b9e2e0a16db74d2853a2caa51bc59906639c2b3086d901d52f8d3fc83a13775598fe289b5aade5cfa
|
7
|
+
data.tar.gz: e1bef19fc7e259673e4f2d33588aef9a78b9cf7bc2a5cf4d61089eb50d7c40d5c19c64f7b7c5b65eff0ce8b0d410efa1d98070b8b6849e4270110969ed961ebf
|
data/.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.13
|
data/static/app/flow/flow.rb
CHANGED
@@ -2,15 +2,14 @@
|
|
2
2
|
# for now all in same class
|
3
3
|
|
4
4
|
require 'logger'
|
5
|
-
require 'awesome_print'
|
6
5
|
|
7
6
|
module Flow
|
8
|
-
mattr_accessor :organization
|
9
|
-
mattr_accessor :base_country
|
10
|
-
mattr_accessor :api_key
|
11
|
-
|
12
7
|
extend self
|
13
8
|
|
9
|
+
def organization() ENV.fetch('FLOW_ORGANIZATION') end
|
10
|
+
def base_country() ENV.fetch('FLOW_BASE_COUNTRY') end
|
11
|
+
def api_key() ENV.fetch('FLOW_API_KEY') end
|
12
|
+
|
14
13
|
# builds curl command and gets remote data
|
15
14
|
def api action, path, params={}, body=nil
|
16
15
|
body ||= params.delete(:BODY)
|
@@ -41,13 +40,12 @@ module Flow
|
|
41
40
|
|
42
41
|
data = JSON.load `#{command}`
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
if data.kind_of?(Hash) && data['code'] == 'generic_error'
|
44
|
+
ap data
|
45
|
+
data
|
46
|
+
else
|
47
|
+
data
|
48
|
+
end
|
51
49
|
end
|
52
50
|
|
53
51
|
def logger
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# Flow (2017)
|
2
|
-
#
|
2
|
+
# api error logger and formater
|
3
3
|
|
4
4
|
require 'digest/sha1'
|
5
5
|
|
6
6
|
class Flow::Error < StandardError
|
7
7
|
|
8
8
|
# logs error to file for easy discovery and fix
|
9
|
-
def self.log
|
9
|
+
def self.log exception, request
|
10
10
|
history = exception.backtrace.reject{ |el| el.index('/gems/') }.map{ |el| el.sub(Rails.root.to_s, '') }.join($/)
|
11
11
|
|
12
12
|
msg = '%s in %s' % [exception.class, request.url]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flowcommerce-solidus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flow.io (Dino Reic)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -118,7 +118,6 @@ files:
|
|
118
118
|
- "./static/app/flow/flow/order.rb"
|
119
119
|
- "./static/app/flow/flow/pay_pal.rb"
|
120
120
|
- "./static/app/flow/flow/session.rb"
|
121
|
-
- "./static/app/flow/flow/simple_crypt.rb"
|
122
121
|
- "./static/app/flow/flow/simple_gateway.rb"
|
123
122
|
- "./static/app/flow/flow/webhook.rb"
|
124
123
|
- "./static/app/flow/lib/flow_api_refresh.rb"
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# Flow.io (2017)
|
2
|
-
# Module uses rails engine for encrypt and decrypt
|
3
|
-
|
4
|
-
# example
|
5
|
-
# enc1 = Flow::SimpleCrypt.encrypt('foo')
|
6
|
-
# Flow::SimpleCrypt.encrypt(enc1)
|
7
|
-
#
|
8
|
-
# example with salt
|
9
|
-
# enc2 = Flow::SimpleCrypt.encrypt('bar', '127.0.0.1')
|
10
|
-
# Flow::SimpleCrypt.encrypt(enc2) # raises error: ActiveSupport::MessageVerifier::InvalidSignature
|
11
|
-
# Flow::SimpleCrypt.encrypt(enc2, '127.0.0.1') # ok
|
12
|
-
|
13
|
-
module Flow::SimpleCrypt
|
14
|
-
extend self
|
15
|
-
|
16
|
-
def encrypt_base(salt)
|
17
|
-
local_secret = Rails.application.secrets.secret_key_base[0,32]
|
18
|
-
key = ActiveSupport::KeyGenerator.new(local_secret).generate_key(salt || '', 32)
|
19
|
-
|
20
|
-
ActiveSupport::MessageEncryptor.new(key)
|
21
|
-
end
|
22
|
-
|
23
|
-
def encrypt(raw_data, salt=nil)
|
24
|
-
encrypt_base(salt).encrypt_and_sign(raw_data)
|
25
|
-
end
|
26
|
-
|
27
|
-
def decrypt(enc_data, salt=nil)
|
28
|
-
encrypt_base(salt).decrypt_and_verify(enc_data)
|
29
|
-
end
|
30
|
-
end
|