mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Merge pull request #146 from woocommerce/fix/PCP-130-fix-cc-fields
Fix/pcp 130 fix cc fields
This commit is contained in:
commit
437a6654c5
3 changed files with 28 additions and 2 deletions
|
@ -87,7 +87,7 @@ class CreditCardRenderer {
|
|||
},
|
||||
expirationDate: {
|
||||
selector: '#ppcp-credit-card-gateway-card-expiry',
|
||||
placeholder: this.defaultConfig.hosted_fields.labels.mm_yyyy,
|
||||
placeholder: this.defaultConfig.hosted_fields.labels.mm_yy,
|
||||
}
|
||||
}
|
||||
}).then(hostedFields => {
|
||||
|
|
|
@ -667,7 +667,7 @@ class SmartButton implements SmartButtonInterface {
|
|||
'labels' => array(
|
||||
'credit_card_number' => '',
|
||||
'cvv' => '',
|
||||
'mm_yyyy' => __( 'MM/YYYY', 'woocommerce-paypal-payments' ),
|
||||
'mm_yy' => __( 'MM/YY', 'woocommerce-paypal-payments' ),
|
||||
'fields_not_valid' => __(
|
||||
'Unfortunately, your credit card details are not valid.',
|
||||
'woocommerce-paypal-payments'
|
||||
|
|
|
@ -198,6 +198,32 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the credit card fields.
|
||||
*/
|
||||
public function form() {
|
||||
add_action( 'gettext', array( $this, 'replace_credit_card_cvv_label' ), 10, 3 );
|
||||
parent::form();
|
||||
remove_action( 'gettext', 'replace_credit_card_cvv_label' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace WooCommerce credit card field label.
|
||||
*
|
||||
* @param string $translation Translated text.
|
||||
* @param string $text Original text to translate.
|
||||
* @param string $domain Text domain.
|
||||
*
|
||||
* @return string Translated field.
|
||||
*/
|
||||
public function replace_credit_card_cvv_label( string $translation, string $text, string $domain ): string {
|
||||
if ( 'woocommerce' !== $domain || 'Card code' !== $text ) {
|
||||
return $translation;
|
||||
}
|
||||
|
||||
return __( 'CVV', 'woocommerce-paypal-payments' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of the gateway.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue