# bonlineco/module-tajersystem

> Syncs orders, products, and stock data from Magento 2 to TajerSystem ERP.

`composer require bonlineco/module-tajersystem`

Canonical URL: https://packagento.com/bonlineco/module-tajersystem

## At a glance

- **Vendor**: bonlineco (https://packagento.com/bonlineco.md)
- **Latest version**: 2.7.1 — released 2026-07-24
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/bonlineco/module-tajersystem and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require bonlineco/module-tajersystem:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Syncs orders, products, and stock data from Magento 2 to TajerSystem ERP.

## README

Official connector module that links a Magento 2 / Adobe Commerce store to
[TajerSystem](https://tajersystem.com) — real-time profit, VAT and inventory
analytics for Magento merchants.

**See what it feeds:** [open the live TajerSystem demo](https://app.tajersystem.com/login?demo=1&lang=en) — one click, no signup.

### What's new in 2.7

Version 2.7 turns the sync from "orders and totals" into an **accounting-grade
financial event ledger** living inside your own Magento database:

- **Immutable financial events** — order placement, invoices, payment
  authorizations/captures, credit memos, refunds, shipments, deliveries and
  returns are each recorded as append-only events, protected by database
  triggers so history can never be rewritten (not even by the module itself).
- **Outbox with auto-recovery** — financial changes are delivered through a
  durable outbox (`tajersystem_financial_change`); a recovery cron re-queues
  anything missed within 5 minutes, so no financial change is ever lost.
- **Delivery evidence endpoint** — `POST /V1/tajersystem/orders/:orderId/delivery-evidence`
  records real carrier delivery confirmation instead of inferring it from a
  mutable order status (essential for COD profit recognition).
- **Structured tax evidence** — order payloads carry explicit net/tax/gross
  per line; VAT reports reconcile against evidence, not reverse-engineered totals.
- **Consent-gated marketing touchpoints** (dormant by default) — allowlisted
  UTM/referrer capture that only fires behind a CMP-owned consent cookie; the
  module never sets the cookie itself.
- Still **zero extra infrastructure**: DB-backed queues + standard Magento
  cron. No RabbitMQ, no middleware.

See [CHANGELOG.md](CHANGELOG.md) for details. 2.7.1 fixes trigger installation
on MariaDB / MySQL 8.

### What it does

- **Real-time push sync** — observers on `sales_order_save_after`,
  `catalog_product_save_after`, `inventory_source_item_save_after` and
  `customer_save_after` push changes to TajerSystem the moment they happen.
- **One-click connect** — a *Connect* button in Stores → Configuration
  generates a short-lived setup token; TajerSystem exchanges it for a scoped
  integration token (`POST /V1/tajersystem/exchange-token`). No copying API
  keys around.
- **Pull API for TajerSystem** — REST endpoints under `/V1/tajersystem/*`
  let the platform manage orders (status, invoice, ship, refund, comment),
  adjust stock, and update product price/status — so actions taken in
  TajerSystem reflect back into Magento.
- **Backfill commands** — `bin/magento tajersystem:sync:orders`,
  `tajersystem:sync:products`, `tajersystem:sync:stock` for initial or
  catch-up sync.
- **Housekeeping cron** — expired setup tokens are cleaned automatically.

### Requirements

- Magento Open Source / Adobe Commerce **2.4.x**
- PHP **8.1+** (8.3 supported) with **ext-bcmath** (exact money math)
- MSI modules (`magento/module-inventory-api`) recommended for salable-qty sync

### Installation

#### Via app/code

```bash
mkdir -p app/code/Bonlineco/TajerSystem
## copy this repository's contents there, then:
bin/magento module:enable Bonlineco_TajerSystem
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
```

#### Via composer (path or VCS repository)

```bash
composer config repositories.tajersystem vcs https://github.com/o0mohd0o/magento2-tajersystem-connector
composer require bonlineco/module-tajersystem
bin/magento module:enable Bonlineco_TajerSystem && bin/magento setup:upgrade
```

### Connecting your store

1. Create a free TajerSystem account at [tajersystem.com](https://tajersystem.com) (14-day trial, no card).
2. In Magento admin: **Stores → Configuration → TajerSystem → Connect** — click *Generate connect link*.
3. Open the link — TajerSystem exchanges the setup token and starts the first
   full sync automatically. Your profit numbers appear within minutes.

### Security notes

- The setup token is single-use and short-lived; the permanent integration
  token is scoped to the endpoints listed above.
- The module only talks to the TajerSystem URL configured under
  **Stores → Configuration → TajerSystem** (default `https://app.tajersystem.com`).
- No telemetry, no third-party calls.

### License

[OSL-3.0](LICENSE) — the same license family as Magento Open Source itself.

---

Built by [BONLINE TECHNOLOGIES LTD](https://tajersystem.com/en/about) — a team
that runs Magento stores, for people who run Magento stores.

## Changelog

All notable changes to the `bonlineco/module-tajersystem` module are documented in this file.

### 2.7.1 — 2026-07-24

#### Fixed

- **Production activation compatibility fixes**
  - Completed Magento service-contract and queue message PHPDoc metadata.
  - Created compound trigger bodies through Magento's `multiQuery` API.
  - Marked the three trigger data patches `NonTransactionable` so Magento does not wrap trigger DDL in a transaction.
  - Made the trigger patch intentionally non-revertable/data-preserving to avoid Magento's transactional DDL conflict.

---

### 2.7.0 — 2026-07-24

#### Added

- **Immutable financial-event sync & payload contracts** (Spec 001 Reconciled Profitability)
  - Added support for explicit contract-allowed financial event payload types (`order_placed`, `invoice_issued`, `payment_authorized`, `payment_captured`, `credit_issued`, `refund_paid`, `shipment_completed`, `delivery_completed`, `return_received`) carrying `source_namespace=magento:{store_code}` and immutable stored `economic_origin_key`.
- **Structured sales-line tax evidence capture**
  - Expanded order payload serialization in `OrderPayloadBuilder` to preserve explicit net/tax/gross and structured output-tax evidence without totals-based inference, leaving output line recoverability fields null.
- **Consent-aware marketing touchpoint capture**
  - `CaptureMarketingTouchpoint` observer wired to capture allowlisted UTM params, referrer, and consent-aware acquisition parameters on first landing.
  - `CopyMarketingTouchpointToOrder` observer transfers touchpoints from quote to order context for attribution processing.
- **Durable queue topology & payload compatibility**
  - Enhanced queue message consumers and payload serialization to maintain backward and forward compatibility between Magento and TajerSystem SaaS versions.

---

### 2.6.0 — 2026-03-01

#### Changed

- **Outbound sync request context header** (Sprint E Task 7.3)
  - `Model/Client/TajerSystemClient` now sends `X-Magento-Website-Id` on outbound sync requests (`orders/upsert`, `products/upsert`, `stock/update`, `customers/upsert`).
  - This header carries Magento website context to TajerSystem's inbound webhook receiver for safer multi-connection mapping.

---

### 2.5.0 — 2026-03-01

#### Added

- **Customer sync pipeline** (Sprint E Task 6.1)
  - `CustomerSyncObserver` wired to `customer_save_after` to publish customer sync messages.
  - Queue contract + wiring for customer sync: topic `tajersystem.customer.sync`, publisher/topology bindings, queue `tajersystem.customer.sync.queue`, consumer `tajersystem.customer.sync.consumer`.
  - Customer sync message + processing classes: `CustomerSyncMessage`, `CustomerSyncConsumer`, and `CustomerPayloadBuilder`.
- **Customer pull endpoint** — `GET /rest/V1/tajersystem/customers` for TajerSystem ERP pull sync with pagination and optional `updated_after` / `website_id` filtering.
  - **Service contract:** `Bonlineco\TajerSystem\Api\CustomerManagementInterface` (`getList`).
  - **Implementation:** `Bonlineco\TajerSystem\Model\Customer\GetCustomersService`.

#### Changed

- `etc/acl.xml` — added `Bonlineco_TajerSystem::customers` ACL resource.
- `etc/di.xml` — added `CustomerManagementInterface` to `GetCustomersService` preference.
- `etc/webapi.xml` — added route `GET /V1/tajersystem/customers` with `Bonlineco_TajerSystem::customers` resource.
- `composer.json` — version bumped to `2.5.0`.

---

### 2.4.0 — 2026-03-01

#### Added

_(Changelog truncated for .md surface. Full history on https://packagento.com/bonlineco/module-tajersystem.)_

## Recent Versions

| Version | Released |
|---|---|
| 2.7.1 | 2026-07-24 |

## Dependencies

### Require

| Package | Constraint |
|---|---|
| ext-bcmath | * |
| magento/framework | ^103.0 |
| magento/module-catalog | ^104.0 |
| magento/module-checkout | ^100.4 |
| magento/module-config | ^101.2 |
| magento/module-integration | ^100.4 |
| magento/module-quote | ^101.2 |
| magento/module-sales | ^103.0 |
| magento/module-store | ^101.1 |
| magento/module-tax | ^100.4 |
| php | ^8.1 |

### Require (dev)

| Package | Constraint |
|---|---|
| phpunit/phpunit | ^10.5 |

### Suggest

| Package | Constraint |
|---|---|
| magento/module-inventory-api | Required for MSI stock sync |
| magento/module-inventory-sales-api | Required for salable quantity calculation |

## Quality

Latest release (2.7.1) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Fail | 270 | 2 errors, 268 warnings (ruleset: Magento2), 231 auto-fixable with phpcbf |
| PHPMD | Warning | 15 | 15 rule violations (UnusedPrivateField:13, ExcessiveClassLength:2) |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 1 | valid; 1 advisory note (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 74 | 74 | – | – |
| 2.4.8 | – | 74 | 74 | – |
| 2.4.9 | – | – | 74 | 74 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["bonlineco/module-tajersystem"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

bonlineco is a Magento 2 vendor on Packagento. See https://packagento.com/bonlineco.md for their full catalogue.

