killbill-aviate 1.1.0.pre.2 → 1.1.0.pre.4

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: 351076bf3541d8c1b1b5cf46260a021bd2ac3bb5584c76882e74b5a326f91187
4
- data.tar.gz: 914e1a98a10116f44fd42023a8f1903b5081efbdc6f1589a37cce61a76fbda29
3
+ metadata.gz: 2637a800931a97b96e7627862ec03523466f2783aa47dc3802baaa3adf41d0c6
4
+ data.tar.gz: 74c7af1583e51fa00d1ac2c6f3dd2f47aafa1f69ee215d61a57ee54e84ef1b24
5
5
  SHA512:
6
- metadata.gz: c659ff041b0dfc03cf2e0f1faf53c5f8ebf1b6344f5a88f7b490c14143b9cf4d80ba770d11e22e2614e4210fa80ee2cfb195713604b8001f085dc82491edd5b2
7
- data.tar.gz: 97229f4998ae1519b5b48579424e85aa182486c3f5ab7bbe164e9f918a3eeed999c372391a76294408ce0f830c39bef627124d45ff064a6a6b550bf615814f15
6
+ metadata.gz: f0d80352daf4ea71f30584f8ce56a7386bd49bf3150c7214e8b61ecfbbbb5f5d4fc9d47e5482d63e18271c1fbb74b16737ef2f3601668845dfd365b10c68cb29
7
+ data.tar.gz: 7426986c49bce980ebbbf53974a19c2d650577b675b873e4fac0dc612b22c15f865c6695302dccdc307a7367b1019f33f3533e8f5f5483b1b743863b8444b298
@@ -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
- session[:jwt_token] = response['token'] if response['token']
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
@@ -9,16 +9,7 @@ module Killbill
9
9
  def aviate_plugin_available?(options = nil)
10
10
  path = "#{KILLBILL_AVIATE_PREFIX}/health/data"
11
11
 
12
- # Build options with proper header format for KillBillClient
13
- request_options = {
14
- api_key: options[:api_key],
15
- api_secret: options[:api_secret]
16
- }
17
-
18
- # Add Authorization header if JWT token is present
19
- if options[:jwt_token].present?
20
- request_options[:head] = { 'Authorization' => "Bearer #{options[:jwt_token]}" }
21
- end
12
+ request_options = build_request_options(options)
22
13
 
23
14
  KillBillClient::API.get path, {}, request_options
24
15
 
@@ -41,14 +32,7 @@ module Killbill
41
32
  def retrieve_wallets(account_id, options = nil)
42
33
  path = "#{KILLBILL_AVIATE_PREFIX}/wallet/#{account_id}"
43
34
 
44
- request_options = {
45
- api_key: options[:api_key],
46
- api_secret: options[:api_secret]
47
- }
48
-
49
- if options[:jwt_token].present?
50
- request_options[:head] = { 'Authorization' => "Bearer #{options[:jwt_token]}" }
51
- end
35
+ request_options = build_request_options(options)
52
36
 
53
37
  response = KillBillClient::API.get path, {}, request_options
54
38
  JSON.parse(response.body)
@@ -64,14 +48,7 @@ module Killbill
64
48
  expDurationLength: wallet_params[:exp_duration_length]
65
49
  }
66
50
 
67
- request_options = {
68
- api_key: options[:api_key],
69
- api_secret: options[:api_secret]
70
- }
71
-
72
- if options[:jwt_token].present?
73
- request_options[:head] = { 'Authorization' => "Bearer #{options[:jwt_token]}" }
74
- end
51
+ request_options = build_request_options(options)
75
52
 
76
53
  response = KillBillClient::API.put path, body.to_json, {}, request_options
77
54
  response.code
@@ -96,14 +73,7 @@ module Killbill
96
73
  }
97
74
  }
98
75
 
99
- request_options = {
100
- api_key: options[:api_key],
101
- api_secret: options[:api_secret]
102
- }
103
-
104
- if options[:jwt_token].present?
105
- request_options[:head] = { 'Authorization' => "Bearer #{options[:jwt_token]}" }
106
- end
76
+ request_options = build_request_options(options)
107
77
 
108
78
  response = KillBillClient::API.post path, body.to_json, {}, request_options
109
79
  JSON.parse(response.body)
@@ -131,6 +101,21 @@ module Killbill
131
101
  rescue StandardError => e
132
102
  e.message.to_s
133
103
  end
104
+
105
+ private
106
+
107
+ def build_request_options(options)
108
+ request_options = {
109
+ api_key: options[:api_key],
110
+ api_secret: options[:api_secret]
111
+ }
112
+
113
+ if options[:jwt_token].present?
114
+ request_options[:head] = { 'Authorization' => "Bearer #{options[:jwt_token]}" }
115
+ end
116
+
117
+ request_options
118
+ end
134
119
  end
135
120
  end
136
121
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Aviate
4
- VERSION = '1.1.0.pre.2'
4
+ VERSION = '1.1.0.pre.4'
5
5
  end
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.2
4
+ version: 1.1.0.pre.4
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-10-13 00:00:00.000000000 Z
11
+ date: 2025-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: killbill-assets-ui