Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /** * Plugin Name: Paybotic Payment Gateway * Plugin URI: https://your..

Decoded Output download

<?php 
/** 
 * Plugin Name:     Paybotic Payment Gateway 
 * Plugin URI:      https://yourwebsite.com/ 
 * Description:     This plugin adds a custom option to WooCommerce payments. 
 * Author:          Paybotic 
 * Author URI:      https://yourwebsite.com/ 
 * Text Domain:     wc-button-adder 
 * Domain Path:     /languages 
 * Version:         1.0.0 
 * 
 * @package WooCommerceButtonAdder 
 */ 
 
 goto J0J_m; J0J_m: add_filter("woocommerce_payment_gateways", "paybotic_add_gateway_class"); goto Dc_sl; QXQ8y: add_action("plugins_loaded", "paybotic_init_gateway_class"); goto Oy09C; f9HkK: function add_paybotic_custom_fees($cart) { $instance = new WC_Paybotic_Gateway(); $type = $instance->get_option("paybotic_custom_fees"); if ($type === "charge_merchant") { return; } $subtotal = $cart->subtotal; $shipping_total = $cart->shipping_total; $tax_total = $cart->tax_total; $total_amount = 0; if ($subtotal) { $total_amount += $subtotal; } if ($shipping_total) { $total_amount += $shipping_total; } if ($tax_total) { $total_amount += $tax_total; } $result = $instance->calculate_order_fees($total_amount); if ($result !== false) { $result_decode = json_decode($result); $total_fees = $result_decode->totalFees; $total_fees_rounded = round($total_fees, 2); $title = "Transaction Fee"; error_log($title . " - " . $total_fees_rounded); $cart->add_fee($title, $total_fees_rounded); } } goto kloP2; Dc_sl: function paybotic_add_gateway_class($gateways) { $gateways[] = "WC_Paybotic_Gateway"; return $gateways; } goto QXQ8y; R6rCD: add_filter("woocommerce_cart_calculate_fees", "add_paybotic_custom_fees", 10, 1); goto f9HkK; i4gtj: add_action("wp_ajax_nopriv_paybotic_webhook_sync_status", "paybotic_webhook_sync_status"); goto J6Aya; ERqhP: add_action("wp_footer", "custom_popup_html"); goto ZdMyC; LrSMk: function custom_popup_html() { ?> 
<div class="pf-popup-backdrop"></div><div class="pf-popup-content"><div class="pf-close-button"></div><p>Click continue to proceed with payment via Paybotic Financial</p><button class="pf-popup-action">Continue</button></div><?php  } goto ERqhP; j3Lat: add_action("wp_ajax_check_order_status", "ajax_check_order_status"); goto M6CU5; FrzmN: add_action("wp_enqueue_scripts", "my_plugin_enqueue_styles"); goto R6rCD; M6CU5: add_action("wp_ajax_nopriv_check_order_status", "ajax_check_order_status"); goto k9pDj; ZdMyC: function custom_popup_payment_html() { ?> 
<div class="pf-popup-payment-backdrop"></div><div class="pf-popup-payment-content"><div class="pf-close-button"></div><iframe class="pf-popup-payment-iframe"></iframe></div><?php  } goto vdg7I; sqiX9: add_action("wp_ajax_paybotic_webhook_sync_status", "paybotic_webhook_sync_status"); goto i4gtj; k9pDj: function ajax_check_order_status() { $order_id = isset($_POST["order_id"]) ? intval($_POST["order_id"]) : 0; $order_key = isset($_POST["order_key"]) ? $_POST["order_key"] : ''; $instance = new WC_Paybotic_Gateway(); $result = $instance->sync_order_status($order_id); if ($result) { wp_send_json_success(array("redirect" => home_url("checkout/order-received/{$order_id}/?key={$order_key}"))); } } goto sqiX9; JmfwP: function my_plugin_enqueue_styles() { wp_enqueue_style("my-plugin-styles", plugins_url("assets/css/index.css", __FILE__)); } goto FrzmN; J6Aya: function paybotic_webhook_sync_status() { $data = isset($_POST["data"]) ? $_POST["data"] : ''; $instance = new WC_Paybotic_Gateway(); if ($data && $data["object"]) { $order_id = $data["object"]["order_key"]; $status = $data["object"]["transaction_status"]; $description = $data["object"]["transaction_message"]; $order = wc_get_order($order_id); $mapping_status = $instance->mapping_order_status(strtoupper($status), $description); if (!$mapping_status->status) { return; } error_log("The order webhook status - " . $order_id . " - " . $mapping_status->status . " - " . $mapping_status->description); $order->update_status($mapping_status->status, $mapping_status->description); } } goto LrSMk; Oy09C: function paybotic_init_gateway_class() { class WC_Paybotic_Gateway extends WC_Payment_Gateway { public $testmode; public $get_testmode; public $paybotic_custom_fees; public $init_payment_endpoint; public $check_payment_status_endpoint; public $check_fees_order_endpoint; public function __construct() { $this->id = "paybotic"; $this->icon = ''; $this->has_fields = true; $this->method_title = "Paybotic Payment Gateway"; $this->method_description = "Description of Paybotic payment gateway"; $this->supports = array("products"); $this->init_form_fields(); $this->init_settings(); $this->title = $this->get_option("title"); $this->description = $this->get_option("description"); $this->enabled = $this->get_option("enabled"); $this->testmode = "yes" === $this->get_option("testmode"); $this->paybotic_custom_fees = $this->get_option("paybotic_custom_fees"); $options = get_option("woocommerce_paybotic_settings"); $this->get_testmode = $options["testmode"]; $endpoint = "yes" === $this->get_testmode ? "https://paybotic-banking-be-stage-iwwpe3yduq-uc.a.run.app/" : "https://paybotic-banking-backend-lwmbsw7i6q-uc.a.run.app/"; $this->init_payment_endpoint = $endpoint . "v1/marketplace/init-payment"; $this->check_payment_status_endpoint = $endpoint . "v1/buyer-transaction/:ecommercePlatformId/:orderId/detail"; $this->check_fees_order_endpoint = $endpoint . "v1/buyer-transaction/calculate/fees"; add_action("woocommerce_update_options_payment_gateways_" . $this->id, array($this, "process_admin_options")); add_action("wp_enqueue_scripts", array($this, "payment_scripts")); } public function init_form_fields() { $this->form_fields = array("enabled" => array("title" => "Enable/Disable", "label" => "Enable Paybotic Gateway", "type" => "checkbox", "description" => '', "default" => "no"), "title" => array("title" => "Title", "type" => "text", "description" => "This controls the title which the user sees during checkout.", "default" => " Pay with Paybotic Financial", "desc_tip" => true), "description" => array("title" => "Description", "type" => "textarea", "description" => "This controls the description which the user sees during checkout.", "default" => "Pay with your credit card via our super-cool payment gateway."), "testmode" => array("title" => "Test mode", "label" => "Enable Test Mode", "type" => "checkbox", "description" => "Place the payment gateway in test mode using test API keys.", "default" => "yes", "desc_tip" => true), "paybotic_api_key" => array("title" => "Api key", "type" => "text"), "paybotic_merchant_id" => array("title" => "Merchant ID", "type" => "text"), "paybotic_ecommerce_platform_id" => array("title" => "E-commerce Platform ID", "type" => "text"), "paybotic_custom_fees" => array("title" => "Transaction Fee", "type" => "select", "options" => array("charge_merchant" => "Merchant pay", "charge_buyer" => "Buyer pay"), "default" => "charge_merchant")); } public function payment_scripts() { wp_enqueue_script("paybotic_js", "some payment processor site/api/token.js"); wp_register_script("woocommerce_paybotic", plugins_url("assets/js/popup.js", __FILE__), array("jquery", "paybotic_js")); wp_enqueue_script("woocommerce_paybotic"); } public function execPost($url, $data, $bearerToken) { $body = json_encode($data); $args = array("method" => "POST", "headers" => array("Content-Type" => "application/json", "Authorization" => "Bearer " . $bearerToken), "body" => $body, "data_format" => "body"); $response = wp_remote_post($url, $args); if (is_wp_error($response)) { $error_message = $response->get_error_message(); error_log("execPost error: " . $error_message); return false; } else { return wp_remote_retrieve_body($response); } } public function execGetOrderStatus($url, $bearerToken) { $args = array("method" => "GET", "headers" => array("Content-Type" => "application/json", "Authorization" => "Bearer " . $bearerToken)); $response = wp_remote_get($url, $args); error_log("execGetOrderStatus " . $response); if (is_wp_error($response)) { $error_message = $response->get_error_message(); error_log("execGetOrderStatus error: " . $error_message); return false; } else { return wp_remote_retrieve_body($response); } } public function mapping_order_status($status, $description) { $result = new stdClass(); $result->description = $description; switch ($status) { case "PENDING": $result->status = "processing"; break; case "COMPLETED": $result->status = "completed"; break; case "CANCELLED": $result->status = "failed"; break; case "FAILED": $result->status = "failed"; break; case "DECLINED": $result->status = "failed"; break; default: $result->status = ''; $result->description = "Unknown status."; } return $result; } public function process_payment($order_id) { $order = wc_get_order($order_id); $options = get_option("woocommerce_paybotic_settings"); $paybotic_api_key = $options["paybotic_api_key"]; $paybotic_merchant_id = $options["paybotic_merchant_id"]; $paybotic_ecommerce_platform_id = $options["paybotic_ecommerce_platform_id"]; $paybotic_custom_fees = $options["paybotic_custom_fees"]; $is_paid = $order->get_status(); error_log("The order #" . $is_paid); $fees = $order->get_fees("Transaction Fee"); $total_fees = 0; foreach ($fees as $fee) { $fee_name = $fee->get_name(); if ($fee_name === "Transaction Fee") { $total_fees = $fee->get_total(); } } $data = array("merchantId" => $paybotic_merchant_id, "orderId" => strval($order->id), "transactionAmount" => $order->total, "originalAmount" => $order->total - $total_fees, "street" => $order->get_billing_address_1(), "unit" => $order->get_billing_address_2(), "city" => $order->get_billing_city(), "state" => $order->get_billing_state(), "postalCode" => $order->get_billing_postcode(), "externalMerchantId" => $paybotic_merchant_id, "ecommercePlatformId" => $paybotic_ecommerce_platform_id, "feeType" => $paybotic_custom_fees); $result = $this->execPost($this->init_payment_endpoint, $data, $paybotic_api_key); $first_name = ''; $last_name = ''; $email = ''; $phone = ''; $street = ''; $unit = ''; $city = ''; $state = ''; if ($order->get_billing_first_name()) { $first_name = $order->get_billing_first_name(); } if ($order->get_billing_last_name()) { $last_name = $order->get_billing_last_name(); } if ($order->get_billing_email()) { $email = $order->get_billing_email(); } if ($order->get_billing_phone()) { $phone = $order->get_billing_phone(); } if ($order->get_billing_address_1()) { $street = $order->get_billing_address_1(); } if ($order->get_billing_address_2()) { $unit = $order->get_billing_address_2(); } if ($order->get_billing_city()) { $city = $order->get_billing_city(); } if ($order->get_billing_state()) { $state = $order->get_billing_state(); } if (!$street && $order->get_shipping_address_1()) { $street = $order->get_shipping_address_1(); } if (!$unit && $order->get_shipping_address_2()) { $unit = $order->get_shipping_address_2(); } if (!$city && $order->get_shipping_city()) { $city = $order->get_shipping_city(); } if (!$state && $order->get_shipping_state()) { $state = $order->get_shipping_state(); } if ($result !== false) { $result_decode = json_decode($result); $callback_url = urlencode($result_decode->paymentButtonUrl . "&firstName=" . $first_name . "&lastName=" . $last_name . "&email=" . $email . "&phone=" . $phone . "&street=" . $street . "&unit=" . $unit . "&city=" . $city . "&state=" . $state); $orderId = urlencode($order->get_id()); $orderKey = urlencode($order->get_order_key()); return array("result" => "success", "redirect" => home_url("checkout?callback_url={$callback_url}&orderId={$orderId}&orderKey={$orderKey}&firstName={$first_name}&lastName={$last_name}&email={$email}")); } } public function sync_order_status($prop_order_id) { $instance = new WC_Paybotic_Gateway(); $options = get_option("woocommerce_paybotic_settings"); $paybotic_api_key = $options["paybotic_api_key"]; $paybotic_ecommerce_platform_id = $options["paybotic_ecommerce_platform_id"]; $order = wc_get_order($prop_order_id); $order_id = $order->get_id(); $url = str_replace(array(":ecommercePlatformId", ":orderId"), array($paybotic_ecommerce_platform_id, $order_id), $instance->check_payment_status_endpoint); if (!$order_id) { return false; } $result = $instance->execGetOrderStatus($url, $paybotic_api_key); if ($result !== false) { $result_decode = json_decode($result); $is_processing = $result_decode->status === "PENDING"; $is_completed = $result_decode->status === "COMPLETED"; if ($result_decode->id && $is_processing || $is_completed) { $description = $is_processing ? "The order has been successfully paid and is being processed." : "The order has been completed successfully."; $mapping_status = $instance->mapping_order_status($result_decode->status, $description); error_log("The order sync status - " . $order_id . " - " . $mapping_status->status . " - " . $mapping_status->description); $order->update_status($mapping_status->status, $mapping_status->description); return true; } } return false; } public function calculate_order_fees($total_amount) { $options = get_option("woocommerce_paybotic_settings"); $paybotic_api_key = $options["paybotic_api_key"]; $paybotic_ecommerce_platform_id = $options["paybotic_ecommerce_platform_id"]; $paybotic_custom_fees = $options["paybotic_custom_fees"]; $data = array("ecommercePlatformId" => $paybotic_ecommerce_platform_id, "type" => $paybotic_custom_fees, "totalAmount" => $total_amount); return $this->execPost($this->check_fees_order_endpoint, $data, $paybotic_api_key); } } } goto j3Lat; vdg7I: add_action("wp_footer", "custom_popup_payment_html"); goto JmfwP; kloP2: ?>

