=== CatCode Accounting Sync with Wafeq for WooCommerce ===
Contributors: catcodestudio
Tags: wafeq, accounting, invoices, woocommerce, uae
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sends WooCommerce orders to Wafeq as sales invoices, with contacts, VAT mapping, UAE place of supply, automatic retries and no duplicates.

== Description ==

Every order in your shop has to end up in your accounts. This plugin sends it to Wafeq when the order reaches a status you choose, and keeps trying when the connection is down.

Wafeq is a third-party product. This is an independent integration, not affiliated with or endorsed by Wafeq.

= What it does =

* Creates a sales invoice in Wafeq for each order, with products, shipping and fees.
* Finds or creates the contact: by customer, then by e-mail address. A changed address is updated in Wafeq. Company name and tax registration number come along.
* VAT mapping: a WooCommerce rate goes to the Wafeq sales rate with the same percentage, or to the one you choose. If there is no certain match, the order stops with a message instead of landing in the wrong place of your VAT return.
* Place of supply for UAE organizations: outside the UAE for foreign addresses, otherwise the emirate named in the state or city field, in English or Arabic, or a default you choose.
* Revenue accounts for products, shipping and fees.
* The invoice can stay a draft, or be finalized. It is created as a draft first, and a total that does not match the order stops it there.
* Invoice language: English or Arabic.
* Works through a queue. Network and server errors are retried automatically for up to about two days, and Wafeq's rate limit is respected. Problems that need your attention stop with a clear message on the order and in the queue.
* No duplicates. A document exists once per reference in the queue, and before creating anything the plugin looks it up in Wafeq, so a lost answer or a second status change does not create a second invoice.
* A box on the order, a bulk action on the orders list, and "Send again" in the queue.
* Works with High-Performance Order Storage and classic order storage.
* English and Arabic.
<!-- @pro-begin -->

= Pro =

Sold on [catcode.com.ua](https://catcode.com.ua/modules/wafeq-accounting-sync-woocommerce/) with a 7-day trial.

* Payments recorded on the invoice, with the transaction reference and an account per payment method. Cash on delivery counts as paid when the order is completed.
* Credit notes for refunds, per line or spread over the order's VAT rates for a refund entered as an amount. They settle what is open on the invoice, and the rest is recorded as money paid back.
* Finalized invoices and credit notes reported to the tax authority through Wafeq, for the organizations and document types Wafeq supports.
* A separate tax rate for sales outside the UAE.
* Revenue accounts per product category.
<!-- @pro-end -->

== Installation ==

1. Install and activate the plugin. WooCommerce has to be active.
2. In Wafeq, switch to the organization of this shop, open the API Keys settings and create a key.
3. In WooCommerce > Accounting Sync, paste the key and save. The connection is tested.
4. Open the Mapping tab: choose the revenue account and check the VAT rates.
5. If your organization is in the UAE and your checkout does not ask for the emirate, choose a default place of supply on the Connection tab.

== Frequently Asked Questions ==

= What happens to orders that existed before I installed the plugin? =

Nothing, until you send them: select them in the orders list and choose "Send to the bookkeeping".

= Does the plugin change prices or the checkout? =

No. It adds nothing to the shop front.

= Is this tax advice? =

No. You stay responsible for your bookkeeping and your VAT return. Check the mapping with your accountant.

= An order stopped with a VAT message. What now? =

Choose the Wafeq rate on the Mapping tab, or create the rate in Wafeq, and click "Send again". The invoice is created once.

= My organization is not registered for VAT. =

Choose "No tax rate" for lines without VAT on the Mapping tab.

== External services ==

This plugin connects to the Wafeq API (api.wafeq.com) to create contacts and sales invoices in your own Wafeq organization. It only does so after you add your API key.

When an order reaches a status you chose, or when you send it by hand, these data go to Wafeq: the customer's name, company, address, e-mail address, phone number and tax registration number, and the order's reference, date, lines, amounts, VAT and place of supply. The settings screens also read your organization profile, VAT rates and revenue accounts.

Wafeq [terms](https://www.wafeq.com/en/terms-of-service) and [privacy policy](https://www.wafeq.com/en/privacy-policy).
<!-- @pro-begin -->

This build also sends payments and refunds to Wafeq, and it talks to catcode.com.ua to activate the key and to look for updates. It sends the key and the site address, nothing about orders or customers.
<!-- @pro-end -->

== Changelog ==

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.0.0 =
First release.
