Don't allow invoices lower than 0.001 and require 0.01 for sponsorship.
refs #122
This commit is contained in:
parent
0cbc7e2ab6
commit
1f7483687f
@ -48,23 +48,30 @@ class Donations {
|
|||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await this.getStatus(data.id);
|
const response = await this.getStatus(data.id);
|
||||||
if (response.status === 'complete') {
|
if (response.status !== 'complete') {
|
||||||
if (this.notifyDonationStatusCallback) {
|
return;
|
||||||
this.notifyDonationStatusCallback(data.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
let imageUrl = '';
|
|
||||||
if (response.orderId !== '') {
|
|
||||||
try {
|
|
||||||
imageUrl = await this.$getTwitterImageUrl(response.orderId);
|
|
||||||
} catch (e) {
|
|
||||||
console.log('Error fetching twitter image from Hive', e.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$addDonationToDatabase(response, imageUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.notifyDonationStatusCallback) {
|
||||||
|
this.notifyDonationStatusCallback(data.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parseFloat(response.btcPaid) < 0.001) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let imageUrl = '';
|
||||||
|
if (response.orderId !== '') {
|
||||||
|
try {
|
||||||
|
imageUrl = await this.$getTwitterImageUrl(response.orderId);
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Error fetching twitter image', e.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$addDonationToDatabase(response, imageUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getStatus(id: string): Promise<any> {
|
private getStatus(id: string): Promise<any> {
|
||||||
|
@ -117,8 +117,8 @@ class Routes {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.amount < 0.01) {
|
if (p.amount < 0.001) {
|
||||||
res.status(400).send('Amount needs to be at least 0.01');
|
res.status(400).send('Amount needs to be at least 0.001');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
<div class="input-group-prepend" style="width: 42px;">
|
<div class="input-group-prepend" style="width: 42px;">
|
||||||
<span class="input-group-text">₿</span>
|
<span class="input-group-text">₿</span>
|
||||||
</div>
|
</div>
|
||||||
<input formControlName="amount" class="form-control" type="number" min="0.01" step="1E-03">
|
<input formControlName="amount" class="form-control" type="number" min="0.001" step="1E-03">
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group mb-4">
|
<div class="input-group mb-4" *ngIf="donationForm.get('amount').value >= 0.01; else lowAmount">
|
||||||
<div class="input-group-prepend" style="width: 42px;">
|
<div class="input-group-prepend" style="width: 42px;">
|
||||||
<span class="input-group-text">@</span>
|
<span class="input-group-text">@</span>
|
||||||
</div>
|
</div>
|
||||||
@ -41,12 +41,20 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ng-template #lowAmount>
|
||||||
|
<div class="input-group mb-4 text-small">
|
||||||
|
If you donate 0.01 BTC or more, your profile photo will be added to the list of sponsors above :)
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
<div *ngIf="donationStatus === 3" class="text-center">
|
<div *ngIf="donationStatus === 3" class="text-center">
|
||||||
<div class="qr-wrapper mt-4 mb-2">
|
<div class="qr-wrapper mt-2 mb-2">
|
||||||
<app-qrcode [data]="donationObj.address + '?amount=' + donationObj.amount"></app-qrcode>
|
<app-qrcode [data]="donationObj.address + '?amount=' + donationObj.amount"></app-qrcode>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<p style="font-size: 10px;">{{ donationObj.address }}</p>
|
<p style="font-size: 10px;">{{ donationObj.address }}</p>
|
||||||
|
<p style="font-size: 12px;">{{ donationObj.amount }} BTC</p>
|
||||||
|
|
||||||
<p>Waiting for transaction... </p>
|
<p>Waiting for transaction... </p>
|
||||||
<div class="spinner-border text-light"></div>
|
<div class="spinner-border text-light"></div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user