Skip to content

Commit

Permalink
Merge branch 'MAIN-B-21527-counselor-actual-expense-reimbursement' in…
Browse files Browse the repository at this point in the history
…to INT-B-21527-counselor-actual-expense-reimbursement
  • Loading branch information
taeJungCaci committed Oct 29, 2024
2 parents cee5b83 + afd1797 commit 7ee27ba
Show file tree
Hide file tree
Showing 9 changed files with 337 additions and 17 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ require (
github.com/namsral/flag v1.7.4-pre
github.com/pdfcpu/pdfcpu v0.6.0
github.com/pkg/errors v0.9.1
github.com/pkg/sftp v1.13.6
github.com/pkg/sftp v1.13.7
github.com/pterm/pterm v0.12.79
github.com/rickar/cal/v2 v2.1.13
github.com/spf13/afero v1.11.0
Expand Down
7 changes: 5 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.5.0 h1:042Buzk+NhDI+DeSAA62RwJL8VAuZUMQZUjCsRz1Mug=
github.com/pkg/profile v1.5.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
github.com/pkg/sftp v1.13.6 h1:JFZT4XbOU7l77xGSpOdW+pwIMqP044IyjXX6FGyEKFo=
github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk=
github.com/pkg/sftp v1.13.7 h1:uv+I3nNJvlKZIQGSr8JVQLNHFU9YhhNpvC14Y6KgmSM=
github.com/pkg/sftp v1.13.7/go.mod h1:KMKI0t3T6hfA+lTR/ssZdunHo+uwq7ghoN09/FSu3DY=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down Expand Up @@ -720,6 +720,7 @@ golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
Expand Down Expand Up @@ -827,6 +828,7 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
Expand All @@ -844,6 +846,7 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
Expand Down
122 changes: 122 additions & 0 deletions pkg/handlers/internalapi/internal/payloads/payload_to_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/transcom/mymove/pkg/gen/internalmessages"
"github.com/transcom/mymove/pkg/handlers"
"github.com/transcom/mymove/pkg/models"
"github.com/transcom/mymove/pkg/unit"
)

func (suite *PayloadsSuite) TestAddressModel() {
Expand Down Expand Up @@ -328,3 +329,124 @@ func (suite *PayloadsSuite) TestPPMShipmentModelWithOptionalDestinationStreet1Fr
model3 := UpdatePPMShipmentModel(&ppmShipmentValidDestAddress1)
suite.Equal(model3.DestinationAddress.StreetAddress1, streetAddress1)
}

