Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
wp-content
/
plugins
/
woocommerce
/
includes
/
gateways
/
paypal
/
includes
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php if (!defined('ABSPATH')) { exit; } abstract class WC_Gateway_Paypal_Response { protected $sandbox = false; protected function get_paypal_order($raw_custom) { $custom = json_decode($raw_custom); if ($custom && is_object($custom)) { $order_id = $custom->order_id; $order_key = $custom->order_key; } else { WC_Gateway_Paypal::log('Order ID and key were not found in "custom".', 'error'); return false; } $order = wc_get_order($order_id); if (!$order) { $order_id = wc_get_order_id_by_order_key($order_key); $order = wc_get_order($order_id); } if (!$order || !hash_equals($order->get_order_key(), $order_key)) { WC_Gateway_Paypal::log('Order Keys do not match.', 'error'); return false; } return $order; } protected function payment_complete($order, $txn_id = '', $note = '') { if (!$order->has_status(array('processing', 'completed'))) { $order->add_order_note($note); $order->payment_complete($txn_id); if (isset(WC()->cart)) { WC()->cart->empty_cart(); } } } protected function payment_on_hold($order, $reason = '') { $order->update_status('on-hold', $reason); if (isset(WC()->cart)) { WC()->cart->empty_cart(); } } }