Skip to content

Commit

Permalink
Merge pull request #958 from guardian/ph-20231118-1557-supporter-plus…
Browse files Browse the repository at this point in the history
…-fix

correct bug in supporter+ charge override for annuals
  • Loading branch information
shtukas authored Nov 20, 2023
2 parents 11e8372 + 3d3e8b4 commit 7ae4c3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,14 @@ object SupporterPlus2023V1V2Migration {
val chargeOverrides = for {
currency <- item.currency
price <- currencyToNewPrice("Annual", currency).toOption
estimatedPrice <- item.estimatedNewPrice
oldPrice <- item.oldPrice
} yield {
if (estimatedPrice > price) {
if (oldPrice > price) {
List(
ChargeOverride(
productRatePlanChargeId = "8a12892d85fc6df4018602451322287f", // Annual Contribution
billingPeriod = "Annual",
price = estimatedPrice - price
price = oldPrice - price
)
)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,8 @@ class AmendmentHandlerTest extends munit.FunSuite {
processingStage = NotificationSendDateWrittenToSalesforce,
startDate = Some(LocalDate.of(2024, 6, 28)),
currency = Some("GBP"),
oldPrice = Some(BigDecimal(120)),
estimatedNewPrice = Some(BigDecimal(120)),
oldPrice = Some(BigDecimal(120)), // Here we simulate the subscription having a £25 contribution
estimatedNewPrice = Some(BigDecimal(95)), // correct rate plan price for annual GBP
billingPeriod = Some("Annual")
)

Expand Down

0 comments on commit 7ae4c3c

Please sign in to comment.