func (suite *PayloadsSuite) TestPPMShipmentModelFromUpdate() {
time := time.Now()
expectedDepartureDate := handlers.FmtDatePtr(&time)
estimatedWeight := int64(5000)
proGearWeight := int64(500)
spouseProGearWeight := int64(50)

address := models.Address{
StreetAddress1: "some address",
City: "city",
State: "state",
PostalCode: "12345",
Country: &models.Country{Country: "US"},
}
address2 := models.Address{
StreetAddress1: "some address",
City: "city",
State: "state",
PostalCode: "11111",
}
address3 := models.Address{
StreetAddress1: "some address",
City: "city",
State: "state",
PostalCode: "54321",
}

var pickupAddress internalmessages.Address
var secondaryPickupAddress internalmessages.Address
var tertiaryPickupAddress internalmessages.Address
var destinationAddress internalmessages.PPMDestinationAddress
var secondaryDestinationAddress internalmessages.Address
var tertiaryDestinationAddress internalmessages.Address

pickupAddress = internalmessages.Address{
City: &address.City,
Country: &address.Country.Country,
PostalCode: &address.PostalCode,
State: &address.State,
StreetAddress1: &address.StreetAddress1,
StreetAddress2: address.StreetAddress2,
StreetAddress3: address.StreetAddress3,
}
destinationAddress = internalmessages.PPMDestinationAddress{
City: &address.City,
Country: &address.Country.Country,
PostalCode: &address.PostalCode,
State: &address.State,
StreetAddress1: &address.StreetAddress1,
StreetAddress2: address.StreetAddress2,
StreetAddress3: address.StreetAddress3,
}
secondaryPickupAddress = internalmessages.Address{
City: &address2.City,
Country: &address.Country.Country,
PostalCode: &address2.PostalCode,
State: &address2.State,
StreetAddress1: &address2.StreetAddress1,
StreetAddress2: address2.StreetAddress2,
StreetAddress3: address2.StreetAddress3,
}
secondaryDestinationAddress = internalmessages.Address{
City: &address2.City,
Country: &address.Country.Country,
PostalCode: &address2.PostalCode,
State: &address2.State,
StreetAddress1: &address2.StreetAddress1,
StreetAddress2: address2.StreetAddress2,
StreetAddress3: address2.StreetAddress3,
}
tertiaryPickupAddress = internalmessages.Address{
City: &address3.City,
Country: &address.Country.Country,
PostalCode: &address3.PostalCode,
State: &address3.State,
StreetAddress1: &address3.StreetAddress1,
StreetAddress2: address3.StreetAddress2,
StreetAddress3: address3.StreetAddress3,
}
tertiaryDestinationAddress = internalmessages.Address{
City: &address3.City,
Country: &address.Country.Country,
PostalCode: &address3.PostalCode,
State: &address3.State,
StreetAddress1: &address3.StreetAddress1,
StreetAddress2: address3.StreetAddress2,
StreetAddress3: address3.StreetAddress3,
}

ppmShipment := internalmessages.UpdatePPMShipment{
ExpectedDepartureDate: expectedDepartureDate,
PickupAddress: &pickupAddress,
SecondaryPickupAddress: &secondaryPickupAddress,
TertiaryPickupAddress: &tertiaryPickupAddress,
DestinationAddress: &destinationAddress,
SecondaryDestinationAddress: &secondaryDestinationAddress,
TertiaryDestinationAddress: &tertiaryDestinationAddress,
SitExpected: models.BoolPointer(true),
EstimatedWeight: &estimatedWeight,
HasProGear: models.BoolPointer(true),
ProGearWeight: &proGearWeight,
SpouseProGearWeight: &spouseProGearWeight,
IsActualExpenseReimbursement: models.BoolPointer(true),
}

model := UpdatePPMShipmentModel(&ppmShipment)

suite.NotNil(model)
suite.True(*model.SITExpected)
suite.Equal(unit.Pound(estimatedWeight), *model.EstimatedWeight)
suite.True(*model.HasProGear)
suite.Equal(unit.Pound(proGearWeight), *model.ProGearWeight)
suite.Equal(unit.Pound(spouseProGearWeight), *model.SpouseProGearWeight)
suite.Nil(model.HasSecondaryPickupAddress)
suite.Nil(model.HasSecondaryDestinationAddress)
suite.Nil(model.HasTertiaryPickupAddress)
suite.Nil(model.HasTertiaryDestinationAddress)
suite.True(*model.IsActualExpenseReimbursement)
suite.NotNil(model)
}
43 changes: 37 additions & 6 deletions pkg/handlers/primeapi/payloads/payload_to_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,13 @@ func (suite *PayloadsSuite) TestPPMShipmentModelFromCreate() {
spouseProGearWeight := int64(50)

ppmShipment := primemessages.CreatePPMShipment{
ExpectedDepartureDate: expectedDepartureDate,
SitExpected: &sitExpected,
EstimatedWeight: &estimatedWeight,
HasProGear: &hasProGear,
ProGearWeight: &proGearWeight,
SpouseProGearWeight: &spouseProGearWeight,
ExpectedDepartureDate: expectedDepartureDate,
SitExpected: &sitExpected,
EstimatedWeight: &estimatedWeight,
HasProGear: &hasProGear,
ProGearWeight: &proGearWeight,
SpouseProGearWeight: &spouseProGearWeight,
IsActualExpenseReimbursement: models.BoolPointer(true),
}

model := PPMShipmentModelFromCreate(&ppmShipment)
Expand All @@ -518,6 +519,36 @@ func (suite *PayloadsSuite) TestPPMShipmentModelFromCreate() {
suite.True(*model.HasProGear)
suite.Equal(unit.Pound(proGearWeight), *model.ProGearWeight)
suite.Equal(unit.Pound(spouseProGearWeight), *model.SpouseProGearWeight)
suite.True(*model.IsActualExpenseReimbursement)
}

func (suite *PayloadsSuite) TestPPMShipmentModelFromUpdate() {
time := time.Now()
expectedDepartureDate := handlers.FmtDatePtr(&time)
estimatedWeight := int64(5000)
proGearWeight := int64(500)
spouseProGearWeight := int64(50)

ppmShipment := primemessages.UpdatePPMShipment{
ExpectedDepartureDate: expectedDepartureDate,
SitExpected: models.BoolPointer(true),
EstimatedWeight: &estimatedWeight,
HasProGear: models.BoolPointer(true),
ProGearWeight: &proGearWeight,
SpouseProGearWeight: &spouseProGearWeight,
IsActualExpenseReimbursement: models.BoolPointer(true),
}

model := PPMShipmentModelFromUpdate(&ppmShipment)

suite.NotNil(model)
suite.True(*model.SITExpected)
suite.Equal(unit.Pound(estimatedWeight), *model.EstimatedWeight)
suite.True(*model.HasProGear)
suite.Equal(unit.Pound(proGearWeight), *model.ProGearWeight)
suite.Equal(unit.Pound(spouseProGearWeight), *model.SpouseProGearWeight)
suite.True(*model.IsActualExpenseReimbursement)
suite.NotNil(model)
}

func (suite *PayloadsSuite) TestCountryModel_WithValidCountry() {
Expand Down
43 changes: 37 additions & 6 deletions pkg/handlers/primeapiv2/payloads/payload_to_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,13 @@ func (suite *PayloadsSuite) TestPPMShipmentModelFromCreate() {
spouseProGearWeight := int64(50)

ppmShipment := primev2messages.CreatePPMShipment{
ExpectedDepartureDate: expectedDepartureDate,
SitExpected: &sitExpected,
EstimatedWeight: &estimatedWeight,
HasProGear: &hasProGear,
ProGearWeight: &proGearWeight,
SpouseProGearWeight: &spouseProGearWeight,
ExpectedDepartureDate: expectedDepartureDate,
SitExpected: &sitExpected,
EstimatedWeight: &estimatedWeight,
HasProGear: &hasProGear,
ProGearWeight: &proGearWeight,
SpouseProGearWeight: &spouseProGearWeight,
IsActualExpenseReimbursement: models.BoolPointer(true),
}

model := PPMShipmentModelFromCreate(&ppmShipment)
Expand All @@ -486,6 +487,36 @@ func (suite *PayloadsSuite) TestPPMShipmentModelFromCreate() {
suite.True(*model.HasProGear)
suite.Equal(unit.Pound(proGearWeight), *model.ProGearWeight)
suite.Equal(unit.Pound(spouseProGearWeight), *model.SpouseProGearWeight)
suite.True(*model.IsActualExpenseReimbursement)
}

func (suite *PayloadsSuite) TestPPMShipmentModelFromUpdate() {
time := time.Now()
expectedDepartureDate := handlers.FmtDatePtr(&time)
estimatedWeight := int64(5000)
proGearWeight := int64(500)
spouseProGearWeight := int64(50)

ppmShipment := primev2messages.UpdatePPMShipment{
ExpectedDepartureDate: expectedDepartureDate,
SitExpected: models.BoolPointer(true),
EstimatedWeight: &estimatedWeight,
HasProGear: models.BoolPointer(true),
ProGearWeight: &proGearWeight,
SpouseProGearWeight: &spouseProGearWeight,
IsActualExpenseReimbursement: models.BoolPointer(true),
}

model := PPMShipmentModelFromUpdate(&ppmShipment)

suite.NotNil(model)
suite.True(*model.SITExpected)
suite.Equal(unit.Pound(estimatedWeight), *model.EstimatedWeight)
suite.True(*model.HasProGear)
suite.Equal(unit.Pound(proGearWeight), *model.ProGearWeight)
suite.Equal(unit.Pound(spouseProGearWeight), *model.SpouseProGearWeight)
suite.True(*model.IsActualExpenseReimbursement)
suite.NotNil(model)
}

func (suite *PayloadsSuite) TestCountryModel_WithValidCountry() {
Expand Down
Loading

0 comments on commit 7ee27ba

Please sign in to comment.