Add logic for accepting payments from soft credits marked as 'anonymous'

This commit is contained in:
Alex Cabal 2025-02-28 11:43:39 -06:00
parent 7b278da43a
commit c9e5026cf4
2 changed files with 9 additions and 4 deletions

View file

@ -153,8 +153,14 @@ try{
$payment->IsMatchingDonation = true;
}
// Sometimes a soft credit is `Anonymous` or `Anonymous Anonymous`.
// See donation `7f296e18-6492-48e1-aeca-5063c6a0bbbb`.
if($hasSoftCredit && preg_match('/Anonymous(\s*Anonymous)*/ius', $payment->User->Name)){
$payment->User = null;
}
// We can get here via an AOGF donation that is anonymous.
if(!$hasSoftCredit && ($payment->User->Email == 'Not provided' || $payment->User->Email == '')){
if(!$hasSoftCredit && ($payment->User?->Email == 'Not provided' || $payment->User?->Email == '')){
$payment->User = null;
}
}