mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
add dcc notices depending on state and dcc availability
This commit is contained in:
parent
4163af8a47
commit
c8ecdeb330
1 changed files with 109 additions and 32 deletions
|
@ -277,7 +277,43 @@ class SettingsRenderer {
|
|||
<?php
|
||||
endforeach;
|
||||
|
||||
if ( $is_dcc && State::STATE_ONBOARDED === $this->state->current_state() ) :
|
||||
if ( $is_dcc ) {
|
||||
if ( $this->dcc_applies->for_country_currency() ) {
|
||||
if ( State::STATE_ONBOARDED > $this->state->current_state() ) {
|
||||
$this->render_dcc_onboarding_info();
|
||||
}
|
||||
if ( State::STATE_ONBOARDED === $this->state->current_state() ) {
|
||||
$this->render_3d_secure_info();
|
||||
}
|
||||
} else {
|
||||
$this->render_dcc_does_not_apply_info();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the ppcp-text field given a configuration.
|
||||
*
|
||||
* @param array $config The configuration array.
|
||||
*/
|
||||
private function render_text( array $config ) {
|
||||
echo wp_kses_post( $config['text'] );
|
||||
if ( isset( $config['hidden'] ) ) {
|
||||
$value = $this->settings->has( $config['hidden'] ) ?
|
||||
(string) $this->settings->get( $config['hidden'] )
|
||||
: '';
|
||||
echo ' <input
|
||||
type = "hidden"
|
||||
name = "ppcp[' . esc_attr( $config['hidden'] ) . ']"
|
||||
value = "' . esc_attr( $value ) . '"
|
||||
> ';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the 3d secure info text.
|
||||
*/
|
||||
private function render_3d_secure_info() {
|
||||
?>
|
||||
<tr>
|
||||
<th><?php esc_html_e( '3D Secure', 'paypal-for-woocommerce' ); ?></th>
|
||||
|
@ -308,25 +344,66 @@ class SettingsRenderer {
|
|||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the ppcp-text field given a configuration.
|
||||
*
|
||||
* @param array $config The configuration array.
|
||||
* Renders the DCC onboarding info.
|
||||
*/
|
||||
private function render_text( array $config ) {
|
||||
echo wp_kses_post( $config['text'] );
|
||||
if ( isset( $config['hidden'] ) ) {
|
||||
$value = $this->settings->has( $config['hidden'] ) ?
|
||||
(string) $this->settings->get( $config['hidden'] )
|
||||
: '';
|
||||
echo ' <input
|
||||
type = "hidden"
|
||||
name = "ppcp[' . esc_attr( $config['hidden'] ) . ']"
|
||||
value = "' . esc_attr( $value ) . '"
|
||||
> ';
|
||||
}
|
||||
private function render_dcc_onboarding_info() {
|
||||
?>
|
||||
<tr>
|
||||
<th><?php esc_html_e( 'Onboarding', 'paypal-for-woocommerce' ); ?></th>
|
||||
<td class="notice notice-error">
|
||||
<p>
|
||||
<?php
|
||||
esc_html_e(
|
||||
'You need to complete your onboarding, before you can use the PayPal Card Processing option.',
|
||||
'paypal-for-woocommerce'
|
||||
);
|
||||
?>
|
||||
|
||||
<a
|
||||
href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' ) ); ?>"
|
||||
>
|
||||
<?php esc_html_e( 'Click here to complete your onboarding.', 'paypal-for-woocommerce' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the info, that DCC is not available in the merchant's country.
|
||||
*/
|
||||
private function render_dcc_does_not_apply_info() {
|
||||
?>
|
||||
<tr>
|
||||
<th><?php esc_html_e( 'Card Processing not available', 'paypal-for-woocommerce' ); ?></th>
|
||||
<td class="notice notice-error">
|
||||
<p>
|
||||
<?php
|
||||
esc_html_e(
|
||||
'Unfortunatly, the card processing option is not yet available in your country.',
|
||||
'paypal-for-woocommerce'
|
||||
);
|
||||
?>
|
||||
|
||||
<a
|
||||
href="https://developer.paypal.com/docs/platforms/checkout/reference/country-availability-advanced-cards/"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
<?php
|
||||
esc_html_e(
|
||||
'Click here to see, in which countries this option is currently available.',
|
||||
'paypal-for-woocommerce'
|
||||
);
|
||||
?>
|
||||
</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue