Open tiagonmas opened 10 months ago
Easypay has the payment confirmation for generic but skip for payment message:
Let me take a look
So, what has been happening is that as part of the payload that easypay sent us for the payment and generic notification they have been including a new field account with an empy id. Like this:
"account": {
"id": ""
},
That empty id was making the json parser to fail because the property wasn't set to nullable in the model. So instead of changing the value I set this to Guid.Empty for now because that may potentially affect a lot of model classes.
I'm going to push a change into master adding a new class GuidConverter and add this converter to the configuration in the API. This solve the issue when simulating a easypay payment notification in my local PC.
we're having Null exceptions in production, and that is because Donation.ConfirmedPaymentId is not being set, and then when we try to fetch donation.ConfirmedPayment.Created we get the null exception.
DateTime donationPaidDate = donation.ConfirmedPayment.Created;
Fixed in bee04c360f711a37ae78749b6ad4edde2b648a3c
made a new payment and still got an error when generating the invoice. Needs more investigation. FYI @guerrerotook
When I try to generate the invoice again (going to donation history) I can see the invoice.
There are still some situations throwing an error. For ex:
select top 10 * from Donations where Id=27027
select top 100 * from Payments where DonationId=27027
select top 100 * from Invoices where DonationId=27027
I'm still seeing the issue @guerrerotook . I can repro in dev. It seems to be time based ... If I donate and try to click on "To claim the invoice click [here .]" immediately, it throws an error. If I refresh it continues to give an error for some seconds, and then it works ...
I see, I tested a couple of times and it work for me, but I see what you said, because it could be a delay between you click and easypay sent us the invoice.
might not be related but I'm seeing this exception "An error occurred while saving the entity changes. See the inner exception for details. Cannot insert duplicate key row in object 'dbo.Invoices' with unique index 'IX_Invoices_Sequence_FoodBank_Id_Year'. The duplicate key value is (420, 19, 2023). "
above message is not related. When I get the error in generating the invoice, I see that event log has "CreateInvoice-InvoiceWithPaymentStatusNotPayed" fired. After a while the issue goes away. This happens after we are presented the Thanks page. How can the payment status not be updated yet and we are at the Thanks page ?
To repro this, make a donation (issue happens with MbWay at least) and when you get to thanks page very quickly follow "To claim the invoice click [here .]"
I added a bit more telemetry to better understand what is happening.
In the example below I refreshed 5 times until I got the invoice. We are showing the Thanks page before actually receiving the confirmation of payment.
added more telemetry in dev to trace easypay generic and payment notifications. Here is the flow ... I click ed on invoice, got a error, waited and then it worked.
Describe the bug A user paid for a donation and did not receive the invoice. The Generate Invoice is not working for this donation.
The log shows a "CreateInvoice-ConfirmedFailedPaymentStatus" event. This is because the Donation record is false in ConfirmedPayment. SQL select top 10 from Donations where Id=27131 select top 10 from Payments where DonationId=27131 select top 10 * from Invoices where DonationId=27131
Returns Donation
Payments
Code
Investigation By looking at
we see several payments that have sucess, but not a completed date.
Discriminator Total MultiBankPayment 1601 MBWayPayment 97 CreditCardPayment 206