tosspayments2-rails 0.5.1 → 0.5.3
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: 73c719bd714f0cfc26846bf34d53df219cc2507183116c65edab920bb54f4e9a
|
4
|
+
data.tar.gz: 969563b02de6d42d5674fffa83c04e4bc9a6efbe0d651ebfeac582e001405c55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90522dad29b4362e3bf50377c7cd722a0c41ef84bc8c4e5ae8b235f35429c082ac7100abd254ee11f00afb48e67d13d27671eb9179619243006de8454d39c1b1
|
7
|
+
data.tar.gz: f409397b362cbf4bf01386ce81e4a864879b546522a4b966b45ed4782a96bbca9313eaf259de6d8d3e612265e8db3566cb51fee1109a257ebe4695d658bc0452
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
_No changes yet._
|
4
4
|
|
5
|
+
## [0.5.3] - 2025-08-21
|
6
|
+
### Fixed
|
7
|
+
- Complete fix for checkout.html.erb template with proper ERB syntax and error handling
|
8
|
+
|
9
|
+
## [0.5.2] - 2025-08-21
|
10
|
+
### Fixed
|
11
|
+
- Fix NoMethodError in checkout.html.erb template when @payment is nil
|
12
|
+
- Add proper nil handling and error messages for missing payment in checkout flow
|
13
|
+
|
5
14
|
## [0.5.1] - 2025-08-21
|
6
15
|
### Fixed
|
7
16
|
- Fix NoMethodError in show.html.erb template when @payment is nil
|
@@ -1,9 +1,10 @@
|
|
1
1
|
<h1>결제 진행</h1>
|
2
2
|
|
3
|
+
<%% if @payment %>
|
3
4
|
<div class="payment-info">
|
4
5
|
<h3>결제 정보</h3>
|
5
|
-
<p><strong>주문번호:</strong>
|
6
|
-
<p><strong>결제금액:</strong>
|
6
|
+
<p><strong>주문번호:</strong> <%%= @payment.order_id %></p>
|
7
|
+
<p><strong>결제금액:</strong> <%%= @payment.formatted_amount %></p>
|
7
8
|
</div>
|
8
9
|
|
9
10
|
<!-- TossPayments 결제 위젯 영역 -->
|
@@ -11,13 +12,13 @@
|
|
11
12
|
<div id="agreement"></div>
|
12
13
|
<button id="payment-button" class="btn btn-primary">결제하기</button>
|
13
14
|
|
14
|
-
|
15
|
+
<%%= tosspayments_script_tag %>
|
15
16
|
|
16
17
|
<script>
|
17
18
|
document.addEventListener('DOMContentLoaded', async () => {
|
18
19
|
// TossPayments 설정
|
19
|
-
const clientKey = '
|
20
|
-
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 %>'; // 구매자 식별값
|
21
22
|
|
22
23
|
if (!clientKey) {
|
23
24
|
console.error('TossPayments 클라이언트 키가 설정되지 않았습니다.');
|
@@ -45,12 +46,12 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|
45
46
|
document.getElementById('payment-button').addEventListener('click', async () => {
|
46
47
|
try {
|
47
48
|
await widgets.requestPayment({
|
48
|
-
orderId: '
|
49
|
+
orderId: '<%%= @payment.order_id %>',
|
49
50
|
orderName: '결제 테스트 상품',
|
50
51
|
customerName: '고객',
|
51
|
-
amount:
|
52
|
-
successUrl: '
|
53
|
-
failUrl: '
|
52
|
+
amount: <%%= @payment.amount %>,
|
53
|
+
successUrl: '<%%= success_payments_url %>',
|
54
|
+
failUrl: '<%%= fail_payments_url %>'
|
54
55
|
});
|
55
56
|
} catch (error) {
|
56
57
|
console.error('결제 요청 실패:', error);
|
@@ -64,6 +65,15 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|
64
65
|
});
|
65
66
|
</script>
|
66
67
|
|
68
|
+
<%% else %>
|
69
|
+
<div class="alert alert-danger">
|
70
|
+
결제 정보를 찾을 수 없습니다.
|
71
|
+
</div>
|
72
|
+
<div class="actions">
|
73
|
+
<%%= link_to '목록으로', payments_path, class: 'btn btn-secondary' %>
|
74
|
+
</div>
|
75
|
+
<%% end %>
|
76
|
+
|
67
77
|
<style>
|
68
78
|
.payment-info {
|
69
79
|
background-color: #f8f9fa;
|
@@ -112,4 +122,27 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|
112
122
|
background-color: #0056b3;
|
113
123
|
border-color: #004085;
|
114
124
|
}
|
125
|
+
|
126
|
+
.btn-secondary {
|
127
|
+
color: #fff;
|
128
|
+
background-color: #6c757d;
|
129
|
+
border-color: #6c757d;
|
130
|
+
}
|
131
|
+
|
132
|
+
.alert {
|
133
|
+
padding: 0.75rem 1.25rem;
|
134
|
+
margin-bottom: 1rem;
|
135
|
+
border: 1px solid transparent;
|
136
|
+
border-radius: 0.25rem;
|
137
|
+
}
|
138
|
+
|
139
|
+
.alert-danger {
|
140
|
+
color: #721c24;
|
141
|
+
background-color: #f8d7da;
|
142
|
+
border-color: #f5c6cb;
|
143
|
+
}
|
144
|
+
|
145
|
+
.actions {
|
146
|
+
margin-top: 2rem;
|
147
|
+
}
|
115
148
|
</style>
|