Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/MAIN-B-22206' into INT-B-22206
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljordan-caci committed Jan 15, 2025
2 parents aef8835 + 48c0324 commit 1b9fb96
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions pkg/services/ghcrateengine/intl_shipping_and_linehaul_pricer.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,18 @@ func (p intlShippingAndLinehaulPricer) Price(appCtx appcontext.AppContext, contr
return 0, nil, fmt.Errorf("could not find contract with code: %s: %w", contractCode, err)
}

basePrice := float64(perUnitCents)
escalatedPrice, contractYear, err := escalatePriceForContractYear(
appCtx,
contract.ID,
referenceDate,
false,
basePrice)
// getting the contract year so we can use the escalation compounded value
contractYear, err := fetchContractYear(appCtx, contract.ID, referenceDate)
if err != nil {
return 0, nil, fmt.Errorf("could not calculate escalated price: %w", err)
return 0, nil, fmt.Errorf("could not find contract year with contract ID: %s and date: %s: %w", contract.ID, referenceDate, err)
}

basePrice := float64(perUnitCents)
escalatedPrice := basePrice * contractYear.EscalationCompounded
escalatedPrice = math.Round(escalatedPrice) // round before multiplying with the weight

escalatedPrice = escalatedPrice * weight.ToCWTFloat64()
totalPriceCents := unit.Cents(math.Round(escalatedPrice))
totalPriceCents := unit.Cents(escalatedPrice)

params := services.PricingDisplayParams{
{
Expand Down

0 comments on commit 1b9fb96

Please sign in to comment.