mirror of
https://github.com/valitydev/koffing.git
synced 2024-11-06 09:15:20 +00:00
FE-578: refund btn (#196)
This commit is contained in:
parent
fa4f5a9efe
commit
c968e73a99
@ -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")
|
||||
|
@ -32,11 +32,11 @@ export class PaymentRefundComponent implements OnInit, OnChanges, AfterViewInit
|
||||
public onRefund: EventEmitter<void> = 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,
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user