killbill-aviate 1.1.0.pre.6 → 1.1.0.pre.7

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: 237b14cde57c3e487b24109830a9fece4b0adacc7258bdaf137fc223837d2ed7
4
- data.tar.gz: 39131607c8da262ac2f0a9a9c8252e5f6d4ffa7463df8b89976c5ad3d72cede3
3
+ metadata.gz: bf309d8121edf5c7e3da515a13826dfdfab7afbf6d2bde7392cffbc3553b3e65
4
+ data.tar.gz: fa8fcedb5694e3d29baa18f292e845e96c0681835a9411f395a8acaf523d2e22
5
5
  SHA512:
6
- metadata.gz: 4aec8c79ef28c8b01c66e86addec6291948913247665dd40581c3e256aef700ba2fa6fed39712d92105e68508f2ab568f1562cd55ff25b9fc8d8bb01a4f616fb
7
- data.tar.gz: 6e008e248edac89eb61fd9586357260faa5729bb1b71c5f8834e605e8caf97a0ee511686e55c411ba22869510fa538e3be5f0922b4cac2cb187dc2db3b932450
6
+ metadata.gz: 60f1ef78a00aa97a9a2e10ff09c064c27f08b6ff32cc3c0c9e261ba3b70fcdae9fb397a5007607cf3a5bd67bf7dc815bcdc9d3346d9d5d22442d42dd90987a75
7
+ data.tar.gz: 1018af92b5222da5cde7ac9d2a4507c00011fd4b2e61e151f56d321750f2b7238172c5405ac6bed19e6be7a87d16beb8c508c143a830007b9bb358bbbdbf0010
@@ -5,7 +5,6 @@ require 'securerandom'
5
5
 
6
6
  module Aviate
7
7
  class ConfigurationController < Aviate::EngineController
8
-
9
8
  def index
10
9
  @available = Killbill::Aviate::AviateClient.aviate_plugin_available?(options_for_klient).first
11
10
  end
@@ -15,18 +14,18 @@ module Aviate
15
14
  email = params[:aviate_email]
16
15
  password = params[:aviate_password]
17
16
  response = Killbill::Aviate::AviateClient.authenticate(email, password, cached_options_for_klient)
18
-
17
+
19
18
  if response.is_a?(Hash) && response['token']
20
19
  reference_token = SecureRandom.hex(16)
21
20
  session[:aviate_token_ref] = reference_token
22
21
 
23
22
  # Store actual JWT in Rails cache using the reference token
24
23
  Rails.cache.write("aviate_jwt_#{reference_token}", response['token'], expires_in: 1.hour)
25
- flash[:notice] = "Successfully authenticated with Aviate"
24
+ flash[:notice] = t('aviate.configuration.authentication_success')
26
25
  else
27
- flash[:error] = "Authentication failed. Please check your credentials."
26
+ flash[:error] = t('aviate.configuration.authentication_failed')
28
27
  end
29
-
28
+
30
29
  redirect_to aviate_root_path
31
30
  end
32
31
 
@@ -36,7 +35,7 @@ module Aviate
36
35
  Rails.cache.delete(jwt_cache_key)
37
36
  session.delete(:aviate_token_ref)
38
37
  end
39
- flash[:notice] = "Successfully logged out from Aviate"
38
+ flash[:notice] = t('aviate.configuration.logout_success')
40
39
  redirect_to aviate_root_path
41
40
  end
42
41
  end
@@ -1,19 +1,19 @@
1
1
  <%= form_tag @wallet ? aviate_engine.top_off_config_account_wallet_path(@account.account_id, @wallet[:wallet_id]) : aviate_engine.account_wallets_path(@account.account_id), :class => 'form-horizontal', :method => :post, :multipart => true do %>
2
2
  <%= hidden_field_tag :account_id, @account.account_id %>
3
3
  <%= hidden_field_tag :wallet_id, @wallet[:wallet_id] if @wallet %>
4
- <div class="form-group">
5
- <%= label_tag :currency, 'Currency', :class => 'col-sm-2 control-label' %>
6
- <div class="col-sm-10">
4
+ <div class="form-group d-flex pb-3">
5
+ <%= label_tag :currency, 'Currency', :class => 'col-sm-3 control-label' %>
6
+ <div class="col-sm-9">
7
7
  <%= hidden_field_tag :currency, @wallet ? @wallet[:currency] : @currency, required: true %>
