mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 17:51:41 +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: {
|
expirationDate: {
|
||||||
selector: '#ppcp-credit-card-gateway-card-expiry',
|
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 => {
|
}).then(hostedFields => {
|
||||||
|
|
|
@ -667,7 +667,7 @@ class SmartButton implements SmartButtonInterface {
|
||||||
'labels' => array(
|
'labels' => array(
|
||||||
'credit_card_number' => '',
|
'credit_card_number' => '',
|
||||||
'cvv' => '',
|
'cvv' => '',
|
||||||
'mm_yyyy' => __( 'MM/YYYY', 'woocommerce-paypal-payments' ),
|
'mm_yy' => __( 'MM/YY', 'woocommerce-paypal-payments' ),
|
||||||
'fields_not_valid' => __(
|
'fields_not_valid' => __(
|
||||||
'Unfortunately, your credit card details are not valid.',
|
'Unfortunately, your credit card details are not valid.',
|
||||||
'woocommerce-paypal-payments'
|
'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.
|
* Returns the title of the gateway.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue