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
4 changes: 2 additions & 2 deletions backend/api/views/donation_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def donation_handler(request):
}
],
mode="payment",
success_url="https://google.com", # this should route to the /success page
cancel_url="https://google.com", # this should route back to the donate page
success_url="http://localhost:3000/success?session_id={CHECKOUT_SESSION_ID}", # this should route to the /success page
cancel_url="http://localhost:3000/donate", # this should route back to the donate page
)
return Response({"url": checkout_session.url}, status=status.HTTP_200_OK)
except Exception as e:
Expand Down
1 change: 0 additions & 1 deletion webapp/src/pages/about-us.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const AboutUs = (): JSX.Element => {
fetch("http://127.0.0.1:8000/api/portfolio/")
.then((response) => response.json())
.then((data) => {
console.log("API Data:", data);
setPortfolio(data.portfolio || []);
setTotalInvestment(data.total_investment || 0);
})
Expand Down
22 changes: 13 additions & 9 deletions webapp/src/pages/donate.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FC, useState, useEffect } from 'react';
import axios from 'axios';
import { useCookies } from 'react-cookie';
import { fetchDonations, fetchDonationAmount } from '@/util/charity';

interface DonationData {
Expand All @@ -17,6 +18,7 @@ interface CharityData {
const DonatePage: FC = () => {
const [loading, setLoading] = useState(false);
const [donationData, setDonationData] = useState<DonationData | null>(null);
const [cookies] = useCookies(['token']);
const [charities, setCharities] = useState<CharityData[]>([]);

useEffect(() => {
Expand All @@ -34,15 +36,17 @@ const DonatePage: FC = () => {
const handleDonate = async (fixed: string, amount: string) => {
setLoading(true);
try {
const response = await axios.post(
'http://localhost:8000/api/donation',
{ fixed, amount },
{
headers: { 'Content-Type': 'application/json' },
responseType: 'text',
validateStatus: () => true,
}
);
const response = await axios.post('http://localhost:8000/api/donation', {
fixed,
amount
}, {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${cookies.token}`
},
responseType: 'text',
validateStatus: () => true
});

const data = JSON.parse(response.data);
if (data.url) {
Expand Down
1 change: 0 additions & 1 deletion webapp/src/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export default function HomePage() {
const donationsResponse = await getTotalDonations();
const donations = donationsResponse?.data?.donation_total || -1; // Safely access donation_total and alert that something is wrong by using -1
setDonationStockData({ amount: donations });
console.log(donationsResponse.data);
};
fetchData();
}, []);
Expand Down
1 change: 0 additions & 1 deletion webapp/src/pages/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const RegisterPage: () => JSX.Element = () => {
}, []);

const handlePhoneChange = (value: string) => {
console.log("PhoneInput Raw Value:", value);
const formattedValue = value.startsWith("+") ? value : `+${value}`;
setPhoneNumber(formattedValue);
setValue("phone_number", formattedValue);
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/pages/success.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const SuccessPage: FC = () => {
const charity = "Lorem Ipsum";

// making request to backend
await axios.post('http://localhost:8000/api/send-payment-recieved-email/', { receiver: email, charity });
await axios.post('http://localhost:8000/api/send-payment-recieved-email', { receiver: email, charity });
} catch (error) {
console.error("Error sending payment received email:", error);
// TODO: Still need to add the donation record to the DB somehow
Expand Down