diff --git a/ozon/fbs.go b/ozon/fbs.go index a887de3..2e48ec1 100644 --- a/ozon/fbs.go +++ b/ozon/fbs.go @@ -1405,38 +1405,6 @@ func (c FBS) ListOfShipmentCertificates(ctx context.Context, params *ListOfShipm 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 { // Shipment identifier PostingNumber []string `json:"posting_number"` diff --git a/ozon/fbs_test.go b/ozon/fbs_test.go index 80d69d3..f7bec1d 100644 --- a/ozon/fbs_test.go +++ b/ozon/fbs_test.go @@ -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) { t.Parallel()