Refactor: Rename create-pakasir-payment to create-payment

- Rename function to abstract payment provider details
- Add support for both QRIS and PayPal methods
- Update frontend to use generic create-payment function
- Remove provider-specific naming from UI/UX
- Payment provider (Pakasir) is now an implementation detail

Response format:
- QRIS: returns qr_string for in-app display, payment_url as fallback
- PayPal: returns payment_url for redirect

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
dwindown
2025-12-23 21:41:47 +07:00
parent a9f7c9b07a
commit 1a36f831cc
5 changed files with 158 additions and 126 deletions

View File

@@ -226,12 +226,13 @@ export default function ConsultingBooking() {
const { error: slotsError } = await supabase.from('consulting_slots').insert(slotsToInsert);
if (slotsError) throw slotsError;
// Call edge function to create Pakasir payment (avoids CORS)
const { data: paymentData, error: paymentError } = await supabase.functions.invoke('create-pakasir-payment', {
// Call edge function to create payment (avoids CORS)
const { data: paymentData, error: paymentError } = await supabase.functions.invoke('create-payment', {
body: {
order_id: order.id,
amount: totalPrice,
description: `Konsultasi 1-on-1 (${totalBlocks} blok)`,
method: 'qris',
},
});
@@ -241,7 +242,7 @@ export default function ConsultingBooking() {
}
if (paymentData?.success && paymentData?.data?.payment_url) {
// Redirect to Pakasir payment page
// Redirect to payment page
window.location.href = paymentData.data.payment_url;
} else {
throw new Error('Gagal membuat URL pembayaran');