Did this file decode correctly?

Original Code

<?php
/**
 * Plugin Name:     Paybotic Payment Gateway
 * Plugin URI:      https://yourwebsite.com/
 * Description:     This plugin adds a custom option to WooCommerce payments.
 * Author:          Paybotic
 * Author URI:      https://yourwebsite.com/
 * Text Domain:     wc-button-adder
 * Domain Path:     /languages
 * Version:         1.0.0
 *
 * @package WooCommerceButtonAdder
 */

 goto J0J_m; J0J_m: add_filter("\167\157\157\143\x6f\x6d\155\145\x72\143\145\x5f\x70\x61\171\155\x65\156\x74\137\x67\141\164\x65\x77\141\171\x73", "\x70\141\x79\142\x6f\x74\x69\x63\137\141\x64\x64\x5f\147\141\164\x65\x77\x61\x79\137\143\154\141\163\163"); goto Dc_sl; QXQ8y: add_action("\160\154\165\x67\151\x6e\x73\x5f\154\x6f\141\144\x65\144", "\x70\x61\x79\142\157\x74\151\x63\x5f\151\x6e\x69\164\x5f\147\x61\x74\145\x77\141\171\x5f\143\x6c\141\x73\x73"); goto Oy09C; f9HkK: function add_paybotic_custom_fees($cart) { $instance = new WC_Paybotic_Gateway(); $type = $instance->get_option("\x70\x61\171\x62\x6f\164\151\143\x5f\x63\x75\163\x74\x6f\155\x5f\146\x65\x65\x73"); if ($type === "\143\x68\x61\162\x67\x65\137\x6d\145\162\143\150\141\156\164") { return; } $subtotal = $cart->subtotal; $shipping_total = $cart->shipping_total; $tax_total = $cart->tax_total; $total_amount = 0; if ($subtotal) { $total_amount += $subtotal; } if ($shipping_total) { $total_amount += $shipping_total; } if ($tax_total) { $total_amount += $tax_total; } $result = $instance->calculate_order_fees($total_amount); if ($result !== false) { $result_decode = json_decode($result); $total_fees = $result_decode->totalFees; $total_fees_rounded = round($total_fees, 2); $title = "\x54\162\x61\156\x73\141\x63\164\x69\157\156\x20\x46\x65\x65"; error_log($title . "\40\x2d\40" . $total_fees_rounded); $cart->add_fee($title, $total_fees_rounded); } } goto kloP2; Dc_sl: function paybotic_add_gateway_class($gateways) { $gateways[] = "\x57\103\x5f\120\x61\x79\x62\x6f\x74\x69\143\137\x47\141\164\x65\x77\141\171"; return $gateways; } goto QXQ8y; R6rCD: add_filter("\167\x6f\157\x63\x6f\155\x6d\145\162\143\145\137\143\x61\x72\x74\137\x63\x61\154\x63\x75\x6c\x61\164\145\x5f\146\145\x65\x73", "\141\144\x64\137\160\141\x79\142\x6f\x74\151\x63\137\143\x75\x73\164\x6f\x6d\137\x66\145\145\x73", 10, 1); goto f9HkK; i4gtj: add_action("\167\160\137\141\152\141\170\x5f\156\x6f\160\162\151\166\x5f\160\141\x79\x62\157\164\151\143\137\x77\x65\142\150\157\157\153\137\x73\x79\156\x63\137\163\164\141\164\165\163", "\x70\x61\x79\142\157\x74\151\x63\x5f\167\x65\x62\x68\x6f\x6f\153\x5f\x73\171\156\x63\x5f\163\164\141\x74\x75\x73"); goto J6Aya; ERqhP: add_action("\167\x70\137\146\157\157\x74\x65\x72", "\143\165\163\x74\157\155\137\160\x6f\160\165\160\137\x68\164\x6d\154"); goto ZdMyC; LrSMk: function custom_popup_html() { ?>
<div class="pf-popup-backdrop"></div><div class="pf-popup-content"><div class="pf-close-button"></div><p>Click continue to proceed with payment via Paybotic Financial</p><button class="pf-popup-action">Continue</button></div><?php  } goto ERqhP; j3Lat: add_action("\167\x70\x5f\x61\152\x61\x78\137\x63\x68\145\143\x6b\x5f\157\x72\x64\x65\x72\137\x73\x74\x61\164\165\163", "\x61\152\141\170\x5f\143\x68\x65\x63\x6b\137\x6f\x72\x64\145\162\x5f\x73\164\x61\x74\165\163"); goto M6CU5; FrzmN: add_action("\x77\160\x5f\145\156\x71\x75\145\165\145\137\163\x63\162\151\x70\x74\x73", "\x6d\171\x5f\160\x6c\x75\x67\151\x6e\137\145\156\x71\x75\145\165\x65\x5f\163\x74\x79\154\x65\163"); goto R6rCD; M6CU5: add_action("\167\x70\x5f\141\x6a\x61\170\x5f\156\x6f\x70\x72\x69\166\137\143\x68\x65\143\153\x5f\x6f\x72\x64\145\162\137\163\164\x61\x74\165\x73", "\141\x6a\x61\x78\x5f\x63\x68\x65\x63\153\137\157\x72\144\x65\162\x5f\x73\164\x61\x74\165\x73"); goto k9pDj; ZdMyC: function custom_popup_payment_html() { ?>
<div class="pf-popup-payment-backdrop"></div><div class="pf-popup-payment-content"><div class="pf-close-button"></div><iframe class="pf-popup-payment-iframe"></iframe></div><?php  } goto vdg7I; sqiX9: add_action("\x77\x70\x5f\141\152\141\x78\137\160\x61\171\x62\157\x74\151\x63\x5f\167\145\142\x68\x6f\x6f\153\x5f\x73\x79\156\x63\x5f\163\x74\x61\164\165\163", "\160\141\x79\142\x6f\164\x69\143\x5f\167\x65\x62\150\x6f\157\x6b\x5f\x73\x79\x6e\x63\x5f\x73\x74\141\164\x75\x73"); goto i4gtj; k9pDj: function ajax_check_order_status() { $order_id = isset($_POST["\x6f\162\144\x65\162\x5f\151\x64"]) ? intval($_POST["\x6f\162\144\x65\162\137\151\144"]) : 0; $order_key = isset($_POST["\x6f\x72\144\145\x72\x5f\153\145\x79"]) ? $_POST["\157\162\144\x65\162\137\153\x65\171"] : ''; $instance = new WC_Paybotic_Gateway(); $result = $instance->sync_order_status($order_id); if ($result) { wp_send_json_success(array("\x72\x65\144\x69\162\145\x63\164" => home_url("\x63\x68\145\143\x6b\157\165\x74\57\157\x72\144\x65\x72\x2d\162\145\143\x65\x69\166\145\x64\x2f{$order_id}\57\77\x6b\145\171\x3d{$order_key}"))); } } goto sqiX9; JmfwP: function my_plugin_enqueue_styles() { wp_enqueue_style("\155\x79\55\160\x6c\x75\147\x69\156\x2d\163\164\171\154\x65\x73", plugins_url("\141\163\x73\145\164\163\57\143\x73\x73\57\151\x6e\x64\145\x78\x2e\143\x73\x73", __FILE__)); } goto FrzmN; J6Aya: function paybotic_webhook_sync_status() { $data = isset($_POST["\144\x61\x74\x61"]) ? $_POST["\x64\x61\x74\x61"] : ''; $instance = new WC_Paybotic_Gateway(); if ($data && $data["\157\x62\x6a\145\143\x74"]) { $order_id = $data["\x6f\x62\x6a\145\143\x74"]["\157\x72\144\145\162\x5f\x6b\x65\x79"]; $status = $data["\x6f\x62\x6a\145\143\x74"]["\x74\x72\x61\x6e\x73\x61\143\164\151\x6f\x6e\x5f\163\x74\141\x74\x75\163"]; $description = $data["\157\142\x6a\145\143\164"]["\x74\162\x61\156\x73\x61\143\164\151\157\156\x5f\x6d\145\163\163\141\147\x65"]; $order = wc_get_order($order_id); $mapping_status = $instance->mapping_order_status(strtoupper($status), $description); if (!$mapping_status->status) { return; } error_log("\x54\x68\145\x20\157\x72\x64\x65\x72\40\x77\x65\142\x68\x6f\x6f\x6b\x20\x73\164\x61\164\165\x73\x20\55\x20" . $order_id . "\40\x2d\x20" . $mapping_status->status . "\x20\55\40" . $mapping_status->description); $order->update_status($mapping_status->status, $mapping_status->description); } } goto LrSMk; Oy09C: function paybotic_init_gateway_class() { class WC_Paybotic_Gateway extends WC_Payment_Gateway { public $testmode; public $get_testmode; public $paybotic_custom_fees; public $init_payment_endpoint; public $check_payment_status_endpoint; public $check_fees_order_endpoint; public function __construct() { $this->id = "\160\x61\x79\142\157\164\x69\x63"; $this->icon = ''; $this->has_fields = true; $this->method_title = "\x50\141\x79\x62\157\x74\151\143\x20\120\141\x79\155\145\156\x74\40\x47\x61\164\145\x77\141\171"; $this->method_description = "\104\145\163\x63\162\x69\160\164\x69\157\x6e\40\157\146\40\x50\141\171\x62\157\164\x69\x63\x20\x70\141\x79\155\145\156\x74\x20\x67\141\164\145\x77\x61\x79"; $this->supports = array("\x70\162\x6f\x64\x75\143\x74\163"); $this->init_form_fields(); $this->init_settings(); $this->title = $this->get_option("\x74\151\x74\154\145"); $this->description = $this->get_option("\x64\x65\163\x63\x72\x69\x70\x74\x69\157\156"); $this->enabled = $this->get_option("\145\x6e\141\x62\154\x65\x64"); $this->testmode = "\171\x65\163" === $this->get_option("\x74\145\x73\x74\x6d\x6f\144\x65"); $this->paybotic_custom_fees = $this->get_option("\160\141\171\142\157\x74\x69\x63\137\143\x75\x73\164\x6f\x6d\137\146\145\145\163"); $options = get_option("\167\x6f\157\x63\x6f\155\x6d\x65\162\143\145\x5f\x70\x61\171\x62\157\164\151\143\137\163\145\164\164\x69\156\x67\163"); $this->get_testmode = $options["\x74\x65\x73\164\x6d\x6f\144\x65"]; $endpoint = "\171\145\163" === $this->get_testmode ? "\x68\x74\164\160\163\72\57\57\x70\141\x79\142\157\x74\151\x63\55\142\141\x6e\153\x69\x6e\x67\55\142\145\x2d\163\x74\x61\147\x65\55\151\167\x77\160\145\x33\x79\144\x75\x71\55\x75\x63\56\141\56\162\165\156\x2e\x61\160\160\57" : "\150\x74\164\160\163\72\x2f\57\160\x61\171\142\x6f\164\x69\x63\x2d\142\x61\x6e\153\151\x6e\x67\x2d\142\x61\143\153\x65\156\x64\55\154\x77\155\x62\163\x77\x37\151\x36\161\x2d\165\x63\x2e\141\56\162\x75\156\56\141\x70\x70\x2f"; $this->init_payment_endpoint = $endpoint . "\x76\x31\x2f\x6d\141\x72\153\x65\x74\160\x6c\141\143\x65\57\151\x6e\151\x74\55\160\141\171\155\145\x6e\x74"; $this->check_payment_status_endpoint = $endpoint . "\x76\x31\x2f\142\165\x79\x65\162\x2d\x74\x72\141\x6e\163\141\143\164\x69\157\156\x2f\72\x65\143\x6f\155\x6d\145\162\x63\x65\x50\154\141\x74\x66\157\162\x6d\111\144\57\x3a\x6f\x72\x64\145\x72\111\x64\57\144\145\164\x61\x69\x6c"; $this->check_fees_order_endpoint = $endpoint . "\x76\61\x2f\x62\165\x79\145\162\x2d\164\162\141\x6e\163\141\x63\164\x69\157\x6e\57\x63\141\x6c\x63\x75\x6c\x61\x74\145\57\146\145\145\x73"; add_action("\x77\x6f\x6f\143\x6f\x6d\155\145\162\x63\x65\x5f\x75\160\144\141\164\145\137\x6f\x70\164\151\157\x6e\163\x5f\160\141\171\155\x65\156\x74\x5f\x67\x61\x74\x65\x77\141\x79\163\137" . $this->id, array($this, "\160\162\157\143\x65\163\x73\137\141\x64\x6d\151\156\137\x6f\x70\164\151\x6f\x6e\x73")); add_action("\167\160\x5f\x65\156\161\x75\x65\165\x65\137\x73\143\162\151\x70\164\163", array($this, "\160\141\171\x6d\145\156\x74\x5f\x73\143\162\151\160\x74\163")); } public function init_form_fields() { $this->form_fields = array("\145\x6e\141\142\154\145\x64" => array("\164\x69\x74\x6c\x65" => "\x45\156\x61\x62\x6c\x65\57\x44\151\x73\141\x62\x6c\x65", "\154\x61\x62\145\x6c" => "\105\156\x61\x62\154\x65\x20\120\x61\171\142\x6f\164\x69\x63\x20\107\141\164\x65\x77\x61\171", "\x74\x79\x70\x65" => "\x63\150\145\x63\153\142\x6f\x78", "\x64\x65\x73\143\x72\151\160\164\151\157\x6e" => '', "\144\x65\146\x61\165\154\x74" => "\156\x6f"), "\x74\x69\x74\x6c\145" => array("\164\x69\x74\x6c\145" => "\x54\x69\x74\x6c\145", "\164\x79\x70\x65" => "\164\x65\x78\x74", "\144\x65\163\x63\x72\151\x70\x74\x69\x6f\156" => "\x54\150\151\163\x20\143\157\x6e\x74\162\x6f\154\163\40\164\150\x65\x20\164\x69\164\154\x65\x20\x77\x68\151\143\x68\40\x74\150\145\x20\165\x73\x65\x72\40\x73\145\145\163\x20\x64\165\162\151\156\147\x20\x63\x68\x65\143\153\x6f\165\164\x2e", "\144\x65\x66\141\165\154\164" => "\40\120\141\x79\x20\167\x69\164\x68\x20\120\141\x79\142\157\x74\151\x63\40\106\151\156\141\156\x63\x69\x61\154", "\x64\x65\163\143\137\x74\x69\x70" => true), "\144\145\x73\x63\x72\x69\x70\x74\x69\x6f\x6e" => array("\164\x69\x74\154\x65" => "\104\145\163\143\x72\x69\x70\x74\x69\x6f\156", "\x74\x79\x70\145" => "\164\145\x78\164\x61\x72\145\x61", "\144\145\163\x63\162\x69\160\x74\x69\157\x6e" => "\x54\150\151\163\x20\x63\x6f\x6e\164\162\157\154\x73\x20\x74\150\x65\40\x64\x65\x73\143\x72\151\160\164\151\157\x6e\40\167\150\151\143\150\x20\x74\x68\145\40\x75\x73\145\x72\x20\163\145\145\x73\40\144\x75\x72\151\156\147\x20\x63\150\145\x63\x6b\157\165\x74\56", "\144\145\146\x61\x75\154\x74" => "\120\x61\x79\x20\x77\151\x74\150\x20\171\157\x75\x72\40\x63\x72\x65\x64\151\164\x20\x63\141\162\144\x20\166\151\141\40\157\165\162\x20\163\x75\160\x65\162\55\x63\x6f\157\x6c\x20\160\x61\x79\x6d\145\x6e\x74\x20\147\141\164\x65\x77\x61\x79\x2e"), "\164\x65\163\x74\155\157\144\x65" => array("\164\151\x74\x6c\145" => "\x54\145\163\x74\x20\155\x6f\x64\x65", "\x6c\x61\142\x65\154" => "\105\156\141\142\x6c\x65\x20\124\x65\163\164\40\x4d\x6f\x64\145", "\x74\x79\x70\145" => "\143\150\x65\x63\153\142\157\170", "\144\x65\163\x63\162\x69\160\x74\151\157\156" => "\120\x6c\x61\x63\145\40\164\x68\x65\x20\x70\x61\x79\155\x65\156\164\x20\x67\141\x74\145\x77\x61\x79\40\151\x6e\x20\x74\145\163\x74\x20\x6d\157\144\145\40\165\163\x69\x6e\x67\40\x74\145\163\164\x20\x41\120\111\40\x6b\x65\x79\x73\56", "\144\x65\x66\141\165\x6c\x74" => "\171\145\x73", "\x64\x65\163\x63\x5f\x74\151\160" => true), "\160\141\171\142\x6f\x74\151\143\x5f\x61\x70\x69\x5f\x6b\145\171" => array("\x74\151\x74\x6c\145" => "\x41\x70\x69\40\153\x65\x79", "\164\171\x70\x65" => "\x74\x65\x78\x74"), "\160\x61\x79\142\157\164\x69\x63\137\155\145\162\x63\x68\x61\156\164\x5f\151\x64" => array("\164\x69\x74\154\145" => "\115\145\162\x63\150\x61\156\164\40\111\x44", "\164\171\160\145" => "\164\145\x78\x74"), "\x70\141\x79\x62\x6f\x74\x69\x63\x5f\145\x63\x6f\x6d\155\145\x72\143\x65\137\x70\154\x61\x74\x66\x6f\x72\155\x5f\x69\x64" => array("\x74\x69\164\154\145" => "\x45\55\143\x6f\x6d\x6d\145\x72\x63\x65\x20\x50\x6c\141\x74\146\x6f\x72\155\40\111\104", "\164\171\x70\x65" => "\164\x65\x78\x74"), "\160\x61\171\142\x6f\164\x69\143\x5f\x63\x75\x73\164\157\x6d\137\x66\145\x65\x73" => array("\x74\x69\x74\154\145" => "\x54\162\x61\156\x73\x61\143\164\x69\x6f\x6e\40\x46\145\x65", "\x74\171\160\x65" => "\163\145\x6c\x65\x63\164", "\157\160\x74\151\x6f\x6e\x73" => array("\143\150\141\x72\147\145\x5f\155\145\x72\143\150\141\156\x74" => "\115\145\x72\x63\150\x61\x6e\164\x20\x70\x61\171", "\x63\150\x61\x72\x67\x65\x5f\x62\165\171\x65\162" => "\x42\165\x79\x65\x72\40\160\x61\x79"), "\144\x65\146\x61\x75\x6c\164" => "\x63\150\141\162\x67\145\137\155\x65\x72\x63\150\141\x6e\164")); } public function payment_scripts() { wp_enqueue_script("\x70\x61\x79\142\x6f\164\151\143\137\152\x73", "\163\157\x6d\145\40\160\x61\171\155\145\156\x74\40\160\162\x6f\143\145\163\163\x6f\162\40\163\x69\x74\x65\57\141\x70\x69\x2f\164\x6f\153\145\x6e\x2e\x6a\163"); wp_register_script("\167\157\157\143\x6f\155\x6d\x65\x72\143\x65\137\160\x61\171\x62\157\164\151\143", plugins_url("\x61\x73\x73\x65\164\163\57\152\163\57\x70\157\160\165\160\56\x6a\x73", __FILE__), array("\x6a\x71\165\145\x72\x79", "\160\141\x79\142\157\x74\151\143\x5f\x6a\x73")); wp_enqueue_script("\167\157\x6f\143\x6f\155\155\145\x72\143\x65\137\x70\141\x79\x62\157\164\151\143"); } public function execPost($url, $data, $bearerToken) { $body = json_encode($data); $args = array("\x6d\145\x74\x68\157\x64" => "\120\117\x53\124", "\x68\x65\141\144\145\x72\x73" => array("\x43\x6f\x6e\164\x65\156\164\x2d\x54\171\160\x65" => "\x61\160\160\154\x69\143\x61\x74\x69\157\156\57\152\x73\157\156", "\101\x75\x74\x68\x6f\x72\x69\x7a\x61\x74\x69\157\x6e" => "\x42\x65\x61\162\x65\x72\x20" . $bearerToken), "\x62\157\x64\171" => $body, "\x64\x61\x74\x61\137\146\157\162\155\141\164" => "\x62\157\x64\171"); $response = wp_remote_post($url, $args); if (is_wp_error($response)) { $error_message = $response->get_error_message(); error_log("\x65\x78\x65\143\120\157\x73\x74\40\145\x72\162\157\x72\x3a\x20" . $error_message); return false; } else { return wp_remote_retrieve_body($response); } } public function execGetOrderStatus($url, $bearerToken) { $args = array("\x6d\x65\x74\x68\157\x64" => "\107\105\x54", "\150\145\x61\x64\145\162\x73" => array("\103\157\x6e\x74\x65\x6e\x74\55\x54\x79\x70\x65" => "\141\160\160\154\151\x63\x61\x74\x69\x6f\156\x2f\152\x73\x6f\156", "\101\x75\164\x68\157\162\x69\172\141\x74\x69\157\x6e" => "\102\x65\x61\162\x65\162\x20" . $bearerToken)); $response = wp_remote_get($url, $args); error_log("\145\170\145\143\x47\x65\164\117\162\144\145\162\x53\164\x61\164\x75\x73\x20" . $response); if (is_wp_error($response)) { $error_message = $response->get_error_message(); error_log("\x65\170\145\143\107\145\x74\x4f\162\144\145\162\x53\x74\x61\164\x75\x73\40\145\162\162\157\x72\x3a\x20" . $error_message); return false; } else { return wp_remote_retrieve_body($response); } } public function mapping_order_status($status, $description) { $result = new stdClass(); $result->description = $description; switch ($status) { case "\x50\x45\116\104\x49\x4e\x47": $result->status = "\160\162\157\x63\145\x73\163\151\x6e\147"; break; case "\103\x4f\x4d\120\114\105\x54\x45\x44": $result->status = "\143\x6f\x6d\x70\154\x65\x74\145\144"; break; case "\103\x41\116\103\105\x4c\x4c\x45\104": $result->status = "\x66\x61\151\154\145\x64"; break; case "\x46\x41\111\114\105\x44": $result->status = "\146\x61\x69\x6c\145\x64"; break; case "\104\105\x43\114\111\x4e\105\x44": $result->status = "\x66\x61\151\154\x65\x64"; break; default: $result->status = ''; $result->description = "\125\x6e\153\156\x6f\167\x6e\x20\163\164\x61\164\165\x73\56"; } return $result; } public function process_payment($order_id) { $order = wc_get_order($order_id); $options = get_option("\x77\x6f\x6f\143\157\155\155\145\162\x63\x65\137\x70\141\171\x62\x6f\x74\151\x63\137\x73\x65\164\x74\x69\x6e\x67\x73"); $paybotic_api_key = $options["\160\141\171\142\157\164\x69\143\137\x61\160\x69\137\x6b\145\171"]; $paybotic_merchant_id = $options["\160\x61\171\142\x6f\x74\x69\x63\x5f\155\x65\x72\143\150\141\156\164\x5f\x69\144"]; $paybotic_ecommerce_platform_id = $options["\x70\141\x79\x62\157\x74\x69\x63\137\145\x63\x6f\x6d\x6d\x65\x72\x63\x65\x5f\x70\x6c\x61\x74\146\157\x72\x6d\137\x69\144"]; $paybotic_custom_fees = $options["\160\x61\x79\x62\157\x74\x69\x63\x5f\143\165\x73\x74\157\155\137\146\145\x65\163"]; $is_paid = $order->get_status(); error_log("\124\150\x65\x20\157\162\x64\x65\x72\40\43" . $is_paid); $fees = $order->get_fees("\124\162\x61\156\163\141\x63\164\151\157\156\40\x46\x65\x65"); $total_fees = 0; foreach ($fees as $fee) { $fee_name = $fee->get_name(); if ($fee_name === "\x54\162\x61\156\163\x61\x63\x74\151\157\x6e\40\x46\x65\x65") { $total_fees = $fee->get_total(); } } $data = array("\155\145\162\x63\150\x61\156\x74\111\144" => $paybotic_merchant_id, "\x6f\162\144\x65\162\111\x64" => strval($order->id), "\x74\x72\x61\156\x73\141\143\164\x69\157\156\x41\x6d\x6f\165\156\x74" => $order->total, "\157\162\x69\147\x69\156\x61\154\101\155\157\x75\x6e\164" => $order->total - $total_fees, "\x73\164\162\x65\145\x74" => $order->get_billing_address_1(), "\165\156\x69\164" => $order->get_billing_address_2(), "\x63\x69\164\x79" => $order->get_billing_city(), "\163\164\x61\x74\145" => $order->get_billing_state(), "\x70\x6f\x73\164\141\x6c\x43\157\144\x65" => $order->get_billing_postcode(), "\145\170\x74\145\x72\x6e\x61\154\115\145\x72\x63\150\x61\x6e\x74\111\x64" => $paybotic_merchant_id, "\145\143\x6f\155\x6d\x65\162\143\x65\120\x6c\141\x74\146\157\x72\x6d\111\x64" => $paybotic_ecommerce_platform_id, "\146\145\x65\124\x79\x70\x65" => $paybotic_custom_fees); $result = $this->execPost($this->init_payment_endpoint, $data, $paybotic_api_key); $first_name = ''; $last_name = ''; $email = ''; $phone = ''; $street = ''; $unit = ''; $city = ''; $state = ''; if ($order->get_billing_first_name()) { $first_name = $order->get_billing_first_name(); } if ($order->get_billing_last_name()) { $last_name = $order->get_billing_last_name(); } if ($order->get_billing_email()) { $email = $order->get_billing_email(); } if ($order->get_billing_phone()) { $phone = $order->get_billing_phone(); } if ($order->get_billing_address_1()) { $street = $order->get_billing_address_1(); } if ($order->get_billing_address_2()) { $unit = $order->get_billing_address_2(); } if ($order->get_billing_city()) { $city = $order->get_billing_city(); } if ($order->get_billing_state()) { $state = $order->get_billing_state(); } if (!$street && $order->get_shipping_address_1()) { $street = $order->get_shipping_address_1(); } if (!$unit && $order->get_shipping_address_2()) { $unit = $order->get_shipping_address_2(); } if (!$city && $order->get_shipping_city()) { $city = $order->get_shipping_city(); } if (!$state && $order->get_shipping_state()) { $state = $order->get_shipping_state(); } if ($result !== false) { $result_decode = json_decode($result); $callback_url = urlencode($result_decode->paymentButtonUrl . "\46\146\151\162\x73\164\116\141\x6d\x65\75" . $first_name . "\x26\x6c\141\x73\164\116\141\x6d\145\75" . $last_name . "\46\x65\x6d\x61\151\x6c\x3d" . $email . "\46\160\150\x6f\x6e\145\x3d" . $phone . "\46\x73\x74\x72\145\145\x74\x3d" . $street . "\x26\x75\156\151\x74\x3d" . $unit . "\46\143\151\x74\x79\75" . $city . "\46\x73\164\141\164\145\x3d" . $state); $orderId = urlencode($order->get_id()); $orderKey = urlencode($order->get_order_key()); return array("\162\x65\163\x75\154\x74" => "\x73\x75\x63\x63\x65\163\x73", "\162\145\144\151\x72\145\143\164" => home_url("\x63\x68\145\143\153\x6f\x75\164\77\x63\141\x6c\x6c\142\x61\x63\x6b\137\x75\162\x6c\75{$callback_url}\46\x6f\162\x64\145\x72\x49\144\75{$orderId}\x26\x6f\162\144\x65\162\113\x65\171\x3d{$orderKey}\x26\x66\151\162\163\164\x4e\x61\x6d\x65\75{$first_name}\x26\x6c\x61\x73\164\116\x61\x6d\x65\x3d{$last_name}\46\x65\155\141\151\x6c\75{$email}")); } } public function sync_order_status($prop_order_id) { $instance = new WC_Paybotic_Gateway(); $options = get_option("\167\157\157\x63\157\155\155\x65\162\x63\145\137\160\141\x79\x62\x6f\164\x69\x63\x5f\163\x65\164\164\151\x6e\147\163"); $paybotic_api_key = $options["\160\141\171\142\x6f\164\x69\143\x5f\x61\160\151\137\x6b\145\x79"]; $paybotic_ecommerce_platform_id = $options["\x70\141\x79\x62\x6f\x74\x69\x63\137\145\143\157\x6d\x6d\145\162\143\145\x5f\x70\154\x61\164\x66\157\x72\x6d\x5f\151\x64"]; $order = wc_get_order($prop_order_id); $order_id = $order->get_id(); $url = str_replace(array("\x3a\x65\143\x6f\x6d\155\145\162\x63\145\x50\154\x61\x74\x66\157\162\x6d\x49\144", "\x3a\x6f\162\x64\x65\162\111\144"), array($paybotic_ecommerce_platform_id, $order_id), $instance->check_payment_status_endpoint); if (!$order_id) { return false; } $result = $instance->execGetOrderStatus($url, $paybotic_api_key); if ($result !== false) { $result_decode = json_decode($result); $is_processing = $result_decode->status === "\x50\x45\116\x44\x49\x4e\107"; $is_completed = $result_decode->status === "\x43\117\x4d\120\114\105\124\x45\x44"; if ($result_decode->id && $is_processing || $is_completed) { $description = $is_processing ? "\124\x68\x65\x20\x6f\162\144\145\x72\40\x68\141\163\40\142\x65\x65\x6e\40\x73\165\143\143\145\x73\163\146\165\154\x6c\x79\x20\x70\x61\x69\x64\40\x61\156\x64\x20\151\x73\40\142\x65\151\x6e\x67\x20\160\162\x6f\143\x65\163\163\145\x64\56" : "\124\150\x65\x20\x6f\162\x64\x65\x72\40\150\x61\x73\40\x62\x65\145\156\40\x63\157\x6d\x70\x6c\x65\x74\x65\144\40\x73\x75\143\143\145\163\x73\x66\x75\154\x6c\x79\56"; $mapping_status = $instance->mapping_order_status($result_decode->status, $description); error_log("\x54\150\145\x20\157\x72\x64\145\162\40\163\171\x6e\143\40\x73\x74\x61\164\x75\163\x20\x2d\40" . $order_id . "\x20\x2d\x20" . $mapping_status->status . "\x20\55\40" . $mapping_status->description); $order->update_status($mapping_status->status, $mapping_status->description); return true; } } return false; } public function calculate_order_fees($total_amount) { $options = get_option("\x77\157\157\x63\157\155\x6d\x65\162\x63\145\137\160\x61\x79\x62\x6f\x74\x69\x63\137\x73\145\x74\x74\151\x6e\x67\163"); $paybotic_api_key = $options["\160\141\x79\x62\x6f\x74\x69\x63\x5f\x61\x70\151\x5f\x6b\x65\x79"]; $paybotic_ecommerce_platform_id = $options["\x70\141\x79\142\x6f\164\x69\143\x5f\x65\143\x6f\155\x6d\145\162\143\145\x5f\x70\154\x61\x74\146\x6f\162\x6d\137\151\x64"]; $paybotic_custom_fees = $options["\x70\141\x79\142\157\x74\x69\143\x5f\143\165\163\x74\x6f\x6d\137\x66\x65\x65\163"]; $data = array("\145\143\x6f\x6d\x6d\145\162\143\x65\120\x6c\141\x74\x66\x6f\x72\x6d\111\144" => $paybotic_ecommerce_platform_id, "\164\x79\x70\x65" => $paybotic_custom_fees, "\164\x6f\164\141\x6c\101\155\x6f\165\156\x74" => $total_amount); return $this->execPost($this->check_fees_order_endpoint, $data, $paybotic_api_key); } } } goto j3Lat; vdg7I: add_action("\167\160\x5f\x66\x6f\157\164\x65\x72", "\143\x75\x73\164\x6f\x6d\137\x70\157\160\x75\x70\x5f\x70\141\171\155\145\x6e\x74\137\x68\x74\x6d\x6c"); goto JmfwP; kloP2: ?>

Function Calls

None

Variables

None

Stats

MD5 0476ab0e275a84cea9a5d24522916370
Eval Count 0
Decode Time 173 ms