8
- <p class="form-control-static"><%= @wallet ? @wallet[:currency] : @currency %></p>
8
+ <span class="form-control-static form-control"><%= @wallet ? @wallet[:currency] : @currency %></span>
9
9
  </div>
10
10
  </div>
11
11
 
12
12
  <% unless @wallet %>
13
- <h3>Initial Credit</h3>
14
- <div class="form-group">
15
- <%= label_tag :credit_type, 'Credit Type', :class => 'col-sm-2 control-label' %>
16
- <div class="col-sm-10">
13
+ <h3 class="border-bottom pb-2 mb-3 pt-3 fw-bold text-start">Initial Credit</h3>
14
+ <div class="form-group d-flex pb-3">
15
+ <%= label_tag :credit_type, 'Credit Type', :class => 'col-sm-3 control-label' %>
16
+ <div class="col-sm-9">
17
17
  <%= select_tag :credit_type,
18
18
  options_for_select(['CREDIT_PAID', 'CREDIT_FREE'], @wallet.try(:[], :credit_type)),
19
19
  :class => 'form-control',
@@ -21,24 +21,24 @@
21
21
  required: true %>
22
22
  </div>
23
23
  </div>
24
- <div class="form-group">
25
- <%= label_tag :amount, 'Amount', :class => 'col-sm-2 control-label' %>
26
- <div class="col-sm-10">
24
+ <div class="form-group d-flex pb-3">
25
+ <%= label_tag :amount, 'Amount', :class => 'col-sm-3 control-label' %>
26
+ <div class="col-sm-9">
27
27
  <%= number_field_tag :amount, @wallet.try(:[], :amount), :class => 'form-control', :step => '0.01', :min => '0', required: true %>
28
28
  </div>
29
29
  </div>
30
- <div class="form-group">
31
- <%= label_tag :exp_date, 'Expiration Date', :class => 'col-sm-2 control-label' %>
32
- <div class="col-sm-10">
33
- <%= date_field_tag :exp_date, @wallet.try(:[], :exp_date), :class => 'form-control', required: true %>
30
+ <div class="form-group d-flex pb-3">
31
+ <%= label_tag :exp_date, 'Expiration Date', :class => 'col-sm-3 control-label' %>
32
+ <div class="col-sm-9">
33
+ <%= date_field_tag :exp_date, @wallet.try(:[], :exp_date), class: 'form-control', id: 'exp_date_input', required: true %>
34
34
  </div>
35
35
  </div>
36
36
  <% end %>
37
37
 
38
- <h3>Top Off</h3>
39
- <div class="form-group">
40
- <%= label_tag :top_off_type, 'Top Off Type', :class => 'col-sm-2 control-label' %>
41
- <div class="col-sm-10">
38
+ <h3 class="border-bottom pb-2 mb-3 pt-3 fw-bold text-start">Top Off</h3>
39
+ <div class="form-group d-flex pb-3">
40
+ <%= label_tag :top_off_type, 'Top Off Type', :class => 'col-sm-3 control-label' %>
41
+ <div class="col-sm-9">
42
42
  <%= select_tag :top_off_type,
43
43
  options_for_select(['TOP_OFF_FIXED', 'TOP_OFF_TARGET'], @wallet.try(:[], :top_off_type)),
44
44
  :class => 'form-control',
@@ -46,21 +46,21 @@
46
46
  required: true %>
47
47
  </div>
48
48
  </div>
49
- <div class="form-group">
50
- <%= label_tag :low_watermark, 'Low Water Mark', :class => 'col-sm-2 control-label' %>
51
- <div class="col-sm-10">
49
+ <div class="form-group d-flex pb-3">
50
+ <%= label_tag :low_watermark, 'Low Water Mark', :class => 'col-sm-3 control-label' %>
51
+ <div class="col-sm-9">
52
52
  <%= text_field_tag :low_watermark, @wallet.try(:[], :low_watermark), :class => 'form-control', required: true %>
53
53
  </div>
54
54
  </div>
