-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcustomer_invoice.go
134 lines (120 loc) · 6.52 KB
/
customer_invoice.go
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package multivers
// https://api.online.unit4.nl/V16/Help/Api/GET-api-database-ProductGroup-productGroupId
import (
"context"
"fmt"
)
const (
CustomerInvoicePath = "/api/%s/CustomerInvoice/%s.json"
)
func NewCustomerInvoiceService(client *Client) *CustomerInvoiceService {
return &CustomerInvoiceService{Client: client}
}
type CustomerInvoiceService struct {
Client *Client
}
func (s *CustomerInvoiceService) Get(database string, invoiceID string, ctx context.Context) (*CustomerInvoiceGetResponse, error) {
method := "GET"
responseBody := s.NewGetResponse()
path := fmt.Sprintf(CustomerInvoicePath, database, invoiceID)
// create a new HTTP request
httpReq, err := s.Client.NewRequest(ctx, method, path, nil)
if err != nil {
return nil, err
}
// submit the request
_, err = s.Client.Do(httpReq, responseBody)
return responseBody, err
}
func (s *CustomerInvoiceService) NewGetResponse() *CustomerInvoiceGetResponse {
return &CustomerInvoiceGetResponse{}
}
type CustomerInvoiceGetResponse CustomerInvoice
type CustomerInvoice struct {
AccountManager string `json:"accountManager"`
AccountManagerID string `json:"accountManagerId"`
Messages []Message `json:"messages"`
AmountCreditSqueeze float64 `json:"amountCreditSqueeze"`
AmountCreditSqueezeCur float64 `json:"amountCreditSqueezeCur"`
AmountRebate float64 `json:"amountRebate"`
AmountRebateCur float64 `json:"amountRebateCur"`
AmountTotal float64 `json:"amountTotal"`
AmountTotalCur float64 `json:"amountTotalCur"`
BordereauxNumber string `json:"bordereauxNumber"`
CanChange bool `json:"canChange"`
ContactPerson string `json:"contactPerson"`
ContactPersonID string `json:"contactPersonId"`
CurrencyID string `json:"currencyId"`
CustomerID string `json:"customerId"`
CustomerInvoiceLinces []CustomerInvoiceLine `json:"customerInvoiceLines"`
DocumentNumber int `json:"documentNumber"`
DunForPayment bool `json:"dunForPayment"`
ExchangeRate float64 `json:"exchangeRate"`
FiscalYear int `json:"fiscalYear"`
InvoiceDate DateNLNL `json:"invoiceDate"`
InvoiceExpirationDate DateNLNL `json:"invoiceExpirationDate"`
InvoiceID string `json:"invoiceId"`
InvoiceType InvoiceType `json:"invoiceType"`
JournalID string `json:"journalId"`
JournalSection string `json:"journalSection"`
JournalTransaction int `json:"journalTransaction"`
KvcPaymentCondition bool `json:"kvcPaymentCondition"`
MandateID string `json:"mandateId"`
NumberOfReminder int `json:"numberOfReminders"`
OpeningBalance bool `json:"openingBalance"`
OrderID string `json:"orderId"`
PaymentConditionID string `json:"paymentConditionId"`
PaymentReference string `json:"paymentReference"`
PeriodNumber int `json:"periodNumber"`
ProcessedBy string `json:"processedBy"`
ProcessedByID string `json:"processedById"`
RebateExpirationDate string `json:"rebateExpirationDate"`
Reference string `json:"reference"`
SystemInvoice bool `json:"systemInvoice"`
TotalAmountVatExcl float64 `json:"totalAmountVatExcl"`
TotalAmountVatExclCur float64 `json:"totalAmountVatExclCur"`
VatAdjusted bool `json:"vatAdjusted"`
VatAmount float64 `json:"vatAmount"`
VatAmountCur float64 `json:"vatAmountCur"`
VatOnInvoice bool `json:"vatOnInvoice"`
VatScenarioID int `json:"vatScenarioId"`
VatTransactionLines []VatTransactionLine `json:"vatTransactionLines"`
}
type CustomerInvoiceLine struct {
AccountID string `json:"accountId"`
Messages []Message `json:"messages"`
CanChange bool `json:"canChange"`
CostCentreID string `json:"costCentreId"`
CostCentreIDRequired bool `json:"costCentreIdRequired"`
CostUnitID string `json:"costUnitId"`
CostUnitIDRequired bool `json:"costUnitIdRequired"`
CreditAmount float64 `json:"creditAmount"`
CreditAmountCur float64 `json:"creditAmountCur"`
CurrencyID string `json:"currencyId"`
DebitAmount float64 `json:"debitAmount"`
DebitAmountCur float64 `json:"debitAmountCur"`
Description string `json:"description"`
DocumentNumber int `json:"documentNumber"`
ExchangeRate float64 `json:"exchangeRate"`
IsSubAdminSpecificationRequired bool `json:"isSubAdminSpecificationRequired"`
JournalSection int `json:"journalSection"`
LineNumbers []int `json:"lineNumbers"`
Quantity float64 `json:"quantity"`
SubAdminSpecifications []interface{} `json:"subAdminSpecifications"`
TransactionDate string `json:"transactionDate"`
VatCodeID int `json:"vatCodeId"`
VatType int `json:"vatType"`
}
type VatTransactionLine struct {
Messages []Message `json:"messages"`
AmountNotDeductibleCur float64 `json:"amountNotDeductibleCur"`
AmountTurnoverCur float64 `json:"amountTurnoverCur"`
CanChange bool `json:"canChange"`
CurrencyID string `json:"currencyId"`
FiscalYear int `json:"fiscalYear"`
VatAmountCur float64 `json:"vatAmountCur"`
VatCodeID int `json:"vatCodeId"`
VatScenarioID int `json:"vatScenarioId"`
VatType int `json:"vatType"`
}
type InvoiceType int