Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion apps/web/src/app/data/services/identity.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Injectable, inject } from '@angular/core';
import { ApiService } from '../../core/services/api.service';
import type { IdentityVerificationSession } from '@zoneless/shared-types';
import type {
IdentityVerificationSession,
ListResponse,
} from '@zoneless/shared-types';
import type { CreateIdentityVerificationSessionInput } from '@zoneless/shared-schemas';

@Injectable({
Expand All @@ -22,4 +25,27 @@ export class IdentityService {
data
);
}

/**
* List VerificationSessions for the platform, newest first.
*/
async ListVerificationSessions(
params: {
relatedAccount?: string;
limit?: number;
} = {}
): Promise<ListResponse<IdentityVerificationSession>> {
const query: Record<string, string> = {};
if (params.relatedAccount) {
query['related_account'] = params.relatedAccount;
}
if (params.limit !== undefined) {
query['limit'] = String(params.limit);
}
return this.api.Call<ListResponse<IdentityVerificationSession>>(
'GET',
'identity/verification_sessions',
query
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ <h2 class="section-title">Identity requirements</h2>
}
</ul>
</div>
} @if (diditSessionId(); as sessionId) {
<div class="mb">
<div class="bolded mb-small">Didit session</div>
<div><app-copy-text [text]="sessionId"></app-copy-text></div>
</div>
} @if ( !GetIdentityStatusLabel() && GetCurrentlyDue().length === 0 &&
GetPendingVerification().length === 0 && GetRequirementErrors().length ===
0 ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
AccountService,
BalanceService,
ExternalWalletService,
IdentityService,
PersonService,
} from '../../../../../data';
import { MetaService } from '../../../../../core';
Expand Down Expand Up @@ -84,6 +85,7 @@ export class ConnectedAccountDetailViewComponent implements OnInit, OnDestroy {
private readonly accountService = inject(AccountService);
private readonly balanceService = inject(BalanceService);
private readonly externalWalletService = inject(ExternalWalletService);
private readonly identityService = inject(IdentityService);
private readonly personService = inject(PersonService);
private readonly metaService = inject(MetaService);
readonly actions = inject(ConnectedAccountActionsService);
Expand All @@ -106,6 +108,7 @@ export class ConnectedAccountDetailViewComponent implements OnInit, OnDestroy {
availableBalance: WritableSignal<number> = signal(0);
pendingBalance: WritableSignal<number> = signal(0);
externalWallets: WritableSignal<ExternalWallet[]> = signal([]);
diditSessionId: WritableSignal<string | null> = signal(null);
idCopied: WritableSignal<boolean> = signal(false);
private idCopiedTimer?: ReturnType<typeof setTimeout>;

Expand Down Expand Up @@ -407,6 +410,7 @@ export class ConnectedAccountDetailViewComponent implements OnInit, OnDestroy {
if (this.account()?.id === id) return;

this.account.set(null);
this.diditSessionId.set(null);
this.activeTab.set('overview');
this.detailPanel.set('main');
this.moneyMovementTab.set('payouts');
Expand All @@ -427,6 +431,7 @@ export class ConnectedAccountDetailViewComponent implements OnInit, OnDestroy {
await Promise.all([
this.RefreshBalance(id),
this.LoadWallets(id, account),
this.LoadLatestVerificationSession(id),
]);
} finally {
this.loading.set(false);
Expand Down Expand Up @@ -465,6 +470,22 @@ export class ConnectedAccountDetailViewComponent implements OnInit, OnDestroy {
}
}

private async LoadLatestVerificationSession(
accountId: string
): Promise<void> {
try {
const result = await this.identityService.ListVerificationSessions({
relatedAccount: accountId,
limit: 1,
});
this.diditSessionId.set(
result.data[0]?.provider_session_id?.trim() || null
);
} catch {
this.diditSessionId.set(null);
}
}

SetTab(tab: DetailTab): void {
this.activeTab.set(tab);
}
Expand Down
Loading