This repository has been archived on 2026-08-11. You can view files and clone it, but cannot push or open issues or pull requests.
Gishen-Mob/lib/commerce.ts
kirukib 7310a349c5 Add Gishen mobile app with complete demo shopping and care flows.
Ship Expo Router screens, seeded stores, and polished UX so auth, shop, checkout, prescriptions, loyalty, family, and account processes work end-to-end offline.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 01:21:32 +03:00

22 lines
647 B
TypeScript

/** Shared commerce numbers so cart, checkout and orders stay consistent. */
export const DELIVERY_FEE = 80;
export const DEMO_VOUCHER = "GISHEN10";
export const DEMO_VOUCHER_PCT = 0.1;
export const DEMO_OTP = "1234";
export function voucherDiscount(subtotal: number, code: string | null | undefined) {
if (!code) return 0;
if (code.trim().toUpperCase() === DEMO_VOUCHER) {
return Math.round(subtotal * DEMO_VOUCHER_PCT);
}
return 0;
}
export function orderSubtotalTotal(input: {
subtotal: number;
deliveryFee: number;
discount?: number;
}) {
return Math.max(0, input.subtotal + input.deliveryFee - (input.discount ?? 0));
}