Skip to content

fix(payments-next): Update Checkout and Upgrade pages to reflect correct amount due#19075

Merged
xlisachan merged 1 commit intomainfrom
FXA-11929
Jul 9, 2025
Merged

fix(payments-next): Update Checkout and Upgrade pages to reflect correct amount due#19075
xlisachan merged 1 commit intomainfrom
FXA-11929

Conversation

@xlisachan
Copy link
Contributor

@xlisachan xlisachan commented Jun 23, 2025

Because

  • the list price is being displayed instead of the price of the offering
  • on Subscription Management page, the total credit balance is deducted from all subscriptions
  • totals on Success page reflected upcoming invoice

This pull request

  • updates the price of the offering from the list price to the unit amount
  • removes upcoming invoice total from Subscription Management, as it deducts total account balance from each subscription
  • updates Success pages for Checkout and Upgrade flow
  • updates Start page for Upgrade
  • removes invoice information on Error, In-progress, Needs Input pages
  • updates SubscriptionFirstInvoice and SubscriptionUpgrade emails to display total due

Issue that this pull request solves

Closes: FXA-11929, FXA-11077, FXA-11729

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.

Other information (Optional)

Outline of changes

@xlisachan xlisachan force-pushed the FXA-11929 branch 4 times, most recently from a6b5467 to fec3155 Compare June 27, 2025 21:28
Comment on lines 27 to 29
const unusedAmountTotal = invoice.lines.data
.filter((line) => line.amount < 0)
.reduce((sum, line) => sum + line.amount, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invoice.lines can contain a bunch of different things, and IMO it's risky to sum the amounts together on an invoice to get the unusedAmountTotal.

If the intention is to calculate the total proration, maybe consider making use of the invoice.lines.data.proration flag.

Comment on lines 31 to 37
let unitAmount;
if (invoice.lines.data[invoice.lines.data.length - 1]) {
unitAmount = Number(
invoice.lines.data[invoice.lines.data.length - 1]
.unit_amount_excluding_tax
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe to assume the last item in invoice.lines will always provide the correct value?

@xlisachan xlisachan force-pushed the FXA-11929 branch 4 times, most recently from 833ab93 to 99f4115 Compare July 3, 2025 15:30
@xlisachan xlisachan changed the title fix(payments-next): Display unit amount of offering instead of list price fix(payments-next): Update Checkout and Upgrade pages to reflect correct amount due Jul 3, 2025
@xlisachan xlisachan force-pushed the FXA-11929 branch 10 times, most recently from 66aef4b to de1b35b Compare July 7, 2025 12:53
@xlisachan xlisachan marked this pull request as ready for review July 7, 2025 13:32
@xlisachan xlisachan requested review from a team as code owners July 7, 2025 13:32
...links,
uid,
email,
invoiceAmountDue: this._getLocalizedCurrencyString(
Copy link
Contributor

@bcolsson bcolsson Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 This is great, it looks like we're getting a localized version of this variable!
Is it out of the scope for this patch to also fix $productPaymentCycleOld / $productPaymentCycleNew ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately it is out of scope for this patch. We have a ticket that includes the improvement mentioned, as well as other updates.

price.id,
cart.currency
);
assertNotNull(offeringPrice);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch this over to an explicit error, if you don't mind. Its easier to debug than AssertionError's are

...InvoicePreviewFactory(override),
oneTimeCharge: faker.number.int({ min: 1, max: 1000 }),
oneTimeChargeSubtotal: faker.number.int({ min: 1, max: 1000 }),
amountDue: faker.number.int({ min: 0, max: 1000 }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update this to have min: 1, rather than min: 0, as an unexpected value of 0 here can have unintended consequences for how we process transactions

@david1alvarez david1alvarez self-requested a review July 9, 2025 16:10
Copy link
Contributor

@david1alvarez david1alvarez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+wc, looks great! The changes looked good across the board

Copy link
Contributor

@david1alvarez david1alvarez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…ect amount due

Because

- the list price is being displayed instead of the price of the offering
- on Subscription Management page, the total credit balance is deducted from all subscriptions
- totals on Success page reflect upcoming invoice
- emails are not displaying correct amount charged

This pull request

- updates the price of the offering from the list price to the unit amount
- temporary removes inaccurate upcoming invoice total from Subscription Management
- updates charged amount in email

Closes: FXA-11929
@xlisachan xlisachan assigned xlisachan and unassigned xlisachan Jul 9, 2025
@xlisachan xlisachan merged commit 1a0c80a into main Jul 9, 2025
19 checks passed
@xlisachan xlisachan deleted the FXA-11929 branch July 9, 2025 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants