Update January 13, 2025 (#139)

This commit is contained in:
Kirill
2025-03-02 00:59:57 +03:00
committed by GitHub
parent 24cc2cbe93
commit 76e54922fa
2 changed files with 0 additions and 88 deletions

View File

@@ -1405,38 +1405,6 @@ func (c FBS) ListOfShipmentCertificates(ctx context.Context, params *ListOfShipm
return resp, nil return resp, nil
} }
type SignShipmentCertificateParams struct {
// Certificate identifier
Id int64 `json:"id"`
// Type of shipment certificate:
// - act_of_mismatch — discrepancy certificate,
// - act_of_excess — surplus certificate
DocType string `json:"doc_type"`
}
type SignShipmentCertificateResponse struct {
core.CommonResponse
// Request processing
Result string `json:"result"`
}
// Signs shipment certificates electronically via the electronic documents (ED) system of Ozon logistics
func (c FBS) SignShipmentCertificate(ctx context.Context, params *SignShipmentCertificateParams) (*SignShipmentCertificateResponse, error) {
url := "/v2/posting/fbs/digital/act/document-sign"
resp := &SignShipmentCertificateResponse{}
response, err := c.client.Request(ctx, http.MethodPost, url, params, resp, nil)
if err != nil {
return nil, err
}
response.CopyCommonResponse(&resp.CommonResponse)
return resp, nil
}
type ChangeStatusToParams struct { type ChangeStatusToParams struct {
// Shipment identifier // Shipment identifier
PostingNumber []string `json:"posting_number"` PostingNumber []string `json:"posting_number"`

View File

@@ -878,62 +878,6 @@ func TestListOfShipmentCertificates(t *testing.T) {
} }
} }
func TestSignShipmentCertificate(t *testing.T) {
t.Parallel()
tests := []struct {
statusCode int
headers map[string]string
params *SignShipmentCertificateParams
response string
}{
// Test Ok
{
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
&SignShipmentCertificateParams{
Id: 900000250859000,
DocType: "act_of_mismatch",
},
`{
"result": "string"
}`,
},
// Test No Client-Id or Api-Key
{
http.StatusUnauthorized,
map[string]string{},
&SignShipmentCertificateParams{},
`{
"code": 16,
"message": "Client-Id and Api-Key headers are required"
}`,
},
}
for _, test := range tests {
c := NewMockClient(core.NewMockHttpHandler(test.statusCode, test.response, test.headers))
ctx, _ := context.WithTimeout(context.Background(), testTimeout)
resp, err := c.FBS().SignShipmentCertificate(ctx, test.params)
if err != nil {
t.Error(err)
continue
}
compareJsonResponse(t, test.response, &SignShipmentCertificateResponse{})
if resp.StatusCode != test.statusCode {
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
}
if resp.StatusCode == http.StatusOK {
if resp.Result == "" {
t.Errorf("Result cannot be empty")
}
}
}
}
func TestChangeStatusTo(t *testing.T) { func TestChangeStatusTo(t *testing.T) {
t.Parallel() t.Parallel()