mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-10 23:42:39 +08:00
Display legal text under place order button
This commit is contained in:
parent
00de9de57e
commit
6c7eef4f58
4 changed files with 53 additions and 36 deletions
|
@ -1,5 +0,0 @@
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
|
||||||
const script = document.createElement('script');
|
|
||||||
script.setAttribute('src', 'https://c.paypal.com/da/r/fb.js');
|
|
||||||
document.body.append(script);
|
|
||||||
});
|
|
12
modules/ppcp-wc-gateway/resources/js/pay-upon-invoice.js
Normal file
12
modules/ppcp-wc-gateway/resources/js/pay-upon-invoice.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.setAttribute('src', 'https://c.paypal.com/da/r/fb.js');
|
||||||
|
document.body.append(script);
|
||||||
|
|
||||||
|
jQuery(document.body).on('updated_checkout payment_method_selected', () => {
|
||||||
|
jQuery('#ppcp-pui-legal-text').hide();
|
||||||
|
if(jQuery('input[name="payment_method"]:checked').val() === 'ppcp-pay-upon-invoice-gateway') {
|
||||||
|
jQuery('#ppcp-pui-legal-text').show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -182,6 +182,46 @@ 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"
|
||||||
|
}
|
||||||
|
</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(
|
||||||
|
'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
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -273,36 +313,6 @@ class WCGatewayModule implements ModuleInterface {
|
||||||
return $disabler->handler( (array) $methods );
|
return $disabler->handler( (array) $methods );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
add_action(
|
|
||||||
'wp_footer',
|
|
||||||
function () use ( $container ) {
|
|
||||||
if ( 'DE' === $container->get( 'api.shop.country' ) ) { ?>
|
|
||||||
<script type="application/json" fncls="fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99">
|
|
||||||
{
|
|
||||||
"f":"d4e0d7b9-4f75-43f9-9437-d8a57c901585",
|
|
||||||
"s":"flowid_provided_to_you"
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
add_action(
|
|
||||||
'wp_enqueue_scripts',
|
|
||||||
function () use ( $container ) {
|
|
||||||
if ( 'DE' === $container->get( 'api.shop.country' ) ) {
|
|
||||||
$gateway_module_url = $container->get( 'wcgateway.url' );
|
|
||||||
wp_enqueue_script(
|
|
||||||
'ppcp-fraudnet',
|
|
||||||
trailingslashit( $gateway_module_url ) . 'assets/js/fraudnet.js',
|
|
||||||
array(),
|
|
||||||
1
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
||||||
target: 'web',
|
target: 'web',
|
||||||
entry: {
|
entry: {
|
||||||
'gateway-settings': path.resolve('./resources/js/gateway-settings.js'),
|
'gateway-settings': path.resolve('./resources/js/gateway-settings.js'),
|
||||||
'fraudnet': path.resolve('./resources/js/fraudnet.js'),
|
'pay-upon-invoice': path.resolve('./resources/js/pay-upon-invoice.js'),
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, 'assets/'),
|
path: path.resolve(__dirname, 'assets/'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue