Code edited in Lovable Code Editor
Edited UI in Lovable
This commit is contained in:
@@ -15,7 +15,7 @@ import { QRCodeSVG } from "qrcode.react";
|
||||
|
||||
// Pakasir configuration
|
||||
const PAKASIR_PROJECT_SLUG = "dewengoding";
|
||||
const PAKASIR_API_KEY = "your-pakasir-api-key"; // TODO: Move to secrets
|
||||
const PAKASIR_API_KEY = "iP13osgh7lAzWWIPsj7TbW5M3iGEAQMo";
|
||||
|
||||
type PaymentMethod = "qris" | "paypal";
|
||||
type CheckoutStep = "cart" | "payment" | "waiting";
|
||||
@@ -51,11 +51,7 @@ export default function Checkout() {
|
||||
|
||||
const checkPaymentStatus = async (oid: string) => {
|
||||
setCheckingStatus(true);
|
||||
const { data: order } = await supabase
|
||||
.from("orders")
|
||||
.select("payment_status")
|
||||
.eq("id", oid)
|
||||
.single();
|
||||
const { data: order } = await supabase.from("orders").select("payment_status").eq("id", oid).single();
|
||||
|
||||
if (order?.payment_status === "paid") {
|
||||
toast({ title: "Pembayaran berhasil!", description: "Akses produk sudah aktif" });
|
||||
@@ -74,7 +70,11 @@ export default function Checkout() {
|
||||
}
|
||||
|
||||
if (items.length === 0) {
|
||||
toast({ title: "Keranjang kosong", description: "Tambahkan produk ke keranjang terlebih dahulu", variant: "destructive" });
|
||||
toast({
|
||||
title: "Keranjang kosong",
|
||||
description: "Tambahkan produk ke keranjang terlebih dahulu",
|
||||
variant: "destructive",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -175,11 +175,7 @@ export default function Checkout() {
|
||||
if (!orderId) return;
|
||||
setCheckingStatus(true);
|
||||
|
||||
const { data: order } = await supabase
|
||||
.from("orders")
|
||||
.select("payment_status")
|
||||
.eq("id", orderId)
|
||||
.single();
|
||||
const { data: order } = await supabase.from("orders").select("payment_status").eq("id", orderId).single();
|
||||
|
||||
if (order?.payment_status === "paid") {
|
||||
toast({ title: "Pembayaran berhasil!", description: "Akses produk sudah aktif" });
|
||||
@@ -212,7 +208,12 @@ export default function Checkout() {
|
||||
)}
|
||||
</div>
|
||||
<div className="w-full space-y-2">
|
||||
<Button onClick={refreshPaymentStatus} variant="outline" className="w-full border-2" disabled={checkingStatus}>
|
||||
<Button
|
||||
onClick={refreshPaymentStatus}
|
||||
variant="outline"
|
||||
className="w-full border-2"
|
||||
disabled={checkingStatus}
|
||||
>
|
||||
{checkingStatus ? <Loader2 className="w-4 h-4 mr-2 animate-spin" /> : null}
|
||||
Cek Status Pembayaran
|
||||
</Button>
|
||||
@@ -271,14 +272,20 @@ export default function Checkout() {
|
||||
<CardTitle>Metode Pembayaran</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<RadioGroup value={paymentMethod} onValueChange={(v) => setPaymentMethod(v as PaymentMethod)} className="space-y-3">
|
||||
<RadioGroup
|
||||
value={paymentMethod}
|
||||
onValueChange={(v) => setPaymentMethod(v as PaymentMethod)}
|
||||
className="space-y-3"
|
||||
>
|
||||
<div className="flex items-center space-x-3 p-3 border-2 border-border rounded-none hover:bg-muted cursor-pointer">
|
||||
<RadioGroupItem value="qris" id="qris" />
|
||||
<Label htmlFor="qris" className="flex items-center gap-2 cursor-pointer flex-1">
|
||||
<QrCode className="w-5 h-5" />
|
||||
<div>
|
||||
<p className="font-medium">QRIS</p>
|
||||
<p className="text-sm text-muted-foreground">Scan QR dengan aplikasi e-wallet atau mobile banking</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Scan QR dengan aplikasi e-wallet atau mobile banking
|
||||
</p>
|
||||
</div>
|
||||
</Label>
|
||||
</div>
|
||||
@@ -322,9 +329,7 @@ export default function Checkout() {
|
||||
"Login untuk Checkout"
|
||||
)}
|
||||
</Button>
|
||||
<p className="text-xs text-muted-foreground text-center">
|
||||
Pembayaran diproses melalui Pakasir
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground text-center">Pembayaran diproses melalui Pakasir</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user