@@ -114,7 +114,7 @@ public function process_payment( $order_id, $allowed_payment_method = null ) {
114114 if ( $ this ->tokenization && $ this ->get_save_payment_card_checkbox () ) {
115115 $ payload ['generatePaymentToken ' ] = true ;
116116 }
117- $ token_id = $ this ->get_frontend_generated_bizum_token ();
117+ $ token_id = $ this ->get_frontend_generated_token ();
118118 if ( $ token_id ) {
119119 if ( ! $ this ->isBlockCheckout () ) {
120120 $ payload ['paymentToken ' ] = $ token_id ;
@@ -140,7 +140,7 @@ public function process_payment( $order_id, $allowed_payment_method = null ) {
140140 'result ' => 'success ' ,
141141 'redirect ' => false ,
142142 'paymentId ' => $ payment ->getId (), // Send the paymentId back to the client
143- 'token ' => $ this ->get_frontend_generated_bizum_token (), // Send the token back to the client
143+ 'token ' => $ this ->get_frontend_generated_token (), // Send the token back to the client
144144 'completeUrl ' => $ payload ['completeUrl ' ],
145145 'failUrl ' => $ payload ['failUrl ' ],
146146 'orderId ' => $ order_id ,
@@ -165,11 +165,11 @@ public function process_payment( $order_id, $allowed_payment_method = null ) {
165165 *
166166 * @return false|string
167167 */
168- protected function get_frontend_generated_bizum_token () {
169- if ( $ this ->id !== 'monei_bizum ' ) {
170- return false ;
168+ protected function get_frontend_generated_token () {
169+ if ( $ this ->id === 'monei_bizum ' || $ this ->id === 'monei_paypal ' ) {
170+ //phpcs:ignore WordPress.Security.NonceVerification, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
171+ return ( isset ( $ _POST ['monei_payment_request_token ' ] ) ) ? wc_clean ( wp_unslash ( $ _POST ['monei_payment_request_token ' ] ) ) : false ; // WPCS: CSRF ok.
171172 }
172- //phpcs:ignore WordPress.Security.NonceVerification, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
173- return ( isset ( $ _POST ['monei_payment_request_token ' ] ) ) ? wc_clean ( wp_unslash ( $ _POST ['monei_payment_request_token ' ] ) ) : false ; // WPCS: CSRF ok.
173+ return false ;
174174 }
175175}
0 commit comments