[지라이슈없음] 결제가능상품 디테일 페이지 QRCodeUrl 변경

This commit is contained in:
고동영
2024-11-25 15:26:54 +09:00
parent b4a7b9d971
commit 0e5dc7c903
3 changed files with 25 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from "react";
import React, { useEffect, useMemo, useRef, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
@@ -6,6 +6,7 @@ import { getDeviceAdditionInfo } from "../../actions/deviceActions";
import { scaleH, scaleW } from "../../utils/helperMethods";
export default function TQRCode({
isBillingProductVisible,
ariaLabel,
text,
width = "128",
@@ -43,7 +44,9 @@ export default function TQRCode({
}
const qrcode = new window.QRCode(qrcodeRef.current, {
text: `${text}&entryMenu=${encodeEntryMenu}&nowMenu=${encodedNowMenu}&idx=${idx}`,
text: isBillingProductVisible
? text
: `${text}&entryMenu=${encodeEntryMenu}&nowMenu=${encodedNowMenu}&idx=${idx}`,
width: scaleW(width),
height: scaleH(height),
correctLevel: window.QRCode.CorrectLevel.L,

View File

@@ -346,6 +346,10 @@ export const getQRCodeUrl = ({
prdtId,
dirPurcSelYn = "Y",
prdtData,
qrType,
liveFlag,
entryMenu,
nowMenu,
}) => {
if (!serverHOST) {
console.error("getQRCodeUrl: Not Supported, Host is missing");
@@ -379,8 +383,11 @@ export const getQRCodeUrl = ({
const prdtDataStr = JSON.stringify(prdtData);
const prdtDataBase64 = btoa(prdtDataStr);
const encodedNowMenu = encodeURIComponent(nowMenu);
const encodeEntryMenu = encodeURIComponent(entryMenu);
return {
detailUrl: `${baseUrl}detail.jsp?patnrId=${patnrId}&prdtId=${prdtId}&cntryCd=${countryCode}&idx=${index}`,
detailUrl: `${baseUrl}billing?cntryCd=${countryCode}&entryMenu=${encodeEntryMenu}&nowMenu=${encodedNowMenu}&idx=${index}&qrType=${qrType}&prdtId=${prdtId}&liveFlag=${liveFlag}&patnrId=${patnrId}`,
checkoutUrl: `${baseUrl}checkout.jsp?patnrId=${patnrId}&dirPurcSelYn=${dirPurcSelYn}&prdtData=${prdtDataBase64}&cntryCd=${countryCode}`,
shippingAddressListUrl: `${baseUrl}address_list.jsp?from=shipping&cntryCd=${countryCode}`,
billingAddressListUrl: `${baseUrl}address_list.jsp?from=billing&cntryCd=${countryCode}`,

View File

@@ -47,6 +47,7 @@ export default function IndicatorOptions({
const serverHOST = useSelector((state) => state.common.appStatus.serverHOST);
const serverType = useSelector((state) => state.localSettings.serverType);
const { entryMenu, nowMenu } = useSelector((state) => state.common.menu);
const { popupVisible, activePopup } = useSelector(
(state) => state.common.popup
@@ -102,8 +103,12 @@ export default function IndicatorOptions({
index: deviceInfo?.dvcIndex,
patnrId: productInfo?.patnrId,
prdtId: productInfo?.prdtId,
entryMenu: entryMenu,
nowMenu: nowMenu,
liveFlag: "Y",
qrType: "billingDetail",
});
}, [serverHOST, serverType, deviceInfo, productInfo]);
}, [serverHOST, serverType, deviceInfo, entryMenu, nowMenu, productInfo]);
const qrCodeUrl = useMemo(() => {
if (!isBillingProductVisible) return productInfo?.qrcodeUrl;
@@ -275,7 +280,12 @@ export default function IndicatorOptions({
{productInfo?.qrImgUrl ? (
productInfo?.qrImgUrl
) : (
<TQRCode text={qrCodeUrl} width="160" height="160" />
<TQRCode
text={qrCodeUrl}
isBillingProductVisible={isBillingProductVisible}
width="160"
height="160"
/>
)}
<div className={css.tooltip}>
<div className={css.tooltipBody}>{tooltipDes}</div>