mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 06:52:50 +08:00
Get session id from request when page is pay for order
This commit is contained in:
parent
564caa418c
commit
5bf95fbca3
2 changed files with 16 additions and 0 deletions
|
@ -30,6 +30,15 @@ window.addEventListener('load', function() {
|
|||
script.text = JSON.stringify(configuration);
|
||||
document.body.appendChild(script);
|
||||
|
||||
const payForOrderForm = document.forms.order_review;
|
||||
if(payForOrderForm) {
|
||||
const puiPayForOrderSessionId = document.createElement('input');
|
||||
puiPayForOrderSessionId.setAttribute('type', 'hidden');
|
||||
puiPayForOrderSessionId.setAttribute('name', 'pui_pay_for_order_session_id');
|
||||
puiPayForOrderSessionId.setAttribute('value', FraudNetConfig.f);
|
||||
payForOrderForm.appendChild(puiPayForOrderSessionId);
|
||||
}
|
||||
|
||||
_loadBeaconJS({fnUrl: "https://c.paypal.com/da/r/fb.js"})
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,13 @@ class FraudNetSessionId {
|
|||
return WC()->session->get( 'ppcp_fraudnet_session_id' );
|
||||
}
|
||||
|
||||
if ( isset( $_GET['pay_for_order'] ) && 'true' === $_GET['pay_for_order'] ) {
|
||||
$pui_pay_for_order_session_id = filter_input( INPUT_POST, 'pui_pay_for_order_session_id', FILTER_SANITIZE_STRING );
|
||||
if ( $pui_pay_for_order_session_id && '' !== $pui_pay_for_order_session_id ) {
|
||||
return $pui_pay_for_order_session_id;
|
||||
}
|
||||
}
|
||||
|
||||
$session_id = bin2hex( random_bytes( 16 ) );
|
||||
WC()->session->set( 'ppcp_fraudnet_session_id', $session_id );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue