feat: update payment amount based on environment

Update the amountToPay in the profile.blade.php file for the association. In the production environment, the amount will be 21000 while in other environments it will be 1 for testing purposes. Also, format the printed amount with thousands separator for better readability.
This commit is contained in:
fsociety
2024-10-02 14:13:11 +02:00
parent adfeb365bf
commit 1fb59bd1d6

View File

@@ -29,7 +29,7 @@ state(['events' => []]);
state(['payments' => []]);
state(['invoice' => null]);
state(['qrCode' => null]);
state(['amountToPay' => 21000]);
state(['amountToPay' => config('app.env') === 'production' ? 21000 : 1]);
state(['currentYearIsPaid' => false]);
state(['currentPubkey' => null]);
state(['currentPleb' => null]);
@@ -58,7 +58,7 @@ on([
])
->where('pubkey', $pubkey)->first();
if ($this->currentPleb->association_status === \App\Enums\AssociationStatus::ACTIVE) {
$this->amountToPay = 21000;
$this->amountToPay = config('app.env') === 'production' ? 21000 : 1;
}
if ($this->currentPleb->paymentEvents->count() < 1) {
$this->createPaymentEvent();
@@ -155,7 +155,7 @@ $createPaymentEvent = function () {
$note->setContent(
'Dieses Event dient der Zahlung des Mitgliedsbeitrags für das Jahr ' . date(
'Y',
) . '. Bitte zappe den Betrag von ' . $this->amountToPay . ' Satoshi.',
) . '. Bitte zappe den Betrag von ' . number_format($this->amountToPay, 0, ',', '.') . ' Satoshi.',
);
$note->setTags([
['d', $this->currentPleb->pubkey . ',' . date('Y')],