tosspayments2-rails 0.5.2 → 0.5.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: 7250fcd0896cac23207aea6c52ce3492cb97d12e96967c3f9c2d7bc4139095a5
4
- data.tar.gz: cff3e8488d66b1fec090a45816bdeb62c6681e78b26736c2af2cd6d16d37179a
3
+ metadata.gz: cb82f0d033bad60126af50821b849025ea3af57657cb80689cba3f49cb1b7d97
4
+ data.tar.gz: 19a61b3288da058e9c9d4f1f900ff2eb712f73aef759247f92e1257dc5afec7e
5
5
  SHA512:
6
- metadata.gz: a3a35483524c9550b34b061149c6a9513a9d6294a9d0decd01aff48af1370d37a7c87a45e0fc0b30b63c3b39278745d6a719d3c80396f3c4eadb3b23ca04c5f2
7
- data.tar.gz: 264fdfd4734d437524cfa67644b5943a5b8b9b344e6597794753dcb923308df0866dec7453fbc138c82f55829a4de53cac332de5f6ea64b765bda65f8d9a3c03
6
+ metadata.gz: dfd24b58428ce7dcb17444d863882f2db0b5be9d303b4b24150a6b24576d0f6d68baa8bfdef34f1336f554ce94353d17f91ba4254818369f0300a798167658ad
7
+ data.tar.gz: 484359c4c87bd16efabde9bc651ff341a04df54eaa378721d818a0618598c837fa1ec5932f36da4e35754b87236f2e69f0fab3100e61126929f26ded9435c617
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  _No changes yet._
4
4
 
5
+ ## [0.5.4] - 2025-08-21
6
+ ### Fixed
7
+ - Fix Rails engine configuration issue where `config.tosspayments2` was undefined
8
+ - Properly define config accessor in Rails application before using it
9
+
10
+ ## [0.5.3] - 2025-08-21
11
+ ### Fixed
12
+ - Complete fix for checkout.html.erb template with proper ERB syntax and error handling
13
+
5
14
  ## [0.5.2] - 2025-08-21
6
15
  ### Fixed
7
16
  - Fix NoMethodError in checkout.html.erb template when @payment is nil
@@ -1,10 +1,10 @@
1
1
  <h1>결제 진행</h1>
2
2
 
3
- <% if @payment %>
3
+ <%% if @payment %>
4
4
  <div class="payment-info">
5
5
  <h3>결제 정보</h3>
6
- <p><strong>주문번호:</strong> <%= @payment.order_id %></p>
7
- <p><strong>결제금액:</strong> <%= @payment.formatted_amount %></p>
6
+ <p><strong>주문번호:</strong> <%%= @payment.order_id %></p>
7
+ <p><strong>결제금액:</strong> <%%= @payment.formatted_amount %></p>
8
8
  </div>
9
9
 
10
10
  <!-- TossPayments 결제 위젯 영역 -->
@@ -12,13 +12,13 @@
12
12
  <div id="agreement"></div>
13
13
  <button id="payment-button" class="btn btn-primary">결제하기</button>
14
14
 
15
- <%= tosspayments_script_tag %>
15
+ <%%= tosspayments_script_tag %>
16
16
 
17
17
  <script>
18
18
  document.addEventListener('DOMContentLoaded', async () => {
19
19
  // TossPayments 설정
20
- const clientKey = '<%= Rails.application.credentials.dig(:tosspayments, :client_key) || ENV["TOSSPAYMENTS_CLIENT_KEY"] %>';
21
- const customerKey = 'customer_<%= Time.current.to_i %>'; // 구매자 식별값
20
+ const clientKey = '<%%= Rails.application.credentials.dig(:tosspayments, :client_key) || ENV["TOSSPAYMENTS_CLIENT_KEY"] %>';
21
+ const customerKey = 'customer_<%%= Time.current.to_i %>'; // 구매자 식별값
22
22
 
23
23
  if (!clientKey) {
24
24
  console.error('TossPayments 클라이언트 키가 설정되지 않았습니다.');
@@ -46,12 +46,12 @@ document.addEventListener('DOMContentLoaded', async () => {
46
46
  document.getElementById('payment-button').addEventListener('click', async () => {
47
47
  try {
48
48
  await widgets.requestPayment({
49
- orderId: '<%= @payment.order_id %>',
49
+ orderId: '<%%= @payment.order_id %>',
50
50
  orderName: '결제 테스트 상품',
51
51
  customerName: '고객',
52
- amount: <%= @payment.amount %>,
53
- successUrl: '<%= success_payments_url %>',
54
- failUrl: '<%= fail_payments_url %>'
52
+ amount: <%%= @payment.amount %>,
53
+ successUrl: '<%%= success_payments_url %>',
54
+ failUrl: '<%%= fail_payments_url %>'
55
55
  });
56
56
  } catch (error) {
57
57
  console.error('결제 요청 실패:', error);
@@ -65,14 +65,14 @@ document.addEventListener('DOMContentLoaded', async () => {
65
65
  });
66
66
  </script>
67
67
 
68
- <% else %>
68
+ <%% else %>
69
69
  <div class="alert alert-danger">
70
70
  결제 정보를 찾을 수 없습니다.
71
71
  </div>
72
72
  <div class="actions">
73
- <%= link_to '목록으로', payments_path, class: 'btn btn-secondary' %>
73
+ <%%= link_to '목록으로', payments_path, class: 'btn btn-secondary' %>
74
74
  </div>
75
- <% end %>
75
+ <%% end %>
76
76
 
77
77
  <style>
78
78
  .payment-info {
@@ -6,7 +6,12 @@ module Tosspayments2
6
6
  class Engine < ::Rails::Engine
7
7
  isolate_namespace Tosspayments2::Rails
8
8
 
9
- initializer 'tosspayments2.configure' do |app|
9
+ initializer 'tosspayments2.configure', before: :load_config_initializers do |app|
10
+ # Ensure config accessor exists
11
+ unless app.config.respond_to?(:tosspayments2)
12
+ app.config.class.send(:attr_accessor, :tosspayments2)
13
+ app.config.tosspayments2 = ActiveSupport::OrderedOptions.new
14
+ end
10
15
  app.config.tosspayments2 ||= ActiveSupport::OrderedOptions.new
11
16
  app_cfg = app.config.tosspayments2
12
17
  ::Tosspayments2::Rails.configure do |c|
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tosspayments2
4
4
  module Rails
5
- VERSION = '0.5.2'
5
+ VERSION = '0.5.4'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tosspayments2-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucius Choi