주문 결제 개선 및 결제취소 조회 인증 만료 처리

- 일반·구독 주문서(PC/모바일) 통화 라벨 표기, 통화 전환 시 첫 결제수단 자동 선택
- Stripe 이메일 자동 입력, 복귀 주소 설정 우선 적용, 진입 이력 GET 처리, 취소 안내·결제결과 회전 표시
- 일반 Stripe 상품명 전체 병 수 요약, 구독 주문은 구독서비스명을 PG에 전달
- 재고 부족 시 상품명·주문 수량·구매 가능 수량 안내
- 결제취소 조회 인증 만료 안내·로그인 이동, 조회 GET 전환, 중복 리다이렉트 종료
- 관련 Java·JS 테스트 추가

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
이주일
2026-11-05 14:34:23 +09:00
parent fa3a84793f
commit 6ac836b5c6
27 changed files with 1069 additions and 102 deletions

View File

@@ -0,0 +1,46 @@
/* 결제취소 화면 조회 전용. 실제 취소/환불 요청은 처리하지 않는다. */
async function fn_load_refund_popup(url, data, onReady) {
const requestUrl = new URL(url, window.location.href);
Object.entries(data).forEach(([key, value]) => requestUrl.searchParams.set(key, value));
const loginRequired = function () {
window.alert('로그인 시간이 만료되었습니다. 다시 로그인해 주세요.');
const loginUrl = new URL('/sopmal/login', window.location.href);
// 로그인 후 AJAX 팝업 주소가 아닌 원래 주문 상세로 돌아온다.
loginUrl.searchParams.set('redirect_uri', window.location.href);
window.location.assign(loginUrl.href);
};
try {
// 갱신 후 리다이렉트에서도 주문 조회 조건이 유지되도록 GET으로 요청한다.
const response = await fetch(requestUrl.href, {
method: 'GET',
credentials: 'same-origin',
cache: 'no-store',
headers: {'X-Requested-With': 'XMLHttpRequest'}
});
const finalUrl = new URL(response.url || requestUrl.href, window.location.href);
if (response.status === 401 || (response.redirected &&
/^\/sopmal\/(login(?:\/|$)|logout(?:\/|$)|main(?:\/|$))/.test(finalUrl.pathname))) {
loginRequired();
return;
}
if (!response.ok || finalUrl.origin !== requestUrl.origin || finalUrl.pathname !== requestUrl.pathname) {
throw new Error('Unexpected refund popup response');
}
// 로그인 HTML이나 빈 응답은 화면에 넣지 않는다. 반환된 스크립트도 실행하지 않는다.
const html = await response.text();
const parsed = new DOMParser().parseFromString(html, 'text/html');
const popup = parsed.querySelector('#refund-pop');
if (!popup) {
throw new Error('Missing refund popup');
}
popup.querySelectorAll('script').forEach(script => script.remove());
$('#refund-pop').remove();
$('#refundPopupDiv').empty().append(popup);
onReady($(popup));
} catch (error) {
window.alert('결제취소 화면을 불러오지 못했습니다. 잠시 후 다시 시도해 주세요.');
}
}