Skip to content

Commit

Permalink
Handle PPCP as PayPal method in list and receipts (#97247)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldcain authored Dec 9, 2024
1 parent fbf691b commit e3aaaa6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
14 changes: 10 additions & 4 deletions client/lib/checkout/payment-methods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ import payPalImage from 'calypso/assets/images/upgrades/paypal.svg';
import razorpayImage from 'calypso/assets/images/upgrades/upi.svg';

export const PARTNER_PAYPAL_EXPRESS = 'paypal_express';
export const PARTNER_PAYPAL_PPCP = 'paypal_ppcp';
export const PARTNER_RAZORPAY = 'razorpay';
export const PAYMENT_AGREEMENTS_PARTNERS = [ PARTNER_PAYPAL_EXPRESS, PARTNER_RAZORPAY ];
export const PAYMENT_AGREEMENTS_PARTNERS = [
PARTNER_PAYPAL_EXPRESS,
PARTNER_PAYPAL_PPCP,
PARTNER_RAZORPAY,
];
export const UPI_PARTNERS = [ PARTNER_RAZORPAY ];

/**
Expand Down Expand Up @@ -53,7 +58,7 @@ export interface StoredPaymentMethodBase {
}

export interface StoredPaymentMethodPayPal extends StoredPaymentMethodBase {
payment_partner: 'paypal_express';
payment_partner: 'paypal_express' | 'paypal_ppcp';
}

export interface StoredPaymentMethodRazorpay extends StoredPaymentMethodBase {
Expand Down Expand Up @@ -125,8 +130,9 @@ const CREDIT_CARD_SELECTED_PATHS: ImagePathsMap = {
mastercard: creditCardMasterCardImage,
unionpay: creditCardUnionPayImage,
visa: creditCardVisaImage,
paypal_express: payPalImage,
paypal: payPalImage,
paypal_express: payPalImage,
paypal_ppcp: payPalImage,
razorpay: razorpayImage,
};

Expand All @@ -148,7 +154,7 @@ export const PaymentMethodSummary = ( {
email?: string;
} ) => {
const translate = useTranslate();
if ( type === PARTNER_PAYPAL_EXPRESS ) {
if ( type === PARTNER_PAYPAL_EXPRESS || type === PARTNER_PAYPAL_PPCP ) {
return <>{ email || '' }</>;
}
if ( type === PARTNER_RAZORPAY ) {
Expand Down
7 changes: 5 additions & 2 deletions client/me/purchases/billing-history/receipt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Main from 'calypso/components/main';
import NavigationHeader from 'calypso/components/navigation-header';
import TextareaAutosize from 'calypso/components/textarea-autosize';
import PageViewTracker from 'calypso/lib/analytics/page-view-tracker';
import { PARTNER_PAYPAL_EXPRESS } from 'calypso/lib/checkout/payment-methods';
import { PARTNER_PAYPAL_EXPRESS, PARTNER_PAYPAL_PPCP } from 'calypso/lib/checkout/payment-methods';
import { billingHistory, vatDetails as vatDetailsPath } from 'calypso/me/purchases/paths';
import titles from 'calypso/me/purchases/titles';
import useVatDetails from 'calypso/me/purchases/vat-info/use-vat-details';
Expand Down Expand Up @@ -207,7 +207,10 @@ function ReceiptPaymentMethod( { transaction }: { transaction: BillingTransactio
const translate = useTranslate();
let text;

if ( transaction.pay_part === PARTNER_PAYPAL_EXPRESS ) {
if (
transaction.pay_part === PARTNER_PAYPAL_EXPRESS ||
transaction.pay_part === PARTNER_PAYPAL_PPCP
) {
text = translate( 'PayPal' );
} else if ( 'XXXX' !== transaction.cc_num ) {
text = translate( '%(cardType)s ending in %(cardNum)s', {
Expand Down

0 comments on commit e3aaaa6

Please sign in to comment.