<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ page import="cokr.xit.ens.modules.common.ctgy.intgrnbill.nv.code.NvEpCardCd" %>
<%@ page import="cokr.xit.ens.modules.common.ctgy.intgrnbill.nv.code.NvEpBankCd" %>
<!DOCTYPE html>
<html data-useragent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">

    <c:set var="ctx" value="${pageContext.request.contextPath}"/>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <link rel="stylesheet" href="${ctx }/resource/bill/css/nvep/nvEpDetail.css"/>
    <link rel="stylesheet" href="${ctx }/resource/bill/css/nvep/nvEpLayout.css"/>
    <link rel="stylesheet" href="${ctx }/resource/bill/css/nvep/nvEpComponent.css"/>

    <title>네이버페이</title>


    <style>
        .result_message {
            text-align: center;
            color: #09aa5c;
            font-size: 1.5rem;
            letter-spacing: -0.5px;
            font-weight: 600;
            position: relative;
            padding: 15px 0px 11px;
        }
    </style>
    <script>
        window.onload = () => {
            notRefresh();
        }

        var notRefresh = () => {
            document.body.style.overscrollBehaviorY = 'none';
            history.pushState(null, null, location.origin + location.pathname);
        }
    </script>
</head>
<body>
<%--<div id="header" class="type_basic">--%>
<!-- header -->
<div id="header" class="type_end">
    <div class="gnb">
        <a href="https://m.pay.naver.com/inflow/outlink?url=https%3A%2F%2Fsmartstore.naver.com"
           class="NONE absolutev logo_npay">
            <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="60" height="23"
                 viewBox="0 0 60 23">
                <defs>
                    <path id="prefix__a" d="M0 23L60 23 60 0 0 0z"></path>
                </defs>
                <g fill="none" fill-rule="evenodd">
                    <path fill="#03C75A"
                          d="M30.688 6.563v4.2h2.4c1.587 0 2.551-.495 2.551-2.036v-.33c0-1.45-.964-1.834-2.343-1.834h-2.608zM28.27 4.6h5.14c3.27 0 4.668 1.614 4.668 3.778v.386c0 2.146-1.512 3.98-4.668 3.98h-2.72v5.081h-2.42V4.6zM45.528 13.137h-2.32c-1.243 0-1.677.517-1.677 1.34v.23c0 .688.49 1.09 1.414 1.09 1 0 1.66-.21 2.15-.708.433-.421.433-.88.433-1.665v-.287zm-6.297 1.741v-.612c0-1.722.999-3.004 3.921-3.004h2.376v-.401c0-1.302-.566-1.837-1.848-1.837-1.112 0-2.074.363-2.94 1.052l-1.17-1.76C40.626 7.57 41.927 6.9 43.7 6.9c2.431 0 4.185 1.244 4.185 3.367v7.405h-2.131l-.038-1.301c-.395.937-1.866 1.454-2.96 1.454-2.224 0-3.525-1.09-3.525-2.947zM52.211 6.9L54.529 14.401 54.603 14.401 56.939 6.9 59.423 6.9 54.121 21.275 51.933 20.519 53.249 17.184 49.615 6.9z"></path>
                    <mask id="prefix__b" fill="#fff">
                        <use xlink:href="#prefix__a"></use>
                    </mask>
                    <path fill="#03C75A" d="M0 23L23.077 23 23.077 0    0 0z" mask="url(#prefix__b)"></path>
                    <path fill="#FFF"
                          d="M16.731 17.25L13.362 17.25 9.298 11.095 9.298 17.25 5.769 17.25 5.769 5.75 9.138 5.75 13.202 11.905 13.202 5.75 16.731 5.75z"
                          mask="url(#prefix__b)"></path>
                </g>
            </svg>
            <span class="blind">네이버페이</span>
        </a>
        <h1 class="pageh1">결제 상세정보</h1>

    </div>
