mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 22:46:49 +01:00
* Indent all JSON files with two spaces * Upgrade Vue.js * Cheat mode improvements * Show payment details in case of expired invoice * Add logo size recommendation * Show clipboard copy hint cursor * Improve info area and wording * Update BIP21 wording * Invoice details adjustments * Remove form; switch payment methods via AJAX * UI updates * Decrease paddings to gain space * Tighten up padding between logo mark and the store title text * Add drop-shadow to the containers * Wording * Cheating improvements * Improve footer spacing * Cheating improvements * Display addresses * More improvements * Expire invoices * Customize invoice expiry * Footer improvements * Remove theme switch * Remove non-existing sourcemap references * Move inline JS to checkout.js file * Plugin compatibility See Kukks/btcpayserver#8 * Test fix * Upgrade vue-i18next * Extract translations into a separate file * Round QR code borders * Remove "Pay with Bitcoin" title in BIP21 case * Add copy hint to payment details * Cheating: Reduce margins * Adjust dt color * Hide addresses for first iteration * Improve View Details button * Make info section collapsible * Revert original en locale file * Checkout v2 tests * Result view link fixes * Fix BIP21 + lazy payment methods case * More result page link improvements * minor visual improvements * Update clipboard code Remove fallback for old browsers. https://caniuse.com/?search=navigator.clipboard * Transition copy symbol * Update info text color * Invert dark neutral colors Simplifies the dark theme quite a bit. * copy adjustments * updates QR border-radius * Add option to remove logo * More checkout v2 test cases * JS improvements * Remove leftovers * Update test * Fix links * Update tests * Update plugins integration * Remove obsolete url code * Minor view update * Update JS to not use arrow functions * Remove FormId from Checkout Appearance settings * Add English-only hint and feedback link * Checkout Appearance: Make options clearer, remove Custom CSS for v2 * Clipboard copy full URL instead of just address/BOLT11 * Upgrade JS libs, add content checks * Add test for BIP21 setting with zero amount invoice Co-authored-by: dstrukt <gfxdsign@gmail.com>
82 lines
4.3 KiB
Text
82 lines
4.3 KiB
Text
@model PaymentModel
|
|
|
|
<main id="checkout-cheating" class="shadow-lg mt-4" v-cloak>
|
|
<section>
|
|
<p id="CheatSuccessMessage" class="alert alert-success text-break" v-if="successMessage" v-text="successMessage"></p>
|
|
<p id="CheatErrorMessage" class="alert alert-danger text-break" v-if="errorMessage" v-text="errorMessage"></p>
|
|
<form id="test-payment" :action="`/i/${invoiceId}/test-payment`" method="post" v-on:submit.prevent="handleFormSubmit($event, 'paying')" v-if="!isPaid">
|
|
<input name="CryptoCode" type="hidden" value="@Model.CryptoCode">
|
|
<input name="PaymentMethodId" type="hidden" :value="paymentMethodId">
|
|
<label for="FakePayAmount" class="control-label form-label">Fake a @Model.CryptoCode payment for testing</label>
|
|
<div class="d-flex gap-2 mb-2">
|
|
<div class="input-group">
|
|
<input id="FakePayAmount" name="Amount" type="number" step="0.00000001" min="0" class="form-control" placeholder="Amount" v-model="amountRemaining" :disabled="paying || paymentMethodId === 'BTC_LightningLike'"/>
|
|
<div id="test-payment-crypto-code" class="input-group-addon input-group-text">@Model.CryptoCode</div>
|
|
</div>
|
|
<button class="btn btn-secondary flex-shrink-0 px-3 w-100px" type="submit" :disabled="paying" id="FakePay">Pay</button>
|
|
</div>
|
|
</form>
|
|
<form id="mine-block" :action="`/i/${invoiceId}/mine-blocks`" method="post" class="mt-4" v-on:submit.prevent="handleFormSubmit($event, 'mining')" v-if="paymentMethodId === 'BTC'">
|
|
<label for="BlockCount" class="control-label form-label">Mine to test processing and settlement</label>
|
|
<div class="d-flex gap-2">
|
|
<div class="input-group">
|
|
<input id="BlockCount" name="BlockCount" type="number" step="1" min="1" class="form-control" value="1"/>
|
|
<div class="input-group-addon input-group-text">blocks</div>
|
|
</div>
|
|
<button class="btn btn-secondary flex-shrink-0 px-3 w-100px" type="submit" :disabled="mining" id="Mine">Mine</button>
|
|
</div>
|
|
</form>
|
|
<form id="expire-invoice" :action="`/i/${invoiceId}/expire`" method="post" class="mt-4" v-on:submit.prevent="handleFormSubmit($event, 'expiring')" v-if="!isPaid">
|
|
<label for="ExpirySeconds" class="control-label form-label">Expire invoice in …</label>
|
|
<div class="d-flex gap-2">
|
|
<div class="input-group">
|
|
<input id="ExpirySeconds" name="Seconds" type="number" step="1" min="0" class="form-control" value="20" />
|
|
<div class="input-group-addon input-group-text">seconds</div>
|
|
</div>
|
|
<button class="btn btn-secondary flex-shrink-0 px-3 w-100px" type="submit" :disabled="expiring" id="Expire">Expire</button>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
</main>
|
|
|
|
<script>
|
|
Vue.component('checkout-cheating', {
|
|
el: '#checkout-cheating',
|
|
data () {
|
|
return {
|
|
successMessage: null,
|
|
errorMessage: null,
|
|
paying: false,
|
|
mining: false,
|
|
expiring: false,
|
|
amountRemaining: parseFloat(this.btcDue)
|
|
}
|
|
},
|
|
props: {
|
|
invoiceId: String,
|
|
paymentMethodId: String,
|
|
btcDue: Number,
|
|
isPaid: Boolean
|
|
},
|
|
methods: {
|
|
async handleFormSubmit (e, processing) {
|
|
const form = e.target;
|
|
const url = form.getAttribute('action');
|
|
const method = form.getAttribute('method');
|
|
const body = new FormData(form);
|
|
const headers = { 'Accept': 'application/json' }
|
|
|
|
this[processing] = true;
|
|
this.successMessage = null;
|
|
this.errorMessage = null;
|
|
|
|
const response = await fetch(url, { method, body, headers });
|
|
const data = await response.json();
|
|
this.successMessage = data.successMessage;
|
|
this.errorMessage = data.errorMessage;
|
|
if (data.amountRemaining) this.amountRemaining = data.amountRemaining;
|
|
this[processing] = false;
|
|
}
|
|
}
|
|
})
|
|
</script>
|