Allow saved payment methods labels other than card/eCheck to display brand & last 4 digits if present (https://github.com/woocommerce/woocommerce-blocks/pull/6177)

* Allow default label to use brand & last4 if present

* Lint fixes
This commit is contained in:
Achyuth Ajoy 2022-04-20 16:45:04 +05:30 committed by GitHub
parent 97a3b06a66
commit a17159cb52
1 changed files with 11 additions and 0 deletions

View File

@ -44,6 +44,17 @@ const getCcOrEcheckLabel = ( { method, expires } ) => {
* @return {string} label
*/
const getDefaultLabel = ( { method } ) => {
/* For saved payment methods with brand & last 4 */
if ( method.brand && method.last4 ) {
return sprintf(
/* translators: %1$s is referring to the payment method brand, %2$s is referring to the last 4 digits of the payment card. */
__( '%1$s ending in %2$s', 'woo-gutenberg-products-block' ),
method.brand,
method.last4
);
}
/* For saved payment methods without brand & last 4 */
return sprintf(
/* translators: %s is the name of the payment method gateway. */
__( 'Saved token for %s', 'woo-gutenberg-products-block' ),