FR-754: Add payment institution account (#284)

This commit is contained in:
Rinat Arsaev 2021-09-20 14:07:36 +03:00 committed by GitHub
parent 14fe9434f6
commit 219c164e80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 7 deletions

View File

@ -41,7 +41,7 @@ FR-0,FR-1: <ОБЩЕЕ НАЗВАНИЕ> или <НАЗВАНИЕ 1>; <НАЗВ
### 🔗 Страницы с изменениями либо как их воспроизвести
- http://localhost:8000/
- http://localhost:7000/
### 🖼 Скриншоты

View File

@ -8,6 +8,7 @@ enum Type {
RussianBankAccount = 'russian_bank_account',
InternationalBankAccount = 'international_bank_account',
WalletInfo = 'wallet_info',
PaymentInstitutionAccount = 'payment_institution_account',
}
@Component({
@ -23,16 +24,26 @@ export class PayoutToolInfoComponent implements OnInit {
selected: Type;
types = [Type.RussianBankAccount, Type.InternationalBankAccount, Type.WalletInfo];
types = [
Type.RussianBankAccount,
Type.InternationalBankAccount,
Type.WalletInfo,
Type.PaymentInstitutionAccount,
];
t = Type;
constructor(private fb: FormBuilder) {}
ngOnInit() {
ngOnInit(): void {
const russianBankAccount = get(this, 'initialValue.russian_bank_account', null);
const internationalBankAccount = get(this, 'initialValue.international_bank_account', null);
const walletInfo = get(this, 'initialValue.wallet_info', null);
const paymentInstitutionAccount = get(
this,
`initialValue.${Type.PaymentInstitutionAccount}`,
null
);
if (russianBankAccount) {
this.selected = Type.RussianBankAccount;
}
@ -42,26 +53,31 @@ export class PayoutToolInfoComponent implements OnInit {
if (walletInfo) {
this.selected = Type.WalletInfo;
}
if (paymentInstitutionAccount) {
this.selected = Type.PaymentInstitutionAccount;
}
this.select();
this.form.updateValueAndValidity();
}
select() {
select(): void {
this.clearControl();
switch (this.selected) {
case Type.RussianBankAccount:
this.clearControl();
this.form.registerControl(Type.RussianBankAccount, this.fb.group({}));
break;
case Type.InternationalBankAccount:
this.clearControl();
this.form.registerControl(Type.InternationalBankAccount, this.fb.group({}));
break;
case Type.WalletInfo: {
this.clearControl();
const walletInfo = get(this, 'initialValue.wallet_info', {});
this.form.registerControl(Type.WalletInfo, this.fb.group(walletInfo));
break;
}
case Type.PaymentInstitutionAccount:
this.form.registerControl(Type.PaymentInstitutionAccount, this.fb.control({}));
this.form.patchValue({});
break;
}
}