Elorus.com API
This service is used to access Elorus platform, for creating and managing invoices
Register the service into your main.go
file:
hitrixRegistry.ServiceProviderElorus()
1
And you should put your credentials and other configs in config/hitrix.yml
elorus:
url: https://api.elorus.com/v1.1
token: secret
organization_id: secret
1
2
3
4
2
3
4
Access the service:
elorusService := service.DI().Elorus()
1
Using the service:
// Request to create contact
elorusService.CreateContact(
elorus.CreateContactRequest{
FirstName: "name",
Active: true,
Company:"company",
VatNumber:"BG108"
Email: []struct {
Email string `json:"email"`
Primary bool `json:"primary"`
}{{
Email: "email@email.com",
Primary: true,
}},
Phones: []struct {
Number string `json:"number"`
Primary bool `json:"primary"`
}{{
Number: "0869586598",
Primary: true,
}},
},
)
// Request to create invoice
elorusService.CreateInvoice(
elorus.CreateInvoiceRequest{
Date: time.Now().Format("2006-01-02"),
Client: contactId,
ClientDisplayName: "name",
ClientEmail: "email@email.com",
ClientVatNumber: "BG108",
Number: "0",
Items: []struct {
Title string `json:"title"`
Description string `json:"description"`
Quantity string `json:"quantity"`
UnitMeasure int `json:"unit_measure"`
UnitValue string `json:"unit_value"`
Taxes []string `json:"Taxes"`
UnitTotal string `json:"unit_total"`
}{{
Title: "title",
Quantity: "5",
UnitValue: "800",
UnitMeasure: 1,
UnitTotal: "500",
Taxes: []string{"2416104549958812800"},
}},
}
)
// Request to get invoice list
elorusService.GetInvoiceList(
elorus.GetInvoiceListRequest{
Client: contactId,
Page: "1",
PageSize:"10",
}
)
// Request to get invoice list
elorusService.DownloadInvoice(
elorus.DownloadInvoiceRequest{
ID: "id",
}
)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67