Skip to content

Commit 9021bec

Browse files
committed
fix: lint error 수정
1 parent 462e221 commit 9021bec

7 files changed

Lines changed: 622 additions & 39 deletions

File tree

app/core/settings.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,13 +457,11 @@
457457
)
458458

459459
# Notification Settings
460-
# 각 템플릿 코드는 NHN Cloud Console에 등록된 코드와 일치해야 합니다.
461-
# NHN Cloud → DB 동기화 후 해당 code로 템플릿을 조회합니다.
462460
NOTIFICATION = types.SimpleNamespace(
463-
# TODO: NHN Cloud에 등록된 결제 완료 알림톡 템플릿 코드로 교체
461+
# NHN Cloud → DB 동기화 후 해당 code로 템플릿을 조회합니다.
464462
payment_completed_alimtalk_template_code=env("PAYMENT_COMPLETED_ALIMTALK_TEMPLATE_CODE", default=""),
465-
# TODO: 결제 완료 이메일 템플릿 생성 후 해당 코드로 교체
466-
payment_completed_email_template_code=env("PAYMENT_COMPLETED_EMAIL_TEMPLATE_CODE", default=""),
463+
# DB에 등록된 결제 완료 이메일 템플릿 코드로 교체 완료
464+
payment_completed_email_template_code=env.str("PAYMENT_COMPLETED_EMAIL_TEMPLATE_CODE", default="payment_completed"),
467465
)
468466

