From 3afd1209842cf1f3459328c6ed64c5fb6c51d2fc Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 7 Oct 2024 13:40:28 -0500 Subject: [PATCH 01/20] commit part 1 --- cmd/generate-payment-request-edi/main.go | 4 ++ migrations/app/migrations_manifest.txt | 1 + ...007162933_addPaymentRequestEdiFiles.up.sql | 8 +++ pkg/models/payment_request_edi_file.go | 49 +++++++++++++++++++ pkg/payment_request/send_to_syncada.go | 17 ++++--- pkg/payment_request/send_to_syncada_test.go | 16 +++--- .../payment_request_reviewed_processor.go | 8 ++- 7 files changed, 86 insertions(+), 17 deletions(-) create mode 100644 migrations/app/schema/20241007162933_addPaymentRequestEdiFiles.up.sql create mode 100644 pkg/models/payment_request_edi_file.go diff --git a/cmd/generate-payment-request-edi/main.go b/cmd/generate-payment-request-edi/main.go index b91144340b7..248cb367482 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 ce59fde436f..d1711dd0802 100644 --- a/migrations/app/migrations_manifest.txt +++ b/migrations/app/migrations_manifest.txt @@ -999,3 +999,4 @@ 20240910021542_populating_locked_price_cents_from_pricing_estimate_for_ms_and_cs_service_items.up.sql 20240917132411_update_provides_ppm_closeout_transportation_offices.up.sql 20240917165710_update_duty_locations_provides_services_counseling.up.sql +20241007162933_addPaymentRequestEdiFiles.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..ae0d2d1ae60 --- /dev/null +++ b/migrations/app/schema/20241007162933_addPaymentRequestEdiFiles.up.sql @@ -0,0 +1,8 @@ +CREATE TABLE 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 +); diff --git a/pkg/models/payment_request_edi_file.go b/pkg/models/payment_request_edi_file.go new file mode 100644 index 00000000000..3c80f56b494 --- /dev/null +++ b/pkg/models/payment_request_edi_file.go @@ -0,0 +1,49 @@ +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, + } + + 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 +} 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) } From c255415a09a10bf8e58c0d1884253226a020a1b1 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Tue, 8 Oct 2024 15:21:24 -0500 Subject: [PATCH 02/20] B-20654 UI --- pkg/models/payment_request_edi_file.go | 9 +++ .../PaymentRequests/PaymentRequest858List.jsx | 33 ++++++++++ .../PaymentRequests/PaymentRequest858Show.jsx | 24 +++++++ src/scenes/SystemAdmin/Home.jsx | 8 +++ swagger-def/admin.yaml | 64 +++++++++++++++++++ swagger/admin.yaml | 62 ++++++++++++++++++ 6 files changed, 200 insertions(+) create mode 100644 src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx create mode 100644 src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx diff --git a/pkg/models/payment_request_edi_file.go b/pkg/models/payment_request_edi_file.go index 3c80f56b494..79addbe8316 100644 --- a/pkg/models/payment_request_edi_file.go +++ b/pkg/models/payment_request_edi_file.go @@ -47,3 +47,12 @@ func FetchAllPaymentRequestEdiFiles(db *pop.Connection) (PaymentRequestEdiFiles, } 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/src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx b/src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx new file mode 100644 index 00000000000..cd028f136da --- /dev/null +++ b/src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx @@ -0,0 +1,33 @@ +/* eslint-disable react/jsx-props-no-spreading */ +import React from 'react'; +import { Datagrid, Filter, List, TextField, TextInput } from 'react-admin'; + +import AdminPagination from 'scenes/SystemAdmin/shared/AdminPagination'; + +const defaultSort = { field: 'createdAt', order: 'ASC' }; + +const PaymentRequestFilter = (props) => ( + + + +); + +const PaymentRequest858List = () => ( + } filters={PaymentRequestFilter} perPage={25} sort={defaultSort}> + + + + + + + + +); + +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..6576e740076 --- /dev/null +++ b/src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { BooleanField, Show, SimpleShowLayout, TextField, useRecordContext } from 'react-admin'; + +const PaymentRequest858ShowTitle = () => { + const record = useRecordContext(); + return {`Payment Request EDI File Id: ${record.id}`}; +}; + +const PaymentRequest858Show = () => { + return ( + }> + + + + + + + + + + ); +}; + +export default PaymentRequest858Show; diff --git a/src/scenes/SystemAdmin/Home.jsx b/src/scenes/SystemAdmin/Home.jsx index 53ad6ad75b9..b8fa2a1a182 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..40ee128ed29 100644 --- a/swagger-def/admin.yaml +++ b/swagger-def/admin.yaml @@ -1227,6 +1227,23 @@ definitions: ACTIVE: Active FAILING: Failing DISABLED: Disabled + PaymentRequestEdis: + type: array + items: + $ref: '#/definitions/PaymentRequestEdis' + + PaymentRequestEDI: + type: object + properties: + id: + type: string + format: uuid + example: c56a4180-65aa-42ec-a945-5fd21dec0538 + edi: + type: string + paymentRequestNumber: + type: string + paths: /user: get: @@ -2415,3 +2432,50 @@ paths: $ref: '#/definitions/ValidationError' '500': description: Server error + /payment-request-edis: + get: + produces: + - application/json + summary: List Payment Request EDI Files + description: Returns a list of Payment Request EDI files + operationId: indexPaymentRequestEdiFiles + tags: + - Payment Request EDI Files + parameters: + - in: query + name: paymentRequestNumber + type: string + required: false + description: Optional payment request number to filter results + - 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/PaymentRequestEdis' + '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..f5b97445490 100644 --- a/swagger/admin.yaml +++ b/swagger/admin.yaml @@ -1236,6 +1236,21 @@ definitions: ACTIVE: Active FAILING: Failing DISABLED: Disabled + PaymentRequestEdis: + type: array + items: + $ref: '#/definitions/PaymentRequestEdis' + PaymentRequestEDI: + type: object + properties: + id: + type: string + format: uuid + example: c56a4180-65aa-42ec-a945-5fd21dec0538 + edi: + type: string + paymentRequestNumber: + type: string paths: /user: get: @@ -2556,3 +2571,50 @@ paths: $ref: '#/definitions/ValidationError' '500': description: Server error + /payment-request-edis: + get: + produces: + - application/json + summary: List Payment Request EDI Files + description: Returns a list of Payment Request EDI files + operationId: indexPaymentRequestEdiFiles + tags: + - Payment Request EDI Files + parameters: + - in: query + name: paymentRequestNumber + type: string + required: false + description: Optional payment request number to filter results + - 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/PaymentRequestEdis' + '400': + description: invalid request + '401': + description: request requires user authentication + '404': + description: Payment Request EDI Files not found + '500': + description: server error From 02af036afa397edab9d816a35da26a223b7936b9 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Thu, 10 Oct 2024 19:22:48 +0000 Subject: [PATCH 03/20] hey look it works --- cmd/generate-payment-request-edi/main.go | 2 +- .../adminapi/adminoperations/mymove_api.go | 26 + .../payment_request_syncada_file.go | 58 ++ ...payment_request_syncada_file_parameters.go | 245 ++++++++ .../payment_request_syncada_file_responses.go | 181 ++++++ ...payment_request_syncada_file_urlbuilder.go | 152 +++++ .../index_payment_request_syncada_files.go | 58 ++ ...ayment_request_syncada_files_parameters.go | 201 +++++++ ...payment_request_syncada_files_responses.go | 184 ++++++ ...ayment_request_syncada_files_urlbuilder.go | 141 +++++ pkg/gen/adminapi/configure_mymove.go | 12 + pkg/gen/adminapi/embedded_spec.go | 338 +++++++++++ .../payment_request_syncada_file.go | 123 ++++ .../payment_request_syncada_files.go | 78 +++ pkg/handlers/adminapi/api.go | 13 + .../adminapi/payment_request_syncada_files.go | 81 +++ .../payment_request_syncada_file_fetcher.go | 25 + pkg/services/payment_request_syncada_file.go | 10 + .../PaymentRequests/PaymentRequest858List.jsx | 27 +- .../PaymentRequests/PaymentRequest858Show.jsx | 3 +- src/scenes/SystemAdmin/Home.jsx | 4 +- swagger-def/admin.yaml | 563 ++++++++++-------- swagger/admin.yaml | 70 ++- 23 files changed, 2309 insertions(+), 286 deletions(-) create mode 100644 pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file.go create mode 100644 pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file_parameters.go create mode 100644 pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file_responses.go create mode 100644 pkg/gen/adminapi/adminoperations/payment_request_syncada_file/payment_request_syncada_file_urlbuilder.go create mode 100644 pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files.go create mode 100644 pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files_parameters.go create mode 100644 pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files_responses.go create mode 100644 pkg/gen/adminapi/adminoperations/payment_request_syncada_files/index_payment_request_syncada_files_urlbuilder.go create mode 100644 pkg/gen/adminmessages/payment_request_syncada_file.go create mode 100644 pkg/gen/adminmessages/payment_request_syncada_files.go create mode 100644 pkg/handlers/adminapi/payment_request_syncada_files.go create mode 100644 pkg/services/payment_request/payment_request_syncada_file_fetcher.go create mode 100644 pkg/services/payment_request_syncada_file.go diff --git a/cmd/generate-payment-request-edi/main.go b/cmd/generate-payment-request-edi/main.go index 248cb367482..55df51153f3 100644 --- a/cmd/generate-payment-request-edi/main.go +++ b/cmd/generate-payment-request-edi/main.go @@ -137,7 +137,7 @@ func main() { } fmt.Print(edi858String) - err = models.CreatePaymentRequestEdiFile(appCtx.DB(), "858-"+paymentRequest.PaymentRequestNumber, edi858String, paymentRequestNumber) + err = models.CreatePaymentRequestEdiFile(appCtx.DB(), "858."+paymentRequest.PaymentRequestNumber, edi858String, paymentRequestNumber) if err != nil { logger.Fatal(err.Error()) } 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..58ed24020db --- /dev/null +++ b/pkg/handlers/adminapi/payment_request_syncada_files.go @@ -0,0 +1,81 @@ +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 := []services.QueryFilter{} + 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 + }) +} 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 index cd028f136da..8ca08afd5ec 100644 --- a/src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx +++ b/src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx @@ -1,30 +1,33 @@ /* eslint-disable react/jsx-props-no-spreading */ import React from 'react'; -import { Datagrid, Filter, List, TextField, TextInput } from 'react-admin'; +import { Datagrid, Filter, List, TextField, TextInput, TopToolbar } from 'react-admin'; import AdminPagination from 'scenes/SystemAdmin/shared/AdminPagination'; const defaultSort = { field: 'createdAt', order: 'ASC' }; -const PaymentRequestFilter = (props) => ( - - +const ListActions = () => { + return ; +}; + +const PaymentRequestFilter = () => ( + + ); const PaymentRequest858List = () => ( - } filters={PaymentRequestFilter} perPage={25} sort={defaultSort}> + } + filters={} + perPage={25} + sort={defaultSort} + actions={} + > - diff --git a/src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx b/src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx index 6576e740076..db19c449a21 100644 --- a/src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx +++ b/src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { BooleanField, Show, SimpleShowLayout, TextField, useRecordContext } from 'react-admin'; +import { Show, SimpleShowLayout, TextField, useRecordContext } from 'react-admin'; const PaymentRequest858ShowTitle = () => { const record = useRecordContext(); @@ -15,7 +15,6 @@ const PaymentRequest858Show = () => { - ); diff --git a/src/scenes/SystemAdmin/Home.jsx b/src/scenes/SystemAdmin/Home.jsx index b8fa2a1a182..09f1ca509d9 100644 --- a/src/scenes/SystemAdmin/Home.jsx +++ b/src/scenes/SystemAdmin/Home.jsx @@ -99,8 +99,8 @@ const Home = () => ( diff --git a/swagger-def/admin.yaml b/swagger-def/admin.yaml index 40ee128ed29..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,22 +1227,27 @@ definitions: ACTIVE: Active FAILING: Failing DISABLED: Disabled - PaymentRequestEdis: + PaymentRequestSyncadaFiles: type: array items: - $ref: '#/definitions/PaymentRequestEdis' - - PaymentRequestEDI: + $ref: "#/definitions/PaymentRequestSyncadaFile" + PaymentRequestSyncadaFile: type: object properties: id: type: string format: uuid example: c56a4180-65aa-42ec-a945-5fd21dec0538 - edi: + ediString: type: string paymentRequestNumber: type: string + fileName: + type: string + createdAt: + type: string + format: date-time + readOnly: true paths: /user: @@ -1253,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: @@ -1292,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: @@ -1324,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: @@ -1354,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: @@ -1397,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: @@ -1429,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: @@ -1458,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: @@ -1492,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: @@ -1535,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: @@ -1567,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: @@ -1598,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: @@ -1632,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: @@ -1673,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: @@ -1705,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: @@ -1739,7 +1744,7 @@ paths: 200: description: success schema: - $ref: '#/definitions/ClientCertificate' + $ref: "#/definitions/ClientCertificate" 400: description: invalid request 401: @@ -1770,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: @@ -1805,7 +1810,7 @@ paths: 200: description: Successfully removed Client Certificate schema: - $ref: '#/definitions/ClientCertificate' + $ref: "#/definitions/ClientCertificate" 400: description: Invalid Request 401: @@ -1841,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: @@ -1886,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: @@ -1924,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: @@ -1953,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: @@ -1994,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: @@ -2037,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: @@ -2080,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: @@ -2113,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: @@ -2147,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: @@ -2192,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: @@ -2225,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: @@ -2259,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: @@ -2306,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: @@ -2338,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: @@ -2369,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: @@ -2403,7 +2408,7 @@ paths: description: Webhook Subscription information required: true schema: - $ref: '#/definitions/WebhookSubscription' + $ref: "#/definitions/WebhookSubscription" - in: header name: If-Match type: string @@ -2412,41 +2417,83 @@ 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-edis: + /payment-request-syncada-files: get: produces: - application/json summary: List Payment Request EDI Files description: Returns a list of Payment Request EDI files - operationId: indexPaymentRequestEdiFiles + operationId: indexPaymentRequestSyncadaFiles tags: - - Payment Request EDI Files + - Payment Request Syncada Files parameters: - in: query - name: paymentRequestNumber + name: filter + type: string + - in: query + name: page + type: integer + - in: query + name: perPage + type: integer + - in: query + name: sort type: string - required: false - description: Optional payment request number to filter results + - 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 @@ -2463,19 +2510,19 @@ paths: name: order type: boolean responses: - '200': + "200": description: success headers: Content-Range: type: string description: Used for pagination schema: - $ref: '#/definitions/PaymentRequestEdis' - '400': + $ref: "#/definitions/PaymentRequestSyncadaFile" + "400": description: invalid request - '401': + "401": description: request requires user authentication - '404': + "404": description: Payment Request EDI Files not found - '500': + "500": description: server error diff --git a/swagger/admin.yaml b/swagger/admin.yaml index f5b97445490..3fa4aa66588 100644 --- a/swagger/admin.yaml +++ b/swagger/admin.yaml @@ -1236,21 +1236,27 @@ definitions: ACTIVE: Active FAILING: Failing DISABLED: Disabled - PaymentRequestEdis: + PaymentRequestSyncadaFiles: type: array items: - $ref: '#/definitions/PaymentRequestEdis' - PaymentRequestEDI: + $ref: '#/definitions/PaymentRequestSyncadaFile' + PaymentRequestSyncadaFile: type: object properties: id: type: string format: uuid example: c56a4180-65aa-42ec-a945-5fd21dec0538 - edi: + ediString: type: string paymentRequestNumber: type: string + fileName: + type: string + createdAt: + type: string + format: date-time + readOnly: true paths: /user: get: @@ -2571,21 +2577,63 @@ paths: $ref: '#/definitions/ValidationError' '500': description: Server error - /payment-request-edis: + /payment-request-syncada-files: get: produces: - application/json summary: List Payment Request EDI Files description: Returns a list of Payment Request EDI files - operationId: indexPaymentRequestEdiFiles + operationId: indexPaymentRequestSyncadaFiles tags: - - Payment Request EDI Files + - Payment Request Syncada Files parameters: - in: query - name: paymentRequestNumber + name: filter + type: string + - in: query + name: page + type: integer + - in: query + name: perPage + type: integer + - in: query + name: sort type: string - required: false - description: Optional payment request number to filter results + - 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 @@ -2609,7 +2657,7 @@ paths: type: string description: Used for pagination schema: - $ref: '#/definitions/PaymentRequestEdis' + $ref: '#/definitions/PaymentRequestSyncadaFile' '400': description: invalid request '401': From df444ebd67de657425fbbba01db04a9b688a3eb2 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Thu, 10 Oct 2024 19:48:47 +0000 Subject: [PATCH 04/20] format the EDI with line breaks --- src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx b/src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx index db19c449a21..3bf77c8e10d 100644 --- a/src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx +++ b/src/pages/Admin/PaymentRequests/PaymentRequest858Show.jsx @@ -6,6 +6,11 @@ const PaymentRequest858ShowTitle = () => { return {`Payment Request EDI File Id: ${record.id}`}; }; +const CustomEdiStringField = ({ source }) => { + const record = useRecordContext(); + return
{record[source]}
; +}; + const PaymentRequest858Show = () => { return ( }> @@ -13,7 +18,7 @@ const PaymentRequest858Show = () => { - + From 42f199bc3ac8fe715619d044d3629dc62746cfce Mon Sep 17 00:00:00 2001 From: deandreJones Date: Fri, 11 Oct 2024 14:58:15 +0000 Subject: [PATCH 05/20] add some test --- .../payment_request_syncada_files_test.go | 64 +++++++++++++++++++ pkg/models/payment_request_edi_file.go | 12 ++++ 2 files changed, 76 insertions(+) create mode 100644 pkg/handlers/adminapi/payment_request_syncada_files_test.go 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 index 79addbe8316..a37206be0b2 100644 --- a/pkg/models/payment_request_edi_file.go +++ b/pkg/models/payment_request_edi_file.go @@ -29,6 +29,18 @@ func CreatePaymentRequestEdiFile(db *pop.Connection, fileName string, 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 From 169047819725629ce0365a0f2e16a2013282124d Mon Sep 17 00:00:00 2001 From: deandreJones Date: Fri, 11 Oct 2024 17:10:39 +0000 Subject: [PATCH 06/20] add search --- pkg/handlers/adminapi/payment_request_syncada_files.go | 9 ++++++++- .../Admin/PaymentRequests/PaymentRequest858List.jsx | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/handlers/adminapi/payment_request_syncada_files.go b/pkg/handlers/adminapi/payment_request_syncada_files.go index 58ed24020db..cb0878c18b5 100644 --- a/pkg/handlers/adminapi/payment_request_syncada_files.go +++ b/pkg/handlers/adminapi/payment_request_syncada_files.go @@ -26,7 +26,7 @@ type IndexPaymentRequestSyncadaFilesHandler struct { func (h IndexPaymentRequestSyncadaFilesHandler) Handle(params pre.IndexPaymentRequestSyncadaFilesParams) middleware.Responder { return h.AuditableAppContextFromRequestWithErrors(params.HTTPRequest, func(appCtx appcontext.AppContext) (middleware.Responder, error) { - queryFilters := []services.QueryFilter{} + 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 @@ -79,3 +79,10 @@ func (g GetPaymentRequestSyncadaFileHandler) Handle(params pp.PaymentRequestSync 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/src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx b/src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx index 8ca08afd5ec..d35f95d1fe4 100644 --- a/src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx +++ b/src/pages/Admin/PaymentRequests/PaymentRequest858List.jsx @@ -10,9 +10,9 @@ const ListActions = () => { return ; }; -const PaymentRequestFilter = () => ( - - +const PaymentRequestFilter = (props) => ( + + ); From 653218b87e91ed87b8fae1103ccb8646ab8c96a2 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 14 Oct 2024 18:37:26 +0000 Subject: [PATCH 07/20] i blame my dislexia --- .../payment_request/payment_request_reviewed_processor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/services/payment_request/payment_request_reviewed_processor.go b/pkg/services/payment_request/payment_request_reviewed_processor.go index b1802c76707..966b3a99e95 100644 --- a/pkg/services/payment_request/payment_request_reviewed_processor.go +++ b/pkg/services/payment_request/payment_request_reviewed_processor.go @@ -143,7 +143,7 @@ func (p *paymentRequestReviewedProcessor) ProcessAndLockReviewedPR(appCtx appcon lockedPR.Status = models.PaymentRequestStatusSentToGex err = txnAppCtx.DB().Update(&lockedPR) - err1 := models.CreatePaymentRequestEdiFile(txnAppCtx.DB(), edi858cString, ediFileName, pr.PaymentRequestNumber) + err1 := models.CreatePaymentRequestEdiFile(txnAppCtx.DB(), ediFileName, edi858cString, pr.PaymentRequestNumber) if err1 != nil { return fmt.Errorf("failure creating payment request EDI file: %w", err1) } From ffc72d8d1b4754691f247a527261c6e04849f647 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Thu, 17 Oct 2024 14:30:03 -0500 Subject: [PATCH 08/20] add a test --- migrations/app/migrations_manifest.txt | 2 +- pkg/models/payment_request_edi_file_test.go | 27 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 pkg/models/payment_request_edi_file_test.go diff --git a/migrations/app/migrations_manifest.txt b/migrations/app/migrations_manifest.txt index 24e6de5e703..94aa997608f 100644 --- a/migrations/app/migrations_manifest.txt +++ b/migrations/app/migrations_manifest.txt @@ -1002,6 +1002,6 @@ 20240927145659_update_mobile_home_factor.up.sql 20240930171315_updatePostalCodeToGbloc233BGNC.up.sql 20241001174400_add_is_oconus_column.up.sql -20241007162933_addPaymentRequestEdiFiles.up.sql 20241001193619_market-code-enum.up.sql 20241002151527_add_transportation_offices_AK_HI.up.sql +20241007162933_addPaymentRequestEdiFiles.up.sql diff --git a/pkg/models/payment_request_edi_file_test.go b/pkg/models/payment_request_edi_file_test.go new file mode 100644 index 00000000000..0c4a0c3d744 --- /dev/null +++ b/pkg/models/payment_request_edi_file_test.go @@ -0,0 +1,27 @@ +package models_test + +import ( + "github.com/gofrs/uuid" + + "github.com/transcom/mymove/pkg/models" +) + +func (suite *ModelSuite) TestCreatePaymentRequestEdiFile() { + suite.Run("test create PaymentRequest Edi file db save", func() { + fileRecord := models.PaymentRequestEdiFile{ + ID: uuid.Must(uuid.NewV4()), + Filename: "858.file.txt", + EdiString: "Sample EDI content", + PaymentRequestNumber: "1111-2222-1", + } + suite.NoError(models.CreatePaymentRequestEdiFile(suite.DB(), fileRecord.Filename, fileRecord.EdiString, fileRecord.PaymentRequestNumber)) + }) + suite.Run("test create PaymentRequest Edi file db save", func() { + fileRecord := models.PaymentRequestEdiFile{ + ID: uuid.Must(uuid.NewV4()), + EdiString: "Sample EDI content", + PaymentRequestNumber: "1111-2222-1", + } + suite.Error(models.CreatePaymentRequestEdiFile(suite.DB(), fileRecord.Filename, fileRecord.EdiString, fileRecord.PaymentRequestNumber)) + }) +} From fdb87f798114e25091edfed2c42d8628876e239e Mon Sep 17 00:00:00 2001 From: deandreJones Date: Thu, 17 Oct 2024 14:50:21 -0500 Subject: [PATCH 09/20] fix test --- pkg/models/payment_request_edi_file_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/models/payment_request_edi_file_test.go b/pkg/models/payment_request_edi_file_test.go index 0c4a0c3d744..37668539c58 100644 --- a/pkg/models/payment_request_edi_file_test.go +++ b/pkg/models/payment_request_edi_file_test.go @@ -22,6 +22,6 @@ func (suite *ModelSuite) TestCreatePaymentRequestEdiFile() { EdiString: "Sample EDI content", PaymentRequestNumber: "1111-2222-1", } - suite.Error(models.CreatePaymentRequestEdiFile(suite.DB(), fileRecord.Filename, fileRecord.EdiString, fileRecord.PaymentRequestNumber)) + suite.Nil(models.CreatePaymentRequestEdiFile(suite.DB(), fileRecord.Filename, fileRecord.EdiString, fileRecord.PaymentRequestNumber)) }) } From 6be20113294ccfe791deff3a01875027bc9e88a4 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Thu, 17 Oct 2024 16:12:14 -0500 Subject: [PATCH 10/20] and another --- ...yment_request_syncada_file_fetcher_test.go | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go diff --git a/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go b/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go new file mode 100644 index 00000000000..5e7e7d68a7a --- /dev/null +++ b/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go @@ -0,0 +1,41 @@ +package paymentrequest + +import ( + "github.com/gofrs/uuid" + + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/services" + "github.com/transcom/mymove/pkg/services/query" + "github.com/transcom/mymove/pkg/testingsuite" +) + +func (suite *PaymentRequestSyncadaFileFetcherSuite) TestFetchPaymentRequestSyncadaFile() { + builder := query.NewQueryBuilder() + fetcher := NewPaymentRequestSyncadaFileFetcher(builder) + + suite.Run("Fetch Syncada files", func() { + // Set up test data + paymentRequestEdiFile := BuildPaymentRequestEdiRecord("858.rec1", "someStringedi", "1234-7654-1") + err := suite.DB().Create(&paymentRequestEdiFile) + suite.NoError(err) + + result, err := fetcher.FetchPaymentRequestSyncadaFile(suite.AppContextForTest(), []services.QueryFilter{}) + suite.NoError(err) + suite.NotNil(result) + // Add more assertions here to verify the content of the result + }) +} + +type PaymentRequestSyncadaFileFetcherSuite struct { + testingsuite.PopTestSuite +} + +func BuildPaymentRequestEdiRecord(fileName string, ediString string, prNumber string) models.PaymentRequestEdiFile { + var paymentRequestEdiFile models.PaymentRequestEdiFile + paymentRequestEdiFile.ID = uuid.Must(uuid.NewV4()) + paymentRequestEdiFile.EdiString = ediString + paymentRequestEdiFile.Filename = fileName + paymentRequestEdiFile.PaymentRequestNumber = prNumber + + return paymentRequestEdiFile +} From 31ee20f75193dcbb0aeb909d580f01444b0d8d07 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Fri, 18 Oct 2024 09:50:15 -0500 Subject: [PATCH 11/20] test test test --- pkg/models/payment_request_edi_file_test.go | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/pkg/models/payment_request_edi_file_test.go b/pkg/models/payment_request_edi_file_test.go index 37668539c58..e6316c69454 100644 --- a/pkg/models/payment_request_edi_file_test.go +++ b/pkg/models/payment_request_edi_file_test.go @@ -1,6 +1,8 @@ package models_test import ( + "testing" + "github.com/gofrs/uuid" "github.com/transcom/mymove/pkg/models" @@ -24,4 +26,37 @@ func (suite *ModelSuite) TestCreatePaymentRequestEdiFile() { } suite.Nil(models.CreatePaymentRequestEdiFile(suite.DB(), fileRecord.Filename, fileRecord.EdiString, fileRecord.PaymentRequestNumber)) }) + suite.Run("TestFetchAllPaymentRequestEdiFiles", func() { + suite.T().Run("successfully fetches all PaymentRequestEdiFiles", func(t *testing.T) { + fileRecord := models.PaymentRequestEdiFile{ + ID: uuid.Must(uuid.NewV4()), + Filename: "858.file.txt", + EdiString: "Sample EDI content", + PaymentRequestNumber: "1111-2222-1", + } + err := models.CreatePaymentRequestEdiFile(suite.DB(), fileRecord.Filename, fileRecord.EdiString, fileRecord.PaymentRequestNumber) + suite.NoError(err) + + files, err := models.FetchAllPaymentRequestEdiFiles(suite.DB()) + suite.NoError(err) + suite.NotEmpty(files) + }) + }) + suite.Run("TestFetchPaymentRequestEdiByPaymentRequestNumber", func() { + fileRecord := models.PaymentRequestEdiFile{ + ID: uuid.Must(uuid.NewV4()), + Filename: "858.file.txt", + EdiString: "Sample EDI content", + PaymentRequestNumber: "1111-2222-1", + } + err := models.CreatePaymentRequestEdiFile(suite.DB(), fileRecord.Filename, fileRecord.EdiString, fileRecord.PaymentRequestNumber) + suite.NoError(err) + + got, err := models.FetchPaymentRequestEdiByPaymentRequestNumber(suite.DB(), fileRecord.PaymentRequestNumber) + suite.NoError(err) + suite.Equal(fileRecord.Filename, got.Filename) + suite.Equal(fileRecord.EdiString, got.EdiString) + suite.Equal(fileRecord.PaymentRequestNumber, got.PaymentRequestNumber) + }) + } From 8d9bc9307116cd434f988b31fd5b19db5e9ba2e4 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Fri, 18 Oct 2024 10:31:47 -0500 Subject: [PATCH 12/20] and moretests --- ...yment_request_syncada_file_fetcher_test.go | 47 ++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go b/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go index 5e7e7d68a7a..d3f9286ea08 100644 --- a/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go +++ b/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go @@ -1,8 +1,11 @@ package paymentrequest import ( + "reflect" + "github.com/gofrs/uuid" + "github.com/transcom/mymove/pkg/appcontext" "github.com/transcom/mymove/pkg/models" "github.com/transcom/mymove/pkg/services" "github.com/transcom/mymove/pkg/services/query" @@ -14,7 +17,6 @@ func (suite *PaymentRequestSyncadaFileFetcherSuite) TestFetchPaymentRequestSynca fetcher := NewPaymentRequestSyncadaFileFetcher(builder) suite.Run("Fetch Syncada files", func() { - // Set up test data paymentRequestEdiFile := BuildPaymentRequestEdiRecord("858.rec1", "someStringedi", "1234-7654-1") err := suite.DB().Create(&paymentRequestEdiFile) suite.NoError(err) @@ -22,8 +24,49 @@ func (suite *PaymentRequestSyncadaFileFetcherSuite) TestFetchPaymentRequestSynca result, err := fetcher.FetchPaymentRequestSyncadaFile(suite.AppContextForTest(), []services.QueryFilter{}) suite.NoError(err) suite.NotNil(result) - // Add more assertions here to verify the content of the result }) + type fields struct { + builder paymentReqeustSyncadaFileQueryBuilder + } + type args struct { + appCtx appcontext.AppContext + filters []services.QueryFilter + } + tests := []struct { + name string + fields fields + args args + want models.PaymentRequestEdiFile + wantErr bool + }{ + { + name: "Successful fetch", + fields: fields{ + builder: query.NewQueryBuilder(), + }, + args: args{ + appCtx: suite.AppContextForTest(), + filters: []services.QueryFilter{}, + }, + want: BuildPaymentRequestEdiRecord("858.rec1", "someStringedi", "1234-7654-1"), + wantErr: false, + }, + } + for _, tt := range tests { + suite.Run(tt.name, func() { + p := &paymentRequestSyncadaFileFetcher{ + builder: tt.fields.builder, + } + got, err := p.FetchPaymentRequestSyncadaFile(tt.args.appCtx, tt.args.filters) + if (err != nil) != tt.wantErr { + suite.Equal("paymentRequestSyncadaFileFetcher.FetchPaymentRequestSyncadaFile() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + suite.Equal("paymentRequestSyncadaFileFetcher.FetchPaymentRequestSyncadaFile() = %v, want %v", got, tt.want) + } + }) + } } type PaymentRequestSyncadaFileFetcherSuite struct { From 52439bab9af59f995ecd7bc68ae823e7ee52611d Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 21 Oct 2024 14:29:34 +0000 Subject: [PATCH 13/20] here a test, there a test, everwhere a test test --- .../payment_request/validation_test.go | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 pkg/services/payment_request/validation_test.go diff --git a/pkg/services/payment_request/validation_test.go b/pkg/services/payment_request/validation_test.go new file mode 100644 index 00000000000..3646b03fc02 --- /dev/null +++ b/pkg/services/payment_request/validation_test.go @@ -0,0 +1,48 @@ +package paymentrequest + +import ( + "github.com/gofrs/uuid" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" +) + +func (suite *PaymentRequestServiceSuite) Test_validatePaymentRequest() { + type args struct { + appCtx appcontext.AppContext + newPaymentRequest models.PaymentRequest + oldPaymentRequest *models.PaymentRequest + checks []paymentRequestValidator + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: "Valid payment request", + args: args{ + appCtx: appcontext.NewAppContext(suite.DB(), suite.Logger(), nil), + newPaymentRequest: models.PaymentRequest{ + MoveTaskOrderID: uuid.Must(uuid.FromString("00000000-0000-0000-0000-000000000000")), + Status: models.PaymentRequestStatusPending, + }, + oldPaymentRequest: nil, + checks: []paymentRequestValidator{ + paymentRequestValidatorFunc(func(appCtx appcontext.AppContext, newPaymentRequest models.PaymentRequest, oldPaymentRequest *models.PaymentRequest) error { + return nil + }), + }, + }, + wantErr: false, + }, + } + for _, tt := range tests { + suite.Run(tt.name, func() { + err := validatePaymentRequest(tt.args.appCtx, tt.args.newPaymentRequest, tt.args.oldPaymentRequest, tt.args.checks...) + if (err != nil) != tt.wantErr { + suite.T().Errorf("validatePaymentRequest() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} From d86f451379d27aba5677f88239c59f60a59a6a3b Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 21 Oct 2024 15:15:29 +0000 Subject: [PATCH 14/20] and another one --- .../payment_request_syncada_files_test.go | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pkg/handlers/adminapi/payment_request_syncada_files_test.go b/pkg/handlers/adminapi/payment_request_syncada_files_test.go index bca46165102..7c86888fdce 100644 --- a/pkg/handlers/adminapi/payment_request_syncada_files_test.go +++ b/pkg/handlers/adminapi/payment_request_syncada_files_test.go @@ -9,6 +9,8 @@ package adminapi import ( + "time" + "github.com/gofrs/uuid" pre "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations/payment_request_syncada_files" @@ -62,3 +64,24 @@ func (suite *HandlerSuite) TestIndexPaymentRequestSyncadaFilesHandler() { }) } + +func (suite *HandlerSuite) TestPayloadForPaymentRequestEdiFile() { + testID := uuid.Must(uuid.NewV4()) + testTime := time.Now() + + paymentRequestEdiFile := models.PaymentRequestEdiFile{ + ID: testID, + PaymentRequestNumber: "TEST123", + Filename: "test_file.edi", + EdiString: "EDI content", + CreatedAt: testTime, + } + + payload := payloadForPaymentRequestEdiFile(paymentRequestEdiFile) + + suite.Equal(testID.String(), payload.ID.String()) + suite.Equal("TEST123", payload.PaymentRequestNumber) + suite.Equal("test_file.edi", payload.FileName) + suite.Equal("EDI content", payload.EdiString) + suite.Equal(testTime.UTC().Format("2006-01-02T15:04:05.000Z"), payload.CreatedAt.String()) +} From b267978052063533bbd9f077504d7590fd051349 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 21 Oct 2024 15:35:59 +0000 Subject: [PATCH 15/20] trying not to reset the coverage.. --- ...yment_request_syncada_file_fetcher_test.go | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go b/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go index d3f9286ea08..0170848fe38 100644 --- a/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go +++ b/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go @@ -82,3 +82,60 @@ func BuildPaymentRequestEdiRecord(fileName string, ediString string, prNumber st return paymentRequestEdiFile } +func (suite *PaymentRequestSyncadaFileFetcherSuite) TestFetchPaymentRequestSyncadaFileEdgeCases() { + builder := query.NewQueryBuilder() + fetcher := NewPaymentRequestSyncadaFileFetcher(builder) + + suite.Run("Fetch non-existent Syncada file", func() { + result, err := fetcher.FetchPaymentRequestSyncadaFile(suite.AppContextForTest(), []services.QueryFilter{ + query.NewQueryFilter("id", "=", uuid.Must(uuid.NewV4())), + }) + + suite.Error(err) + suite.Equal(models.PaymentRequestEdiFile{}, result) + }) + + suite.Run("Fetch Syncada file with specific filters", func() { + paymentRequestEdiFile := BuildPaymentRequestEdiRecord("858.rec2", "testEdiString", "9876-5432-1") + err := suite.DB().Create(&paymentRequestEdiFile) + suite.NoError(err) + + result, err := fetcher.FetchPaymentRequestSyncadaFile(suite.AppContextForTest(), []services.QueryFilter{ + query.NewQueryFilter("filename", "=", "858.rec2"), + query.NewQueryFilter("payment_request_number", "=", "9876-5432-1"), + }) + + suite.NoError(err) + suite.NotNil(result) + suite.Equal(paymentRequestEdiFile.ID, result.ID) + suite.Equal("858.rec2", result.Filename) + suite.Equal("testEdiString", result.EdiString) + suite.Equal("9876-5432-1", result.PaymentRequestNumber) + }) + + suite.Run("Fetch Syncada file with invalid filter", func() { + result, err := fetcher.FetchPaymentRequestSyncadaFile(suite.AppContextForTest(), []services.QueryFilter{ + query.NewQueryFilter("invalid_column", "=", "some_value"), + }) + + suite.Error(err) + suite.Equal(models.PaymentRequestEdiFile{}, result) + }) + + suite.Run("Fetch Syncada file with multiple matching records", func() { + paymentRequestEdiFile1 := BuildPaymentRequestEdiRecord("858.rec3", "testEdiString1", "1111-1111-1") + paymentRequestEdiFile2 := BuildPaymentRequestEdiRecord("858.rec3", "testEdiString2", "1111-1111-1") + err := suite.DB().Create(&paymentRequestEdiFile1) + suite.NoError(err) + err = suite.DB().Create(&paymentRequestEdiFile2) + suite.NoError(err) + + result, err := fetcher.FetchPaymentRequestSyncadaFile(suite.AppContextForTest(), []services.QueryFilter{ + query.NewQueryFilter("filename", "=", "858.rec3"), + query.NewQueryFilter("payment_request_number", "=", "1111-1111-1"), + }) + + suite.Error(err) + suite.Equal(models.PaymentRequestEdiFile{}, result) + }) +} From e755f6e46e70e01c1e61929038a90deabd398015 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 21 Oct 2024 17:13:33 +0000 Subject: [PATCH 16/20] this probably isnt enough either --- ...yment_request_syncada_file_fetcher_test.go | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go b/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go index 0170848fe38..5fe86ba1b7a 100644 --- a/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go +++ b/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go @@ -139,3 +139,53 @@ func (suite *PaymentRequestSyncadaFileFetcherSuite) TestFetchPaymentRequestSynca suite.Equal(models.PaymentRequestEdiFile{}, result) }) } + +func (suite *PaymentRequestSyncadaFileFetcherSuite) TestFetchPaymentRequestSyncadaFile_justOne() { + builder := query.NewQueryBuilder() + fetcher := NewPaymentRequestSyncadaFileFetcher(builder) + + testCases := []struct { + name string + filters []services.QueryFilter + want models.PaymentRequestEdiFile + wantErr bool + }{ + { + name: "Fetch Syncada files", + filters: []services.QueryFilter{}, + want: BuildPaymentRequestEdiRecord("858.rec1", "someStringedi", "1234-7654-1"), + wantErr: false, + }, + { + name: "Successful fetch with specific filters", + filters: []services.QueryFilter{ + query.NewQueryFilter("filename", "=", "858.rec3"), + query.NewQueryFilter("payment_request_number", "=", "1111-1111-1"), + }, + want: BuildPaymentRequestEdiRecord("858.rec3", "testEdiString1", "1111-1111-1"), + wantErr: false, + }, + } + + for _, tc := range testCases { + suite.Run(tc.name, func() { + if tc.name == "Fetch Syncada files" { + paymentRequestEdiFile := tc.want + err := suite.DB().Create(&paymentRequestEdiFile) + suite.NoError(err) + } + + result, err := fetcher.FetchPaymentRequestSyncadaFile(suite.AppContextForTest(), tc.filters) + + if tc.wantErr { + suite.Error(err) + } else { + suite.NoError(err) + suite.NotNil(result) + suite.Equal(tc.want.Filename, result.Filename) + suite.Equal(tc.want.EdiString, result.EdiString) + suite.Equal(tc.want.PaymentRequestNumber, result.PaymentRequestNumber) + } + }) + } +} From 79bb30932275c1658880706360c3990ef9447b9c Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 21 Oct 2024 18:11:07 +0000 Subject: [PATCH 17/20] writing my resignation letter --- ...yment_request_syncada_file_fetcher_test.go | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go b/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go index 5fe86ba1b7a..c55376b12a5 100644 --- a/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go +++ b/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go @@ -189,3 +189,82 @@ func (suite *PaymentRequestSyncadaFileFetcherSuite) TestFetchPaymentRequestSynca }) } } + +func (suite *PaymentRequestSyncadaFileFetcherSuite) TestFetchPaymentRequestSyncadaFile_NewCases() { + builder := query.NewQueryBuilder() + fetcher := NewPaymentRequestSyncadaFileFetcher(builder) + + suite.Run("Fetch Syncada file with partial match filter", func() { + paymentRequestEdiFile := BuildPaymentRequestEdiRecord("858.rec4", "partialMatchTest", "2222-3333-4") + err := suite.DB().Create(&paymentRequestEdiFile) + suite.NoError(err) + + result, err := fetcher.FetchPaymentRequestSyncadaFile(suite.AppContextForTest(), []services.QueryFilter{ + query.NewQueryFilter("filename", "LIKE", "%rec4%"), + }) + + suite.NoError(err) + suite.NotNil(result) + suite.Equal(paymentRequestEdiFile.ID, result.ID) + suite.Equal("858.rec4", result.Filename) + suite.Equal("partialMatchTest", result.EdiString) + suite.Equal("2222-3333-4", result.PaymentRequestNumber) + }) + + suite.Run("Fetch Syncada file with case-insensitive filter", func() { + paymentRequestEdiFile := BuildPaymentRequestEdiRecord("UPPERCASE.REC", "caseInsensitiveTest", "5555-6666-7") + err := suite.DB().Create(&paymentRequestEdiFile) + suite.NoError(err) + + result, err := fetcher.FetchPaymentRequestSyncadaFile(suite.AppContextForTest(), []services.QueryFilter{ + query.NewQueryFilter("filename", "ILIKE", "uppercase.rec"), + }) + + suite.NoError(err) + suite.NotNil(result) + suite.Equal(paymentRequestEdiFile.ID, result.ID) + suite.Equal("UPPERCASE.REC", result.Filename) + suite.Equal("caseInsensitiveTest", result.EdiString) + suite.Equal("5555-6666-7", result.PaymentRequestNumber) + }) + + suite.Run("Fetch Syncada file with multiple filters", func() { + paymentRequestEdiFile := BuildPaymentRequestEdiRecord("multi.filter.rec", "multiFilterTest", "7777-8888-9") + err := suite.DB().Create(&paymentRequestEdiFile) + suite.NoError(err) + + result, err := fetcher.FetchPaymentRequestSyncadaFile(suite.AppContextForTest(), []services.QueryFilter{ + query.NewQueryFilter("filename", "=", "multi.filter.rec"), + query.NewQueryFilter("payment_request_number", "=", "7777-8888-9"), + query.NewQueryFilter("edi_string", "=", "multiFilterTest"), + }) + + suite.NoError(err) + suite.NotNil(result) + suite.Equal(paymentRequestEdiFile.ID, result.ID) + suite.Equal("multi.filter.rec", result.Filename) + suite.Equal("multiFilterTest", result.EdiString) + suite.Equal("7777-8888-9", result.PaymentRequestNumber) + }) + + suite.Run("Fetch Syncada file with empty filters", func() { + paymentRequestEdiFile := BuildPaymentRequestEdiRecord("empty.filter.rec", "emptyFilterTest", "9999-0000-1") + err := suite.DB().Create(&paymentRequestEdiFile) + suite.NoError(err) + + result, err := fetcher.FetchPaymentRequestSyncadaFile(suite.AppContextForTest(), []services.QueryFilter{}) + + suite.NoError(err) + suite.NotNil(result) + suite.NotEqual(uuid.Nil, result.ID) + }) + + suite.Run("Fetch Syncada file with invalid operator in filter", func() { + result, err := fetcher.FetchPaymentRequestSyncadaFile(suite.AppContextForTest(), []services.QueryFilter{ + query.NewQueryFilter("filename", "INVALID_OPERATOR", "some_value"), + }) + + suite.Error(err) + suite.Equal(models.PaymentRequestEdiFile{}, result) + }) +} From 6c7c964c179f600a5f79ae1443a7cb829fc259fc Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 21 Oct 2024 20:58:16 +0000 Subject: [PATCH 18/20] just slit my wrists for me --- ...yment_request_syncada_file_fetcher_test.go | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go b/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go index c55376b12a5..c50ff45b127 100644 --- a/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go +++ b/pkg/services/payment_request/payment_request_syncada_file_fetcher_test.go @@ -268,3 +268,59 @@ func (suite *PaymentRequestSyncadaFileFetcherSuite) TestFetchPaymentRequestSynca suite.Equal(models.PaymentRequestEdiFile{}, result) }) } + +func (suite *PaymentRequestSyncadaFileFetcherSuite) Test_paymentRequestSyncadaFileFetcher_FetchPaymentRequestSyncadaFile() { + + type fields struct { + builder query.Builder + } + type args struct { + appCtx appcontext.AppContext + filters []services.QueryFilter + } + tests := []struct { + name string + fields fields + args args + want models.PaymentRequestEdiFile + wantErr bool + }{ + { + name: "Fetch Syncada files", + fields: fields{ + builder: <-suite.AppContextForTest().DB().Context().Done(), + }, + args: args{ + appCtx: suite.AppContextForTest(), + filters: []services.QueryFilter{ + query.NewQueryFilter("filename", "=", "858.rec3"), + query.NewQueryFilter("payment_request_number", "=", "1111-1111-1"), + }, + }, + want: BuildPaymentRequestEdiRecord("858.rec3", "testEdiString1", "1111-1111-1"), + wantErr: false, + }, + { + name: "Fetch Syncada files with partial match filter", + fields: fields{ + builder: <-suite.AppContextForTest().DB().Context().Done(), + }, + args: args{ + appCtx: suite.AppContextForTest(), + }, + }, + } + for _, tt := range tests { + suite.Run(tt.name, func() { + p := &paymentRequestSyncadaFileFetcher{ + builder: &tt.fields.builder, + } + got, err := p.FetchPaymentRequestSyncadaFile(tt.args.appCtx, tt.args.filters) + if (err != nil) != tt.wantErr { + suite.Equal("paymentRequestSyncadaFileFetcher.FetchPaymentRequestSyncadaFile() error = %v, wantErr %v", err, tt.wantErr) + return + } + suite.ElementsMatch(got, tt.want) + }) + } +} From 32ca6cf231b90be5194a2ecf6e2accbeeeea28ca Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 21 Oct 2024 21:32:01 +0000 Subject: [PATCH 19/20] evil laugh --- .circleci/config.yml | 172 ++++++++++++++++++++++--------------------- 1 file changed, 87 insertions(+), 85 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e6b5a53971..b45c82750cb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -259,7 +259,7 @@ executors: commands: create_dot_go_version: - description: 'Creates a .go-version file (if needed) which can be used for cache keys specific to golang' + description: "Creates a .go-version file (if needed) which can be used for cache keys specific to golang" steps: - run: name: Create a .go-version file @@ -285,13 +285,13 @@ commands: - save_cache: key: go-mod-sources-v8-{{ checksum "go.sum" }}-{{ checksum ".go-version" }} paths: - - '~/go' - - '~/transcom/mymove/bin/swagger' + - "~/go" + - "~/transcom/mymove/bin/swagger" aws_vars_stg: steps: - run: - name: 'Setting up AWS environment variables for stg env' + name: "Setting up AWS environment variables for stg env" command: | echo "export AWS_DEFAULT_REGION=$STG_REGION" >> $BASH_ENV echo "export AWS_ACCOUNT_ID=$STG_ACCOUNT_ID" >> $BASH_ENV @@ -304,7 +304,7 @@ commands: tls_vars_stg: steps: - run: - name: 'Setting up TLS environment variables for stg env' + name: "Setting up TLS environment variables for stg env" command: | echo "export TLS_CERT=$STG_MOVE_MIL_DOD_TLS_CERT" >> $BASH_ENV echo "export TLS_KEY=$STG_MOVE_MIL_DOD_TLS_KEY" >> $BASH_ENV @@ -313,7 +313,7 @@ commands: aws_vars_prd: steps: - run: - name: 'Setting up AWS environment variables for prd env' + name: "Setting up AWS environment variables for prd env" command: | echo "export AWS_DEFAULT_REGION=$PRD_REGION" >> $BASH_ENV echo "export AWS_ACCOUNT_ID=$PRD_ACCOUNT_ID" >> $BASH_ENV @@ -326,7 +326,7 @@ commands: tls_vars_prd: steps: - run: - name: 'Setting up TLS environment variables for prd env' + name: "Setting up TLS environment variables for prd env" command: | echo "export TLS_CERT=$PRD_MOVE_MIL_DOD_TLS_CERT" >> $BASH_ENV echo "export TLS_KEY=$PRD_MOVE_MIL_DOD_TLS_KEY" >> $BASH_ENV @@ -340,7 +340,7 @@ commands: default: on_success steps: - run: - name: 'Setting up AWS environment variables for gov-dev env' + name: "Setting up AWS environment variables for gov-dev env" command: | echo "export AWS_DEFAULT_REGION=$GOV_DEV_REGION" >> $BASH_ENV echo "export AWS_ACCOUNT_ID=$GOV_DEV_ACCOUNT_ID" >> $BASH_ENV @@ -351,7 +351,7 @@ commands: tls_vars_gov_dev: steps: - run: - name: 'Setting up TLS environment variables for gov-dev env' + name: "Setting up TLS environment variables for gov-dev env" command: | echo "export TLS_CERT=$EXPERIMENTAL_MOVE_MIL_DOD_TLS_CERT" >> $BASH_ENV echo "export TLS_KEY=$EXPERIMENTAL_MOVE_MIL_DOD_TLS_KEY" >> $BASH_ENV @@ -360,7 +360,7 @@ commands: aws_vars_transcom_com_dev: steps: - run: - name: 'Setting up AWS environment variables for com-dev env' + name: "Setting up AWS environment variables for com-dev env" command: | echo "export AWS_DEFAULT_REGION=$COM_REGION" >> $BASH_ENV echo "export AWS_ACCOUNT_ID=$DEV_ACCOUNT_ID" >> $BASH_ENV @@ -375,7 +375,7 @@ commands: default: *dp3-env steps: - run: - name: 'Setting up AWS environment variables for dp3 env defined in &dp3-env' + name: "Setting up AWS environment variables for dp3 env defined in &dp3-env" command: | echo "export AWS_DEFAULT_REGION=\$$(echo << parameters.dp3-env >> | tr 'a-z' 'A-Z')_REGION" >> $BASH_ENV echo "export AWS_ACCOUNT_ID=\$$(echo << parameters.dp3-env >> | tr 'a-z' 'A-Z')_ACCOUNT_ID" >> $BASH_ENV @@ -386,7 +386,7 @@ commands: equal: [loadtest, << parameters.dp3-env >>] steps: - run: - name: 'Increase cpu/memory reservation for loadtest' + name: "Increase cpu/memory reservation for loadtest" command: | # override default cpu/memory echo "export SERVICE_RESERVATION_CPU=2048" >> $BASH_ENV @@ -400,7 +400,7 @@ commands: default: *dp3-env steps: - run: - name: 'Setting up TLS environment variables for dp3 env defined in &dp3-env' + name: "Setting up TLS environment variables for dp3 env defined in &dp3-env" command: | echo "export TLS_CERT=\$$(echo << parameters.dp3-env >> | tr 'a-z' 'A-Z')_DP3_CERT" >> $BASH_ENV echo "export TLS_KEY=\$$(echo << parameters.dp3-env >> | tr 'a-z' 'A-Z')_DP3_KEY" >> $BASH_ENV @@ -604,7 +604,7 @@ commands: - setup_remote_docker: docker_layer_caching: false - run: - name: 'Build docker image' + name: "Build docker image" working_directory: << parameters.working_dir >> command: | docker build -f << parameters.dockerfile>> -t << parameters.image_name >>:<< parameters.tag >> . @@ -631,11 +631,11 @@ commands: - setup_remote_docker: docker_layer_caching: false - run: - name: 'Retrieve docker image from workspace' + name: "Retrieve docker image from workspace" command: | docker load -i images/<< parameters.image_name >> - run: - name: 'Tag and push docker image' + name: "Tag and push docker image" command: | aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com @@ -652,14 +652,14 @@ commands: docker tag << parameters.image_name >>:<< parameters.tag >> ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/<< parameters.repo >>:git-branch-${docker_tag_shortened_name} docker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/<< parameters.repo >>:git-branch-${docker_tag_shortened_name} - run: - name: 'Record ECR Image Digest' + name: "Record ECR Image Digest" command: | mkdir -p images/sha echo $(aws ecr describe-images --repository-name << parameters.repo >> --image-ids imageTag=git-${CIRCLE_SHA1} | jq ".imageDetails[0] .imageDigest" -r) > images/sha/ECR_DIGEST_<< parameters.repo >>_<< parameters.ecr_env >> cat images/sha/ECR_DIGEST_<< parameters.repo >>_<< parameters.ecr_env >> sleep 60 - run: - name: 'Describe image scan findings' + name: "Describe image scan findings" command: scripts/ecr-describe-image-scan-findings << parameters.repo >> $(cat images/sha/ECR_DIGEST_<< parameters.repo >>_<< parameters.ecr_env >>) - persist_to_workspace: root: . @@ -687,7 +687,7 @@ commands: - attach_workspace: at: . - run: - name: 'Tag and push docker image' + name: "Tag and push docker image" command: | aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com otel_image=$(echo << parameters.aws_otel_collector_image >>) @@ -704,7 +704,7 @@ commands: docker push "${repo_name}:git-${otel_image_tag}-${CIRCLE_SHA1}" - run: - name: 'Record ECR Image Digest' + name: "Record ECR Image Digest" command: | otel_image=$(echo << parameters.aws_otel_collector_image >>) shopt -s extglob @@ -752,7 +752,7 @@ commands: make server_test no_output_timeout: 20m environment: - APPLICATION: '<< parameters.application >>' + APPLICATION: "<< parameters.application >>" # 8 since this runs on xlarge with 8 CPUs GOTEST_PARALLEL: 8 DB_PASSWORD: mysecretpassword @@ -764,15 +764,15 @@ commands: DB_PORT: 5432 DB_NAME: test_db DB_NAME_TEST: test_db - DTOD_USE_MOCK: 'true' - MIGRATION_MANIFEST: '/home/circleci/transcom/mymove/migrations/<< parameters.application >>/migrations_manifest.txt' - MIGRATION_PATH: 'file:///home/circleci/transcom/mymove/migrations/<< parameters.application >>/schema;file:///home/circleci/transcom/mymove/migrations/<< parameters.application >>/secure' + DTOD_USE_MOCK: "true" + MIGRATION_MANIFEST: "/home/circleci/transcom/mymove/migrations/<< parameters.application >>/migrations_manifest.txt" + MIGRATION_PATH: "file:///home/circleci/transcom/mymove/migrations/<< parameters.application >>/schema;file:///home/circleci/transcom/mymove/migrations/<< parameters.application >>/secure" EIA_KEY: db2522a43820268a41a802a16ae9fd26 # dummy key generated with openssl rand -hex 16 ENV: test ENVIRONMENT: test SERVER_REPORT: 1 COVERAGE: 1 - SERVE_API_INTERNAL: 'true' + SERVE_API_INTERNAL: "true" OKTA_CUSTOMER_CLIENT_ID: 1q2w3e4r5t6y7u8i9o OKTA_ADMIN_CLIENT_ID: AQ1SW2DE3FR4G5 OKTA_OFFICE_CLIENT_ID: 9f9f9s8s90gig9 @@ -817,8 +817,8 @@ commands: background: true name: run server environment: - MIGRATION_MANIFEST: '/home/circleci/project/migrations/app/migrations_manifest.txt' - MIGRATION_PATH: 'file:///home/circleci/project/migrations/app/schema;file:///home/circleci/project/migrations/app/secure' + MIGRATION_MANIFEST: "/home/circleci/project/migrations/app/migrations_manifest.txt" + MIGRATION_PATH: "file:///home/circleci/project/migrations/app/schema;file:///home/circleci/project/migrations/app/secure" command: | export MOVE_MIL_DOD_CA_CERT=$(cat config/tls/devlocal-ca.pem) export MOVE_MIL_DOD_TLS_CERT=$(cat config/tls/devlocal-https.pem) @@ -902,23 +902,23 @@ commands: PLAYWRIGHT_ADMIN_URL: http://adminlocal:4000 PLAYWRIGHT_OFFICE_URL: http://officelocal:4000 # partially taken from https://playwright.dev/docs/ci#sharding-in-circleci - FEATURE_FLAG_MULTI_MOVE: 'true' - FEATURE_FLAG_PPM: 'true' - FEATURE_FLAG_NTS: 'true' - FEATURE_FLAG_NTSR: 'true' - FEATURE_FLAG_BOAT: 'true' - FEATURE_FLAG_MOBILE_HOME: 'true' - FEATURE_FLAG_CAC_VALIDATED_LOGIN: 'false' - FEATURE_FLAG_VALIDATION_CODE_REQUIRED: 'false' - FEATURE_FLAG_MOVE_LOCK: 'false' - FEATURE_FLAG_OKTA_DODID_INPUT: 'false' - FEATURE_FLAG_HEADQUARTERS_ROLE: 'false' - FEATURE_FLAG_GSR_ROLE: 'false' - FEATURE_FLAG_SAFETY_MOVE: 'false' - FEATURE_FLAG_MANAGE_SUPPORTING_DOCS: 'false' - FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE: 'false' - FEATURE_FLAG_QUEUE_MANAGEMENT: 'false' - FEATURE_FLAG_ENABLE_ALASKA: 'false' + FEATURE_FLAG_MULTI_MOVE: "true" + FEATURE_FLAG_PPM: "true" + FEATURE_FLAG_NTS: "true" + FEATURE_FLAG_NTSR: "true" + FEATURE_FLAG_BOAT: "true" + FEATURE_FLAG_MOBILE_HOME: "true" + FEATURE_FLAG_CAC_VALIDATED_LOGIN: "false" + FEATURE_FLAG_VALIDATION_CODE_REQUIRED: "false" + FEATURE_FLAG_MOVE_LOCK: "false" + FEATURE_FLAG_OKTA_DODID_INPUT: "false" + FEATURE_FLAG_HEADQUARTERS_ROLE: "false" + FEATURE_FLAG_GSR_ROLE: "false" + FEATURE_FLAG_SAFETY_MOVE: "false" + FEATURE_FLAG_MANAGE_SUPPORTING_DOCS: "false" + FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE: "false" + FEATURE_FLAG_QUEUE_MANAGEMENT: "false" + FEATURE_FLAG_ENABLE_ALASKA: "false" command: | SHARD=$((${CIRCLE_NODE_INDEX}+1)) PLAYWRIGHT_JUNIT_OUTPUT_NAME=playwright-results.xml \ @@ -960,8 +960,8 @@ commands: background: true name: run server environment: - MIGRATION_MANIFEST: '/home/circleci/transcom/mymove/migrations/app/migrations_manifest.txt' - MIGRATION_PATH: 'file:///home/circleci/transcom/mymove/migrations/app/schema;file:///home/circleci/transcom/mymove/migrations/app/secure' + MIGRATION_MANIFEST: "/home/circleci/transcom/mymove/migrations/app/migrations_manifest.txt" + MIGRATION_PATH: "file:///home/circleci/transcom/mymove/migrations/app/schema;file:///home/circleci/transcom/mymove/migrations/app/secure" command: | export MOVE_MIL_DOD_CA_CERT=$(cat config/tls/devlocal-ca.pem) export MOVE_MIL_DOD_TLS_CERT=$(cat config/tls/devlocal-https.pem) @@ -1049,8 +1049,8 @@ commands: background: true name: run server environment: - MIGRATION_MANIFEST: '/home/circleci/project/migrations/app/migrations_manifest.txt' - MIGRATION_PATH: 'file:///home/circleci/project/migrations/app/schema;file:///home/circleci/project/migrations/app/secure' + MIGRATION_MANIFEST: "/home/circleci/project/migrations/app/migrations_manifest.txt" + MIGRATION_PATH: "file:///home/circleci/project/migrations/app/schema;file:///home/circleci/project/migrations/app/secure" command: | export MOVE_MIL_DOD_CA_CERT=$(cat config/tls/devlocal-ca.pem) export MOVE_MIL_DOD_TLS_CERT=$(cat config/tls/devlocal-https.pem) @@ -1144,7 +1144,7 @@ commands: - save_cache: key: v2-pipenv-{{ checksum "Pipfile.lock" }}-{{ .Environment.PYTHON_VERSION }} paths: - - '~/transcom/mymove/tmp/milmove_load_testing/.venv' + - "~/transcom/mymove/tmp/milmove_load_testing/.venv" - run: name: extract results # always try to extract the artifacts so it can help us @@ -1408,8 +1408,8 @@ jobs: DB_PORT: 5432 DB_NAME: dev_db DB_NAME_DEV: dev_db - MIGRATION_MANIFEST: '/home/circleci/transcom/mymove/migrations/app/migrations_manifest.txt' - MIGRATION_PATH: 'file:///home/circleci/transcom/mymove/migrations/app/schema;file:///home/circleci/transcom/mymove/migrations/app/secure' + MIGRATION_MANIFEST: "/home/circleci/transcom/mymove/migrations/app/migrations_manifest.txt" + MIGRATION_PATH: "file:///home/circleci/transcom/mymove/migrations/app/schema;file:///home/circleci/transcom/mymove/migrations/app/secure" EIA_KEY: db2522a43820268a41a802a16ae9fd26 # dummy key generated with openssl rand -hex 16 ENVIRONMENT: development DOD_CA_PACKAGE: /home/circleci/transcom/mymove/config/tls/milmove-cert-bundle.p7b @@ -1500,7 +1500,7 @@ jobs: # # The trailing hyphen in restore_cache seems important # according to the page linked above - - v9-server-tests-coverage- + - v10-server-tests-coverage- - run: name: Ensure Test Coverage Increasing command: | @@ -1510,7 +1510,7 @@ jobs: - run: # on failure, post a comment to the PR with a link to the report when: on_fail - name: 'Post server coverage failure comment to GitHub' + name: "Post server coverage failure comment to GitHub" command: | source server_test_job_id.env ./scripts/handle-pr-comment \ @@ -1521,7 +1521,7 @@ jobs: - run: # on success, check for an existing PR comment and remove it when: on_success - name: 'Delete server coverage failure comment on PR if present' + name: "Delete server coverage failure comment on PR if present" command: | ./scripts/handle-pr-comment \ $CIRCLE_BRANCH \ @@ -1543,7 +1543,7 @@ jobs: - when: always steps: - run: - name: 'Copy coverage to baseline' + name: "Copy coverage to baseline" command: | mkdir -p ~/transcom/mymove/tmp/baseline-go-coverage cp ~/transcom/mymove/tmp/test-results/gotest/app/go-coverage.txt \ @@ -1556,14 +1556,14 @@ jobs: # Use the BuildNum to update the cache key so that the # coverage cache is always updated - save_cache: - key: v9-server-tests-coverage-{{ .BuildNum }} + key: v10-server-tests-coverage-{{ .BuildNum }} paths: - ~/transcom/mymove/tmp/baseline-go-coverage when: always - aws_vars_transcom_gov_dev: when: always - run: - name: 'Record server coverage stats' + name: "Record server coverage stats" command: | timestamp=$(date +"%Y-%m-%dT%H:%M:%SZ") coverage=$(grep statements tmp/test-results/gotest/app/go-coverage.txt | grep -o '[0-9.]*') @@ -1644,7 +1644,7 @@ jobs: - run: # on failure, post a comment to the PR with a link to the report when: on_fail - name: 'Post client coverage failure comment to GitHub' + name: "Post client coverage failure comment to GitHub" command: | source client_test_job_id.env ./scripts/handle-pr-comment \ @@ -1655,7 +1655,7 @@ jobs: - run: # on success, check for an existing PR comment and remove it when: on_success - name: 'Delete client coverage failure comment on PR if present' + name: "Delete client coverage failure comment on PR if present" command: | ./scripts/handle-pr-comment \ $CIRCLE_BRANCH \ @@ -1674,7 +1674,7 @@ jobs: - equal: [main, << pipeline.git.branch >>] steps: - run: - name: 'Copy coverage to baseline' + name: "Copy coverage to baseline" command: | mkdir -p ~/transcom/mymove/tmp/baseline-jest-coverage cp ~/transcom/mymove/coverage/clover.xml \ @@ -1693,7 +1693,7 @@ jobs: - aws_vars_transcom_gov_dev: when: always - run: - name: 'Record client coverage stats' + name: "Record client coverage stats" command: | timestamp=$(date +"%Y-%m-%dT%H:%M:%SZ") coverage=$(grep -B 1 'span.*Statements' coverage/lcov-report/index.html | grep -o '[0-9.]*') @@ -2110,13 +2110,13 @@ jobs: environment: APP_ENVIRONMENT: *dp3-env - OPEN_TELEMETRY_SIDECAR: 'true' - HEALTH_CHECK: 'true' + OPEN_TELEMETRY_SIDECAR: "true" + HEALTH_CHECK: "true" steps: - checkout - aws_vars_dp3 - deploy_app_steps: - compare_host: '' # leave blank since we want dp3 to be able to roll back + compare_host: "" # leave blank since we want dp3 to be able to roll back health_check_hosts: my.<< parameters.dp3-env >>.dp3.us,office.<< parameters.dp3-env >>.dp3.us,admin.<< parameters.dp3-env >>.dp3.us ecr_env: *dp3-env @@ -2129,14 +2129,14 @@ jobs: default: *dp3-env environment: APP_ENVIRONMENT: *dp3-env - OPEN_TELEMETRY_SIDECAR: 'true' - HEALTH_CHECK: 'true' + OPEN_TELEMETRY_SIDECAR: "true" + HEALTH_CHECK: "true" steps: - checkout - aws_vars_dp3 - tls_vars_dp3 - deploy_app_client_tls_steps: - compare_host: '' # leave blank since we want dp3 to be able to roll back + compare_host: "" # leave blank since we want dp3 to be able to roll back health_check_hosts: api.<< parameters.dp3-env >>.dp3.us ecr_env: *dp3-env @@ -2152,7 +2152,7 @@ jobs: deploy_stg_migrations: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'stg' + APP_ENVIRONMENT: "stg" steps: - checkout - aws_vars_stg @@ -2163,7 +2163,7 @@ jobs: deploy_stg_tasks: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'stg' + APP_ENVIRONMENT: "stg" steps: - checkout - aws_vars_stg @@ -2174,9 +2174,9 @@ jobs: deploy_stg_app: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'stg' - OPEN_TELEMETRY_SIDECAR: 'true' - HEALTH_CHECK: 'true' + APP_ENVIRONMENT: "stg" + OPEN_TELEMETRY_SIDECAR: "true" + HEALTH_CHECK: "true" steps: - checkout - aws_vars_stg @@ -2191,9 +2191,9 @@ jobs: # use dockerhub otel collector image as govcloud does not have the # right certs for pulling from public.ecr.aws environment: - APP_ENVIRONMENT: 'stg' - OPEN_TELEMETRY_SIDECAR: 'true' - HEALTH_CHECK: 'true' + APP_ENVIRONMENT: "stg" + OPEN_TELEMETRY_SIDECAR: "true" + HEALTH_CHECK: "true" steps: - checkout - aws_vars_stg @@ -2215,7 +2215,7 @@ jobs: deploy_prd_migrations: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'prd' + APP_ENVIRONMENT: "prd" steps: - checkout - aws_vars_prd @@ -2226,7 +2226,7 @@ jobs: deploy_prd_tasks: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'prd' + APP_ENVIRONMENT: "prd" steps: - checkout - aws_vars_prd @@ -2237,9 +2237,9 @@ jobs: deploy_prd_app: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'prd' - OPEN_TELEMETRY_SIDECAR: 'true' - HEALTH_CHECK: 'true' + APP_ENVIRONMENT: "prd" + OPEN_TELEMETRY_SIDECAR: "true" + HEALTH_CHECK: "true" steps: - checkout - aws_vars_prd @@ -2252,9 +2252,9 @@ jobs: deploy_prd_app_client_tls: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'prd' - OPEN_TELEMETRY_SIDECAR: 'true' - HEALTH_CHECK: 'true' + APP_ENVIRONMENT: "prd" + OPEN_TELEMETRY_SIDECAR: "true" + HEALTH_CHECK: "true" steps: - checkout - aws_vars_prd @@ -2310,7 +2310,8 @@ workflows: - pre_deps_golang filters: branches: - ignore: [*integration-mtls-ignore-branch, *integration-ignore-branch] + ignore: + [*integration-mtls-ignore-branch, *integration-ignore-branch] - pre_test: requires: @@ -2454,7 +2455,8 @@ workflows: - build_migrations filters: branches: - ignore: [*integration-mtls-ignore-branch, *integration-ignore-branch] + ignore: + [*integration-mtls-ignore-branch, *integration-ignore-branch] - build_tasks: requires: From c296945bba452cbb064ad9b8ba7198fbd95e2fc6 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Tue, 22 Oct 2024 13:07:52 +0000 Subject: [PATCH 20/20] reset test_coverage --- .circleci/config.yml | 170 ++++++++++++++++++++++--------------------- 1 file changed, 86 insertions(+), 84 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7c0ed860e11..ae634cbe1c2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -259,7 +259,7 @@ executors: commands: create_dot_go_version: - description: 'Creates a .go-version file (if needed) which can be used for cache keys specific to golang' + description: "Creates a .go-version file (if needed) which can be used for cache keys specific to golang" steps: - run: name: Create a .go-version file @@ -285,13 +285,13 @@ commands: - save_cache: key: go-mod-sources-v8-{{ checksum "go.sum" }}-{{ checksum ".go-version" }} paths: - - '~/go' - - '~/transcom/mymove/bin/swagger' + - "~/go" + - "~/transcom/mymove/bin/swagger" aws_vars_stg: steps: - run: - name: 'Setting up AWS environment variables for stg env' + name: "Setting up AWS environment variables for stg env" command: | echo "export AWS_DEFAULT_REGION=$STG_REGION" >> $BASH_ENV echo "export AWS_ACCOUNT_ID=$STG_ACCOUNT_ID" >> $BASH_ENV @@ -304,7 +304,7 @@ commands: tls_vars_stg: steps: - run: - name: 'Setting up TLS environment variables for stg env' + name: "Setting up TLS environment variables for stg env" command: | echo "export TLS_CERT=$STG_MOVE_MIL_DOD_TLS_CERT" >> $BASH_ENV echo "export TLS_KEY=$STG_MOVE_MIL_DOD_TLS_KEY" >> $BASH_ENV @@ -313,7 +313,7 @@ commands: aws_vars_prd: steps: - run: - name: 'Setting up AWS environment variables for prd env' + name: "Setting up AWS environment variables for prd env" command: | echo "export AWS_DEFAULT_REGION=$PRD_REGION" >> $BASH_ENV echo "export AWS_ACCOUNT_ID=$PRD_ACCOUNT_ID" >> $BASH_ENV @@ -326,7 +326,7 @@ commands: tls_vars_prd: steps: - run: - name: 'Setting up TLS environment variables for prd env' + name: "Setting up TLS environment variables for prd env" command: | echo "export TLS_CERT=$PRD_MOVE_MIL_DOD_TLS_CERT" >> $BASH_ENV echo "export TLS_KEY=$PRD_MOVE_MIL_DOD_TLS_KEY" >> $BASH_ENV @@ -340,7 +340,7 @@ commands: default: on_success steps: - run: - name: 'Setting up AWS environment variables for gov-dev env' + name: "Setting up AWS environment variables for gov-dev env" command: | echo "export AWS_DEFAULT_REGION=$GOV_DEV_REGION" >> $BASH_ENV echo "export AWS_ACCOUNT_ID=$GOV_DEV_ACCOUNT_ID" >> $BASH_ENV @@ -351,7 +351,7 @@ commands: tls_vars_gov_dev: steps: - run: - name: 'Setting up TLS environment variables for gov-dev env' + name: "Setting up TLS environment variables for gov-dev env" command: | echo "export TLS_CERT=$EXPERIMENTAL_MOVE_MIL_DOD_TLS_CERT" >> $BASH_ENV echo "export TLS_KEY=$EXPERIMENTAL_MOVE_MIL_DOD_TLS_KEY" >> $BASH_ENV @@ -360,7 +360,7 @@ commands: aws_vars_transcom_com_dev: steps: - run: - name: 'Setting up AWS environment variables for com-dev env' + name: "Setting up AWS environment variables for com-dev env" command: | echo "export AWS_DEFAULT_REGION=$COM_REGION" >> $BASH_ENV echo "export AWS_ACCOUNT_ID=$DEV_ACCOUNT_ID" >> $BASH_ENV @@ -375,7 +375,7 @@ commands: default: *dp3-env steps: - run: - name: 'Setting up AWS environment variables for dp3 env defined in &dp3-env' + name: "Setting up AWS environment variables for dp3 env defined in &dp3-env" command: | echo "export AWS_DEFAULT_REGION=\$$(echo << parameters.dp3-env >> | tr 'a-z' 'A-Z')_REGION" >> $BASH_ENV echo "export AWS_ACCOUNT_ID=\$$(echo << parameters.dp3-env >> | tr 'a-z' 'A-Z')_ACCOUNT_ID" >> $BASH_ENV @@ -386,7 +386,7 @@ commands: equal: [loadtest, << parameters.dp3-env >>] steps: - run: - name: 'Increase cpu/memory reservation for loadtest' + name: "Increase cpu/memory reservation for loadtest" command: | # override default cpu/memory echo "export SERVICE_RESERVATION_CPU=2048" >> $BASH_ENV @@ -400,7 +400,7 @@ commands: default: *dp3-env steps: - run: - name: 'Setting up TLS environment variables for dp3 env defined in &dp3-env' + name: "Setting up TLS environment variables for dp3 env defined in &dp3-env" command: | echo "export TLS_CERT=\$$(echo << parameters.dp3-env >> | tr 'a-z' 'A-Z')_DP3_CERT" >> $BASH_ENV echo "export TLS_KEY=\$$(echo << parameters.dp3-env >> | tr 'a-z' 'A-Z')_DP3_KEY" >> $BASH_ENV @@ -604,7 +604,7 @@ commands: - setup_remote_docker: docker_layer_caching: false - run: - name: 'Build docker image' + name: "Build docker image" working_directory: << parameters.working_dir >> command: | docker build -f << parameters.dockerfile>> -t << parameters.image_name >>:<< parameters.tag >> . @@ -631,11 +631,11 @@ commands: - setup_remote_docker: docker_layer_caching: false - run: - name: 'Retrieve docker image from workspace' + name: "Retrieve docker image from workspace" command: | docker load -i images/<< parameters.image_name >> - run: - name: 'Tag and push docker image' + name: "Tag and push docker image" command: | aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com @@ -652,14 +652,14 @@ commands: docker tag << parameters.image_name >>:<< parameters.tag >> ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/<< parameters.repo >>:git-branch-${docker_tag_shortened_name} docker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/<< parameters.repo >>:git-branch-${docker_tag_shortened_name} - run: - name: 'Record ECR Image Digest' + name: "Record ECR Image Digest" command: | mkdir -p images/sha echo $(aws ecr describe-images --repository-name << parameters.repo >> --image-ids imageTag=git-${CIRCLE_SHA1} | jq ".imageDetails[0] .imageDigest" -r) > images/sha/ECR_DIGEST_<< parameters.repo >>_<< parameters.ecr_env >> cat images/sha/ECR_DIGEST_<< parameters.repo >>_<< parameters.ecr_env >> sleep 60 - run: - name: 'Describe image scan findings' + name: "Describe image scan findings" command: scripts/ecr-describe-image-scan-findings << parameters.repo >> $(cat images/sha/ECR_DIGEST_<< parameters.repo >>_<< parameters.ecr_env >>) - persist_to_workspace: root: . @@ -687,7 +687,7 @@ commands: - attach_workspace: at: . - run: - name: 'Tag and push docker image' + name: "Tag and push docker image" command: | aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com otel_image=$(echo << parameters.aws_otel_collector_image >>) @@ -704,7 +704,7 @@ commands: docker push "${repo_name}:git-${otel_image_tag}-${CIRCLE_SHA1}" - run: - name: 'Record ECR Image Digest' + name: "Record ECR Image Digest" command: | otel_image=$(echo << parameters.aws_otel_collector_image >>) shopt -s extglob @@ -752,7 +752,7 @@ commands: make server_test no_output_timeout: 20m environment: - APPLICATION: '<< parameters.application >>' + APPLICATION: "<< parameters.application >>" # 8 since this runs on xlarge with 8 CPUs GOTEST_PARALLEL: 8 DB_PASSWORD: mysecretpassword @@ -764,15 +764,15 @@ commands: DB_PORT: 5432 DB_NAME: test_db DB_NAME_TEST: test_db - DTOD_USE_MOCK: 'true' - MIGRATION_MANIFEST: '/home/circleci/transcom/mymove/migrations/<< parameters.application >>/migrations_manifest.txt' - MIGRATION_PATH: 'file:///home/circleci/transcom/mymove/migrations/<< parameters.application >>/schema;file:///home/circleci/transcom/mymove/migrations/<< parameters.application >>/secure' + DTOD_USE_MOCK: "true" + MIGRATION_MANIFEST: "/home/circleci/transcom/mymove/migrations/<< parameters.application >>/migrations_manifest.txt" + MIGRATION_PATH: "file:///home/circleci/transcom/mymove/migrations/<< parameters.application >>/schema;file:///home/circleci/transcom/mymove/migrations/<< parameters.application >>/secure" EIA_KEY: db2522a43820268a41a802a16ae9fd26 # dummy key generated with openssl rand -hex 16 ENV: test ENVIRONMENT: test SERVER_REPORT: 1 COVERAGE: 1 - SERVE_API_INTERNAL: 'true' + SERVE_API_INTERNAL: "true" OKTA_CUSTOMER_CLIENT_ID: 1q2w3e4r5t6y7u8i9o OKTA_ADMIN_CLIENT_ID: AQ1SW2DE3FR4G5 OKTA_OFFICE_CLIENT_ID: 9f9f9s8s90gig9 @@ -817,8 +817,8 @@ commands: background: true name: run server environment: - MIGRATION_MANIFEST: '/home/circleci/project/migrations/app/migrations_manifest.txt' - MIGRATION_PATH: 'file:///home/circleci/project/migrations/app/schema;file:///home/circleci/project/migrations/app/secure' + MIGRATION_MANIFEST: "/home/circleci/project/migrations/app/migrations_manifest.txt" + MIGRATION_PATH: "file:///home/circleci/project/migrations/app/schema;file:///home/circleci/project/migrations/app/secure" command: | export MOVE_MIL_DOD_CA_CERT=$(cat config/tls/devlocal-ca.pem) export MOVE_MIL_DOD_TLS_CERT=$(cat config/tls/devlocal-https.pem) @@ -901,22 +901,22 @@ commands: PLAYWRIGHT_ADMIN_URL: http://adminlocal:4000 PLAYWRIGHT_OFFICE_URL: http://officelocal:4000 # partially taken from https://playwright.dev/docs/ci#sharding-in-circleci - FEATURE_FLAG_MULTI_MOVE: 'true' - FEATURE_FLAG_PPM: 'true' - FEATURE_FLAG_NTS: 'true' - FEATURE_FLAG_NTSR: 'true' - FEATURE_FLAG_BOAT: 'true' - FEATURE_FLAG_MOBILE_HOME: 'true' - FEATURE_FLAG_CAC_VALIDATED_LOGIN: 'false' - FEATURE_FLAG_VALIDATION_CODE_REQUIRED: 'false' - FEATURE_FLAG_MOVE_LOCK: 'false' - FEATURE_FLAG_OKTA_DODID_INPUT: 'false' - FEATURE_FLAG_HEADQUARTERS_ROLE: 'false' - FEATURE_FLAG_GSR_ROLE: 'false' - FEATURE_FLAG_SAFETY_MOVE: 'false' - FEATURE_FLAG_MANAGE_SUPPORTING_DOCS: 'false' - FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE: 'false' - FEATURE_FLAG_QUEUE_MANAGEMENT: 'false' + FEATURE_FLAG_MULTI_MOVE: "true" + FEATURE_FLAG_PPM: "true" + FEATURE_FLAG_NTS: "true" + FEATURE_FLAG_NTSR: "true" + FEATURE_FLAG_BOAT: "true" + FEATURE_FLAG_MOBILE_HOME: "true" + FEATURE_FLAG_CAC_VALIDATED_LOGIN: "false" + FEATURE_FLAG_VALIDATION_CODE_REQUIRED: "false" + FEATURE_FLAG_MOVE_LOCK: "false" + FEATURE_FLAG_OKTA_DODID_INPUT: "false" + FEATURE_FLAG_HEADQUARTERS_ROLE: "false" + FEATURE_FLAG_GSR_ROLE: "false" + FEATURE_FLAG_SAFETY_MOVE: "false" + FEATURE_FLAG_MANAGE_SUPPORTING_DOCS: "false" + FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE: "false" + FEATURE_FLAG_QUEUE_MANAGEMENT: "false" command: | SHARD=$((${CIRCLE_NODE_INDEX}+1)) PLAYWRIGHT_JUNIT_OUTPUT_NAME=playwright-results.xml \ @@ -958,8 +958,8 @@ commands: background: true name: run server environment: - MIGRATION_MANIFEST: '/home/circleci/transcom/mymove/migrations/app/migrations_manifest.txt' - MIGRATION_PATH: 'file:///home/circleci/transcom/mymove/migrations/app/schema;file:///home/circleci/transcom/mymove/migrations/app/secure' + MIGRATION_MANIFEST: "/home/circleci/transcom/mymove/migrations/app/migrations_manifest.txt" + MIGRATION_PATH: "file:///home/circleci/transcom/mymove/migrations/app/schema;file:///home/circleci/transcom/mymove/migrations/app/secure" command: | export MOVE_MIL_DOD_CA_CERT=$(cat config/tls/devlocal-ca.pem) export MOVE_MIL_DOD_TLS_CERT=$(cat config/tls/devlocal-https.pem) @@ -1047,8 +1047,8 @@ commands: background: true name: run server environment: - MIGRATION_MANIFEST: '/home/circleci/project/migrations/app/migrations_manifest.txt' - MIGRATION_PATH: 'file:///home/circleci/project/migrations/app/schema;file:///home/circleci/project/migrations/app/secure' + MIGRATION_MANIFEST: "/home/circleci/project/migrations/app/migrations_manifest.txt" + MIGRATION_PATH: "file:///home/circleci/project/migrations/app/schema;file:///home/circleci/project/migrations/app/secure" command: | export MOVE_MIL_DOD_CA_CERT=$(cat config/tls/devlocal-ca.pem) export MOVE_MIL_DOD_TLS_CERT=$(cat config/tls/devlocal-https.pem) @@ -1142,7 +1142,7 @@ commands: - save_cache: key: v2-pipenv-{{ checksum "Pipfile.lock" }}-{{ .Environment.PYTHON_VERSION }} paths: - - '~/transcom/mymove/tmp/milmove_load_testing/.venv' + - "~/transcom/mymove/tmp/milmove_load_testing/.venv" - run: name: extract results # always try to extract the artifacts so it can help us @@ -1406,8 +1406,8 @@ jobs: DB_PORT: 5432 DB_NAME: dev_db DB_NAME_DEV: dev_db - MIGRATION_MANIFEST: '/home/circleci/transcom/mymove/migrations/app/migrations_manifest.txt' - MIGRATION_PATH: 'file:///home/circleci/transcom/mymove/migrations/app/schema;file:///home/circleci/transcom/mymove/migrations/app/secure' + MIGRATION_MANIFEST: "/home/circleci/transcom/mymove/migrations/app/migrations_manifest.txt" + MIGRATION_PATH: "file:///home/circleci/transcom/mymove/migrations/app/schema;file:///home/circleci/transcom/mymove/migrations/app/secure" EIA_KEY: db2522a43820268a41a802a16ae9fd26 # dummy key generated with openssl rand -hex 16 ENVIRONMENT: development DOD_CA_PACKAGE: /home/circleci/transcom/mymove/config/tls/milmove-cert-bundle.p7b @@ -1508,7 +1508,7 @@ jobs: - run: # on failure, post a comment to the PR with a link to the report when: on_fail - name: 'Post server coverage failure comment to GitHub' + name: "Post server coverage failure comment to GitHub" command: | source server_test_job_id.env ./scripts/handle-pr-comment \ @@ -1519,7 +1519,7 @@ jobs: - run: # on success, check for an existing PR comment and remove it when: on_success - name: 'Delete server coverage failure comment on PR if present' + name: "Delete server coverage failure comment on PR if present" command: | ./scripts/handle-pr-comment \ $CIRCLE_BRANCH \ @@ -1541,7 +1541,7 @@ jobs: - when: always steps: - run: - name: 'Copy coverage to baseline' + name: "Copy coverage to baseline" command: | mkdir -p ~/transcom/mymove/tmp/baseline-go-coverage cp ~/transcom/mymove/tmp/test-results/gotest/app/go-coverage.txt \ @@ -1561,7 +1561,7 @@ jobs: - aws_vars_transcom_gov_dev: when: always - run: - name: 'Record server coverage stats' + name: "Record server coverage stats" command: | timestamp=$(date +"%Y-%m-%dT%H:%M:%SZ") coverage=$(grep statements tmp/test-results/gotest/app/go-coverage.txt | grep -o '[0-9.]*') @@ -1632,7 +1632,7 @@ jobs: # The trailing hyphen in restore_cache seems important # according to the page linked above keys: - - v7-client-tests-coverage- + - v8-client-tests-coverage- - run: name: Ensure Test Coverage Increasing command: | @@ -1642,7 +1642,7 @@ jobs: - run: # on failure, post a comment to the PR with a link to the report when: on_fail - name: 'Post client coverage failure comment to GitHub' + name: "Post client coverage failure comment to GitHub" command: | source client_test_job_id.env ./scripts/handle-pr-comment \ @@ -1653,7 +1653,7 @@ jobs: - run: # on success, check for an existing PR comment and remove it when: on_success - name: 'Delete client coverage failure comment on PR if present' + name: "Delete client coverage failure comment on PR if present" command: | ./scripts/handle-pr-comment \ $CIRCLE_BRANCH \ @@ -1672,7 +1672,7 @@ jobs: - equal: [main, << pipeline.git.branch >>] steps: - run: - name: 'Copy coverage to baseline' + name: "Copy coverage to baseline" command: | mkdir -p ~/transcom/mymove/tmp/baseline-jest-coverage cp ~/transcom/mymove/coverage/clover.xml \ @@ -1684,14 +1684,14 @@ jobs: # Use the BuildNum to update the cache key so that the # coverage cache is always updated - save_cache: - key: v7-client-tests-coverage-{{ .BuildNum }} + key: v8-client-tests-coverage-{{ .BuildNum }} paths: - ~/transcom/mymove/tmp/baseline-jest-coverage when: always - aws_vars_transcom_gov_dev: when: always - run: - name: 'Record client coverage stats' + name: "Record client coverage stats" command: | timestamp=$(date +"%Y-%m-%dT%H:%M:%SZ") coverage=$(grep -B 1 'span.*Statements' coverage/lcov-report/index.html | grep -o '[0-9.]*') @@ -2108,13 +2108,13 @@ jobs: environment: APP_ENVIRONMENT: *dp3-env - OPEN_TELEMETRY_SIDECAR: 'true' - HEALTH_CHECK: 'true' + OPEN_TELEMETRY_SIDECAR: "true" + HEALTH_CHECK: "true" steps: - checkout - aws_vars_dp3 - deploy_app_steps: - compare_host: '' # leave blank since we want dp3 to be able to roll back + compare_host: "" # leave blank since we want dp3 to be able to roll back health_check_hosts: my.<< parameters.dp3-env >>.dp3.us,office.<< parameters.dp3-env >>.dp3.us,admin.<< parameters.dp3-env >>.dp3.us ecr_env: *dp3-env @@ -2127,14 +2127,14 @@ jobs: default: *dp3-env environment: APP_ENVIRONMENT: *dp3-env - OPEN_TELEMETRY_SIDECAR: 'true' - HEALTH_CHECK: 'true' + OPEN_TELEMETRY_SIDECAR: "true" + HEALTH_CHECK: "true" steps: - checkout - aws_vars_dp3 - tls_vars_dp3 - deploy_app_client_tls_steps: - compare_host: '' # leave blank since we want dp3 to be able to roll back + compare_host: "" # leave blank since we want dp3 to be able to roll back health_check_hosts: api.<< parameters.dp3-env >>.dp3.us ecr_env: *dp3-env @@ -2150,7 +2150,7 @@ jobs: deploy_stg_migrations: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'stg' + APP_ENVIRONMENT: "stg" steps: - checkout - aws_vars_stg @@ -2161,7 +2161,7 @@ jobs: deploy_stg_tasks: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'stg' + APP_ENVIRONMENT: "stg" steps: - checkout - aws_vars_stg @@ -2172,9 +2172,9 @@ jobs: deploy_stg_app: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'stg' - OPEN_TELEMETRY_SIDECAR: 'true' - HEALTH_CHECK: 'true' + APP_ENVIRONMENT: "stg" + OPEN_TELEMETRY_SIDECAR: "true" + HEALTH_CHECK: "true" steps: - checkout - aws_vars_stg @@ -2189,9 +2189,9 @@ jobs: # use dockerhub otel collector image as govcloud does not have the # right certs for pulling from public.ecr.aws environment: - APP_ENVIRONMENT: 'stg' - OPEN_TELEMETRY_SIDECAR: 'true' - HEALTH_CHECK: 'true' + APP_ENVIRONMENT: "stg" + OPEN_TELEMETRY_SIDECAR: "true" + HEALTH_CHECK: "true" steps: - checkout - aws_vars_stg @@ -2213,7 +2213,7 @@ jobs: deploy_prd_migrations: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'prd' + APP_ENVIRONMENT: "prd" steps: - checkout - aws_vars_prd @@ -2224,7 +2224,7 @@ jobs: deploy_prd_tasks: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'prd' + APP_ENVIRONMENT: "prd" steps: - checkout - aws_vars_prd @@ -2235,9 +2235,9 @@ jobs: deploy_prd_app: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'prd' - OPEN_TELEMETRY_SIDECAR: 'true' - HEALTH_CHECK: 'true' + APP_ENVIRONMENT: "prd" + OPEN_TELEMETRY_SIDECAR: "true" + HEALTH_CHECK: "true" steps: - checkout - aws_vars_prd @@ -2250,9 +2250,9 @@ jobs: deploy_prd_app_client_tls: executor: mymove_pusher environment: - APP_ENVIRONMENT: 'prd' - OPEN_TELEMETRY_SIDECAR: 'true' - HEALTH_CHECK: 'true' + APP_ENVIRONMENT: "prd" + OPEN_TELEMETRY_SIDECAR: "true" + HEALTH_CHECK: "true" steps: - checkout - aws_vars_prd @@ -2308,7 +2308,8 @@ workflows: - pre_deps_golang filters: branches: - ignore: [*integration-mtls-ignore-branch, *integration-ignore-branch] + ignore: + [*integration-mtls-ignore-branch, *integration-ignore-branch] - pre_test: requires: @@ -2452,7 +2453,8 @@ workflows: - build_migrations filters: branches: - ignore: [*integration-mtls-ignore-branch, *integration-ignore-branch] + ignore: + [*integration-mtls-ignore-branch, *integration-ignore-branch] - build_tasks: requires: