diff --git a/index.html b/index.html index 95106c7..c84619e 100644 --- a/index.html +++ b/index.html @@ -2,9 +2,9 @@ - + - core-midtrans-cifo + Simaya Midtrans | Retail Payment
diff --git a/public/simaya.png b/public/simaya.png new file mode 100644 index 0000000..8f5e90b Binary files /dev/null and b/public/simaya.png differ diff --git a/server/index.cjs b/server/index.cjs index 11bbdc8..5e50c9b 100644 --- a/server/index.cjs +++ b/server/index.cjs @@ -124,7 +124,7 @@ const ENABLE = { // --- Payment Link Config const EXTERNAL_API_KEY = process.env.EXTERNAL_API_KEY || '' const PAYMENT_LINK_SECRET = process.env.PAYMENT_LINK_SECRET || '' -const PAYMENT_LINK_TTL_MINUTES = parseInt(process.env.PAYMENT_LINK_TTL_MINUTES || '30', 10) +const PAYMENT_LINK_TTL_MINUTES = parseInt(process.env.PAYMENT_LINK_TTL_MINUTES || '1440', 10) const PAYMENT_LINK_BASE = process.env.PAYMENT_LINK_BASE || 'http://localhost:5174/pay' const activeOrders = new Map() // order_id -> expire_at // Map untuk menyimpan mercant_id per order_id agar notifikasi ERP bisa dinamis @@ -234,7 +234,7 @@ app.get('/api/payment-links/:token', (req, res) => { if (result.error) { logWarn('paymentlink.invalid', { error: result.error }) if (isDevEnv()) { - const ttlMin = PAYMENT_LINK_TTL_MINUTES > 0 ? PAYMENT_LINK_TTL_MINUTES : 30 + const ttlMin = PAYMENT_LINK_TTL_MINUTES > 0 ? PAYMENT_LINK_TTL_MINUTES : 1440 const fallback = { order_id: token, nominal: 150000, expire_at: Date.now() + ttlMin * 60 * 1000 } logInfo('paymentlink.dev.fallback', { order_id: fallback.order_id }) return res.json(fallback) @@ -386,7 +386,7 @@ app.post('/createtransaksi', async (req, res) => { } const nominal = Number(nominalRaw) const now = Date.now() - const ttlMin = PAYMENT_LINK_TTL_MINUTES > 0 ? PAYMENT_LINK_TTL_MINUTES : 30 + const ttlMin = PAYMENT_LINK_TTL_MINUTES > 0 ? PAYMENT_LINK_TTL_MINUTES : 1440 const expire_at = now + ttlMin * 60 * 1000 // Block jika sudah selesai diff --git a/src/app/router.tsx b/src/app/router.tsx index 4dd5a2a..5cc3e8a 100644 --- a/src/app/router.tsx +++ b/src/app/router.tsx @@ -1,10 +1,11 @@ import { createBrowserRouter, RouterProvider } from 'react-router-dom' import { AppLayout } from './AppLayout' -import { CheckoutPage } from '../pages/CheckoutPage' +// import { CheckoutPage } from '../pages/CheckoutPage' import { PaymentStatusPage } from '../pages/PaymentStatusPage' import { PaymentHistoryPage } from '../pages/PaymentHistoryPage' import { NotFoundPage } from '../pages/NotFoundPage' -import { DemoStorePage } from '../pages/DemoStorePage' +// import { DemoStorePage } from '../pages/DemoStorePage' +import { InitPage } from '../pages/InitialPage' import { PayPage } from '../pages/PayPage' const router = createBrowserRouter([ @@ -13,8 +14,8 @@ const router = createBrowserRouter([ element: , errorElement:
Terjadi kesalahan. Coba muat ulang.
, children: [ - { index: true, element: }, - { path: 'checkout', element: }, + { index: true, element: }, + // { path: 'checkout', element: }, { path: 'pay/:token', element: }, { path: 'payments/:orderId/status', element: }, { path: 'history', element: }, diff --git a/src/features/payments/components/PaymentLogos.tsx b/src/features/payments/components/PaymentLogos.tsx index ec88161..b2a55dc 100644 --- a/src/features/payments/components/PaymentLogos.tsx +++ b/src/features/payments/components/PaymentLogos.tsx @@ -103,7 +103,7 @@ export function CStoreLogosRow({ compact = false, size }: { compact?: boolean; s return (
- + {/* */}
) } diff --git a/src/features/payments/components/PaymentSheet.tsx b/src/features/payments/components/PaymentSheet.tsx index 22331e6..14cecf6 100644 --- a/src/features/payments/components/PaymentSheet.tsx +++ b/src/features/payments/components/PaymentSheet.tsx @@ -14,9 +14,10 @@ function useCountdown(expireAt: number) { }, []) const remainMs = Math.max(0, expireAt - now) const totalSec = Math.floor(remainMs / 1000) - const mm = String(Math.floor(totalSec / 60)).padStart(2, '0') + const hh = String(Math.floor(totalSec / 3600)).padStart(2, '0') + const mm = String(Math.floor((totalSec % 3600) / 60)).padStart(2, '0') const ss = String(totalSec % 60).padStart(2, '0') - return `${mm}:${ss}` + return `${hh}:${mm}:${ss}` } export interface PaymentSheetProps { @@ -63,22 +64,21 @@ export function PaymentSheet({ merchantName = 'Simaya', orderId, amount, expireA - {/* Amount panel */} + {expanded && (
-
Total
+
Total
{formatCurrencyIDR(amount)}
Order ID #{orderId}
)} - {/* Body */} +
{children}
- {/* Sticky CTA (mobile-friendly) */} {showStatusCTA && (
) -} \ No newline at end of file +} diff --git a/src/features/payments/lib/navigation.ts b/src/features/payments/lib/navigation.ts index 1d888e9..0363e42 100644 --- a/src/features/payments/lib/navigation.ts +++ b/src/features/payments/lib/navigation.ts @@ -4,7 +4,7 @@ export function usePaymentNavigation() { const navigate = useNavigate() return { toCheckout() { - navigate('/checkout') + window.location.assign('https://erpskrip.id/pembayaran-pelanggan') }, toStatus(orderId: string, method?: string) { const qs = method ? `?m=${encodeURIComponent(method)}` : '' @@ -14,4 +14,4 @@ export function usePaymentNavigation() { navigate('/history') }, } -} \ No newline at end of file +} diff --git a/src/main.tsx b/src/main.tsx index 1226f31..837b8d6 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,7 +1,7 @@ import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' import './styles/globals.css' -// Force light theme in case hosting injects a global 'dark' class + (() => { const html = document.documentElement try { @@ -9,11 +9,9 @@ import './styles/globals.css' html.classList.remove('dark') } document.body.classList.remove('dark') - // Hint browsers to prefer light color scheme html.style.colorScheme = 'light' html.setAttribute('data-theme', 'light') } catch { - // noop } })() import { AppRouter } from './app/router' diff --git a/src/pages/InitialPage.tsx b/src/pages/InitialPage.tsx new file mode 100644 index 0000000..feb4db1 --- /dev/null +++ b/src/pages/InitialPage.tsx @@ -0,0 +1,13 @@ +export function InitPage() { + return ( +
+
+ Simaya +
+
Simaya Midtrans
+
Payment Service
+
+
+
+ ) +} diff --git a/src/pages/NotFoundPage.tsx b/src/pages/NotFoundPage.tsx index 8f82e65..2a4f80c 100644 --- a/src/pages/NotFoundPage.tsx +++ b/src/pages/NotFoundPage.tsx @@ -5,7 +5,8 @@ export function NotFoundPage() {

Halaman tidak ditemukan

Periksa URL atau kembali ke checkout.

- Kembali ke Checkout + {/* Kembali ke Checkout */} + Kembali
) } \ No newline at end of file diff --git a/src/pages/PayPage.tsx b/src/pages/PayPage.tsx index 27b2eac..c941c7e 100644 --- a/src/pages/PayPage.tsx +++ b/src/pages/PayPage.tsx @@ -19,7 +19,7 @@ export function PayPage() { const { token } = useParams() const [orderId, setOrderId] = useState('') const [amount, setAmount] = useState(0) - const [expireAt, setExpireAt] = useState(Date.now() + 30 * 60 * 1000) + const [expireAt, setExpireAt] = useState(Date.now() + 24 * 60 * 60 * 1000) const [selectedMethod, setSelectedMethod] = useState(null) const [locked, setLocked] = useState(false) const [selectedBank, setSelectedBank] = useState(null) @@ -39,7 +39,7 @@ export function PayPage() { if (cancelled) return setOrderId(payload.order_id) setAmount(payload.nominal) - setExpireAt(payload.expire_at ?? Date.now() + 30 * 60 * 1000) + setExpireAt(payload.expire_at ?? Date.now() + 24 * 60 * 60 * 1000) setAllowedMethods(payload.allowed_methods) setError(null) } catch (err) { @@ -53,7 +53,7 @@ export function PayPage() { } }, [token]) - const merchantName = useMemo(() => 'Simaya Retail', []) + const merchantName = useMemo(() => '', []) const isExpired = expireAt ? Date.now() > expireAt : false const enabledMap: Record = useMemo(() => { @@ -88,16 +88,17 @@ export function PayPage() { >
{msg} -
+
Hubungi Admin @@ -123,7 +124,6 @@ export function PayPage() { onSelect={(m) => { setSelectedMethod(m as Method) if (m === 'bank_transfer' || m === 'cstore') { - // Panel pemilihan bank/toko akan muncul di bawah item, dan lanjut ke step 3 setelah memilih } else if (m === 'cpay') { try { window.open('https://play.google.com/store/apps/details?id=com.cifo.walanja', '_blank') @@ -148,7 +148,7 @@ export function PayPage() { return (
Pilih bank untuk membuat Virtual Account
-
+
{(['bca', 'bni', 'bri', 'cimb', 'mandiri', 'permata'] as BankKey[]).map((bk) => (
) -} \ No newline at end of file +} diff --git a/src/pages/PaymentStatusPage.tsx b/src/pages/PaymentStatusPage.tsx index 4c56abe..a05d08a 100644 --- a/src/pages/PaymentStatusPage.tsx +++ b/src/pages/PaymentStatusPage.tsx @@ -112,7 +112,7 @@ export function PaymentStatusPage() { ) : null}
- +
{!Env.API_BASE_URL && ( diff --git a/src/services/api.ts b/src/services/api.ts index dca842e..9b24ca1 100644 --- a/src/services/api.ts +++ b/src/services/api.ts @@ -129,22 +129,22 @@ export async function getPaymentLinkPayload(token: string): Promise