55
- <div class="form-group">
56
- <%= label_tag :top_off_amount, 'Amount', :class => 'col-sm-2 control-label' %>
57
- <div class="col-sm-10">
55
+ <div class="form-group d-flex pb-3">
56
+ <%= label_tag :top_off_amount, 'Amount', :class => 'col-sm-3 control-label' %>
57
+ <div class="col-sm-9">
58
58
  <%= number_field_tag :top_off_amount, @wallet.try(:[], :top_off_amount), :class => 'form-control', :step => '0.01', :min => '0', required: true %>
59
59
  </div>
60
60
  </div>
61
- <div class="form-group">
62
- <%= label_tag :exp_duration_unit, 'Expiration Duration Unit', :class => 'col-sm-2 control-label' %>
63
- <div class="col-sm-10">
61
+ <div class="form-group d-flex pb-3">
62
+ <%= label_tag :exp_duration_unit, 'Expiration Duration Unit', :class => 'col-sm-3 control-label pe-3' %>
63
+ <div class="col-sm-9">
64
64
  <%= select_tag :exp_duration_unit,
65
65
  options_for_select(['DAYS', 'WEEKS', 'MONTHS', 'YEARS'], @wallet.try(:[], :exp_duration_unit)),
66
66
  :class => 'form-control',
@@ -68,16 +68,46 @@
68
68
  required: true %>
69
69
  </div>
70
70
  </div>
71
- <div class="form-group">
72
- <%= label_tag :exp_duration_length, 'Expiration Duration Length', :class => 'col-sm-2 control-label' %>
73
- <div class="col-sm-10">
71
+ <div class="form-group d-flex pb-4">
72
+ <%= label_tag :exp_duration_length, 'Expiration Duration Length', :class => 'col-sm-3 control-label' %>
73
+ <div class="col-sm-9">
74
74
  <%= number_field_tag :exp_duration_length, @wallet.try(:[], :exp_duration_length), :class => 'form-control', required: true %>
75
75
  </div>
76
76
  </div>
77
77
 
78
- <div class="form-group">
79
- <div class="col-sm-offset-2 col-sm-10">
80
- <%= submit_tag 'Save', :class => 'btn btn-default' %>
81
- </div>
78
+ <div class="form-group d-flex justify-content-end pt-3 border-top">
79
+ <%= render "kaui/components/button/button", {
80
+ label: 'Close',
81
+ variant: "outline-secondary d-inline-flex align-items-center gap-1",
82
+ type: "button",
83
+ html_class: "kaui-button custom-hover mx-2",
84
+ html_options: {
85
+ onclick: "window.history.back();"
86
+ }
87
+ } %>
88
+ <%= render "kaui/components/button/button", {
89
+ label: 'Save Wallet',
90
+ variant: "outline-secondary d-inline-flex align-items-center gap-1",
91
+ type: "submit",
92
+ html_class: "kaui-dropdown custom-hover"
93
+ } %>
82
94
  </div>
83
95
  <% end %>
