From c5f53b3cfa1661998271288240497b64f9b6d0e6 Mon Sep 17 00:00:00 2001 From: dwibudut Date: Tue, 5 Mar 2024 16:36:17 +0700 Subject: [PATCH] fix typo field 15118CertificateHashData to iso15118CertificateHashData on AuthorizeRequest --- ocpp2.0.1/authorization/authorize.go | 2 +- ocpp2.0.1_test/authorize_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ocpp2.0.1/authorization/authorize.go b/ocpp2.0.1/authorization/authorize.go index 6ba8764f..d04c97f3 100644 --- a/ocpp2.0.1/authorization/authorize.go +++ b/ocpp2.0.1/authorization/authorize.go @@ -39,7 +39,7 @@ func isValidAuthorizeCertificateStatus(fl validator.FieldLevel) bool { type AuthorizeRequest struct { Certificate string `json:"certificate,omitempty" validate:"max=5500"` IdToken types.IdToken `json:"idToken" validate:"required"` - CertificateHashData []types.OCSPRequestDataType `json:"15118CertificateHashData,omitempty" validate:"max=4,dive"` + CertificateHashData []types.OCSPRequestDataType `json:"iso15118CertificateHashData,omitempty" validate:"max=4,dive"` } // This field definition of the Authorize response payload, sent by the Charging Station to the CSMS in response to an AuthorizeRequest. diff --git a/ocpp2.0.1_test/authorize_test.go b/ocpp2.0.1_test/authorize_test.go index db31dab3..2f6f08ca 100644 --- a/ocpp2.0.1_test/authorize_test.go +++ b/ocpp2.0.1_test/authorize_test.go @@ -53,7 +53,7 @@ func (suite *OcppV2TestSuite) TestAuthorizeE2EMocked() { certHashData := types.OCSPRequestDataType{HashAlgorithm: types.SHA256, IssuerNameHash: "h0", IssuerKeyHash: "h0.1", SerialNumber: "s0", ResponderURL: "http://www.test.org"} status := types.AuthorizationStatusAccepted certificateStatus := authorization.CertificateStatusAccepted - requestJson := fmt.Sprintf(`[2,"%v","%v",{"certificate":"%v","idToken":{"idToken":"%v","type":"%v","additionalInfo":[{"additionalIdToken":"%v","type":"%v"}]},"15118CertificateHashData":[{"hashAlgorithm":"%v","issuerNameHash":"%v","issuerKeyHash":"%v","serialNumber":"%v","responderURL":"%v"}]}]`, + requestJson := fmt.Sprintf(`[2,"%v","%v",{"certificate":"%v","idToken":{"idToken":"%v","type":"%v","additionalInfo":[{"additionalIdToken":"%v","type":"%v"}]},"iso15118CertificateHashData":[{"hashAlgorithm":"%v","issuerNameHash":"%v","issuerKeyHash":"%v","serialNumber":"%v","responderURL":"%v"}]}]`, messageId, authorization.AuthorizeFeatureName, certificate, idToken.IdToken, idToken.Type, additionalInfo.AdditionalIdToken, additionalInfo.Type, certHashData.HashAlgorithm, certHashData.IssuerNameHash, certHashData.IssuerKeyHash, certHashData.SerialNumber, certHashData.ResponderURL) responseJson := fmt.Sprintf(`[3,"%v",{"certificateStatus":"%v","idTokenInfo":{"status":"%v"}}]`, messageId, certificateStatus, status) @@ -103,7 +103,7 @@ func (suite *OcppV2TestSuite) TestAuthorizeInvalidEndpoint() { idToken := types.IdToken{IdToken: "tok1", Type: types.IdTokenTypeKeyCode, AdditionalInfo: []types.AdditionalInfo{additionalInfo}} certHashData := types.OCSPRequestDataType{HashAlgorithm: types.SHA256, IssuerNameHash: "h0", IssuerKeyHash: "h0.1", SerialNumber: "s0", ResponderURL: "http://www.test.org"} authorizeRequest := authorization.NewAuthorizationRequest(idToken.IdToken, idToken.Type) - requestJson := fmt.Sprintf(`[2,"%v","%v",{"certificate":"%v","idToken":{"idToken":"%v","type":"%v","additionalInfo":[{"additionalIdToken":"%v","type":"%v"}]},"15118CertificateHashData":[{"hashAlgorithm":"%v","issuerNameHash":"%v","issuerKeyHash":"%v","serialNumber":"%v","responderURL":"%v"}]}]`, + requestJson := fmt.Sprintf(`[2,"%v","%v",{"certificate":"%v","idToken":{"idToken":"%v","type":"%v","additionalInfo":[{"additionalIdToken":"%v","type":"%v"}]},"iso15118CertificateHashData":[{"hashAlgorithm":"%v","issuerNameHash":"%v","issuerKeyHash":"%v","serialNumber":"%v","responderURL":"%v"}]}]`, messageId, authorization.AuthorizeFeatureName, certificate, idToken.IdToken, idToken.Type, additionalInfo.AdditionalIdToken, additionalInfo.Type, certHashData.HashAlgorithm, certHashData.IssuerNameHash, certHashData.IssuerKeyHash, certHashData.SerialNumber, certHashData.ResponderURL) testUnsupportedRequestFromCentralSystem(suite, authorizeRequest, requestJson, messageId) }