forked from iiko-go/iiko-go
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeliveries.go
More file actions
66 lines (50 loc) · 1.72 KB
/
deliveries.go
File metadata and controls
66 lines (50 loc) · 1.72 KB
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
package iiko
import (
"github.com/google/uuid"
)
type OrderServiceType string
const (
Common OrderServiceType = "Common"
DeliveryByCourier OrderServiceType = "DeliveryByCourier"
DeliveryPickUp OrderServiceType = "DeliveryPickUp"
)
type OrderTypeItem struct {
// Order type ID in RMS. [required]
ID uuid.UUID `json:"id"`
// Order type name. [required]
Name string `json:"name"`
// Enum: Common, DeliveryByCourier, DeliveryPickUp Service type. [required]
OrderServiceType OrderServiceType `json:"orderServiceType"`
// IsDeleted attribute of order type.
IsDeleted bool `json:"isDeleted"`
// External system revision number.
ExternalRevision int64 `json:"externalRevision"`
}
type OrderType struct {
// Organization ID.
// Can be obtained by /api/1/organizations operation. [required]
OrganizationID uuid.UUID `json:"organizationId"`
// Items for organization. [required]
Items []OrderTypeItem `json:"items"`
}
type DeliveriesOrderTypesRequest struct {
// Organizations IDs which payment types have to be returned.
// Can be obtained by /api/1/organizations operation. [required]
OrganizationIDs []uuid.UUID `json:"organizationIds"`
}
type DeliveriesOrderTypesResponse struct {
// Operation ID. [required]
CorrelationID uuid.UUID `json:"correlationId"`
// List of order types. [required]
OrderTypes []OrderType `json:"orderTypes"`
}
// Order types.
//
// iiko API: /api/1/deliveries/order_types
func (c *Client) DeliveriesOrderTypes(req *DeliveriesOrderTypesRequest, opts ...Option) (*DeliveriesOrderTypesResponse, error) {
var response DeliveriesOrderTypesResponse
if err := c.post(true, "/api/1/deliveries/order_types", req, &response, opts...); err != nil {
return nil, err
}
return &response, nil
}