mirror of
https://github.com/valitydev/dashboard.git
synced 2024-11-06 10:35:21 +00:00
FRONTEND-473: Added partyID param to anapi api services (#404)
This commit is contained in:
parent
ceb7bede8b
commit
110a911594
@ -1 +1 @@
|
||||
Subproject commit ff23f6cb65733927f97bf67a223f1fcaf451526f
|
||||
Subproject commit c3a0f346f3c7a46d824562f1037f5dfbde96f12a
|
@ -1,14 +1,21 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
|
||||
import { AnalyticsService as APIAnalyticsService, InlineResponse200, SplitUnit } from '@dsh/api-codegen/anapi';
|
||||
import { KeycloakTokenInfoService } from '@dsh/app/shared/services';
|
||||
|
||||
import { PaymentInstitutionRealm } from '../model';
|
||||
import { genXRequestID, toDateLike } from '../utils';
|
||||
|
||||
@Injectable()
|
||||
export class AnalyticsService {
|
||||
constructor(private analyticsService: APIAnalyticsService) {}
|
||||
constructor(
|
||||
private analyticsService: APIAnalyticsService,
|
||||
private keycloakTokenInfoService: KeycloakTokenInfoService
|
||||
) {}
|
||||
|
||||
private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$;
|
||||
|
||||
getAveragePayment(
|
||||
fromTime: string,
|
||||
@ -19,15 +26,19 @@ export class AnalyticsService {
|
||||
paymentInstitutionRealm?: PaymentInstitutionRealm;
|
||||
}
|
||||
) {
|
||||
return this.analyticsService.getAveragePayment(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.analyticsService.getAveragePayment(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -40,15 +51,19 @@ export class AnalyticsService {
|
||||
paymentInstitutionRealm?: PaymentInstitutionRealm;
|
||||
}
|
||||
) {
|
||||
return this.analyticsService.getPaymentsAmount(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.analyticsService.getPaymentsAmount(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -61,15 +76,19 @@ export class AnalyticsService {
|
||||
paymentInstitutionRealm?: PaymentInstitutionRealm;
|
||||
}
|
||||
) {
|
||||
return this.analyticsService.getPaymentsCount(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.analyticsService.getPaymentsCount(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -82,15 +101,19 @@ export class AnalyticsService {
|
||||
paymentInstitutionRealm?: PaymentInstitutionRealm;
|
||||
}
|
||||
) {
|
||||
return this.analyticsService.getPaymentsErrorDistribution(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.analyticsService.getPaymentsErrorDistribution(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -103,15 +126,19 @@ export class AnalyticsService {
|
||||
paymentInstitutionRealm?: PaymentInstitutionRealm;
|
||||
}
|
||||
) {
|
||||
return this.analyticsService.getPaymentsSubErrorDistribution(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.analyticsService.getPaymentsSubErrorDistribution(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -124,15 +151,19 @@ export class AnalyticsService {
|
||||
paymentInstitutionRealm?: PaymentInstitutionRealm;
|
||||
}
|
||||
) {
|
||||
return this.analyticsService.getPaymentsToolDistribution(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.analyticsService.getPaymentsToolDistribution(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -145,15 +176,19 @@ export class AnalyticsService {
|
||||
paymentInstitutionRealm?: PaymentInstitutionRealm;
|
||||
}
|
||||
) {
|
||||
return this.analyticsService.getRefundsAmount(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.analyticsService.getRefundsAmount(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -167,16 +202,20 @@ export class AnalyticsService {
|
||||
paymentInstitutionRealm?: PaymentInstitutionRealm;
|
||||
}
|
||||
) {
|
||||
return this.analyticsService.getPaymentsSplitAmount(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
splitUnit,
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.analyticsService.getPaymentsSplitAmount(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
splitUnit,
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -190,16 +229,20 @@ export class AnalyticsService {
|
||||
paymentInstitutionRealm?: PaymentInstitutionRealm;
|
||||
}
|
||||
) {
|
||||
return this.analyticsService.getPaymentsSplitCount(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
splitUnit,
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.analyticsService.getPaymentsSplitCount(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
splitUnit,
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -208,13 +251,17 @@ export class AnalyticsService {
|
||||
excludeShopIDs?: string[];
|
||||
paymentInstitutionRealm?: PaymentInstitutionRealm;
|
||||
}) {
|
||||
return this.analyticsService.getCurrentBalances(
|
||||
genXRequestID(),
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.analyticsService.getCurrentBalances(
|
||||
genXRequestID(),
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopIDs,
|
||||
params.excludeShopIDs,
|
||||
params.paymentInstitutionRealm
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,21 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import moment from 'moment';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
|
||||
import { InlineResponse2009, SearchService } from '@dsh/api-codegen/anapi';
|
||||
import { InlineResponse2009, Invoice, SearchService } from '@dsh/api-codegen/anapi';
|
||||
import { KeycloakTokenInfoService } from '@dsh/app/shared/services';
|
||||
|
||||
import { genXRequestID, toDateLike } from '../utils';
|
||||
import { Duration, InvoicesSearchParams } from './model';
|
||||
|
||||
export type InvoicesAndContinuationToken = InlineResponse2009;
|
||||
|
||||
@Injectable()
|
||||
export class InvoiceSearchService {
|
||||
constructor(private searchService: SearchService) {}
|
||||
constructor(private searchService: SearchService, private keycloakTokenInfoService: KeycloakTokenInfoService) {}
|
||||
|
||||
private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$;
|
||||
|
||||
searchInvoices(
|
||||
fromTime: string,
|
||||
@ -18,35 +23,43 @@ export class InvoiceSearchService {
|
||||
params: InvoicesSearchParams,
|
||||
limit: number,
|
||||
continuationToken?: string
|
||||
): Observable<InlineResponse2009> {
|
||||
return this.searchService.searchInvoices(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
limit,
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopID,
|
||||
params.shopIDs,
|
||||
params.paymentInstitutionRealm,
|
||||
params.invoiceIDs,
|
||||
params.invoiceStatus,
|
||||
params.invoiceID,
|
||||
params.externalID,
|
||||
params.invoiceAmountFrom,
|
||||
params.invoiceAmountTo,
|
||||
params.excludedShops,
|
||||
continuationToken
|
||||
): Observable<InvoicesAndContinuationToken> {
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.searchService.searchInvoices(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
limit,
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopID,
|
||||
params.shopIDs,
|
||||
params.paymentInstitutionRealm,
|
||||
params.invoiceIDs,
|
||||
params.invoiceStatus,
|
||||
params.invoiceID,
|
||||
params.externalID,
|
||||
params.invoiceAmountFrom,
|
||||
params.invoiceAmountTo,
|
||||
params.excludedShops,
|
||||
continuationToken
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
searchInvoicesByDuration({ amount, unit }: Duration, invoiceID: string, limit: number) {
|
||||
searchInvoicesByDuration(
|
||||
{ amount, unit }: Duration,
|
||||
invoiceID: string,
|
||||
limit: number
|
||||
): Observable<InvoicesAndContinuationToken> {
|
||||
const from = moment().subtract(amount, unit).startOf('d').utc().format();
|
||||
const to = moment().endOf('d').utc().format();
|
||||
return this.searchInvoices(from, to, { invoiceID }, limit);
|
||||
}
|
||||
|
||||
getInvoiceByDuration(duration: Duration, invoiceID: string) {
|
||||
getInvoiceByDuration(duration: Duration, invoiceID: string): Observable<Invoice> {
|
||||
return this.searchInvoicesByDuration(duration, invoiceID, 1).pipe(map((res) => res.result[0]));
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,21 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import moment from 'moment';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
|
||||
import { InlineResponse20010, PaymentSearchResult, SearchService } from '@dsh/api-codegen/anapi';
|
||||
import { KeycloakTokenInfoService } from '@dsh/app/shared/services';
|
||||
|
||||
import { genXRequestID, toDateLike } from '../utils';
|
||||
import { Duration, PaymentsSearchParams } from './model';
|
||||
|
||||
export type PaymentsAndContinuationToken = InlineResponse20010;
|
||||
|
||||
@Injectable()
|
||||
export class PaymentSearchService {
|
||||
constructor(private searchService: SearchService) {}
|
||||
constructor(private searchService: SearchService, private keycloakTokenInfoService: KeycloakTokenInfoService) {}
|
||||
|
||||
private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$;
|
||||
|
||||
searchPayments(
|
||||
fromTime: string,
|
||||
@ -18,39 +23,43 @@ export class PaymentSearchService {
|
||||
params: PaymentsSearchParams,
|
||||
limit: number,
|
||||
continuationToken?: string
|
||||
): Observable<InlineResponse20010> {
|
||||
return this.searchService.searchPayments(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
limit,
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopID,
|
||||
params.shopIDs,
|
||||
params.paymentInstitutionRealm,
|
||||
params.invoiceIDs,
|
||||
params.paymentStatus,
|
||||
params.paymentFlow,
|
||||
params.paymentMethod,
|
||||
params.paymentTerminalProvider,
|
||||
params.invoiceID,
|
||||
params.paymentID,
|
||||
params.externalID,
|
||||
params.payerEmail,
|
||||
params.payerIP,
|
||||
params.payerFingerprint,
|
||||
params.customerID,
|
||||
params.first6,
|
||||
params.last4,
|
||||
params.rrn,
|
||||
params.approvalCode,
|
||||
params.bankCardTokenProvider,
|
||||
params.bankCardPaymentSystem,
|
||||
params.paymentAmountFrom,
|
||||
params.paymentAmountTo,
|
||||
params.excludedShops,
|
||||
continuationToken
|
||||
): Observable<PaymentsAndContinuationToken> {
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.searchService.searchPayments(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
limit,
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopID,
|
||||
params.shopIDs,
|
||||
params.paymentInstitutionRealm,
|
||||
params.invoiceIDs,
|
||||
params.paymentStatus,
|
||||
params.paymentFlow,
|
||||
params.paymentMethod,
|
||||
params.paymentTerminalProvider,
|
||||
params.invoiceID,
|
||||
params.paymentID,
|
||||
params.externalID,
|
||||
params.payerEmail,
|
||||
params.payerIP,
|
||||
params.payerFingerprint,
|
||||
params.customerID,
|
||||
params.first6,
|
||||
params.last4,
|
||||
params.rrn,
|
||||
params.approvalCode,
|
||||
params.bankCardTokenProvider,
|
||||
params.bankCardPaymentSystem,
|
||||
params.paymentAmountFrom,
|
||||
params.paymentAmountTo,
|
||||
params.excludedShops,
|
||||
continuationToken
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -59,7 +68,7 @@ export class PaymentSearchService {
|
||||
params: PaymentsSearchParams,
|
||||
limit: number,
|
||||
continuationToken?: string
|
||||
): Observable<InlineResponse20010> {
|
||||
): Observable<PaymentsAndContinuationToken> {
|
||||
const from = moment().subtract(amount, unit).startOf('d').utc().format();
|
||||
const to = moment().endOf('d').utc().format();
|
||||
return this.searchPayments(from, to, params, limit, continuationToken);
|
||||
|
@ -1,30 +1,46 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
|
||||
import { SearchService } from '@dsh/api-codegen/anapi';
|
||||
import { InlineResponse20011, SearchService } from '@dsh/api-codegen/anapi';
|
||||
import { KeycloakTokenInfoService } from '@dsh/app/shared/services';
|
||||
|
||||
import { genXRequestID, toDateLike } from '../utils';
|
||||
import { PayoutsSearchParams } from './model';
|
||||
|
||||
type PayoutsAndContinuationToken = InlineResponse20011;
|
||||
|
||||
@Injectable()
|
||||
export class PayoutSearchService {
|
||||
constructor(private searchService: SearchService) {}
|
||||
constructor(private searchService: SearchService, private keycloakTokenInfoService: KeycloakTokenInfoService) {}
|
||||
|
||||
searchPayouts(fromTime: string, toTime: string, limit: number, options: PayoutsSearchParams) {
|
||||
return this.searchService.searchPayouts(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
limit,
|
||||
undefined,
|
||||
undefined,
|
||||
options.shopID,
|
||||
options.shopIDs,
|
||||
options.paymentInstitutionRealm,
|
||||
options.offset,
|
||||
options.payoutID,
|
||||
options.payoutToolType,
|
||||
options.excludedShops,
|
||||
options.continuationToken
|
||||
private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$;
|
||||
|
||||
searchPayouts(
|
||||
fromTime: string,
|
||||
toTime: string,
|
||||
limit: number,
|
||||
options: PayoutsSearchParams
|
||||
): Observable<PayoutsAndContinuationToken> {
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.searchService.searchPayouts(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
limit,
|
||||
undefined,
|
||||
partyID,
|
||||
options.shopID,
|
||||
options.shopIDs,
|
||||
options.paymentInstitutionRealm,
|
||||
options.offset,
|
||||
options.payoutID,
|
||||
options.payoutToolType,
|
||||
options.excludedShops,
|
||||
options.continuationToken
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,21 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import moment from 'moment';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
|
||||
import { SearchService } from '@dsh/api-codegen/anapi';
|
||||
import { InlineResponse20012, Refund, SearchService } from '@dsh/api-codegen/anapi';
|
||||
import { KeycloakTokenInfoService } from '@dsh/app/shared/services';
|
||||
|
||||
import { genXRequestID, toDateLike } from '../utils';
|
||||
import { Duration, RefundsSearchParams } from './model';
|
||||
|
||||
export type RefundsAndContinuationToken = InlineResponse20012;
|
||||
|
||||
@Injectable()
|
||||
export class RefundSearchService {
|
||||
constructor(private searchService: SearchService) {}
|
||||
constructor(private searchService: SearchService, private keycloakTokenInfoService: KeycloakTokenInfoService) {}
|
||||
|
||||
private partyID$: Observable<string> = this.keycloakTokenInfoService.partyID$;
|
||||
|
||||
searchRefunds(
|
||||
fromTime: string,
|
||||
@ -17,26 +23,30 @@ export class RefundSearchService {
|
||||
params: RefundsSearchParams,
|
||||
limit: number,
|
||||
continuationToken?: string
|
||||
) {
|
||||
return this.searchService.searchRefunds(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
limit,
|
||||
undefined,
|
||||
undefined,
|
||||
params.shopID,
|
||||
params.shopIDs,
|
||||
params.paymentInstitutionRealm,
|
||||
undefined,
|
||||
params.invoiceIDs,
|
||||
params.invoiceID,
|
||||
params.paymentID,
|
||||
params.refundID,
|
||||
params.externalID,
|
||||
params.refundStatus,
|
||||
params.excludedShops,
|
||||
continuationToken
|
||||
): Observable<RefundsAndContinuationToken> {
|
||||
return this.partyID$.pipe(
|
||||
switchMap((partyID) =>
|
||||
this.searchService.searchRefunds(
|
||||
genXRequestID(),
|
||||
toDateLike(fromTime),
|
||||
toDateLike(toTime),
|
||||
limit,
|
||||
undefined,
|
||||
partyID,
|
||||
params.shopID,
|
||||
params.shopIDs,
|
||||
params.paymentInstitutionRealm,
|
||||
undefined,
|
||||
params.invoiceIDs,
|
||||
params.invoiceID,
|
||||
params.paymentID,
|
||||
params.refundID,
|
||||
params.externalID,
|
||||
params.refundStatus,
|
||||
params.excludedShops,
|
||||
continuationToken
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -45,13 +55,13 @@ export class RefundSearchService {
|
||||
params: RefundsSearchParams,
|
||||
limit?: number,
|
||||
continuationToken?: string
|
||||
) {
|
||||
): Observable<RefundsAndContinuationToken> {
|
||||
const from = moment().subtract(amount, unit).startOf('d').utc().format();
|
||||
const to = moment().endOf('d').utc().format();
|
||||
return this.searchRefunds(from, to, params, limit, continuationToken);
|
||||
}
|
||||
|
||||
getRefundByDuration(duration: Duration, invoiceID: string, paymentID: string) {
|
||||
getRefundByDuration(duration: Duration, invoiceID: string, paymentID: string): Observable<Refund> {
|
||||
return this.searchRefundsByDuration(duration, { invoiceID, paymentID }, 1).pipe(map((res) => res.result[0]));
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,7 @@ import {
|
||||
} from '@angular/material-moment-adapter';
|
||||
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MAT_RIPPLE_GLOBAL_OPTIONS } from '@angular/material/core';
|
||||
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
||||
import { MatIconRegistry } from '@angular/material/icon';
|
||||
import { BrowserModule, DomSanitizer } from '@angular/platform-browser';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslocoConfig, TranslocoModule, TRANSLOCO_CONFIG } from '@ngneat/transloco';
|
||||
|
||||
@ -23,8 +22,7 @@ import { AuthModule, KeycloakAngularModule, KeycloakService } from './auth';
|
||||
import { ConfigModule, ConfigService } from './config';
|
||||
import { FeedbackModule } from './feedback';
|
||||
import { HomeModule } from './home';
|
||||
import { IconsModule } from './icons';
|
||||
import icons from './icons/icons.json';
|
||||
import { IconsModule, IconsService } from './icons';
|
||||
import { initializer } from './initializer';
|
||||
import { LanguageService } from './language';
|
||||
import { SectionsModule } from './sections';
|
||||
@ -70,6 +68,7 @@ import { YandexMetrikaConfigService, YandexMetrikaModule } from './yandex-metrik
|
||||
YandexMetrikaConfigService,
|
||||
PLATFORM_ID,
|
||||
ThemeManager,
|
||||
IconsService,
|
||||
],
|
||||
multi: true,
|
||||
},
|
||||
@ -103,18 +102,4 @@ import { YandexMetrikaConfigService, YandexMetrikaModule } from './yandex-metrik
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
})
|
||||
export class AppModule {
|
||||
constructor(private matIconRegistry: MatIconRegistry, private domSanitizer: DomSanitizer) {
|
||||
this.registerIcons();
|
||||
}
|
||||
|
||||
registerIcons() {
|
||||
for (const name of icons) {
|
||||
this.matIconRegistry.addSvgIcon(
|
||||
name,
|
||||
this.domSanitizer.bypassSecurityTrustResourceUrl(`../assets/icons/${name}.svg`)
|
||||
);
|
||||
}
|
||||
this.matIconRegistry.setDefaultFontSetClass('material-icons-outlined');
|
||||
}
|
||||
}
|
||||
export class AppModule {}
|
||||
|
@ -1,28 +1,24 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatIconRegistry } from '@angular/material/icon';
|
||||
import { IconOptions } from '@angular/material/icon/icon-registry';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
import icons from './icons.json';
|
||||
|
||||
const ICONS_ROOT_DIR = 'assets/icons';
|
||||
|
||||
@Injectable()
|
||||
export class IconsService {
|
||||
constructor(private matIconRegistry: MatIconRegistry, private domSanitizer: DomSanitizer) {}
|
||||
|
||||
init() {
|
||||
this.addIcons(icons);
|
||||
this.registerIcons(icons);
|
||||
this.matIconRegistry.setDefaultFontSetClass('material-icons-outlined');
|
||||
}
|
||||
|
||||
private addIcons(iconNames: string[]) {
|
||||
for (const name of iconNames) {
|
||||
this.addIcon(name, `${ICONS_ROOT_DIR}/${name}.svg`);
|
||||
private registerIcons(iconList) {
|
||||
for (const name of iconList) {
|
||||
this.matIconRegistry.addSvgIcon(
|
||||
name,
|
||||
this.domSanitizer.bypassSecurityTrustResourceUrl(`../assets/icons/${name}.svg`)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private addIcon(name: string, path: string, options?: IconOptions) {
|
||||
this.matIconRegistry.addSvgIcon(name, this.domSanitizer.bypassSecurityTrustResourceUrl(path), options);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { KeycloakService } from './auth/keycloak';
|
||||
import { ConfigService } from './config';
|
||||
import { IconsService } from './icons';
|
||||
import { LanguageService } from './language';
|
||||
import { ThemeManager } from './theme-manager';
|
||||
import { YandexMetrikaConfigService } from './yandex-metrika';
|
||||
@ -10,7 +11,8 @@ export const initializer = (
|
||||
languageService: LanguageService,
|
||||
yandexMetrikaService: YandexMetrikaConfigService,
|
||||
platformId: object,
|
||||
themeManager: ThemeManager
|
||||
themeManager: ThemeManager,
|
||||
iconsService: IconsService
|
||||
) => () =>
|
||||
Promise.all([
|
||||
configService
|
||||
@ -30,4 +32,5 @@ export const initializer = (
|
||||
bearerPrefix: 'Bearer',
|
||||
}),
|
||||
languageService.init(),
|
||||
iconsService.init(),
|
||||
]);
|
||||
|
@ -1,13 +1,16 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
|
||||
import jwt_decode from 'jwt-decode';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { map, pluck, shareReplay } from 'rxjs/operators';
|
||||
|
||||
@UntilDestroy()
|
||||
@Injectable()
|
||||
export class KeycloakTokenInfoService {
|
||||
private decoded$ = from(this.keycloakService.getToken()).pipe(
|
||||
map((token) => jwt_decode(token)),
|
||||
untilDestroyed(this),
|
||||
shareReplay(1)
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user