From 8b02a0ab3966c426588255a771cfd31e30329a96 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Wed, 18 Sep 2024 11:45:46 -0500 Subject: [PATCH] Remove commas from payment values when processing payments --- scripts/process-pending-payments | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/process-pending-payments b/scripts/process-pending-payments index ff80d999..d8eefbf6 100755 --- a/scripts/process-pending-payments +++ b/scripts/process-pending-payments @@ -155,8 +155,8 @@ try{ $payment->Created = DateTimeImmutable::createFromFormat('n/j/Y', trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::th[normalize-space(.) = "Created"]]'))->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::th[normalize-space(.) = "Total Amount"]]'))->getText()))); - $payment->Fee = floatval(str_replace('$', '', trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::th[normalize-space(.) = "Fee"]]'))->getText()))); + $payment->Amount = floatval(preg_replace('/[^0-9\.]/', '', trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::th[normalize-space(.) = "Total Amount"]]'))->getText()))); + $payment->Fee = floatval(preg_replace('/[^0-9\.]/', '', trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::th[normalize-space(.) = "Fee"]]'))->getText()))); $transactionId = (string)($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::th[normalize-space(.) = "ID"]]'))->getText()); $transactionId = str_replace('View on FS', '', $transactionId);