Merge pull request 'srinath' (#313) from srinath into main

Reviewed-on: Pozomind/pozo-retail-app#313
This commit is contained in:
karthikalakshmi 2026-03-26 12:07:43 +05:30
commit 286fefede5
8 changed files with 557 additions and 402 deletions

View File

@ -1416,6 +1416,13 @@ export const getOtherServiceTicket = createAsyncThunk(
}
}
);
// post /cancelPayment
export const PostCancelPayment = createAsyncThunk(
'BookingData/cancelPayment',
async (postData) => {
return await axiosRetailInstanceData.post(`/cancelPayment`, postData);
}
);
export const PostBlockSlots = createAsyncThunk(
'BookingData/PostBlockSlots',
async (postData) => {
@ -1444,6 +1451,7 @@ export const getPaymentStatusForBusinessUPI = createAsyncThunk(
}
);
export const getCurrentOrderid = createAsyncThunk(
'BookingData/getcurrentorderid',

View File

@ -127,6 +127,7 @@ import {
changeSearchedData,
GlobalSelectedCustDisable,
GlobalOrderStatus,
PostCancelPayment,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
import {
@ -944,7 +945,7 @@ export default function BST1Payment() {
const selectedStyle =
stylesMap[
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
];
if (selectedStyle) {
@ -1392,6 +1393,15 @@ export default function BST1Payment() {
: AddBookingDetails(BookingType, true);
}
};
// PostCancelPayment
const CancelPayment = async () => {
const response = await dispatch(PostCancelPayment({OrderId: businessUPIOrderId})).unwrap()
if (response?.data?.statusCode) {
ClearAllGlobalStateDatas();
CustomerDisplay();
setBusinessUPI(false);
}
}
const financialYearError = async () => {
setMessageType('error');
setMessageData('Financial Year-Based Sales Not Yet Started');
@ -2069,15 +2079,15 @@ export default function BST1Payment() {
OrderStatus: 'O',
OrderType:
BookingType === 'Dine In' ||
BookingTypeBoth ||
Estimation?.SettingValue == 'N'
BookingTypeBoth ||
Estimation?.SettingValue == 'N'
? 'S'
: GlobEstBooking === 'OvrAllEst'
? 'E'
: GlobEstBooking === 'ParEst'
? GlobProdwisedata?.includes(
a.InwardDtlId + ' ' + a?.BookingTypeName
)
a.InwardDtlId + ' ' + a?.BookingTypeName
)
? 'E'
: 'S'
: 'S',
@ -2170,7 +2180,7 @@ export default function BST1Payment() {
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
OrderDtlDetails:
@ -2187,9 +2197,9 @@ export default function BST1Payment() {
? globalTipAmount === 0
? SelectedTableDetails
: SelectedTableDetails?.map((item) => ({
...item,
TipsAmount: globalTipAmount,
}))
...item,
TipsAmount: globalTipAmount,
}))
: null,
SalesPaymentType: 'normal',
@ -2205,8 +2215,8 @@ export default function BST1Payment() {
? PaymentgatewayUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.ModeId
(busupi) => busupi?.ModeId === UpiId
)?.ModeId
: paybtnselected
: paybtnselected
? paybtnselected
@ -2219,15 +2229,15 @@ export default function BST1Payment() {
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business'
SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId
?.MerchantId
: null,
PaymentOptionType:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC'
@ -2247,29 +2257,29 @@ export default function BST1Payment() {
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId
?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null,
AccountDtl:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId
)
(upipay) => upipay?.UPIId === UpiId
)
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'pd') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pd')
SelectedUPIPayOption?.toLowerCase() === 'pd') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pd')
? useOptions?.[0]?.PaymentDetails?.PaymentDevice
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'pg') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pg')
SelectedUPIPayOption?.toLowerCase() === 'pg') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [],
PaymentStatus:
@ -2280,13 +2290,13 @@ export default function BST1Payment() {
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
Debit:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
@ -2362,14 +2372,14 @@ export default function BST1Payment() {
setMessageType('success');
setMessageData(
response?.data?.response +
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
);
response?.data?.OrderDetails?.length > 0 &&
setPrintOrderDetails([response?.data]);
@ -2526,14 +2536,14 @@ export default function BST1Payment() {
setMessageType('success');
setMessageData(
response?.data?.response +
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
);
response?.data?.OrderDetails?.length > 0 &&
setPrintOrderDetails([response?.data]);
@ -2634,14 +2644,14 @@ export default function BST1Payment() {
}
setMessageData(
response?.data?.response +
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
);
if (response?.data?.OrderDetails?.length > 0) {
setPrintOrderDetails([response?.data]);
@ -2816,14 +2826,14 @@ export default function BST1Payment() {
setMessageType('success');
setMessageData(
bookingpaymentupdate?.data?.response +
' ' +
(bookingpaymentupdate?.data?.OrderDetails?.length > 0
? bookingpaymentupdate?.data?.OrderId &&
extractLastNumberOrderId(
bookingpaymentupdate?.data?.OrderId,
bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
)
: '')
' ' +
(bookingpaymentupdate?.data?.OrderDetails?.length > 0
? bookingpaymentupdate?.data?.OrderId &&
extractLastNumberOrderId(
bookingpaymentupdate?.data?.OrderId,
bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
)
: '')
);
bookingpaymentupdate?.data?.OrderDetails?.length > 0 &&
setPrintOrderDetails([bookingpaymentupdate?.data]);
@ -2841,7 +2851,7 @@ export default function BST1Payment() {
if (
Date.now() - startTime >
useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes *
60000
60000
) {
// 60,000 ms = 1 minute
@ -3650,29 +3660,29 @@ export default function BST1Payment() {
{tableOptions.find(
(item) => item.OptionName === 'AddCustomer'
) && (
<div
style={{
display: 'flex',
alignItems: 'center',
columnGap: '0.5rem',
}}
>
<BSCustomerSelect />
<div
style={{
display: 'flex',
alignItems: 'center',
columnGap: '0.5rem',
}}
>
<BSCustomerSelect />
<TooltipWrapper title={'Add Customer'} isMobile={isMobile}>
{' '}
<PozoAddCustomerIcon
className="BSBillingNav-icon-table-icon"
onClick={handleAddCustomer}
style={{
fontSize: '25px',
color: selOption || GetCustId ? '#52c41a' : '#1292EE',
cursor: Custdisable ? 'not-allowed' : 'pointer',
}}
/>
</TooltipWrapper>
</div>
)}
<TooltipWrapper title={'Add Customer'} isMobile={isMobile}>
{' '}
<PozoAddCustomerIcon
className="BSBillingNav-icon-table-icon"
onClick={handleAddCustomer}
style={{
fontSize: '25px',
color: selOption || GetCustId ? '#52c41a' : '#1292EE',
cursor: Custdisable ? 'not-allowed' : 'pointer',
}}
/>
</TooltipWrapper>
</div>
)}
</div>
</div>
</div>
@ -3735,31 +3745,31 @@ export default function BST1Payment() {
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 'none'
: 'auto',
opacity:
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 0.5
: 1,
}}
>
{paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => (
<div className="Table3-cash">
<button
className={
paybtnselected === payment.ModeId &&
(UpinotSelected || CardoptionnotSelected)
(UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel'
: paybtnselected === payment.ModeId &&
(!UpinotSelected || !CardoptionnotSelected)
(!UpinotSelected || !CardoptionnotSelected)
? 'Btn-payment-mode'
: 'Btn-payment-mode-sel'
}
@ -3773,13 +3783,13 @@ export default function BST1Payment() {
onClick={() =>
payment?.ModeName?.toLowerCase() === 'upi' // Change the condition to payment.Id
? handleUPIButtonClick(
payment.ModeId,
payment.ModeName
)
payment.ModeId,
payment.ModeName
)
: handlePaymentMode(
payment.ModeId,
payment.ModeName
)
payment.ModeId,
payment.ModeName
)
}
>
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -3838,10 +3848,10 @@ export default function BST1Payment() {
<button
className={
refundPaySelected === payment.ConfigId &&
(UpinotSelected || CardoptionnotSelected)
(UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel'
: refundPaySelected === payment.ConfigId &&
(!UpinotSelected || !CardoptionnotSelected)
(!UpinotSelected || !CardoptionnotSelected)
? 'Btn-payment-mode'
: 'Btn-payment-mode-sel'
}
@ -3916,9 +3926,9 @@ export default function BST1Payment() {
OrderCardDetail?.length > 0 && 'not-allowed',
color:
OrderCardDetail?.length > 0 ||
(selOption?.value === undefined &&
GlobalAddCustomerDetails1?.length === 0 &&
GetCustId?.CustMobile === undefined)
(selOption?.value === undefined &&
GlobalAddCustomerDetails1?.length === 0 &&
GetCustId?.CustMobile === undefined)
? 'gray'
: 'rgb(18, 146, 238)',
fontSize: '28px',
@ -3968,16 +3978,16 @@ export default function BST1Payment() {
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 'none'
: 'auto',
opacity:
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 0.5
: 1,
}}
@ -3996,14 +4006,14 @@ export default function BST1Payment() {
width: '1.5rem',
cursor:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'not-allowed'
: 'pointer',
color:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'gray'
: 'rgb(18, 146, 238)',
display: 'flex',
@ -4040,8 +4050,8 @@ export default function BST1Payment() {
cursor: OrderCardDetail?.length > 0 && 'not-allowed',
color:
OrderCardDetail?.length > 0 ||
(OrderCardDetail?.length > 0 &&
GetCustId?.CustMobile === undefined)
(OrderCardDetail?.length > 0 &&
GetCustId?.CustMobile === undefined)
? 'gray'
: 'rgb(18, 146, 238)',
fontSize: '25px',
@ -4070,14 +4080,14 @@ export default function BST1Payment() {
width: '1.5rem',
cursor:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'not-allowed'
: 'pointer',
color:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'gray'
: 'rgb(18, 146, 238)',
display: 'flex',
@ -4159,58 +4169,58 @@ export default function BST1Payment() {
<div>
{unpaidFlow == false
? holdCheckedSalesSetup &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
OrderCardDetail?.length != 0 &&
CheckOrderType?.length === 0 &&
OrderType != 'Failed' &&
CheckBookingStatus != 'Close' &&
paybtns?.length > 0 &&
!addnewAccess && (
<TooltipWrapper title={'Hold'} isMobile={isMobile}>
{' '}
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => AddBookingDetails('Hold')}
style={{
fontSize: '30px',
cursor: 'pointer',
color: '' ? '#52c41a' : '#1292EE',
}}
/>
</TooltipWrapper>
)
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
OrderCardDetail?.length != 0 &&
CheckOrderType?.length === 0 &&
OrderType != 'Failed' &&
CheckBookingStatus != 'Close' &&
paybtns?.length > 0 &&
!addnewAccess && (
<TooltipWrapper title={'Hold'} isMobile={isMobile}>
{' '}
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => AddBookingDetails('Hold')}
style={{
fontSize: '30px',
cursor: 'pointer',
color: '' ? '#52c41a' : '#1292EE',
}}
/>
</TooltipWrapper>
)
: ''}
{unpaidFlow == false
? holdCheckedSalesSetup &&
paybtns?.length > 0 &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
Holddata?.length > 0 &&
OrderCardDetail?.length == 0 &&
CheckBookingStatus != 'Close' &&
!addnewAccess && (
<TooltipWrapper title={'Recall'} isMobile={isMobile}>
{' '}
<Badge
count={Holddata?.length}
size={'small'}
offset={[0, 7]}
>
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => HandleholdModelOpen()}
style={{
fontSize: '28px',
cursor: 'pointer',
color: Holddata ? '#52c41a' : 'default',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
/>
</Badge>
</TooltipWrapper>
)
paybtns?.length > 0 &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
Holddata?.length > 0 &&
OrderCardDetail?.length == 0 &&
CheckBookingStatus != 'Close' &&
!addnewAccess && (
<TooltipWrapper title={'Recall'} isMobile={isMobile}>
{' '}
<Badge
count={Holddata?.length}
size={'small'}
offset={[0, 7]}
>
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => HandleholdModelOpen()}
style={{
fontSize: '28px',
cursor: 'pointer',
color: Holddata ? '#52c41a' : 'default',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
/>
</Badge>
</TooltipWrapper>
)
: ''}
</div>
)}
@ -4253,9 +4263,9 @@ export default function BST1Payment() {
addnewAccess
? 'price-button-disabled'
: FirstPaymentclick === false &&
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
? !OrderStatus
? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
@ -4277,7 +4287,7 @@ export default function BST1Payment() {
{isMobile ? (
!OrderStatus ? (
salesBillEdit &&
currentOrderNetAmount < previousNetAmount ? (
currentOrderNetAmount < previousNetAmount ? (
<div>
Refund:
{(previousNetAmount || 0) -
@ -4503,14 +4513,14 @@ export default function BST1Payment() {
OrderType === 'Failed'
? FailedTotalAmt
: Math.round(
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))
)
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))
)
}
failedOrderData={failedOrderData}
/>
@ -4643,9 +4653,9 @@ export default function BST1Payment() {
const qty = isGroup
? OrderCardDetail.filter((o) => o.id === groupKey).reduce(
(sum, o) => sum + (o.OrderQty || 1),
0
)
(sum, o) => sum + (o.OrderQty || 1),
0
)
: item.OrderQty || 1;
return (
@ -4728,6 +4738,7 @@ export default function BST1Payment() {
handleCancel={() => setShowCancelConfirm(true)}
footer={false}
width={500}
destroyOnClose={true}
children={
<>
<PaymentGatewayEmbedded
@ -4744,14 +4755,27 @@ export default function BST1Payment() {
}
/>
{showCancelConfirm && (
// <Modal
// open={showCancelConfirm}
// title="Cancel Payment"
// onOk={() => {
// setBusinessUPI(false);
// setShowCancelConfirm(false);
// ClearAllGlobalStateDatas();
// CustomerDisplay();
// }}
// onCancel={() => setShowCancelConfirm(false)}
// okText="Yes"
// cancelText="No"
// >
// Do you want to cancel the payment?
// </Modal>
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setBusinessUPI(false);
setShowCancelConfirm(false);
ClearAllGlobalStateDatas();
CustomerDisplay();
CancelPayment()
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"

View File

@ -141,6 +141,7 @@ import {
changePreviousOrderOfferDetail,
GlobalAllBookingType,
changeSearchedData,
PostCancelPayment,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import { PrintStyleFunction } from '../../../../paymentpdfPage/PrintStyleFunction.js';
import FeaturesFunctionalities from '../../BookingFunctionality/FeaturesFunctionalities';
@ -1035,7 +1036,7 @@ const BSBillingTable3Pay = () => {
const selectedStyle =
stylesMap[
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle
];
if (selectedStyle) {
@ -1574,7 +1575,15 @@ const BSBillingTable3Pay = () => {
: AddBookingDetails(BookingType, true);
}
};
// PostCancelPayment
const CancelPayment = async () => {
const response = await dispatch(PostCancelPayment({OrderId: businessUPIOrderId})).unwrap()
if (response?.data?.statusCode) {
ClearAllGlobalStateDatas();
CustomerDisplay();
setBusinessUPI(false);
}
}
const financialYearError = async () => {
setMessageType('error');
setMessageData('Financial Year-Based Sales Not Yet Started');
@ -2261,15 +2270,15 @@ const BSBillingTable3Pay = () => {
OrderStatus: 'O',
OrderType:
BookingType === 'Dine In' ||
BookingTypeBoth ||
Estimation?.SettingValue == 'N'
BookingTypeBoth ||
Estimation?.SettingValue == 'N'
? 'S'
: GlobEstBooking === 'OvrAllEst'
? 'E'
: GlobEstBooking === 'ParEst'
? GlobProdwisedata?.includes(
a.InwardDtlId + ' ' + a?.BookingTypeName
)
a.InwardDtlId + ' ' + a?.BookingTypeName
)
? 'E'
: 'S'
: 'S',
@ -2364,7 +2373,7 @@ const BSBillingTable3Pay = () => {
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
OrderDtlDetails:
@ -2381,9 +2390,9 @@ const BSBillingTable3Pay = () => {
? globalTipAmount === 0
? SelectedTableDetails
: SelectedTableDetails?.map((item) => ({
...item,
TipsAmount: globalTipAmount,
}))
...item,
TipsAmount: globalTipAmount,
}))
: null,
SalesPaymentType: 'normal',
PaymentDetail: [
@ -2398,8 +2407,8 @@ const BSBillingTable3Pay = () => {
? PaymentgatewayUPI?.[0]?.ModeId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.ModeId
(busupi) => busupi?.ModeId === UpiId
)?.ModeId
: paybtnselected
: paybtnselected
? paybtnselected
@ -2412,15 +2421,15 @@ const BSBillingTable3Pay = () => {
salesBillEdit && currentOrderNetAmount < previousNetAmount
? null
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'business'
SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId)
?.MerchantId
?.MerchantId
: null,
PaymentOptionType:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
currentOrderNetAmount < previousNetAmount &&
(refundPaySelectedName?.toLowerCase() === 'cash' ||
refundPaySelectedName?.toLowerCase() === 'credit')
? 'PC'
: Paybtnnameselected?.toLowerCase() === 'cash'
? 'PC'
@ -2440,29 +2449,29 @@ const BSBillingTable3Pay = () => {
? null
: SelectedUPIPayOption?.toLowerCase() === 'default'
? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId)
?.UPIDetailId
?.UPIDetailId
: SelectedUPIPayOption?.toLowerCase() === 'business'
? BusinessPayOption?.find(
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
(busupi) => busupi?.ModeId === UpiId
)?.MerchantUPIId
: null,
AccountDtl:
salesBillEdit && currentOrderNetAmount < previousNetAmount
? []
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find(
(upipay) => upipay?.UPIId === UpiId
)
(upipay) => upipay?.UPIId === UpiId
)
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'pd') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pd')
SelectedUPIPayOption?.toLowerCase() === 'pd') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pd')
? useOptions?.[0]?.PaymentDetails?.PaymentDevice
: (Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'pg') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pg')
SelectedUPIPayOption?.toLowerCase() === 'pg') ||
(Paybtnnameselected?.toLowerCase() === 'card' &&
SelectedCardOption?.toLowerCase() === 'pg')
? useOptions?.[0]?.PaymentDetails?.PaymentGateway
: [],
PaymentStatus:
@ -2473,13 +2482,13 @@ const BSBillingTable3Pay = () => {
: Paybtnnameselected?.toLowerCase() === 'credit'
? 'S'
: Paybtnnameselected?.toLowerCase() === 'upi' &&
SelectedUPIPayOption?.toLowerCase() === 'default'
SelectedUPIPayOption?.toLowerCase() === 'default'
? 'S'
: 'P',
Debit:
salesBillEdit &&
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
currentOrderNetAmount < previousNetAmount &&
refundPaySelectedName?.toLowerCase() === 'credit'
? Math.round(previousNetAmount - currentOrderNetAmount)
: 0,
Credit: salesBillEdit
@ -2557,14 +2566,14 @@ const BSBillingTable3Pay = () => {
setMessageType('success');
setMessageData(
response?.data?.response +
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
);
response?.data?.OrderDetails?.length > 0 &&
setPrintOrderDetails([response?.data]);
@ -2724,14 +2733,14 @@ const BSBillingTable3Pay = () => {
setMessageType('success');
setMessageData(
response?.data?.response +
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
);
response?.data?.OrderDetails?.length > 0 &&
setPrintOrderDetails([response?.data]);
@ -2834,14 +2843,14 @@ const BSBillingTable3Pay = () => {
}
setMessageData(
response?.data?.response +
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
' ' +
(response?.data?.OrderDetails?.length > 0
? response?.data?.OrderId &&
extractLastNumberOrderId(
response?.data?.OrderId,
response?.data?.OrderDetails?.[0]?.FYStatus
)
: '')
);
if (response?.data?.OrderDetails?.length > 0) {
setPrintOrderDetails([response?.data]);
@ -3018,14 +3027,14 @@ const BSBillingTable3Pay = () => {
setMessageType('success');
setMessageData(
bookingpaymentupdate?.data?.response +
' ' +
(bookingpaymentupdate?.data?.OrderDetails?.length > 0
? bookingpaymentupdate?.data?.OrderId &&
extractLastNumberOrderId(
bookingpaymentupdate?.data?.OrderId,
bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
)
: '')
' ' +
(bookingpaymentupdate?.data?.OrderDetails?.length > 0
? bookingpaymentupdate?.data?.OrderId &&
extractLastNumberOrderId(
bookingpaymentupdate?.data?.OrderId,
bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus
)
: '')
);
bookingpaymentupdate?.data?.OrderDetails?.length > 0 &&
setPrintOrderDetails([bookingpaymentupdate?.data]);
@ -3044,7 +3053,7 @@ const BSBillingTable3Pay = () => {
if (
Date.now() - startTime >
useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes *
60000
60000
) {
// 60,000 ms = 1 minute
@ -3751,9 +3760,9 @@ const BSBillingTable3Pay = () => {
'not-allowed',
color:
OrderCardDetail?.length > 0 ||
(selOption?.value === undefined &&
GlobalAddCustomerDetails1?.length === 0 &&
GetCustId?.CustMobile === undefined)
(selOption?.value === undefined &&
GlobalAddCustomerDetails1?.length === 0 &&
GetCustId?.CustMobile === undefined)
? 'gray'
: 'rgb(18, 146, 238)',
fontSize: '28px',
@ -3775,16 +3784,16 @@ const BSBillingTable3Pay = () => {
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 'none'
: 'auto',
opacity:
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 0.5
: 1,
width: '2rem',
@ -3807,14 +3816,14 @@ const BSBillingTable3Pay = () => {
width: '1.5rem',
cursor:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'not-allowed'
: 'pointer',
color:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'gray'
: 'rgb(18, 146, 238)',
display: 'flex',
@ -3850,8 +3859,8 @@ const BSBillingTable3Pay = () => {
cursor: OrderCardDetail?.length > 0 && 'not-allowed',
color:
OrderCardDetail?.length > 0 ||
(OrderCardDetail?.length > 0 &&
GetCustId?.CustMobile === undefined)
(OrderCardDetail?.length > 0 &&
GetCustId?.CustMobile === undefined)
? 'gray'
: 'rgb(18, 146, 238)',
fontSize: '25px',
@ -3938,65 +3947,65 @@ const BSBillingTable3Pay = () => {
<>
{unpaidFlow == false
? item?.OptionName == 'Hold' &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
OrderCardDetail?.length != 0 &&
CheckOrderType?.length === 0 &&
OrderType != 'Failed' &&
CheckBookingStatus != 'Close' &&
paybtns?.length > 0 &&
!addnewAccess && (
<TooltipWrapper
title={'Hold (Alt+W)'}
isMobile={isMobile}
>
{' '}
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => AddBookingDetails('Hold', false)}
style={{
fontSize: '30px',
cursor: 'pointer',
color: '' ? '#52c41a' : '#1292EE',
}}
/>
</TooltipWrapper>
)
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
OrderCardDetail?.length != 0 &&
CheckOrderType?.length === 0 &&
OrderType != 'Failed' &&
CheckBookingStatus != 'Close' &&
paybtns?.length > 0 &&
!addnewAccess && (
<TooltipWrapper
title={'Hold (Alt+W)'}
isMobile={isMobile}
>
{' '}
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => AddBookingDetails('Hold', false)}
style={{
fontSize: '30px',
cursor: 'pointer',
color: '' ? '#52c41a' : '#1292EE',
}}
/>
</TooltipWrapper>
)
: ''}
{unpaidFlow == false
? item?.OptionName == 'Hold' &&
paybtns?.length > 0 &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
Holddata?.length > 0 &&
OrderCardDetail?.length == 0 &&
CheckBookingStatus != 'Close' &&
!addnewAccess && (
<TooltipWrapper
title={'Recall (Alt+W)'}
isMobile={isMobile}
paybtns?.length > 0 &&
BookingType !== 'Dine In' &&
!BookingTypeBoth &&
Holddata?.length > 0 &&
OrderCardDetail?.length == 0 &&
CheckBookingStatus != 'Close' &&
!addnewAccess && (
<TooltipWrapper
title={'Recall (Alt+W)'}
isMobile={isMobile}
>
{' '}
<Badge
count={Holddata?.length}
size={'small'}
offset={[0, 7]}
>
{' '}
<Badge
count={Holddata?.length}
size={'small'}
offset={[0, 7]}
>
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => HandleholdModelOpen()}
style={{
fontSize: '28px',
cursor: 'pointer',
color: Holddata ? '#52c41a' : 'default',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
/>
</Badge>
</TooltipWrapper>
)
<PozoHoldIcon
className="BSBillingNav-icon-table-icon"
onClick={() => HandleholdModelOpen()}
style={{
fontSize: '28px',
cursor: 'pointer',
color: Holddata ? '#52c41a' : 'default',
pointerEvents:
OrderType === 'Failed' ? 'none' : 'auto',
}}
/>
</Badge>
</TooltipWrapper>
)
: ''}
</>
))}
@ -4042,14 +4051,14 @@ const BSBillingTable3Pay = () => {
width: '1.5rem',
cursor:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'not-allowed'
: 'pointer',
color:
OrderCardDetail?.length === 0 ||
CheckBookingStatus == 'Close' ||
addnewAccess
CheckBookingStatus == 'Close' ||
addnewAccess
? 'gray'
: 'rgb(18, 146, 238)',
display: 'flex',
@ -4148,31 +4157,31 @@ const BSBillingTable3Pay = () => {
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 'none'
: 'auto',
opacity:
(BookingType === 'Dine In' ||
BookingTypeBoth ||
CheckOrderType?.length > 0) &&
!unpaidFlow &&
OrderStatus
!unpaidFlow &&
OrderStatus
? 0.5
: 1,
}}
>
{paybtns?.length > 0 &&
currentOrderNetAmount >= previousNetAmount ? (
currentOrderNetAmount >= previousNetAmount ? (
paybtns?.map((payment) => (
<div className="Table3-cash">
<button
className={
paybtnselected === payment.ModeId &&
(UpinotSelected || CardoptionnotSelected)
(UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel'
: paybtnselected === payment.ModeId &&
(!UpinotSelected || !CardoptionnotSelected)
(!UpinotSelected || !CardoptionnotSelected)
? 'Btn-payment-mode'
: 'Btn-payment-mode-sel'
}
@ -4186,13 +4195,13 @@ const BSBillingTable3Pay = () => {
onClick={() =>
payment?.ModeName?.toLowerCase() === 'upi' // Change the condition to payment.Id
? handleUPIButtonClick(
payment.ModeId,
payment.ModeName
)
payment.ModeId,
payment.ModeName
)
: handlePaymentMode(
payment.ModeId,
payment.ModeName
)
payment.ModeId,
payment.ModeName
)
}
>
{/* {UpiOption === "" && payment?.ModeName?.toLowerCase() === "upi" && <p> UPI</p>} */}
@ -4252,10 +4261,10 @@ const BSBillingTable3Pay = () => {
<button
className={
refundPaySelected === payment.ConfigId &&
(UpinotSelected || CardoptionnotSelected)
(UpinotSelected || CardoptionnotSelected)
? 'Btn-payment-mode-notupisel'
: refundPaySelected === payment.ConfigId &&
(!UpinotSelected || !CardoptionnotSelected)
(!UpinotSelected || !CardoptionnotSelected)
? 'Btn-payment-mode'
: 'Btn-payment-mode-sel'
}
@ -4516,9 +4525,9 @@ const BSBillingTable3Pay = () => {
addnewAccess
? 'BSBillingTable3-paybtn-deactive'
: FirstPaymentclick === false &&
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
OrderCardDetail?.length > 0 &&
paybtnselected &&
CheckBookingStatus != 'Close'
? !OrderStatus
? salesBillEdit &&
currentOrderNetAmount < previousNetAmount
@ -4752,14 +4761,14 @@ const BSBillingTable3Pay = () => {
OrderType === 'Failed'
? FailedTotalAmt
: Math.round(
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))
)
OrderCardDetail?.reduce(
(acc, data) => data?.TotalAmt + acc,
0
) -
((OverAllSales > 0 ? OverAllSales : 0) +
(OverAllEstimate > 0 ? OverAllEstimate : 0) +
(Discount > 0 ? Discount : 0))
)
}
failedOrderData={failedOrderData}
/>
@ -4835,9 +4844,9 @@ const BSBillingTable3Pay = () => {
const qty = isGroup
? OrderCardDetail.filter((o) => o.id === groupKey).reduce(
(sum, o) => sum + (o.OrderQty || 1),
0
)
(sum, o) => sum + (o.OrderQty || 1),
0
)
: item.OrderQty || 1;
return (
@ -4919,6 +4928,7 @@ const BSBillingTable3Pay = () => {
open={businessUPI}
handleCancel={() => setShowCancelConfirm(true)}
footer={false}
destroyOnClose={true}
width={500}
children={
<>
@ -4936,14 +4946,27 @@ const BSBillingTable3Pay = () => {
}
/>
{showCancelConfirm && (
// <Modal
// open={showCancelConfirm}
// title="Cancel Payment"
// onOk={() => {
// setBusinessUPI(false);
// setShowCancelConfirm(false);
// ClearAllGlobalStateDatas();
// CustomerDisplay();
// }}
// onCancel={() => setShowCancelConfirm(false)}
// okText="Yes"
// cancelText="No"
// >
// Do you want to cancel the payment?
// </Modal>
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setBusinessUPI(false);
setShowCancelConfirm(false);
ClearAllGlobalStateDatas();
CustomerDisplay();
CancelPayment()
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"

View File

@ -109,6 +109,7 @@ import {
GlobalUnpaidListData,
PaymentGatewayGetdetail,
PostBookingData,
PostCancelPayment,
PostPaymentdevice,
PreferenceData,
PutBookingData,
@ -1214,6 +1215,15 @@ const StandardTablePayment = () => {
}
};
// PostCancelPayment
const CancelPayment = async () => {
const response = await dispatch(PostCancelPayment({OrderId: businessUPIOrderId})).unwrap()
if (response?.data?.statusCode) {
ClearAllGlobalStateDatas();
CustomerDisplay();
setBusinessUPI(false);
}
}
const Otherserviceprint = async () => {
if (OtherServicesPrintDetails?.length > 0) {
const style = await PrintStyleFunction('OtherServices1');
@ -4191,6 +4201,7 @@ const StandardTablePayment = () => {
handleCancel={() => setShowCancelConfirm(true)}
footer={false}
width={600}
destroyOnClose={true}
className={'ModalPaymentGatewayEmbedded'}
children={
<>
@ -4209,22 +4220,35 @@ const StandardTablePayment = () => {
}
/>
{showCancelConfirm && (
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
paymentGatewayRef.current?.clearPolling();
setBusinessUPI(false);
setShowCancelConfirm(false);
ClearAllGlobalStateDatas();
CustomerDisplay();
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
// <Modal
// open={showCancelConfirm}
// title="Cancel Payment"
// onOk={() => {
// paymentGatewayRef.current?.clearPolling();
// setBusinessUPI(false);
// setShowCancelConfirm(false);
// ClearAllGlobalStateDatas();
// CustomerDisplay();
// }}
// onCancel={() => setShowCancelConfirm(false)}
// okText="Yes"
// cancelText="No"
// >
// Do you want to cancel the payment?
// </Modal>
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setShowCancelConfirm(false);
CancelPayment()
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
)}
{customerPreviesOrders && (
<DefaultModal

View File

@ -128,6 +128,7 @@ import {
changePreviousOrderOfferDetail,
GlobalPaymentTrigger,
changeSearchedData,
PostCancelPayment,
} from '../../../../Features/BookingScreen/BookingData/BookingData';
import { PrintStyleFunction } from '../../../paymentpdfPage/PrintStyleFunction.js';
import {
@ -1294,6 +1295,16 @@ const BSC1Payment = (props) => {
}
};
// PostCancelPayment
const CancelPayment = async () => {
const response = await dispatch(PostCancelPayment({OrderId: businessUPIOrderId})).unwrap()
if (response?.data?.statusCode) {
ClearAllGlobalStateDatas();
CustomerDisplay();
setBusinessUPI(false);
}
}
useEffect(() => {
const handleKeyPress = (event) => {
if (event.key === 'F4' && isButtonActive() && !isF4Pressed.current) {
@ -4993,6 +5004,7 @@ const BSC1Payment = (props) => {
handleCancel={() => setShowCancelConfirm(true)}
footer={false}
width={500}
destroyOnClose={true}
children={
<>
<PaymentGatewayEmbedded
@ -5009,21 +5021,34 @@ const BSC1Payment = (props) => {
}
/>
{showCancelConfirm && (
// <Modal
// open={showCancelConfirm}
// title="Cancel Payment"
// onOk={() => {
// setBusinessUPI(false);
// setShowCancelConfirm(false);
// ClearAllGlobalStateDatas();
// CustomerDisplay();
// }}
// onCancel={() => setShowCancelConfirm(false)}
// okText="Yes"
// cancelText="No"
// >
// Do you want to cancel the payment?
// </Modal>
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setBusinessUPI(false);
setShowCancelConfirm(false);
ClearAllGlobalStateDatas();
CustomerDisplay();
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setShowCancelConfirm(false);
CancelPayment()
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
)}
{customerPreviesOrders && (

View File

@ -1,6 +1,6 @@
import { useEffect, useRef, useState, useImperativeHandle, forwardRef } from 'react';
import { useDispatch } from 'react-redux';
import { getPaymentStatusForBusinessUPI } from '../../../../Features/BookingScreen/BookingData/BookingData';
import { getPaymentStatusForBusinessUPI, PostCancelPayment } from '../../../../Features/BookingScreen/BookingData/BookingData';
const PaymentGatewayEmbedded = forwardRef(({
orderId,
@ -65,6 +65,7 @@ const PaymentGatewayEmbedded = forwardRef(({
if (data.status === 'TIMEOUT') {
// Stop polling and mark as timed out
dispatch(PostCancelPayment({OrderId: orderId})).unwrap()
setTimedOut(true);
setShowTimeout(true);
if (intervalRef.current) {

View File

@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useState } from 'react';
import { Popconfirm, Drawer, Badge } from 'antd';
import { Popconfirm, Drawer, Badge, Modal } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { useDispatch, useSelector } from 'react-redux';
import { IoIosArrowForward } from 'react-icons/io';
@ -43,7 +43,7 @@ import KioskPayment from '../Payment/KioskPaymentWithModal';
import { ApplicationPreferences } from '../../../Features/BrachLogin/BranchLogin';
import { FaAngleUp, FaCircleCheck } from 'react-icons/fa6';
import { FaAngleDown } from 'react-icons/fa';
import { PostBookingData } from '../../../Features/BookingScreen/BookingData/BookingData';
import { PostBookingData, PostCancelPayment } from '../../../Features/BookingScreen/BookingData/BookingData';
import {
generateRandomKey,
getSession,
@ -129,6 +129,7 @@ const selfKioskFooter = (props) => {
const [chairInformation, setChairInformation] = useState();
const [TableINformation, setTableINformation] = useState();
const [paymentUrl, setpaymentUrl] = useState(null);
const [showCancelConfirm, setShowCancelConfirm] = useState(null);
const [TransctionId, setTransctionId] = useState(null);
const [paymentGatewayAccess, setPaymentGatewayAccess] = useState([]);
// let chairInformation = getSession('table');
@ -939,6 +940,15 @@ const selfKioskFooter = (props) => {
setMessageType(null);
}, []);
// PostCancelPayment
const CancelPayment = async () => {
const response = await dispatch(PostCancelPayment({OrderId: TransctionId})).unwrap()
if (response?.data?.statusCode) {
// setBusinessUPI(false);
setpaymentUrl(null)
}
}
return (
<div>
<Messages
@ -1462,7 +1472,8 @@ const selfKioskFooter = (props) => {
<button
className="paymentclose-btn"
onClick={() => {
setpaymentUrl(null);
// setpaymentUrl(null);
setShowCancelConfirm(true);
}}
>
@ -1476,6 +1487,21 @@ const selfKioskFooter = (props) => {
></iframe>
</div>
)}
{showCancelConfirm && (
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setShowCancelConfirm(false);
CancelPayment()
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
)}
</div>
);
};

View File

@ -61,6 +61,7 @@ import {
import {
getConfigType,
getPreferenceData,
PostCancelPayment,
PreferenceData,
PutPendingPaymentList,
} from '../../../Features/BookingScreen/BookingData/BookingData';
@ -1092,6 +1093,15 @@ const KioskPayment = (props) => {
}, 2000);
}
};
// PostCancelPayment
const CancelPayment = async () => {
const response = await dispatch(PostCancelPayment({OrderId: businessUPIOrderId})).unwrap()
if (response?.data?.statusCode) {
ClearAllGlobalStateDatas();
CustomerDisplay();
setBusinessUPI(false);
}
}
const handleDevice = async (paymentDetails, option) => {
const paymentDeviceDetails = await dispatch(
@ -2342,6 +2352,7 @@ const KioskPayment = (props) => {
handleCancel={() => setShowCancelConfirm(true)}
footer={false}
width={500}
destroyOnClose={true}
children={
<>
<PaymentGatewayEmbedded
@ -2359,21 +2370,34 @@ const KioskPayment = (props) => {
}
/>
{showCancelConfirm && (
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
paymentGatewayRef.current?.clearPolling();
setBusinessUPI(false);
setShowCancelConfirm(false);
ClearAllGlobalStateDatas();
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
// <Modal
// open={showCancelConfirm}
// title="Cancel Payment"
// onOk={() => {
// paymentGatewayRef.current?.clearPolling();
// setBusinessUPI(false);
// setShowCancelConfirm(false);
// ClearAllGlobalStateDatas();
// }}
// onCancel={() => setShowCancelConfirm(false)}
// okText="Yes"
// cancelText="No"
// >
// Do you want to cancel the payment?
// </Modal>
<Modal
open={showCancelConfirm}
title="Cancel Payment"
onOk={() => {
setShowCancelConfirm(false);
CancelPayment()
}}
onCancel={() => setShowCancelConfirm(false)}
okText="Yes"
cancelText="No"
>
Do you want to cancel the payment?
</Modal>
)}
</div>
);