public static function getRedirectionUrl($params) { // $links = array( // 'url_confirm' => get_permalink( woocommerce_get_page_id('shop')) . '?' . $post_result_array->id, // 'url_cancel' => get_permalink( woocommerce_get_page_id('shop')) . '?' . $post_result_array->id // ); // if(array_keys($params) == 'item'){ // $amount = 0; // foreach ($param['payment']['items'] as $item){ // $amount += $item['qt'] * $item['price']; // } // $payload['payment']['amount'] = $amount; // } // $payload = array_merge((array)$params, (array)$links); $result = MEOWallet_Request::post(MEOWallet_Config::getEnvURl() . '/checkout/', MEOWallet_Config::$apikey, $params); return $result->url_redirect; }
public static function status($id) { return MEOWallet_Request::get(MEOWallet_Config::getEnvURl() . '/operations/' . $id, MEOWallet_Config::$apikey, FALSE)->status; }
function meowallet_response() { global $woocommerce; @ob_clean(); global $woocommerce; $order = new WC_Order($order_id); MEOWallet_Config::$isProduction = $this->environment == 'production' ? TRUE : FALSE; if ($this->environment == 'production') { MEOWallet_Config::$apikey = $this->apikey_live; } else { MEOWallet_Config::$apikey = $this->apikey_sandbox; } $_notification = new MEOWallet_Notify(); if (in_array('NEW', $_notification->payment['status'])) { // header('Location: ' . $url_redirect); header('HTTP/1.1 200 OK'); if ($order->get_order($_notification->order_id) == TRUE) { $_notification = MEOWallet_Trasact::status($_notification->order_id); do_action("wallet-request", $_notification); } } }