mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Display legal text from gateway settings
This commit is contained in:
parent
6c7eef4f58
commit
f8d25a9357
2 changed files with 45 additions and 34 deletions
|
@ -73,6 +73,11 @@ class PayUponInvoiceGateway extends WC_Payment_Gateway {
|
|||
'label' => __( 'Pay upon Invoice', 'woocommerce-paypal-payments' ),
|
||||
'default' => 'yes'
|
||||
),
|
||||
'legal_text' => array(
|
||||
'title' => __( 'Legal text', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'textarea',
|
||||
'default' => 'By clicking on the button, you agree to the <a href="https://www.ratepay.com/legal-payment-terms">terms of payment</a> and <a href="https://www.ratepay.com/legal-payment-dataprivacy">performance of a risk check</a> from the payment partner, Ratepay. You also agree to PayPal’s <a href="https://www.paypal.com/de/webapps/mpp/ua/privacy-full?locale.x=eng_DE&_ga=1.267010504.718583817.1563460395">privacy statement</a>. If your request to purchase upon invoice is accepted, the purchase price claim will be assigned to Ratepay, and you may only pay Ratepay, not the merchant.',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -183,45 +183,51 @@ class WCGatewayModule implements ModuleInterface {
|
|||
}
|
||||
);
|
||||
|
||||
if ( 'DE' === $c->get( 'api.shop.country' ) ) {
|
||||
add_action(
|
||||
'wp_footer',
|
||||
function () {
|
||||
?>
|
||||
<script type="application/json" fncls="fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99">
|
||||
{
|
||||
"f":"d4e0d7b9-4f75-43f9-9437-d8a57c901585",
|
||||
"s":"flowid_provided_to_you"
|
||||
add_action(
|
||||
'init',
|
||||
function() use ( $c ) {
|
||||
if ( 'DE' === $c->get( 'api.shop.country' ) ) { // TODO && is_checkout() does not work, we are on admin-ajax.php
|
||||
|
||||
add_action(
|
||||
'wp_footer',
|
||||
function () {
|
||||
?>
|
||||
<script type="application/json" fncls="fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99">
|
||||
{
|
||||
"f":"d4e0d7b9-4f75-43f9-9437-d8a57c901585",
|
||||
"s":"flowid_provided_to_you"
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
);
|
||||
|
||||
}
|
||||
);
|
||||
add_action(
|
||||
'wp_enqueue_scripts',
|
||||
function () use ( $c ) {
|
||||
$gateway_module_url = $c->get( 'wcgateway.url' );
|
||||
wp_enqueue_script(
|
||||
'ppcp-pay-upon-invoice',
|
||||
trailingslashit( $gateway_module_url ) . 'assets/js/pay-upon-invoice.js',
|
||||
array(),
|
||||
1
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
add_action(
|
||||
'wp_enqueue_scripts',
|
||||
function () use ( $c ) {
|
||||
$gateway_module_url = $c->get( 'wcgateway.url' );
|
||||
wp_enqueue_script(
|
||||
'ppcp-pay-upon-invoice',
|
||||
trailingslashit( $gateway_module_url ) . 'assets/js/pay-upon-invoice.js',
|
||||
array(),
|
||||
1
|
||||
add_action(
|
||||
'woocommerce_review_order_after_submit',
|
||||
function () {
|
||||
$gateway_settings = get_option( 'woocommerce_ppcp-pay-upon-invoice-gateway_settings' );
|
||||
?>
|
||||
<p id="ppcp-pui-legal-text" style="display:none;"><?php echo wp_kses_post( $gateway_settings['legal_text'] ?? '' ); ?></p>
|
||||
<?php
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
add_action(
|
||||
'woocommerce_review_order_after_submit',
|
||||
function () {
|
||||
// TODO show/hide via JS
|
||||
?>
|
||||
<p id="ppcp-pui-legal-text" style="display:none;">By clicking on the button, you agree to the <a href="https://www.ratepay.com/legal-payment-terms">terms of payment</a> and <a href="https://www.ratepay.com/legal-payment-dataprivacy">performance of a risk check</a> from the payment partner, Ratepay. You also agree to PayPal’s <a href="https://www.paypal.com/de/webapps/mpp/ua/privacy-full?locale.x=eng_DE&_ga=1.267010504.718583817.1563460395">privacy statement</a>. If your request to purchase upon invoice is accepted, the purchase price claim will be assigned to Ratepay, and you may only pay Ratepay, not the merchant.</p>
|
||||
<?php
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue