diff --git a/src/app/invoice/payments/payment-refund/payment-refund.component.pug b/src/app/invoice/payments/payment-refund/payment-refund.component.pug index 75cfa6f..2f0e0e3 100644 --- a/src/app/invoice/payments/payment-refund/payment-refund.component.pug +++ b/src/app/invoice/payments/payment-refund/payment-refund.component.pug @@ -14,7 +14,7 @@ button.btn.btn-default.btn-sm(data-toggle="modal", [attr.data-target]="'#' + pay .form-group label Сумма возврата: input.form-control(formControlName="amount") - span.helpBlock(*ngIf="account") Баланс основного счета: {{account.availableAmount / 100}} + span.helpBlock(*ngIf="account") Баланс основного счета: {{account.availableAmount / 100}} {{account.currency | kofCurrency}} .form-group label Причина совершения операции: textarea.form-control(formControlName="reason", rows="5") diff --git a/src/app/invoice/payments/payment-refund/payment-refund.component.ts b/src/app/invoice/payments/payment-refund/payment-refund.component.ts index 1265db6..f5ba77f 100644 --- a/src/app/invoice/payments/payment-refund/payment-refund.component.ts +++ b/src/app/invoice/payments/payment-refund/payment-refund.component.ts @@ -32,11 +32,11 @@ export class PaymentRefundComponent implements OnInit, OnChanges, AfterViewInit public onRefund: EventEmitter = new EventEmitter(); public form: FormGroup; - + public account: Account; public inProcess: boolean = false; + private modalElement: any; private refundedAmount: number = 0; - private account: Account; private settlementID: number; constructor(private eventPollerService: EventPollerService, diff --git a/src/app/invoice/payments/payment-refunds/payment-refunds.component.ts b/src/app/invoice/payments/payment-refunds/payment-refunds.component.ts index a89ecac..0373b1d 100644 --- a/src/app/invoice/payments/payment-refunds/payment-refunds.component.ts +++ b/src/app/invoice/payments/payment-refunds/payment-refunds.component.ts @@ -36,12 +36,16 @@ export class PaymentRefundsComponent implements OnInit { } public isRefundActionAvailable(): boolean { - if (this.refunds) { - const totalRefunded = this.refunds.reduce((acc, current) => current.status === 'succeeded' ? acc + current.amount : acc, 0); - return totalRefunded < this.payment.amount - 1000; - } else { - return true; + let result: boolean = false; + if (this.payment.status === 'captured') { + if (this.refunds) { + const totalRefunded = this.refunds.reduce((acc, current) => current.status === 'succeeded' ? acc + current.amount : acc, 0); + result = totalRefunded < this.payment.amount - 1000; + } else { + result = true; + } } + return result; } private getRefunds() { diff --git a/src/app/invoice/payments/payment-refunds/payment-refunds.service.ts b/src/app/invoice/payments/payment-refunds/payment-refunds.service.ts deleted file mode 100644 index e69de29..0000000