# Sending JEVAPOS to technicians

## Owner procedure

1. Finish and test the required changes in your normal development project.
2. Open `E:\xampp\htdocs\jevapos.com` in File Explorer and double-click
   `Build-Client-Package.cmd`. Do not manually zip the development directory.
3. Choose **1 NEW INSTALLATION** or **2 UPDATE**, then wait for
   `CLIENT PACKAGE CREATED AND CHECKED`. The output folder opens.
4. Send ONLY the newly generated `JEVAPOS-CLIENT-...zip` from
   `outputs\client-releases`. A failed build must not be distributed.
5. The technician follows `CLIENT_INSTALLATION.txt` inside that ZIP. Instructions
   distinguish a fresh installation from updating an existing client.
6. When the technician submits an activation request, sign into your private
   owner ERP yourself and issue the licence. Send the licence, not your password.
7. Repeat these same steps for the next client change. Do not send the owner's
   `config/license.php` separately: the package builder supplies the client version.

You keep one application codebase. The generated client's licence configuration
is deliberately different from the owner's configuration. Building never edits
your `.env`, signing keys, application configuration or database.

**Never extract a client package over your own issuing ERP or development project.**
That would replace its licence configuration with a verifier-only client profile.

## What the technician does

### Existing client update

1. Back up that client's database and files before a maintenance window.
2. Extract the ZIP into a separate folder. Copy its contents over the client
   project; do not delete the existing project folder first.
3. Keep that client's existing `.env`, application key, database, uploaded files,
   printer/attendance settings and runtime storage. The ZIP does not contain a
   replacement database or `.env`. UPDATE builds also omit WordPress wp-config.php
   and uploaded images, so existing client website/database credentials and
   uploaded media are not replaced by the development copy. INSTALL builds retain them.
4. In a terminal inside the client project, using its installed PHP, run:

```text
php artisan optimize:clear
php artisan migrate --force
php artisan security:check-license-access --client
```

Every security check must show PASS. Do not run `key:generate`, `migrate:fresh`,
`migrate:refresh` or `db:wipe` on an existing installation.

5. Log out/back in, test the business workflows and confirm client users cannot
   open `/customer-activations`. Existing signed keys remain usable if their
   verification key and installation binding still match.
6. Copying does not remove old files. Check for any previously distributed owner
   `.env` backups, private keys, owner database dumps and old cached configuration.
   Stop if a signing key was exposed; deleting the file does not revoke copies.

### New client

1. Extract the INSTALL ZIP's `jevapos.com` folder into XAMPP `htdocs`.
2. Create the database and credentials in phpMyAdmin.
3. Import the separately supplied, matching clean client database through HeidiSQL.
4. Edit the included `.env` database settings and `APP_URL`.
5. Start Apache/MySQL, open the login page and request activation.
6. The owner issues the licence; the technician enters it and signs in with the
   client setup account, not the private owner password.

The INSTALL ZIP already has a fresh Laravel APP_KEY in its client-only `.env`;
no `key:generate`, template copying or migration command is required for a new
installation using the matching complete database. Build a new INSTALL package
for each client so the encryption key is not reused. This is an application key,
not the private key that signs licences. Never use the INSTALL ZIP to overwrite
an existing client; use the UPDATE option, which deliberately contains no `.env`.

Website files are retained. WordPress/website databases and connection settings
remain separate from the POS database and require their own configuration.

## Release checks

The builder retains the project files, including the website, dependencies,
images in public uploads and storage/app/public, custom folders/comments and
`storage/update-db.php`. It excludes build outputs, private signing keys, owner
environment files, database/archive backups and sensitive runtime data such as
cached configuration, sessions, licence identity, import/export/test data and logs.
The public verification key remains. The client
config fixes enforcement on, legacy acceptance off, issuing off, owner ID zero and
private signing key settings empty. These choices do not depend on `.env` flags.
The key-pair generation CLI is not shipped. Existing client keys and account data
are not rewritten by the packaging process.

The ZIP is reopened and checked before it is reported successful. A SHA256 hash
is printed for transfer verification. PHP ZipArchive must be enabled on the
owner's build machine (it is available in this XAMPP installation).

These controls prevent licence issuing through the unchanged client application.
They are not source-code encryption: someone with full filesystem access can
alter PHP. Source tampering and signing-key compromise require separate controls.

## Ownership markers

Custom folders and attribution comments are retained unless they fall inside a
security/runtime exclusion. Use a business copyright notice or other non-sensitive
identifier. Do not distribute personal identity documents, banking information,
passwords or private credentials as ownership markers. Copied comments/files can
be removed or fabricated and are not conclusive proof of authorship; retain dated
source history and release records independently.

The package denies direct HTTP access to storage through storage/.htaccess.
The retained updater is not a public authenticated update endpoint; do not expose
it by copying it into public without appropriate security controls.