96
+
97
+ <%= javascript_tag do %>
98
+
99
+ window.addEventListener('load', function() {
100
+ const dateInput = document.getElementById('exp_date_input');
101
+ if (!dateInput) return;
102
+
103
+ dateInput.addEventListener('click', function() {
104
+ if (typeof this.showPicker === 'function') {
105
+ this.showPicker();
106
+ return;
107
+ }
108
+ this.focus();
109
+ this.type = 'text';
110
+ this.type = 'date';
111
+ });
112
+ });
113
+ <% end %>
@@ -1,31 +1,45 @@
1
- <div class="search">
2
-
3
- <div class="column-block">
4
-
5
- <h1>
6
- Wallets
7
- <%= link_to '<i class="fa fa-plus-square"></i>'.html_safe,
8
- aviate_engine.new_account_wallet_path(@account_id),
9
- :class => 'btn btn-xs' %>
10
- </h1>
11
-
12
-
13
- <table id="wallets-table" class="table table-condensed mobile-data">
14
- <thead>
15
- <tr>
16
- <th>Wallet ID</th>
17
- <th>Account ID</th>
18
- <th>Wallet Currency</th>
19
- <th>Wallet Balance</th>
20
- <th>Live Balance</th>
21
- </tr>
22
- </thead>
23
- <tbody>
24
- <tr>
25
- <td colspan="1" class="dataTables_empty">Loading data from server</td>
26
- </tr>
27
- </tbody>
28
- </table>
1
+ <div class="kaui-container wallets-index">
2
+ <div class="d-flex " style="gap: 4rem;">
3
+ <div class="wallets" style="max-width: 80rem;">
4
+ <div class="d-flex flex-column ">
5
+ <div class="wallets-header mb-4">
6
+ <div class="d-flex align-items-center">
7
+ <h2>Wallets</h2>
8
+ </div>
9
+ <span>
10
+ <%= render "kaui/components/button/button", {
11
+ label: "Create Wallet",
12
+ icon: "kaui/plus.svg",
13
+ variant: "outline-secondary d-inline-flex align-items-center gap-1 mx-2",
14
+ type: "button",
15
+ html_class: "kaui-dropdown custom-hover text-nowrap",
16
+ html_options: {
17
+ onclick: "window.location.href='#{aviate_engine.new_account_wallet_path(@account_id)}'"
18
+ }
19
+ } %>
20
+ </span>
21
+ </div>
22
+ <div id="search-labels-container" class="ml-2">
23
+ <!-- Dynamic search labels will be added here -->
24
+ </div>
25
+ <table id="wallets-table" class="wallets-table">
26
+ <thead>
27
+ <tr>
28
+ <th>Wallet ID</th>
29
+ <th>Account ID</th>
30
+ <th>Wallet Currency</th>
31
+ <th>Wallet Balance</th>
32
+ <th>Live Balance</th>
33
+ </tr>
34
+ </thead>
35
+ <tbody>
36
+ <tr>
37
+ <td colspan="1" class="dataTables_empty">Loading data from server</td>
38
+ </tr>
39
+ </tbody>
40
+ </table>
41
+ </div>
42
+ </div>
29
43
  </div>
30
44
  </div>
31
45
 
@@ -1,8 +1,19 @@
1
- <div class="register">
2
- <div class="col-md-8 col-md-offset-2">
3
- <div class="column-block">
4
- <h1>Create Wallet</h1>
1
+ <div class="register add-new-wallet-details">
2
+ <div>
3
+ <div class="mx-auto" style="max-width: 37.5rem;">
4
+ <h5 class="add-new-wallet-title border-bottom pb-3 mb-3">
5
+ <span class="icon-container">
6
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
7
+ <path d="M15.8333 5.83333H4.16667C3.24619 5.83333 2.5 6.57953 2.5 7.5V15C2.5 15.9205 3.24619 16.6667 4.16667 16.6667H15.8333C16.7538 16.6667 17.5 15.9205 17.5 15V7.5C17.5 6.57953 16.7538 5.83333 15.8333 5.83333Z" stroke="#414651" stroke-width="1.5" stroke-linejoin="round"/>
8
+ <path d="M2.5 9.16667H17.5" stroke="#414651" stroke-width="1.5" stroke-linecap="round"/>
9
+ <path d="M5.83325 11.6667H7.49992" stroke="#414651" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
10
+ <path d="M14.1667 12.5C14.6269 12.5 15 12.1269 15 11.6667C15 11.2064 14.6269 10.8333 14.1667 10.8333C13.7064 10.8333 13.3333 11.2064 13.3333 11.6667C13.3333 12.1269 13.7064 12.5 14.1667 12.5Z" fill="#414651"/>
11
+ <path d="M5.83325 3.33333C5.83325 2.8731 6.20635 2.5 6.66659 2.5H13.3333C13.7935 2.5 14.1666 2.8731 14.1666 3.33333V5.83333H5.83325V3.33333Z" stroke="#414651" stroke-width="1.5" stroke-linejoin="round"/>
12
+ </svg>
13
+ </span>
14
+ Create Wallet
15
+ </h5>
5
16
  <%= render 'form' %>
6
17
  </div>
7
18
  </div>
