Bahari KYC for Magento 2 / Adobe Commerce
=========================================

Requirements: Magento Open Source or Adobe Commerce 2.4.x, PHP 8.1 or newer with curl.

Install
1. Copy app/code/Bahari/Kyc from this zip into your Magento root, so the module is at
   app/code/Bahari/Kyc.
2. Run from the Magento root:
     bin/magento module:enable Bahari_Kyc
     bin/magento setup:upgrade
     bin/magento setup:di:compile          (production mode only)
     bin/magento setup:static-content:deploy   (production mode only)
     bin/magento cache:flush
3. In the admin open Stores > Configuration > Customers > Bahari KYC. Paste a secret API key
   from the Bahari KYC dashboard (API keys). Keys start with sk_live_. Save.
4. In the Bahari KYC dashboard open Webhooks and add an endpoint with the Webhook URL shown in
   the Connection group. Copy the signing secret (whsec_...) into the module settings and save.
5. The Connection group should say OK.
6. Magento cron must be running (bin/magento cron:run every minute). It re-checks open
   verifications every 15 minutes in case a webhook was missed.

Customer page
  Customers verify at My Account > Identity verification (/baharikyc/verify).
  Link it from your menu or emails.

Settings (Checkout and orders)
  Require verification at checkout   Customers must be signed in and verified before they can
                                      place an order with products in scope. Checkout sends them
                                      to the verification page, and orders placed through the
                                      REST or GraphQL API are refused too. Guest checkout is not
                                      possible for those products. Orders created by an admin
                                      are not stopped.
  Put new orders on hold              Orders from unverified customers with products in scope are
                                      put on hold, with a comment. They are released automatically
                                      when the customer is approved. Guest orders are held too and
                                      have to be released by hand.
  Applies to                          All products, or only products in the chosen categories
                                      (subcategories included).
  Declined customers can try again    Otherwise they need to contact you.

Admin
  Customers > Identity verification   Recent verifications, look up a customer by ID, re-check
                                      the status, get a verification link to send, re-check all
                                      open verifications.
  Customer page                       Identity verification tab with the status, reason codes and
                                      a link to the session in the Bahari KYC dashboard.
  Order page                          The customer's verification status in Order & Account
                                      information.
  Command line                        bin/magento bahari-kyc:sync re-checks open verifications now.

Data
  Only the session id, status and reason codes are stored, in the table bahari_kyc, plus a
  bahari_kyc_hold flag on sales_order for orders this module put on hold.
  Photos and document data stay in Bahari KYC.

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