Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import type { Metadata } from 'next';
import { headers } from 'next/headers';
import Image from 'next/image';
import { auth } from 'apps/payments/next/auth';

import { SubPlatPaymentMethodType } from '@fxa/payments/customer';
import { getCardIcon } from '@fxa/payments/ui';
import {
fetchCMSData,
Expand Down Expand Up @@ -140,47 +142,23 @@ export default async function CheckoutSuccess({
cart.latestInvoicePreview?.currency,
locale
)}
{cart.paymentInfo.walletType === 'apple_pay' ? (
{cart.paymentInfo.walletType ? (
<div className="flex items-center gap-3">
<Image
src={getCardIcon('apple_pay', l10n).img}
alt={l10n.getString('apple-pay-logo-alt-text', 'Apple Pay logo')}
width={40}
height={24}
src={getCardIcon(cart.paymentInfo.walletType, l10n).img}
alt={getCardIcon(cart.paymentInfo.walletType, l10n).altText}
width={getCardIcon(cart.paymentInfo.walletType, l10n).width}
height={getCardIcon(cart.paymentInfo.walletType, l10n).height}
/>
</div>
) : cart.paymentInfo.walletType === 'google_pay' ? (
<div className="flex items-center gap-3">
) : cart.paymentInfo.type === SubPlatPaymentMethodType.Card &&
cart.paymentInfo.brand ? (
<span className="flex items-center gap-2">
<Image
src={getCardIcon('google_pay', l10n).img}
alt={l10n.getString('google-pay-logo-alt-text', 'Google Pay logo')}
width={40}
height={24}
src={getCardIcon(cart.paymentInfo.brand, l10n).img}
alt={getCardIcon(cart.paymentInfo.brand, l10n).altText}
className="w-10 h-auto object-cover"
/>
</div>
) : cart.paymentInfo.type === 'external_paypal' ? (
<Image
src={getCardIcon('paypal', l10n).img}
alt={l10n.getString('paypal-logo-alt-text', 'PayPal logo')}
width={91}
height={24}
/>
) : cart.paymentInfo.type === 'link' ? (
<Image
src={getCardIcon('link', l10n).img}
alt={l10n.getString('link-logo-alt-text', 'Link logo')}
width={70}
height={24}
/>
) : (
<span className="flex items-center gap-2">
{cart.paymentInfo.brand && (
<Image
src={getCardIcon(cart.paymentInfo.brand, l10n).img}
alt={getCardIcon(cart.paymentInfo.brand, l10n).altText}
className="w-10 h-auto object-cover"
/>
)}
{l10n.getString(
'next-payment-confirmation-cc-card-ending-in',
{
Expand All @@ -189,6 +167,15 @@ export default async function CheckoutSuccess({
`Card ending in ${cart.paymentInfo.last4}`
)}
</span>
) : (
<div className="flex items-center gap-3">
<Image
src={getCardIcon(cart.paymentInfo.type, l10n).img}
alt={getCardIcon(cart.paymentInfo.type, l10n).altText}
width={getCardIcon(cart.paymentInfo.type, l10n).width}
height={getCardIcon(cart.paymentInfo.type, l10n).height}
/>
</div>
)}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { headers } from 'next/headers';
import Image from 'next/image';
import { Metadata } from 'next';
import { auth } from 'apps/payments/next/auth';

import { SubPlatPaymentMethodType } from '@fxa/payments/customer';
import { getCardIcon } from '@fxa/payments/ui';
import {
fetchCMSData,
getCartOrRedirectAction,
} from '@fxa/payments/ui/actions';
import {
CheckoutParams,
SupportedPages,
getApp,
buildPageMetadata,
} from '@fxa/payments/ui/server';
import {
fetchCMSData,
getCartOrRedirectAction,
} from '@fxa/payments/ui/actions';
import { CheckoutParams } from '@fxa/payments/ui/server';
import Image from 'next/image';
import { Metadata } from 'next';
import { config } from 'apps/payments/next/config';

export const dynamic = 'force-dynamic';
Expand Down Expand Up @@ -141,39 +143,17 @@ export default async function UpgradeSuccess({
cart.latestInvoicePreview?.currency,
locale
)}
{cart.paymentInfo.walletType === 'apple_pay' ? (
<div className="flex items-center gap-3">
<Image
src={getCardIcon('apple_pay', l10n).img}
alt={l10n.getString('apple-pay-logo-alt-text', 'Apple Pay logo')}
width={40}
height={24}
/>
</div>
) : cart.paymentInfo.walletType === 'google_pay' ? (
{cart.paymentInfo.walletType ? (
<div className="flex items-center gap-3">
<Image
src={getCardIcon('google_pay', l10n).img}
alt={l10n.getString('google-pay-logo-alt-text', 'Google Pay logo')}
width={40}
height={24}
src={getCardIcon(cart.paymentInfo.walletType, l10n).img}
alt={getCardIcon(cart.paymentInfo.walletType, l10n).altText}
width={getCardIcon(cart.paymentInfo.walletType, l10n).width}
height={getCardIcon(cart.paymentInfo.walletType, l10n).height}
/>
</div>
) : cart.paymentInfo.type === 'external_paypal' ? (
<Image
src={getCardIcon('paypal', l10n).img}
alt={l10n.getString('paypal-logo-alt-text', 'PayPal logo')}
width={91}
height={24}
/>
) : cart.paymentInfo.type === 'link' ? (
<Image
src={getCardIcon('link', l10n).img}
alt={l10n.getString('link-logo-alt-text', 'Link logo')}
width={70}
height={24}
/>
) : (
) : cart.paymentInfo.type === SubPlatPaymentMethodType.Card &&
cart.paymentInfo.brand ? (
<span className="flex items-center gap-2">
{cart.paymentInfo.brand && (
<Image
Expand All @@ -190,6 +170,15 @@ export default async function UpgradeSuccess({
`Card ending in ${cart.paymentInfo.last4}`
)}
</span>
) : (
<div className="flex items-center gap-3">
<Image
src={getCardIcon(cart.paymentInfo.type, l10n).img}
alt={getCardIcon(cart.paymentInfo.type, l10n).altText}
width={getCardIcon(cart.paymentInfo.type, l10n).width}
height={getCardIcon(cart.paymentInfo.type, l10n).height}
/>
</div>
)}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import { headers } from 'next/headers';
import Image from 'next/image';

import { SubPlatPaymentMethodType } from '@fxa/payments/customer';
import { getCardIcon, PaymentSection } from '@fxa/payments/ui';
import {
fetchCMSData,
Expand Down Expand Up @@ -90,39 +92,17 @@ export default async function Upgrade({

{cart.paymentInfo && (
<div className="flex items-center justify-between mt-4 text-sm">
{cart.paymentInfo.walletType === 'apple_pay' ? (
<div className="flex items-center gap-3">
<Image
src={getCardIcon('apple_pay', l10n).img}
alt={l10n.getString('apple-pay-logo-alt-text', 'Apple Pay logo')}
width={40}
height={24}
/>
</div>
) : cart.paymentInfo.walletType === 'google_pay' ? (
{cart.paymentInfo.walletType ? (
<div className="flex items-center gap-3">
<Image
src={getCardIcon('google_pay', l10n).img}
alt={l10n.getString('google-pay-logo-alt-text', 'Google Pay logo')}
width={40}
height={24}
src={getCardIcon(cart.paymentInfo.walletType, l10n).img}
alt={getCardIcon(cart.paymentInfo.walletType, l10n).altText}
width={getCardIcon(cart.paymentInfo.walletType, l10n).width}
height={getCardIcon(cart.paymentInfo.walletType, l10n).height}
/>
</div>
) : cart.paymentInfo.type === 'external_paypal' ? (
<Image
src={getCardIcon('paypal', l10n).img}
alt={l10n.getString('paypal-logo-alt-text', 'PayPal logo')}
width={91}
height={24}
/>
) : cart.paymentInfo.type === 'link' ? (
<Image
src={getCardIcon('link', l10n).img}
alt={l10n.getString('link-logo-alt-text', 'Link logo')}
width={70}
height={24}
/>
) : (
) : cart.paymentInfo.type === SubPlatPaymentMethodType.Card &&
cart.paymentInfo.brand ? (
<span className="flex items-center gap-2">
{cart.paymentInfo.brand && (
<Image
Expand All @@ -139,6 +119,15 @@ export default async function Upgrade({
`Card ending in ${cart.paymentInfo.last4}`
)}
</span>
) : (
<div className="flex items-center gap-3">
<Image
src={getCardIcon(cart.paymentInfo.type, l10n).img}
alt={getCardIcon(cart.paymentInfo.type, l10n).altText}
width={getCardIcon(cart.paymentInfo.type, l10n).width}
height={getCardIcon(cart.paymentInfo.type, l10n).height}
/>
</div>
)}
</div>
)}
Expand Down