mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Merge pull request #799 from woocommerce/PCP-832-enable-acdc-by-default-only-in-locations-where-woo-commerce-payments-is-not-available
Enable ACDC by default only in locations where WooCommerce Payments is not available
This commit is contained in:
commit
86e3f38e4f
5 changed files with 59 additions and 47 deletions
|
@ -77,6 +77,18 @@ class DccApplies {
|
|||
return $applies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether WooCommerce Payments plugin is available for the store country.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function for_wc_payments(): bool {
|
||||
$countries = array_keys( $this->allowed_country_currency_matrix );
|
||||
array_push( $countries, 'AT', 'BE', 'HK', 'IE', 'NL', 'PL', 'PT', 'SG', 'CH' );
|
||||
|
||||
return in_array( $this->country, $countries, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns credit cards, which can be used.
|
||||
*
|
||||
|
|
|
@ -55,6 +55,7 @@ ul.ppcp-onboarding-options, ul.ppcp-onboarding-options-sublist {
|
|||
|
||||
ul.ppcp-onboarding-options-sublist {
|
||||
margin-left: 15px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.ppcp-muted-text {
|
||||
|
|
|
@ -158,6 +158,8 @@ function ppcp_onboarding_productionCallback(...args) {
|
|||
input.disabled = !cardsChk.checked;
|
||||
});
|
||||
|
||||
document.querySelector('.ppcp-onboarding-cards-options').style.display = !cardsChk.checked ? 'none' : '';
|
||||
|
||||
const basicRb = document.querySelector('#ppcp-onboarding-dcc-basic');
|
||||
|
||||
const isExpress = !cardsChk.checked || basicRb.checked;
|
||||
|
|
|
@ -56,6 +56,7 @@ class OnboardingOptionsRenderer {
|
|||
* @param bool $is_shop_supports_dcc Whether the shop can use DCC (country, currency).
|
||||
*/
|
||||
public function render( bool $is_shop_supports_dcc ): string {
|
||||
$checked = $is_shop_supports_dcc ? '' : 'checked';
|
||||
return '
|
||||
<ul class="ppcp-onboarding-options">
|
||||
<li>
|
||||
|
@ -64,9 +65,7 @@ class OnboardingOptionsRenderer {
|
|||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input type="checkbox" id="ppcp-onboarding-accept-cards" checked> ' .
|
||||
__( 'Securely accept all major credit & debit cards on the strength of the PayPal network', 'woocommerce-paypal-payments' ) . '
|
||||
</label>
|
||||
<label><input type="checkbox" id="ppcp-onboarding-accept-cards" ' . $checked . '> ' . __( 'Securely accept all major credit & debit cards on the strength of the PayPal network', 'woocommerce-paypal-payments' ) . '</label>
|
||||
</li>
|
||||
<li>' . $this->render_dcc( $is_shop_supports_dcc ) . '</li>' .
|
||||
$this->render_pui_option()
|
||||
|
@ -103,6 +102,44 @@ class OnboardingOptionsRenderer {
|
|||
|
||||
$is_us_shop = 'US' === $this->country;
|
||||
|
||||
$basic_table_rows = array(
|
||||
$this->render_table_row(
|
||||
__( 'Credit & Debit Card form fields', 'woocommerce-paypal-payments' ),
|
||||
__( 'Prebuilt user experience', 'woocommerce-paypal-payments' )
|
||||
),
|
||||
! $is_us_shop ? '' : $this->render_table_row(
|
||||
__( 'Credit & Debit Card pricing', 'woocommerce-paypal-payments' ),
|
||||
__( '3.49% + $0.49', 'woocommerce-paypal-payments' ),
|
||||
'',
|
||||
__( 'for US domestic transactions', 'woocommerce-paypal-payments' )
|
||||
),
|
||||
$this->render_table_row(
|
||||
__( 'Seller Protection', 'woocommerce-paypal-payments' ),
|
||||
__( 'Yes', 'woocommerce-paypal-payments' ),
|
||||
__( 'No matter what you sell, Seller Protection can help you avoid chargebacks, reversals, and fees on eligible PayPal payment transactions — even when a customer has filed a dispute.', 'woocommerce-paypal-payments' ),
|
||||
__( 'for eligible PayPal transactions', 'woocommerce-paypal-payments' )
|
||||
),
|
||||
$this->render_table_row(
|
||||
__( 'Seller Account Type', 'woocommerce-paypal-payments' ),
|
||||
__( 'Business or Casual', 'woocommerce-paypal-payments' ),
|
||||
__( 'For Standard payments, Casual sellers may connect their Personal PayPal account in eligible countries to sell on WooCommerce. For Advanced payments, a Business PayPal account is required.', 'woocommerce-paypal-payments' )
|
||||
),
|
||||
);
|
||||
$items[] = '
|
||||
<li>
|
||||
<label>
|
||||
<input type="radio" id="ppcp-onboarding-dcc-basic" name="ppcp_onboarding_dcc" value="basic" checked ' .
|
||||
( ! $is_shop_supports_dcc ? 'checked' : '' ) .
|
||||
' data-screen-url="' . $this->get_screen_url( 'basic' ) . '"' .
|
||||
'> ' .
|
||||
__( 'Standard Card Processing', 'woocommerce-paypal-payments' ) . '
|
||||
</label>
|
||||
' . $this->render_tooltip( __( 'Card transactions are managed by PayPal, which simplifies compliance requirements for you.', 'woocommerce-paypal-payments' ) ) . '
|
||||
<table>
|
||||
' . implode( $basic_table_rows ) . '
|
||||
</table>
|
||||
</li>';
|
||||
|
||||
if ( $is_shop_supports_dcc ) {
|
||||
$dcc_table_rows = array(
|
||||
$this->render_table_row(
|
||||
|
@ -146,9 +183,9 @@ class OnboardingOptionsRenderer {
|
|||
$items[] = '
|
||||
<li>
|
||||
<label>
|
||||
<input type="radio" id="ppcp-onboarding-dcc-acdc" name="ppcp_onboarding_dcc" value="acdc" checked ' .
|
||||
<input type="radio" id="ppcp-onboarding-dcc-acdc" name="ppcp_onboarding_dcc" value="acdc" ' .
|
||||
'data-screen-url="' . $this->get_screen_url( 'acdc' ) . '"> ' .
|
||||
__( 'Advanced Card Processing', 'woocommerce-paypal-payments' ) . '
|
||||
__( 'Advanced Card Processing', 'woocommerce-paypal-payments' ) . '
|
||||
</label>
|
||||
' . $this->render_tooltip( __( 'PayPal acts as the payment processor for card transactions. You can add optional features like Chargeback Protection for more security.', 'woocommerce-paypal-payments' ) ) . '
|
||||
<table>
|
||||
|
@ -157,53 +194,13 @@ class OnboardingOptionsRenderer {
|
|||
</li>';
|
||||
}
|
||||
|
||||
$basic_table_rows = array(
|
||||
$this->render_table_row(
|
||||
__( 'Credit & Debit Card form fields', 'woocommerce-paypal-payments' ),
|
||||
__( 'Prebuilt user experience', 'woocommerce-paypal-payments' )
|
||||
),
|
||||
! $is_us_shop ? '' : $this->render_table_row(
|
||||
__( 'Credit & Debit Card pricing', 'woocommerce-paypal-payments' ),
|
||||
__( '3.49% + $0.49', 'woocommerce-paypal-payments' ),
|
||||
'',
|
||||
__( 'for US domestic transactions', 'woocommerce-paypal-payments' )
|
||||
),
|
||||
$this->render_table_row(
|
||||
__( 'Seller Protection', 'woocommerce-paypal-payments' ),
|
||||
__( 'Yes', 'woocommerce-paypal-payments' ),
|
||||
__( 'No matter what you sell, Seller Protection can help you avoid chargebacks, reversals, and fees on eligible PayPal payment transactions — even when a customer has filed a dispute.', 'woocommerce-paypal-payments' ),
|
||||
__( 'for eligible PayPal transactions', 'woocommerce-paypal-payments' )
|
||||
),
|
||||
$this->render_table_row(
|
||||
__( 'Seller Account Type', 'woocommerce-paypal-payments' ),
|
||||
__( 'Business or Casual', 'woocommerce-paypal-payments' ),
|
||||
__( 'For Standard payments, Casual sellers may connect their Personal PayPal account in eligible countries to sell on WooCommerce. For Advanced payments, a Business PayPal account is required.', 'woocommerce-paypal-payments' )
|
||||
),
|
||||
);
|
||||
$items[] = '
|
||||
<li ' . ( ! $is_shop_supports_dcc ? 'style="display: none;"' : '' ) . '>
|
||||
<label>
|
||||
<input type="radio" id="ppcp-onboarding-dcc-basic" name="ppcp_onboarding_dcc" value="basic" ' .
|
||||
( ! $is_shop_supports_dcc ? 'checked' : '' ) .
|
||||
' data-screen-url="' . $this->get_screen_url( 'basic' ) . '"' .
|
||||
'> ' .
|
||||
__( 'Standard Card Processing', 'woocommerce-paypal-payments' ) . '
|
||||
</label>
|
||||
' . $this->render_tooltip( __( 'Card transactions are managed by PayPal, which simplifies compliance requirements for you.', 'woocommerce-paypal-payments' ) ) . '
|
||||
<table>
|
||||
' . implode( $basic_table_rows ) . '
|
||||
</table>
|
||||
</li>';
|
||||
|
||||
return '
|
||||
<div class="ppcp-onboarding-cards-options">
|
||||
<ul id="ppcp-onboarding-dcc-options" class="ppcp-onboarding-options-sublist">' .
|
||||
implode( '', $items ) .
|
||||
'
|
||||
</ul>
|
||||
<div class="ppcp-onboarding-cards-screen">' .
|
||||
( $is_shop_supports_dcc ? '<img id="ppcp-onboarding-cards-screen-img" />' : '' ) . '
|
||||
</div>
|
||||
<div class="ppcp-onboarding-cards-screen"><img id="ppcp-onboarding-cards-screen-img" /></div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@ return array(
|
|||
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
|
||||
assert( $dcc_applies instanceof DccApplies );
|
||||
|
||||
$is_shop_supports_dcc = $dcc_applies->for_country_currency();
|
||||
$is_shop_supports_dcc = $dcc_applies->for_country_currency() || $dcc_applies->for_wc_payments();
|
||||
|
||||
$onboarding_options_renderer = $container->get( 'onboarding.render-options' );
|
||||
assert( $onboarding_options_renderer instanceof OnboardingOptionsRenderer );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue