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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb82f0d033bad60126af50821b849025ea3af57657cb80689cba3f49cb1b7d97
|
4
|
+
data.tar.gz: 19a61b3288da058e9c9d4f1f900ff2eb712f73aef759247f92e1257dc5afec7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
3
|
+
<%% if @payment %>
|
4
4
|
<div class="payment-info">
|
5
5
|
<h3>결제 정보</h3>
|
6
|
-
<p><strong>주문번호:</strong>
|
7
|
-
<p><strong>결제금액:</strong>
|
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
|
-
|
15
|
+
<%%= tosspayments_script_tag %>
|
16
16
|
|
17
17
|
<script>
|
18
18
|
document.addEventListener('DOMContentLoaded', async () => {
|
19
19
|
// TossPayments 설정
|
20
|
-
const clientKey = '
|
21
|
-
const customerKey = 'customer_
|
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: '
|
49
|
+
orderId: '<%%= @payment.order_id %>',
|
50
50
|
orderName: '결제 테스트 상품',
|
51
51
|
customerName: '고객',
|
52
|
-
amount:
|
53
|
-
successUrl: '
|
54
|
-
failUrl: '
|
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
|
-
|
68
|
+
<%% else %>
|
69
69
|
<div class="alert alert-danger">
|
70
70
|
결제 정보를 찾을 수 없습니다.
|
71
71
|
</div>
|
72
72
|
<div class="actions">
|
73
|
-
|
73
|
+
<%%= link_to '목록으로', payments_path, class: 'btn btn-secondary' %>
|
74
74
|
</div>
|
75
|
-
|
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|
|