fixed-issue(32): cupon validation and other minor issues like gateway fees and UI
This commit is contained in:
parent
75acd1de92
commit
22404d03e1
|
|
@ -0,0 +1,2 @@
|
|||
Branch: main
|
||||
Commit: 75acd1de923fe310458333b66b71450f444eee2b
|
||||
|
|
@ -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);
|
||||
|
|
@ -781,6 +781,7 @@ export default function App() {
|
|||
pricingCalc &&
|
||||
pricingCalc.coupon_applied &&
|
||||
pricingCalc.coupon_applied !== 'None' &&
|
||||
pricingCalc.coupon_discount_amount > 0 &&
|
||||
!pricingCalc.coupon_error
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,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.'}
|
||||
|
|
@ -234,44 +234,7 @@ export const CartDrawer: React.FC<CartDrawerProps> = ({
|
|||
</span>
|
||||
</div>
|
||||
)}
|
||||
{pricingCalc.convenience_fee > 0 && (
|
||||
<div className="flex justify-between text-xs text-slate-600 font-bold">
|
||||
<span>Gateway fee ({pricingCalc.convenience_fee_rate}%)</span>
|
||||
<span>
|
||||
{currency === 'INR'
|
||||
? `₹${pricingCalc.convenience_fee}`
|
||||
: currency === 'EUR'
|
||||
? `€${pricingCalc.convenience_fee}`
|
||||
: `$${pricingCalc.convenience_fee}`}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{pricingCalc.gst_amount > 0 && (
|
||||
<div className="space-y-0.5">
|
||||
<div className="flex justify-between text-xs text-slate-600 font-bold">
|
||||
<span>GST (18%)</span>
|
||||
<span>
|
||||
{currency === 'INR'
|
||||
? `₹${pricingCalc.gst_amount}`
|
||||
: currency === 'EUR'
|
||||
? `€${pricingCalc.gst_amount}`
|
||||
: `$${pricingCalc.gst_amount}`}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex justify-between text-[10px] text-slate-400 font-semibold italic">
|
||||
<span>
|
||||
(Taxable Amount:{' '}
|
||||
{currency === 'INR'
|
||||
? `₹${pricingCalc.taxable_amount}`
|
||||
: currency === 'EUR'
|
||||
? `€${pricingCalc.taxable_amount}`
|
||||
: `$${pricingCalc.taxable_amount}`}
|
||||
)
|
||||
</span>
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="h-px bg-slate-200 my-2" />
|
||||
<div className="flex justify-between items-center text-sm font-bold text-slate-800">
|
||||
<span>Total Chargeable</span>
|
||||
|
|
|
|||
|
|
@ -24,37 +24,14 @@ export const PaymentSuccessModal: React.FC<PaymentSuccessModalProps> = ({
|
|||
}) => {
|
||||
const [desktopNotice, setDesktopNotice] = useState(false);
|
||||
|
||||
// Handler to reliably launch the Acupedia Mobile App across platforms (Android, iOS, and Desktop)
|
||||
// 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 isAndroid = /Android/i.test(userAgent);
|
||||
const isIOS = /iPhone|iPad|iPod/i.test(userAgent);
|
||||
|
||||
if (isAndroid) {
|
||||
// Android Chrome requires an Intent URI format to launch apps by package and scheme reliably
|
||||
const intentUrl = 'intent://#Intent;scheme=acupedia;package=com.anonymous.acupedia;end';
|
||||
window.location.href = intentUrl;
|
||||
|
||||
// Fallback to custom URI schemes in case intent fails or Expo uses alternate scheme
|
||||
setTimeout(() => {
|
||||
window.location.href = 'acupedia://';
|
||||
}, 500);
|
||||
setTimeout(() => {
|
||||
window.location.href = 'myapp://';
|
||||
}, 1000);
|
||||
} else if (isIOS) {
|
||||
// iOS Safari and Chrome handle custom URI schemes directly
|
||||
window.location.href = 'acupedia://';
|
||||
|
||||
// Fallback in case Expo uses default 'myapp://' scheme
|
||||
setTimeout(() => {
|
||||
window.location.href = 'myapp://';
|
||||
}, 500);
|
||||
} else {
|
||||
// On desktop browsers, try opening the registered custom scheme
|
||||
window.location.href = 'acupedia://';
|
||||
// Show helpful desktop feedback informing the user how to access content on mobile
|
||||
const isMobile = /Android|iPhone|iPad|iPod/i.test(userAgent);
|
||||
if (!isMobile) {
|
||||
setDesktopNotice(true);
|
||||
}
|
||||
};
|
||||
|
|
@ -217,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">
|
||||
|
|
|
|||
|
|
@ -11,33 +11,33 @@ export interface ModuleItem {
|
|||
|
||||
export const CURRICULUM_MODULES: ModuleItem[] = [
|
||||
// 1. Points Category
|
||||
{ code: 'POINTS_ACU', name: 'Points: Acu (EOV+Cat+Ext+MR)', category: 'Points', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Unlocks Master Acupuncture Points, Extraordinary Vessels, Category/Extension Rules, and Meridian Stimulations.', color: 'from-blue-500 to-indigo-600' },
|
||||
{ code: 'POINTS_SCALP', name: 'Points: Scalp', category: 'Points', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Unlocks High-Performance Scalp Acupuncture Mapping for specialized clinical neurological disorders.', color: 'from-indigo-500 to-purple-600' },
|
||||
{ code: 'POINTS_EAR', name: 'Points: Ear / Auricular', category: 'Points', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Unlocks specialized Ear Micro-System Reflex stimulations, anatomy mapping, and reflexes.', color: 'from-purple-500 to-pink-600' },
|
||||
{ code: 'POINTS_TUNG', name: 'Master Tung', category: 'Points', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Unlocks Master Tung\'s legendary extra points, clinical distals, and unique point properties.', color: 'from-pink-500 to-rose-600' },
|
||||
{ code: 'POINTS_PACK', name: 'Points: Complete Pack', category: 'Points', priceInr: 2, priceUsd: 2.0, priceEur: 2.0, desc: '1 Year: Unlock all 4 Points modules (Acu, Scalp, Ear, and Master Tung) at once for ultimate master-level access.', color: 'from-indigo-600 to-pink-600' },
|
||||
{ code: 'POINTS_ACU', name: 'Points: Acu (EOV+Cat+Ext+MR)', category: 'Points', priceInr: 300, priceUsd: 5.0, priceEur: 5.0, desc: '1 Year: Unlocks Master Acupuncture Points, Extraordinary Vessels, Category/Extension Rules, and Meridian Stimulations.', color: 'from-blue-500 to-indigo-600' },
|
||||
{ code: 'POINTS_SCALP', name: 'Points: Scalp', category: 'Points', priceInr: 100, priceUsd: 2.0, priceEur: 2.0, desc: '1 Year: Unlocks High-Performance Scalp Acupuncture Mapping for specialized clinical neurological disorders.', color: 'from-indigo-500 to-purple-600' },
|
||||
{ code: 'POINTS_EAR', name: 'Points: Ear / Auricular', category: 'Points', priceInr: 200, priceUsd: 3.0, priceEur: 3.0, desc: '1 Year: Unlocks specialized Ear Micro-System Reflex stimulations, anatomy mapping, and reflexes.', color: 'from-purple-500 to-pink-600' },
|
||||
{ code: 'POINTS_TUNG', name: 'Master Tung', category: 'Points', priceInr: 300, priceUsd: 5.0, priceEur: 5.0, desc: '1 Year: Unlocks Master Tung\'s legendary extra points, clinical distals, and unique point properties.', color: 'from-pink-500 to-rose-600' },
|
||||
{ code: 'POINTS_PACK', name: 'Points: Complete Pack', category: 'Points', priceInr: 900, priceUsd: 15.0, priceEur: 15.0, desc: '1 Year: Unlock all 4 Points modules (Acu, Scalp, Ear, and Master Tung) at once for ultimate master-level access.', color: 'from-indigo-600 to-pink-600' },
|
||||
|
||||
// 2. Pattern Category — Individual sub-modules (all map to PATTERN_CORE plan)
|
||||
{ code: 'PATTERN_CORE', name: 'Eight Principles', category: 'Pattern', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Exterior/Interior, Cold/Heat, Deficiency/Excess, Yin/Yang pattern differentiation.', color: 'from-violet-500 to-purple-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Zang-Fu Organs', category: 'Pattern', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Zangfu organ and channel identification across 12 organ systems.', color: 'from-cyan-500 to-blue-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Qi, Blood & Body Fluids', category: 'Pattern', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Qi, Blood, and Body Fluid identification of pathological patterns.', color: 'from-blue-500 to-indigo-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Pathogenic Factors', category: 'Pattern', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Wind, Cold, Summer-Heat, Dampness, Dryness, Fire pattern identification.', color: 'from-amber-500 to-orange-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Six Stages', category: 'Pattern', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Tai Yang, Yang Ming, Shao Yang, Tai Yin, Shao Yin, Jue Yin stage differentiation.', color: 'from-emerald-500 to-green-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Four Levels', category: 'Pattern', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Wei, Qi, Ying, Xue level pattern identification for warm diseases.', color: 'from-red-500 to-rose-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Three Burners', category: 'Pattern', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Upper, Middle, and Lower Burner (San Jiao) pattern identification.', color: 'from-pink-500 to-fuchsia-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Five Elements', category: 'Pattern', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Wood, Fire, Earth, Metal, Water relationships and clinical patterns.', color: 'from-indigo-500 to-violet-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Pattern: Complete Pack', category: 'Pattern', priceInr: 2, priceUsd: 2.0, priceEur: 2.0, desc: '1 Year: Unlock all 8 Pattern Diagnosis methodologies at once for complete syndrome differentiation mastery.', color: 'from-rose-600 to-orange-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Eight Principles', category: 'Pattern', priceInr: 500, priceUsd: 10.0, priceEur: 10.0, desc: '1 Year: Exterior/Interior, Cold/Heat, Deficiency/Excess, Yin/Yang pattern differentiation.', color: 'from-violet-500 to-purple-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Zang-Fu Organs', category: 'Pattern', priceInr: 500, priceUsd: 10.0, priceEur: 10.0, desc: '1 Year: Zangfu organ and channel identification across 12 organ systems.', color: 'from-cyan-500 to-blue-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Qi, Blood & Body Fluids', category: 'Pattern', priceInr: 500, priceUsd: 10.0, priceEur: 10.0, desc: '1 Year: Qi, Blood, and Body Fluid identification of pathological patterns.', color: 'from-blue-500 to-indigo-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Pathogenic Factors', category: 'Pattern', priceInr: 500, priceUsd: 10.0, priceEur: 10.0, desc: '1 Year: Wind, Cold, Summer-Heat, Dampness, Dryness, Fire pattern identification.', color: 'from-amber-500 to-orange-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Six Stages', category: 'Pattern', priceInr: 500, priceUsd: 10.0, priceEur: 10.0, desc: '1 Year: Tai Yang, Yang Ming, Shao Yang, Tai Yin, Shao Yin, Jue Yin stage differentiation.', color: 'from-emerald-500 to-green-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Four Levels', category: 'Pattern', priceInr: 500, priceUsd: 10.0, priceEur: 10.0, desc: '1 Year: Wei, Qi, Ying, Xue level pattern identification for warm diseases.', color: 'from-red-500 to-rose-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Three Burners', category: 'Pattern', priceInr: 500, priceUsd: 10.0, priceEur: 10.0, desc: '1 Year: Upper, Middle, and Lower Burner (San Jiao) pattern identification.', color: 'from-pink-500 to-fuchsia-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Five Elements', category: 'Pattern', priceInr: 500, priceUsd: 10.0, priceEur: 10.0, desc: '1 Year: Wood, Fire, Earth, Metal, Water relationships and clinical patterns.', color: 'from-indigo-500 to-violet-600' },
|
||||
{ code: 'PATTERN_CORE', name: 'Pattern: Complete Pack', category: 'Pattern', priceInr: 500, priceUsd: 10.0, priceEur: 10.0, desc: '1 Year: Unlock all 8 Pattern Diagnosis methodologies at once for complete syndrome differentiation mastery.', color: 'from-rose-600 to-orange-600' },
|
||||
|
||||
// 3. Nutrition Category — Individual sub-modules (all map to NUTRITION_CORE plan)
|
||||
{ code: 'NUTRITION_CORE', name: 'Food Categories', category: 'Nutrition', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Nutritional food category classifications, thermal properties, and dietetic groupings.', color: 'from-emerald-500 to-teal-600' },
|
||||
{ code: 'NUTRITION_CORE', name: 'Food Items', category: 'Nutrition', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Individual food item properties, indications, and therapeutic applications.', color: 'from-green-500 to-emerald-600' },
|
||||
{ code: 'NUTRITION_CORE', name: 'Nutrition: Complete Pack', category: 'Nutrition', priceInr: 2, priceUsd: 2.0, priceEur: 2.0, desc: '1 Year: Unlock all Nutrition & Dietetics modules for complete clinical dietary therapy mastery.', color: 'from-teal-500 to-green-600' },
|
||||
{ code: 'NUTRITION_CORE', name: 'Food Categories', category: 'Nutrition', priceInr: 600, priceUsd: 15.0, priceEur: 15.0, desc: '1 Year: Nutritional food category classifications, thermal properties, and dietetic groupings.', color: 'from-emerald-500 to-teal-600' },
|
||||
{ code: 'NUTRITION_CORE', name: 'Food Items', category: 'Nutrition', priceInr: 600, priceUsd: 15.0, priceEur: 15.0, desc: '1 Year: Individual food item properties, indications, and therapeutic applications.', color: 'from-green-500 to-emerald-600' },
|
||||
{ code: 'NUTRITION_CORE', name: 'Nutrition: Complete Pack', category: 'Nutrition', priceInr: 600, priceUsd: 15.0, priceEur: 15.0, desc: '1 Year: Unlock all Nutrition & Dietetics modules for complete clinical dietary therapy mastery.', color: 'from-teal-500 to-green-600' },
|
||||
|
||||
// 4. Therapeutics Category
|
||||
{ code: 'THERAPEUTICS_GYNAE', name: 'Therapeutics: Gynecology', category: 'Therapeutics', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Unlocks advanced clinical Gynecology treatment protocols, syndromes, and corresponding points.', color: 'from-teal-500 to-cyan-500' },
|
||||
{ code: 'THERAPEUTICS_EAR', name: 'Therapeutics: Ear reflexology', category: 'Therapeutics', priceInr: 1, priceUsd: 1.0, priceEur: 1.0, desc: '1 Year: Unlocks comprehensive ear micro-system treatment procedures and specific clinical ear protocols.', color: 'from-cyan-500 to-blue-600' },
|
||||
{ code: 'THERAPEUTICS_CORE', name: 'Therapeutics Complete Bundle', category: 'Therapeutics', priceInr: 2, priceUsd: 2.0, priceEur: 2.0, desc: '1 Year: Unlocks both advanced clinical Gynecology and Ear Reflexology therapeutics treatment protocols.', color: 'from-teal-500 to-blue-600' },
|
||||
{ code: 'THERAPEUTICS_GYNAE', name: 'Therapeutics: Gynecology', category: 'Therapeutics', priceInr: 600, priceUsd: 15.0, priceEur: 15.0, desc: '1 Year: Unlocks advanced clinical Gynecology treatment protocols, syndromes, and corresponding points.', color: 'from-teal-500 to-cyan-500' },
|
||||
{ code: 'THERAPEUTICS_EAR', name: 'Therapeutics: Ear reflexology', category: 'Therapeutics', priceInr: 600, priceUsd: 15.0, priceEur: 15.0, desc: '1 Year: Unlocks comprehensive ear micro-system treatment procedures and specific clinical ear protocols.', color: 'from-cyan-500 to-blue-600' },
|
||||
{ code: 'THERAPEUTICS_CORE', name: 'Therapeutics Complete Bundle', category: 'Therapeutics', priceInr: 1200, priceUsd: 30.0, priceEur: 30.0, desc: '1 Year: Unlocks both advanced clinical Gynecology and Ear Reflexology therapeutics treatment protocols.', color: 'from-teal-500 to-blue-600' },
|
||||
|
||||
// 5. Lifetime Access
|
||||
{ code: 'LIFETIME_ALL', name: 'Lifetime Unlimited Access Pass', category: 'Lifetime', priceInr: 2, priceUsd: 2.0, priceEur: 2.0, desc: '10 Years: Unlock all 10 current modules + all future updates. Includes official master clinical certificate.', color: 'from-yellow-500 to-amber-600' }
|
||||
{ code: 'LIFETIME_ALL', name: 'Lifetime Unlimited Access Pass', category: 'Lifetime', priceInr: 15000, priceUsd: 350.0, priceEur: 350.0, desc: '10 Years: Unlock all 10 current modules + all future updates. Includes official master clinical certificate.', color: 'from-yellow-500 to-amber-600' }
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue