Update November 22, 2024 (#123)

This commit is contained in:
Kirill
2024-12-27 22:46:08 +03:00
committed by GitHub
parent 7b5f44ee44
commit 2f4d207726
2 changed files with 13 additions and 19 deletions

View File

@@ -463,8 +463,15 @@ type GetReturnsReportsFilter struct {
// Order delivery scheme: fbs — delivery from seller's warehouse // Order delivery scheme: fbs — delivery from seller's warehouse
DeliverySchema string `json:"delivery_schema"` DeliverySchema string `json:"delivery_schema"`
// Order identifier // Date from which the data is displayed in the report.
OrderId int64 `json:"order_id"` //
// 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 // Order status
Status string `json:"status"` Status string `json:"status"`
@@ -473,20 +480,13 @@ type GetReturnsReportsFilter struct {
type GetReturnsReportResponse struct { type GetReturnsReportResponse struct {
core.CommonResponse 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. // Unique report identifier. The report is available for downloading within 3 days after making a request.
Code string `json:"code"` 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. // Method for getting a report on FBO and FBS returns
//
// The method is only suitable for orders shipped from the seller's warehouse
func (c Reports) GetReturns(ctx context.Context, params *GetReturnsReportParams) (*GetReturnsReportResponse, error) { func (c Reports) GetReturns(ctx context.Context, params *GetReturnsReportParams) (*GetReturnsReportResponse, error) {
url := "/v1/report/returns/create" url := "/v2/report/returns/create"
resp := &GetReturnsReportResponse{} resp := &GetReturnsReportResponse{}

View File

@@ -380,9 +380,7 @@ func TestGetReturnsReport(t *testing.T) {
}, },
}, },
`{ `{
"result": { "code": "REPORT_seller_products_924336_1720170405_a9ea2f27-a473-4b13-99f9-d0cfcb5b1a69"
"code": "d55f4517-8347-4e24-9d93-d6e736c1c07c"
}
}`, }`,
}, },
// Test No Client-Id or Api-Key // Test No Client-Id or Api-Key
@@ -407,16 +405,12 @@ func TestGetReturnsReport(t *testing.T) {
continue continue
} }
compareJsonResponse(t, test.response, &GetReturnsReportResponse{})
if resp.StatusCode != test.statusCode { if resp.StatusCode != test.statusCode {
t.Errorf("got wrong status code: got: %d, expected: %d", 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.StatusCode == http.StatusOK {
if resp.Result.Code == "" { compareJsonResponse(t, test.response, &GetReturnsReportResponse{})
t.Errorf("Code cannot be empty")
}
} }
} }
} }