stripe changes

This commit is contained in:
2026-01-05 09:37:20 +01:00
parent d04d9d9887
commit 8f863153cb
5 changed files with 241 additions and 60 deletions

View File

@@ -213,6 +213,18 @@ export const Dashboard: React.FC = () => {
const paymentSummary = currentOrder.details?.payment_summary;
const isStandardPackage = ['Landing Page', 'Pro Web'].includes(currentOrder.package);
// Extract the new domain if provided during approval
const approvedDomain = feedbackData.approval?.domain;
// Construct base updated details
const updatedDetails = {
...(currentOrder.details || {}),
latestFeedback: feedbackData,
feedbackDate: new Date().toISOString(),
// If approved domain is provided, update the main domainName field so it's visible in Admin
...(approvedDomain ? { domainName: approvedDomain } : {})
};
// Check if payment is needed: Approved + Standard Package + Not Custom Price + Has Remaining Balance
// Note: paymentSummary.remaining > 0 check is implicitly handled by Logic in FeedbackModal (it shows payment button only if true)
// But we double check here for security.
@@ -240,12 +252,7 @@ export const Dashboard: React.FC = () => {
if (checkoutData?.url) {
// Update details with feedback content BEFORE redirecting
// This ensures we save the "Approval" state even if they drop off payment (status remains pending_feedback though)
const updatedDetails = {
...(currentOrder.details || {}),
latestFeedback: feedbackData,
feedbackDate: new Date().toISOString()
};
// This ensures we save the "Approval" and the new domain even if they drop off payment (status remains pending_feedback though)
await supabase.from('orders').update({ details: updatedDetails }).eq('id', selectedOrderId);
// Redirect to Stripe
@@ -257,12 +264,6 @@ export const Dashboard: React.FC = () => {
}
// If no payment needed (e.g. revision request, or custom price, or enterprise), update status directly
const updatedDetails = {
...(currentOrder.details || {}),
latestFeedback: feedbackData,
feedbackDate: new Date().toISOString()
};
const newStatus = 'in_progress'; // Send back to dev in both cases (to finalize or revise)
const { error: updateError } = await supabase.from('orders').update({