killbill-payment-test-ui 4.0.1 → 4.0.2
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/payment_test/payments_controller.rb +21 -14
- data/app/views/kaui/components/menu_dropdown/_menu_dropdown.html.erb +27 -4
- data/app/views/payment_test/payments/index.html.erb +57 -15
- data/lib/payment_test/client.rb +2 -2
- data/lib/payment_test/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: 23ecd0c85e54cae7c993dcd993e6f453ffaf06234d2440418edbc591c8c7b4a2
|
|
4
|
+
data.tar.gz: 4d071a29ae872c2b969c1158e23c7a6b7001244f3af3ab3594819298627da795
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0431d49f16d9db230476749fac3322742ccbc0eae40ba6beedcf9a7b16d31b88abe199ebaf70c85d05410a0af2c8b55a6aaecb09c5b95032b0f8e313f6e7e65f
|
|
7
|
+
data.tar.gz: d7b026ab346e5eed248a5b23e2d44205786589db31aa4d91c2879e9f2b437c2f8f123a6f532fa0c40f245daffb980e517620c010ae620e07392e00f288a3ed5e
|
|
@@ -12,28 +12,31 @@ module PaymentTest
|
|
|
12
12
|
Rails.logger.warn("Failed to retrieve payment status : #{e}")
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
+
states = raw_status&.dig('states') || {}
|
|
16
|
+
sleeps = raw_status&.dig('sleeps') || {}
|
|
17
|
+
|
|
15
18
|
@status = if raw_status.nil?
|
|
16
19
|
'UNKNOWN'
|
|
17
|
-
elsif
|
|
20
|
+
elsif states.empty? && sleeps.empty?
|
|
21
|
+
'CLEAR'
|
|
22
|
+
elsif states.values.include?('ACTION_RETURN_PLUGIN_STATUS_ERROR')
|
|
18
23
|
'RETURN ERROR'
|
|
19
|
-
elsif
|
|
24
|
+
elsif states.values.include?('ACTION_RETURN_PLUGIN_STATUS_PENDING')
|
|
20
25
|
'RETURN PENDING'
|
|
21
|
-
elsif
|
|
26
|
+
elsif states.values.include?('ACTION_RETURN_PLUGIN_STATUS_CANCELED')
|
|
22
27
|
'RETURN CANCELED'
|
|
23
|
-
elsif
|
|
28
|
+
elsif states.values.include?('ACTION_THROW_EXCEPTION')
|
|
24
29
|
'RETURN THROW'
|
|
25
|
-
elsif
|
|
26
|
-
'RETURN NULL
|
|
27
|
-
elsif
|
|
28
|
-
"SLEEP #{
|
|
29
|
-
else
|
|
30
|
-
'CLEAR'
|
|
30
|
+
elsif states.values.include?('RETURN_NIL')
|
|
31
|
+
'RETURN NULL'
|
|
32
|
+
elsif sleeps.any?
|
|
33
|
+
"SLEEP #{sleeps.values.first}"
|
|
31
34
|
end
|
|
32
35
|
|
|
33
|
-
@methods = if
|
|
36
|
+
@methods = if states.empty?
|
|
34
37
|
['*']
|
|
35
38
|
else
|
|
36
|
-
|
|
39
|
+
states.keys
|
|
37
40
|
end
|
|
38
41
|
end
|
|
39
42
|
|
|
@@ -43,20 +46,24 @@ module PaymentTest
|
|
|
43
46
|
|
|
44
47
|
begin
|
|
45
48
|
::Killbill::PaymentTest::PaymentTestClient.send(target_method, nil, options_for_klient)
|
|
49
|
+
flash[:notice] = "Status set to #{new_state}"
|
|
46
50
|
rescue StandardError => e
|
|
47
51
|
flash[:error] = "Failed to set state: #{e}"
|
|
52
|
+
Rails.logger.error("Failed to set state: #{e.message}\n#{e.backtrace.join("\n")}")
|
|
48
53
|
end
|
|
49
54
|
|
|
50
|
-
redirect_to root_path and return
|
|
55
|
+
redirect_to payment_test_engine.root_path and return
|
|
51
56
|
end
|
|
52
57
|
|
|
53
58
|
def reset
|
|
54
59
|
begin
|
|
55
60
|
::Killbill::PaymentTest::PaymentTestClient.reset(nil, options_for_klient)
|
|
61
|
+
flash[:notice] = 'Status cleared'
|
|
56
62
|
rescue StandardError => e
|
|
57
63
|
flash[:error] = "Failed to reset state: #{e}"
|
|
64
|
+
Rails.logger.error("Failed to reset state: #{e.message}\n#{e.backtrace.join("\n")}")
|
|
58
65
|
end
|
|
59
|
-
redirect_to root_path and return
|
|
66
|
+
redirect_to payment_test_engine.root_path and return
|
|
60
67
|
end
|
|
61
68
|
end
|
|
62
69
|
end
|
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
<%#
|
|
2
|
-
|
|
2
|
+
Menu dropdown component for payment test UI.
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
Locals:
|
|
5
|
+
- variant: CSS class for button styling (e.g., "btn-light")
|
|
6
|
+
- label: Button label text
|
|
7
|
+
- dropdown_id: Unique ID for the dropdown
|
|
8
|
+
- html_class: Additional CSS classes
|
|
9
|
+
- menu_items: Array of { label:, url:, method: } hashes
|
|
6
10
|
%>
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
<div class="dropdown d-inline-block <%= local_assigns[:html_class] %>">
|
|
13
|
+
<button class="btn <%= local_assigns[:variant] || 'btn-secondary' %> btn-sm dropdown-toggle"
|
|
14
|
+
type="button"
|
|
15
|
+
id="<%= local_assigns[:dropdown_id] || 'menuDropdown' %>"
|
|
16
|
+
data-bs-toggle="dropdown"
|
|
17
|
+
aria-expanded="false">
|
|
18
|
+
<%= local_assigns[:label] || 'Menu' %>
|
|
19
|
+
</button>
|
|
20
|
+
<ul class="dropdown-menu" aria-labelledby="<%= local_assigns[:dropdown_id] || 'menuDropdown' %>">
|
|
21
|
+
<% (local_assigns[:menu_items] || []).each do |item| %>
|
|
22
|
+
<li>
|
|
23
|
+
<% if item[:method] && item[:method] != :get %>
|
|
24
|
+
<%= link_to item[:label], item[:url], method: item[:method], class: 'dropdown-item' %>
|
|
25
|
+
<% else %>
|
|
26
|
+
<%= link_to item[:label], item[:url], class: 'dropdown-item' %>
|
|
27
|
+
<% end %>
|
|
28
|
+
</li>
|
|
29
|
+
<% end %>
|
|
30
|
+
</ul>
|
|
31
|
+
</div>
|
|
@@ -28,21 +28,63 @@
|
|
|
28
28
|
<th>Method</th>
|
|
29
29
|
<th class="d-flex align-items-center">
|
|
30
30
|
<span>Status </span>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
<div class="dropdown dropdown-menu-end position-relative ms-2" id="statusDropdown_wrapper">
|
|
32
|
+
<button type="button" class="btn kaui-dropdown custom-hover btn-light select-status" id="statusDropdown_button" aria-expanded="false">
|
|
33
|
+
Set status
|
|
34
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" style="margin-left: 4px;">
|
|
35
|
+
<path d="M4 6L8 10L12 6" stroke="#495057" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
36
|
+
</svg>
|
|
37
|
+
</button>
|
|
38
|
+
<ul class="dropdown-menu header-menu shadow border-0 rounded-3" id="statusDropdown_menu" style="min-width: 12rem; display: none; position: absolute; z-index: 1000;">
|
|
39
|
+
<li>
|
|
40
|
+
<%= button_to reset_path, method: :post, class: 'dropdown-item d-flex align-items-center gap-2 py-2 px-3', style: 'background: none; border: none; width: 100%; text-align: left; font-size: 0.875rem; cursor: pointer;', form_class: 'mb-0 w-100' do %>
|
|
41
|
+
<span style="font-weight: 500; font-size: 0.875rem; color: #344054;">Clear all status</span>
|
|
42
|
+
<% end %>
|
|
43
|
+
</li>
|
|
44
|
+
<li>
|
|
45
|
+
<%= button_to set_failed_state_path(state: :ERROR), method: :post, class: 'dropdown-item d-flex align-items-center gap-2 py-2 px-3', style: 'background: none; border: none; width: 100%; text-align: left; font-size: 0.875rem; cursor: pointer;', form_class: 'mb-0 w-100' do %>
|
|
46
|
+
<span style="font-weight: 500; font-size: 0.875rem; color: #344054;">Configure ERROR</span>
|
|
47
|
+
<% end %>
|
|
48
|
+
</li>
|
|
49
|
+
<li>
|
|
50
|
+
<%= button_to set_failed_state_path(state: :PENDING), method: :post, class: 'dropdown-item d-flex align-items-center gap-2 py-2 px-3', style: 'background: none; border: none; width: 100%; text-align: left; font-size: 0.875rem; cursor: pointer;', form_class: 'mb-0 w-100' do %>
|
|
51
|
+
<span style="font-weight: 500; font-size: 0.875rem; color: #344054;">Configure PENDING</span>
|
|
52
|
+
<% end %>
|
|
53
|
+
</li>
|
|
54
|
+
<li>
|
|
55
|
+
<%= button_to set_failed_state_path(state: :CANCELED), method: :post, class: 'dropdown-item d-flex align-items-center gap-2 py-2 px-3', style: 'background: none; border: none; width: 100%; text-align: left; font-size: 0.875rem; cursor: pointer;', form_class: 'mb-0 w-100' do %>
|
|
56
|
+
<span style="font-weight: 500; font-size: 0.875rem; color: #344054;">Configure CANCELED</span>
|
|
57
|
+
<% end %>
|
|
58
|
+
</li>
|
|
59
|
+
<li>
|
|
60
|
+
<%= button_to set_failed_state_path(state: :THROW), method: :post, class: 'dropdown-item d-flex align-items-center gap-2 py-2 px-3', style: 'background: none; border: none; width: 100%; text-align: left; font-size: 0.875rem; cursor: pointer;', form_class: 'mb-0 w-100' do %>
|
|
61
|
+
<span style="font-weight: 500; font-size: 0.875rem; color: #344054;">Configure THROW</span>
|
|
62
|
+
<% end %>
|
|
63
|
+
</li>
|
|
64
|
+
</ul>
|
|
65
|
+
</div>
|
|
66
|
+
<%= javascript_tag do %>
|
|
67
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
68
|
+
const button = document.getElementById('statusDropdown_button');
|
|
69
|
+
const menu = document.getElementById('statusDropdown_menu');
|
|
70
|
+
const wrapper = document.getElementById('statusDropdown_wrapper');
|
|
38
71
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
72
|
+
button.addEventListener('click', function (e) {
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
const isShown = menu.style.display === 'block';
|
|
75
|
+
document.querySelectorAll('.dropdown-menu').forEach(function (m) {
|
|
76
|
+
if (m !== menu) { m.style.display = 'none'; }
|
|
77
|
+
});
|
|
78
|
+
menu.style.display = isShown ? 'none' : 'block';
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
document.addEventListener('click', function (e) {
|
|
82
|
+
if (!wrapper.contains(e.target)) {
|
|
83
|
+
menu.style.display = 'none';
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
<% end %>
|
|
46
88
|
</th>
|
|
47
89
|
</tr>
|
|
48
90
|
</thead>
|
|
@@ -61,4 +103,4 @@
|
|
|
61
103
|
</div>
|
|
62
104
|
</div>
|
|
63
105
|
</div>
|
|
64
|
-
</div>
|
|
106
|
+
</div>
|
data/lib/payment_test/client.rb
CHANGED
|
@@ -49,9 +49,9 @@ module Killbill
|
|
|
49
49
|
'CONFIGURE_ACTION' => action
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
body['SLEEP_TIME_SEC'] = arg if action == '
|
|
52
|
+
body['SLEEP_TIME_SEC'] = arg if action == 'ACTION_SLEEP' && arg.present?
|
|
53
53
|
|
|
54
|
-
body['METHODS'] = methods
|
|
54
|
+
body['METHODS'] = methods.join(',') if methods.present?
|
|
55
55
|
|
|
56
56
|
KillBillClient::API.post "#{KILLBILL_PAYMENT_TEST_PREFIX}/configure",
|
|
57
57
|
body.to_json,
|
data/lib/payment_test/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: killbill-payment-test-ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0.
|
|
4
|
+
version: 4.0.2
|
|
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: 2026-03-
|
|
11
|
+
date: 2026-03-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: killbill-assets-ui
|