method to list cancellation reasons for fbo scheme

This commit is contained in:
diPhantxm
2024-10-31 15:16:11 +03:00
parent 2164eff0a6
commit 3430ead143
2 changed files with 105 additions and 0 deletions

View File

@@ -3016,3 +3016,38 @@ func (c FBS) GetCarriage(ctx context.Context, params *GetCarriageParams) (*GetCa
return resp, nil
}
type GetCancellationReasonsResponse struct {
core.CommonResponse
// Method result
Result []GetCancellationReasonsResult `json:"result"`
}
type GetCancellationReasonsResult struct {
// Cancellation reasons identifier
Id int64 `json:"id"`
// Shipment cancellation result. true if the request is available for cancellation
IsAvailableForCancellation bool `json:"is_available_for_cancellation"`
// Category name
Title string `json:"title"`
// Shipment cancellation initiator
TypeId string `json:"type_id"`
}
func (c FBS) GetCancellationReasons(ctx context.Context) (*GetCancellationReasonsResponse, error) {
url := "/v1/posting/fbo/cancel-reason/list"
resp := &GetCancellationReasonsResponse{}
response, err := c.client.Request(ctx, http.MethodPost, url, nil, resp, nil)
if err != nil {
return nil, err
}
response.CopyCommonResponse(&resp.CommonResponse)
return resp, nil
}