---
tags: [vompay, cross-module]
module: VomPay
---

# [Cross]CrossModuleDependencies

## Connections
[[_VomPay]] · [[[Service]InvoiceServices]] · [[[Service]SupplierServices]] · [[[Job]Jobs]] · [[[Action]Actions]]

---

## VomPay → Sales

| What VomPay Uses | From Sales | Why |
|---|---|---|
| `Invoice` model | `Modules/Sales/Entities/Invoice` | Polymorphic paiable target |
| `ProformaInvoice` model | `Modules/Sales/Entities/ProformaInvoice` | Polymorphic paiable target |
| `SalesEstimate` model | `Modules/Sales/Entities/SalesEstimate` | Polymorphic paiable target |
| `Customer` model | `Modules/Sales/Entities/Customer` | Lookup customer contact for payment link |
| `InvoicesRepository` | `Modules/Sales/Repositories/InvoicesRepository` | Fetch invoice data inside webhook handler |
| `CustomersRepository` | `Modules/Sales/Repositories/CustomersRepository` | Fetch customer email/phone for notification |
| `CreatingJournalEntryAfterPayingService` | `Modules/Sales/Services/...` | Post accounting entry on payment success |
| `CreatingCustomerReceiptAfterPayingService` | `Modules/Sales/Services/...` | Create customer receipt on payment success |

Sales services also use VomPay's `VomPayPaiable` trait — VomPay is mixed in, making the dependency bidirectional.

---

## VomPay → Accounting

| What VomPay Uses | Why |
|---|---|
| `JournalEntry` creation (via Sales service) | Records gateway fee and payment receipt to the configured accounts |
| `AccountsRepository` (via Settings) | Validates expense_account_id and payment_account_id on settings save |

---

## VomPay → Settings Module

| What VomPay Uses | From Settings | Why |
|---|---|---|
| `GeneralSettingsRepository` | `Modules/Settings/Repositories/...` | Read/write `is_integrated_with_vompay` flag |
| `AccountsRepository` | `Modules/Settings/Repositories/...` | Resolve account IDs for VomPaySetting |

---

## VomPay → Products Module

| What VomPay Uses | From Products | Why |
|---|---|---|
| `CostCentersRepository` | `Modules/Products/Repositories/...` | Populate cost_center_id dropdown in settings form |

---

## VomPay → CompanyUser Module

| What VomPay Uses | From CompanyUser | Why |
|---|---|---|
| `TenantBaseController` | Base controller | All VomPay controllers extend this |
| `RetrievingUsersByPermissionService` | `Modules/CompanyUser/Services/...` | Find users with `vompay.dashboard.view` for approval/rejection notifications |
| `SendingEmailService` | `Modules/CompanyUser/Services/...` | Dispatch all VomPay emails (activation, approval, rejection, tracking) |
| `ContentGenerator` | `Modules/CompanyUser/...` | Extended by `NotifySupplierApprovalContentGenerator` and `NotifySupplierRejectionContentGenerator` |

---

## VomPay → Tenant Module

| What VomPay Uses | From Tenant | Why |
|---|---|---|
| `VomPaySupplier` model | `Modules/Tenant/Entities/VomPaySupplier` | The supplier registration record ⚠️ model lives in Tenant, not VomPay |
| `RetrievingTenantBySubdomainService` | `Modules/Tenant/Services/...` | Used in `CreateVomPayPaymentLinkJob` to resolve DB connection from subdomain |
| `PreparingCurrentSubscriptionDataService` | `Modules/Tenant/Services/...` | Checks subscription package to select correct commission rates (`VomPayPackagesEnum`) |

---

## VomPay → App Core / Infrastructure

| What VomPay Uses | Why |
|---|---|
| `TenantConnectionOnRuntime` trait | Applied to `CreateVomPayPaymentLinkJob` to switch DB connection at queue runtime |
| `UsesTenantConnection` trait | Applied to all VomPay models for multi-tenant DB routing |
| `GuzzleHttpClientEncodingBody` | Used in `MyFatoorahInvoiceAPIService` and `MyFatoorahSupplierAPIService` for outbound HTTP to MyFatoorah |

---

## External Service Dependency

| Service | Used By | What For |
|---|---|---|
| **MyFatoorah API** | `MyFatoorahInvoiceAPIService` · `MyFatoorahSupplierAPIService` | Supplier onboarding, commission setup, document upload, payment link generation, webhook receipt |

Credentials configured via environment variables consumed inside the API service classes.

---

## What Depends on VomPay

| Consumer | What It Uses |
|---|---|
| Sales module services | `VomPayPaiable` trait — auto-dispatches `CreateVomPayPaymentLinkJob` on invoice/proforma/debit-note creation |
| Notifications system | `NotifySupplierApprovalContentGenerator` + `NotifySupplierRejectionContentGenerator` registered as content generators |
| Queue worker (`vom_pay`) | Processes `CreateVomPayPaymentLinkJob` asynchronously |
