Rewrite plugin to v3.0

This commit is contained in:
mosu forge 2018-09-22 07:57:35 -07:00
parent 4c091a13f7
commit 4def1b771e
37 changed files with 4613 additions and 1685 deletions

View file

@ -0,0 +1 @@
<?php echo $error; ?>

View file

@ -0,0 +1,82 @@
<table class="striped" style="width:100%" cellspacing="0" cellpadding="5">
<tr>
<td>Exchange rate</td>
<td>1 XMR = <?php echo $details['rate_formatted'].' '.$details['currency']; ?></td>
</tr>
<tr>
<td>Total amount</td>
<td><?php echo $details['amount_total_formatted']; ?> XMR</td>
</tr>
<tr>
<td>Total paid</td>
<td><?php echo $details['amount_paid_formatted']; ?> XMR</td>
</tr>
<tr>
<td>Total due</td>
<td><?php echo $details['amount_due_formatted']; ?> XMR</td>
</tr>
<tr>
<td>Order age</td>
<td><?php echo Monero_Gateway::format_seconds_to_time($details['order_age']) ?> ago</td>
</tr>
<tr>
<td>Order exipires</td>
<td>
<?php echo $details['order_expires'] ?>
</td>
</tr>
<tr>
<td>Status</td>
<td>
<?php
switch($details['status']) {
case 'confirmed':
echo '<span style="color:#006400">Confirmed</span>';
break;
case 'paid':
echo '<span style="color:#006400">Paid, waiting confirmation</span>';
break;
case 'partial':
echo '<span style="color:#ffae42">Partial payment made</span>';
break;
case 'unpaid':
echo '<span style="color:#ffae42">Pending payment</span>';
break;
case 'expired_partial':
echo '<span style="color:#dc143c">Expired, partial payment made</span>';
break;
case 'expired':
echo '<span style="color:#dc143c">Expired</span>';
break;
}
?>
</td>
</tr>
<tr>
<td>Payment id</td>
<td><?php echo $details['payment_id'] ?></td>
</tr>
<tr>
<td>Integrated address</td>
<td style="word-break: break-all;"><?php echo $details['integrated_address'] ?></td>
</tr>
</table>
<?php if(count($details['txs'])): ?>
<table class="striped" style="width:100%" cellspacing="0" cellpadding="5">
<tr>
<td>Transactions</td>
<td>Height</td>
<td>Amount</td>
</tr>
<?php foreach($details['txs'] as $tx): ?>
<tr>
<td>
<a href="<?php echo MONERO_GATEWAY_EXPLORER_URL.'/tx/'.$tx['txid']; ?>" target="_blank"><?php echo $tx['txid']; ?></a>
</td>
<td><?php echo $tx['height']; ?></td>
<td><?php echo sprintf(MONERO_GATEWAY_ATOMIC_UNITS_SPRINTF, $tx['amount'] / MONERO_GATEWAY_ATOMIC_UNITS_POW); ?> XMR</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>

View file

@ -0,0 +1,54 @@
<?php foreach($errors as $error): ?>
<div class="error"><p><strong>Monero Gateway Error</strong>: <?php echo $error; ?></p></div>
<?php endforeach; ?>
<h1>Monero Gateway Settings</h1>
<?php if($confirm_type === 'monero-wallet-rpc'): ?>
<div style="border:1px solid #ddd;padding:5px 10px;">
<?php
echo 'Wallet height: ' . $balance['height'] . '</br>';
echo 'Your balance is: ' . $balance['balance'] . '</br>';
echo 'Unlocked balance: ' . $balance['unlocked_balance'] . '</br>';
?>
</div>
<?php endif; ?>
<table class="form-table">
<?php echo $settings_html ?>
</table>
<h4><a href="https://github.com/monero-integrations/monerowp">Learn more about using the Monero payment gateway</a></h4>
<script>
function moneroUpdateFields() {
var confirmType = jQuery("#woocommerce_monero_gateway_confirm_type").val();
if(confirmType == "monero-wallet-rpc") {
jQuery("#woocommerce_monero_gateway_monero_address").closest("tr").hide();
jQuery("#woocommerce_monero_gateway_viewkey").closest("tr").hide();
jQuery("#woocommerce_monero_gateway_daemon_host").closest("tr").show();
jQuery("#woocommerce_monero_gateway_daemon_port").closest("tr").show();
} else {
jQuery("#woocommerce_monero_gateway_monero_address").closest("tr").show();
jQuery("#woocommerce_monero_gateway_viewkey").closest("tr").show();
jQuery("#woocommerce_monero_gateway_daemon_host").closest("tr").hide();
jQuery("#woocommerce_monero_gateway_daemon_port").closest("tr").hide();
}
var useMoneroPrices = jQuery("#woocommerce_monero_gateway_use_monero_price").is(":checked");
if(useMoneroPrices) {
jQuery("#woocommerce_monero_gateway_use_monero_price_decimals").closest("tr").show();
} else {
jQuery("#woocommerce_monero_gateway_use_monero_price_decimals").closest("tr").hide();
}
}
moneroUpdateFields();
jQuery("#woocommerce_monero_gateway_confirm_type").change(moneroUpdateFields);
jQuery("#woocommerce_monero_gateway_use_monero_price").change(moneroUpdateFields);
</script>
<style>
#woocommerce_monero_gateway_monero_address,
#woocommerce_monero_gateway_viewkey {
width: 100%;
}
</style>