merit-api 0.4.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ share/python-wheels/
20
+ *.egg-info/
21
+ .installed.cfg
22
+ *.egg
23
+ MANIFEST
24
+
25
+ # Environment
26
+ .env
27
+ .venv
28
+ env/
29
+ venv/
30
+ ENV/
31
+ env.bak/
32
+ venv.bak/
33
+
34
+ # Node
35
+ node_modules/
36
+ package-lock.json
37
+ __pycache__/
38
+ apitest.ipynb
39
+ .claude/
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.4
2
+ Name: merit-api
3
+ Version: 0.4.4
4
+ Summary: Python client for Merit Aktiva API
5
+ Author-email: Jaak <jaak@example.com>
6
+ License: MIT
7
+ Requires-Python: >=3.10
8
+ Requires-Dist: requests>=2.31.0
9
+ Provides-Extra: dev
10
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
11
+ Requires-Dist: python-dotenv>=1.0.0; extra == 'dev'
12
+ Description-Content-Type: text/markdown
13
+
14
+ # merit-api
15
+
16
+ Python SDK for the Merit Aktiva API.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install merit-api
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```python
27
+ from merit_api import MeritAPI
28
+
29
+ client = MeritAPI(api_id="YOUR_API_ID", api_key="YOUR_API_KEY")
30
+
31
+ customers = client.customers.get_list()
32
+ invoices = client.sales.get_invoices(
33
+ PeriodStart="2024-01-01",
34
+ PeriodEnd="2024-01-31",
35
+ )
36
+ ```
37
+
38
+ ## Features
39
+
40
+ - deterministic request-body serialization for signing
41
+ - configurable timeout and retry handling
42
+ - request and response logging hooks with secret redaction
43
+ - optional idempotency header generation
44
+ - API-level business error parsing from HTTP 200 responses
45
+
46
+ ## Testing and method coverage report
47
+
48
+ Run tests:
49
+
50
+ ```bash
51
+ pytest -q
52
+ ```
53
+
54
+ Regenerate the method-level read/write coverage report:
55
+
56
+ ```bash
57
+ python scripts_report_method_test_coverage.py
58
+ ```
59
+
60
+ The report is written to `reports/method_test_coverage.md` and CI checks that this file stays up to date.
@@ -0,0 +1,47 @@
1
+ # merit-api
2
+
3
+ Python SDK for the Merit Aktiva API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install merit-api
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ from merit_api import MeritAPI
15
+
16
+ client = MeritAPI(api_id="YOUR_API_ID", api_key="YOUR_API_KEY")
17
+
18
+ customers = client.customers.get_list()
19
+ invoices = client.sales.get_invoices(
20
+ PeriodStart="2024-01-01",
21
+ PeriodEnd="2024-01-31",
22
+ )
23
+ ```
24
+
25
+ ## Features
26
+
27
+ - deterministic request-body serialization for signing
28
+ - configurable timeout and retry handling
29
+ - request and response logging hooks with secret redaction
30
+ - optional idempotency header generation
31
+ - API-level business error parsing from HTTP 200 responses
32
+
33
+ ## Testing and method coverage report
34
+
35
+ Run tests:
36
+
37
+ ```bash
38
+ pytest -q
39
+ ```
40
+
41
+ Regenerate the method-level read/write coverage report:
42
+
43
+ ```bash
44
+ python scripts_report_method_test_coverage.py
45
+ ```
46
+
47
+ The report is written to `reports/method_test_coverage.md` and CI checks that this file stays up to date.
@@ -0,0 +1,194 @@
1
+ # Merit API meetodid (v1 / v2)
2
+
3
+ Allikas: https://api.merit.ee/connecting-robots/reference-manual/
4
+
5
+ | Meetod | v1 URL | v2 URL | Tüüp | Dokumentatsioon |
6
+ |---|---|---|---|---|
7
+ | Get list of sales invoces | `/api/v1/getinvoices` | `/api/v2/getinvoices`<br>`/api/v2/getinvoices2` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/sales-invoices/get-list-of-invoices/ |
8
+ | Get sales invoice details | `/api/v1/getinvoice` | `/api/v2/getinvoice` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/sales-invoices/get-invoice-details/ |
9
+ | Delete Invoice | `/api/v1/deleteinvoice` | | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-invoices/delete-invoice/ |
10
+ | Create Sales Invoice | `/api/v1/sendinvoice` | `/api/v2/sendinvoice` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-invoices/create-sales-invoice/ |
11
+ | Create Sales Invoice with multiple payments | `/api/v1/sendinvoice2` | | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-invoices/create-sales-invoice/create-sales-invoice-with-multiple-payments/ |
12
+ | Create Sales Invoice of Estonian e-invoice standard 1.2 | | `/api/v2/sendinvoicexml` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-invoices/create-sales-invoice/create-sales-invoice-of-estonian-e-invoice-standard-1-2/ |
13
+ | Send Sales Invoice by e-mail | | `/api/v2/sendinvoicebyemail` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-invoices/create-sales-invoice/send-invoice-by-e-mail/ |
14
+ | Send Sales Invoice as e-invoice | | `/api/v2/sendinvoiceaseinv` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-invoices/create-sales-invoice/send-sales-invoice-by-einvoice/ |
15
+ | Get Sales Invoice PDF | | `/api/v2/getsalesinvpdf` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/sales-invoices/create-sales-invoice/get-sales-invoice-pdf/ |
16
+ | Create Credit Invoice | `/api/v1/sendinvoice` | | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-invoices/create-credit-invoice/ |
17
+ | Get List of Sales Offers | | `/api/v2/getoffers` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/sales-offers/get-list-of-sales-offers/ |
18
+ | Create Sales Offer | `/api/v1/sendoffer` | `/api/v2/sendoffer` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-offers/create-sales-offer/ |
19
+ | Set Offer status | | `/api/v2/setofferstatus` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-offers/set-offer-status/ |
20
+ | Create Invoice from SalesOffer | | `/api/v2/offer2inv` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-offers/create-invoice-from-salesoffer/ |
21
+ | Get sales offer details | | `/api/v2/getoffer` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/sales-offers/get-sales-offer-details/ |
22
+ | Update sales offer | | `/api/v2/updateoffer` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-offers/update-sales-offer/ |
23
+ | Create Recurring Invoice | | `/api/v2/sendperinvoice` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/recurring-invoices/create-recurring-invoice/ |
24
+ | Get Recurring Invoices clients address list | | `/api/v2/getpershaddress` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/recurring-invoices/get-recurring-invoices-clients-address-list/ |
25
+ | Send Indication Values | `/api/v1/sendindvalues` | | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/recurring-invoices/send-indication-values/ |
26
+ | Get list of Recurring Invoices | | `/api/v2/getperinvoices` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/recurring-invoices/get-list-of-recurring-invoices/ |
27
+ | Get Recurring Invoice details | | `/api/v2/getperinvoice` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/recurring-invoices/get-recurring-invoice-details/ |
28
+ | Get list of purchase invoices | `/api/v1/getpurchorders` | `/api/v2/getpurchorders` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/purchase-invoices/get-list-of-purchase-invoices/ |
29
+ | Get purchase invoice details | `/api/v1/getpurchorder` | `/api/v2/getpurchorder` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/purchase-invoices/get-purchase-invoice-details/ |
30
+ | Delete Purchase Invoice | `/api/v1/deletepurchinvoice` | | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/purchase-invoices/delete-purchase-invoice/ |
31
+ | Create Purchase Invoice | `/api/v1/sendpurchinvoice` | `/api/v2/sendpurchinvoice` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/purchase-invoices/create-purchase-invoice/ |
32
+ | Create Purchase Invoice Waiting Approval | `/api/v1/sendpurchorder` | `/api/v2/sendpurchorder` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/purchase-invoices/create-purchase-order/ |
33
+ | Create Purchase Invoice Waiting Approval of Estonian e-invoice standard 1.2 | | `/api/v2/sendpurchorderxml` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/purchase-invoices/create-purchase-invoice-waiting-approval-of-estonian-e-invoice-standard-1-2/ |
34
+ | Get list of Purchase Orders | | `/api/v2/GetPOrders` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/purchase-invoices/get-list-of-purchase-orders/ |
35
+ | Get list of locations | | `/api/v2/getlocations` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/inventory-movements1/get-list-of-locations/ |
36
+ | Send Invenroty Movements | `/api/v1/SendInvMovement` | `/api/v2/SendInvMovement` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/inventory-movements1/send-invenroty-movements/ |
37
+ | Get List of Inventory Movements | | `/api/v2/getinvmovements` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/inventory-movements1/get-list-of-inventory-movements/ |
38
+ | List of Payments | `/api/v1/getpayments` | `/api/v2/getpayments` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/payments/list-of-payments/ |
39
+ | List of Payment Types | | `/api/v2/getpaymenttypes` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/payments/list-of-payment-types/ |
40
+ | Create Payment of sales invoice | `/api/v1/sendpayment` | `/api/v2/sendpayment` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/payments/create-payment/ |
41
+ | Create Payment of purchase invoice | `/api/v1/sendPaymentV` | `/api/v2/sendPaymentV` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/payments/payment-of-purchase-invoice/ |
42
+ | Create Payment of sales offer | `/api/v1/sendPaymentO` | `/api/v2/sendPaymentO` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/payments/create-payment-of-sales-offer/ |
43
+ | Delete Payment | `/api/v1/deletepayment` | | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/payments/delete-payment/ |
44
+ | Bank statement import | | `/api/v2/sendcamt53` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/payments/bank-statement-import/ |
45
+ | Send Settlement | | `/api/v2/sendsettlement` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/payments/send-settlement/ |
46
+ | Get Payment Imports | | `/api/v2/PaymentImports` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/payments/get-payment-imports/ |
47
+ | List of ExpensePayments | | `/api/v2/Banks/{bankId}/ExpensePayments` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/payments/list-of-expensepayments/ |
48
+ | Send ExpensePayments | | `/api/v2/Banks/{bankId}/ExpensePayments` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/payments/send-expensepayments/ |
49
+ | List of IncomePayments | | `/api/v2/Banks/{bankId}/IncomePayments` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/payments/list-of-incomepayments/ |
50
+ | Send IncomePayments | | `/api/v2/Banks/{bankId}/IncomePayments` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/payments/send-incomepayments/ |
51
+ | Send PrePayments | | `/api/v2/Banks/{bankId}/PrePayments`<br>`/api/v2/Banks/{bankId}/PrePayments/ForCustomer/{customerId}`<br>`/api/v2/Banks/{bankId}/PrePayments/ForVendor/{vendorId}` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/payments/send-prepayments/ |
52
+ | Creating General Ledger Transactions | `/api/v1/sendglbatch` | | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/general-ledger-transactions/creating-general-ledger-transactions/ |
53
+ | Get list of GL Transactions | `/api/v1/getglbatches` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/general-ledger-transactions/get-list-of-gl-transactions/ |
54
+ | Getting GL Transaction Details | `/api/v1/getglbatch` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/general-ledger-transactions/getting-gl-transaction-details/ |
55
+ | Getting GL Transactions Full Details | `/api/v1/GetGLBatchesFull` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/general-ledger-transactions/getting-gl-transactions-full-details/ |
56
+ | List Fixed asset locations | | `/api/v2/getfalocations` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/fixed-asset/list-fixed-asset-locations/ |
57
+ | Responsible employee list | | `/api/v2/getfaresppersons` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/fixed-asset/responsible-employee-list/ |
58
+ | Send Fixed assets | | `/api/v2/sendfixedassets` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/fixed-asset/send-fixed-assets/ |
59
+ | Get Fixed assets | | `/api/v2/getfixassets` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/fixed-asset/get-fixed-assets/ |
60
+ | Tax list | `/api/v1/gettaxes` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/tax-list/ |
61
+ | Send Tax | | `/api/v2/sendtax` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/send-tax/ |
62
+ | Get Customer List | `/api/v1/getcustomers` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/customers/get-customer-list/ |
63
+ | Create Customer | | `/api/v2/sendcustomer` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/customers/create-customer/ |
64
+ | Update Customer | `/api/v1/updatecustomer` | | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/customers/update-customer/ |
65
+ | Create Customergroup | | `/api/v2/sendcustomergroup` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/customers/create-customergroup/ |
66
+ | Get Customergroups | | `/api/v2/getcustomergroups` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/customers/get-customergroups/ |
67
+ | Get Vendor List | `/api/v1/getvendors` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/vendors/get-vendor-list/ |
68
+ | Create Vendor | | `/api/v2/sendvendor` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/vendors/create-vendor/ |
69
+ | Update Vendor | `/api/v1/updatevendor` | `/api/v2/updatevendor` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/vendors/update-vendor/ |
70
+ | Create Vendorgroup | | `/api/v2/sendvendorgroup` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/vendors/create-vendorgroup/ |
71
+ | Get Vendorgroup List | | `/api/v2/getvendorgroups`<br>`/api/v2/getvendorlist` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/vendors/get-vendorgroup-list/ |
72
+ | Accounts List | `/api/v1/getaccounts` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/accounts-list/ |
73
+ | Project List | `/api/v1/getprojects` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/project-list/ |
74
+ | Cost Centers List | `/api/v1/getcostcenters` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/cost-centers-list/ |
75
+ | Get Dimensions List | | `/api/v2/getdimensions` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/dimensions/dimensionslist/ |
76
+ | Add Dimensions | | `/api/v2/senddimensions` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/dimensions/add-dimensions/ |
77
+ | Add Dimensions Values | | `/api/v2/senddimvalues` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/dimensions/add-dimensions-values/ |
78
+ | Departments List | `/api/v1/getdepartments` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/departments-list/ |
79
+ | Send prices | | `/api/v2/sendprices` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-prices-and-discounts/send-prices/ |
80
+ | Send discounts | | `/api/v2/senddiscounts` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/sales-prices-and-discounts/send-discounts/ |
81
+ | Get prices | | `/api/v2/getprices` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/sales-prices-and-discounts/get-prices/ |
82
+ | Get discounts | | `/api/v2/getdiscounts` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/sales-prices-and-discounts/get-discounts/ |
83
+ | Get Price | | `/api/v2/getprice` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/sales-prices-and-discounts/get-price/ |
84
+ | Units of Measure List | `/api/v1/getunits` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/units-of-measure/units-of-measure-list/ |
85
+ | Send units of measure | | `/api/v2/senduom` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/units-of-measure/send-units-of-measure/ |
86
+ | Banks List | `/api/v1/getbanks` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/banks-list/ |
87
+ | Financial Years | | `/api/v2/getaccperiods` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/financial-years/ |
88
+ | Items List | `/api/v1/getitems` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/items/items-list/ |
89
+ | Item Groups | | `/api/v2/getitemgroups` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/items/get-item-groups/ |
90
+ | Add Items | | `/api/v2/senditems` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/items/add-items/ |
91
+ | Add Item groups | | `/api/v2/senditemgroups` | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/items/add-item-groups/ |
92
+ | Update Item | `/api/v1/updateitem` | | kirjutamine | https://api.merit.ee/connecting-robots/reference-manual/items/update-item/ |
93
+ | Customer Debts Report | `/api/v1/getcustdebtrep` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/reports/customer-debts-report/ |
94
+ | Customer Payment Report | | `/api/v2/getcustpaymrep`<br>`/api/v2/getmoredata` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/reports/customer-payment-report/ |
95
+ | Statement of Profit or Loss | `/api/v1/getprofitrep` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/reports/income-statement/ |
96
+ | Statement of Financial Position | `/api/v1/getbalancerep` | | lugemine | https://api.merit.ee/connecting-robots/reference-manual/reports/balance-sheet/ |
97
+ | Get Inventory Report | | `/api/v2/getinventoryreport` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/reports/get-inventory-report/ |
98
+ | Sales Report | | `/api/v2/getsalesrep` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/reports/sales-report/ |
99
+ | Purchase Report | | `/api/v2/getpurchrep` | lugemine | https://api.merit.ee/connecting-robots/reference-manual/reports/purchase-report/ |
100
+
101
+ ## Python API rakenduse seis
102
+
103
+ Allolev staatus on kontrollitud failide `merit_api/src/merit_api/namespaces.py` ja `merit_api/tests/*.py` põhjal.
104
+
105
+ Legend:
106
+
107
+ - `Unit` = mockitud/lokaalsed pytest-testid
108
+ - `Integration` = päris Merit API vastu jooksvad testid, mis vajavad `MERIT_API_INTEGRATION_TEST=true` ja API võtmeid
109
+ - `raw _post` = endpointi kasutatakse testis otse `client._post(...)` kaudu, kuid public wrapper puudub
110
+
111
+ - `✅ Integration` tähendab, et meetod on kaasatud `test_integration_read.py` või vastavasse eraldi integratsioonitesti; konkreetse konto korral võib test siiski andmete või mooduli puudumisel `skip`-i minna.
112
+
113
+ Kokku on Pythoni kliendis praegu wrapper olemas **62** siin tabelis dokumenteeritud operatsioonile.
114
+
115
+ - Kõik dokumenteeritud lugemise/get/list/report meetodid on nüüd wrapperiga kaetud: **49/49**
116
+ - Unit-kattega wrapperid: **53/62**
117
+ - Integration-kattega wrapperid: **52/62**
118
+ - Ilma ühegi testita wrapperid: `customers.send`, `vendors.send`, `items.add`, `items.update`, `sales.delete_invoice`, `financial.create_payment`, `taxes.send`, `dimensions.add`
119
+ - Kontrollitud lokaalselt: `python3 -m pytest merit_api/tests -q` -> `70 passed, 55 skipped`
120
+ - Kontrollitud päris API vastu 2026-04-16: `MERIT_API_INTEGRATION_TEST=true python3 -m pytest merit_api/tests/test_integration_read.py -q -rs` -> `44 passed, 5 skipped`
121
+
122
+ ### Implemented Read Wrappers
123
+
124
+ | Namespace | Wrapperid | Unit | Integration | Märkused |
125
+ |---|---|---|---|---|
126
+ | `customers` | `get_list()`, `get_groups()` | ✅ `test_read_methods.py` | ✅ `test_integration_read.py` | Katab `getcustomers`, `getcustomergroups`. |
127
+ | `vendors` | `get_list()`, `get_groups()` | ✅ | ✅ | Katab `getvendors`, `getvendorgroups`. |
128
+ | `items` | `get_list()`, `get_groups()` | ✅ | ✅ | Katab `getitems`, `getitemgroups`. |
129
+ | `sales` | `get_invoices()`, `get_invoice()`, `get_invoice_pdf()`, `get_offers()`, `get_offer()`, `get_recurring_invoices()`, `get_recurring_invoice()`, `get_recurring_invoice_addresses()` | ✅ | ✅ | Katab kõik dokumenteeritud sales-read meetodid. `get_invoice()` kasutab praegu `v1/getinvoice`; `get_invoice_pdf()` kasutab `_get_pdf(...)`. |
130
+ | `purchases` | `get_invoices()`, `get_invoice()`, `get_orders()` | ✅ | ✅ | Katab `getpurchorders`, `getpurchorder`, `GetPOrders`. |
131
+ | `financial` | `get_payments()`, `get_payment_types()`, `get_payment_imports()`, `get_expense_payments()`, `get_income_payments()`, `get_gl_batches()`, `get_gl_batch()`, `get_gl_batches_full()`, `get_banks()`, `get_accounts()`, `get_costs()`, `get_projects()`, `get_departments()`, `get_financial_years()` | ✅ | ✅ | `get_payment_imports()`, `get_expense_payments()` ja `get_income_payments()` kasutavad query-string GET transporti (`client._get(...)`), sest live API käitus nii korrektselt. |
132
+ | `inventory` | `get_locations()`, `get_movements()` | ✅ | ✅ | Katab `getlocations`, `getinvmovements`. |
133
+ | `assets` | `get_locations()`, `get_responsible_persons()`, `get_fixed_assets()` | ✅ | ✅ | Katab `getfalocations`, `getfaresppersons`, `getfixassets`. |
134
+ | `taxes` | `get_list()` | ✅ | ✅ | Katab `gettaxes`. |
135
+ | `dimensions` | `get_list()` | ✅ | ✅ | Katab `getdimensions`. |
136
+ | `pricing` | `get_prices()`, `get_discounts()`, `get_price()` | ✅ | ✅ | Katab `getprices`, `getdiscounts`, `getprice`; `get_price()` vajab live API-s `DocDate`. |
137
+ | `reports` | `get_customer_debts()`, `get_customer_payments()`, `get_more_data()`, `get_profit()`, `get_balance()`, `get_inventory()`, `get_sales()`, `get_purchases()` | ✅ | ✅ | Katab kõik dokumenteeritud report-read meetodid; live API nõuab mitmel juhul teistsugust payloadi kui lihtne `PeriodStart/PeriodEnd`. |
138
+ | `reference` | `get_units()` | ✅ | ✅ | Katab `getunits`. |
139
+
140
+ ### Existing Write Wrappers
141
+
142
+ | Dokumenteeritud meetod | Python API | Unit | Integration | Märkused |
143
+ |---|---|---|---|---|
144
+ | Delete Invoice | `client.sales.delete_invoice()` | ❌ | ❌ | Wrapper olemas, aga testid puuduvad. |
145
+ | Create Sales Invoice | `client.sales.send_invoice()` | ✅ `test_priority1_invoice_delivery.py` | ❌ | Kasutab vaikimisi `v1/sendinvoice`, kuigi dokumentatsioonis on olemas ka `v2`. |
146
+ | Send Sales Invoice by e-mail | `client.sales.send_invoice_by_email()` | ✅ `test_priority1_invoice_delivery.py` | ✅ `test_priority1_integration.py` | Kasutab `v2/sendinvoicebyemail`. |
147
+ | Send Sales Invoice as e-invoice | `client.sales.send_invoice_by_einvoice()` | ✅ `test_priority1_invoice_delivery.py` | ✅ `test_priority1_integration.py` | Kasutab `v2/sendinvoiceaseinv`. |
148
+ | Create Credit Invoice | `client.sales.send_credit_invoice()` | ✅ `test_priority1_invoice_delivery.py` | ❌ | Eraldi endpointi ei ole; wrapper kasutab sama `sendinvoice` transporti negatiivsete summadega. |
149
+ | Create Purchase Invoice | `client.purchases.send_invoice()` | ❌ | ✅ `test_purchase_invoice_integration.py` | Kasutab vaikimisi `v1/sendpurchinvoice`; olemas reaalne integratsioonitest PDF-manusega. |
150
+ | Create Payment of purchase invoice | `client.financial.create_payment()` | ❌ | ❌ | Katab ainult `sendPaymentV` purchase-invoice makse flow'd. Kui payloadis on `CurrencyCode`, lülitab `v2` peale, muidu kasutab `v1`. |
151
+ | Send Tax | `client.taxes.send()` | ❌ | ❌ | Kasutab `v2/sendtax`, aga testid puuduvad. |
152
+ | Create Customer | `client.customers.send()` | ❌ | ❌ | Wrapper olemas, kuid praegu kutsub vaikimisi `v1/sendcustomer`; dokumentatsioonis on see `v2` endpoint. |
153
+ | Create Vendor | `client.vendors.send()` | ❌ | ❌ | Wrapper olemas, kuid praegu kutsub vaikimisi `v1/sendvendor`; dokumentatsioonis on see `v2` endpoint. |
154
+ | Add Dimensions | `client.dimensions.add()` | ❌ | ❌ | Kasutab `v2/senddimensions`, aga testid puuduvad. |
155
+ | Add Items | `client.items.add()` | ❌ | ❌ | Kasutab `v2/senditems`, aga testid puuduvad. |
156
+ | Update Item | `client.items.update()` | ❌ | ❌ | Kasutab `v1/updateitem`, aga testid puuduvad. |
157
+
158
+ ### Dokumenteeritud endpointid, millele public wrapper puudub
159
+
160
+ Need endpointid on dokumentatsioonis olemas, kuid `merit_api/src/merit_api/namespaces.py` ei paku neile praegu avalikku namespace-meetodit. Pärast read-wrapperite lisamist on puudu jäänud ainult kirjutamise/mutating poole meetodid.
161
+
162
+ | Dokumenteeritud meetod | Endpoint(id) | Märkused |
163
+ |---|---|---|
164
+ | Create Sales Invoice with multiple payments | `/api/v1/sendinvoice2` | Puudub wrapper. |
165
+ | Create Sales Invoice of Estonian e-invoice standard 1.2 | `/api/v2/sendinvoicexml` | Puudub wrapper. |
166
+ | Create Sales Offer | `/api/v1/sendoffer`, `/api/v2/sendoffer` | Puudub wrapper. |
167
+ | Set Offer status | `/api/v2/setofferstatus` | Puudub wrapper. |
168
+ | Create Invoice from SalesOffer | `/api/v2/offer2inv` | Puudub wrapper. |
169
+ | Update sales offer | `/api/v2/updateoffer` | Puudub wrapper. |
170
+ | Create Recurring Invoice | `/api/v2/sendperinvoice` | Puudub wrapper. |
171
+ | Send Indication Values | `/api/v1/sendindvalues` | Puudub wrapper. |
172
+ | Delete Purchase Invoice | `/api/v1/deletepurchinvoice` | Puudub public wrapper; kasutatakse ainult `raw _post` kujul integratsioonitestis cleanup'iks. |
173
+ | Create Purchase Invoice Waiting Approval | `/api/v1/sendpurchorder`, `/api/v2/sendpurchorder` | Puudub wrapper. |
174
+ | Create Purchase Invoice Waiting Approval of Estonian e-invoice standard 1.2 | `/api/v2/sendpurchorderxml` | Puudub wrapper. |
175
+ | Send Invenroty Movements | `/api/v1/SendInvMovement`, `/api/v2/SendInvMovement` | Puudub wrapper. |
176
+ | Create Payment of sales invoice | `/api/v1/sendpayment`, `/api/v2/sendpayment` | Puudub wrapper. |
177
+ | Create Payment of sales offer | `/api/v1/sendPaymentO`, `/api/v2/sendPaymentO` | Puudub wrapper. |
178
+ | Delete Payment | `/api/v1/deletepayment` | Puudub wrapper. |
179
+ | Bank statement import | `/api/v2/sendcamt53` | Puudub wrapper. |
180
+ | Send Settlement | `/api/v2/sendsettlement` | Puudub wrapper. |
181
+ | Send ExpensePayments | `/api/v2/Banks/{bankId}/ExpensePayments` | Puudub wrapper. |
182
+ | Send IncomePayments | `/api/v2/Banks/{bankId}/IncomePayments` | Puudub wrapper. |
183
+ | Send PrePayments | `/api/v2/Banks/{bankId}/PrePayments`, `/api/v2/Banks/{bankId}/PrePayments/ForCustomer/{customerId}`, `/api/v2/Banks/{bankId}/PrePayments/ForVendor/{vendorId}` | Puudub wrapper. |
184
+ | Creating General Ledger Transactions | `/api/v1/sendglbatch` | Puudub wrapper. |
185
+ | Send Fixed assets | `/api/v2/sendfixedassets` | Puudub wrapper. |
186
+ | Update Customer | `/api/v1/updatecustomer` | Puudub wrapper. |
187
+ | Create Customergroup | `/api/v2/sendcustomergroup` | Puudub wrapper. |
188
+ | Update Vendor | `/api/v1/updatevendor`, `/api/v2/updatevendor` | Puudub wrapper. |
189
+ | Create Vendorgroup | `/api/v2/sendvendorgroup` | Puudub wrapper. |
190
+ | Add Dimensions Values | `/api/v2/senddimvalues` | Puudub wrapper. |
191
+ | Send prices | `/api/v2/sendprices` | Puudub wrapper. |
192
+ | Send discounts | `/api/v2/senddiscounts` | Puudub wrapper. |
193
+ | Send units of measure | `/api/v2/senduom` | Puudub wrapper. |
194
+ | Add Item groups | `/api/v2/senditemgroups` | Puudub wrapper. |
@@ -0,0 +1,26 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "merit-api"
7
+ version = "0.4.4"
8
+ description = "Python client for Merit Aktiva API"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Jaak", email = "jaak@example.com"},
14
+ ]
15
+ dependencies = [
16
+ "requests>=2.31.0",
17
+ ]
18
+
19
+ [project.optional-dependencies]
20
+ dev = [
21
+ "pytest>=8.0.0",
22
+ "python-dotenv>=1.0.0",
23
+ ]
24
+
25
+ [tool.hatch.build.targets.wheel]
26
+ packages = ["src/merit_api"]
@@ -0,0 +1,80 @@
1
+ # Merit API method test coverage (read/write)
2
+
3
+ This report is generated by static inspection of namespace methods and tests.
4
+ A method is marked covered if tests reference the namespace call or matching `_post` endpoint.
5
+
6
+ Overall coverage: **51/60 (85.0%)**
7
+
8
+ ## Read capabilities
9
+
10
+ Coverage: **45/46 (97.8%)**
11
+
12
+ | Method | Endpoint | Version | Covered by tests | Evidence |
13
+ |---|---|---|---|---|
14
+ | `Assets.get_fixed_assets` | `getfixassets` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
15
+ | `Assets.get_locations` | `getfalocations` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
16
+ | `Assets.get_responsible_persons` | `getfaresppersons` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
17
+ | `Customers.get_groups` | `getcustomergroups` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
18
+ | `Customers.get_list` | `getcustomers` | `v1` | ✅ | test_integration_read.py, test_phase0_foundation.py, test_read_methods.py, test_send_invoice.py |
19
+ | `Dimensions.get_list` | `getdimensions` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
20
+ | `Financial.get_accounts` | `getaccounts` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
21
+ | `Financial.get_banks` | `getbanks` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
22
+ | `Financial.get_costs` | `getcostcenters` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
23
+ | `Financial.get_departments` | `getdepartments` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
24
+ | `Financial.get_financial_years` | `getaccperiods` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
25
+ | `Financial.get_gl_batch` | `getglbatch` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
26
+ | `Financial.get_gl_batches` | `getglbatches` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
27
+ | `Financial.get_gl_batches_full` | `GetGLBatchesFull` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
28
+ | `Financial.get_payment_types` | `getpaymenttypes` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
29
+ | `Financial.get_payments` | `getpayments` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
30
+ | `Financial.get_projects` | `getprojects` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
31
+ | `Inventory.get_locations` | `getlocations` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
32
+ | `Inventory.get_movements` | `getinvmovements` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
33
+ | `Items.get_groups` | `getitemgroups` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
34
+ | `Items.get_list` | `getitems` | `v1` | ✅ | test_integration_read.py, test_read_methods.py, test_send_invoice.py |
35
+ | `Pricing.get_discounts` | `getdiscounts` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
36
+ | `Pricing.get_price` | `getprice` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
37
+ | `Pricing.get_prices` | `getprices` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
38
+ | `Purchases.get_invoice` | `getpurchorder` | `v1` | ✅ | test_integration_read.py, test_purchase_invoice_integration.py, test_read_methods.py |
39
+ | `Purchases.get_invoices` | `getpurchorders` | `v1` | ✅ | test_integration_read.py, test_purchase_invoice_integration.py, test_read_methods.py |
40
+ | `Purchases.get_orders` | `GetPOrders` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
41
+ | `ReferenceData.get_units` | `getunits` | `v1` | ❌ | — |
42
+ | `Reports.get_balance` | `getbalancerep` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
43
+ | `Reports.get_customer_debts` | `getcustdebtrep` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
44
+ | `Reports.get_customer_payments` | `getcustpaymrep` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
45
+ | `Reports.get_inventory` | `getinventoryreport` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
46
+ | `Reports.get_more_data` | `getmoredata` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
47
+ | `Reports.get_profit` | `getprofitrep` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
48
+ | `Reports.get_purchases` | `getpurchrep` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
49
+ | `Reports.get_sales` | `getsalesrep` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
50
+ | `Sales.get_invoice` | `getinvoice` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
51
+ | `Sales.get_invoices` | `getinvoices` | `v2` | ✅ | test_integration_read.py, test_priority1_integration.py, test_read_methods.py |
52
+ | `Sales.get_offer` | `getoffer` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
53
+ | `Sales.get_offers` | `getoffers` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
54
+ | `Sales.get_recurring_invoice` | `getperinvoice` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
55
+ | `Sales.get_recurring_invoice_addresses` | `getpershaddress` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
56
+ | `Sales.get_recurring_invoices` | `getperinvoices` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
57
+ | `Taxes.get_list` | `gettaxes` | `v1` | ✅ | test_integration_read.py, test_read_methods.py |
58
+ | `Vendors.get_groups` | `getvendorgroups` | `v2` | ✅ | test_integration_read.py, test_read_methods.py |
59
+ | `Vendors.get_list` | `getvendors` | `v1` | ✅ | test_integration_read.py, test_purchase_invoice_integration.py, test_read_methods.py |
60
+
61
+ ## Write capabilities
62
+
63
+ Coverage: **6/14 (42.9%)**
64
+
65
+ | Method | Endpoint | Version | Covered by tests | Evidence |
66
+ |---|---|---|---|---|
67
+ | `Customers.send` | `sendcustomer` | `v1` | ❌ | — |
68
+ | `Dimensions.add` | `senddimensions` | `v2` | ❌ | — |
69
+ | `Financial.create_payment` | `sendPaymentV` | `v1` | ✅ | test_purchase_invoice_integration.py |
70
+ | `Items.add` | `senditems` | `v2` | ❌ | — |
71
+ | `Items.update` | `updateitem` | `v1` | ❌ | — |
72
+ | `Purchases.send_invoice` | `sendpurchinvoice` | `v1` | ✅ | test_purchase_invoice_integration.py |
73
+ | `Sales.delete_invoice` | `deleteinvoice` | `v1` | ❌ | — |
74
+ | `Sales.send_credit_invoice` | `sendinvoice` | `v1` | ✅ | test_phase0_foundation.py, test_priority1_invoice_delivery.py, test_send_invoice.py |
75
+ | `Sales.send_invoice` | `sendinvoice` | `v1` | ✅ | test_phase0_foundation.py, test_priority1_invoice_delivery.py, test_send_invoice.py |
76
+ | `Sales.send_invoice_by_einvoice` | `sendinvoiceaseinv` | `v2` | ✅ | test_priority1_integration.py, test_priority1_invoice_delivery.py |
77
+ | `Sales.send_invoice_by_email` | `sendinvoicebyemail` | `v2` | ✅ | test_priority1_integration.py, test_priority1_invoice_delivery.py |
78
+ | `Taxes.send` | `sendtax` | `v2` | ❌ | — |
79
+ | `Vendors.send` | `sendvendor` | `v1` | ❌ | — |
80
+ | `Vendors.update` | `updatevendor` | `v2` | ❌ | — |
@@ -0,0 +1,3 @@
1
+ requests==2.32.5
2
+ python-dotenv==1.2.1
3
+ pytest==9.0.2