Create countryPriceInfo util

This commit is contained in:
Narek Zakarian 2024-11-26 18:18:02 +04:00
parent d768c4e24f
commit db8a6cccd2
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7
6 changed files with 6 additions and 95 deletions

View file

@ -2,13 +2,13 @@ import BadgeBox, { BADGE_BOX_TITLE_BIG } from '../BadgeBox';
import { __, sprintf } from '@wordpress/i18n';
import Separator from '../Separator';
import generatePriceText from '../../../utils/badgeBoxUtils';
import { countryPriceInfo } from '../../../utils/countryPriceInfo';
const AcdcOptionalPaymentMethods = ( {
isFastlane,
isPayLater,
storeCountry,
storeCurrency,
countryPriceInfo,
} ) => {
if ( isFastlane && isPayLater && storeCountry === 'us' ) {
return (

View file

@ -1,12 +1,12 @@
import BadgeBox from '../BadgeBox';
import { __, sprintf } from '@wordpress/i18n';
import generatePriceText from '../../../utils/badgeBoxUtils';
import { countryPriceInfo } from '../../../utils/countryPriceInfo';
const BcdcOptionalPaymentMethods = ( {
isPayLater,
storeCountry,
storeCurrency,
countryPriceInfo,
} ) => {
if ( isPayLater && storeCountry === 'us' ) {
return (

View file

@ -7,7 +7,6 @@ const OptionalPaymentMethods = ( {
isPayLater,
storeCountry,
storeCurrency,
countryPriceInfo,
} ) => {
return (
<div className="ppcp-r-optional-payment-methods">
@ -17,14 +16,12 @@ const OptionalPaymentMethods = ( {
isPayLater={ isPayLater }
storeCountry={ storeCountry }
storeCurrency={ storeCurrency }
countryPriceInfo={ countryPriceInfo }
/>
) : (
<BcdcOptionalPaymentMethods
isPayLater={ isPayLater }
storeCountry={ storeCountry }
storeCurrency={ storeCurrency }
countryPriceInfo={ countryPriceInfo }
/>
) }
</div>

View file

@ -2,6 +2,8 @@ import BadgeBox, { BADGE_BOX_TITLE_BIG } from '../BadgeBox';
import { __, sprintf } from '@wordpress/i18n';
import Separator from '../Separator';
import generatePriceText from '../../../utils/badgeBoxUtils';
import { countryPriceInfo } from '../../../utils/countryPriceInfo';
import OptionalPaymentMethods from '../OptionalPaymentMethods/OptionalPaymentMethods';
const AcdcFlow = ( {
@ -9,7 +11,6 @@ const AcdcFlow = ( {
isPayLater,
storeCountry,
storeCurrency,
countryPriceInfo,
} ) => {
if ( isFastlane && isPayLater && storeCountry === 'us' ) {
return (
@ -116,7 +117,6 @@ const AcdcFlow = ( {
isPayLater={ isPayLater }
storeCountry={ storeCountry }
storeCurrency={ storeCurrency }
countryPriceInfo={ countryPriceInfo }
/>
</div>
</div>
@ -202,7 +202,6 @@ const AcdcFlow = ( {
isPayLater={ isPayLater }
storeCountry={ storeCountry }
storeCurrency={ storeCurrency }
countryPriceInfo={ countryPriceInfo }
/>
</div>
</div>
@ -282,7 +281,6 @@ const AcdcFlow = ( {
isPayLater={ isPayLater }
storeCountry={ storeCountry }
storeCurrency={ storeCurrency }
countryPriceInfo={ countryPriceInfo }
/>
</div>
</div>

View file

@ -2,14 +2,10 @@ import BadgeBox, { BADGE_BOX_TITLE_BIG } from '../BadgeBox';
import { __, sprintf } from '@wordpress/i18n';
import Separator from '../Separator';
import generatePriceText from '../../../utils/badgeBoxUtils';
import { countryPriceInfo } from '../../../utils/countryPriceInfo';
import OptionalPaymentMethods from '../OptionalPaymentMethods/OptionalPaymentMethods';
const BcdcFlow = ( {
isPayLater,
storeCountry,
storeCurrency,
countryPriceInfo,
} ) => {
const BcdcFlow = ( { isPayLater, storeCountry, storeCurrency } ) => {
if ( isPayLater && storeCountry === 'us' ) {
return (
<div className="ppcp-r-welcome-docs__wrapper">
@ -115,7 +111,6 @@ const BcdcFlow = ( {
isPayLater={ isPayLater }
storeCountry={ storeCountry }
storeCurrency={ storeCurrency }
countryPriceInfo={ countryPriceInfo }
/>
</div>
</div>
@ -187,7 +182,6 @@ const BcdcFlow = ( {
isPayLater={ isPayLater }
storeCountry={ storeCountry }
storeCurrency={ storeCurrency }
countryPriceInfo={ countryPriceInfo }
/>
</div>
);

View file

@ -19,82 +19,6 @@ const WelcomeDocs = ( {
'https://woocommerce.com/document/woocommerce-paypal-payments/#manual-credential-input '
);
const countryPriceInfo = {
us: {
currencySymbol: '$',
fixedFee: 0.49,
checkout: 3.49,
ccf: 2.59,
dw: 2.59,
apm: 2.59,
fastlane: 2.59,
standardCardFields: 2.99,
},
uk: {
currencySymbol: '£',
fixedFee: 0.3,
checkout: 2.9,
ccf: 1.2,
dw: 1.2,
apm: 1.2,
standardCardFields: 1.2,
},
ca: {
currencySymbol: '$',
fixedFee: 0.3,
checkout: 2.9,
ccf: 2.7,
dw: 2.7,
apm: 2.9,
standardCardFields: 2.9,
},
au: {
currencySymbol: '$',
fixedFee: 0.3,
checkout: 2.6,
ccf: 1.75,
dw: 1.75,
apm: 2.6,
standardCardFields: 2.6,
},
fr: {
currencySymbol: '€',
fixedFee: 0.35,
checkout: 2.9,
ccf: 1.2,
dw: 1.2,
apm: 1.2,
standardCardFields: 1.2,
},
it: {
currencySymbol: '€',
fixedFee: 0.35,
checkout: 3.4,
ccf: 1.2,
dw: 1.2,
apm: 1.2,
standardCardFields: 1.2,
},
de: {
currencySymbol: '€',
fixedFee: 0.39,
checkout: 2.99,
ccf: 2.99,
dw: 2.99,
apm: 2.99,
standardCardFields: 2.99,
},
es: {
currencySymbol: '€',
fixedFee: 0.35,
checkout: 2.9,
ccf: 1.2,
dw: 1.2,
apm: 1.2,
standardCardFields: 1.2,
},
};
return (
<div className="ppcp-r-welcome-docs">
<h2 className="ppcp-r-welcome-docs__title">
@ -109,14 +33,12 @@ const WelcomeDocs = ( {
isPayLater={ isPayLater }
storeCountry={ storeCountry }
storeCurrency={ storeCurrency }
countryPriceInfo={ countryPriceInfo }
/>
) : (
<BcdcFlow
isPayLater={ isPayLater }
storeCountry={ storeCountry }
storeCurrency={ storeCurrency }
countryPriceInfo={ countryPriceInfo }
/>
) }
<p