Browse Source

Added phpqrcode lib

main
fekt 2 years ago
parent
commit
5e970982e8
  1. 21
      hush-woocommerce-gateway.php
  2. 3312
      phpqrcode.php

21
hush-woocommerce-gateway.php

@ -24,6 +24,10 @@
defined( 'ABSPATH' ) or exit;
// Include phpqrcode lib
include_once('phpqrcode.php');
// Make sure WooCommerce is active
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
return;
@ -234,18 +238,27 @@ function hush_gateway_init() {
// Generate HUSH URI
$hushURI = "hush:".$hushAddress."?amt=".$hushAmt;
// Generate QR Code
$timestamp = $_SERVER['REQUEST_TIME'];
$upload_dir = wp_upload_dir();
$upload_dir = $upload_dir['basedir'] . '/' . "hush/";
if(!file_exists($upload_dir)) wp_mkdir_p($upload_dir);
QRcode::png($hushAddress, $upload_dir.'qr_code-'.$timestamp.'.png', QR_ECLEVEL_L, 8);
// Display instructions for customer to send payment to
$htmlOutput .= "<h2>HUSH Payment Instructions</h2>";
$htmlOutput .= $this->checkoutInstructions."<br/><br/>";
$htmlOutput .= "<strong>Address to send HUSH to: </strong><input type='text' value='".$hushAddress."' id='hushAddress' style='width:100%'/><br/><br/>";
$htmlOutput .= "<strong>Amount to send: </strong>(Exchange Rate is </strong>".$hushPrice." USD + ". $this->volatilityMarkup * 100 ."% volatility markup)<br/><input type='text' value='".$hushAmt."' id='hushAmt' style='width:100%'/><br/><br/>";
$htmlOutput .= "<strong>Memo</strong> is not required, but you may include with any message, notes, or special instructions<br/><br/><br/>";
$htmlOutput .= "<strong>Memo</strong> is not required, but you may include with any message, notes, or special instructions<br/><br/>";
$htmlOutput .= "An auto-generated HUSH URI may be used instead for easier/quicker payment. In lite or full wallet, go to <strong>File > Pay HUSH URI</strong> and copy paste the URI below. Do not modify this URI. Orders will only be fulfilled if expected amount of HUSH is received.<br/><br/>";
$htmlOutput .= "<strong>Pay HUSH URI: </strong><input type='text' value='".$hushURI."' id='hushURI' style='width:100%'/><br/><br/><br/>";
$htmlOutput .= "<strong>Pay HUSH URI: </strong><input type='text' value='".$hushURI."' id='hushURI' style='width:100%'/><br/><br/>";
$htmlOutput .= "<strong>Silent Dragon Android QR Code: </strong><br/><img src='/wp-content/uploads/hush/qr_code-".$timestamp.".png' /><br/><br/>";
echo $htmlOutput;
}
/**
* Process the payment and return the result

3312
phpqrcode.php

File diff suppressed because it is too large
Loading…
Cancel
Save