8
- </div>
19
+ </div>
@@ -1,8 +1,19 @@
1
- <div class="register">
2
- <div class="col-md-8 col-md-offset-2">
3
- <div class="column-block">
4
- <h1>Edit Wallet</h1>
1
+ <div class="register add-new-wallet-details">
2
+ <div>
3
+ <div class="mx-auto" style="max-width: 37.5rem;">
4
+ <h5 class="add-new-wallet-title border-bottom pb-3 mb-3">
5
+ <span class="icon-container">
6
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
7
+ <path d="M15.8333 5.83333H4.16667C3.24619 5.83333 2.5 6.57953 2.5 7.5V15C2.5 15.9205 3.24619 16.6667 4.16667 16.6667H15.8333C16.7538 16.6667 17.5 15.9205 17.5 15V7.5C17.5 6.57953 16.7538 5.83333 15.8333 5.83333Z" stroke="#414651" stroke-width="1.5" stroke-linejoin="round"/>
8
+ <path d="M2.5 9.16667H17.5" stroke="#414651" stroke-width="1.5" stroke-linecap="round"/>
9
+ <path d="M5.83325 11.6667H7.49992" stroke="#414651" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
10
+ <path d="M14.1667 12.5C14.6269 12.5 15 12.1269 15 11.6667C15 11.2064 14.6269 10.8333 14.1667 10.8333C13.7064 10.8333 13.3333 11.2064 13.3333 11.6667C13.3333 12.1269 13.7064 12.5 14.1667 12.5Z" fill="#414651"/>
11
+ <path d="M5.83325 3.33333C5.83325 2.8731 6.20635 2.5 6.66659 2.5H13.3333C13.7935 2.5 14.1666 2.8731 14.1666 3.33333V5.83333H5.83325V3.33333Z" stroke="#414651" stroke-width="1.5" stroke-linejoin="round"/>
12
+ </svg>
13
+ </span>
14
+ Edit Wallet
15
+ </h5>
5
16
  <%= render 'form' %>
6
17
  </div>
7
18
  </div>
8
- </div>
19
+ </div>
@@ -2,6 +2,8 @@ en:
2
2
  aviate:
3
3
  configuration:
4
4
  authentication_success: "Successfully authenticated. Welcome to Aviate!"
5
+ authentication_failed: "Authentication failed. Please check your credentials."
6
+ logout_success: "Successfully logged out from Aviate"
5
7
  flashes:
6
8
  notices:
7
9
  wallet_created_successfully: "Wallet created successfully"
data/lib/aviate/client.rb CHANGED
@@ -8,9 +8,8 @@ module Killbill
8
8
  class << self
9
9
  def aviate_plugin_available?(options = nil)
10
10
  path = "#{KILLBILL_AVIATE_PREFIX}/health/data"
11
-
12
11
  request_options = build_request_options(options)
13
-
12
+
14
13
  KillBillClient::API.get path, {}, request_options
15
14
 
16
15
  [true, nil]
@@ -31,9 +30,8 @@ module Killbill
31
30
 
32
31
  def retrieve_wallets(account_id, options = nil)
33
32
  path = "#{KILLBILL_AVIATE_PREFIX}/wallet/#{account_id}"
34
-
35
33
  request_options = build_request_options(options)
36
-
34
+
37
35
  response = KillBillClient::API.get path, {}, request_options
38
36
  JSON.parse(response.body)
39
37
  end
@@ -47,9 +45,9 @@ module Killbill
47
45
  expDurationUnit: wallet_params[:exp_duration_unit],
48
46
  expDurationLength: wallet_params[:exp_duration_length]
49
47
  }
50
-
48
+
51
49
  request_options = build_request_options(options)
52
-
50
+
53
51
  response = KillBillClient::API.put path, body.to_json, {}, request_options
54
52
  response.code
55
53
  end
@@ -109,11 +107,9 @@ module Killbill
109
107
  api_key: options[:api_key],
110
108
  api_secret: options[:api_secret]
111
109
  }
112
-
113
- if options[:jwt_token].present?
114
- request_options[:head] = { 'Authorization' => "Bearer #{options[:jwt_token]}" }
115
- end
116
-
110
+
111
+ request_options[:head] = { 'Authorization' => "Bearer #{options[:jwt_token]}" } if options[:jwt_token].present?
112
+
117
113
  request_options
118
114
  end
119
115
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Aviate
4
- VERSION = '1.1.0.pre.6'
4
+ VERSION = '1.1.0.pre.7'
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.6
4
+ version: 1.1.0.pre.7
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-26 00:00:00.000000000 Z
11
+ date: 2025-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: killbill-assets-ui