Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payments.Completed not set for 6000 donations #783

Open
tiagonmas opened this issue Dec 5, 2024 · 7 comments
Open

Payments.Completed not set for 6000 donations #783

tiagonmas opened this issue Dec 5, 2024 · 7 comments
Assignees
Labels
prio:High Issue of higher priority. Should be addressed first

Comments

@tiagonmas
Copy link
Collaborator

Describe the bug
Checking SQL below returns Paid donations but Payment is not set as completed

SELECT  top(10) dbo.Donations.*, dbo.Payments.*
FROM    dbo.Donations INNER JOIN
         dbo.Payments ON dbo.Donations.Id = dbo.Payments.DonationId
WHERE  (dbo.Donations.PaymentStatus = 1) AND (dbo.Payments.Completed Is NULL) order by Donations.id desc

several other are

@tiagonmas tiagonmas added the prio:High Issue of higher priority. Should be addressed first label Dec 5, 2024
@guerrerotook
Copy link
Contributor

For me that query only return 10 rows in PROD, Am I missing something?

@tiagonmas
Copy link
Collaborator Author

its because of the Top 10 :) .... below will return around 6000

SELECT  top(10) dbo.Donations.*, dbo.Payments.*
FROM    dbo.Donations INNER JOIN
         dbo.Payments ON dbo.Donations.Id = dbo.Payments.DonationId
WHERE  (dbo.Donations.PaymentStatus = 1) AND (dbo.Payments.Completed Is NULL) order by Donations.id desc

@guerrerotook
Copy link
Contributor

I found that the query that we should execute is this:

SELECT dbo.Donations.*, dbo.Payments.* FROM dbo.Donations INNER JOIN dbo.Payments ON dbo.Donations.ConfirmedPaymentId = dbo.Payments.Id WHERE (dbo.Donations.PaymentStatus = 1) AND (dbo.Payments.Completed Is NULL) order by Donations.id desc

And compared the ConfirmedPayId and the PaymentId so we only check payments that are the one confimed. That query is down to 3307 in PROD.

I am going to create a small tool to update this from the EasyPay API, this seem that we have an issue with the notifications.

@tiagonmas
Copy link
Collaborator Author

Those are 2 slightly different ways of doing the joins thus making it return different results ... but great anyway :)

@guerrerotook
Copy link
Contributor

So I executed the tool, and we are down to 430 rows missing this completed date that have a missing completed date.

@guerrerotook
Copy link
Contributor

The rest are from PayPal.

@tiagonmas
Copy link
Collaborator Author

my initial sql query was listing all payments that not complete, that were associated with a donation that was paid ... so we can ignore those. Your SQL is only looking at the confirmed payments and is more correct.
When running your SQL, I see that all donations that show up are from 2021.

guerrerotook added a commit that referenced this issue Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio:High Issue of higher priority. Should be addressed first
Projects
None yet
Development

No branches or pull requests

2 participants