diff --git a/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.component.ts b/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.component.ts
index ded0d956..c482e6c6 100644
--- a/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.component.ts
+++ b/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.component.ts
@@ -2,8 +2,9 @@ import { Component, DestroyRef } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { FormBuilder } from '@angular/forms';
import { Shop } from '@vality/domain-proto/domain';
+import { ShopID, WalletID } from '@vality/domain-proto/internal/domain';
import { StatWallet } from '@vality/fistful-proto/fistful_stat';
-import { DialogResponseStatus, DialogSuperclass, NotifyLogService } from '@vality/ng-core';
+import { DialogResponseStatus, DialogSuperclass, NotifyLogService, Option } from '@vality/ng-core';
import { RoutingRulesService } from '../../services/routing-rules';
import { RoutingRulesType } from '../../types/routing-rules-type';
@@ -16,12 +17,24 @@ export class AddPartyRoutingRuleDialogComponent extends DialogSuperclass<
{ refID: number; partyID: string; shops: Shop[]; wallets: StatWallet[]; type: RoutingRulesType }
> {
form = this.fb.group<{ shopID: string; walletID: string; name: string; description: string }>({
- shopID: '',
- walletID: '',
+ shopID: null,
+ walletID: null,
name: 'Ruleset[candidates]',
description: '',
});
+ shopsOptions: Option
[] = this.dialogData.shops.map((s) => ({
+ value: s.id,
+ label: s.details.name,
+ description: s.id,
+ }));
+
+ walletsOptions: Option[] = this.dialogData.wallets.map((s) => ({
+ value: s.id,
+ label: s.name,
+ description: s.id,
+ }));
+
constructor(
private fb: FormBuilder,
private routingRulesService: RoutingRulesService,
diff --git a/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.module.ts b/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.module.ts
index 778ed6b3..89824e65 100644
--- a/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.module.ts
+++ b/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.module.ts
@@ -10,7 +10,7 @@ import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
-import { DialogModule } from '@vality/ng-core';
+import { DialogModule, SelectFieldModule } from '@vality/ng-core';
import { AddPartyRoutingRuleDialogComponent } from './add-party-routing-rule-dialog.component';
@@ -28,6 +28,7 @@ import { AddPartyRoutingRuleDialogComponent } from './add-party-routing-rule-dia
MatRadioModule,
MatAutocompleteModule,
DialogModule,
+ SelectFieldModule,
],
declarations: [AddPartyRoutingRuleDialogComponent],
exports: [AddPartyRoutingRuleDialogComponent],
diff --git a/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.component.ts b/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.component.ts
index ae0eac99..533e7bfc 100644
--- a/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.component.ts
+++ b/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.component.ts
@@ -1,7 +1,7 @@
import { Component, DestroyRef } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ActivatedRoute, Router } from '@angular/router';
-import { DialogService, DialogResponseStatus } from '@vality/ng-core';
+import { DialogService, DialogResponseStatus, compareDifferentTypes } from '@vality/ng-core';
import { combineLatest } from 'rxjs';
import { filter, map, shareReplay, startWith, switchMap, take } from 'rxjs/operators';
@@ -165,20 +165,39 @@ export class PartyRoutingRulesetComponent {
this.partyRoutingRulesetService.wallets$,
this.routingRulesTypeService.routingRulesType$,
this.partyRoutingRulesetService.partyID$,
+ this.partyRuleset$,
])
.pipe(
take(1),
- switchMap(([refID, shops, wallets, type, partyID]) =>
- this.dialogService
+ switchMap(([refID, shops, wallets, type, partyID, ruleset]) => {
+ return this.dialogService
.open(AddPartyRoutingRuleDialogComponent, {
refID,
- shops,
- wallets,
+ shops: shops
+ .filter((s) =>
+ ruleset.data.decisions.delegates.every(
+ (d) =>
+ d?.allowed?.condition?.party?.definition?.shop_is !==
+ s.id,
+ ),
+ )
+ .sort((a, b) =>
+ compareDifferentTypes(a.details.name, b.details.name),
+ ),
+ wallets: wallets
+ .filter((w) =>
+ ruleset.data.decisions.delegates.every(
+ (d) =>
+ d?.allowed?.condition?.party?.definition?.wallet_is !==
+ w.id,
+ ),
+ )
+ .sort((a, b) => compareDifferentTypes(a.name, b.name)),
type,
partyID,
})
- .afterClosed(),
- ),
+ .afterClosed();
+ }),
takeUntilDestroyed(this.destroyRef),
)
.subscribe({
diff --git a/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.service.ts b/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.service.ts
index ab1f693f..aa960c04 100644
--- a/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.service.ts
+++ b/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.service.ts
@@ -43,6 +43,7 @@ export class PartyRoutingRulesetService {
shops$ = defer(() => this.party$).pipe(
map((p) => p.shops),
map((shops) => Array.from(shops.values())),
+ shareReplay({ refCount: true, bufferSize: 1 }),
);
wallets$ = defer(() => this.partyID$).pipe(
switchMap((partyID) =>
diff --git a/src/app/sections/sections-routing.module.ts b/src/app/sections/sections-routing.module.ts
index e099f3a9..30b6c866 100644
--- a/src/app/sections/sections-routing.module.ts
+++ b/src/app/sections/sections-routing.module.ts
@@ -40,10 +40,6 @@ const ROUTES: Routes = [
path: 'payments',
loadChildren: () => import('./payments/payments.module').then((m) => m.PaymentsModule),
},
- {
- path: 'old-payments',
- loadChildren: () => import('./old-payments/payments.module').then((m) => m.PaymentsModule),
- },
{
path: 'deposits',
loadChildren: () => import('./deposits/deposits.module').then((m) => m.DepositsModule),
diff --git a/src/app/sections/terms/components/shops-terms/shops-terms.component.ts b/src/app/sections/terms/components/shops-terms/shops-terms.component.ts
index 860ab95e..db90a62f 100644
--- a/src/app/sections/terms/components/shops-terms/shops-terms.component.ts
+++ b/src/app/sections/terms/components/shops-terms/shops-terms.component.ts
@@ -24,6 +24,7 @@ import {
UpdateOptions,
VSelectPipe,
Column2,
+ cachedHeadMap,
} from '@vality/ng-core';
import { map, shareReplay } from 'rxjs/operators';
import { Overwrite } from 'utility-types';
@@ -86,19 +87,17 @@ export class ShopsTermsComponent implements OnInit {
}),
);
terms$ = this.shopsTermsService.result$.pipe(
- map((terms) =>
- terms.map((t) => ({
- value: t,
- children: getFlatDecisions(getShopCashFlowSelectors(t.current_term_set)).filter(
- (v) =>
- isShopTermSetDecision(v, {
- partyId: t.owner_id,
- shopId: t.shop_id,
- currency: t.currency,
- }),
- ),
- })),
- ),
+ cachedHeadMap((t) => ({
+ value: t,
+ children: getFlatDecisions(getShopCashFlowSelectors(t.current_term_set)).filter((v) =>
+ isShopTermSetDecision(v, {
+ partyId: t.owner_id,
+ shopId: t.shop_id,
+ currency: t.currency,
+ }),
+ ),
+ })),
+ shareReplay({ refCount: true, bufferSize: 1 }),
);
hasMore$ = this.shopsTermsService.hasMore$;
isLoading$ = this.shopsTermsService.isLoading$;
diff --git a/src/app/sections/terms/components/terminals-terms/terminals-terms.component.ts b/src/app/sections/terms/components/terminals-terms/terminals-terms.component.ts
index 22a2ab1c..c2f8ac8a 100644
--- a/src/app/sections/terms/components/terminals-terms/terminals-terms.component.ts
+++ b/src/app/sections/terms/components/terminals-terms/terminals-terms.component.ts
@@ -23,6 +23,7 @@ import {
TableModule,
UpdateOptions,
VSelectPipe,
+ cachedHeadMap,
} from '@vality/ng-core';
import { map, shareReplay } from 'rxjs/operators';
import { Overwrite } from 'utility-types';
@@ -74,7 +75,8 @@ export class TerminalsTermsComponent implements OnInit {
}),
);
terms$ = this.terminalsTermsService.result$.pipe(
- map((terms) => terms.map(getTerminalTreeDataItem((d) => d.current_term_set))),
+ cachedHeadMap(getTerminalTreeDataItem((d) => d.current_term_set)),
+ shareReplay({ refCount: true, bufferSize: 1 }),
);
hasMore$ = this.terminalsTermsService.hasMore$;
isLoading$ = this.terminalsTermsService.isLoading$;
diff --git a/src/app/sections/terms/components/wallets-terms/wallets-terms.component.ts b/src/app/sections/terms/components/wallets-terms/wallets-terms.component.ts
index 5ac260ee..d4b4df59 100644
--- a/src/app/sections/terms/components/wallets-terms/wallets-terms.component.ts
+++ b/src/app/sections/terms/components/wallets-terms/wallets-terms.component.ts
@@ -27,6 +27,7 @@ import {
UpdateOptions,
VSelectPipe,
Column2,
+ cachedHeadMap,
} from '@vality/ng-core';
import { map, shareReplay } from 'rxjs/operators';
import { Overwrite } from 'utility-types';
@@ -89,19 +90,17 @@ export class WalletsTermsComponent implements OnInit {
}),
);
terms$ = this.walletsTermsService.result$.pipe(
- map((terms) =>
- terms.map((t) => ({
- value: t,
- children: getFlatDecisions(getWalletCashFlowSelectors(t.current_term_set)).filter(
- (v) =>
- isWalletTermSetDecision(v, {
- partyId: t.owner_id,
- walletId: t.wallet_id,
- currency: t.currency,
- }),
- ),
- })),
- ),
+ cachedHeadMap((t) => ({
+ value: t,
+ children: getFlatDecisions(getWalletCashFlowSelectors(t.current_term_set)).filter((v) =>
+ isWalletTermSetDecision(v, {
+ partyId: t.owner_id,
+ walletId: t.wallet_id,
+ currency: t.currency,
+ }),
+ ),
+ })),
+ shareReplay({ refCount: true, bufferSize: 1 }),
);
hasMore$ = this.walletsTermsService.hasMore$;
isLoading$ = this.walletsTermsService.isLoading$;
diff --git a/src/app/sections/withdrawals/withdrawals.component.html b/src/app/sections/withdrawals/withdrawals.component.html
index ed0f2943..06b72c0a 100644
--- a/src/app/sections/withdrawals/withdrawals.component.html
+++ b/src/app/sections/withdrawals/withdrawals.component.html
@@ -1,4 +1,4 @@
-
+
@@ -24,7 +24,7 @@
-
-
-
+
diff --git a/src/app/sections/withdrawals/withdrawals.component.ts b/src/app/sections/withdrawals/withdrawals.component.ts
index d3ab7902..9d14a74c 100644
--- a/src/app/sections/withdrawals/withdrawals.component.ts
+++ b/src/app/sections/withdrawals/withdrawals.component.ts
@@ -5,7 +5,6 @@ import { PartyID } from '@vality/domain-proto/domain';
import { StatWithdrawal } from '@vality/fistful-proto/fistful_stat';
import {
QueryParamsService,
- Column,
UpdateOptions,
clean,
DialogService,
@@ -18,6 +17,7 @@ import {
getValueChanges,
countChanged,
debounceTimeWithFirst,
+ Column2,
} from '@vality/ng-core';
import { getUnionKey } from '@vality/ng-thrift';
import { endOfDay } from 'date-fns';
@@ -28,9 +28,7 @@ import { WithdrawalParams } from '@cc/app/api/fistful-stat';
import { createFailureColumn } from '../../shared';
import { FailMachinesDialogComponent, Type } from '../../shared/components/fail-machines-dialog';
-import { AmountCurrencyService } from '../../shared/services';
-import { createProviderColumn } from '../../shared/utils/table/create-provider-column';
-import { createTerminalColumn } from '../../shared/utils/table/create-terminal-column';
+import { createDomainObjectColumn, createCurrencyColumn } from '../../shared/utils/table2';
import { DATE_RANGE_DAYS, DEBOUNCE_TIME_MS } from '../../tokens';
import { CreateAdjustmentDialogComponent } from './components/create-adjustment-dialog/create-adjustment-dialog.component';
@@ -72,46 +70,39 @@ export class WithdrawalsComponent implements OnInit {
withdrawals$ = this.fetchWithdrawalsService.result$;
inProgress$ = this.fetchWithdrawalsService.isLoading$;
hasMore$ = this.fetchWithdrawalsService.hasMore$;
- columns: Column[] = [
- { field: 'id' },
- { field: 'created_at', type: 'datetime' },
- 'identity_id',
- 'source_id',
- 'destination_id',
- 'external_id',
- {
+ columns: Column2[] = [
+ { field: 'id', sticky: 'start' },
+ { field: 'external_id' },
+ { field: 'created_at', cell: { type: 'datetime' } },
+ { field: 'identity_id' },
+ { field: 'source_id' },
+ { field: 'destination_id' },
+ createCurrencyColumn((d) => ({ amount: d.amount, code: d.currency_symbolic_code }), {
field: 'amount',
- type: 'currency',
- formatter: (d) =>
- this.amountCurrencyService.toMajor(d.amount, d.currency_symbolic_code),
- typeParameters: {
- currencyCode: (d) => d.currency_symbolic_code,
- },
- },
- {
+ }),
+ createCurrencyColumn((d) => ({ amount: d.fee, code: d.currency_symbolic_code }), {
field: 'fee',
- type: 'currency',
- formatter: (d) => this.amountCurrencyService.toMajor(d.fee, d.currency_symbolic_code),
- typeParameters: {
- currencyCode: (d) => d.currency_symbolic_code,
- },
- },
+ }),
{
field: 'status',
- type: 'tag',
- formatter: (d) => getUnionKey(d.status),
- typeParameters: {
- label: (d) => startCase(getUnionKey(d.status)),
- tags: {
- pending: { color: 'pending' },
- succeeded: { color: 'success' },
- failed: { color: 'warn' },
- },
- },
+ cell: (d) => ({
+ value: startCase(getUnionKey(d.status)),
+ color: (
+ {
+ pending: 'pending',
+ succeeded: 'success',
+ failed: 'warn',
+ } as const
+ )[getUnionKey(d.status)],
+ }),
},
- createTerminalColumn((d) => d.terminal_id),
- createProviderColumn((d) => d.provider_id),
- createFailureColumn((d) => d.status?.failed?.base_failure),
+ createDomainObjectColumn((d) => ({ ref: { terminal: { id: d.terminal_id } } }), {
+ header: 'Terminal',
+ }),
+ createDomainObjectColumn((d) => ({ ref: { provider: { id: d.provider_id } } }), {
+ header: 'Provider',
+ }),
+ createFailureColumn((d) => ({ failure: d.status?.failed?.base_failure })),
];
selected: StatWithdrawal[] = [];
statuses: WithdrawalParams['status'][] = ['Pending', 'Succeeded', 'Failed'];
@@ -122,7 +113,6 @@ export class WithdrawalsComponent implements OnInit {
private fetchWithdrawalsService: FetchWithdrawalsService,
private fb: NonNullableFormBuilder,
private qp: QueryParamsService>,
- private amountCurrencyService: AmountCurrencyService,
private dialogService: DialogService,
private destroyRef: DestroyRef,
@Inject(DATE_RANGE_DAYS) private dateRangeDays: number,
diff --git a/src/app/shared/services/domain-metadata-form-extensions/domain-metadata-form-extensions.service.ts b/src/app/shared/services/domain-metadata-form-extensions/domain-metadata-form-extensions.service.ts
index ad653ca2..4988af09 100644
--- a/src/app/shared/services/domain-metadata-form-extensions/domain-metadata-form-extensions.service.ts
+++ b/src/app/shared/services/domain-metadata-form-extensions/domain-metadata-form-extensions.service.ts
@@ -76,6 +76,15 @@ export class DomainMetadataFormExtensionsService {
generate: () => of('authorization_failed:unknown'),
}),
},
+ {
+ determinant: (data) => of(isTypeWithAliases(data, 'DataRevision', 'domain')),
+ extension: () =>
+ this.domainStoreService.version$.pipe(
+ map(() => ({
+ generate: () => this.domainStoreService.version$,
+ })),
+ ),
+ },
]),
shareReplay({ refCount: true, bufferSize: 1 }),
);
diff --git a/src/app/shared/utils/table/create-failure-column.ts b/src/app/shared/utils/table/create-failure-column.ts
index 8e95409d..e45ce662 100644
--- a/src/app/shared/utils/table/create-failure-column.ts
+++ b/src/app/shared/utils/table/create-failure-column.ts
@@ -1,12 +1,5 @@
import { Failure } from '@vality/domain-proto/domain';
-import {
- PossiblyAsync,
- ColumnObject,
- getPossiblyAsyncObservable,
- createColumn,
-} from '@vality/ng-core';
-import { of } from 'rxjs';
-import { map, switchMap } from 'rxjs/operators';
+import { createColumn } from '@vality/ng-core';
function getFailureMessageTree(failure: Failure, withReason = true, level = Infinity) {
if (!failure) {
@@ -21,38 +14,8 @@ function getFailureMessageTree(failure: Failure, withReason = true, level = Infi
);
}
-export function createFailureColumn(
- selectFailure: (d: T) => PossiblyAsync,
- selectNoFailureMessage: (d: T) => PossiblyAsync = () => '',
- params: Partial> = {},
-): ColumnObject {
- return {
- field: 'failure',
- formatter: (d) =>
- getPossiblyAsyncObservable(selectNoFailureMessage(d)).pipe(
- switchMap((msg) => {
- if (msg) {
- return of(msg);
- }
- return getPossiblyAsyncObservable(selectFailure(d)).pipe(
- map((failure) => getFailureMessageTree(failure, false, 2)),
- );
- }),
- ),
- description: (d) =>
- getPossiblyAsyncObservable(selectFailure(d)).pipe(
- map((failure) => failure?.reason || ''),
- ),
- tooltip: (d) =>
- getPossiblyAsyncObservable(selectFailure(d)).pipe(
- map((failure) => getFailureMessageTree(failure?.sub?.sub)),
- ),
- ...params,
- } as ColumnObject;
-}
-
-export const createFailureColumn2 = createColumn(
- ({ failure, noFailureMessage }: { failure: Failure; noFailureMessage: string }) => ({
+export const createFailureColumn = createColumn(
+ ({ failure, noFailureMessage }: { failure: Failure; noFailureMessage?: string }) => ({
value: noFailureMessage || getFailureMessageTree(failure, false, 2),
description: failure?.reason || '',
tooltip: failure?.sub?.sub ? JSON.stringify(failure.sub.sub, null, 2) : '',