Use new deposit mgt module (#276)

This commit is contained in:
Ildar Galeev 2021-07-23 16:19:21 +03:00 committed by GitHub
parent b6c240e9fd
commit de00b166fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 43 additions and 17 deletions

View File

@ -0,0 +1,21 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { KeycloakTokenInfoService } from '@cc/app/shared/services';
import { ThriftConnector } from '../../thrift-connector';
import { RevertParams, RevertState } from '../gen-model/deposit_revert';
import { RevertParams as ThriftRevertParams } from './gen-nodejs/deposit_revert_types';
import * as Management from './gen-nodejs/Management';
@Injectable()
export class DepositManagementService extends ThriftConnector {
constructor(protected keycloakTokenInfoService: KeycloakTokenInfoService) {
super(keycloakTokenInfoService, Management, '/v1/deposit');
}
createRevert(depositID: string, revertParams: RevertParams): Observable<RevertState> {
const thriftRevertParams = new ThriftRevertParams(revertParams);
return this.callThriftServiceMethod('CreateRevert', depositID, thriftRevertParams);
}
}

View File

@ -0,0 +1,8 @@
import { NgModule } from '@angular/core';
import { DepositManagementService } from './deposit-management.service';
@NgModule({
providers: [DepositManagementService],
})
export class DepositModule {}

View File

@ -0,0 +1,2 @@
export * from './deposit.module';
export * from './deposit-management.service';

View File

@ -1 +1,2 @@
export * from './wallet';
export * from './deposit';

View File

@ -43,11 +43,11 @@ export class AppComponent implements OnInit {
{ name: 'Domain config', route: '/domain', activateRoles: [DomainConfigRole.Checkout] },
{ name: 'Payouts', route: '/payouts', activateRoles: [PayoutRole.Read] },
// FR-688
{
name: 'Claims-Deprecated',
route: '/claims-deprecated',
activateRoles: [ClaimManagementRole.GetClaims],
},
// {
// name: 'Claims-Deprecated',
// route: '/claims-deprecated',
// activateRoles: [ClaimManagementRole.GetClaims],
// },
{ name: 'Claims', route: '/claims', activateRoles: [ClaimManagementRole.GetClaims] },
{
name: 'Payment adjustment',

View File

@ -8,6 +8,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { DepositModule } from '@cc/app/api/fistful';
import { UserInfoBasedIdGeneratorModule } from '@cc/app/shared/services/user-info-based-id-generator/user-info-based-id-generator.module';
import { CreateRevertDialogComponent } from './create-revert-dialog.component';
@ -23,6 +24,7 @@ import { CreateRevertDialogComponent } from './create-revert-dialog.component';
MatButtonModule,
MatInputModule,
UserInfoBasedIdGeneratorModule,
DepositModule,
],
declarations: [CreateRevertDialogComponent],
})

View File

@ -1,18 +1,16 @@
import { Injectable } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { progress } from '@rbkmoney/utils';
import { KeycloakService } from 'keycloak-angular';
import { EMPTY, merge, ReplaySubject, Subject } from 'rxjs';
import { catchError } from 'rxjs/internal/operators';
import { map, shareReplay, switchMap, withLatestFrom } from 'rxjs/operators';
import Int64 from 'thrift-ts/lib/int64';
import { DepositManagementService } from '@cc/app/api/fistful';
import { UserInfoBasedIdGeneratorService } from '@cc/app/shared/services';
import { toMinor } from '@cc/utils/to-minor';
import { FistfulStatisticsService } from '../../../../../../thrift-services/fistful/fistful-stat.service';
import { RevertParams } from '../../../../../../thrift-services/fistful/gen-model/deposit_revert';
import { RevertManagementService } from '../../../../../../thrift-services/fistful/revert-management.service';
import { CreateRevertDialogConfig } from '../../types/create-revert-dialog-config';
@Injectable()
@ -26,7 +24,7 @@ export class CreateRevertService {
map(() => this.getParams()),
withLatestFrom(this.depositID$),
switchMap(([params, depositID]) =>
this.managementService.createRevert(depositID, params).pipe(
this.depositManagementService.createRevert(depositID, params).pipe(
catchError((e) => {
// eslint-disable-next-line no-console
console.log(e);
@ -48,11 +46,9 @@ export class CreateRevertService {
form: FormGroup;
constructor(
private managementService: RevertManagementService,
private fistfulStatisticsService: FistfulStatisticsService,
private keycloakService: KeycloakService,
private fb: FormBuilder,
private idGenerator: UserInfoBasedIdGeneratorService
private idGenerator: UserInfoBasedIdGeneratorService,
private depositManagementService: DepositManagementService
) {}
createRevert() {

View File

@ -1,7 +1,5 @@
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { ActivatedRoute } from '@angular/router';
import { filter } from 'rxjs/operators';
import { AppAuthGuardService, DepositRole } from '@cc/app/shared/services';
@ -32,8 +30,6 @@ export class RevertsComponent implements OnInit {
constructor(
private fetchRevertsService: FetchRevertsService,
private route: ActivatedRoute,
private snackBar: MatSnackBar,
private dialog: MatDialog,
private authGuardService: AppAuthGuardService
) {}