IMP-230: Init tariffs api (#358)

This commit is contained in:
Rinat Arsaev 2024-05-13 20:33:18 +05:00 committed by GitHub
parent ba159b62df
commit 4e3e09e257
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 67 additions and 2 deletions

6
package-lock.json generated
View File

@ -22,6 +22,7 @@
"@ngneat/input-mask": "6.0.0",
"@vality/deanonimus-proto": "2.0.1-2a02d87.0",
"@vality/domain-proto": "2.0.1-b04aba8.0",
"@vality/dominator-proto": "1.0.0",
"@vality/fistful-proto": "2.0.1-6600be9.0",
"@vality/machinegun-proto": "1.0.0",
"@vality/magista-proto": "2.0.2-28d11b9.0",
@ -6421,6 +6422,11 @@
"resolved": "https://registry.npmjs.org/@vality/domain-proto/-/domain-proto-2.0.1-b04aba8.0.tgz",
"integrity": "sha512-AKD5RkqiS+31hTUaLfh7I3vgYZ2yytwxp8J1jQZ7iPWURz/m5+6Yg4YKNj8Vyyxu3yzO13FxxPUnkTh/poCDWg=="
},
"node_modules/@vality/dominator-proto": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@vality/dominator-proto/-/dominator-proto-1.0.0.tgz",
"integrity": "sha512-N7gTGnr419mwnZH3FB4kTIJUgbFoVzKUHKNIyzjjJuPiSnOEaWr/sj8cFfDdyuHUkpHb4CKXJ+QdF686UtGKGw=="
},
"node_modules/@vality/eslint-config": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/@vality/eslint-config/-/eslint-config-8.2.0.tgz",

View File

@ -30,6 +30,7 @@
"@ngneat/input-mask": "6.0.0",
"@vality/deanonimus-proto": "2.0.1-2a02d87.0",
"@vality/domain-proto": "2.0.1-b04aba8.0",
"@vality/dominator-proto": "1.0.0",
"@vality/fistful-proto": "2.0.1-6600be9.0",
"@vality/machinegun-proto": "1.0.0",
"@vality/magista-proto": "2.0.2-28d11b9.0",

View File

@ -0,0 +1,57 @@
import { Injectable } from '@angular/core';
import {
dominator_DominatorServiceCodegenClient,
ThriftAstMetadata,
dominator_DominatorService,
dominator,
} from '@vality/dominator-proto';
import { combineLatest, from, map, Observable, switchMap } from 'rxjs';
import { KeycloakTokenInfoService, toWachterHeaders } from '@cc/app/shared/services';
import { environment } from '@cc/environments/environment';
import { ConfigService } from '../../core/config.service';
@Injectable({ providedIn: 'root' })
export class DominatorService {
private client$: Observable<dominator_DominatorServiceCodegenClient>;
constructor(
private keycloakTokenInfoService: KeycloakTokenInfoService,
configService: ConfigService,
) {
const headers$ = this.keycloakTokenInfoService.info$.pipe(
map(toWachterHeaders('Dominator')),
);
const metadata$ = from(
import('@vality/fistful-proto/metadata.json').then(
(m) => m.default as ThriftAstMetadata[],
),
);
this.client$ = combineLatest([metadata$, headers$]).pipe(
switchMap(([metadata, headers]) =>
dominator_DominatorService({
metadata,
headers,
logging: environment.logging.requests,
...configService.config.api.wachter,
}),
),
);
}
// eslint-disable-next-line @typescript-eslint/naming-convention
SearchShopTermSets(shopSearchQuery: dominator.ShopSearchQuery) {
return this.client$.pipe(switchMap((c) => c.SearchShopTermSets(shopSearchQuery)));
}
// eslint-disable-next-line @typescript-eslint/naming-convention
SearchWalletTermSets(walletSearchQuery: dominator.WalletSearchQuery) {
return this.client$.pipe(switchMap((c) => c.SearchWalletTermSets(walletSearchQuery)));
}
// eslint-disable-next-line @typescript-eslint/naming-convention
SearchTerminalTermSets(terminalSearchQuery: dominator.TerminalSearchQuery) {
return this.client$.pipe(switchMap((c) => c.SearchTerminalTermSets(terminalSearchQuery)));
}
}

View File

@ -0,0 +1 @@
export * from './dominator.service';

View File

@ -36,7 +36,7 @@
>
<ng-container
*ngSwitchCase="'party_modification'"
[ngSwitch]="modificationUnit.modification | ccUnionValue | ngtUnionKey"
[ngSwitch]="modificationUnit.modification | ngtUnionValue | ngtUnionKey"
>
<cc-shop-modification-timeline-item
*ngSwitchCase="'shop_modification'"
@ -55,7 +55,7 @@
</ng-container>
<ng-container
*ngSwitchCase="'claim_modification'"
[ngSwitch]="modificationUnit.modification | ccUnionValue | ngtUnionKey"
[ngSwitch]="modificationUnit.modification | ngtUnionValue | ngtUnionKey"
>
<cc-status-modification-timeline-item
*ngSwitchCase="'status_modification'"