mirror of
https://github.com/valitydev/control-center.git
synced 2024-11-06 02:25:17 +00:00
Use new deposit mgt module (#276)
This commit is contained in:
parent
b6c240e9fd
commit
de00b166fd
21
src/app/api/fistful/deposit/deposit-management.service.ts
Normal file
21
src/app/api/fistful/deposit/deposit-management.service.ts
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
8
src/app/api/fistful/deposit/deposit.module.ts
Normal file
8
src/app/api/fistful/deposit/deposit.module.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { DepositManagementService } from './deposit-management.service';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
providers: [DepositManagementService],
|
||||||
|
})
|
||||||
|
export class DepositModule {}
|
2
src/app/api/fistful/deposit/index.ts
Normal file
2
src/app/api/fistful/deposit/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './deposit.module';
|
||||||
|
export * from './deposit-management.service';
|
@ -1 +1,2 @@
|
|||||||
export * from './wallet';
|
export * from './wallet';
|
||||||
|
export * from './deposit';
|
||||||
|
@ -43,11 +43,11 @@ export class AppComponent implements OnInit {
|
|||||||
{ name: 'Domain config', route: '/domain', activateRoles: [DomainConfigRole.Checkout] },
|
{ name: 'Domain config', route: '/domain', activateRoles: [DomainConfigRole.Checkout] },
|
||||||
{ name: 'Payouts', route: '/payouts', activateRoles: [PayoutRole.Read] },
|
{ name: 'Payouts', route: '/payouts', activateRoles: [PayoutRole.Read] },
|
||||||
// FR-688
|
// FR-688
|
||||||
{
|
// {
|
||||||
name: 'Claims-Deprecated',
|
// name: 'Claims-Deprecated',
|
||||||
route: '/claims-deprecated',
|
// route: '/claims-deprecated',
|
||||||
activateRoles: [ClaimManagementRole.GetClaims],
|
// activateRoles: [ClaimManagementRole.GetClaims],
|
||||||
},
|
// },
|
||||||
{ name: 'Claims', route: '/claims', activateRoles: [ClaimManagementRole.GetClaims] },
|
{ name: 'Claims', route: '/claims', activateRoles: [ClaimManagementRole.GetClaims] },
|
||||||
{
|
{
|
||||||
name: 'Payment adjustment',
|
name: 'Payment adjustment',
|
||||||
|
@ -8,6 +8,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
|||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
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 { UserInfoBasedIdGeneratorModule } from '@cc/app/shared/services/user-info-based-id-generator/user-info-based-id-generator.module';
|
||||||
|
|
||||||
import { CreateRevertDialogComponent } from './create-revert-dialog.component';
|
import { CreateRevertDialogComponent } from './create-revert-dialog.component';
|
||||||
@ -23,6 +24,7 @@ import { CreateRevertDialogComponent } from './create-revert-dialog.component';
|
|||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
UserInfoBasedIdGeneratorModule,
|
UserInfoBasedIdGeneratorModule,
|
||||||
|
DepositModule,
|
||||||
],
|
],
|
||||||
declarations: [CreateRevertDialogComponent],
|
declarations: [CreateRevertDialogComponent],
|
||||||
})
|
})
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import { progress } from '@rbkmoney/utils';
|
import { progress } from '@rbkmoney/utils';
|
||||||
import { KeycloakService } from 'keycloak-angular';
|
|
||||||
import { EMPTY, merge, ReplaySubject, Subject } from 'rxjs';
|
import { EMPTY, merge, ReplaySubject, Subject } from 'rxjs';
|
||||||
import { catchError } from 'rxjs/internal/operators';
|
import { catchError } from 'rxjs/internal/operators';
|
||||||
import { map, shareReplay, switchMap, withLatestFrom } from 'rxjs/operators';
|
import { map, shareReplay, switchMap, withLatestFrom } from 'rxjs/operators';
|
||||||
import Int64 from 'thrift-ts/lib/int64';
|
import Int64 from 'thrift-ts/lib/int64';
|
||||||
|
|
||||||
|
import { DepositManagementService } from '@cc/app/api/fistful';
|
||||||
import { UserInfoBasedIdGeneratorService } from '@cc/app/shared/services';
|
import { UserInfoBasedIdGeneratorService } from '@cc/app/shared/services';
|
||||||
import { toMinor } from '@cc/utils/to-minor';
|
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 { 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';
|
import { CreateRevertDialogConfig } from '../../types/create-revert-dialog-config';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -26,7 +24,7 @@ export class CreateRevertService {
|
|||||||
map(() => this.getParams()),
|
map(() => this.getParams()),
|
||||||
withLatestFrom(this.depositID$),
|
withLatestFrom(this.depositID$),
|
||||||
switchMap(([params, depositID]) =>
|
switchMap(([params, depositID]) =>
|
||||||
this.managementService.createRevert(depositID, params).pipe(
|
this.depositManagementService.createRevert(depositID, params).pipe(
|
||||||
catchError((e) => {
|
catchError((e) => {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(e);
|
console.log(e);
|
||||||
@ -48,11 +46,9 @@ export class CreateRevertService {
|
|||||||
form: FormGroup;
|
form: FormGroup;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private managementService: RevertManagementService,
|
|
||||||
private fistfulStatisticsService: FistfulStatisticsService,
|
|
||||||
private keycloakService: KeycloakService,
|
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private idGenerator: UserInfoBasedIdGeneratorService
|
private idGenerator: UserInfoBasedIdGeneratorService,
|
||||||
|
private depositManagementService: DepositManagementService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
createRevert() {
|
createRevert() {
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
||||||
import { ActivatedRoute } from '@angular/router';
|
|
||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
|
|
||||||
import { AppAuthGuardService, DepositRole } from '@cc/app/shared/services';
|
import { AppAuthGuardService, DepositRole } from '@cc/app/shared/services';
|
||||||
@ -32,8 +30,6 @@ export class RevertsComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private fetchRevertsService: FetchRevertsService,
|
private fetchRevertsService: FetchRevertsService,
|
||||||
private route: ActivatedRoute,
|
|
||||||
private snackBar: MatSnackBar,
|
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
private authGuardService: AppAuthGuardService
|
private authGuardService: AppAuthGuardService
|
||||||
) {}
|
) {}
|
||||||
|
Loading…
Reference in New Issue
Block a user