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
|
.form-group
|
||||||
label Сумма возврата:
|
label Сумма возврата:
|
||||||
input.form-control(formControlName="amount")
|
input.form-control(formControlName="amount")
|
||||||
span.helpBlock(*ngIf="account") Баланс основного счета: {{account.availableAmount / 100}}
|
span.helpBlock(*ngIf="account") Баланс основного счета: {{account.availableAmount / 100}} {{account.currency | kofCurrency}}
|
||||||
.form-group
|
.form-group
|
||||||
label Причина совершения операции:
|
label Причина совершения операции:
|
||||||
textarea.form-control(formControlName="reason", rows="5")
|
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 onRefund: EventEmitter<void> = new EventEmitter();
|
||||||
|
|
||||||
public form: FormGroup;
|
public form: FormGroup;
|
||||||
|
public account: Account;
|
||||||
public inProcess: boolean = false;
|
public inProcess: boolean = false;
|
||||||
|
|
||||||
private modalElement: any;
|
private modalElement: any;
|
||||||
private refundedAmount: number = 0;
|
private refundedAmount: number = 0;
|
||||||
private account: Account;
|
|
||||||
private settlementID: number;
|
private settlementID: number;
|
||||||
|
|
||||||
constructor(private eventPollerService: EventPollerService,
|
constructor(private eventPollerService: EventPollerService,
|
||||||
|
@ -36,12 +36,16 @@ export class PaymentRefundsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public isRefundActionAvailable(): boolean {
|
public isRefundActionAvailable(): boolean {
|
||||||
if (this.refunds) {
|
let result: boolean = false;
|
||||||
const totalRefunded = this.refunds.reduce((acc, current) => current.status === 'succeeded' ? acc + current.amount : acc, 0);
|
if (this.payment.status === 'captured') {
|
||||||
return totalRefunded < this.payment.amount - 1000;
|
if (this.refunds) {
|
||||||
} else {
|
const totalRefunded = this.refunds.reduce((acc, current) => current.status === 'succeeded' ? acc + current.amount : acc, 0);
|
||||||
return true;
|
result = totalRefunded < this.payment.amount - 1000;
|
||||||
|
} else {
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getRefunds() {
|
private getRefunds() {
|
||||||
|
Loading…
Reference in New Issue
Block a user