From 7962e22ecd965602476691e3dad837281b694958 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Fri, 20 Dec 2024 09:34:32 +0100 Subject: [PATCH 1/4] Update countryPriceInfo.js values --- .../resources/js/utils/countryPriceInfo.js | 70 +++++++++++++++++-- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/modules/ppcp-settings/resources/js/utils/countryPriceInfo.js b/modules/ppcp-settings/resources/js/utils/countryPriceInfo.js index 17504453b..8e2bcee9a 100644 --- a/modules/ppcp-settings/resources/js/utils/countryPriceInfo.js +++ b/modules/ppcp-settings/resources/js/utils/countryPriceInfo.js @@ -2,81 +2,139 @@ export const countryPriceInfo = { US: { fixedFee: { USD: 0.49, + GBP: 0.39, + CAD: 0.59, + AUD: 0.59, + EUR: 0.39, }, checkout: 3.49, - ccf: 2.59, - dw: 2.59, - apm: 2.59, - fastlane: 2.59, + plater: 4.99, + ccf: { + percentage: 2.59, + fixedFee: 0.29, + }, + dw: { + percentage: 2.59, + fixedFee: 0.29, + }, + apm: { + percentage: 2.89, + fixedFee: 0.29, + }, + fastlane: { + percentage: 2.59, + fixedFee: 0.29, + }, standardCardFields: 2.99, }, UK: { fixedFee: { GPB: 0.3, + USD: 0.3, + CAD: 0.3, + AUD: 0.3, + EUR: 0.35, }, checkout: 2.9, + plater: 2.9, ccf: 1.2, dw: 1.2, + fastlane: 1.2, apm: 1.2, standardCardFields: 1.2, }, CA: { fixedFee: { CAD: 0.3, + USD: 0.3, + GBP: 0.2, + AUD: 0.3, + EUR: 0.35, }, checkout: 2.9, ccf: 2.7, dw: 2.7, + fastlane: 2.7, apm: 2.9, standardCardFields: 2.9, }, AU: { fixedFee: { AUD: 0.3, + USD: 0.3, + GBP: 0.2, + CAD: 0.3, + EUR: 0.35, }, checkout: 2.6, + plater: 2.6, ccf: 1.75, dw: 1.75, + fastlane: 1.75, apm: 2.6, standardCardFields: 2.6, }, FR: { fixedFee: { EUR: 0.35, + USD: 0.3, + GBP: 0.3, + CAD: 0.3, + AUD: 0.3, }, checkout: 2.9, + plater: 2.9, ccf: 1.2, dw: 1.2, + fastlane: 1.2, apm: 1.2, standardCardFields: 1.2, }, IT: { fixedFee: { - EUR: 0.35, + EUR: 0.35, + USD: 0.3, + GBP: 0.3, + CAD: 0.3, + AUD: 0.3, }, checkout: 3.4, + plater: 3.4, ccf: 1.2, dw: 1.2, + fastlane: 1.2, apm: 1.2, standardCardFields: 1.2, }, DE: { fixedFee: { EUR: 0.39, + USD: 0.49, + GBP: 0.29, + CAD: 0.59, + AUD: 0.59, }, checkout: 2.99, + plater: 2.99, ccf: 2.99, dw: 2.99, + fastlane: 2.99, apm: 2.99, standardCardFields: 2.99, }, ES: { fixedFee: { - EUR: 0.35, + EUR: 0.35, + USD: 0.3, + GBP: 0.3, + CAD: 0.3, + AUD: 0.3, }, checkout: 2.9, + plater: 2.9, ccf: 1.2, dw: 1.2, + fastlane: 1.2, apm: 1.2, standardCardFields: 1.2, }, From 07e5c5d0e51e4a9aeccffd10df13080a3e8629f8 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Fri, 20 Dec 2024 11:43:33 +0100 Subject: [PATCH 2/4] Rename item as expected --- .../resources/js/utils/countryPriceInfo.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/ppcp-settings/resources/js/utils/countryPriceInfo.js b/modules/ppcp-settings/resources/js/utils/countryPriceInfo.js index 8e2bcee9a..c5cf52a3e 100644 --- a/modules/ppcp-settings/resources/js/utils/countryPriceInfo.js +++ b/modules/ppcp-settings/resources/js/utils/countryPriceInfo.js @@ -21,7 +21,7 @@ export const countryPriceInfo = { percentage: 2.89, fixedFee: 0.29, }, - fastlane: { + fast: { percentage: 2.59, fixedFee: 0.29, }, @@ -39,7 +39,7 @@ export const countryPriceInfo = { plater: 2.9, ccf: 1.2, dw: 1.2, - fastlane: 1.2, + fast: 1.2, apm: 1.2, standardCardFields: 1.2, }, @@ -54,7 +54,7 @@ export const countryPriceInfo = { checkout: 2.9, ccf: 2.7, dw: 2.7, - fastlane: 2.7, + fast: 2.7, apm: 2.9, standardCardFields: 2.9, }, @@ -70,7 +70,7 @@ export const countryPriceInfo = { plater: 2.6, ccf: 1.75, dw: 1.75, - fastlane: 1.75, + fast: 1.75, apm: 2.6, standardCardFields: 2.6, }, @@ -86,7 +86,7 @@ export const countryPriceInfo = { plater: 2.9, ccf: 1.2, dw: 1.2, - fastlane: 1.2, + fast: 1.2, apm: 1.2, standardCardFields: 1.2, }, @@ -102,7 +102,7 @@ export const countryPriceInfo = { plater: 3.4, ccf: 1.2, dw: 1.2, - fastlane: 1.2, + fast: 1.2, apm: 1.2, standardCardFields: 1.2, }, @@ -118,7 +118,7 @@ export const countryPriceInfo = { plater: 2.99, ccf: 2.99, dw: 2.99, - fastlane: 2.99, + fast: 2.99, apm: 2.99, standardCardFields: 2.99, }, @@ -134,7 +134,7 @@ export const countryPriceInfo = { plater: 2.9, ccf: 1.2, dw: 1.2, - fastlane: 1.2, + fast: 1.2, apm: 1.2, standardCardFields: 1.2, }, From 179f5a64168af099820a2f6c55d4963aee276f28 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Fri, 20 Dec 2024 11:46:00 +0100 Subject: [PATCH 3/4] Add new fixedAmount per item we need to add the new amount to the general fixed amount. Added also fastlane Fix passing currency instead of country --- .../ReusableComponents/PricingTitleBadge.js | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/PricingTitleBadge.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/PricingTitleBadge.js index 33825d96b..5603d10e4 100644 --- a/modules/ppcp-settings/resources/js/Components/ReusableComponents/PricingTitleBadge.js +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/PricingTitleBadge.js @@ -5,26 +5,29 @@ import { countryPriceInfo } from '../../utils/countryPriceInfo'; import { formatPrice } from '../../utils/formatPrice'; import TitleBadge, { TITLE_BADGE_INFO } from './TitleBadge'; -const getFixedAmount = ( currency, priceList ) => { - if ( priceList[ currency ] ) { - return formatPrice( priceList[ currency ], currency ); +const getFixedAmount = ( currency, priceList, itemFixedAmount ) => { + if ( priceList[ currency ] ) { + const sum = priceList[ currency ] + itemFixedAmount; + return formatPrice( sum, currency ); } const [ defaultCurrency, defaultPrice ] = Object.entries( priceList )[ 0 ]; - - return formatPrice( defaultPrice, defaultCurrency ); + const sum = defaultPrice + itemFixedAmount; + return formatPrice( sum, defaultCurrency ); }; const PricingTitleBadge = ( { item } ) => { - const { storeCountry } = CommonHooks.useWooSettings(); + const { storeCountry, storeCurrency } = CommonHooks.useWooSettings(); const infos = countryPriceInfo[ storeCountry ]; + const itemKey = item.split(' ')[0]; // Extract the first word, fastlane has more than one - if ( ! infos || ! infos[ item ] ) { + if ( ! infos || ! infos[ itemKey ] ) { return null; } - const percentage = infos[ item ].toFixed( 2 ); - const fixedAmount = getFixedAmount( storeCountry, infos.fixedFee ); + const percentage = typeof infos[itemKey] === 'number' ? infos[itemKey].toFixed(2) : infos[itemKey]['percentage'].toFixed(2); + const itemFixedAmount = infos[itemKey]['fixedFee'] ? infos[itemKey]['fixedFee'] : 0; + const fixedAmount = getFixedAmount( storeCurrency, infos.fixedFee, itemFixedAmount ); const label = sprintf( __( 'from %1$s%% + %2$s', 'woocommerce-paypal-payments' ), From c863ef7723bdea92f971be024bc1ca9fd0425582 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Fri, 20 Dec 2024 11:46:37 +0100 Subject: [PATCH 4/4] Add textbadge to Pay Later --- .../js/Components/ReusableComponents/WelcomeDocs/AcdcFlow.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/WelcomeDocs/AcdcFlow.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/WelcomeDocs/AcdcFlow.js index 89d4455e1..3f4a6ff02 100644 --- a/modules/ppcp-settings/resources/js/Components/ReusableComponents/WelcomeDocs/AcdcFlow.js +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/WelcomeDocs/AcdcFlow.js @@ -53,6 +53,9 @@ const AcdcFlow = ( { isFastlane, isPayLater, storeCountry } ) => { imageBadge={ [ 'icon-payment-method-paypal-small.svg', ] } + textBadge={ + + } description={ sprintf( // translators: %s: Link to PayPal business fees guide __(