123123q - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of 123123q.php
- <?php
- public function check_ipn_response()
- {
- global $woocommerce;
- $requestType = !empty($_GET['payop']) ? $_GET['payop'] : '';
- if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- $postedData = json_decode(file_get_contents('php://input'), true);
- if (!is_array($postedData)) {
- $postedData = [];
- }
- } else {
- $postedData = $_GET;
- }
- ;
- switch ($requestType) {
- case 'result':
- @ob_clean();
- $postedData = stripslashes_deep($postedData);
- if ($postedData['status'] === 'wait') {
- wp_die('Status wait', 'Status wait', 200);
- }
- $orderId = $postedData['orderId'];
- $order = new WC_Order($orderId);
- $valid = $this->check_ipn_request_is_valid($postedData);
- if ($valid === true) {
- if ($postedData['status'] === 'success') {
- $order->update_status('processing', __('Payment successfully paid', 'payop-woocommerce'));
- wp_die('Status success', 'Status success', 200);
- } elseif ($postedData['status'] === 'error') {
- $order->update_status('failed', __('Payment not paid', 'payop-woocommerce'));
- wp_die('Status fail', 'Status fail', 200);
- }
- do_action('valid-payop-standard-ipn-reques', $postedData);
- } else {
- wp_die($valid, $valid, 400);
- }
- break;
File Description
- 123123q
- PHP Code
- 20 Nov-2019
- 1.73 Kb
You can Share it:
Latest PHP Pastes