From 6ec16693081defffafd231c778efc2dc9da2f9fe Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Wed, 26 Apr 2023 15:54:30 -0500 Subject: [PATCH] Update payment process script to work around FA additions --- scripts/process-pending-payments | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/process-pending-payments b/scripts/process-pending-payments index 65eade8e..a64bd0fa 100755 --- a/scripts/process-pending-payments +++ b/scripts/process-pending-payments @@ -151,11 +151,15 @@ try{ } $payment->Created = DateTime::createFromFormat('n/j/Y', trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "Created On"]]'))->getText())); - $payment->TransactionId = trim(str_replace('View on Finance', '', $detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "ID"]]'))->getText())); $payment->IsRecurring = sizeof($headerRow->findElements(WebDriverBy::xpath('//td[contains(., "Recurring")]'))) > 0; $payment->Amount = floatval(str_replace('$', '', trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "Total Amount"]]'))->getText()))); $payment->Fee = floatval(str_replace('$', '', trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "Fee"]]'))->getText()))); + $transactionId = $detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "ID"]]'))->getText(); + $transactionId = str_replace('View on FS', '', $transactionId); + $transactionId = str_replace('View on Finance', '', $transactionId); + $payment->TransactionId = trim($transactionId); + // We might also get a case where the donation is on behalf of a company match, but there's not really a way to distinguish that. Do a rough check. // See donation 00b60a22-eafa-44cb-9850-54bef9763e8d if($payment->User !== null && preg_match('/\b(L\.?L\.?C\.?|Foundation|President|Fund|Charitable)\b/ius', $payment->User->Name)){