469467
# External API Key Settings (등록 데스크 등)
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import json
2+
from pathlib import Path
3+
4+
from django.conf import settings
5+
from django.db import migrations
6+
7+
# DB에 등록할 결제 완료 이메일 템플릿 코드로 교체 완료 (payment_completed.html)
8+
# 만일 추후 변경 시 settings.NOTIFICATION.payment_completed_email_template_code 및 환경변수도 함께 수정 필요
9+
_TEMPLATE_CODE = "payment_completed"
10+
11+
_EMAIL_SUBJECT = "파이콘 한국 티켓 결제가 완료되었습니다!"
12+
13+
_HTML_TEMPLATE_PATH = Path(__file__).parent.parent / "templates" / "payment_completed.html"
14+
15+
16+
def seed_payment_completed_email_template(apps, schema_editor):
17+
EmailNotificationTemplate = apps.get_model("notification", "EmailNotificationTemplate")
18+
EmailNotificationTemplate.objects.get_or_create(
19+
code=_TEMPLATE_CODE,
20+
defaults={
21+
"title": "결제 완료 이메일",
22+
# migration 실행 시점의 환경변수(EMAIL_HOST_USER)를 발신 주소로 사용.
23+
# 값이 비어있으면 이메일 발송 시 오류가 발생하므로 배포 전 EMAIL_HOST_USER 설정 필요.
24+
"sent_from": settings.EMAIL_HOST_USER,
25+
"data": json.dumps(
26+
{
27+
"title": _EMAIL_SUBJECT,
28+
"body": _HTML_TEMPLATE_PATH.read_text(encoding="utf-8"),
29+
},
30+
ensure_ascii=False,
31+
),
32+
},
33+
)
34+
35+
36+
def reverse_seed_payment_completed_email_template(apps, schema_editor):
37+
EmailNotificationTemplate = apps.get_model("notification", "EmailNotificationTemplate")
38+
EmailNotificationTemplate.objects.filter(code=_TEMPLATE_CODE).delete()
39+
40+
41+
class Migration(migrations.Migration):
42+
dependencies = [
43+
("notification", "0002_emailnotificationhistorysentto_failure_reason_and_more"),
44+
]
45+
46+
operations = [
47+
migrations.RunPython(
48+
seed_payment_completed_email_template, # 실행할 로직
49+
reverse_seed_payment_completed_email_template, # 실행할 로직에서 failure 발생 시 되돌릴 역방향 로직
50+
),
51+
]
Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
<!doctype html>
2+
<html lang="ko-kr">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>
7+
파이콘 한국 스토어 결제 완료 안내 | PyCon Korea Store — Order Confirmation
8+
</title>
9+
</head>
10+
<body
11+
style="
12+
margin: 0;
13+
padding: 0;
14+
background-color: #f5f6f8;
15+
font-family:
16+
&quot;Noto Sans KR&quot;,
17+
-apple-system,
18+
BlinkMacSystemFont,
19+
&quot;Segoe UI&quot;,
20+
sans-serif;
21+
color: #222;
22+
line-height: 1.6;
23+
"
24+
>
25+
<table
26+
role="presentation"
27+
width="100%"
28+
cellpadding="0"
29+
cellspacing="0"
30+
border="0"
31+
style="background-color: #f5f6f8"
32+
>
33+
<tr>
34+
<td align="center" style="padding: 16px 8px">
35+
<table
36+
role="presentation"
37+
width="560"
38+
cellpadding="0"
39+
cellspacing="0"
40+
border="0"
41+
style="width: 100%; max-width: 560px; background-color: #ffffff"
42+
>
43+
<tr>
44+
<td
45+
align="center"
46+
style="
47+
padding: 32px 24px 24px 24px;
48+
background-color: #ffffff;
49+
border-bottom: 1px solid #eef0f3;
50+
"
51+
>
52+
<img
53+
src="https://static.pycon.kr/pycon-korea/logo/logo-192px.png"
54+
width="80"
55+
height="80"
56+
alt="Python Korea"
57+
style="
58+
display: block;
59+
margin: 0 auto 12px auto;
60+
border: 0;
61+
outline: none;
62+
"
63+
/>
64+
<p
65+
style="
66+
font-size: 13px;
67+
letter-spacing: 0.04em;
68+
color: #6b7280;
69+
margin: 0 0 6px 0;
70+
"
71+
>
72+
파이콘 한국 스토어 | PyCon Korea Store
73+
</p>
74+
<h1
75+
style="
76+
font-size: 20px;
77+
font-weight: 700;
78+
margin: 0;
79+
color: #231759;
80+
line-height: 1.4;
81+
"
82+
>
83+
파이콘 한국과 함께해 주셔서 감사합니다.
84+
</h1>
85+
<p
86+
style="
87+
font-size: 13px;
88+
color: #6b7280;
89+
margin: 6px 0 0 0;
90+
line-height: 1.4;
91+
"
92+
>
93+
Thank you for your order.
94+
</p>
95+
</td>
96+
</tr>
97+
98+
<tr>
99+
<td style="padding: 20px 24px; border-bottom: 1px solid #eef0f3">
100+
<table
101+
role="presentation"
102+
width="100%"
103+
cellpadding="0"
104+
cellspacing="0"
105+
border="0"
106+
style="font-size: 14px"
107+
>
108+
<tr>
109+
<td colspan="2" style="padding: 0 0 12px 0">
110+
<h2
111+
style="
112+
font-size: 14px;
113+
font-weight: 700;
114+
color: #1f3a8a;
115+
margin: 0;
116+
text-transform: uppercase;
117+
letter-spacing: 0.06em;
118+
"
119+
>
120+
주문 정보 | ORDER INFO
121+
</h2>
122+
</td>
123+
</tr>
124+
<tr>
125+
<th
126+
align="left"
127+
valign="top"
128+
width="40%"
129+
style="color: #6b7280; font-weight: 500; padding: 8px 0"
130+
>
131+
주문 명 (Order name)
132+
</th>
133+
<td valign="top" style="color: #111; padding: 8px 0">
134+
{{ order_name }}
135+
</td>
136+
</tr>
137+
<tr>
138+
<th
139+
align="left"
140+
valign="top"
141+
width="40%"
142+
style="color: #6b7280; font-weight: 500; padding: 8px 0"
143+
>
144+
결제 일시 (Paid at)
145+
</th>
146+
<td valign="top" style="color: #111; padding: 8px 0">
147+
{{ first_paid_at }}
148+
</td>
149+
</tr>
150+
<tr>
151+
<th
152+
align="left"
153+
valign="top"
154+
width="40%"
155+
style="color: #6b7280; font-weight: 500; padding: 8px 0"
156+
>
157+
결제 금액 (Paid amount)
158+
</th>
159+
<td valign="top" style="color: #111; padding: 8px 0">
160+
{{ first_paid_price }}
161+
</td>
162+
</tr>
163+
<tr>
164+
<td colspan="2" style="padding: 24px 0 12px 0">
165+
<h2
166+
style="
167+
font-size: 14px;
168+
font-weight: 700;
169+
color: #1f3a8a;
170+
margin: 0;
171+
text-transform: uppercase;
172+
letter-spacing: 0.06em;
173+
"
174+
>
175+
주문자 정보 | CUSTOMER INFO
176+
</h2>
177+
</td>
178+
</tr>
179+
<tr>
180+
<th
181+
align="left"
182+
valign="top"
183+
width="40%"
184+
style="color: #6b7280; font-weight: 500; padding: 8px 0"
185+
>
186+
이름 (Name)
187+
</th>
188+
<td valign="top" style="color: #111; padding: 8px 0">
189+
{{ customer_name }}
190+
</td>
191+
</tr>
192+
<tr>
193+
<th
194+
align="left"
195+
valign="top"
196+
width="40%"
197+
style="color: #6b7280; font-weight: 500; padding: 8px 0"
198+
>
199+
이메일 (Email)
200+
</th>
201+
<td valign="top" style="color: #111; padding: 8px 0">
202+
{{ customer_email }}
203+
</td>
204+
</tr>
205+
<tr>
206+
<th
207+
align="left"
208+
valign="top"
209+
width="40%"
210+
style="color: #6b7280; font-weight: 500; padding: 8px 0"
211+
>
212+
연락처 (Phone)
213+
</th>
214+
<td valign="top" style="color: #111; padding: 8px 0">
215+
{{ customer_phone }}
216+
</td>
217+
</tr>
218+
</table>
219+
</td>
220+
</tr>
221+
222+
<tr>
223+
<td style="padding: 20px 24px; border-bottom: 1px solid #eef0f3">
224+
<h2
225+
style="
226+
font-size: 14px;
227+
font-weight: 700;
228+
color: #1f3a8a;
229+
margin: 0 0 12px 0;
230+
text-transform: uppercase;
231+
letter-spacing: 0.06em;
232+
"
233+
>
234+
주문 상세 확인, 영수증, 환불 관련 안내 | ORDER &amp; REFUND
235+
INFO
236+
</h2>
237+
<p style="font-size: 14px; color: #555; margin: 0 0 6px 0">
238+
주문 상세 내역과 영수증, 환불 관련 안내는
239+
<a
240+
href="https://pycon.kr"
241+
style="color: #1f3a8a; text-decoration: none"
242+
>파이콘 한국 홈페이지</a
243+
>에서 확인해주세요.
244+
</p>
245+
<p
246+
style="
247+
font-size: 13px;
248+
color: #6b7280;
249+
margin: 0 0 16px 0;
250+
line-height: 1.5;
251+
"
252+
>
253+
For more details, please visit the
254+
<a
255+
href="https://pycon.kr"
256+
style="color: #1f3a8a; text-decoration: none"
257+
>PyCon Korea homepage</a
258+
>.
259+
</p>
260+
<table
261+
role="presentation"
262+
cellpadding="0"
263+
cellspacing="0"
264+
border="0"
265+
align="center"
266+
style="margin: 0 auto"
267+
>
268+
<tr>
269+
<td align="center">
270+
<a
271+
href="https://pycon.kr"
272+
style="
273+
display: inline-block;
274+
padding: 12px 28px;
275+
background-color: #1f3a8a;
276+
color: #ffffff;
277+
text-decoration: none;
278+
border-radius: 6px;
279+
font-size: 14px;
280+
font-weight: 600;
281+
"
282+
>파이콘 한국 홈페이지 | PyCon Korea Homepage</a
283+
>
284+
</td>
285+
</tr>
286+
</table>
287+
</td>
288+
</tr>
289+
290+
<tr>
291+
<td
292+
align="center"
293+
style="
294+
padding: 20px 24px 24px 24px;
295+
background-color: #f9fafb;
296+
font-size: 12px;
297+
color: #6b7280;
298+
line-height: 1.6;
299+
"
300+
>
301+
<p style="margin: 0">
302+
본 메일은 발신 전용입니다. 문의는
303+
<a
304+
href="mailto:pycon@pycon.kr"
305+
style="color: #1f3a8a; text-decoration: none"
306+
>pycon@pycon.kr</a
307+
>
308+
으로 부탁드립니다.
309+
</p>
310+
<p style="margin: 0 0 8px 0">
311+
This is a send-only email. For inquiries, please contact
312+
<a
313+
href="mailto:pycon@pycon.kr"
314+
style="color: #1f3a8a; text-decoration: none"
315+
>pycon@pycon.kr</a
316+
>.
317+
</p>
318+
<p style="margin: 0">
319+
&copy; 파이썬 한국 사용자 모임 (Python Korea)
320+
</p>
321+
</td>
322+
</tr>
323+
</table>
324+
</td>
325+
</tr>
326+
</table>
327+
</body>
328+
</html>

0 commit comments

Comments
 (0)