Bahari KYC for Odoo
===================

Requirements: Odoo 17 (Community or Enterprise). No extra Python packages.
The server must be reachable over HTTPS from the internet for webhooks.

The zip has three addon folders:
  bahari_kyc               Main addon. Needs only Portal (installed with most apps).
  bahari_kyc_sale          Installs itself when Sales is installed. Order confirmation rule.
  bahari_kyc_website_sale  Installs itself when eCommerce is installed. Checkout rule.

Install
1. Copy the three folders into your Odoo addons path (for example /mnt/extra-addons)
   and restart Odoo.
2. Turn on developer mode, open Apps, click Update Apps List, search for Bahari KYC
   and click Activate. Or from the command line: odoo -d <db> -i bahari_kyc --stop-after-init
3. Open Settings > Bahari KYC. Paste a secret API key from the Bahari KYC dashboard
   (API keys). Keys start with sk_live_. Click Test connection. It should say Connected.
4. In the Bahari KYC dashboard open Webhooks and add an endpoint with the Webhook URL
   shown in Settings > Bahari KYC (https://<your odoo>/bahari_kyc/webhook).
   Copy the signing secret (whsec_...) into Signing secret and click Save.
5. Check that Settings > Technical > System Parameters > web.base.url is your public
   https address. The webhook URL and the return link are built from it.

Customer portal
  Customers verify at /my/verification (My account > Identity verification).
  Link it from your website menu or emails. The page starts a new verification,
  continues an unfinished one, and shows the status.

Contacts
  Each contact has an Identity verification tab with the status, the reason codes,
  the date of approval, Open in Bahari KYC (dashboard link) and Refresh status.
  The contact list has filters Identity verified, Verification open and Verification declined.
  A contact counts as verified when it, or the company it belongs to, is approved.

Settings
  Declined customers can try again        Otherwise they need to contact support.
  Require verification at shop checkout   Unverified customers are sent to the verification page
                                          instead of the payment step (needs eCommerce).
  Block confirming orders                 Staff cannot confirm quotations of unverified customers
                                          (needs Sales). Orders confirmed by an online payment
                                          are not stopped; use the checkout rule for the shop.

Webhooks and sync
  Webhooks update the status immediately. Signatures are checked (Verify-Signature,
  5 minute tolerance) and repeated events are dropped (Verify-Event-Id).
  The webhook log is under Settings > Bahari KYC > Webhook log, kept for 30 days.
  A scheduled action re-checks open sessions every 15 minutes in case a webhook was missed.
  If one Odoo server hosts several databases, set dbfilter so the webhook URL
  reaches the right database.

Data
  Only the session id, applicant id, status, reason codes and dates are stored on the contact.
  Photos and document data stay in Bahari KYC. Uninstalling the addon removes these fields.

Odoo 16 and 18
  Built and tested on Odoo 17. On Odoo 18 remove the numbercall line in
  bahari_kyc/data/ir_cron.xml. Odoo 16 needs older view syntax and is not supported yet.

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