Bahari KYC for HostBill
=======================

Requirements: HostBill with PHP 7.4 or newer (tested on 7.4 and 8.2) with curl.

Install
1. Upload the contents of this zip to the HostBill root folder. It creates
   includes/modules/Other/baharikyc/.
2. In HostBill admin open Settings > Modules > Plugins (Inactive plugins), find Bahari KYC and activate it.
3. Paste a secret API key from the Bahari KYC dashboard (API keys). Keys start with sk_live_.
4. In the Bahari KYC dashboard open Webhooks and add an endpoint with the URL shown on the module's
   admin page (Extras > Plugins > Bahari KYC). Copy the signing secret (whsec_...) into the module settings.
5. Open the module's admin page. Connection should say OK.

Client area
  Clients verify at index.php?cmd=baharikyc. Link it from your menu, client area or emails.

Admin
  Extras > Plugins > Bahari KYC shows the connection check, webhook URL, a client lookup with
  Re-check status and Get verification link, recent verifications, held accounts and a short log.
  The client profile shows a status box with a link to the session in the Bahari KYC dashboard.

Settings
  Require verification to order       Off, all orders, or only the listed order page ids. Logged-in
                                      clients who are not verified are sent to the verification page
                                      when they open the cart.
  Hold setup for unverified clients   Automatic account creation is stopped until the client is approved.
  Run held setup after approval       Accounts that were held are created when the client is approved.
  Admins can run setup manually       Create clicked by an admin is not stopped.
  Declined clients can try again      Otherwise they need to contact support.

Status updates
  Webhooks update the status right away. The HostBill cron (every 5 minutes) also re-checks
  verifications that are still open, in case a webhook was missed.

Limits
  HostBill has no hook to stop checkout, so the ordering check runs in the client's browser on cart
  pages and does not apply to guests. Use Hold setup for unverified clients as the real gate: it is
  checked on the server before any account is created.

Data
  Only the session id, status and reason codes are stored, in the table hb_baharikyc. Held accounts
  are listed in hb_baharikyc_held and the module log in hb_baharikyc_log. Photos and document data
  stay in Bahari KYC. Deactivating the module keeps the tables.

Help and documentation: https://kyc.baharione.com/docs#hostbill
Support: support@baharione.com
