mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
Merge pull request #1986 from woocommerce/PCP-2521-apple-pay-recurring-payments
Apple Pay recurring payments (2521)
This commit is contained in:
commit
037f650288
20 changed files with 437 additions and 37 deletions
|
@ -56,6 +56,8 @@ class FundingSourceRenderer {
|
|||
* @param string $id The ID of the funding source, such as 'venmo'.
|
||||
*/
|
||||
public function render_name( string $id ): string {
|
||||
$id = $this->sanitize_id( $id );
|
||||
|
||||
if ( array_key_exists( $id, $this->funding_sources ) ) {
|
||||
if ( in_array( $id, $this->own_funding_sources, true ) ) {
|
||||
return $this->funding_sources[ $id ];
|
||||
|
@ -78,6 +80,8 @@ class FundingSourceRenderer {
|
|||
* @param string $id The ID of the funding source, such as 'venmo'.
|
||||
*/
|
||||
public function render_description( string $id ): string {
|
||||
$id = $this->sanitize_id( $id );
|
||||
|
||||
if ( array_key_exists( $id, $this->funding_sources ) ) {
|
||||
return sprintf(
|
||||
/* translators: %s - Sofort, BLIK, iDeal, Mercado Pago, etc. */
|
||||
|
@ -90,4 +94,14 @@ class FundingSourceRenderer {
|
|||
$this->settings->get( 'description' )
|
||||
: __( 'Pay via PayPal.', 'woocommerce-paypal-payments' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes the id to a standard format.
|
||||
*
|
||||
* @param string $id The funding source id.
|
||||
* @return string
|
||||
*/
|
||||
private function sanitize_id( string $id ): string {
|
||||
return str_replace( '_', '', strtolower( $id ) );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue