From d846ee65ffef541586df8be9e0a533fa4623e9a4 Mon Sep 17 00:00:00 2001 From: joeydoyecaci Date: Thu, 11 Jan 2024 18:42:17 +0000 Subject: [PATCH] removed definittion for /personally_procured_moves/incentive from internal.yaml API definition. removed deprecated "personally procured move" incentive handler. --- pkg/gen/internalapi/configure_mymove.go | 5 - pkg/gen/internalapi/embedded_spec.go | 142 --------- .../internaloperations/mymove_api.go | 12 - .../ppm/show_p_p_m_incentive.go | 58 ---- .../ppm/show_p_p_m_incentive_parameters.go | 280 ------------------ .../ppm/show_p_p_m_incentive_responses.go | 184 ------------ .../ppm/show_p_p_m_incentive_urlbuilder.go | 127 -------- pkg/handlers/internalapi/api.go | 1 - .../personally_procured_move_incentive.go | 85 ------ swagger-def/internal.yaml | 49 --- swagger/internal.yaml | 49 --- 11 files changed, 992 deletions(-) delete mode 100644 pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive.go delete mode 100644 pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive_parameters.go delete mode 100644 pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive_responses.go delete mode 100644 pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive_urlbuilder.go delete mode 100644 pkg/handlers/internalapi/personally_procured_move_incentive.go diff --git a/pkg/gen/internalapi/configure_mymove.go b/pkg/gen/internalapi/configure_mymove.go index a5a94d9b495..78c9689af16 100644 --- a/pkg/gen/internalapi/configure_mymove.go +++ b/pkg/gen/internalapi/configure_mymove.go @@ -307,11 +307,6 @@ func configureAPI(api *internaloperations.MymoveAPI) http.Handler { return middleware.NotImplemented("operation ppm.ShowPPMEstimate has not yet been implemented") }) } - if api.PpmShowPPMIncentiveHandler == nil { - api.PpmShowPPMIncentiveHandler = ppm.ShowPPMIncentiveHandlerFunc(func(params ppm.ShowPPMIncentiveParams) middleware.Responder { - return middleware.NotImplemented("operation ppm.ShowPPMIncentive has not yet been implemented") - }) - } if api.PpmShowPPMSitEstimateHandler == nil { api.PpmShowPPMSitEstimateHandler = ppm.ShowPPMSitEstimateHandlerFunc(func(params ppm.ShowPPMSitEstimateParams) middleware.Responder { return middleware.NotImplemented("operation ppm.ShowPPMSitEstimate has not yet been implemented") diff --git a/pkg/gen/internalapi/embedded_spec.go b/pkg/gen/internalapi/embedded_spec.go index f13223db818..07d45bdc82c 100644 --- a/pkg/gen/internalapi/embedded_spec.go +++ b/pkg/gen/internalapi/embedded_spec.go @@ -2005,77 +2005,6 @@ func init() { } } }, - "/personally_procured_moves/incentive": { - "get": { - "description": "Calculates incentive for a PPM move (excluding SIT)", - "tags": [ - "ppm" - ], - "summary": "Return a PPM incentive value", - "operationId": "showPPMIncentive", - "parameters": [ - { - "type": "string", - "format": "date", - "name": "original_move_date", - "in": "query", - "required": true - }, - { - "pattern": "^(\\d{5}([\\-]\\d{4})?)$", - "type": "string", - "format": "zip", - "name": "origin_zip", - "in": "query", - "required": true - }, - { - "pattern": "^(\\d{5}([\\-]\\d{4})?)$", - "type": "string", - "format": "zip", - "name": "origin_duty_location_zip", - "in": "query", - "required": true - }, - { - "type": "string", - "format": "uuid", - "name": "orders_id", - "in": "query", - "required": true - }, - { - "type": "integer", - "name": "weight", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "Made calculation of PPM incentive", - "schema": { - "$ref": "#/definitions/PPMIncentive" - } - }, - "400": { - "description": "invalid request" - }, - "401": { - "description": "request requires user authentication" - }, - "403": { - "description": "user is not authorized" - }, - "409": { - "description": "distance is less than 50 miles (no short haul moves)" - }, - "500": { - "description": "internal server error" - } - } - } - }, "/personally_procured_moves/{personallyProcuredMoveId}/approve": { "post": { "description": "Sets the status of the PPM to APPROVED.", @@ -10318,77 +10247,6 @@ func init() { } } }, - "/personally_procured_moves/incentive": { - "get": { - "description": "Calculates incentive for a PPM move (excluding SIT)", - "tags": [ - "ppm" - ], - "summary": "Return a PPM incentive value", - "operationId": "showPPMIncentive", - "parameters": [ - { - "type": "string", - "format": "date", - "name": "original_move_date", - "in": "query", - "required": true - }, - { - "pattern": "^(\\d{5}([\\-]\\d{4})?)$", - "type": "string", - "format": "zip", - "name": "origin_zip", - "in": "query", - "required": true - }, - { - "pattern": "^(\\d{5}([\\-]\\d{4})?)$", - "type": "string", - "format": "zip", - "name": "origin_duty_location_zip", - "in": "query", - "required": true - }, - { - "type": "string", - "format": "uuid", - "name": "orders_id", - "in": "query", - "required": true - }, - { - "type": "integer", - "name": "weight", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "Made calculation of PPM incentive", - "schema": { - "$ref": "#/definitions/PPMIncentive" - } - }, - "400": { - "description": "invalid request" - }, - "401": { - "description": "request requires user authentication" - }, - "403": { - "description": "user is not authorized" - }, - "409": { - "description": "distance is less than 50 miles (no short haul moves)" - }, - "500": { - "description": "internal server error" - } - } - } - }, "/personally_procured_moves/{personallyProcuredMoveId}/approve": { "post": { "description": "Sets the status of the PPM to APPROVED.", diff --git a/pkg/gen/internalapi/internaloperations/mymove_api.go b/pkg/gen/internalapi/internaloperations/mymove_api.go index f7ee6bd6355..6a71027ab7b 100644 --- a/pkg/gen/internalapi/internaloperations/mymove_api.go +++ b/pkg/gen/internalapi/internaloperations/mymove_api.go @@ -210,9 +210,6 @@ func NewMymoveAPI(spec *loads.Document) *MymoveAPI { PpmShowPPMEstimateHandler: ppm.ShowPPMEstimateHandlerFunc(func(params ppm.ShowPPMEstimateParams) middleware.Responder { return middleware.NotImplemented("operation ppm.ShowPPMEstimate has not yet been implemented") }), - PpmShowPPMIncentiveHandler: ppm.ShowPPMIncentiveHandlerFunc(func(params ppm.ShowPPMIncentiveParams) middleware.Responder { - return middleware.NotImplemented("operation ppm.ShowPPMIncentive has not yet been implemented") - }), PpmShowPPMSitEstimateHandler: ppm.ShowPPMSitEstimateHandlerFunc(func(params ppm.ShowPPMSitEstimateParams) middleware.Responder { return middleware.NotImplemented("operation ppm.ShowPPMSitEstimate has not yet been implemented") }), @@ -419,8 +416,6 @@ type MymoveAPI struct { OrdersShowOrdersHandler orders.ShowOrdersHandler // PpmShowPPMEstimateHandler sets the operation handler for the show p p m estimate operation PpmShowPPMEstimateHandler ppm.ShowPPMEstimateHandler - // PpmShowPPMIncentiveHandler sets the operation handler for the show p p m incentive operation - PpmShowPPMIncentiveHandler ppm.ShowPPMIncentiveHandler // PpmShowPPMSitEstimateHandler sets the operation handler for the show p p m sit estimate operation PpmShowPPMSitEstimateHandler ppm.ShowPPMSitEstimateHandler // QueuesShowQueueHandler sets the operation handler for the show queue operation @@ -690,9 +685,6 @@ func (o *MymoveAPI) Validate() error { if o.PpmShowPPMEstimateHandler == nil { unregistered = append(unregistered, "ppm.ShowPPMEstimateHandler") } - if o.PpmShowPPMIncentiveHandler == nil { - unregistered = append(unregistered, "ppm.ShowPPMIncentiveHandler") - } if o.PpmShowPPMSitEstimateHandler == nil { unregistered = append(unregistered, "ppm.ShowPPMSitEstimateHandler") } @@ -1043,10 +1035,6 @@ func (o *MymoveAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/personally_procured_moves/incentive"] = ppm.NewShowPPMIncentive(o.context, o.PpmShowPPMIncentiveHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } o.handlers["GET"]["/estimates/ppm_sit"] = ppm.NewShowPPMSitEstimate(o.context, o.PpmShowPPMSitEstimateHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) diff --git a/pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive.go b/pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive.go deleted file mode 100644 index ce644d9a20e..00000000000 --- a/pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package ppm - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// ShowPPMIncentiveHandlerFunc turns a function with the right signature into a show p p m incentive handler -type ShowPPMIncentiveHandlerFunc func(ShowPPMIncentiveParams) middleware.Responder - -// Handle executing the request and returning a response -func (fn ShowPPMIncentiveHandlerFunc) Handle(params ShowPPMIncentiveParams) middleware.Responder { - return fn(params) -} - -// ShowPPMIncentiveHandler interface for that can handle valid show p p m incentive params -type ShowPPMIncentiveHandler interface { - Handle(ShowPPMIncentiveParams) middleware.Responder -} - -// NewShowPPMIncentive creates a new http.Handler for the show p p m incentive operation -func NewShowPPMIncentive(ctx *middleware.Context, handler ShowPPMIncentiveHandler) *ShowPPMIncentive { - return &ShowPPMIncentive{Context: ctx, Handler: handler} -} - -/* - ShowPPMIncentive swagger:route GET /personally_procured_moves/incentive ppm showPPMIncentive - -# Return a PPM incentive value - -Calculates incentive for a PPM move (excluding SIT) -*/ -type ShowPPMIncentive struct { - Context *middleware.Context - Handler ShowPPMIncentiveHandler -} - -func (o *ShowPPMIncentive) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewShowPPMIncentiveParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive_parameters.go b/pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive_parameters.go deleted file mode 100644 index 77e3597d397..00000000000 --- a/pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive_parameters.go +++ /dev/null @@ -1,280 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package ppm - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// NewShowPPMIncentiveParams creates a new ShowPPMIncentiveParams object -// -// There are no default values defined in the spec. -func NewShowPPMIncentiveParams() ShowPPMIncentiveParams { - - return ShowPPMIncentiveParams{} -} - -// ShowPPMIncentiveParams contains all the bound params for the show p p m incentive operation -// typically these are obtained from a http.Request -// -// swagger:parameters showPPMIncentive -type ShowPPMIncentiveParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /* - Required: true - In: query - */ - OrdersID strfmt.UUID - /* - Required: true - Pattern: ^(\d{5}([\-]\d{4})?)$ - In: query - */ - OriginDutyLocationZip string - /* - Required: true - Pattern: ^(\d{5}([\-]\d{4})?)$ - In: query - */ - OriginZip string - /* - Required: true - In: query - */ - OriginalMoveDate strfmt.Date - /* - Required: true - In: query - */ - Weight int64 -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewShowPPMIncentiveParams() beforehand. -func (o *ShowPPMIncentiveParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - qs := runtime.Values(r.URL.Query()) - - qOrdersID, qhkOrdersID, _ := qs.GetOK("orders_id") - if err := o.bindOrdersID(qOrdersID, qhkOrdersID, route.Formats); err != nil { - res = append(res, err) - } - - qOriginDutyLocationZip, qhkOriginDutyLocationZip, _ := qs.GetOK("origin_duty_location_zip") - if err := o.bindOriginDutyLocationZip(qOriginDutyLocationZip, qhkOriginDutyLocationZip, route.Formats); err != nil { - res = append(res, err) - } - - qOriginZip, qhkOriginZip, _ := qs.GetOK("origin_zip") - if err := o.bindOriginZip(qOriginZip, qhkOriginZip, route.Formats); err != nil { - res = append(res, err) - } - - qOriginalMoveDate, qhkOriginalMoveDate, _ := qs.GetOK("original_move_date") - if err := o.bindOriginalMoveDate(qOriginalMoveDate, qhkOriginalMoveDate, route.Formats); err != nil { - res = append(res, err) - } - - qWeight, qhkWeight, _ := qs.GetOK("weight") - if err := o.bindWeight(qWeight, qhkWeight, route.Formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// bindOrdersID binds and validates parameter OrdersID from query. -func (o *ShowPPMIncentiveParams) bindOrdersID(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("orders_id", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("orders_id", "query", raw); err != nil { - return err - } - - // Format: uuid - value, err := formats.Parse("uuid", raw) - if err != nil { - return errors.InvalidType("orders_id", "query", "strfmt.UUID", raw) - } - o.OrdersID = *(value.(*strfmt.UUID)) - - if err := o.validateOrdersID(formats); err != nil { - return err - } - - return nil -} - -// validateOrdersID carries on validations for parameter OrdersID -func (o *ShowPPMIncentiveParams) validateOrdersID(formats strfmt.Registry) error { - - if err := validate.FormatOf("orders_id", "query", "uuid", o.OrdersID.String(), formats); err != nil { - return err - } - return nil -} - -// bindOriginDutyLocationZip binds and validates parameter OriginDutyLocationZip from query. -func (o *ShowPPMIncentiveParams) bindOriginDutyLocationZip(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("origin_duty_location_zip", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("origin_duty_location_zip", "query", raw); err != nil { - return err - } - o.OriginDutyLocationZip = raw - - if err := o.validateOriginDutyLocationZip(formats); err != nil { - return err - } - - return nil -} - -// validateOriginDutyLocationZip carries on validations for parameter OriginDutyLocationZip -func (o *ShowPPMIncentiveParams) validateOriginDutyLocationZip(formats strfmt.Registry) error { - - if err := validate.Pattern("origin_duty_location_zip", "query", o.OriginDutyLocationZip, `^(\d{5}([\-]\d{4})?)$`); err != nil { - return err - } - - return nil -} - -// bindOriginZip binds and validates parameter OriginZip from query. -func (o *ShowPPMIncentiveParams) bindOriginZip(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("origin_zip", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("origin_zip", "query", raw); err != nil { - return err - } - o.OriginZip = raw - - if err := o.validateOriginZip(formats); err != nil { - return err - } - - return nil -} - -// validateOriginZip carries on validations for parameter OriginZip -func (o *ShowPPMIncentiveParams) validateOriginZip(formats strfmt.Registry) error { - - if err := validate.Pattern("origin_zip", "query", o.OriginZip, `^(\d{5}([\-]\d{4})?)$`); err != nil { - return err - } - - return nil -} - -// bindOriginalMoveDate binds and validates parameter OriginalMoveDate from query. -func (o *ShowPPMIncentiveParams) bindOriginalMoveDate(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("original_move_date", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("original_move_date", "query", raw); err != nil { - return err - } - - // Format: date - value, err := formats.Parse("date", raw) - if err != nil { - return errors.InvalidType("original_move_date", "query", "strfmt.Date", raw) - } - o.OriginalMoveDate = *(value.(*strfmt.Date)) - - if err := o.validateOriginalMoveDate(formats); err != nil { - return err - } - - return nil -} - -// validateOriginalMoveDate carries on validations for parameter OriginalMoveDate -func (o *ShowPPMIncentiveParams) validateOriginalMoveDate(formats strfmt.Registry) error { - - if err := validate.FormatOf("original_move_date", "query", "date", o.OriginalMoveDate.String(), formats); err != nil { - return err - } - return nil -} - -// bindWeight binds and validates parameter Weight from query. -func (o *ShowPPMIncentiveParams) bindWeight(rawData []string, hasKey bool, formats strfmt.Registry) error { - if !hasKey { - return errors.Required("weight", "query", rawData) - } - var raw string - if len(rawData) > 0 { - raw = rawData[len(rawData)-1] - } - - // Required: true - // AllowEmptyValue: false - - if err := validate.RequiredString("weight", "query", raw); err != nil { - return err - } - - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("weight", "query", "int64", raw) - } - o.Weight = value - - return nil -} diff --git a/pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive_responses.go b/pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive_responses.go deleted file mode 100644 index fa946895814..00000000000 --- a/pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive_responses.go +++ /dev/null @@ -1,184 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package ppm - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/transcom/mymove/pkg/gen/internalmessages" -) - -// ShowPPMIncentiveOKCode is the HTTP code returned for type ShowPPMIncentiveOK -const ShowPPMIncentiveOKCode int = 200 - -/* -ShowPPMIncentiveOK Made calculation of PPM incentive - -swagger:response showPPMIncentiveOK -*/ -type ShowPPMIncentiveOK struct { - - /* - In: Body - */ - Payload *internalmessages.PPMIncentive `json:"body,omitempty"` -} - -// NewShowPPMIncentiveOK creates ShowPPMIncentiveOK with default headers values -func NewShowPPMIncentiveOK() *ShowPPMIncentiveOK { - - return &ShowPPMIncentiveOK{} -} - -// WithPayload adds the payload to the show p p m incentive o k response -func (o *ShowPPMIncentiveOK) WithPayload(payload *internalmessages.PPMIncentive) *ShowPPMIncentiveOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the show p p m incentive o k response -func (o *ShowPPMIncentiveOK) SetPayload(payload *internalmessages.PPMIncentive) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ShowPPMIncentiveOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// ShowPPMIncentiveBadRequestCode is the HTTP code returned for type ShowPPMIncentiveBadRequest -const ShowPPMIncentiveBadRequestCode int = 400 - -/* -ShowPPMIncentiveBadRequest invalid request - -swagger:response showPPMIncentiveBadRequest -*/ -type ShowPPMIncentiveBadRequest struct { -} - -// NewShowPPMIncentiveBadRequest creates ShowPPMIncentiveBadRequest with default headers values -func NewShowPPMIncentiveBadRequest() *ShowPPMIncentiveBadRequest { - - return &ShowPPMIncentiveBadRequest{} -} - -// WriteResponse to the client -func (o *ShowPPMIncentiveBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(400) -} - -// ShowPPMIncentiveUnauthorizedCode is the HTTP code returned for type ShowPPMIncentiveUnauthorized -const ShowPPMIncentiveUnauthorizedCode int = 401 - -/* -ShowPPMIncentiveUnauthorized request requires user authentication - -swagger:response showPPMIncentiveUnauthorized -*/ -type ShowPPMIncentiveUnauthorized struct { -} - -// NewShowPPMIncentiveUnauthorized creates ShowPPMIncentiveUnauthorized with default headers values -func NewShowPPMIncentiveUnauthorized() *ShowPPMIncentiveUnauthorized { - - return &ShowPPMIncentiveUnauthorized{} -} - -// WriteResponse to the client -func (o *ShowPPMIncentiveUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(401) -} - -// ShowPPMIncentiveForbiddenCode is the HTTP code returned for type ShowPPMIncentiveForbidden -const ShowPPMIncentiveForbiddenCode int = 403 - -/* -ShowPPMIncentiveForbidden user is not authorized - -swagger:response showPPMIncentiveForbidden -*/ -type ShowPPMIncentiveForbidden struct { -} - -// NewShowPPMIncentiveForbidden creates ShowPPMIncentiveForbidden with default headers values -func NewShowPPMIncentiveForbidden() *ShowPPMIncentiveForbidden { - - return &ShowPPMIncentiveForbidden{} -} - -// WriteResponse to the client -func (o *ShowPPMIncentiveForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(403) -} - -// ShowPPMIncentiveConflictCode is the HTTP code returned for type ShowPPMIncentiveConflict -const ShowPPMIncentiveConflictCode int = 409 - -/* -ShowPPMIncentiveConflict distance is less than 50 miles (no short haul moves) - -swagger:response showPPMIncentiveConflict -*/ -type ShowPPMIncentiveConflict struct { -} - -// NewShowPPMIncentiveConflict creates ShowPPMIncentiveConflict with default headers values -func NewShowPPMIncentiveConflict() *ShowPPMIncentiveConflict { - - return &ShowPPMIncentiveConflict{} -} - -// WriteResponse to the client -func (o *ShowPPMIncentiveConflict) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(409) -} - -// ShowPPMIncentiveInternalServerErrorCode is the HTTP code returned for type ShowPPMIncentiveInternalServerError -const ShowPPMIncentiveInternalServerErrorCode int = 500 - -/* -ShowPPMIncentiveInternalServerError internal server error - -swagger:response showPPMIncentiveInternalServerError -*/ -type ShowPPMIncentiveInternalServerError struct { -} - -// NewShowPPMIncentiveInternalServerError creates ShowPPMIncentiveInternalServerError with default headers values -func NewShowPPMIncentiveInternalServerError() *ShowPPMIncentiveInternalServerError { - - return &ShowPPMIncentiveInternalServerError{} -} - -// WriteResponse to the client -func (o *ShowPPMIncentiveInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(500) -} diff --git a/pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive_urlbuilder.go b/pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive_urlbuilder.go deleted file mode 100644 index c81ef163827..00000000000 --- a/pkg/gen/internalapi/internaloperations/ppm/show_p_p_m_incentive_urlbuilder.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package ppm - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ShowPPMIncentiveURL generates an URL for the show p p m incentive operation -type ShowPPMIncentiveURL struct { - OrdersID strfmt.UUID - OriginDutyLocationZip string - OriginZip string - OriginalMoveDate strfmt.Date - Weight int64 - - _basePath string - // avoid unkeyed usage - _ struct{} -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ShowPPMIncentiveURL) WithBasePath(bp string) *ShowPPMIncentiveURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *ShowPPMIncentiveURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *ShowPPMIncentiveURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/personally_procured_moves/incentive" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/internal" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - qs := make(url.Values) - - ordersIDQ := o.OrdersID.String() - if ordersIDQ != "" { - qs.Set("orders_id", ordersIDQ) - } - - originDutyLocationZipQ := o.OriginDutyLocationZip - if originDutyLocationZipQ != "" { - qs.Set("origin_duty_location_zip", originDutyLocationZipQ) - } - - originZipQ := o.OriginZip - if originZipQ != "" { - qs.Set("origin_zip", originZipQ) - } - - originalMoveDateQ := o.OriginalMoveDate.String() - if originalMoveDateQ != "" { - qs.Set("original_move_date", originalMoveDateQ) - } - - weightQ := swag.FormatInt64(o.Weight) - if weightQ != "" { - qs.Set("weight", weightQ) - } - - _result.RawQuery = qs.Encode() - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *ShowPPMIncentiveURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *ShowPPMIncentiveURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *ShowPPMIncentiveURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on ShowPPMIncentiveURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on ShowPPMIncentiveURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *ShowPPMIncentiveURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/pkg/handlers/internalapi/api.go b/pkg/handlers/internalapi/api.go index 7ff49ce9db7..af4d2434914 100644 --- a/pkg/handlers/internalapi/api.go +++ b/pkg/handlers/internalapi/api.go @@ -68,7 +68,6 @@ func NewInternalAPI(handlerConfig handlers.HandlerConfig) *internalops.MymoveAPI internalAPI.PpmPatchPersonallyProcuredMoveHandler = PatchPersonallyProcuredMoveHandler{handlerConfig} internalAPI.PpmSubmitPersonallyProcuredMoveHandler = SubmitPersonallyProcuredMoveHandler{handlerConfig} - internalAPI.PpmShowPPMIncentiveHandler = ShowPPMIncentiveHandler{handlerConfig} internalAPI.PpmRequestPPMPaymentHandler = RequestPPMPaymentHandler{handlerConfig} internalAPI.DutyLocationsSearchDutyLocationsHandler = SearchDutyLocationsHandler{handlerConfig} diff --git a/pkg/handlers/internalapi/personally_procured_move_incentive.go b/pkg/handlers/internalapi/personally_procured_move_incentive.go deleted file mode 100644 index 636b619d1ac..00000000000 --- a/pkg/handlers/internalapi/personally_procured_move_incentive.go +++ /dev/null @@ -1,85 +0,0 @@ -package internalapi - -import ( - "time" - - "github.com/go-openapi/runtime/middleware" - "github.com/gofrs/uuid" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/apperror" - ppmop "github.com/transcom/mymove/pkg/gen/internalapi/internaloperations/ppm" - "github.com/transcom/mymove/pkg/gen/internalmessages" - "github.com/transcom/mymove/pkg/handlers" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/rateengine" - "github.com/transcom/mymove/pkg/unit" -) - -// ShowPPMIncentiveHandler returns PPM SIT estimate for a weight, move date, -type ShowPPMIncentiveHandler struct { - handlers.HandlerConfig -} - -// Handle calculates a PPM reimbursement range. -func (h ShowPPMIncentiveHandler) Handle(params ppmop.ShowPPMIncentiveParams) middleware.Responder { - return h.AuditableAppContextFromRequestWithErrors(params.HTTPRequest, - func(appCtx appcontext.AppContext) (middleware.Responder, error) { - if !appCtx.Session().IsOfficeUser() { - return ppmop.NewShowPPMIncentiveForbidden(), apperror.NewForbiddenError("user must be office user") - } - - ordersID, err := uuid.FromString(params.OrdersID.String()) - if err != nil { - return handlers.ResponseForError(appCtx.Logger(), err), err - } - - move, err := models.FetchMoveByOrderID(appCtx.DB(), ordersID) - if err != nil { - return handlers.ResponseForError(appCtx.Logger(), err), err - } - - engine := rateengine.NewRateEngine(move) - - destinationZip, err := GetDestinationDutyLocationPostalCode(appCtx, ordersID) - if err != nil { - return handlers.ResponseForError(appCtx.Logger(), err), err - } - - distanceMilesFromOriginPickupZip, err := h.DTODPlanner().Zip5TransitDistanceLineHaul(appCtx, params.OriginZip, destinationZip) - if err != nil { - return handlers.ResponseForError(appCtx.Logger(), err), err - } - - distanceMilesFromOriginDutyLocationZip, err := h.DTODPlanner().Zip5TransitDistanceLineHaul(appCtx, params.OriginDutyLocationZip, destinationZip) - if err != nil { - return handlers.ResponseForError(appCtx.Logger(), err), err - } - - costDetails, err := engine.ComputePPMMoveCosts( - appCtx, - unit.Pound(params.Weight), - params.OriginZip, - params.OriginDutyLocationZip, - destinationZip, - distanceMilesFromOriginPickupZip, - distanceMilesFromOriginDutyLocationZip, - time.Time(time.Now()), - 0, // We don't want any SIT charges - ) - if err != nil { - return handlers.ResponseForError(appCtx.Logger(), err), err - } - - cost := rateengine.GetWinningCostMove(costDetails) - - gcc := cost.GCC - incentivePercentage := cost.GCC.MultiplyFloat64(0.95) - - ppmObligation := internalmessages.PPMIncentive{ - Gcc: models.Int64Pointer(gcc.Int64()), - IncentivePercentage: models.Int64Pointer(incentivePercentage.Int64()), - } - return ppmop.NewShowPPMIncentiveOK().WithPayload(&ppmObligation), nil - }) -} diff --git a/swagger-def/internal.yaml b/swagger-def/internal.yaml index 63300848358..f0217ff1045 100644 --- a/swagger-def/internal.yaml +++ b/swagger-def/internal.yaml @@ -3647,55 +3647,6 @@ paths: description: user is not authorized '500': description: internal server error - /personally_procured_moves/incentive: - get: - summary: Return a PPM incentive value - description: Calculates incentive for a PPM move (excluding SIT) - operationId: showPPMIncentive - tags: - - ppm - parameters: - - in: query - name: original_move_date - type: string - format: date - required: true - - in: query - name: origin_zip - type: string - format: zip - pattern: '^(\d{5}([\-]\d{4})?)$' - required: true - - in: query - name: origin_duty_location_zip - type: string - format: zip - pattern: '^(\d{5}([\-]\d{4})?)$' - required: true - - in: query - name: orders_id - type: string - format: uuid - required: true - - in: query - name: weight - type: integer - required: true - responses: - '200': - description: Made calculation of PPM incentive - schema: - $ref: '#/definitions/PPMIncentive' - '400': - description: invalid request - '401': - description: request requires user authentication - '403': - description: user is not authorized - '409': - description: distance is less than 50 miles (no short haul moves) - '500': - description: internal server error /documents: post: summary: Create a new document diff --git a/swagger/internal.yaml b/swagger/internal.yaml index 496ed4142f4..b4564213141 100644 --- a/swagger/internal.yaml +++ b/swagger/internal.yaml @@ -4890,55 +4890,6 @@ paths: description: user is not authorized '500': description: internal server error - /personally_procured_moves/incentive: - get: - summary: Return a PPM incentive value - description: Calculates incentive for a PPM move (excluding SIT) - operationId: showPPMIncentive - tags: - - ppm - parameters: - - in: query - name: original_move_date - type: string - format: date - required: true - - in: query - name: origin_zip - type: string - format: zip - pattern: ^(\d{5}([\-]\d{4})?)$ - required: true - - in: query - name: origin_duty_location_zip - type: string - format: zip - pattern: ^(\d{5}([\-]\d{4})?)$ - required: true - - in: query - name: orders_id - type: string - format: uuid - required: true - - in: query - name: weight - type: integer - required: true - responses: - '200': - description: Made calculation of PPM incentive - schema: - $ref: '#/definitions/PPMIncentive' - '400': - description: invalid request - '401': - description: request requires user authentication - '403': - description: user is not authorized - '409': - description: distance is less than 50 miles (no short haul moves) - '500': - description: internal server error /documents: post: summary: Create a new document