forked from lorenzodonini/ocpp-go
/
request_stop_transaction.go
63 lines (49 loc) · 2.52 KB
/
request_stop_transaction.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
package remotecontrol
import (
"reflect"
"github.com/pxc-smart-business/ocpp-go/ocpp2.0.1/types"
)
// -------------------- Request Start Transaction (CSMS -> CS) --------------------
const RequestStopTransactionFeatureName = "RequestStopTransaction"
// The field definition of the RequestStopTransaction request payload sent by the CSMS to the Charging Station.
type RequestStopTransactionRequest struct {
TransactionID string `json:"transactionId" validate:"required,max=36"`
}
// This field definition of the RequestStopTransaction response payload, sent by the Charging Station to the CSMS in response to a RequestStopTransactionRequest.
// In case the request was invalid, or couldn't be processed, an error will be sent instead.
type RequestStopTransactionResponse struct {
Status RequestStartStopStatus `json:"status" validate:"required,requestStartStopStatus"`
StatusInfo *types.StatusInfo `json:"statusInfo,omitempty"`
}
// The CSMS may remotely stop an ongoing transaction for a user.
// This functionality may be triggered by:
// - a CSO, to help out a user, that is having trouble stopping a transaction
// - a third-party event (e.g. mobile app)
// - the ISO15118-1 use-case F2
//
// The CSMS sends a RequestStopTransactionRequest to the Charging Station.
// The Charging Stations will reply with a RequestStopTransactionResponse.
type RequestStopTransactionFeature struct{}
func (f RequestStopTransactionFeature) GetFeatureName() string {
return RequestStopTransactionFeatureName
}
func (f RequestStopTransactionFeature) GetRequestType() reflect.Type {
return reflect.TypeOf(RequestStopTransactionRequest{})
}
func (f RequestStopTransactionFeature) GetResponseType() reflect.Type {
return reflect.TypeOf(RequestStopTransactionResponse{})
}
func (r RequestStopTransactionRequest) GetFeatureName() string {
return RequestStopTransactionFeatureName
}
func (c RequestStopTransactionResponse) GetFeatureName() string {
return RequestStopTransactionFeatureName
}
// Creates a new RequestStopTransactionRequest, containing all required fields. There are no optional fields for this message.
func NewRequestStopTransactionRequest(transactionID string) *RequestStopTransactionRequest {
return &RequestStopTransactionRequest{TransactionID: transactionID}
}
// Creates a new RequestStopTransactionResponse, containing all required fields. Optional fields may be set afterwards.
func NewRequestStopTransactionResponse(status RequestStartStopStatus) *RequestStopTransactionResponse {
return &RequestStopTransactionResponse{Status: status}
}