Skip to content

Commit 32a2c84

Browse files
authored
Merge pull request #1 from rantalainen/feat-billing
implement MaventaBillingApiClient
2 parents 7d41720 + ee99906 commit 32a2c84

File tree

5 files changed

+523
-6
lines changed

5 files changed

+523
-6
lines changed

README.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**MaventaApiClient** is a third party [Maventa AutoXChange API](https://documentation.maventa.com/rest-api/#autoxchange-api) client for NodeJS. It is a wrapper around an API client that has been [automatically generated](https://www.npmjs.com/package/swagger-typescript-api) using the [OpenAPI schema](https://ax.maventa.com/swagger_doc) provided by Maventa.
44

5-
This package also includes **MaventaMassPrintingApiClient** for the [Maventa Payslip API](https://documentation.maventa.com/rest-api/#payslip-api).
5+
This package also includes **MaventaMassPrintingApiClient** for the [Maventa Payslip API](https://documentation.maventa.com/rest-api/#payslip-api) and **MaventaBillingApiClient** for the Maventa Billing API using its' [OpenAPI schema](https://bling.maventa.com/api/billing/v2/swagger_yml) provided by Maventa.
66

77
## Installation
88

@@ -15,13 +15,13 @@ npm install @rantalainen/maventa-api-client
1515
### Import to NodeJS project
1616

1717
```javascript
18-
const { MaventaApiClient, MaventaMassPrintingApiClient } = require('@rantalainen/maventa-api-client');
18+
const { MaventaApiClient, MaventaMassPrintingApiClient, MaventaBillingApiClient } = require('@rantalainen/maventa-api-client');
1919
```
2020

2121
### Import to TypeScript project
2222

2323
```javascript
24-
import { MaventaApiClient, MaventaMassPrintingApiClient } from '@rantalainen/maventa-api-client';
24+
import { MaventaApiClient, MaventaMassPrintingApiClient, MaventaBillingApiClient } from '@rantalainen/maventa-api-client';
2525
```
2626

2727
## AutoXChange API
@@ -41,7 +41,11 @@ const maventa = new MaventaApiClient({
4141
});
4242
```
4343

44-
Available methods can be found in [Maventa Swagger](https://swagger.maventa.com/?urls.primaryName=PROD%20-%20AutoXChange%20API).
44+
Available methods can be found in [Maventa Swagger](https://swagger.maventa.com/?urls.primaryName=PROD%20-%20AutoXChange%20API). Use `maventa.api` to access them:
45+
46+
```javascript
47+
const companies = await maventa.api.companies.getV1Companies();
48+
```
4549

4650
## Payslip API
4751

@@ -94,6 +98,32 @@ const result = await maventaMassPrinting.send({ filename: 'letter_example.zip',
9498
console.log(result);
9599
```
96100

101+
## Billing API
102+
103+
Billing API (also known as AutoInvoice Billing API) can be used fetch billing transactions from Maventa. It uses `MaventaApiClient` under the hood to obtain the access token.
104+
105+
### Setup client with options
106+
107+
In order to obtain an API key, please contact Maventa Integration Support. An API key is needed to access all API functions. Use the invoice receiving company's UUID as clientId.
108+
109+
```javascript
110+
const maventaBilling = new MaventaBillingApiClient({
111+
// Required options:
112+
clientId: 'company_UUID',
113+
clientSecret: 'api_key',
114+
vendorApiKey: 'vendor_api_key'
115+
});
116+
```
117+
118+
Available methods can be found in [Maventa Swagger](https://swagger.maventa.com/?urls.primaryName=PROD%20-%20AutoInvoice%20Billing%20API). Use `maventaBilling.api.billing` to access them:
119+
120+
```javascript
121+
const transactions = await maventaBilling.api.billing.billingV2ReportsBillingCompanyTransactionsList({
122+
year: 2023,
123+
month: 3
124+
});
125+
```
126+
97127
## Resources
98128

99129
- Maventa login page: https://secure.maventa.com/

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"name": "@rantalainen/maventa-api-client",
3-
"version": "1.0.3",
3+
"version": "1.1.0",
44
"description": "",
55
"main": "dist/index.js",
66
"scripts": {
77
"dev": "tsc --watch",
88
"test": "nodemon test.js",
99
"build": "tsc",
10-
"openapi": "npx swagger-typescript-api -p https://ax.maventa.com/swagger_doc -o ./src -n api.ts -r --default-response any --module-name-index 1 --axios"
10+
"openapi-autoxchange": "npx swagger-typescript-api -p https://ax.maventa.com/swagger_doc -o ./src -n api.ts -r --default-response any --module-name-index 1 --axios",
11+
"openapi-billing": "npx swagger-typescript-api -p https://bling.maventa.com/api/billing/v2/swagger_yml -o ./src -n billing-api.ts -r --default-response any --module-name-index 1 --axios"
1112
},
1213
"repository": {
1314
"type": "git",

0 commit comments

Comments
 (0)