diff --git a/ozon/reports.go b/ozon/reports.go index f3da60f..0be30c1 100644 --- a/ozon/reports.go +++ b/ozon/reports.go @@ -463,8 +463,15 @@ type GetReturnsReportsFilter struct { // Order delivery scheme: fbs — delivery from seller's warehouse DeliverySchema string `json:"delivery_schema"` - // Order identifier - OrderId int64 `json:"order_id"` + // Date from which the data is displayed in the report. + // + // Available for the last three months only + DateFrom time.Time `json:"date_from"` + + // Date up to which the data is displayed in the report. + // + // Available for the last three months only + DateTo time.Time `json:"date_to"` // Order status Status string `json:"status"` @@ -473,20 +480,13 @@ type GetReturnsReportsFilter struct { type GetReturnsReportResponse struct { core.CommonResponse - // Method result - Result GetReturnReportResult `json:"result"` -} - -type GetReturnReportResult struct { // Unique report identifier. The report is available for downloading within 3 days after making a request. Code string `json:"code"` } -// The report contains information about returned products that were accepted from the customer, ready for pickup, or delivered to the seller. -// -// The method is only suitable for orders shipped from the seller's warehouse +// Method for getting a report on FBO and FBS returns func (c Reports) GetReturns(ctx context.Context, params *GetReturnsReportParams) (*GetReturnsReportResponse, error) { - url := "/v1/report/returns/create" + url := "/v2/report/returns/create" resp := &GetReturnsReportResponse{} diff --git a/ozon/reports_test.go b/ozon/reports_test.go index 61e028d..392f33b 100644 --- a/ozon/reports_test.go +++ b/ozon/reports_test.go @@ -380,9 +380,7 @@ func TestGetReturnsReport(t *testing.T) { }, }, `{ - "result": { - "code": "d55f4517-8347-4e24-9d93-d6e736c1c07c" - } + "code": "REPORT_seller_products_924336_1720170405_a9ea2f27-a473-4b13-99f9-d0cfcb5b1a69" }`, }, // Test No Client-Id or Api-Key @@ -407,16 +405,12 @@ func TestGetReturnsReport(t *testing.T) { continue } - compareJsonResponse(t, test.response, &GetReturnsReportResponse{}) - 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.Code == "" { - t.Errorf("Code cannot be empty") - } + compareJsonResponse(t, test.response, &GetReturnsReportResponse{}) } } }