feat: add Revolut payment link to ViewLocationCard

- Display Revolut payment link when enableRevolutPayment is enabled and tenantPaymentMethod is "revolut"
- Generate payment link with profile name (@ symbol removed), amount, currency, and reference
- Convert amount from cents to main currency unit (divide by 100, fixed to 2 decimals)
- Add placeholder for QR code (to be implemented)
- Remove unused import (inspector)

Payment link format: https://revolut.me/{profile}?amount={amount}&currency={currency}&reference={text}

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-24 15:45:19 +01:00
parent 4e9e5ca8d2
commit 7c8497ccfe

View File

@@ -145,6 +145,26 @@ export const ViewLocationCard:FC<ViewLocationCardProps> = ({location, userSettin
</>
: null
}
{
userSettings?.enableRevolutPayment && tenantPaymentMethod === "revolut" ?
<>
<p className="max-w-[25em] ml-1 mt-1 mb-1">{t("payment-info-header")}</p>
<p className="ml-1">
To pay via Revolut, please click the following link:{' '}
<Link
href={`https://revolut.me/${userSettings.ownerRevolutProfileName?.replace('@', '')}?amount=${(monthlyExpense / 100).toFixed(2)}&currency=${userSettings.currency}&reference=${encodeURIComponent(`Režije za ${locationName} ${formatYearMonth(yearMonth)}`)}`}
target="_blank"
className="text-blue-600 underline"
>
Pay with Revolut
</Link>
</p>
<label className="label p-2 grow bg-white border border-gray-300 rounded-box justify-center">
ToDo: QR Code goes here
</label>
</>
: null
}
<fieldset className="fieldset bg-base-200 border-base-300 rounded-box w-xs border p-4 pb-2 pt-0 mt-2">
<legend className="fieldset-legend font-semibold uppercase">{t("upload-proof-of-payment-legend")}</legend>
{