diff --git a/cmd/generate-payment-request-edi/main.go b/cmd/generate-payment-request-edi/main.go index b91144340b7..55df51153f3 100644 --- a/cmd/generate-payment-request-edi/main.go +++ b/cmd/generate-payment-request-edi/main.go @@ -137,4 +137,8 @@ func main() { } fmt.Print(edi858String) + err = models.CreatePaymentRequestEdiFile(appCtx.DB(), "858."+paymentRequest.PaymentRequestNumber, edi858String, paymentRequestNumber) + if err != nil { + logger.Fatal(err.Error()) + } } diff --git a/migrations/app/migrations_manifest.txt b/migrations/app/migrations_manifest.txt index 315fc57392d..abc292d3bf0 100644 --- a/migrations/app/migrations_manifest.txt +++ b/migrations/app/migrations_manifest.txt @@ -1008,4 +1008,5 @@ 20241002151527_add_transportation_offices_AK_HI.up.sql 20241002164836_add_re_country_table_and_refactor.up.sql 20241002170242_add_ub_shipment_type.up.sql +20241007162933_addPaymentRequestEdiFiles.up.sql 20241008212243_populate_market_code_on_shipments_table.up.sql diff --git a/migrations/app/schema/20241007162933_addPaymentRequestEdiFiles.up.sql b/migrations/app/schema/20241007162933_addPaymentRequestEdiFiles.up.sql new file mode 100644 index 00000000000..e7bc2cbb582 --- /dev/null +++ b/migrations/app/schema/20241007162933_addPaymentRequestEdiFiles.up.sql @@ -0,0 +1,13 @@ +CREATE TABLE + IF NOT EXISTS payment_request_edi_files ( + id UUID PRIMARY KEY, + payment_request_number TEXT NOT NULL, + edi_string TEXT NOT NULL, + file_name TEXT NOT NULL, + created_at TIMESTAMP + WITH + TIME ZONE DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP + WITH + TIME ZONE DEFAULT CURRENT_TIMESTAMP + ); \ No newline at end of file diff --git a/pkg/gen/adminapi/adminoperations/mymove_api.go b/pkg/gen/adminapi/adminoperations/mymove_api.go index 8ccd45a15e0..50e2bfaca71 100644 --- a/pkg/gen/adminapi/adminoperations/mymove_api.go +++ b/pkg/gen/adminapi/adminoperations/mymove_api.go @@ -26,6 +26,8 @@ import ( "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/notifications" "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/office_users" "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/organizations" + "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/payment_request_syncada_file" + "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/payment_request_syncada_files" "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/requested_office_users" "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/transportation_offices" "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/uploads" @@ -122,6 +124,9 @@ func NewMymoveAPI(spec *loads.Document) *MymoveAPI { OrganizationsIndexOrganizationsHandler: organizations.IndexOrganizationsHandlerFunc(func(params organizations.IndexOrganizationsParams) middleware.Responder { return middleware.NotImplemented("operation organizations.IndexOrganizations has not yet been implemented") }), + PaymentRequestSyncadaFilesIndexPaymentRequestSyncadaFilesHandler: payment_request_syncada_files.IndexPaymentRequestSyncadaFilesHandlerFunc(func(params payment_request_syncada_files.IndexPaymentRequestSyncadaFilesParams) middleware.Responder { + return middleware.NotImplemented("operation payment_request_syncada_files.IndexPaymentRequestSyncadaFiles has not yet been implemented") + }), RequestedOfficeUsersIndexRequestedOfficeUsersHandler: requested_office_users.IndexRequestedOfficeUsersHandlerFunc(func(params requested_office_users.IndexRequestedOfficeUsersParams) middleware.Responder { return middleware.NotImplemented("operation requested_office_users.IndexRequestedOfficeUsers has not yet been implemented") }), @@ -131,6 +136,9 @@ func NewMymoveAPI(spec *loads.Document) *MymoveAPI { WebhookSubscriptionsIndexWebhookSubscriptionsHandler: webhook_subscriptions.IndexWebhookSubscriptionsHandlerFunc(func(params webhook_subscriptions.IndexWebhookSubscriptionsParams) middleware.Responder { return middleware.NotImplemented("operation webhook_subscriptions.IndexWebhookSubscriptions has not yet been implemented") }), + PaymentRequestSyncadaFilePaymentRequestSyncadaFileHandler: payment_request_syncada_file.PaymentRequestSyncadaFileHandlerFunc(func(params payment_request_syncada_file.PaymentRequestSyncadaFileParams) middleware.Responder { + return middleware.NotImplemented("operation payment_request_syncada_file.PaymentRequestSyncadaFile has not yet been implemented") + }), ClientCertificatesRemoveClientCertificateHandler: client_certificates.RemoveClientCertificateHandlerFunc(func(params client_certificates.RemoveClientCertificateParams) middleware.Responder { return middleware.NotImplemented("operation client_certificates.RemoveClientCertificate has not yet been implemented") }), @@ -239,12 +247,16 @@ type MymoveAPI struct { TransportationOfficesIndexOfficesHandler transportation_offices.IndexOfficesHandler // OrganizationsIndexOrganizationsHandler sets the operation handler for the index organizations operation OrganizationsIndexOrganizationsHandler organizations.IndexOrganizationsHandler + // PaymentRequestSyncadaFilesIndexPaymentRequestSyncadaFilesHandler sets the operation handler for the index payment request syncada files operation + PaymentRequestSyncadaFilesIndexPaymentRequestSyncadaFilesHandler payment_request_syncada_files.IndexPaymentRequestSyncadaFilesHandler // RequestedOfficeUsersIndexRequestedOfficeUsersHandler sets the operation handler for the index requested office users operation RequestedOfficeUsersIndexRequestedOfficeUsersHandler requested_office_users.IndexRequestedOfficeUsersHandler // UsersIndexUsersHandler sets the operation handler for the index users operation UsersIndexUsersHandler users.IndexUsersHandler // WebhookSubscriptionsIndexWebhookSubscriptionsHandler sets the operation handler for the index webhook subscriptions operation WebhookSubscriptionsIndexWebhookSubscriptionsHandler webhook_subscriptions.IndexWebhookSubscriptionsHandler + // PaymentRequestSyncadaFilePaymentRequestSyncadaFileHandler sets the operation handler for the payment request syncada file operation + PaymentRequestSyncadaFilePaymentRequestSyncadaFileHandler payment_request_syncada_file.PaymentRequestSyncadaFileHandler // ClientCertificatesRemoveClientCertificateHandler sets the operation handler for the remove client certificate operation ClientCertificatesRemoveClientCertificateHandler client_certificates.RemoveClientCertificateHandler // AdminUsersUpdateAdminUserHandler sets the operation handler for the update admin user operation @@ -404,6 +416,9 @@ func (o *MymoveAPI) Validate() error { if o.OrganizationsIndexOrganizationsHandler == nil { unregistered = append(unregistered, "organizations.IndexOrganizationsHandler") } + if o.PaymentRequestSyncadaFilesIndexPaymentRequestSyncadaFilesHandler == nil { + unregistered = append(unregistered, "payment_request_syncada_files.IndexPaymentRequestSyncadaFilesHandler") + } if o.RequestedOfficeUsersIndexRequestedOfficeUsersHandler == nil { unregistered = append(unregistered, "requested_office_users.IndexRequestedOfficeUsersHandler") } @@ -413,6 +428,9 @@ func (o *MymoveAPI) Validate() error { if o.WebhookSubscriptionsIndexWebhookSubscriptionsHandler == nil { unregistered = append(unregistered, "webhook_subscriptions.IndexWebhookSubscriptionsHandler") } + if o.PaymentRequestSyncadaFilePaymentRequestSyncadaFileHandler == nil { + unregistered = append(unregistered, "payment_request_syncada_file.PaymentRequestSyncadaFileHandler") + } if o.ClientCertificatesRemoveClientCertificateHandler == nil { unregistered = append(unregistered, "client_certificates.RemoveClientCertificateHandler") } @@ -616,6 +634,10 @@ func (o *MymoveAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } + o.handlers["GET"]["/payment-request-syncada-files"] = payment_request_syncada_files.NewIndexPaymentRequestSyncadaFiles(o.context, o.PaymentRequestSyncadaFilesIndexPaymentRequestSyncadaFilesHandler) + if o.handlers["GET"] == nil { + o.handlers["GET"] = make(map[string]http.Handler) + } o.handlers["GET"]["/requested-office-users"] = requested_office_users.NewIndexRequestedOfficeUsers(o.context, o.RequestedOfficeUsersIndexRequestedOfficeUsersHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) @@ -625,6 +647,10 @@ func (o *MymoveAPI) initHandlerCache() { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/webhook-subscriptions"] = webhook_subscriptions.NewIndexWebhookSubscriptions(o.context, o.WebhookSubscriptionsIndexWebhookSubscriptionsHandler) + if o.handlers["GET"] == nil { + o.handlers["GET"] = make(map[string]http.Handler) + } + o.handlers["GET"]["/payment-request-syncada-files/{paymentRequestSyncadaFileId}"] = payment_request_syncada_file.NewPaymentRequestSyncadaFile(o.context, o.PaymentRequestSyncadaFilePaymentRequestSyncadaFileHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } diff --git a/pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file.go b/pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file.go new file mode 100644 index 00000000000..0fd69641d61 --- /dev/null +++ b/pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file.go @@ -0,0 +1,58 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payment_request_syncada_file + +// 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" +) + +// PaymentRequestSyncadaFileHandlerFunc turns a function with the right signature into a payment request syncada file handler +type PaymentRequestSyncadaFileHandlerFunc func(PaymentRequestSyncadaFileParams) middleware.Responder + +// Handle executing the request and returning a response +func (fn PaymentRequestSyncadaFileHandlerFunc) Handle(params PaymentRequestSyncadaFileParams) middleware.Responder { + return fn(params) +} + +// PaymentRequestSyncadaFileHandler interface for that can handle valid payment request syncada file params +type PaymentRequestSyncadaFileHandler interface { + Handle(PaymentRequestSyncadaFileParams) middleware.Responder +} + +// NewPaymentRequestSyncadaFile creates a new http.Handler for the payment request syncada file operation +func NewPaymentRequestSyncadaFile(ctx *middleware.Context, handler PaymentRequestSyncadaFileHandler) *PaymentRequestSyncadaFile { + return &PaymentRequestSyncadaFile{Context: ctx, Handler: handler} +} + +/* + PaymentRequestSyncadaFile swagger:route GET /payment-request-syncada-files/{paymentRequestSyncadaFileId} Payment Request Syncada File paymentRequestSyncadaFile + +# Payment Request EDI File + +Returns a Payment Request EDI858 file +*/ +type PaymentRequestSyncadaFile struct { + Context *middleware.Context + Handler PaymentRequestSyncadaFileHandler +} + +func (o *PaymentRequestSyncadaFile) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewPaymentRequestSyncadaFileParams() + 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/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file_parameters.go b/pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file_parameters.go new file mode 100644 index 00000000000..4fddbb8299b --- /dev/null +++ b/pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payment_request_syncada_file + +// 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" +) + +// NewPaymentRequestSyncadaFileParams creates a new PaymentRequestSyncadaFileParams object +// +// There are no default values defined in the spec. +func NewPaymentRequestSyncadaFileParams() PaymentRequestSyncadaFileParams { + + return PaymentRequestSyncadaFileParams{} +} + +// PaymentRequestSyncadaFileParams contains all the bound params for the payment request syncada file operation +// typically these are obtained from a http.Request +// +// swagger:parameters paymentRequestSyncadaFile +type PaymentRequestSyncadaFileParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /* + In: query + */ + Filter *string + /* + In: query + */ + Order *bool + /* + In: query + */ + Page *int64 + /* + Required: true + In: path + */ + PaymentRequestSyncadaFileID strfmt.UUID + /* + In: query + */ + PerPage *int64 + /* + In: query + */ + Sort *string +} + +// 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 NewPaymentRequestSyncadaFileParams() beforehand. +func (o *PaymentRequestSyncadaFileParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + qs := runtime.Values(r.URL.Query()) + + qFilter, qhkFilter, _ := qs.GetOK("filter") + if err := o.bindFilter(qFilter, qhkFilter, route.Formats); err != nil { + res = append(res, err) + } + + qOrder, qhkOrder, _ := qs.GetOK("order") + if err := o.bindOrder(qOrder, qhkOrder, route.Formats); err != nil { + res = append(res, err) + } + + qPage, qhkPage, _ := qs.GetOK("page") + if err := o.bindPage(qPage, qhkPage, route.Formats); err != nil { + res = append(res, err) + } + + rPaymentRequestSyncadaFileID, rhkPaymentRequestSyncadaFileID, _ := route.Params.GetOK("paymentRequestSyncadaFileId") + if err := o.bindPaymentRequestSyncadaFileID(rPaymentRequestSyncadaFileID, rhkPaymentRequestSyncadaFileID, route.Formats); err != nil { + res = append(res, err) + } + + qPerPage, qhkPerPage, _ := qs.GetOK("perPage") + if err := o.bindPerPage(qPerPage, qhkPerPage, route.Formats); err != nil { + res = append(res, err) + } + + qSort, qhkSort, _ := qs.GetOK("sort") + if err := o.bindSort(qSort, qhkSort, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindFilter binds and validates parameter Filter from query. +func (o *PaymentRequestSyncadaFileParams) bindFilter(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + o.Filter = &raw + + return nil +} + +// bindOrder binds and validates parameter Order from query. +func (o *PaymentRequestSyncadaFileParams) bindOrder(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + + value, err := swag.ConvertBool(raw) + if err != nil { + return errors.InvalidType("order", "query", "bool", raw) + } + o.Order = &value + + return nil +} + +// bindPage binds and validates parameter Page from query. +func (o *PaymentRequestSyncadaFileParams) bindPage(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + + value, err := swag.ConvertInt64(raw) + if err != nil { + return errors.InvalidType("page", "query", "int64", raw) + } + o.Page = &value + + return nil +} + +// bindPaymentRequestSyncadaFileID binds and validates parameter PaymentRequestSyncadaFileID from path. +func (o *PaymentRequestSyncadaFileParams) bindPaymentRequestSyncadaFileID(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + + // Format: uuid + value, err := formats.Parse("uuid", raw) + if err != nil { + return errors.InvalidType("paymentRequestSyncadaFileId", "path", "strfmt.UUID", raw) + } + o.PaymentRequestSyncadaFileID = *(value.(*strfmt.UUID)) + + if err := o.validatePaymentRequestSyncadaFileID(formats); err != nil { + return err + } + + return nil +} + +// validatePaymentRequestSyncadaFileID carries on validations for parameter PaymentRequestSyncadaFileID +func (o *PaymentRequestSyncadaFileParams) validatePaymentRequestSyncadaFileID(formats strfmt.Registry) error { + + if err := validate.FormatOf("paymentRequestSyncadaFileId", "path", "uuid", o.PaymentRequestSyncadaFileID.String(), formats); err != nil { + return err + } + return nil +} + +// bindPerPage binds and validates parameter PerPage from query. +func (o *PaymentRequestSyncadaFileParams) bindPerPage(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + + value, err := swag.ConvertInt64(raw) + if err != nil { + return errors.InvalidType("perPage", "query", "int64", raw) + } + o.PerPage = &value + + return nil +} + +// bindSort binds and validates parameter Sort from query. +func (o *PaymentRequestSyncadaFileParams) bindSort(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + o.Sort = &raw + + return nil +} diff --git a/pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file_responses.go b/pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file_responses.go new file mode 100644 index 00000000000..768d9302f7c --- /dev/null +++ b/pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payment_request_syncada_file + +// 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/adminmessages" +) + +// PaymentRequestSyncadaFileOKCode is the HTTP code returned for type PaymentRequestSyncadaFileOK +const PaymentRequestSyncadaFileOKCode int = 200 + +/* +PaymentRequestSyncadaFileOK success + +swagger:response paymentRequestSyncadaFileOK +*/ +type PaymentRequestSyncadaFileOK struct { + /*Used for pagination + + */ + ContentRange string `json:"Content-Range"` + + /* + In: Body + */ + Payload *adminmessages.PaymentRequestSyncadaFile `json:"body,omitempty"` +} + +// NewPaymentRequestSyncadaFileOK creates PaymentRequestSyncadaFileOK with default headers values +func NewPaymentRequestSyncadaFileOK() *PaymentRequestSyncadaFileOK { + + return &PaymentRequestSyncadaFileOK{} +} + +// WithContentRange adds the contentRange to the payment request syncada file o k response +func (o *PaymentRequestSyncadaFileOK) WithContentRange(contentRange string) *PaymentRequestSyncadaFileOK { + o.ContentRange = contentRange + return o +} + +// SetContentRange sets the contentRange to the payment request syncada file o k response +func (o *PaymentRequestSyncadaFileOK) SetContentRange(contentRange string) { + o.ContentRange = contentRange +} + +// WithPayload adds the payload to the payment request syncada file o k response +func (o *PaymentRequestSyncadaFileOK) WithPayload(payload *adminmessages.PaymentRequestSyncadaFile) *PaymentRequestSyncadaFileOK { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the payment request syncada file o k response +func (o *PaymentRequestSyncadaFileOK) SetPayload(payload *adminmessages.PaymentRequestSyncadaFile) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *PaymentRequestSyncadaFileOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + // response header Content-Range + + contentRange := o.ContentRange + if contentRange != "" { + rw.Header().Set("Content-Range", contentRange) + } + + 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 + } + } +} + +// PaymentRequestSyncadaFileBadRequestCode is the HTTP code returned for type PaymentRequestSyncadaFileBadRequest +const PaymentRequestSyncadaFileBadRequestCode int = 400 + +/* +PaymentRequestSyncadaFileBadRequest invalid request + +swagger:response paymentRequestSyncadaFileBadRequest +*/ +type PaymentRequestSyncadaFileBadRequest struct { +} + +// NewPaymentRequestSyncadaFileBadRequest creates PaymentRequestSyncadaFileBadRequest with default headers values +func NewPaymentRequestSyncadaFileBadRequest() *PaymentRequestSyncadaFileBadRequest { + + return &PaymentRequestSyncadaFileBadRequest{} +} + +// WriteResponse to the client +func (o *PaymentRequestSyncadaFileBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(400) +} + +// PaymentRequestSyncadaFileUnauthorizedCode is the HTTP code returned for type PaymentRequestSyncadaFileUnauthorized +const PaymentRequestSyncadaFileUnauthorizedCode int = 401 + +/* +PaymentRequestSyncadaFileUnauthorized request requires user authentication + +swagger:response paymentRequestSyncadaFileUnauthorized +*/ +type PaymentRequestSyncadaFileUnauthorized struct { +} + +// NewPaymentRequestSyncadaFileUnauthorized creates PaymentRequestSyncadaFileUnauthorized with default headers values +func NewPaymentRequestSyncadaFileUnauthorized() *PaymentRequestSyncadaFileUnauthorized { + + return &PaymentRequestSyncadaFileUnauthorized{} +} + +// WriteResponse to the client +func (o *PaymentRequestSyncadaFileUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(401) +} + +// PaymentRequestSyncadaFileNotFoundCode is the HTTP code returned for type PaymentRequestSyncadaFileNotFound +const PaymentRequestSyncadaFileNotFoundCode int = 404 + +/* +PaymentRequestSyncadaFileNotFound Payment Request EDI Files not found + +swagger:response paymentRequestSyncadaFileNotFound +*/ +type PaymentRequestSyncadaFileNotFound struct { +} + +// NewPaymentRequestSyncadaFileNotFound creates PaymentRequestSyncadaFileNotFound with default headers values +func NewPaymentRequestSyncadaFileNotFound() *PaymentRequestSyncadaFileNotFound { + + return &PaymentRequestSyncadaFileNotFound{} +} + +// WriteResponse to the client +func (o *PaymentRequestSyncadaFileNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(404) +} + +// PaymentRequestSyncadaFileInternalServerErrorCode is the HTTP code returned for type PaymentRequestSyncadaFileInternalServerError +const PaymentRequestSyncadaFileInternalServerErrorCode int = 500 + +/* +PaymentRequestSyncadaFileInternalServerError server error + +swagger:response paymentRequestSyncadaFileInternalServerError +*/ +type PaymentRequestSyncadaFileInternalServerError struct { +} + +// NewPaymentRequestSyncadaFileInternalServerError creates PaymentRequestSyncadaFileInternalServerError with default headers values +func NewPaymentRequestSyncadaFileInternalServerError() *PaymentRequestSyncadaFileInternalServerError { + + return &PaymentRequestSyncadaFileInternalServerError{} +} + +// WriteResponse to the client +func (o *PaymentRequestSyncadaFileInternalServerError) 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/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file_urlbuilder.go b/pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file_urlbuilder.go new file mode 100644 index 00000000000..ac95f4dcaf0 --- /dev/null +++ b/pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file_urlbuilder.go @@ -0,0 +1,152 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payment_request_syncada_file + +// 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" + "strings" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PaymentRequestSyncadaFileURL generates an URL for the payment request syncada file operation +type PaymentRequestSyncadaFileURL struct { + PaymentRequestSyncadaFileID strfmt.UUID + + Filter *string + Order *bool + Page *int64 + PerPage *int64 + Sort *string + + _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 *PaymentRequestSyncadaFileURL) WithBasePath(bp string) *PaymentRequestSyncadaFileURL { + 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 *PaymentRequestSyncadaFileURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *PaymentRequestSyncadaFileURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/payment-request-syncada-files/{paymentRequestSyncadaFileId}" + + paymentRequestSyncadaFileID := o.PaymentRequestSyncadaFileID.String() + if paymentRequestSyncadaFileID != "" { + _path = strings.Replace(_path, "{paymentRequestSyncadaFileId}", paymentRequestSyncadaFileID, -1) + } else { + return nil, errors.New("paymentRequestSyncadaFileId is required on PaymentRequestSyncadaFileURL") + } + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/admin/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + qs := make(url.Values) + + var filterQ string + if o.Filter != nil { + filterQ = *o.Filter + } + if filterQ != "" { + qs.Set("filter", filterQ) + } + + var orderQ string + if o.Order != nil { + orderQ = swag.FormatBool(*o.Order) + } + if orderQ != "" { + qs.Set("order", orderQ) + } + + var pageQ string + if o.Page != nil { + pageQ = swag.FormatInt64(*o.Page) + } + if pageQ != "" { + qs.Set("page", pageQ) + } + + var perPageQ string + if o.PerPage != nil { + perPageQ = swag.FormatInt64(*o.PerPage) + } + if perPageQ != "" { + qs.Set("perPage", perPageQ) + } + + var sortQ string + if o.Sort != nil { + sortQ = *o.Sort + } + if sortQ != "" { + qs.Set("sort", sortQ) + } + + _result.RawQuery = qs.Encode() + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *PaymentRequestSyncadaFileURL) 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 *PaymentRequestSyncadaFileURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *PaymentRequestSyncadaFileURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on PaymentRequestSyncadaFileURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on PaymentRequestSyncadaFileURL") + } + + 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 *PaymentRequestSyncadaFileURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files.go b/pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files.go new file mode 100644 index 00000000000..6f1a093c000 --- /dev/null +++ b/pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files.go @@ -0,0 +1,58 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payment_request_syncada_files + +// 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" +) + +// IndexPaymentRequestSyncadaFilesHandlerFunc turns a function with the right signature into a index payment request syncada files handler +type IndexPaymentRequestSyncadaFilesHandlerFunc func(IndexPaymentRequestSyncadaFilesParams) middleware.Responder + +// Handle executing the request and returning a response +func (fn IndexPaymentRequestSyncadaFilesHandlerFunc) Handle(params IndexPaymentRequestSyncadaFilesParams) middleware.Responder { + return fn(params) +} + +// IndexPaymentRequestSyncadaFilesHandler interface for that can handle valid index payment request syncada files params +type IndexPaymentRequestSyncadaFilesHandler interface { + Handle(IndexPaymentRequestSyncadaFilesParams) middleware.Responder +} + +// NewIndexPaymentRequestSyncadaFiles creates a new http.Handler for the index payment request syncada files operation +func NewIndexPaymentRequestSyncadaFiles(ctx *middleware.Context, handler IndexPaymentRequestSyncadaFilesHandler) *IndexPaymentRequestSyncadaFiles { + return &IndexPaymentRequestSyncadaFiles{Context: ctx, Handler: handler} +} + +/* + IndexPaymentRequestSyncadaFiles swagger:route GET /payment-request-syncada-files Payment Request Syncada Files indexPaymentRequestSyncadaFiles + +# List Payment Request EDI Files + +Returns a list of Payment Request EDI files +*/ +type IndexPaymentRequestSyncadaFiles struct { + Context *middleware.Context + Handler IndexPaymentRequestSyncadaFilesHandler +} + +func (o *IndexPaymentRequestSyncadaFiles) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewIndexPaymentRequestSyncadaFilesParams() + 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/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files_parameters.go b/pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files_parameters.go new file mode 100644 index 00000000000..9863485c460 --- /dev/null +++ b/pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files_parameters.go @@ -0,0 +1,201 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payment_request_syncada_files + +// 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" +) + +// NewIndexPaymentRequestSyncadaFilesParams creates a new IndexPaymentRequestSyncadaFilesParams object +// +// There are no default values defined in the spec. +func NewIndexPaymentRequestSyncadaFilesParams() IndexPaymentRequestSyncadaFilesParams { + + return IndexPaymentRequestSyncadaFilesParams{} +} + +// IndexPaymentRequestSyncadaFilesParams contains all the bound params for the index payment request syncada files operation +// typically these are obtained from a http.Request +// +// swagger:parameters indexPaymentRequestSyncadaFiles +type IndexPaymentRequestSyncadaFilesParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /* + In: query + */ + Filter *string + /* + In: query + */ + Order *bool + /* + In: query + */ + Page *int64 + /* + In: query + */ + PerPage *int64 + /* + In: query + */ + Sort *string +} + +// 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 NewIndexPaymentRequestSyncadaFilesParams() beforehand. +func (o *IndexPaymentRequestSyncadaFilesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + qs := runtime.Values(r.URL.Query()) + + qFilter, qhkFilter, _ := qs.GetOK("filter") + if err := o.bindFilter(qFilter, qhkFilter, route.Formats); err != nil { + res = append(res, err) + } + + qOrder, qhkOrder, _ := qs.GetOK("order") + if err := o.bindOrder(qOrder, qhkOrder, route.Formats); err != nil { + res = append(res, err) + } + + qPage, qhkPage, _ := qs.GetOK("page") + if err := o.bindPage(qPage, qhkPage, route.Formats); err != nil { + res = append(res, err) + } + + qPerPage, qhkPerPage, _ := qs.GetOK("perPage") + if err := o.bindPerPage(qPerPage, qhkPerPage, route.Formats); err != nil { + res = append(res, err) + } + + qSort, qhkSort, _ := qs.GetOK("sort") + if err := o.bindSort(qSort, qhkSort, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindFilter binds and validates parameter Filter from query. +func (o *IndexPaymentRequestSyncadaFilesParams) bindFilter(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + o.Filter = &raw + + return nil +} + +// bindOrder binds and validates parameter Order from query. +func (o *IndexPaymentRequestSyncadaFilesParams) bindOrder(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + + value, err := swag.ConvertBool(raw) + if err != nil { + return errors.InvalidType("order", "query", "bool", raw) + } + o.Order = &value + + return nil +} + +// bindPage binds and validates parameter Page from query. +func (o *IndexPaymentRequestSyncadaFilesParams) bindPage(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + + value, err := swag.ConvertInt64(raw) + if err != nil { + return errors.InvalidType("page", "query", "int64", raw) + } + o.Page = &value + + return nil +} + +// bindPerPage binds and validates parameter PerPage from query. +func (o *IndexPaymentRequestSyncadaFilesParams) bindPerPage(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + + value, err := swag.ConvertInt64(raw) + if err != nil { + return errors.InvalidType("perPage", "query", "int64", raw) + } + o.PerPage = &value + + return nil +} + +// bindSort binds and validates parameter Sort from query. +func (o *IndexPaymentRequestSyncadaFilesParams) bindSort(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + o.Sort = &raw + + return nil +} diff --git a/pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files_responses.go b/pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files_responses.go new file mode 100644 index 00000000000..a5b535302c4 --- /dev/null +++ b/pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files_responses.go @@ -0,0 +1,184 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payment_request_syncada_files + +// 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/adminmessages" +) + +// IndexPaymentRequestSyncadaFilesOKCode is the HTTP code returned for type IndexPaymentRequestSyncadaFilesOK +const IndexPaymentRequestSyncadaFilesOKCode int = 200 + +/* +IndexPaymentRequestSyncadaFilesOK success + +swagger:response indexPaymentRequestSyncadaFilesOK +*/ +type IndexPaymentRequestSyncadaFilesOK struct { + /*Used for pagination + + */ + ContentRange string `json:"Content-Range"` + + /* + In: Body + */ + Payload adminmessages.PaymentRequestSyncadaFiles `json:"body,omitempty"` +} + +// NewIndexPaymentRequestSyncadaFilesOK creates IndexPaymentRequestSyncadaFilesOK with default headers values +func NewIndexPaymentRequestSyncadaFilesOK() *IndexPaymentRequestSyncadaFilesOK { + + return &IndexPaymentRequestSyncadaFilesOK{} +} + +// WithContentRange adds the contentRange to the index payment request syncada files o k response +func (o *IndexPaymentRequestSyncadaFilesOK) WithContentRange(contentRange string) *IndexPaymentRequestSyncadaFilesOK { + o.ContentRange = contentRange + return o +} + +// SetContentRange sets the contentRange to the index payment request syncada files o k response +func (o *IndexPaymentRequestSyncadaFilesOK) SetContentRange(contentRange string) { + o.ContentRange = contentRange +} + +// WithPayload adds the payload to the index payment request syncada files o k response +func (o *IndexPaymentRequestSyncadaFilesOK) WithPayload(payload adminmessages.PaymentRequestSyncadaFiles) *IndexPaymentRequestSyncadaFilesOK { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the index payment request syncada files o k response +func (o *IndexPaymentRequestSyncadaFilesOK) SetPayload(payload adminmessages.PaymentRequestSyncadaFiles) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *IndexPaymentRequestSyncadaFilesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + // response header Content-Range + + contentRange := o.ContentRange + if contentRange != "" { + rw.Header().Set("Content-Range", contentRange) + } + + rw.WriteHeader(200) + payload := o.Payload + if payload == nil { + // return empty array + payload = adminmessages.PaymentRequestSyncadaFiles{} + } + + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } +} + +// IndexPaymentRequestSyncadaFilesBadRequestCode is the HTTP code returned for type IndexPaymentRequestSyncadaFilesBadRequest +const IndexPaymentRequestSyncadaFilesBadRequestCode int = 400 + +/* +IndexPaymentRequestSyncadaFilesBadRequest invalid request + +swagger:response indexPaymentRequestSyncadaFilesBadRequest +*/ +type IndexPaymentRequestSyncadaFilesBadRequest struct { +} + +// NewIndexPaymentRequestSyncadaFilesBadRequest creates IndexPaymentRequestSyncadaFilesBadRequest with default headers values +func NewIndexPaymentRequestSyncadaFilesBadRequest() *IndexPaymentRequestSyncadaFilesBadRequest { + + return &IndexPaymentRequestSyncadaFilesBadRequest{} +} + +// WriteResponse to the client +func (o *IndexPaymentRequestSyncadaFilesBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(400) +} + +// IndexPaymentRequestSyncadaFilesUnauthorizedCode is the HTTP code returned for type IndexPaymentRequestSyncadaFilesUnauthorized +const IndexPaymentRequestSyncadaFilesUnauthorizedCode int = 401 + +/* +IndexPaymentRequestSyncadaFilesUnauthorized request requires user authentication + +swagger:response indexPaymentRequestSyncadaFilesUnauthorized +*/ +type IndexPaymentRequestSyncadaFilesUnauthorized struct { +} + +// NewIndexPaymentRequestSyncadaFilesUnauthorized creates IndexPaymentRequestSyncadaFilesUnauthorized with default headers values +func NewIndexPaymentRequestSyncadaFilesUnauthorized() *IndexPaymentRequestSyncadaFilesUnauthorized { + + return &IndexPaymentRequestSyncadaFilesUnauthorized{} +} + +// WriteResponse to the client +func (o *IndexPaymentRequestSyncadaFilesUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(401) +} + +// IndexPaymentRequestSyncadaFilesNotFoundCode is the HTTP code returned for type IndexPaymentRequestSyncadaFilesNotFound +const IndexPaymentRequestSyncadaFilesNotFoundCode int = 404 + +/* +IndexPaymentRequestSyncadaFilesNotFound Payment Request EDI Files not found + +swagger:response indexPaymentRequestSyncadaFilesNotFound +*/ +type IndexPaymentRequestSyncadaFilesNotFound struct { +} + +// NewIndexPaymentRequestSyncadaFilesNotFound creates IndexPaymentRequestSyncadaFilesNotFound with default headers values +func NewIndexPaymentRequestSyncadaFilesNotFound() *IndexPaymentRequestSyncadaFilesNotFound { + + return &IndexPaymentRequestSyncadaFilesNotFound{} +} + +// WriteResponse to the client +func (o *IndexPaymentRequestSyncadaFilesNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(404) +} + +// IndexPaymentRequestSyncadaFilesInternalServerErrorCode is the HTTP code returned for type IndexPaymentRequestSyncadaFilesInternalServerError +const IndexPaymentRequestSyncadaFilesInternalServerErrorCode int = 500 + +/* +IndexPaymentRequestSyncadaFilesInternalServerError server error + +swagger:response indexPaymentRequestSyncadaFilesInternalServerError +*/ +type IndexPaymentRequestSyncadaFilesInternalServerError struct { +} + +// NewIndexPaymentRequestSyncadaFilesInternalServerError creates IndexPaymentRequestSyncadaFilesInternalServerError with default headers values +func NewIndexPaymentRequestSyncadaFilesInternalServerError() *IndexPaymentRequestSyncadaFilesInternalServerError { + + return &IndexPaymentRequestSyncadaFilesInternalServerError{} +} + +// WriteResponse to the client +func (o *IndexPaymentRequestSyncadaFilesInternalServerError) 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/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files_urlbuilder.go b/pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files_urlbuilder.go new file mode 100644 index 00000000000..a9174bc35af --- /dev/null +++ b/pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files_urlbuilder.go @@ -0,0 +1,141 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package payment_request_syncada_files + +// 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/swag" +) + +// IndexPaymentRequestSyncadaFilesURL generates an URL for the index payment request syncada files operation +type IndexPaymentRequestSyncadaFilesURL struct { + Filter *string + Order *bool + Page *int64 + PerPage *int64 + Sort *string + + _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 *IndexPaymentRequestSyncadaFilesURL) WithBasePath(bp string) *IndexPaymentRequestSyncadaFilesURL { + 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 *IndexPaymentRequestSyncadaFilesURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *IndexPaymentRequestSyncadaFilesURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/payment-request-syncada-files" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/admin/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + qs := make(url.Values) + + var filterQ string + if o.Filter != nil { + filterQ = *o.Filter + } + if filterQ != "" { + qs.Set("filter", filterQ) + } + + var orderQ string + if o.Order != nil { + orderQ = swag.FormatBool(*o.Order) + } + if orderQ != "" { + qs.Set("order", orderQ) + } + + var pageQ string + if o.Page != nil { + pageQ = swag.FormatInt64(*o.Page) + } + if pageQ != "" { + qs.Set("page", pageQ) + } + + var perPageQ string + if o.PerPage != nil { + perPageQ = swag.FormatInt64(*o.PerPage) + } + if perPageQ != "" { + qs.Set("perPage", perPageQ) + } + + var sortQ string + if o.Sort != nil { + sortQ = *o.Sort + } + if sortQ != "" { + qs.Set("sort", sortQ) + } + + _result.RawQuery = qs.Encode() + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *IndexPaymentRequestSyncadaFilesURL) 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 *IndexPaymentRequestSyncadaFilesURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *IndexPaymentRequestSyncadaFilesURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on IndexPaymentRequestSyncadaFilesURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on IndexPaymentRequestSyncadaFilesURL") + } + + 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 *IndexPaymentRequestSyncadaFilesURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/pkg/gen/adminapi/configure_mymove.go b/pkg/gen/adminapi/configure_mymove.go index ccb4cd613ca..5fe0a5e00f2 100644 --- a/pkg/gen/adminapi/configure_mymove.go +++ b/pkg/gen/adminapi/configure_mymove.go @@ -18,6 +18,8 @@ import ( "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/notifications" "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/office_users" "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/organizations" + "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/payment_request_syncada_file" + "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/payment_request_syncada_files" "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/requested_office_users" "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/transportation_offices" "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/uploads" @@ -160,6 +162,11 @@ func configureAPI(api *adminoperations.MymoveAPI) http.Handler { return middleware.NotImplemented("operation organizations.IndexOrganizations has not yet been implemented") }) } + if api.PaymentRequestSyncadaFilesIndexPaymentRequestSyncadaFilesHandler == nil { + api.PaymentRequestSyncadaFilesIndexPaymentRequestSyncadaFilesHandler = payment_request_syncada_files.IndexPaymentRequestSyncadaFilesHandlerFunc(func(params payment_request_syncada_files.IndexPaymentRequestSyncadaFilesParams) middleware.Responder { + return middleware.NotImplemented("operation payment_request_syncada_files.IndexPaymentRequestSyncadaFiles has not yet been implemented") + }) + } if api.RequestedOfficeUsersIndexRequestedOfficeUsersHandler == nil { api.RequestedOfficeUsersIndexRequestedOfficeUsersHandler = requested_office_users.IndexRequestedOfficeUsersHandlerFunc(func(params requested_office_users.IndexRequestedOfficeUsersParams) middleware.Responder { return middleware.NotImplemented("operation requested_office_users.IndexRequestedOfficeUsers has not yet been implemented") @@ -175,6 +182,11 @@ func configureAPI(api *adminoperations.MymoveAPI) http.Handler { return middleware.NotImplemented("operation webhook_subscriptions.IndexWebhookSubscriptions has not yet been implemented") }) } + if api.PaymentRequestSyncadaFilePaymentRequestSyncadaFileHandler == nil { + api.PaymentRequestSyncadaFilePaymentRequestSyncadaFileHandler = payment_request_syncada_file.PaymentRequestSyncadaFileHandlerFunc(func(params payment_request_syncada_file.PaymentRequestSyncadaFileParams) middleware.Responder { + return middleware.NotImplemented("operation payment_request_syncada_file.PaymentRequestSyncadaFile has not yet been implemented") + }) + } if api.ClientCertificatesRemoveClientCertificateHandler == nil { api.ClientCertificatesRemoveClientCertificateHandler = client_certificates.RemoveClientCertificateHandlerFunc(func(params client_certificates.RemoveClientCertificateParams) middleware.Responder { return middleware.NotImplemented("operation client_certificates.RemoveClientCertificate has not yet been implemented") diff --git a/pkg/gen/adminapi/embedded_spec.go b/pkg/gen/adminapi/embedded_spec.go index fe1d21fe488..03274b71847 100644 --- a/pkg/gen/adminapi/embedded_spec.go +++ b/pkg/gen/adminapi/embedded_spec.go @@ -1184,6 +1184,145 @@ func init() { } } }, + "/payment-request-syncada-files": { + "get": { + "description": "Returns a list of Payment Request EDI files", + "produces": [ + "application/json" + ], + "tags": [ + "Payment Request Syncada Files" + ], + "summary": "List Payment Request EDI Files", + "operationId": "indexPaymentRequestSyncadaFiles", + "parameters": [ + { + "type": "string", + "name": "filter", + "in": "query" + }, + { + "type": "integer", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "name": "perPage", + "in": "query" + }, + { + "type": "string", + "name": "sort", + "in": "query" + }, + { + "type": "boolean", + "name": "order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "$ref": "#/definitions/PaymentRequestSyncadaFiles" + }, + "headers": { + "Content-Range": { + "type": "string", + "description": "Used for pagination" + } + } + }, + "400": { + "description": "invalid request" + }, + "401": { + "description": "request requires user authentication" + }, + "404": { + "description": "Payment Request EDI Files not found" + }, + "500": { + "description": "server error" + } + } + } + }, + "/payment-request-syncada-files/{paymentRequestSyncadaFileId}": { + "get": { + "description": "Returns a Payment Request EDI858 file", + "produces": [ + "application/json" + ], + "tags": [ + "Payment Request Syncada File" + ], + "summary": "Payment Request EDI File", + "operationId": "paymentRequestSyncadaFile", + "parameters": [ + { + "type": "string", + "format": "uuid", + "name": "paymentRequestSyncadaFileId", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "filter", + "in": "query" + }, + { + "type": "integer", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "name": "perPage", + "in": "query" + }, + { + "type": "string", + "name": "sort", + "in": "query" + }, + { + "type": "boolean", + "name": "order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "$ref": "#/definitions/PaymentRequestSyncadaFile" + }, + "headers": { + "Content-Range": { + "type": "string", + "description": "Used for pagination" + } + } + }, + "400": { + "description": "invalid request" + }, + "401": { + "description": "request requires user authentication" + }, + "404": { + "description": "Payment Request EDI Files not found" + }, + "500": { + "description": "server error" + } + } + } + }, "/requested-office-users": { "get": { "description": "This endpoint returns a list of Office Users. Do not use this endpoint directly\nas it is meant to be used with the Admin UI exclusively.\n", @@ -2843,6 +2982,36 @@ func init() { "$ref": "#/definitions/Organization" } }, + "PaymentRequestSyncadaFile": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "readOnly": true + }, + "ediString": { + "type": "string" + }, + "fileName": { + "type": "string" + }, + "id": { + "type": "string", + "format": "uuid", + "example": "c56a4180-65aa-42ec-a945-5fd21dec0538" + }, + "paymentRequestNumber": { + "type": "string" + } + } + }, + "PaymentRequestSyncadaFiles": { + "type": "array", + "items": { + "$ref": "#/definitions/PaymentRequestSyncadaFile" + } + }, "Privilege": { "type": "object", "properties": { @@ -4573,6 +4742,145 @@ func init() { } } }, + "/payment-request-syncada-files": { + "get": { + "description": "Returns a list of Payment Request EDI files", + "produces": [ + "application/json" + ], + "tags": [ + "Payment Request Syncada Files" + ], + "summary": "List Payment Request EDI Files", + "operationId": "indexPaymentRequestSyncadaFiles", + "parameters": [ + { + "type": "string", + "name": "filter", + "in": "query" + }, + { + "type": "integer", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "name": "perPage", + "in": "query" + }, + { + "type": "string", + "name": "sort", + "in": "query" + }, + { + "type": "boolean", + "name": "order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "$ref": "#/definitions/PaymentRequestSyncadaFiles" + }, + "headers": { + "Content-Range": { + "type": "string", + "description": "Used for pagination" + } + } + }, + "400": { + "description": "invalid request" + }, + "401": { + "description": "request requires user authentication" + }, + "404": { + "description": "Payment Request EDI Files not found" + }, + "500": { + "description": "server error" + } + } + } + }, + "/payment-request-syncada-files/{paymentRequestSyncadaFileId}": { + "get": { + "description": "Returns a Payment Request EDI858 file", + "produces": [ + "application/json" + ], + "tags": [ + "Payment Request Syncada File" + ], + "summary": "Payment Request EDI File", + "operationId": "paymentRequestSyncadaFile", + "parameters": [ + { + "type": "string", + "format": "uuid", + "name": "paymentRequestSyncadaFileId", + "in": "path", + "required": true + }, + { + "type": "string", + "name": "filter", + "in": "query" + }, + { + "type": "integer", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "name": "perPage", + "in": "query" + }, + { + "type": "string", + "name": "sort", + "in": "query" + }, + { + "type": "boolean", + "name": "order", + "in": "query" + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "$ref": "#/definitions/PaymentRequestSyncadaFile" + }, + "headers": { + "Content-Range": { + "type": "string", + "description": "Used for pagination" + } + } + }, + "400": { + "description": "invalid request" + }, + "401": { + "description": "request requires user authentication" + }, + "404": { + "description": "Payment Request EDI Files not found" + }, + "500": { + "description": "server error" + } + } + } + }, "/requested-office-users": { "get": { "description": "This endpoint returns a list of Office Users. Do not use this endpoint directly\nas it is meant to be used with the Admin UI exclusively.\n", @@ -6233,6 +6541,36 @@ func init() { "$ref": "#/definitions/Organization" } }, + "PaymentRequestSyncadaFile": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "readOnly": true + }, + "ediString": { + "type": "string" + }, + "fileName": { + "type": "string" + }, + "id": { + "type": "string", + "format": "uuid", + "example": "c56a4180-65aa-42ec-a945-5fd21dec0538" + }, + "paymentRequestNumber": { + "type": "string" + } + } + }, + "PaymentRequestSyncadaFiles": { + "type": "array", + "items": { + "$ref": "#/definitions/PaymentRequestSyncadaFile" + } + }, "Privilege": { "type": "object", "properties": { diff --git a/pkg/gen/adminmessages/payment_request_syncada_file.go b/pkg/gen/adminmessages/payment_request_syncada_file.go new file mode 100644 index 00000000000..efc68406b0a --- /dev/null +++ b/pkg/gen/adminmessages/payment_request_syncada_file.go @@ -0,0 +1,123 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adminmessages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PaymentRequestSyncadaFile payment request syncada file +// +// swagger:model PaymentRequestSyncadaFile +type PaymentRequestSyncadaFile struct { + + // created at + // Read Only: true + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // edi string + EdiString string `json:"ediString,omitempty"` + + // file name + FileName string `json:"fileName,omitempty"` + + // id + // Example: c56a4180-65aa-42ec-a945-5fd21dec0538 + // Format: uuid + ID strfmt.UUID `json:"id,omitempty"` + + // payment request number + PaymentRequestNumber string `json:"paymentRequestNumber,omitempty"` +} + +// Validate validates this payment request syncada file +func (m *PaymentRequestSyncadaFile) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PaymentRequestSyncadaFile) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *PaymentRequestSyncadaFile) validateID(formats strfmt.Registry) error { + if swag.IsZero(m.ID) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this payment request syncada file based on the context it is used +func (m *PaymentRequestSyncadaFile) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCreatedAt(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PaymentRequestSyncadaFile) contextValidateCreatedAt(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "createdAt", "body", strfmt.DateTime(m.CreatedAt)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PaymentRequestSyncadaFile) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PaymentRequestSyncadaFile) UnmarshalBinary(b []byte) error { + var res PaymentRequestSyncadaFile + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/adminmessages/payment_request_syncada_files.go b/pkg/gen/adminmessages/payment_request_syncada_files.go new file mode 100644 index 00000000000..2aa965b1493 --- /dev/null +++ b/pkg/gen/adminmessages/payment_request_syncada_files.go @@ -0,0 +1,78 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package adminmessages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PaymentRequestSyncadaFiles payment request syncada files +// +// swagger:model PaymentRequestSyncadaFiles +type PaymentRequestSyncadaFiles []*PaymentRequestSyncadaFile + +// Validate validates this payment request syncada files +func (m PaymentRequestSyncadaFiles) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this payment request syncada files based on the context it is used +func (m PaymentRequestSyncadaFiles) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + + if swag.IsZero(m[i]) { // not required + return nil + } + + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/handlers/adminapi/api.go b/pkg/handlers/adminapi/api.go index ae1cc7aa687..231ded61fe7 100644 --- a/pkg/handlers/adminapi/api.go +++ b/pkg/handlers/adminapi/api.go @@ -20,6 +20,7 @@ import ( officeuser "github.com/transcom/mymove/pkg/services/office_user" "github.com/transcom/mymove/pkg/services/organization" "github.com/transcom/mymove/pkg/services/pagination" + prsff "github.com/transcom/mymove/pkg/services/payment_request" "github.com/transcom/mymove/pkg/services/query" requestedofficeusers "github.com/transcom/mymove/pkg/services/requested_office_users" "github.com/transcom/mymove/pkg/services/roles" @@ -271,5 +272,17 @@ func NewAdminAPI(handlerConfig handlers.HandlerConfig) *adminops.MymoveAPI { query.NewQueryFilter, } + adminAPI.PaymentRequestSyncadaFilesIndexPaymentRequestSyncadaFilesHandler = IndexPaymentRequestSyncadaFilesHandler{ + handlerConfig, + fetch.NewListFetcher(queryBuilder), + query.NewQueryFilter, + pagination.NewPagination, + } + + adminAPI.PaymentRequestSyncadaFilePaymentRequestSyncadaFileHandler = GetPaymentRequestSyncadaFileHandler{ + handlerConfig, + prsff.NewPaymentRequestSyncadaFileFetcher(queryBuilder), + query.NewQueryFilter, + } return adminAPI } diff --git a/pkg/handlers/adminapi/payment_request_syncada_files.go b/pkg/handlers/adminapi/payment_request_syncada_files.go new file mode 100644 index 00000000000..cb0878c18b5 --- /dev/null +++ b/pkg/handlers/adminapi/payment_request_syncada_files.go @@ -0,0 +1,88 @@ +package adminapi + +import ( + "fmt" + + "github.com/go-openapi/runtime/middleware" + "github.com/gofrs/uuid" + + "github.com/transcom/mymove/pkg/appcontext" + pp "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/payment_request_syncada_file" + pre "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/payment_request_syncada_files" + "github.com/transcom/mymove/pkg/gen/adminmessages" + "github.com/transcom/mymove/pkg/handlers" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/services" + "github.com/transcom/mymove/pkg/services/query" +) + +type IndexPaymentRequestSyncadaFilesHandler struct { + handlers.HandlerConfig + services.ListFetcher + services.NewQueryFilter + services.NewPagination +} + +func (h IndexPaymentRequestSyncadaFilesHandler) Handle(params pre.IndexPaymentRequestSyncadaFilesParams) middleware.Responder { + return h.AuditableAppContextFromRequestWithErrors(params.HTTPRequest, + func(appCtx appcontext.AppContext) (middleware.Responder, error) { + queryFilters := generateQueryFilters(appCtx.Logger(), params.Filter, paymentRequestNumberFilter) + ordering := query.NewQueryOrder(params.Sort, params.Order) + pagination := h.NewPagination(params.Page, params.PerPage) + var paymentRequestEdiFiles models.PaymentRequestEdiFiles + err := h.ListFetcher.FetchRecordList(appCtx, &paymentRequestEdiFiles, queryFilters, nil, pagination, ordering) + if err != nil { + return handlers.ResponseForError(appCtx.Logger(), err), err + } + totalPaymentRequestSyncadaFilesCount, err := h.ListFetcher.FetchRecordCount(appCtx, &paymentRequestEdiFiles, queryFilters) + if err != nil { + return handlers.ResponseForError(appCtx.Logger(), err), err + } + queriedPaymentRequestEdiFilesCount := len(paymentRequestEdiFiles) + payload := make([]*adminmessages.PaymentRequestSyncadaFile, queriedPaymentRequestEdiFilesCount) + for i, paymentRequestEdiFile := range paymentRequestEdiFiles { + payload[i] = payloadForPaymentRequestEdiFile(paymentRequestEdiFile) + } + return pre.NewIndexPaymentRequestSyncadaFilesOK().WithContentRange(fmt.Sprintf("payment-request-syncada-files %d-%d/%d", pagination.Offset(), pagination.Offset()+queriedPaymentRequestEdiFilesCount, totalPaymentRequestSyncadaFilesCount)).WithPayload(payload), nil + }) +} + +func payloadForPaymentRequestEdiFile(paymentRequestEdiFile models.PaymentRequestEdiFile) *adminmessages.PaymentRequestSyncadaFile { + paymentRequestSyncadaFilePayload := &adminmessages.PaymentRequestSyncadaFile{ + ID: *handlers.FmtUUID(paymentRequestEdiFile.ID), + PaymentRequestNumber: paymentRequestEdiFile.PaymentRequestNumber, + FileName: paymentRequestEdiFile.Filename, + EdiString: paymentRequestEdiFile.EdiString, + CreatedAt: *handlers.FmtDateTime(paymentRequestEdiFile.CreatedAt), + } + return paymentRequestSyncadaFilePayload +} + +type GetPaymentRequestSyncadaFileHandler struct { + handlers.HandlerConfig + services.PaymentRequestSyncadaFileFetcher + services.NewQueryFilter +} + +// Handle implements payment_request_syncada_file.PaymentRequestSyncadaFileHandler. +func (g GetPaymentRequestSyncadaFileHandler) Handle(params pp.PaymentRequestSyncadaFileParams) middleware.Responder { + return g.AuditableAppContextFromRequestWithErrors(params.HTTPRequest, + func(appCtx appcontext.AppContext) (middleware.Responder, error) { + paymentRequestSyncadaFileID := uuid.FromStringOrNil(params.PaymentRequestSyncadaFileID.String()) + queryFilters := []services.QueryFilter{query.NewQueryFilter("id", "=", paymentRequestSyncadaFileID)} + + paymentRequestSyncadaFile, err := g.PaymentRequestSyncadaFileFetcher.FetchPaymentRequestSyncadaFile(appCtx, queryFilters) + if err != nil { + return handlers.ResponseForError(appCtx.Logger(), err), err + } + payload := payloadForPaymentRequestEdiFile(paymentRequestSyncadaFile) + return pp.NewPaymentRequestSyncadaFileOK().WithPayload(payload), nil + }) +} + +var paymentRequestNumberFilter = map[string]func(string) []services.QueryFilter{ + "paymentRequestNumber": func(content string) []services.QueryFilter { + return []services.QueryFilter{ + query.NewQueryFilter("payment_request_number", "ILIKE", fmt.Sprintf("%%%s%%", content))} + }, +} diff --git a/pkg/handlers/adminapi/payment_request_syncada_files_test.go b/pkg/handlers/adminapi/payment_request_syncada_files_test.go new file mode 100644 index 00000000000..bca46165102 --- /dev/null +++ b/pkg/handlers/adminapi/payment_request_syncada_files_test.go @@ -0,0 +1,64 @@ +// RA Summary: gosec - errcheck - Unchecked return value +// RA: Linter flags errcheck error: Ignoring a method's return value can cause the program to overlook unexpected states and conditions. +// RA: Functions with unchecked return values in the file are used set up environment variables +// RA: Given the functions causing the lint errors are used to set environment variables for testing purposes, it does not present a risk +// RA Developer Status: Mitigated +// RA Validator Status: Mitigated +// RA Modified Severity: N/A +// nolint:errcheck +package adminapi + +import ( + "github.com/gofrs/uuid" + + pre "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/payment_request_syncada_files" + "github.com/transcom/mymove/pkg/models" + fetch "github.com/transcom/mymove/pkg/services/fetch" + "github.com/transcom/mymove/pkg/services/pagination" + "github.com/transcom/mymove/pkg/services/query" +) + +const ( + edi858cA = "ISA*00*0084182369*00*_ _*ZZ*GOVDPIBS*12*8004171844*20200921*1459*U*00401*100001272*0*T*|" + edi858cB = "ISA*00*0084182369*00*0000000000*ZZ*MILMOVE *12*8004171844 *241009*1912*U*00401*404551885*0*T*|" +) + +func (suite *HandlerSuite) TestIndexPaymentRequestSyncadaFilesHandler() { + // test that everything is wired up + suite.Run("payment request syncada files handler result in ok response", func() { + prsf := []models.PaymentRequestEdiFile{ + { + + PaymentRequestNumber: "1234-1212-1", + EdiString: edi858cA, + Filename: "858-2770-1.txt", + }, + { + ID: uuid.Must(uuid.NewV4()), + PaymentRequestNumber: "2345-9875-2", + EdiString: edi858cB, + Filename: "858-0324-1.txt", + }, + } + models.CreatePaymentRequestEdiFile(suite.DB(), prsf[0].Filename, prsf[0].EdiString, prsf[0].PaymentRequestNumber) + models.CreatePaymentRequestEdiFile(suite.DB(), prsf[1].Filename, prsf[1].EdiString, prsf[1].PaymentRequestNumber) + + params := pre.IndexPaymentRequestSyncadaFilesParams{ + HTTPRequest: suite.setupAuthenticatedRequest("GET", "/payment-request-syncada-files"), + } + queryBuilder := query.NewQueryBuilder() + handler := IndexPaymentRequestSyncadaFilesHandler{ + HandlerConfig: suite.HandlerConfig(), + NewQueryFilter: query.NewQueryFilter, + ListFetcher: fetch.NewListFetcher(queryBuilder), + NewPagination: pagination.NewPagination, + } + + response := handler.Handle(params) + suite.IsType(&pre.IndexPaymentRequestSyncadaFilesOK{}, response) + okResponse := response.(*pre.IndexPaymentRequestSyncadaFilesOK) + suite.Len(okResponse.Payload, 2) + suite.Equal(prsf[0].PaymentRequestNumber, okResponse.Payload[0].PaymentRequestNumber) + }) + +} diff --git a/pkg/models/payment_request_edi_file.go b/pkg/models/payment_request_edi_file.go new file mode 100644 index 00000000000..a37206be0b2 --- /dev/null +++ b/pkg/models/payment_request_edi_file.go @@ -0,0 +1,70 @@ +package models + +import ( + "time" + + "github.com/gobuffalo/pop/v6" + "github.com/gofrs/uuid" +) + +type PaymentRequestEdiFile struct { + ID uuid.UUID `json:"id" db:"id"` + CreatedAt time.Time `json:"created_at" db:"created_at"` + UpdatedAt time.Time `json:"updated_at" db:"updated_at"` + EdiString string `json:"edi_string" db:"edi_string"` + Filename string `json:"file_name" db:"file_name"` + PaymentRequestNumber string `json:"payment_request_number" db:"payment_request_number"` +} + +func (p PaymentRequestEdiFile) TableName() string { + return "payment_request_edi_files" +} + +type PaymentRequestEdiFiles []PaymentRequestEdiFile + +func CreatePaymentRequestEdiFile(db *pop.Connection, fileName string, ediString string, paymentRequestNumber string) error { + paymentRequestEdiFile := &PaymentRequestEdiFile{ + Filename: fileName, + EdiString: ediString, + PaymentRequestNumber: paymentRequestNumber, + } + + if paymentRequestEdiFile.EdiString == "" { + return nil + } + + if paymentRequestEdiFile.Filename == "" { + return nil + } + + if paymentRequestEdiFile.PaymentRequestNumber == "" { + return nil + } + + verrs, err := db.ValidateAndCreate(paymentRequestEdiFile) + if err != nil { + return err + } + if verrs.HasAny() { + return verrs + } + return nil +} + +func FetchAllPaymentRequestEdiFiles(db *pop.Connection) (PaymentRequestEdiFiles, error) { + var paymentRequestEdiFiles PaymentRequestEdiFiles + err := db.All(&paymentRequestEdiFiles) + if err != nil { + return nil, err + } + return paymentRequestEdiFiles, nil +} + +func FetchPaymentRequestEdiByPaymentRequestNumber(db *pop.Connection, paymentRequestNumber string) (PaymentRequestEdiFile, error) { + var paymentRequestEdiFile PaymentRequestEdiFile + err := db.Where("payment_request_number = ?", paymentRequestNumber).First(&paymentRequestEdiFile) + if err != nil { + return PaymentRequestEdiFile{}, err + } + return paymentRequestEdiFile, nil +} diff --git a/pkg/payment_request/send_to_syncada.go b/pkg/payment_request/send_to_syncada.go index 0111db7ea67..fac50c2e219 100644 --- a/pkg/payment_request/send_to_syncada.go +++ b/pkg/payment_request/send_to_syncada.go @@ -13,32 +13,32 @@ import ( ) // SendToSyncada send EDI file to Syncada for processing -func SendToSyncada(appCtx appcontext.AppContext, edi string, icn int64, gexSender services.GexSender, sftpSender services.SyncadaSFTPSender, sendEDIFile bool) error { +func SendToSyncada(appCtx appcontext.AppContext, edi string, icn int64, gexSender services.GexSender, sftpSender services.SyncadaSFTPSender, sendEDIFile bool) (string, error) { logger := appCtx.Logger() syncadaFileName := fmt.Sprintf("%s_%d_edi858.txt", time.Now().Format("2006_01_02T15_04_05Z07_00"), icn) if !sendEDIFile { logger.Info("SendToSyncada() is in do not send mode, syncadaFileName: " + syncadaFileName + "") - return nil + return syncadaFileName, nil } if (gexSender == nil) && (sftpSender == nil) { - return fmt.Errorf("cannot send to Syncada, SendToSyncada() senders are nil") + return syncadaFileName, fmt.Errorf("cannot send to Syncada, SendToSyncada() senders are nil") } if gexSender != nil { logger.Info("SendToSyncada() is in send mode using GEX, sending syncadaFileName: " + syncadaFileName) resp, err := gexSender.SendToGex(services.GEXChannelInvoice, edi, syncadaFileName) if err != nil { logger.Error("GEX Sender encountered an error", zap.Error(err)) - return fmt.Errorf("GEX sender encountered an error: %w", err) + return syncadaFileName, fmt.Errorf("GEX sender encountered an error: %w", err) } if resp == nil { logger.Error("GEX Sender receieved no response from GEX") - return fmt.Errorf("no response when sending EDI to GEX") + return syncadaFileName, fmt.Errorf("no response when sending EDI to GEX") } if resp.StatusCode != http.StatusOK { logger.Error("func SendToSyncada() failed send to GEX with", zap.Int("StatusCode", resp.StatusCode), zap.String("Status", resp.Status)) - return fmt.Errorf("received error response when sending EDI to GEX %v", resp) + return syncadaFileName, fmt.Errorf("received error response when sending EDI to GEX %v", resp) } logger.Info( "SUCCESS: EDI858 Processor sent a new file to syncada for Payment Request, using GEX", @@ -50,9 +50,10 @@ func SendToSyncada(appCtx appcontext.AppContext, edi string, icn int64, gexSende logger.Info("SendToSyncada() is in send mode, sending syncadaFileName: " + syncadaFileName + "") _, err := sftpSender.SendToSyncadaViaSFTP(appCtx, edi858String, syncadaFileName) if err != nil { - return err + return syncadaFileName, err } + logger.Info("SUCCESS: EDI858 Processor sent new file to syncada for Payment Request", zap.String("syncadaFileName", syncadaFileName)) } - return nil + return syncadaFileName, nil } diff --git a/pkg/payment_request/send_to_syncada_test.go b/pkg/payment_request/send_to_syncada_test.go index 7d94dbb6e33..7c65c1d187a 100644 --- a/pkg/payment_request/send_to_syncada_test.go +++ b/pkg/payment_request/send_to_syncada_test.go @@ -21,14 +21,14 @@ func (suite *PaymentRequestHelperSuite) TestSendToSyncada() { suite.Run("returns no error if send is false", func() { sftpSender := services.SyncadaSFTPSender(nil) gexSender := services.GexSender(nil) - err := SendToSyncada(suite.AppContextForTest(), "edi string", 12345, gexSender, sftpSender, false) + _, err := SendToSyncada(suite.AppContextForTest(), "edi string", 12345, gexSender, sftpSender, false) suite.NoError(err) }) suite.Run("returns error if no sender", func() { sftpSender := services.SyncadaSFTPSender(nil) gexSender := services.GexSender(nil) - err := SendToSyncada(suite.AppContextForTest(), "edi string", 12345, gexSender, sftpSender, true) + _, err := SendToSyncada(suite.AppContextForTest(), "edi string", 12345, gexSender, sftpSender, true) suite.Error(err) suite.Equal("cannot send to Syncada, SendToSyncada() senders are nil", err.Error()) }) @@ -40,7 +40,7 @@ func (suite *PaymentRequestHelperSuite) TestSendToSyncada() { gexSender := &mocks.GexSender{} gexSender. On("SendToGex", services.GEXChannelInvoice, fakeEdi, filenameMatcher).Return(response, nil) - err := SendToSyncada(suite.AppContextForTest(), fakeEdi, 12345, gexSender, sftpSender, true) + _, err := SendToSyncada(suite.AppContextForTest(), fakeEdi, 12345, gexSender, sftpSender, true) suite.NoError(err) }) @@ -51,7 +51,7 @@ func (suite *PaymentRequestHelperSuite) TestSendToSyncada() { gexSender := &mocks.GexSender{} gexSender. On("SendToGex", services.GEXChannelInvoice, fakeEdi, filenameMatcher).Return(response, nil) - err := SendToSyncada(suite.AppContextForTest(), fakeEdi, 12345, gexSender, sftpSender, true) + _, err := SendToSyncada(suite.AppContextForTest(), fakeEdi, 12345, gexSender, sftpSender, true) suite.Error(err) suite.Contains("received error response when sending EDI to GEX &{ 403 0 0 map[] 0 [] false false map[] }", err.Error()) }) @@ -62,7 +62,7 @@ func (suite *PaymentRequestHelperSuite) TestSendToSyncada() { gexSender := &mocks.GexSender{} gexSender. On("SendToGex", services.GEXChannelInvoice, fakeEdi, filenameMatcher).Return(nil, nil) - err := SendToSyncada(suite.AppContextForTest(), fakeEdi, 12345, gexSender, sftpSender, true) + _, err := SendToSyncada(suite.AppContextForTest(), fakeEdi, 12345, gexSender, sftpSender, true) suite.Error(err) suite.Contains("no response when sending EDI to GEX", err.Error()) }) @@ -73,7 +73,7 @@ func (suite *PaymentRequestHelperSuite) TestSendToSyncada() { gexSender := &mocks.GexSender{} gexSender. On("SendToGex", services.GEXChannelInvoice, fakeEdi, filenameMatcher).Return(nil, fmt.Errorf("gex send threw error")) - err := SendToSyncada(suite.AppContextForTest(), fakeEdi, 12345, gexSender, sftpSender, true) + _, err := SendToSyncada(suite.AppContextForTest(), fakeEdi, 12345, gexSender, sftpSender, true) suite.Error(err) suite.Contains("GEX sender encountered an error: gex send threw error", err.Error()) }) @@ -85,7 +85,7 @@ func (suite *PaymentRequestHelperSuite) TestSendToSyncada() { sftpSender. On("SendToSyncadaViaSFTP", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, filenameMatcher).Return(bytesSent, fmt.Errorf("test error")) gexSender := services.GexSender(nil) - err := SendToSyncada(suite.AppContextForTest(), "edi string", 12345, gexSender, sftpSender, true) + _, err := SendToSyncada(suite.AppContextForTest(), "edi string", 12345, gexSender, sftpSender, true) suite.Error(err) suite.Equal("test error", err.Error()) }) @@ -98,7 +98,7 @@ func (suite *PaymentRequestHelperSuite) TestSendToSyncada() { sftpSender. On("SendToSyncadaViaSFTP", mock.AnythingOfType("*appcontext.appContext"), strings.NewReader(fakeEdi), filenameMatcher).Return(bytesSent, nil) gexSender := services.GexSender(nil) - err := SendToSyncada(suite.AppContextForTest(), fakeEdi, 12345, gexSender, sftpSender, true) + _, err := SendToSyncada(suite.AppContextForTest(), fakeEdi, 12345, gexSender, sftpSender, true) suite.NoError(err) }) } diff --git a/pkg/services/payment_request/payment_request_reviewed_processor.go b/pkg/services/payment_request/payment_request_reviewed_processor.go index 882f7097ec8..b1802c76707 100644 --- a/pkg/services/payment_request/payment_request_reviewed_processor.go +++ b/pkg/services/payment_request/payment_request_reviewed_processor.go @@ -133,7 +133,8 @@ func (p *paymentRequestReviewedProcessor) ProcessAndLockReviewedPR(appCtx appcon ) // Send EDI string to Syncada // If sent successfully to GEX, update payment request status to SENT_TO_GEX. - err = paymentrequesthelper.SendToSyncada(txnAppCtx, edi858cString, icn, p.gexSender, p.sftpSender, p.runSendToSyncada) + var ediFileName string + ediFileName, err = paymentrequesthelper.SendToSyncada(txnAppCtx, edi858cString, icn, p.gexSender, p.sftpSender, p.runSendToSyncada) if err != nil { return GexSendError{paymentRequestID: lockedPR.ID, err: err} } @@ -142,6 +143,11 @@ func (p *paymentRequestReviewedProcessor) ProcessAndLockReviewedPR(appCtx appcon lockedPR.Status = models.PaymentRequestStatusSentToGex err = txnAppCtx.DB().Update(&lockedPR) + err1 := models.CreatePaymentRequestEdiFile(txnAppCtx.DB(), edi858cString, ediFileName, pr.PaymentRequestNumber) + if err1 != nil { + return fmt.Errorf("failure creating payment request EDI file: %w", err1) + } + if err != nil { return fmt.Errorf("failure updating payment request status: %w", err) } diff --git a/pkg/services/payment_request/payment_request_syncada_file_fetcher.go b/pkg/services/payment_request/payment_request_syncada_file_fetcher.go new file mode 100644 index 00000000000..832546b6d90 --- /dev/null +++ b/pkg/services/payment_request/payment_request_syncada_file_fetcher.go @@ -0,0 +1,25 @@ +package paymentrequest + +import ( + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/services" +) + +type paymentReqeustSyncadaFileQueryBuilder interface { + FetchOne(appCtx appcontext.AppContext, model interface{}, filters []services.QueryFilter) error +} + +type paymentRequestSyncadaFileFetcher struct { + builder paymentReqeustSyncadaFileQueryBuilder +} + +func (p *paymentRequestSyncadaFileFetcher) FetchPaymentRequestSyncadaFile(appCtx appcontext.AppContext, filters []services.QueryFilter) (models.PaymentRequestEdiFile, error) { + var paymentRequestEdiFile models.PaymentRequestEdiFile + err := p.builder.FetchOne(appCtx, &paymentRequestEdiFile, filters) + return paymentRequestEdiFile, err +} + +func NewPaymentRequestSyncadaFileFetcher(builder paymentReqeustSyncadaFileQueryBuilder) services.PaymentRequestSyncadaFileFetcher { + return &paymentRequestSyncadaFileFetcher{builder} +} diff --git a/pkg/services/payment_request_syncada_file.go b/pkg/services/payment_request_syncada_file.go new file mode 100644 index 00000000000..03b1c23bd8b --- /dev/null +++ b/pkg/services/payment_request_syncada_file.go @@ -0,0 +1,10 @@ +package services + +import ( + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" +) + +type PaymentRequestSyncadaFileFetcher interface { + FetchPaymentRequestSyncadaFile(appCtx appcontext.AppContext, filters []QueryFilter) (models.PaymentRequestEdiFile, error) +} diff --git a/src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx b/src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx new file mode 100644 index 00000000000..d35f95d1fe4 --- /dev/null +++ b/src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx @@ -0,0 +1,36 @@ +/* eslint-disable react/jsx-props-no-spreading */ +import React from 'react'; +import { Datagrid, Filter, List, TextField, TextInput, TopToolbar } from 'react-admin'; + +import AdminPagination from 'scenes/SystemAdmin/shared/AdminPagination'; + +const defaultSort = { field: 'createdAt', order: 'ASC' }; + +const ListActions = () => { + return ; +}; + +const PaymentRequestFilter = (props) => ( + + + +); + +const PaymentRequest858List = () => ( + } + filters={} + perPage={25} + sort={defaultSort} + actions={} + > + + + + + + + +); + +export default PaymentRequest858List; diff --git a/src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx b/src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx new file mode 100644 index 00000000000..3bf77c8e10d --- /dev/null +++ b/src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx @@ -0,0 +1,28 @@ +import React from 'react'; +import { Show, SimpleShowLayout, TextField, useRecordContext } from 'react-admin'; + +const PaymentRequest858ShowTitle = () => { + const record = useRecordContext(); + return {`Payment Request EDI File Id: ${record.id}`}; +}; + +const CustomEdiStringField = ({ source }) => { + const record = useRecordContext(); + return
{record[source]}
; +}; + +const PaymentRequest858Show = () => { + return ( + }> + + + + + + + + + ); +}; + +export default PaymentRequest858Show; diff --git a/src/scenes/SystemAdmin/Home.jsx b/src/scenes/SystemAdmin/Home.jsx index 53ad6ad75b9..09f1ca509d9 100644 --- a/src/scenes/SystemAdmin/Home.jsx +++ b/src/scenes/SystemAdmin/Home.jsx @@ -42,6 +42,8 @@ import WebhookSubscriptionCreate from 'pages/Admin/WebhookSubscriptions/WebhookS import RequestedOfficeUserList from 'pages/Admin/RequestedOfficeUsers/RequestedOfficeUserList'; import RequestedOfficeUserShow from 'pages/Admin/RequestedOfficeUsers/RequestedOfficeUserShow'; import RequestedOfficeUserEdit from 'pages/Admin/RequestedOfficeUsers/RequestedOfficeUserEdit'; +import PaymentRequest858List from 'pages/Admin/PaymentRequests/PaymentRequest858List'; +import PaymentRequest858Show from 'pages/Admin/PaymentRequests/PaymentRequest858Show'; const httpClient = (url, options = {}) => { if (!options.headers) { @@ -96,6 +98,12 @@ const Home = () => ( /> + diff --git a/swagger-def/admin.yaml b/swagger-def/admin.yaml index b429f70fe6a..9eb2f4d55ef 100644 --- a/swagger-def/admin.yaml +++ b/swagger-def/admin.yaml @@ -1,4 +1,4 @@ -swagger: '2.0' +swagger: "2.0" info: contact: email: milmove-developers@caci.com @@ -6,7 +6,7 @@ info: $ref: info/admin_description.md license: name: MIT - url: 'https://opensource.org/licenses/MIT' + url: "https://opensource.org/licenses/MIT" title: MilMove Admin API version: 1.0.0 basePath: /admin/v1 @@ -219,7 +219,7 @@ definitions: type: string title: Country x-nullable: true - example: 'USA' + example: "USA" default: USA county: type: string @@ -280,7 +280,7 @@ definitions: properties: email: type: string - example: 'user@userdomain.com' + example: "user@userdomain.com" title: Email firstName: type: string @@ -291,7 +291,7 @@ definitions: organizationId: type: string format: uuid - example: 'c56a4180-65aa-42ec-a945-5fd21dec0538' + example: "c56a4180-65aa-42ec-a945-5fd21dec0538" super: type: boolean AdminUserUpdate: @@ -314,7 +314,7 @@ definitions: AdminUsers: type: array items: - $ref: '#/definitions/AdminUser' + $ref: "#/definitions/AdminUser" ClientCertificate: type: object properties: @@ -371,7 +371,7 @@ definitions: ClientCertificates: type: array items: - $ref: '#/definitions/ClientCertificate' + $ref: "#/definitions/ClientCertificate" ClientCertificateCreate: type: object required: @@ -487,7 +487,7 @@ definitions: format: uuid example: c56a4180-65aa-42ec-a945-5fd21dec0538 status: - $ref: '#/definitions/WebhookSubscriptionStatus' + $ref: "#/definitions/WebhookSubscriptionStatus" eventKey: type: string description: >- @@ -515,7 +515,7 @@ definitions: format: uuid example: c56a4180-65aa-42ec-a945-5fd21dec0538 issuer: - $ref: '#/definitions/Issuer' + $ref: "#/definitions/Issuer" ordersNumber: type: string title: Orders Number @@ -532,7 +532,7 @@ definitions: ElectronicOrders: type: array items: - $ref: '#/definitions/ElectronicOrder' + $ref: "#/definitions/ElectronicOrder" ElectronicOrdersTotal: type: object properties: @@ -545,7 +545,7 @@ definitions: ElectronicOrdersTotals: type: array items: - $ref: '#/definitions/ElectronicOrdersTotal' + $ref: "#/definitions/ElectronicOrdersTotal" Issuer: type: string description: >- @@ -570,12 +570,12 @@ definitions: format: uuid example: c56a4180-65aa-42ec-a945-5fd21dec0538 serviceMember: - $ref: '#/definitions/ServiceMember' + $ref: "#/definitions/ServiceMember" locator: type: string - example: '12432' + example: "12432" status: - $ref: '#/definitions/MoveStatus' + $ref: "#/definitions/MoveStatus" show: type: boolean x-nullable: true @@ -596,7 +596,7 @@ definitions: Moves: type: array items: - $ref: '#/definitions/Move' + $ref: "#/definitions/Move" MoveStatus: type: string title: Move status @@ -649,7 +649,7 @@ definitions: Notifications: type: array items: - $ref: '#/definitions/Notification' + $ref: "#/definitions/Notification" OfficeUser: type: object properties: @@ -682,7 +682,7 @@ definitions: roles: type: array items: - $ref: '#/definitions/Role' + $ref: "#/definitions/Role" edipi: type: string otherUniqueId: @@ -698,7 +698,7 @@ definitions: privileges: type: array items: - $ref: '#/definitions/Privilege' + $ref: "#/definitions/Privilege" createdAt: type: string format: date-time @@ -728,7 +728,7 @@ definitions: properties: email: type: string - example: 'user@userdomain.com' + example: "user@userdomain.com" title: Email firstName: type: string @@ -749,16 +749,16 @@ definitions: transportationOfficeId: type: string format: uuid - example: 'c56a4180-65aa-42ec-a945-5fd21dec0538' + example: "c56a4180-65aa-42ec-a945-5fd21dec0538" roles: type: array items: - $ref: '#/definitions/OfficeUserRole' + $ref: "#/definitions/OfficeUserRole" privileges: type: array x-nullable: true items: - $ref: '#/definitions/OfficeUserPrivilege' + $ref: "#/definitions/OfficeUserPrivilege" OfficeUserUpdate: type: object properties: @@ -787,26 +787,26 @@ definitions: roles: type: array items: - $ref: '#/definitions/OfficeUserRole' + $ref: "#/definitions/OfficeUserRole" transportationOfficeId: type: string format: uuid - example: 'c56a4180-65aa-42ec-a945-5fd21dec0538' + example: "c56a4180-65aa-42ec-a945-5fd21dec0538" privileges: type: array items: - $ref: '#/definitions/OfficeUserPrivilege' + $ref: "#/definitions/OfficeUserPrivilege" OfficeUserRole: type: object properties: name: type: string - example: 'Task Ordering Officer' + example: "Task Ordering Officer" x-nullable: true title: name roleType: type: string - example: 'task_ordering_officer' + example: "task_ordering_officer" x-nullable: true title: roleType OfficeUserPrivilege: @@ -814,18 +814,18 @@ definitions: properties: name: type: string - example: 'Supervisor' + example: "Supervisor" x-nullable: true title: name privilegeType: type: string - example: 'supervisor' + example: "supervisor" x-nullable: true title: privilegeType OfficeUsers: type: array items: - $ref: '#/definitions/OfficeUser' + $ref: "#/definitions/OfficeUser" Organization: type: object required: @@ -864,7 +864,7 @@ definitions: Organizations: type: array items: - $ref: '#/definitions/Organization' + $ref: "#/definitions/Organization" RequestedOfficeUserUpdate: type: object properties: @@ -883,7 +883,7 @@ definitions: x-nullable: true email: type: string - example: 'user@userdomain.com' + example: "user@userdomain.com" telephone: type: string format: telephone @@ -893,11 +893,11 @@ definitions: roles: type: array items: - $ref: '#/definitions/OfficeUserRole' + $ref: "#/definitions/OfficeUserRole" transportationOfficeId: type: string format: uuid - example: 'c56a4180-65aa-42ec-a945-5fd21dec0538' + example: "c56a4180-65aa-42ec-a945-5fd21dec0538" x-nullable: true edipi: type: string @@ -994,7 +994,7 @@ definitions: type: string example: Fort Bragg North Station address: - $ref: '#/definitions/Address' + $ref: "#/definitions/Address" phoneLines: type: array items: @@ -1004,7 +1004,7 @@ definitions: example: 212-555-5555 gbloc: type: string - pattern: '^[A-Z]{4}$' + pattern: "^[A-Z]{4}$" example: JENQ latitude: type: number @@ -1031,7 +1031,7 @@ definitions: TransportationOffices: type: array items: - $ref: '#/definitions/TransportationOffice' + $ref: "#/definitions/TransportationOffice" Upload: type: object properties: @@ -1060,10 +1060,10 @@ definitions: example: c56a4180-65aa-42ec-a945-5fd21dec0538 moveLocator: type: string - example: '12432' + example: "12432" x-nullable: true upload: - $ref: '#/definitions/Upload' + $ref: "#/definitions/Upload" serviceMemberId: type: string format: uuid @@ -1139,7 +1139,7 @@ definitions: Users: type: array items: - $ref: '#/definitions/User' + $ref: "#/definitions/User" UserUpdate: type: object properties: @@ -1158,7 +1158,7 @@ definitions: ValidationError: allOf: - - $ref: '#/definitions/ClientError' + - $ref: "#/definitions/ClientError" - type: object properties: invalidFields: @@ -1185,7 +1185,7 @@ definitions: description: Unique identifier for the subscriber x-nullable: true status: - $ref: '#/definitions/WebhookSubscriptionStatus' + $ref: "#/definitions/WebhookSubscriptionStatus" callbackUrl: type: string description: The URL to which the notifications for this subscription will be pushed to. @@ -1214,7 +1214,7 @@ definitions: WebhookSubscriptions: type: array items: - $ref: '#/definitions/WebhookSubscription' + $ref: "#/definitions/WebhookSubscription" WebhookSubscriptionStatus: type: string title: Webhook subscription status @@ -1227,6 +1227,28 @@ definitions: ACTIVE: Active FAILING: Failing DISABLED: Disabled + PaymentRequestSyncadaFiles: + type: array + items: + $ref: "#/definitions/PaymentRequestSyncadaFile" + PaymentRequestSyncadaFile: + type: object + properties: + id: + type: string + format: uuid + example: c56a4180-65aa-42ec-a945-5fd21dec0538 + ediString: + type: string + paymentRequestNumber: + type: string + fileName: + type: string + createdAt: + type: string + format: date-time + readOnly: true + paths: /user: get: @@ -1236,17 +1258,17 @@ paths: tags: - User responses: - '200': + "200": description: success schema: - $ref: '#/definitions/AdminUser' - '400': + $ref: "#/definitions/AdminUser" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Admin User not found - '500': + "500": description: server error /requested-office-users: get: @@ -1275,21 +1297,21 @@ paths: name: order type: boolean responses: - '200': + "200": description: success headers: Content-Range: type: string description: Used for pagination schema: - $ref: '#/definitions/OfficeUsers' - '400': + $ref: "#/definitions/OfficeUsers" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Office User not found - '500': + "500": description: server error /requested-office-users/{officeUserId}: get: @@ -1307,17 +1329,17 @@ paths: format: uuid required: true responses: - '200': + "200": description: success schema: - $ref: '#/definitions/OfficeUser' - '400': + $ref: "#/definitions/OfficeUser" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Office User not found - '500': + "500": description: server error patch: produces: @@ -1337,21 +1359,21 @@ paths: name: body required: true schema: - $ref: '#/definitions/RequestedOfficeUserUpdate' + $ref: "#/definitions/RequestedOfficeUserUpdate" responses: - '200': + "200": description: success schema: - $ref: '#/definitions/OfficeUser' - '422': + $ref: "#/definitions/OfficeUser" + "422": description: validation error schema: - $ref: '#/definitions/ValidationError' - '401': + $ref: "#/definitions/ValidationError" + "401": description: request requires user authentication - '404': + "404": description: Office User not found - '500': + "500": description: server error /office-users: get: @@ -1380,21 +1402,21 @@ paths: name: order type: boolean responses: - '200': + "200": description: success headers: Content-Range: type: string description: Used for pagination schema: - $ref: '#/definitions/OfficeUsers' - '400': + $ref: "#/definitions/OfficeUsers" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Office User not found - '500': + "500": description: server error post: consumes: @@ -1412,17 +1434,17 @@ paths: name: officeUser description: Office User information schema: - $ref: '#/definitions/OfficeUserCreate' + $ref: "#/definitions/OfficeUserCreate" responses: - '201': + "201": description: Successfully created Office User schema: - $ref: '#/definitions/OfficeUser' - '422': + $ref: "#/definitions/OfficeUser" + "422": description: validation error schema: - $ref: '#/definitions/ValidationError' - '500': + $ref: "#/definitions/ValidationError" + "500": description: internal server error /office-users/{officeUserId}: get: @@ -1441,17 +1463,17 @@ paths: format: uuid required: true responses: - '200': + "200": description: success schema: - $ref: '#/definitions/OfficeUser' - '400': + $ref: "#/definitions/OfficeUser" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Office User not found - '500': + "500": description: server error patch: consumes: @@ -1475,19 +1497,19 @@ paths: description: Office User information required: true schema: - $ref: '#/definitions/OfficeUserUpdate' + $ref: "#/definitions/OfficeUserUpdate" responses: - '200': + "200": description: Successfully updated Office User schema: - $ref: '#/definitions/OfficeUser' - '400': + $ref: "#/definitions/OfficeUser" + "400": description: Invalid Request - '401': + "401": description: Must be authenticated to use this end point - '403': + "403": description: Not authorized to update an Office User - '500': + "500": description: Server error /admin-users: get: @@ -1518,21 +1540,21 @@ paths: name: order type: boolean responses: - '200': + "200": description: success headers: Content-Range: type: string description: Used for pagination schema: - $ref: '#/definitions/AdminUsers' - '400': + $ref: "#/definitions/AdminUsers" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Admin Users not found - '500': + "500": description: server error post: consumes: @@ -1550,19 +1572,19 @@ paths: name: adminUser description: Admin User information schema: - $ref: '#/definitions/AdminUserCreate' + $ref: "#/definitions/AdminUserCreate" responses: - '201': + "201": description: Successfully created Admin User schema: - $ref: '#/definitions/AdminUser' - '400': + $ref: "#/definitions/AdminUser" + "400": description: Invalid Request - '401': + "401": description: Must be authenticated to use this end point - '403': + "403": description: Not authorized to create an Admin User - '500': + "500": description: Server error /admin-users/{adminUserId}: get: @@ -1581,17 +1603,17 @@ paths: format: uuid required: true responses: - '200': + "200": description: success schema: - $ref: '#/definitions/AdminUser' - '400': + $ref: "#/definitions/AdminUser" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Admin User not found - '500': + "500": description: server error patch: consumes: @@ -1615,19 +1637,19 @@ paths: description: Admin User information required: true schema: - $ref: '#/definitions/AdminUserUpdate' + $ref: "#/definitions/AdminUserUpdate" responses: - '200': + "200": description: Successfully updated Admin User schema: - $ref: '#/definitions/AdminUser' - '400': + $ref: "#/definitions/AdminUser" + "400": description: Invalid Request - '401': + "401": description: Must be authenticated to use this end point - '403': + "403": description: Not authorized to update an Admin User - '500': + "500": description: Server error /client-certificates: get: @@ -1656,21 +1678,21 @@ paths: name: order type: boolean responses: - '200': + "200": description: success headers: Content-Range: type: string description: Used for pagination schema: - $ref: '#/definitions/ClientCertificates' - '400': + $ref: "#/definitions/ClientCertificates" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: office not found - '500': + "500": description: server error post: consumes: @@ -1688,12 +1710,12 @@ paths: name: clientCertificate description: client cert information schema: - $ref: '#/definitions/ClientCertificateCreate' + $ref: "#/definitions/ClientCertificateCreate" responses: 201: description: Successfully created client certificate schema: - $ref: '#/definitions/ClientCertificate' + $ref: "#/definitions/ClientCertificate" 400: description: Invalid Request 401: @@ -1722,7 +1744,7 @@ paths: 200: description: success schema: - $ref: '#/definitions/ClientCertificate' + $ref: "#/definitions/ClientCertificate" 400: description: invalid request 401: @@ -1753,12 +1775,12 @@ paths: description: client cert information required: true schema: - $ref: '#/definitions/ClientCertificateUpdate' + $ref: "#/definitions/ClientCertificateUpdate" responses: 200: description: Successfully updated Client Certificate schema: - $ref: '#/definitions/ClientCertificate' + $ref: "#/definitions/ClientCertificate" 400: description: Invalid Request 401: @@ -1788,7 +1810,7 @@ paths: 200: description: Successfully removed Client Certificate schema: - $ref: '#/definitions/ClientCertificate' + $ref: "#/definitions/ClientCertificate" 400: description: Invalid Request 401: @@ -1824,21 +1846,21 @@ paths: name: order type: boolean responses: - '200': + "200": description: success headers: Content-Range: type: string description: Used for pagination schema: - $ref: '#/definitions/TransportationOffices' - '400': + $ref: "#/definitions/TransportationOffices" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Transportation Office not found - '500': + "500": description: server error /electronic-orders: get: @@ -1869,21 +1891,21 @@ paths: name: order type: boolean responses: - '200': + "200": description: success headers: Content-Range: type: string description: Used for pagination schema: - $ref: '#/definitions/ElectronicOrders' - '400': + $ref: "#/definitions/ElectronicOrders" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Electronic Order not found - '500': + "500": description: server error /electronic-orders/totals: get: @@ -1907,17 +1929,17 @@ paths: items: type: string responses: - '200': + "200": description: success schema: - $ref: '#/definitions/ElectronicOrdersTotals' - '400': + $ref: "#/definitions/ElectronicOrdersTotals" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Total count for Electronic Orders not found - '500': + "500": description: server error /uploads/{uploadId}: get: @@ -1936,17 +1958,17 @@ paths: format: uuid required: true responses: - '200': + "200": description: success schema: - $ref: '#/definitions/UploadInformation' - '400': + $ref: "#/definitions/UploadInformation" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Upload not found - '500': + "500": description: server error /organizations: get: @@ -1977,21 +1999,21 @@ paths: name: order type: boolean responses: - '200': + "200": description: success headers: Content-Range: type: string description: Used for pagination schema: - $ref: '#/definitions/Organizations' - '400': + $ref: "#/definitions/Organizations" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Organizations not found - '500': + "500": description: server error /notifications: get: @@ -2020,21 +2042,21 @@ paths: name: order type: boolean responses: - '200': + "200": description: success headers: Content-Range: type: string description: Used for pagination schema: - $ref: '#/definitions/Notifications' - '400': + $ref: "#/definitions/Notifications" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Notifications not found - '500': + "500": description: server error /moves: get: @@ -2063,21 +2085,21 @@ paths: name: order type: boolean responses: - '200': + "200": description: success headers: Content-Range: type: string description: Used for pagination schema: - $ref: '#/definitions/Moves' - '400': + $ref: "#/definitions/Moves" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Moves not found - '500': + "500": description: server error /moves/{moveID}: get: @@ -2096,17 +2118,17 @@ paths: format: uuid required: true responses: - '200': + "200": description: Success schema: - $ref: '#/definitions/Move' - '400': + $ref: "#/definitions/Move" + "400": description: Invalid request - '401': + "401": description: Must be authenticated to use this endpoint - '404': + "404": description: Move not found - '500': + "500": description: Server error patch: consumes: @@ -2130,23 +2152,23 @@ paths: description: Move information required: true schema: - $ref: '#/definitions/MoveUpdate' + $ref: "#/definitions/MoveUpdate" responses: - '200': + "200": description: Successfully updated the Move schema: - $ref: '#/definitions/Move' - '400': + $ref: "#/definitions/Move" + "400": description: Invalid request - '401': + "401": description: Must be authenticated to use this endpoint - '403': + "403": description: Not authorized to update this Move - '404': + "404": description: Move not found - '422': + "422": description: Invalid input - '500': + "500": description: Server error /users: get: @@ -2175,21 +2197,21 @@ paths: name: order type: boolean responses: - '200': + "200": description: success headers: Content-Range: type: string description: Used for pagination schema: - $ref: '#/definitions/Users' - '400': + $ref: "#/definitions/Users" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Users not found - '500': + "500": description: server error /users/{userId}: get: @@ -2208,17 +2230,17 @@ paths: format: uuid required: true responses: - '200': + "200": description: success schema: - $ref: '#/definitions/User' - '400': + $ref: "#/definitions/User" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: User not found - '500': + "500": description: server error patch: consumes: @@ -2242,25 +2264,25 @@ paths: description: User information required: true schema: - $ref: '#/definitions/UserUpdate' + $ref: "#/definitions/UserUpdate" responses: - '200': + "200": description: Successfully updated User schema: - $ref: '#/definitions/User' - '400': + $ref: "#/definitions/User" + "400": description: Invalid Request - '401': + "401": description: Must be authenticated to use this end point - '403': + "403": description: Not authorized to update this User - '404': + "404": description: Not found - '422': + "422": description: Validation error schema: - $ref: '#/definitions/ValidationError' - '500': + $ref: "#/definitions/ValidationError" + "500": description: Server error /webhook-subscriptions: get: @@ -2289,21 +2311,21 @@ paths: name: order type: boolean responses: - '200': + "200": description: success headers: Content-Range: type: string description: Used for pagination schema: - $ref: '#/definitions/WebhookSubscriptions' - '400': + $ref: "#/definitions/WebhookSubscriptions" + "400": description: Invalid request - '401': + "401": description: Not authenticated for this endpoint - '404': + "404": description: Webhook Subscriptions not found - '500': + "500": description: Server error post: consumes: @@ -2321,19 +2343,19 @@ paths: name: webhookSubscription description: Webhook subscription information schema: - $ref: '#/definitions/CreateWebhookSubscription' + $ref: "#/definitions/CreateWebhookSubscription" responses: - '201': + "201": description: Successfully created Webhook Subscription schema: - $ref: '#/definitions/WebhookSubscription' - '400': + $ref: "#/definitions/WebhookSubscription" + "400": description: Invalid Request - '401': + "401": description: Must be authenticated to use this end point - '403': + "403": description: Not authorized to create a Webhook Subscription - '500': + "500": description: Server error /webhook-subscriptions/{webhookSubscriptionId}: get: @@ -2352,17 +2374,17 @@ paths: format: uuid required: true responses: - '200': + "200": description: success schema: - $ref: '#/definitions/WebhookSubscription' - '400': + $ref: "#/definitions/WebhookSubscription" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Webhook Subscription not found - '500': + "500": description: server error patch: consumes: @@ -2386,7 +2408,7 @@ paths: description: Webhook Subscription information required: true schema: - $ref: '#/definitions/WebhookSubscription' + $ref: "#/definitions/WebhookSubscription" - in: header name: If-Match type: string @@ -2395,23 +2417,112 @@ paths: Optimistic locking is implemented via the `If-Match` header. If the ETag header does not match the value of the resource on the server, the server rejects the change with a `412 Precondition Failed` error. responses: - '200': + "200": description: Successfully updated Webhook Subscription schema: - $ref: '#/definitions/WebhookSubscription' - '400': + $ref: "#/definitions/WebhookSubscription" + "400": description: Invalid Request - '401': + "401": description: Must be authenticated to use this end point - '403': + "403": description: Not authorized to update this Webhook Subscription - '404': + "404": description: Webhook Subscription not found - '412': + "412": description: Precondition failed - '422': + "422": description: Validation error schema: - $ref: '#/definitions/ValidationError' - '500': + $ref: "#/definitions/ValidationError" + "500": description: Server error + /payment-request-syncada-files: + get: + produces: + - application/json + summary: List Payment Request EDI Files + description: Returns a list of Payment Request EDI files + operationId: indexPaymentRequestSyncadaFiles + tags: + - Payment Request Syncada Files + parameters: + - in: query + name: filter + type: string + - in: query + name: page + type: integer + - in: query + name: perPage + type: integer + - in: query + name: sort + type: string + - in: query + name: order + type: boolean + responses: + "200": + description: success + headers: + Content-Range: + type: string + description: Used for pagination + schema: + $ref: "#/definitions/PaymentRequestSyncadaFiles" + "400": + description: invalid request + "401": + description: request requires user authentication + "404": + description: Payment Request EDI Files not found + "500": + description: server error + /payment-request-syncada-files/{paymentRequestSyncadaFileId}: + get: + produces: + - application/json + summary: Payment Request EDI File + description: Returns a Payment Request EDI858 file + operationId: paymentRequestSyncadaFile + tags: + - Payment Request Syncada File + parameters: + - in: path + name: paymentRequestSyncadaFileId + type: string + format: uuid + required: true + - in: query + name: filter + type: string + - in: query + name: page + type: integer + - in: query + name: perPage + type: integer + - in: query + name: sort + type: string + - in: query + name: order + type: boolean + responses: + "200": + description: success + headers: + Content-Range: + type: string + description: Used for pagination + schema: + $ref: "#/definitions/PaymentRequestSyncadaFile" + "400": + description: invalid request + "401": + description: request requires user authentication + "404": + description: Payment Request EDI Files not found + "500": + description: server error diff --git a/swagger/admin.yaml b/swagger/admin.yaml index 5b4a47e7643..3fa4aa66588 100644 --- a/swagger/admin.yaml +++ b/swagger/admin.yaml @@ -1236,6 +1236,27 @@ definitions: ACTIVE: Active FAILING: Failing DISABLED: Disabled + PaymentRequestSyncadaFiles: + type: array + items: + $ref: '#/definitions/PaymentRequestSyncadaFile' + PaymentRequestSyncadaFile: + type: object + properties: + id: + type: string + format: uuid + example: c56a4180-65aa-42ec-a945-5fd21dec0538 + ediString: + type: string + paymentRequestNumber: + type: string + fileName: + type: string + createdAt: + type: string + format: date-time + readOnly: true paths: /user: get: @@ -2556,3 +2577,92 @@ paths: $ref: '#/definitions/ValidationError' '500': description: Server error + /payment-request-syncada-files: + get: + produces: + - application/json + summary: List Payment Request EDI Files + description: Returns a list of Payment Request EDI files + operationId: indexPaymentRequestSyncadaFiles + tags: + - Payment Request Syncada Files + parameters: + - in: query + name: filter + type: string + - in: query + name: page + type: integer + - in: query + name: perPage + type: integer + - in: query + name: sort + type: string + - in: query + name: order + type: boolean + responses: + '200': + description: success + headers: + Content-Range: + type: string + description: Used for pagination + schema: + $ref: '#/definitions/PaymentRequestSyncadaFiles' + '400': + description: invalid request + '401': + description: request requires user authentication + '404': + description: Payment Request EDI Files not found + '500': + description: server error + /payment-request-syncada-files/{paymentRequestSyncadaFileId}: + get: + produces: + - application/json + summary: Payment Request EDI File + description: Returns a Payment Request EDI858 file + operationId: paymentRequestSyncadaFile + tags: + - Payment Request Syncada File + parameters: + - in: path + name: paymentRequestSyncadaFileId + type: string + format: uuid + required: true + - in: query + name: filter + type: string + - in: query + name: page + type: integer + - in: query + name: perPage + type: integer + - in: query + name: sort + type: string + - in: query + name: order + type: boolean + responses: + '200': + description: success + headers: + Content-Range: + type: string + description: Used for pagination + schema: + $ref: '#/definitions/PaymentRequestSyncadaFile' + '400': + description: invalid request + '401': + description: request requires user authentication + '404': + description: Payment Request EDI Files not found + '500': + description: server error