</div>
<%--</div>--%>
<div id="container" role="main">

    <c:choose>
    <c:when test="${code eq 'Success' }">
    <div class="detail_section result_message">
        <strong>결제가 정상 처리 되었습니다</strong>
    </div>
    <div id="content">
        <div class="detail_section ordernum_sc">
            <div class="ordernum">
                <p class="number"><c:out value="${body.paymentId}"/>(결제번호)</p>
                <fmt:parseDate var="tradeConfirmYmdt" value="${body.detail.tradeConfirmYmdt}" pattern="yyyyMMddHHmmss"/>
                <span class="date"><fmt:formatDate value="${tradeConfirmYmdt}" pattern="yyyy.MM.dd"/></span>
            </div>
        </div>
    </div>

    <div class="detail_section">
        <!-- 가맹점 정보 -->
        <div class="sellerinfo_area">
            <div class="seller_box">
                <div class="seller_cell ellipsis">
                    <div class="seller_inner">
                        <span class="icon_seller">
                            <span class="blind">가맹점</span>
                        </span>
                        <a class="seller_link ellipsis"
                           href="https://m.pay.naver.com/inflow/outlink?url=https%3A%2F%2Fsmartstore.naver.com">
                            <c:out value="${body.detail.merchantName}"/>
                        </a>
                    </div>
                </div>
            </div>
        </div>
        <ul class="order_list">
            <!-- 상품정보 -->
            <li>
                <div class="info_area ">
                    <div class="info_head">
                        <h3 class="h3">상품명</h3>
                        <strong class="detail_order_price"><c:out value="${body.detail.productName}"/></strong>
                    </div>
                </div>
            </li>
        </ul>
    </div>

    <!-- 결제금액 -->
    <div class="detail_section type_payment_info">
        <div class="info_area ">
            <div class="info_head">
                <h3 class="h3">결제금액</h3>
                <strong class="detail_order_price"><fmt:formatNumber value="${body.detail.totalPayAmount}"
                                                                     pattern="###,###,###"/>원</strong>
            </div>
            <div class="info_cont">
                <ul class="info_list">
                    <li>
                        <div class="total">
                            <strong>과세금액</strong>
                            <em class="amount"><span><fmt:formatNumber value="${body.detail.taxScopeAmount}"
                                                                       pattern="###,###,###"/></span>원</em>
                        </div>
                    </li>
                    <c:if test="${body.detail.taxExScopeAmount > 0}">
                        <li>
                            <div class="total">
                                <strong>면세금액</strong>
                                <em class="amount"><span><fmt:formatNumber value="${body.detail.taxExScopeAmount}"
                                                                           pattern="###,###,###"/></span>원</em>
                            </div>
                        </li>
                    </c:if>
                    <c:if test="${body.detail.environmentDepositAmount > 0}">
                        <li>
                            <div class="total">
                                <strong>컵 보증금</strong>
                                <em class="amount"><span><fmt:formatNumber
                                        value="${body.detail.environmentDepositAmount}" pattern="###,###,###"/></span>원</em>
                            </div>
                        </li>
                    </c:if>
                </ul>
            </div>
        </div>
    </div>
    <!-- 결제상세 -->
    <div class="detail_section type_payment_info">
        <div class="info_area">
            <div class="info_head">
                <h3 class="h3">결제상세</h3>
            </div>
            <div class="info_cont">
                <ul class="info_list">
                    <!-- 결제방법-네이버페이 포인트/머니 -->
                    <c:if test="${body.detail.npointPayAmount > 0}">
                        <li>
                            <div class="total">
                                <strong>네이버페이 포인트/머니 사용</strong>
                                <p class="amount"><span><fmt:formatNumber value="${body.detail.npointPayAmount}"
                                                                          pattern="###,###,###"/></span>원</p>
                            </div>
                        </li>
                    </c:if>
                    <!-- 결제방법-기프트카드 -->
                    <c:if test="${body.detail.giftCardAmount > 0}">
                        <li class="type_main_payment">
                            <strong>기프트카드 결제</strong>
                            <em class="amount"><span><fmt:formatNumber value="${body.detail.giftCardAmount}"
                                                                       pattern="###,###,###"/></span>원</em>
                        </li>
                    </c:if>
                    <!-- 결제방법-계좌이체 -->
                    <c:if test="${body.detail.primaryPayMeans eq 'BANK'}">
                        <li class="type_main_payment">
                            <strong>계좌이체</strong>
                            <em class="amount"><span><fmt:formatNumber value="${body.detail.primaryPayAmount}"
                                                                       pattern="###,###,###"/></span>원</em>
                            <div class="payment_detail_info">
                                <c:out value="${NvEpBankCd.valueOf('B' += body.detail.bankCorpCode).codeNm}"/>
                                (<c:out value="${body.detail.bankAccountNo}"/>)
                            </div>
                        </li>
                    </c:if>
                    <!-- 결제방법-카드간편결제 -->
                    <c:if test="${body.detail.primaryPayMeans eq 'CARD'}">
                        <li class="type_main_payment">
                            <strong>카드 간편결제</strong>
                            <em class="amount"><span><fmt:formatNumber value="${body.detail.primaryPayAmount}"
                                                                       pattern="###,###,###"/></span>원</em>
                            <div class="payment_detail_info">
                                <c:out value="${NvEpCardCd.valueOf(body.detail.cardCorpCode).codeNm}"/>
                                (<c:out value="${body.detail.cardNo}"/>)
                                <span class="card_payment_type">
                                <fmt:formatNumber var="cardInstCount" value="${body.detail.cardInstCount}"
                                                  pattern="###,###,###"/>
                                <c:out value="${cardInstCount == 0 ? '일시불' :  '('+= cardInstCount += '개월)할부'}"/>
                            </span>
                            </div>
                            <ul class="dot_list type_round">
                                <li>카드에 BC 마크가 없는 경우 무이자 할부 적용 불가</li>
                                <li>무이자 적용 여부는 카드사로 문의하시면 정확하게 확인할 수 있습니다.</li>
                            </ul>
                        </li>
                    </c:if>
                </ul>
            </div>
        </div>
    </div>


</div>
</c:when>
<c:otherwise>
    <div class="detail_section result_message">
        <strong>결제 처리에 실패 했습니다</strong>
    </div>
    <!-- 실패사유 -->
    <div class="detail_section type_payment_info">
        <div class="info_area">
            <div class="info_head">
                <h3 class="h3">실패 사유</h3>
            </div>
            <div class="info_cont">
                <ul class="info_list">
                    <li>
                        <div class="total">
                            <strong>코드</strong>
                            <p class="amount"><span><c:out value="${code}"/></span></p>
                        </div>
                    </li>
                    <li>
                        <div class="total">
                            <strong>메시지</strong>
                            <p class="amount"><span><c:out value="${message}"/></span></p>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</c:otherwise>
</c:choose>
</div>

</body>


</html>
