ref #193
This commit is contained in:
@@ -42,10 +42,10 @@ export class ResponseDonation implements IResponse {
|
||||
amount: number;
|
||||
|
||||
/**
|
||||
* The donation's payed amount in the smalles unit of your currency (default: euro cent).
|
||||
* The donation's paid amount in the smalles unit of your currency (default: euro cent).
|
||||
*/
|
||||
@IsInt()
|
||||
payedAmount: number;
|
||||
paidAmount: number;
|
||||
|
||||
/**
|
||||
* Creates a ResponseDonation object from a scan.
|
||||
@@ -55,12 +55,12 @@ export class ResponseDonation implements IResponse {
|
||||
this.id = donation.id;
|
||||
this.donor = donation.donor.toResponse();
|
||||
this.amount = donation.amount;
|
||||
this.payedAmount = donation.payedAmount || 0;
|
||||
if (this.payedAmount < this.amount) {
|
||||
this.paidAmount = donation.paidAmount || 0;
|
||||
if (this.paidAmount < this.amount) {
|
||||
this.status = DonationStatus.OPEN;
|
||||
}
|
||||
else {
|
||||
this.status = DonationStatus.PAYED;
|
||||
this.status = DonationStatus.PAID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,10 @@ export class ResponseDonor extends ResponseParticipant implements IResponse {
|
||||
donationAmount: number;
|
||||
|
||||
/**
|
||||
* Returns the total payed donations of a donor based on his linked donations.
|
||||
* Returns the total paid donations of a donor based on his linked donations.
|
||||
*/
|
||||
@IsInt()
|
||||
payedDonationAmount: number;
|
||||
paidDonationAmount: number;
|
||||
|
||||
/**
|
||||
* Creates a ResponseRunner object from a runner.
|
||||
@@ -42,5 +42,6 @@ export class ResponseDonor extends ResponseParticipant implements IResponse {
|
||||
super(donor);
|
||||
this.receiptNeeded = donor.receiptNeeded;
|
||||
this.donationAmount = donor.donationAmount;
|
||||
this.paidDonationAmount = donor.paidDonationAmount;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user