|
|
@@ -80,18 +80,21 @@ export class RefundOrderDialogComponent
|
|
|
.filter(refundLine => refundLine.orderLineId === line.id)
|
|
|
.reduce((sum, refundLine) => sum + refundLine.quantity, 0) ?? 0;
|
|
|
|
|
|
- return refundedCount < line.quantity;
|
|
|
+ return refundedCount < line.orderPlacedQuantity;
|
|
|
}
|
|
|
|
|
|
ngOnInit() {
|
|
|
- this.lineQuantities = this.order.lines.reduce((result, line) => ({
|
|
|
+ this.lineQuantities = this.order.lines.reduce(
|
|
|
+ (result, line) => ({
|
|
|
...result,
|
|
|
[line.id]: {
|
|
|
quantity: 0,
|
|
|
refund: false,
|
|
|
cancel: false,
|
|
|
},
|
|
|
- }), {});
|
|
|
+ }),
|
|
|
+ {},
|
|
|
+ );
|
|
|
this.settledPayments = (this.order.payments || []).filter(p => p.state === 'Settled');
|
|
|
if (this.settledPayments.length) {
|
|
|
this.selectedPayment = this.settledPayments[0];
|
|
|
@@ -106,12 +109,18 @@ export class RefundOrderDialogComponent
|
|
|
}
|
|
|
|
|
|
isRefunding(): boolean {
|
|
|
- const result = Object.values(this.lineQuantities).reduce((isRefunding, line) => isRefunding || (0 < line.quantity && line.refund), false);
|
|
|
+ const result = Object.values(this.lineQuantities).reduce(
|
|
|
+ (isRefunding, line) => isRefunding || (0 < line.quantity && line.refund),
|
|
|
+ false,
|
|
|
+ );
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
isCancelling(): boolean {
|
|
|
- const result = Object.values(this.lineQuantities).reduce((isCancelling, line) => isCancelling || (0 < line.quantity && line.cancel), false);
|
|
|
+ const result = Object.values(this.lineQuantities).reduce(
|
|
|
+ (isCancelling, line) => isCancelling || (0 < line.quantity && line.cancel),
|
|
|
+ false,
|
|
|
+ );
|
|
|
return result;
|
|
|
}
|
|
|
|