Skip to content

Commit

Permalink
Merge branch 'main' into B-21557-Estimated-Price
Browse files Browse the repository at this point in the history
  • Loading branch information
joeydoyecaci authored Jan 22, 2025
2 parents 3c2d562 + cd9f4f6 commit 437ac4a
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 17 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ require (
github.com/lib/pq v1.10.9
github.com/markbates/goth v1.79.0
github.com/namsral/flag v1.7.4-pre
github.com/pdfcpu/pdfcpu v0.9.1
github.com/pdfcpu/pdfcpu v0.9.2-0.20250122004437-b05d39596f8f
github.com/pkg/errors v0.9.1
github.com/pkg/sftp v1.13.7
github.com/pterm/pterm v0.12.79
Expand Down Expand Up @@ -259,7 +259,7 @@ require (
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/image v0.21.0 // indirect
golang.org/x/image v0.23.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627 h1:pSCLCl6joCFRnjpeojzOpEYs4q7Vditq8fySFG5ap3Y=
github.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pdfcpu/pdfcpu v0.9.1 h1:q8/KlBdHjkE7ZJU4ofhKG5Rjf7M6L324CVM6BMDySao=
github.com/pdfcpu/pdfcpu v0.9.1/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=
github.com/pdfcpu/pdfcpu v0.9.2-0.20250122004437-b05d39596f8f h1:pbR5oPqr7t9jhmy/804XHl/JjsxJuNHumdWA+lFkU4E=
github.com/pdfcpu/pdfcpu v0.9.2-0.20250122004437-b05d39596f8f/go.mod h1:8EAma3IBIS7ssMiPlcNIPWwISTuP31WToXfGvc327vI=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
github.com/peterbourgon/diskv/v3 v3.0.1 h1:x06SQA46+PKIUftmEujdwSEpIx8kR+M9eLYsUxeYveU=
Expand Down Expand Up @@ -730,8 +730,8 @@ golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjs
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s=
golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78=
golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68=
golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
Expand Down
6 changes: 3 additions & 3 deletions pkg/paperwork/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,16 @@ func (g *Generator) GetPdfFileInfo(fileName string) (*pdfcpu.PDFInfo, error) {
return nil, err
}
defer file.Close()
return api.PDFInfo(file, fileName, nil, g.pdfConfig)
return api.PDFInfo(file, fileName, nil, false, g.pdfConfig)
}

func (g *Generator) GetPdfFileInfoForReadSeeker(rs io.ReadSeeker) (*pdfcpu.PDFInfo, error) {
return api.PDFInfo(rs, "", nil, g.pdfConfig)
return api.PDFInfo(rs, "", nil, false, g.pdfConfig)
}

// Get file information of a single PDF
func (g *Generator) GetPdfFileInfoByContents(file afero.File) (*pdfcpu.PDFInfo, error) {
return api.PDFInfo(file, file.Name(), nil, g.pdfConfig)
return api.PDFInfo(file, file.Name(), nil, false, g.pdfConfig)
}

// CreateMergedPDFUpload converts Uploads to PDF and merges them into a single PDF
Expand Down
4 changes: 2 additions & 2 deletions pkg/paperwork/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (suite *PaperworkSuite) TestPDFFromImages() {
files, err := os.ReadDir(tmpDir)
suite.FatalNil(err)

suite.Equal(4, len(files), "did not find 2 images")
suite.Equal(2, len(files), "did not find 2 images")

for _, file := range files {
checksum, sha256ForPathErr := suite.sha256ForPath(path.Join(tmpDir, file.Name()), nil)
Expand Down Expand Up @@ -182,7 +182,7 @@ func (suite *PaperworkSuite) TestPDFFromImagesNoRotation() {
files, err := os.ReadDir(tmpDir)
suite.FatalNil(err)

suite.Equal(4, len(files), "did not find 2 images")
suite.Equal(2, len(files), "did not find 2 images")

for _, file := range files {
checksum, sha256ForPathErr := suite.sha256ForPath(path.Join(tmpDir, file.Name()), nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,14 @@ func (g *moveUserUploadToPDFDownloader) GenerateDownloadMoveUserUploadPDF(appCtx

// Build orderUploadDocType for document
func (g *moveUserUploadToPDFDownloader) buildPdfBatchInfo(appCtx appcontext.AppContext, uploadDocType services.MoveOrderUploadType, documentID uuid.UUID) (*pdfBatchInfo, error) {
document, err := models.FetchDocumentWithNoRestrictions(appCtx.DB(), appCtx.Session(), documentID, false)
document, err := models.FetchDocumentWithNoRestrictions(appCtx.DB(), appCtx.Session(), documentID, true)
if err != nil {
return nil, errors.Wrap(err, fmt.Sprintf("error fetching document domain by id: %s", documentID))
}

// filter out deleted uploads from userUploads
document.UserUploads = document.UserUploads.FilterDeleted()

var pdfFileNames []string
var pageCounts []int
// Document has one or more uploads. Create PDF file for each.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (suite *PaperworkServiceSuite) TestPrimeDownloadMoveUploadPDFGeneratorUnpro
}

func (suite *PaperworkServiceSuite) pdfFileInfo(generator *paperwork.Generator, file afero.File) (*pdfcpu.PDFInfo, error) {
return api.PDFInfo(file, file.Name(), nil, generator.PdfConfiguration())
return api.PDFInfo(file, file.Name(), nil, false, generator.PdfConfiguration())
}

func (suite *PaperworkServiceSuite) setupOrdersDocument() (services.PrimeDownloadMoveUploadPDFGenerator, models.Order) {
Expand Down
6 changes: 3 additions & 3 deletions src/constants/MoveHistory/Database/FieldMappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ export default {
shipment_type: 'Shipment type',
pickup_address: 'Pickup Address',
secondary_pickup_address: 'Second Pickup Address',
has_secondary_pickup_address: 'Secondary Pickup Address',
has_secondary_pickup_address: 'Second Pickup Address',
tertiary_pickup_address: 'Third Pickup Address',
has_tertiary_pickup_address: 'Third Pickup Address',
destination_address: 'Delivery Address',
secondary_destination_address: 'Second Delivery Address',
has_secondary_delivery_address: 'Secondary Delivery Address',
has_secondary_delivery_address: 'Second Delivery Address',
tertiary_destination_address: 'Third Delivery Address',
has_tertiary_destination_address: 'Third Delivery Address',
has_tertiary_delivery_address: 'Third Delivery Address',
receiving_agent: 'Receiving agent',
releasing_agent: 'Releasing agent',
tio_remarks: 'Max billable weight remark',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ describe('when given an mto shipment update with mto shipment table history reco
status: 'SUBMITTED',
tac_type: 'NTS',
uses_external_vendor: true,

has_secondary_pickup_address: true,
has_secondary_delivery_address: true,
has_tertiary_pickup_address: false,
has_tertiary_delivery_address: true,
advance_amount_requested: 100,
destination_postal_code: '29102',
estimated_incentive: 2252814,
Expand Down Expand Up @@ -103,6 +106,10 @@ describe('when given an mto shipment update with mto shipment table history reco
[FieldMappings.sit_estimated_entry_date, formatCustomerDate(changedValues.sit_estimated_entry_date)],
[FieldMappings.sit_estimated_weight, formatWeight(Number(changedValues.sit_estimated_weight))],
[FieldMappings.spouse_pro_gear_weight, formatWeight(Number(changedValues.spouse_pro_gear_weight))],
[FieldMappings.has_secondary_pickup_address, changedValues.has_secondary_pickup_address ? 'Yes' : 'No'],
[FieldMappings.has_secondary_delivery_address, changedValues.has_secondary_delivery_address ? 'Yes' : 'No'],
[FieldMappings.has_tertiary_pickup_address, changedValues.has_tertiary_pickup_address ? 'Yes' : 'No'],
[FieldMappings.has_tertiary_delivery_address, changedValues.has_tertiary_delivery_address ? 'Yes' : 'No'],
])('displays the correct details value for %s', async (label, value) => {
const targetItem = Object.fromEntries(
Object.entries(changedValues).filter(([key]) => FieldMappings[key] === label),
Expand Down

0 comments on commit 437ac4a

Please sign in to comment.