Skip to content

Accounting Integration

Vitayou integrates with the parent company Mealbox's LOGO accounting integration API.

Service Access

The service persists on a different machine in the same subnet and both the production and staging servers can access it without any extra configuration.

However if on a different network (i.e. your local development environment) you need to use a VPN tunnel to the said subnet to gain access to the accounting API.

NameURL
Adminhttp://192.168.81.3:10121/
Swaggerhttp://192.168.81.3:10121/swagger/ui/index#/

The Service

The service is placed under app/Services/Accounting relative to the project root. The service is written using strategy pattern and with this approach, you can easily write another strategy without changing much of the code in case the service needs replacement.

Tip

Active strategy can be replaced by changin the ACCOUNTING_STRATEGY environment variable.

Important

Checking for the TCKN/TaxPayer information and providing correct information for the newly created customer accounts are required by the accounting department.

We use a 3rd party service called mukellef.info to make the queries. It is wise to query the credits frequently and setup an alert when it's down.

It should also be noted that the accounts over accounting side are synced with ADDRESSES, not CUSTOMERS.

The Structure

Accounting
├── Contracts
│   └── AccountingStrategyContract.php
├── Strategies
│   ├── Logo
│   │   ├── Entities
│   │   │   ├── LogoXXXDetails.php
│   │   │   ├── LogoDTO.php
│   │   │   ├── ...
│   │   │   └── LogoProductDTO.php
│   │   ├── Exceptions
│   │   │   ├── LogoClientException.php
│   │   │   └── LogoDTOException.php
│   │   ├── Services
│   │   │   ├── Core
│   │   │   │   └── ServiceCore.php
│   │   │   ├── XXXService.php
│   │   ├── LogoClient.php
│   │   ├── LogoStrategy.php
│   │   └── Routes.php
│   └── Mock
│       ├── Services
│       │   ├── XXXService.php
│       │   └── ServiceFactory.php
│       ├── MockStrategy.php
│       └── Routes.php
└── AccountingService.php

All of the available and used endpoints are reflected as a Logo Service.

Operations and queries are done with robust DTO object generators (under Entities).

The Repository

Repositories
├── AccountingRepository
│   ├── AccountingInvoiceRepository.php
│   ├── AccountingPaymentRepository.php
│   ├── AccountingProductRepository.php
│   ├── AccountingRepositoryCore.php
│   └── AccountRepository.php
└── AccountingRepository.php

The repository works as a reflection of the active accounting service strategy.

You can put all your logic between your controllers <> models <> services without changing anything except repository with this approach.

Environment Variables

dotEnv
ACCOUNTING_STRATEGY=Logo
ACCOUNTING_URL=http://192.168.81.3:10121/api/v1/
ACCOUNTING_USER=
ACCOUNTING_PASS=
ACCOUNTING_COMPANY_ID=040

Testing

The accounting service has a Mock strategy which is used when commencing unit and feature tests within PHPUnit suite.