# FlaroCity KittyCats Payment Station 0.4.0

This folder contains the source scripts for the FlaroCity KittyCats Second Life payment station.

## Files

- `kittycats_payment_core_040.lsl` — terminal registration, secure server sessions, payment preservation, retries, hover text, and customer confirmation messages.
- `kittycats_payment_menu_040.lsl` — owner setup and customer plan menu.

## Default hover text

```text
FlaroCity KittyCats
Payment Station
Status: Off
```

The station changes to `Status: On` only after the server confirms that the terminal is authenticated and Linden charging is enabled.

## Security model

- The distributed source contains only `REPLACE_BEFORE_COMPILE`; it never contains the live registration key.
- The server returns a terminal token that is stored in protected linkset data, not the visible object description.
- The server, not LSL, selects the product price and duration.
- Each customer selection creates a one-avatar, one-price, 60-second purchase session.
- The LSL `money` event supplies the payer and amount. The station adds a unique event UUID, protects pending callbacks in linkset data, and retries only transient HTTP failures.
- One purchase session and one station event can grant access only once.
- Wrong payer, wrong amount, missing session, stale confirmation, or processing failure is preserved for administrator review instead of silently discarded.
- After a confirmed payment, the payer receives a direct message saying the payment succeeded and showing the access state or expiration.

## Before compiling

1. On the server, set a long random `KITTYCATS_PAYMENT_TERMINAL_REGISTRATION_KEY`.
2. Put the same value into `REGISTRATION_KEY` in `kittycats_payment_core_040.lsl`.
3. Compile the Core script and set the compiled script **no modify** before placing the station in public use.
4. Keep the Core and Menu scripts in the same object/linkset.
5. Leave `KITTYCATS_LINDEN_PAYMENTS_ENABLED=false` until every staging test below passes.
6. To preregister a station while charging is off, temporarily enable `KITTYCATS_PAYMENT_TERMINAL_SETUP_ENABLED=true`; this does not permit purchases.

## Required launch tests

- default hover text is exactly the three-line Off status;
- registration key missing and invalid;
- registration and token persistence after reset;
- owner change clears terminal credentials;
- server charging disabled keeps the hover status Off;
- two avatars attempt selection at the same time;
- wrong avatar pays;
- wrong amount is paid;
- payment arrives without a valid session;
- session expires before payment;
- API becomes unavailable after money transfers;
- script resets with one or more pending payments;
- duplicate station callback;
- weekly and monthly Pro early renewal;
- L$995 Auction Account renewal extends its current Auction expiry;
- no weekly Auction Account option is offered;
- payment by an avatar not yet linked to a web account;
- avatar linking later claims the preserved payment;
- payer receives the successful-payment message;
- terminal revocation returns the station to Status: Off.

Production charging must remain disabled until these tests are approved end to end in Second Life.
