fixed-issue(32): cupon validation and other minor issues like gateway fees and UI #51

Merged
amit merged 2 commits from cupon-validation-fix into main 2026-10-15 05:03:56 +00:00
4 changed files with 26 additions and 15 deletions

2
.git_store_info Normal file
View File

@ -0,0 +1,2 @@
Branch: main
Commit: 75acd1de923fe310458333b66b71450f444eee2b

View File

@ -656,7 +656,7 @@ export default function App() {
}, { headers });
const calcData = res.data;
if (appliedCoupon && (!calcData.coupon_applied || calcData.coupon_applied === 'None')) {
if (appliedCoupon && (!calcData.coupon_applied || calcData.coupon_applied === 'None' || calcData.coupon_discount_amount <= 0)) {
calcData.coupon_error = calcData.coupon_error || 'Invalid or expired coupon code.';
}
setPricingCalc(calcData);
@ -789,6 +789,7 @@ export default function App() {
pricingCalc &&
pricingCalc.coupon_applied &&
pricingCalc.coupon_applied !== 'None' &&
pricingCalc.coupon_discount_amount > 0 &&
!pricingCalc.coupon_error
);

View File

@ -166,7 +166,7 @@ export const CartDrawer: React.FC<CartDrawerProps> = ({
</button>
</div>
{appliedCoupon &&
(pricingCalc?.coupon_error || !pricingCalc?.coupon_applied || pricingCalc?.coupon_applied === 'None' ? (
(pricingCalc?.coupon_error || !pricingCalc?.coupon_applied || pricingCalc?.coupon_applied === 'None' || (pricingCalc?.coupon_discount_amount !== undefined && pricingCalc?.coupon_discount_amount <= 0) ? (
<div className="flex justify-between items-center bg-rose-50 border border-rose-200 text-rose-700 text-xs px-3 py-2 rounded-xl font-bold">
<span className="flex items-center gap-1">
⚠️ {pricingCalc?.coupon_error || 'Invalid or expired coupon code.'}

View File

@ -22,7 +22,19 @@ export const PaymentSuccessModal: React.FC<PaymentSuccessModalProps> = ({
returnRoute,
appScheme,
}) => {
const [desktopNotice] = useState(false);
const [desktopNotice, setDesktopNotice] = useState(false);
// Handler to reliably launch the Acupedia Mobile App across platforms
const handleOpenApp = (e: React.MouseEvent) => {
e.preventDefault();
openMobileApp({ route: returnRoute, schemes: appScheme ? [appScheme] : undefined });
const userAgent = navigator.userAgent || '';
const isMobile = /Android|iPhone|iPad|iPod/i.test(userAgent);
if (!isMobile) {
setDesktopNotice(true);
}
};
return (
<div className="fixed inset-0 z-[100] flex items-center justify-center p-4 bg-slate-950/75 backdrop-blur-md transition-all duration-300">
<div className="relative w-full max-w-xl bg-slate-900 border border-slate-800 rounded-2xl p-5 md:p-6 space-y-4 shadow-2xl text-slate-100 overflow-hidden animate-in fade-in zoom-in-95 duration-200">
@ -182,18 +194,14 @@ export const PaymentSuccessModal: React.FC<PaymentSuccessModalProps> = ({
)}
{/* Open in App Button */}
{/* Open in App Button */}
<a
href={getAppDeepLinkUrls({ route: returnRoute, schemes: appScheme ? [appScheme] : undefined })[0]}
onClick={(e) => {
e.preventDefault();
openMobileApp({ route: returnRoute, schemes: appScheme ? [appScheme] : undefined });
}}
className="w-full h-9 bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs rounded-lg transition-all duration-300 flex items-center justify-center gap-2 shadow-md shadow-emerald-600/10 no-underline decoration-0 cursor-pointer"
>
<Smartphone className="h-3.5 w-3.5 text-emerald-200" />
Open in App / Library
</a>
<a
href={getAppDeepLinkUrls({ route: returnRoute, schemes: appScheme ? [appScheme] : undefined })[0]}
onClick={handleOpenApp}
className="w-full h-9 bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs rounded-lg transition-all duration-300 flex items-center justify-center gap-2 shadow-md shadow-emerald-600/10 no-underline decoration-0 cursor-pointer"
>
<Smartphone className="h-3.5 w-3.5 text-emerald-200" />
Open in App / Library
</a>
{desktopNotice && (
<div className="p-2.5 bg-slate-950 border border-emerald-900/40 rounded-lg text-center animate-in fade-in duration-200">