/** * Get the plugin path * * @since 1.1 * @return string */ public static function plugin_path() { if (self::$plugin_path) { return self::$plugin_path; } return self::$plugin_path = untrailingslashit(plugin_dir_path(__FILE__)); }
/** * Generate the sha1 control signature. <br/> * Used in both the request and the response to validate the authenticity of the message. * * @global object $woocommerce * @param array $params The request or response parameters * @param bool $is_response Are the parameters from the response message * @return string The sha1 generated string **/ private function generate_sha1_signature($params, $is_response = true) { $string = ''; if ($is_response) { $this->format_amount(str_replace(',', '', $params['Amount'])); $string = $this->MerchantKey . $this->MerchantCode . $params['PaymentId'] . $params['RefNo'] . $this->hash_amount / 100 . $params['Currency'] . $params['Status']; } else { $string = $this->MerchantKey . $this->MerchantCode . $params['RefNo'] . $this->hash_amount . $params['Currency']; } //Debug log if ('yes' == $this->debug) { WC_iPay88::add_debug_log('Signature string is: ' . $string); } return base64_encode($this->hex2bin(sha1($string))); }