Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ admin_password: "hunter2"
secret_key: insecure-change-in-production

# Payment configuration
# Dummy provider is enabled by default for testing
# For production, configure Stripe or another provider
payment:
stripe:
api_key: "TEST API KEY you'll need to replace this with the one from stripe"
webhook_secret: "whsec_8c7f1687b9e1ca58dfe81a28a5de3fd1fdffac83821f8f4cabc6ad2145669cde"
price_id: "price_1SUSd1GdjfBnc3h7uHVkmhGg"
host_url: "http://localhost:3001" # Base URL for webhooks and redirects
dummy:
host_url: "http://localhost:3001"
amount: 100.00

# Model sources - inference endpoints to connect to
# Uncomment and configure as needed
Expand Down
7 changes: 1 addition & 6 deletions dashboard/src/api/control-layer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -810,12 +810,7 @@ const paymentsApi = {
response,
);
}
const errorData = await response.json().catch(() => ({}));
throw new ApiError(
response.status,
errorData.message || "Failed to process payment",
response,
);
throw new Error(`Failed to process transaction: ${response.status}`);
}

// Explicitly return to ensure promise resolves
Expand Down
1 change: 0 additions & 1 deletion dashboard/src/api/control-layer/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,6 @@ export function useProcessPayment(options?: {
options?.onSuccess?.();
},
onError: (error) => {
console.error('[useProcessPayment] onError callback triggered:', error);
// Call the component's error callback if provided
options?.onError?.(error as Error);
},
Expand Down
1 change: 0 additions & 1 deletion dashboard/src/api/control-layer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export type ApiKeyPurpose = "platform" | "inference";
export interface ConfigResponse {
region: string;
organization: string;
registration_enabled: boolean;
payment_enabled: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ export function CostManagement() {
const processPaymentMutation = useProcessPayment({
onSuccess: () => {
setTimeout(() => {
console.log('Closing modal now');
setShowSuccessModal(false);
}, 2000);
},
onError: (error) => {
console.error('Payment processing error:', error);
}
});

// Handle return from payment provider
Expand Down Expand Up @@ -87,9 +83,8 @@ export function CostManagement() {
description: "Funds purchase - Demo top up"
});
toast.success(`Added $${fundAmount.toFixed(2)}`);
} catch (error) {
} catch {
toast.error("Failed to add funds");
console.error("Error adding funds:", error);
}
} else if (config?.payment_enabled) {
// Payment processing enabled: Get checkout URL and redirect using the mutation hook
Expand All @@ -101,10 +96,8 @@ export function CostManagement() {
} else {
toast.error("Failed to get checkout URL");
}
} catch (error) {
const errorMessage = error instanceof Error ? error.message : "Failed to initiate payment";
toast.error(errorMessage);
console.error("Error creating payment:", error);
} catch {
toast.error("Failed to transfer to payment provider.");
}
} else {
toast.error("Payment processing is not configured");
Expand Down Expand Up @@ -161,14 +154,9 @@ export function CostManagement() {
"Processing your payment and updating your account balance..."
) : processPaymentMutation.isError ? (
<div className="space-y-2">
<p className="text-red-600">
{processPaymentMutation.error instanceof Error
? processPaymentMutation.error.message
: "Failed to process payment"}
</p>
<p>Your payment has been captured but not yet applied to your account.</p>
<p className="text-sm text-gray-600">
Your payment may have been successful, but we couldn't confirm it yet.
If your balance doesn't update within a few minutes, please contact support.
Your balance should update automatically within a few minutes. If it doesn't, please contact support.
</p>
</div>
) : (
Expand Down
4 changes: 0 additions & 4 deletions dwctl/src/api/handlers/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use crate::{AppState, api::models::users::CurrentUser};
pub struct ConfigResponse {
pub region: String,
pub organization: String,
pub registration_enabled: bool,
pub payment_enabled: bool,
}

Expand All @@ -36,8 +35,6 @@ pub async fn get_config(State(state): State<AppState>, _user: CurrentUser) -> im
let response = ConfigResponse {
region: metadata.region.clone(),
organization: metadata.organization.clone(),
// Compute registration_enabled based on native auth configuration
registration_enabled: state.config.auth.native.enabled && state.config.auth.native.allow_registration,
// Compute payment_enabled based on whether payment_processor is configured
payment_enabled: state.config.payment.is_some(),
};
Expand Down Expand Up @@ -71,7 +68,6 @@ mod tests {
// Check that metadata fields are present
assert!(json.get("region").is_some());
assert!(json.get("organization").is_some());
assert!(json.get("registration_enabled").is_some());
}

#[sqlx::test]
Expand Down
Loading