killbill-aviate 1.1.0.pre.1 → 1.1.0.pre.3
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 +4 -4
- data/app/controllers/aviate/configuration_controller.rb +9 -1
- data/lib/aviate/client.rb +28 -10
- data/lib/aviate/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c319f915aef12e37c59e9da46e0c1435109580df42f47e0405fe3892e925b8d9
|
|
4
|
+
data.tar.gz: fc4f02d1810b40db9538cf72aeddb04126f4e826dcc198cfe35c02ebc2dfd2e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1b7db95a97a8052deb9032ba38b7024ec12139a533b56dd17571e0b4b44df5af1925db587d190d7fd500c9870b1278fe4c8b6c9525b814b1bd0c12dab278ab5b
|
|
7
|
+
data.tar.gz: 6cdb61d694a1b52ff3f245c1bfb1d6e52c9a34c0ec87e540fc122be2dc3811d820c218fd311dbec90b7309ef06ac86f28c9b121c4370c4d04c21c9a4811b818e
|
|
@@ -12,7 +12,15 @@ module Aviate
|
|
|
12
12
|
email = params[:aviate_email]
|
|
13
13
|
password = params[:aviate_password]
|
|
14
14
|
response = Killbill::Aviate::AviateClient.authenticate(email, password, cached_options_for_klient)
|
|
15
|
-
|
|
15
|
+
if response['token']
|
|
16
|
+
cookies.encrypted[:jwt_token] = {
|
|
17
|
+
value: response['token'],
|
|
18
|
+
httponly: true,
|
|
19
|
+
secure: Rails.env.production?,
|
|
20
|
+
same_site: :strict,
|
|
21
|
+
expires: 1.hour.from_now
|
|
22
|
+
}
|
|
23
|
+
end
|
|
16
24
|
redirect_to aviate_root_path
|
|
17
25
|
end
|
|
18
26
|
end
|
data/lib/aviate/client.rb
CHANGED
|
@@ -8,7 +8,10 @@ module Killbill
|
|
|
8
8
|
class << self
|
|
9
9
|
def aviate_plugin_available?(options = nil)
|
|
10
10
|
path = "#{KILLBILL_AVIATE_PREFIX}/health/data"
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
request_options = build_request_options(options)
|
|
13
|
+
|
|
14
|
+
KillBillClient::API.get path, {}, request_options
|
|
12
15
|
|
|
13
16
|
[true, nil]
|
|
14
17
|
rescue KillBillClient::API::ResponseError => e
|
|
@@ -28,7 +31,10 @@ module Killbill
|
|
|
28
31
|
|
|
29
32
|
def retrieve_wallets(account_id, options = nil)
|
|
30
33
|
path = "#{KILLBILL_AVIATE_PREFIX}/wallet/#{account_id}"
|
|
31
|
-
|
|
34
|
+
|
|
35
|
+
request_options = build_request_options(options)
|
|
36
|
+
|
|
37
|
+
response = KillBillClient::API.get path, {}, request_options
|
|
32
38
|
JSON.parse(response.body)
|
|
33
39
|
end
|
|
34
40
|
|
|
@@ -41,7 +47,10 @@ module Killbill
|
|
|
41
47
|
expDurationUnit: wallet_params[:exp_duration_unit],
|
|
42
48
|
expDurationLength: wallet_params[:exp_duration_length]
|
|
43
49
|
}
|
|
44
|
-
|
|
50
|
+
|
|
51
|
+
request_options = build_request_options(options)
|
|
52
|
+
|
|
53
|
+
response = KillBillClient::API.put path, body.to_json, {}, request_options
|
|
45
54
|
response.code
|
|
46
55
|
end
|
|
47
56
|
|
|
@@ -64,7 +73,9 @@ module Killbill
|
|
|
64
73
|
}
|
|
65
74
|
}
|
|
66
75
|
|
|
67
|
-
|
|
76
|
+
request_options = build_request_options(options)
|
|
77
|
+
|
|
78
|
+
response = KillBillClient::API.post path, body.to_json, {}, request_options
|
|
68
79
|
JSON.parse(response.body)
|
|
69
80
|
rescue StandardError => e
|
|
70
81
|
JSON.parse(e.message)
|
|
@@ -77,11 +88,12 @@ module Killbill
|
|
|
77
88
|
base_url = KillBillClient::API.base_uri
|
|
78
89
|
uri = URI("#{base_url}#{path}")
|
|
79
90
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
80
|
-
|
|
91
|
+
http.use_ssl = (uri.scheme == 'https')
|
|
92
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
|
81
93
|
request = Net::HTTP::Post.new(uri.path)
|
|
82
94
|
request['Content-Type'] = 'application/json'
|
|
83
|
-
request['X-
|
|
84
|
-
request['X-
|
|
95
|
+
request['X-Killbill-ApiKey'] = options[:api_key]
|
|
96
|
+
request['X-Killbill-ApiSecret'] = options[:api_secret]
|
|
85
97
|
request['Authorization'] = "Basic #{auth}"
|
|
86
98
|
request.body = {}.to_json
|
|
87
99
|
response = http.request(request)
|
|
@@ -92,11 +104,17 @@ module Killbill
|
|
|
92
104
|
|
|
93
105
|
private
|
|
94
106
|
|
|
95
|
-
def
|
|
96
|
-
{
|
|
107
|
+
def build_request_options(options)
|
|
108
|
+
request_options = {
|
|
97
109
|
api_key: options[:api_key],
|
|
98
110
|
api_secret: options[:api_secret]
|
|
99
|
-
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if options[:jwt_token].present?
|
|
114
|
+
request_options[:head] = { 'Authorization' => "Bearer #{options[:jwt_token]}" }
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
request_options
|
|
100
118
|
end
|
|
101
119
|
end
|
|
102
120
|
end
|
data/lib/aviate/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: killbill-aviate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.0.pre.
|
|
4
|
+
version: 1.1.0.pre.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kill Bill core team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-10-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: killbill-assets-ui
|