2024-11-25 19:00:21 +04:00
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
|
2024-11-26 15:01:21 +04:00
|
|
|
const generatePriceText = ( type, selectedCountryPrice, storeCurrency ) => {
|
|
|
|
if ( ! selectedCountryPrice || ! selectedCountryPrice[ type ] ) {
|
|
|
|
console.warn( `Invalid type or price data for: ${ type }` );
|
|
|
|
return '';
|
|
|
|
}
|
2024-11-25 19:00:21 +04:00
|
|
|
|
2024-11-26 15:01:21 +04:00
|
|
|
const percentage = selectedCountryPrice[ type ].toFixed( 2 );
|
|
|
|
const fixedFee = `${ selectedCountryPrice.currencySymbol }${ selectedCountryPrice.fixedFee }`;
|
2024-11-25 19:00:21 +04:00
|
|
|
|
2024-11-26 15:01:21 +04:00
|
|
|
return __(
|
|
|
|
`from ${ percentage }% + ${ fixedFee } ${ storeCurrency }<sup>1</sup>`,
|
|
|
|
'woocommerce-paypal-payments'
|
|
|
|
);
|
2024-11-25 19:00:21 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
export default generatePriceText;
|