mirror of
https://github.com/Motion-Games/MotionWebStudio.git
synced 2026-04-21 09:00:53 +02:00
stripe changes
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user