diff --git a/lib/Payment.php b/lib/Payment.php index 365378c2..911bef49 100644 --- a/lib/Payment.php +++ b/lib/Payment.php @@ -3,6 +3,7 @@ use Safe\DateTimeImmutable; /** * @property ?User $User + * @property string $ProcessorUrl */ class Payment{ use Traits\Accessor; @@ -18,6 +19,7 @@ class Payment{ public bool $IsMatchingDonation = false; protected ?User $_User = null; + protected string $_ProcessorUrl; // ******* @@ -28,13 +30,28 @@ class Payment{ * @throws Exceptions\UserNotFoundException */ protected function GetUser(): ?User{ - if($this->_User === null && $this->UserId !== null){ + if(!isset($this->_User) && $this->UserId !== null){ $this->_User = User::Get($this->UserId); } return $this->_User; } + protected function GetProcessorUrl(): string{ + if(!isset($this->_ProcessorUrl)){ + switch($this->Processor){ + case Enums\PaymentProcessorType::FracturedAtlas: + // This is not a permalink per se, because the FA permalink shows us the donor-facing receipt, without useful information like attribution, etc. However if we search by donation ID, we *do* get that information. + $this->_ProcessorUrl = 'https://fundraising.fracturedatlas.org/admin/general_support/donations?query=' . $this->TransactionId; + break; + default: + $this->_ProcessorUrl = ''; + } + } + + return $this->_ProcessorUrl; + } + // ******* // METHODS diff --git a/www/css/user.css b/www/css/user.css index 6d4ce1ec..055691d0 100644 --- a/www/css/user.css +++ b/www/css/user.css @@ -32,3 +32,74 @@ legend{ width: 100%; } +.payments thead{ + font-weight: bold; +} + +.payments tbody td:first-child{ + width: 100%; + font-weight: normal; +} + +.payments time{ + color: var(--body-text); +} + +.payments td + td{ + text-align: right; + width: auto; +} + +.payments td:nth-child(2){ + text-align: center; +} + +.payments td:last-child{ + text-align: left; + white-space: nowrap; +} + +.payments tbody time{ + width: auto; + margin: auto; +} + +@media(max-width: 1000px){ + .payments thead{ + display: none; + } + + .payments tbody td{ + display: block; + text-align: left; + padding: 0; + } + + .payments tbody td:first-child{ + padding-top: 2rem; + } + + .payments tbody td:nth-child(2){ + text-align: left; + } + + .payments tbody td:nth-child(2)::before{ + content: 'Recurring? '; + font-weight: bold; + } + + .payments tbody td:nth-child(3)::before{ + content: 'Gross: '; + font-weight: bold; + } + + .payments tbody td:nth-child(4)::before{ + content: 'Fee: '; + font-weight: bold; + } + + .payments tbody td:nth-child(5)::before{ + content: 'Net: '; + font-weight: bold; + } +} diff --git a/www/users/get.php b/www/users/get.php index 08ba39b8..54ce137b 100644 --- a/www/users/get.php +++ b/www/users/get.php @@ -152,6 +152,52 @@ catch(Exceptions\SeeOtherException $ex){ } ?> + +
None.
+ }else{ ?> +Created | +Recurring? | +Gross | +Fee | +Net | +Transaction ID | +
+ + | ++ if($payment->IsRecurring){ ?> + ☑ + }else{ ?> + ☐ + } ?> + | ++ $= number_format($payment->Amount, 2) ?> + | ++ $= number_format($payment->Fee, 2) ?> + | ++ $= number_format($payment->Amount - $payment->Fee, 2) ?> + | ++ = Formatter::EscapeHtml($payment->TransactionId) ?> + | +