diff --git a/package-lock.json b/package-lock.json index 95907924..7d4256bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "@vality/swag-api-keys-v2": "0.1.2-321124b.0", "@vality/swag-claim-management": "0.1.1-b5248eb.0", "@vality/swag-organizations": "1.0.1-e863566.0", - "@vality/swag-payments": "0.1.3-5760b7e.0", + "@vality/swag-payments": "0.1.3-44bac58.0", "@vality/swag-url-shortener": "0.1.1-9659896.0", "@vality/swag-wallet": "0.1.3-54f56db.0", "angular-file": "^3.0.1", @@ -7212,9 +7212,9 @@ } }, "node_modules/@vality/swag-payments": { - "version": "0.1.3-5760b7e.0", - "resolved": "https://registry.npmjs.org/@vality/swag-payments/-/swag-payments-0.1.3-5760b7e.0.tgz", - "integrity": "sha512-DqCP2Z3k7JVM9Ik+3fPCzPkYwQ8uQmuKHxmTr5s5zr6DSiiQ3KWzPfeWI1FZ1yqcScrbiWNCLKtZOM2XmrPyCg==", + "version": "0.1.3-44bac58.0", + "resolved": "https://registry.npmjs.org/@vality/swag-payments/-/swag-payments-0.1.3-44bac58.0.tgz", + "integrity": "sha512-F1yf1Dt1q04+z7PzqQ8BNWCFG5rWnF4Yfb/BEa/1efBBg7L6tnD2//dnOpgQyaHA777eRpqC5byGmKsnoMJm9w==", "dependencies": { "tslib": "^2.3.0" }, diff --git a/package.json b/package.json index a16061ce..ee47233b 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@vality/swag-api-keys-v2": "0.1.2-321124b.0", "@vality/swag-claim-management": "0.1.1-b5248eb.0", "@vality/swag-organizations": "1.0.1-e863566.0", - "@vality/swag-payments": "0.1.3-5760b7e.0", + "@vality/swag-payments": "0.1.3-44bac58.0", "@vality/swag-url-shortener": "0.1.1-9659896.0", "@vality/swag-wallet": "0.1.3-54f56db.0", "angular-file": "^3.0.1", diff --git a/src/app/api/payments/index.ts b/src/app/api/payments/index.ts index 53c9066a..ea1cec69 100644 --- a/src/app/api/payments/index.ts +++ b/src/app/api/payments/index.ts @@ -9,7 +9,6 @@ export * from './countries.service'; export * from './shops.service'; export * from './webhooks.service'; export * from './payments.service'; -export * from './payouts.service'; export * from './invoices.service'; export * from './contracts.service'; export * from './payments-dictionary.service'; diff --git a/src/app/api/payments/payouts.service.ts b/src/app/api/payments/payouts.service.ts deleted file mode 100644 index ff26cb64..00000000 --- a/src/app/api/payments/payouts.service.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Injectable, Injector } from '@angular/core'; -import { PayoutsService as ApiPayoutsService } from '@vality/swag-payments'; - -import { PartyIdExtension, PartyIdPatchMethodService } from '@dsh/app/api/utils/extensions'; - -import { createApi } from '../utils'; - -@Injectable({ - providedIn: 'root', -}) -export class PayoutsService extends createApi(ApiPayoutsService, [PartyIdExtension]) { - constructor( - injector: Injector, - private partyIdPatchMethodService: PartyIdPatchMethodService, - ) { - super(injector); - this.createPayout = partyIdPatchMethodService.patch( - this.createPayout, - (params, partyId) => (params.payoutParams.partyID = partyId), - ); - } -} diff --git a/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report-dialog.component.html b/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report-dialog.component.html deleted file mode 100644 index 483e70b2..00000000 --- a/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report-dialog.component.html +++ /dev/null @@ -1,51 +0,0 @@ -
-
{{ t('title') }}
- -
{{ t('descriptionStep2') }}
-
-
{{ t('descriptionStep1') }}
-
- - - -
-
diff --git a/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report-dialog.component.ts b/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report-dialog.component.ts deleted file mode 100644 index f05e7b9d..00000000 --- a/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report-dialog.component.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { ChangeDetectionStrategy, Component, Inject, OnInit } from '@angular/core'; -import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; -import { Router } from '@angular/router'; -import { TranslocoService } from '@ngneat/transloco'; -import { NotifyLogService } from '@vality/ng-core'; -import { Payout } from '@vality/swag-anapi-v2'; - -import { CreatePayoutReportDialogService } from './create-payout-report-dialog.service'; - -@Component({ - templateUrl: 'create-payout-report-dialog.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - providers: [CreatePayoutReportDialogService], -}) -export class CreatePayoutReportDialogComponent implements OnInit { - isLoading$ = this.createPayoutReportDialogService.isLoading$; - reportCreated$ = this.createPayoutReportDialogService.reportCreated$; - - constructor( - private dialogRef: MatDialogRef, - private router: Router, - private createPayoutReportDialogService: CreatePayoutReportDialogService, - private transloco: TranslocoService, - private log: NotifyLogService, - @Inject(MAT_DIALOG_DATA) private data: { payout: Payout }, - ) {} - - ngOnInit() { - this.createPayoutReportDialogService.errorOccurred$.subscribe((err) => - this.log.error( - err, - this.transloco.selectTranslate( - 'payouts.errors.createReportError', - null, - 'payment-section', - ), - ), - ); - } - - create() { - this.createPayoutReportDialogService.create(this.data.payout); - } - - toReports() { - void this.router.navigate([...this.router.url.split('/').slice(0, -1), 'reports']); - this.dialogRef.close(); - } - - cancel() { - this.dialogRef.close(); - } -} diff --git a/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report-dialog.service.ts b/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report-dialog.service.ts deleted file mode 100644 index 79adc3bc..00000000 --- a/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report-dialog.service.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Payout } from '@vality/swag-anapi-v2'; -import { BehaviorSubject, of, Subject } from 'rxjs'; -import { catchError, filter, switchMap, tap } from 'rxjs/operators'; - -import { ReportsService } from '@dsh/app/api/anapi'; - -@Injectable() -export class CreatePayoutReportDialogService { - private create$: Subject = new Subject(); - private loading$ = new BehaviorSubject(false); - private created$ = new BehaviorSubject(false); - private error$ = new Subject(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - isLoading$ = this.loading$.asObservable(); - // eslint-disable-next-line @typescript-eslint/member-ordering - errorOccurred$ = this.error$.asObservable(); - // eslint-disable-next-line @typescript-eslint/member-ordering - reportCreated$ = this.created$.asObservable(); - - constructor(private reportsService: ReportsService) { - this.create$ - .pipe( - tap(() => { - this.loading$.next(true); - this.created$.next(false); - }), - switchMap((payout) => - this.reportsService - .createReport({ - // TODO: fix - fromTime: payout.createdAt, - toTime: payout.createdAt, - reportType: 'paymentRegistry', - }) - .pipe( - catchError((e) => { - console.error(e); - this.loading$.next(false); - this.error$.next(); - return of('error'); - }), - ), - ), - filter((result) => result !== 'error'), - ) - .subscribe(() => { - this.loading$.next(false); - this.created$.next(true); - }); - } - - create(payout: Payout) { - this.create$.next(payout); - } -} diff --git a/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report.module.ts b/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report.module.ts deleted file mode 100644 index 33fffcbb..00000000 --- a/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report.module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { MatDialogModule } from '@angular/material/dialog'; -import { MatInputModule } from '@angular/material/input'; -import { MatSnackBarModule } from '@angular/material/snack-bar'; -import { TranslocoModule } from '@ngneat/transloco'; -import { FlexLayoutModule } from 'ng-flex-layout'; - -import { ButtonModule } from '@dsh/components/buttons'; - -import { CreatePayoutReportDialogComponent } from './create-payout-report-dialog.component'; -import { CreatePayoutReportService } from './create-payout-report.service'; - -@NgModule({ - imports: [ - CommonModule, - TranslocoModule, - MatSnackBarModule, - MatDialogModule, - FlexLayoutModule, - ButtonModule, - MatInputModule, - ], - declarations: [CreatePayoutReportDialogComponent], - providers: [CreatePayoutReportService], -}) -export class CreatePayoutReportModule {} diff --git a/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report.service.ts b/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report.service.ts deleted file mode 100644 index 1e0b1dce..00000000 --- a/src/app/sections/payment-section/payouts/create-payout-report/create-payout-report.service.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Injectable } from '@angular/core'; -import { MatDialog } from '@angular/material/dialog'; -import { Payout } from '@vality/swag-anapi-v2'; -import { Subject } from 'rxjs'; -import { switchMap, takeUntil } from 'rxjs/operators'; - -import { CreatePayoutReportDialogComponent } from './create-payout-report-dialog.component'; - -@Injectable() -export class CreatePayoutReportService { - private destroy$: Subject = new Subject(); - private createPayoutReport$: Subject = new Subject(); - - constructor(private dialog: MatDialog) {} - - createPayoutReport(payout: Payout) { - this.createPayoutReport$.next(payout); - } - - init() { - this.createPayoutReport$ - .pipe( - takeUntil(this.destroy$), - switchMap((payout) => - this.dialog - .open(CreatePayoutReportDialogComponent, { - data: { - payout, - }, - }) - .afterClosed(), - ), - ) - .subscribe(); - } - - destroy() { - this.destroy$.next(); - } -} diff --git a/src/app/sections/payment-section/payouts/create-payout-report/index.ts b/src/app/sections/payment-section/payouts/create-payout-report/index.ts deleted file mode 100644 index a2a64d59..00000000 --- a/src/app/sections/payment-section/payouts/create-payout-report/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './create-payout-report.module'; -export * from './create-payout-report.service'; diff --git a/src/app/sections/payment-section/payouts/create-payout/create-payout-dialog.component.html b/src/app/sections/payment-section/payouts/create-payout/create-payout-dialog.component.html deleted file mode 100644 index c786b56f..00000000 --- a/src/app/sections/payment-section/payouts/create-payout/create-payout-dialog.component.html +++ /dev/null @@ -1,81 +0,0 @@ - - -
-
- - {{ p('shop') }} - - - {{ p('any') }} - - - {{ shopInfo.name }} - - - - - - - - {{ p('payoutTool') }} - - - {{ - payoutTool.details.detailsType - | payoutToolDetailsType - | async - }}: {{ payoutTool.details.walletID }} ({{ - payoutTool.currency - }}) - - - - - {{ p('amount') }} - - - - -
- {{ p('noPayoutTools') }} -
-
-
- -
- -
-
-
-
-
- - - -
-
diff --git a/src/app/sections/payment-section/payouts/create-payout/create-payout-dialog.component.ts b/src/app/sections/payment-section/payouts/create-payout/create-payout-dialog.component.ts deleted file mode 100644 index 44ec4edd..00000000 --- a/src/app/sections/payment-section/payouts/create-payout/create-payout-dialog.component.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { Component, Inject, OnInit } from '@angular/core'; -import { UntypedFormBuilder, Validators } from '@angular/forms'; -import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; -import { TranslocoService } from '@ngneat/transloco'; -import { NotifyLogService } from '@vality/ng-core'; -import { of } from 'rxjs'; - -import { ShopsDataService } from '@dsh/app/shared'; -import { amountValidator } from '@dsh/components/form-controls'; - -import { filterShopsByRealm, mapToShopInfo } from '../../operations/operators'; - -import { CreatePayoutDialogService } from './create-payout-dialog.service'; - -@Component({ - selector: 'dsh-create-payout-dialog', - templateUrl: 'create-payout-dialog.component.html', - providers: [CreatePayoutDialogService], -}) -export class CreatePayoutDialogComponent implements OnInit { - form = this.fb.group({ - shopID: null, - }); - - hasSelectedShop = false; - - currentPayoutToolCurrency: string; - - shopsInfo$ = of(this.data.realm).pipe( - filterShopsByRealm(this.shopsDataService.shops$), - mapToShopInfo, - ); - - isPayoutToolsLoading$ = this.createPayoutDialogService.isLoading$; - payoutTools$ = this.createPayoutDialogService.payoutTools$; - hasPayoutTools$ = this.createPayoutDialogService.hasPayoutTools$; - - constructor( - private dialogRef: MatDialogRef, - private fb: UntypedFormBuilder, - private createPayoutDialogService: CreatePayoutDialogService, - private log: NotifyLogService, - private transloco: TranslocoService, - private shopsDataService: ShopsDataService, - @Inject(MAT_DIALOG_DATA) private data: { realm: string }, - ) {} - - ngOnInit() { - this.createPayoutDialogService.payoutCreated$.subscribe(() => - this.dialogRef.close('created'), - ); - this.createPayoutDialogService.errorOccurred$.subscribe((err) => - this.log.error( - err, - this.transloco.selectTranslate( - 'payouts.errors.createError', - null, - 'payment-section', - ), - ), - ); - } - - cancel() { - this.dialogRef.close(); - } - - create(formValue: { shopID: string; payoutToolID: string; amount: number }) { - this.createPayoutDialogService.createPayout(formValue); - } - - onShopSelectionChange(shopID: string) { - this.hasSelectedShop = !!shopID; - if (this.hasSelectedShop) { - this.createPayoutDialogService.changeShopID(shopID); - this.form.addControl('payoutToolID', this.fb.control('', [Validators.required])); - this.form.addControl( - 'amount', - this.fb.control('', [Validators.required, amountValidator, Validators.min(1)]), - ); - } else { - this.form.removeControl('payoutToolID'); - this.form.removeControl('amount'); - } - } - - onPayoutToolSelectionChange(payoutToolCurrency: string) { - this.currentPayoutToolCurrency = payoutToolCurrency; - } -} diff --git a/src/app/sections/payment-section/payouts/create-payout/create-payout-dialog.service.ts b/src/app/sections/payment-section/payouts/create-payout/create-payout-dialog.service.ts deleted file mode 100644 index 6ddfcab3..00000000 --- a/src/app/sections/payment-section/payouts/create-payout/create-payout-dialog.service.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { Injectable } from '@angular/core'; -import { BehaviorSubject, forkJoin, merge, of, Subject } from 'rxjs'; -import { catchError, filter, map, shareReplay, switchMap, take, tap } from 'rxjs/operators'; - -import { PayoutsService } from '@dsh/app/api/payments'; -import { ShopsDataService } from '@dsh/app/shared'; - -import { toPayoutParams } from './to-payout-params'; - -@Injectable() -export class CreatePayoutDialogService { - private currentShopID$ = new Subject(); - - private create$ = new Subject<{ shopID: string; payoutToolID: string; amount: number }>(); - private loading$ = new BehaviorSubject(false); - private error$ = new Subject(); - private created$ = new Subject(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - isLoading$ = this.loading$.asObservable(); - // eslint-disable-next-line @typescript-eslint/member-ordering - errorOccurred$ = this.error$.asObservable(); - // eslint-disable-next-line @typescript-eslint/member-ordering - payoutCreated$ = this.created$.asObservable(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - payoutTools$ = this.currentShopID$.pipe( - switchMap((shopID) => - this.shopsDataService.shops$.pipe( - map((shops) => shops.find(({ id }) => id === shopID)), - ), - ), - switchMap(({ contractID }) => this.payoutsService.getPayoutToolsForParty({ contractID })), - map((tools) => - tools.filter((tool) => tool.details.detailsType === 'PayoutToolDetailsWalletInfo'), - ), - shareReplay(1), - ); - - // eslint-disable-next-line @typescript-eslint/member-ordering - hasPayoutTools$ = this.payoutTools$.pipe( - map((tools) => !!tools.length), - shareReplay(1), - ); - - constructor( - private shopsDataService: ShopsDataService, - private payoutsService: PayoutsService, - ) { - merge(this.payoutTools$, this.hasPayoutTools$).subscribe(); - this.create$ - .pipe( - tap(() => { - this.loading$.next(true); - this.created$.next(false); - }), - switchMap((params) => - forkJoin([ - of(params), - this.shopsDataService.shops$.pipe( - take(1), - map((shops) => shops.find(({ id }) => id === params.shopID)?.currency), - ), - ]), - ), - map(([params, currency]) => toPayoutParams(params, currency)), - switchMap((payoutParams) => - this.payoutsService.createPayout({ payoutParams }).pipe( - catchError((e) => { - console.error(e); - this.loading$.next(false); - this.error$.next(); - return of('error'); - }), - ), - ), - filter((result) => result !== 'error'), - ) - .subscribe(() => { - this.loading$.next(false); - this.created$.next(true); - }); - } - - changeShopID(id: string) { - this.currentShopID$.next(id); - } - - createPayout(formValue: { shopID: string; payoutToolID: string; amount: number }) { - this.create$.next(formValue); - } -} diff --git a/src/app/sections/payment-section/payouts/create-payout/create-payout.module.ts b/src/app/sections/payment-section/payouts/create-payout/create-payout.module.ts deleted file mode 100644 index 90244c80..00000000 --- a/src/app/sections/payment-section/payouts/create-payout/create-payout.module.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { ReactiveFormsModule } from '@angular/forms'; -import { MatDialogModule } from '@angular/material/dialog'; -import { MatInputModule } from '@angular/material/input'; -import { MatSelectModule } from '@angular/material/select'; -import { MatSnackBarModule } from '@angular/material/snack-bar'; -import { TranslocoModule } from '@ngneat/transloco'; -import { FlexLayoutModule } from 'ng-flex-layout'; - -import { BaseDialogModule } from '@dsh/app/shared/components/dialog/base-dialog'; -import { ApiModelTypesModule } from '@dsh/app/shared/pipes'; -import { ButtonModule } from '@dsh/components/buttons'; -import { FormatInputModule } from '@dsh/components/form-controls'; -import { SpinnerModule } from '@dsh/components/indicators'; - -import { CreatePayoutDialogComponent } from './create-payout-dialog.component'; - -@NgModule({ - imports: [ - CommonModule, - TranslocoModule, - MatSnackBarModule, - MatDialogModule, - FlexLayoutModule, - ButtonModule, - MatInputModule, - ReactiveFormsModule, - MatSelectModule, - SpinnerModule, - FormatInputModule, - ApiModelTypesModule, - BaseDialogModule, - ], - declarations: [CreatePayoutDialogComponent], -}) -export class CreatePayoutModule {} diff --git a/src/app/sections/payment-section/payouts/create-payout/index.ts b/src/app/sections/payment-section/payouts/create-payout/index.ts deleted file mode 100644 index 73cc38e3..00000000 --- a/src/app/sections/payment-section/payouts/create-payout/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './create-payout.module'; diff --git a/src/app/sections/payment-section/payouts/create-payout/to-payout-params.ts b/src/app/sections/payment-section/payouts/create-payout/to-payout-params.ts deleted file mode 100644 index f8dd5190..00000000 --- a/src/app/sections/payment-section/payouts/create-payout/to-payout-params.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { toMinor } from '@vality/ng-core'; -import { PayoutParams } from '@vality/swag-payments'; -import { v4 as uuid } from 'uuid'; - -export const toPayoutParams = ( - { shopID, payoutToolID, amount }: { shopID: string; payoutToolID: string; amount: number }, - currency: string, -): PayoutParams => { - return { - id: uuid(), - shopID, - payoutToolID, - amount: toMinor(amount, currency), - currency, - }; -}; diff --git a/src/app/sections/payment-section/payouts/fetch-payouts.service.ts b/src/app/sections/payment-section/payouts/fetch-payouts.service.ts deleted file mode 100644 index 5125c5a0..00000000 --- a/src/app/sections/payment-section/payouts/fetch-payouts.service.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Payout } from '@vality/swag-anapi-v2'; -import { Observable } from 'rxjs'; -import { shareReplay } from 'rxjs/operators'; - -import { SearchService } from '@dsh/app/api/anapi'; -import { mapToTimestamp } from '@dsh/app/custom-operators'; -import { PartialFetcher } from '@dsh/app/shared'; - -import { SearchParams } from './types/search-params'; - -@Injectable() -export class FetchPayoutsService extends PartialFetcher { - isLoading$: Observable = this.doAction$.pipe(shareReplay(1)); - lastUpdated$: Observable = this.searchResult$.pipe(mapToTimestamp, shareReplay(1)); - - constructor(private searchService: SearchService) { - super(); - } - - protected fetch( - { fromTime, toTime, realm, ...restParams }: SearchParams, - continuationToken: string, - ) { - return this.searchService.searchPayouts({ - ...restParams, - fromTime, - toTime, - limit: 10, - paymentInstitutionRealm: realm, - continuationToken, - }); - } -} diff --git a/src/app/sections/payment-section/payouts/index.ts b/src/app/sections/payment-section/payouts/index.ts deleted file mode 100644 index cd12203b..00000000 --- a/src/app/sections/payment-section/payouts/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './payouts.module'; -export * from './payouts.component'; diff --git a/src/app/sections/payment-section/payouts/payouts-details/index.ts b/src/app/sections/payment-section/payouts/payouts-details/index.ts deleted file mode 100644 index a8794206..00000000 --- a/src/app/sections/payment-section/payouts/payouts-details/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './payouts-details.module'; diff --git a/src/app/sections/payment-section/payouts/payouts-details/payout-actions/index.ts b/src/app/sections/payment-section/payouts/payouts-details/payout-actions/index.ts deleted file mode 100644 index 3ed70482..00000000 --- a/src/app/sections/payment-section/payouts/payouts-details/payout-actions/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './payout-actions.component'; diff --git a/src/app/sections/payment-section/payouts/payouts-details/payout-actions/payout-actions.component.html b/src/app/sections/payment-section/payouts/payouts-details/payout-actions/payout-actions.component.html deleted file mode 100644 index c2d96841..00000000 --- a/src/app/sections/payment-section/payouts/payouts-details/payout-actions/payout-actions.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
-
{{ t('actions') }}
-
- -
-
diff --git a/src/app/sections/payment-section/payouts/payouts-details/payout-actions/payout-actions.component.ts b/src/app/sections/payment-section/payouts/payouts-details/payout-actions/payout-actions.component.ts deleted file mode 100644 index 19cde8ff..00000000 --- a/src/app/sections/payment-section/payouts/payouts-details/payout-actions/payout-actions.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ChangeDetectionStrategy, Component, EventEmitter, Output } from '@angular/core'; - -@Component({ - selector: 'dsh-payout-actions', - templateUrl: 'payout-actions.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PayoutActionsComponent { - @Output() createReport: EventEmitter = new EventEmitter(); -} diff --git a/src/app/sections/payment-section/payouts/payouts-details/payout-main-info/index.ts b/src/app/sections/payment-section/payouts/payouts-details/payout-main-info/index.ts deleted file mode 100644 index dc195c4e..00000000 --- a/src/app/sections/payment-section/payouts/payouts-details/payout-main-info/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './payout-main-info.component'; diff --git a/src/app/sections/payment-section/payouts/payouts-details/payout-main-info/payout-main-info.component.html b/src/app/sections/payment-section/payouts/payouts-details/payout-main-info/payout-main-info.component.html deleted file mode 100644 index 7d6ee24a..00000000 --- a/src/app/sections/payment-section/payouts/payouts-details/payout-main-info/payout-main-info.component.html +++ /dev/null @@ -1,13 +0,0 @@ -
-
- {{ payout?.amount | amountCurrency: payout?.currency }} -
- - {{ payout?.shopID | shopDetails }} - -
diff --git a/src/app/sections/payment-section/payouts/payouts-details/payout-main-info/payout-main-info.component.ts b/src/app/sections/payment-section/payouts/payouts-details/payout-main-info/payout-main-info.component.ts deleted file mode 100644 index 8cb541df..00000000 --- a/src/app/sections/payment-section/payouts/payouts-details/payout-main-info/payout-main-info.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { Payout } from '@vality/swag-anapi-v2'; - -@Component({ - selector: 'dsh-payout-main-info', - templateUrl: 'payout-main-info.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PayoutMainInfoComponent { - @Input() payout: Payout; -} diff --git a/src/app/sections/payment-section/payouts/payouts-details/payouts-details.component.html b/src/app/sections/payment-section/payouts/payouts-details/payouts-details.component.html deleted file mode 100644 index ef945feb..00000000 --- a/src/app/sections/payment-section/payouts/payouts-details/payouts-details.component.html +++ /dev/null @@ -1,13 +0,0 @@ -
- - -
- {{ payout?.payoutToolDetails?.detailsType | payoutToolDetailsType | async }} -
- - - - -
diff --git a/src/app/sections/payment-section/payouts/payouts-details/payouts-details.component.ts b/src/app/sections/payment-section/payouts/payouts-details/payouts-details.component.ts deleted file mode 100644 index baae6be9..00000000 --- a/src/app/sections/payment-section/payouts/payouts-details/payouts-details.component.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; -import { Payout } from '@vality/swag-anapi-v2'; - -@Component({ - selector: 'dsh-payouts-details', - templateUrl: 'payouts-details.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PayoutsDetailsComponent { - @Input() payout: Payout; - @Output() createPayoutReport: EventEmitter = new EventEmitter(); - - createReport(): void { - this.createPayoutReport.emit(this.payout); - } -} diff --git a/src/app/sections/payment-section/payouts/payouts-details/payouts-details.module.ts b/src/app/sections/payment-section/payouts/payouts-details/payouts-details.module.ts deleted file mode 100644 index 9b746ada..00000000 --- a/src/app/sections/payment-section/payouts/payouts-details/payouts-details.module.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { MatDividerModule } from '@angular/material/divider'; -import { MatSnackBarModule } from '@angular/material/snack-bar'; -import { TranslocoModule } from '@ngneat/transloco'; -import { FlexLayoutModule } from 'ng-flex-layout'; - -import { PayoutToolDetailsModule } from '@dsh/app/shared/components'; -import { - ApiModelRefsModule, - ApiModelTypesModule, - AmountCurrencyModule, -} from '@dsh/app/shared/pipes'; -import { ButtonModule } from '@dsh/components/buttons'; -import { IndicatorsModule } from '@dsh/components/indicators'; -import { LayoutModule } from '@dsh/components/layout'; - -import { CreatePayoutReportModule } from '../create-payout-report'; - -import { PayoutActionsComponent } from './payout-actions'; -import { PayoutMainInfoComponent } from './payout-main-info'; -import { PayoutsDetailsComponent } from './payouts-details.component'; - -@NgModule({ - imports: [ - TranslocoModule, - LayoutModule, - ButtonModule, - FlexLayoutModule, - CommonModule, - MatSnackBarModule, - MatDividerModule, - IndicatorsModule, - ApiModelRefsModule, - - CreatePayoutReportModule, - PayoutToolDetailsModule, - ApiModelTypesModule, - AmountCurrencyModule, - ], - declarations: [PayoutsDetailsComponent, PayoutActionsComponent, PayoutMainInfoComponent], - exports: [PayoutsDetailsComponent], -}) -export class PayoutsDetailsModule {} diff --git a/src/app/sections/payment-section/payouts/payouts-expanded-id-manager.service.ts b/src/app/sections/payment-section/payouts/payouts-expanded-id-manager.service.ts deleted file mode 100644 index 800272d5..00000000 --- a/src/app/sections/payment-section/payouts/payouts-expanded-id-manager.service.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Injectable } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { Payout } from '@vality/swag-anapi-v2'; -import { Observable } from 'rxjs'; - -import { ExpandedIdManager } from '@dsh/app/shared/services'; - -import { FetchPayoutsService } from './fetch-payouts.service'; - -@Injectable() -export class PayoutsExpandedIdManager extends ExpandedIdManager { - constructor( - protected route: ActivatedRoute, - protected router: Router, - private fetchPayoutsService: FetchPayoutsService, - ) { - super(route, router); - } - - protected fragmentNotFound(): void { - this.fetchPayoutsService.fetchMore(); - } - - protected get dataSet$(): Observable { - return this.fetchPayoutsService.searchResult$; - } -} diff --git a/src/app/sections/payment-section/payouts/payouts-list/index.ts b/src/app/sections/payment-section/payouts/payouts-list/index.ts deleted file mode 100644 index 92aa8185..00000000 --- a/src/app/sections/payment-section/payouts/payouts-list/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './payouts-list.component'; -export * from './payouts-list.module'; diff --git a/src/app/sections/payment-section/payouts/payouts-list/payout-row-header/index.ts b/src/app/sections/payment-section/payouts/payouts-list/payout-row-header/index.ts deleted file mode 100644 index 50387b75..00000000 --- a/src/app/sections/payment-section/payouts/payouts-list/payout-row-header/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './payout-row-header.component'; diff --git a/src/app/sections/payment-section/payouts/payouts-list/payout-row-header/payout-row-header.component.html b/src/app/sections/payment-section/payouts/payouts-list/payout-row-header/payout-row-header.component.html deleted file mode 100644 index 9a8bc68b..00000000 --- a/src/app/sections/payment-section/payouts/payouts-list/payout-row-header/payout-row-header.component.html +++ /dev/null @@ -1,12 +0,0 @@ - - {{ t('createdAt') }} - {{ t('amount') }} - {{ t('payoutTool') }} - {{ t('shop') }} - diff --git a/src/app/sections/payment-section/payouts/payouts-list/payout-row-header/payout-row-header.component.ts b/src/app/sections/payment-section/payouts/payouts-list/payout-row-header/payout-row-header.component.ts deleted file mode 100644 index d2983c81..00000000 --- a/src/app/sections/payment-section/payouts/payouts-list/payout-row-header/payout-row-header.component.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core'; - -@Component({ - selector: 'dsh-payout-row-header', - templateUrl: 'payout-row-header.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PayoutRowHeaderComponent {} diff --git a/src/app/sections/payment-section/payouts/payouts-list/payout-row/index.ts b/src/app/sections/payment-section/payouts/payouts-list/payout-row/index.ts deleted file mode 100644 index 8afa7b56..00000000 --- a/src/app/sections/payment-section/payouts/payouts-list/payout-row/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './payout-row.component'; diff --git a/src/app/sections/payment-section/payouts/payouts-list/payout-row/payout-row.component.html b/src/app/sections/payment-section/payouts/payouts-list/payout-row/payout-row.component.html deleted file mode 100644 index 17f64da6..00000000 --- a/src/app/sections/payment-section/payouts/payouts-list/payout-row/payout-row.component.html +++ /dev/null @@ -1,19 +0,0 @@ - - - {{ payout.createdAt | date: 'dd MMMM yyyy, HH:mm' }} - - - {{ payout.amount | amountCurrency: payout.currency }} - - {{ - payout?.payoutToolDetails?.detailsType | payoutToolDetailsType | async - }} - - {{ payout.shopID | shopDetails }} - - diff --git a/src/app/sections/payment-section/payouts/payouts-list/payout-row/payout-row.component.ts b/src/app/sections/payment-section/payouts/payouts-list/payout-row/payout-row.component.ts deleted file mode 100644 index 2bc328b3..00000000 --- a/src/app/sections/payment-section/payouts/payouts-list/payout-row/payout-row.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { Payout } from '@vality/swag-anapi-v2'; - -@Component({ - selector: 'dsh-payout-row', - templateUrl: 'payout-row.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PayoutRowComponent { - @Input() payout: Payout; -} diff --git a/src/app/sections/payment-section/payouts/payouts-list/payouts-list.component.html b/src/app/sections/payment-section/payouts/payouts-list/payouts-list.component.html deleted file mode 100644 index 4cb19b73..00000000 --- a/src/app/sections/payment-section/payouts/payouts-list/payouts-list.component.html +++ /dev/null @@ -1,31 +0,0 @@ -
- - - - - - - - {{ t('payoutID', { num: payout.id }) }} - - - - - -
diff --git a/src/app/sections/payment-section/payouts/payouts-list/payouts-list.component.ts b/src/app/sections/payment-section/payouts/payouts-list/payouts-list.component.ts deleted file mode 100644 index 7ca5c02a..00000000 --- a/src/app/sections/payment-section/payouts/payouts-list/payouts-list.component.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; -import { Payout } from '@vality/swag-anapi-v2'; - -import { CreatePayoutReportService } from '../create-payout-report'; - -@Component({ - selector: 'dsh-payouts-list', - templateUrl: 'payouts-list.component.html', -}) -export class PayoutsListComponent implements OnInit, OnDestroy { - @Input() payouts: Payout[]; - @Input() expandedId: number; - @Input() lastUpdated: string; - @Output() expandedIdChange: EventEmitter = new EventEmitter(); - @Output() refreshData: EventEmitter = new EventEmitter(); - - constructor(private createPayoutReportService: CreatePayoutReportService) {} - - createPayoutReport(payout: Payout) { - this.createPayoutReportService.createPayoutReport(payout); - } - - ngOnInit() { - this.createPayoutReportService.init(); - } - - ngOnDestroy(): void { - this.createPayoutReportService.destroy(); - } -} diff --git a/src/app/sections/payment-section/payouts/payouts-list/payouts-list.module.ts b/src/app/sections/payment-section/payouts/payouts-list/payouts-list.module.ts deleted file mode 100644 index 91b4d000..00000000 --- a/src/app/sections/payment-section/payouts/payouts-list/payouts-list.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { MatSnackBarModule } from '@angular/material/snack-bar'; -import { TranslocoModule } from '@ngneat/transloco'; -import { FlexLayoutModule } from 'ng-flex-layout'; - -import { - ApiModelRefsModule, - ApiModelTypesModule, - AmountCurrencyModule, -} from '@dsh/app/shared/pipes'; -import { IndicatorsModule } from '@dsh/components/indicators'; -import { LayoutModule } from '@dsh/components/layout'; - -import { PayoutsDetailsModule } from '../payouts-details'; - -import { PayoutRowComponent } from './payout-row'; -import { PayoutRowHeaderComponent } from './payout-row-header'; -import { PayoutsListComponent } from './payouts-list.component'; - -@NgModule({ - imports: [ - TranslocoModule, - MatSnackBarModule, - LayoutModule, - FlexLayoutModule, - CommonModule, - IndicatorsModule, - PayoutsDetailsModule, - - ApiModelTypesModule, - ApiModelRefsModule, - AmountCurrencyModule, - ], - declarations: [PayoutsListComponent, PayoutRowHeaderComponent, PayoutRowComponent], - exports: [PayoutsListComponent], -}) -export class PayoutsListModule {} diff --git a/src/app/sections/payment-section/payouts/payouts-routing.module.ts b/src/app/sections/payment-section/payouts/payouts-routing.module.ts deleted file mode 100644 index d7d69966..00000000 --- a/src/app/sections/payment-section/payouts/payouts-routing.module.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; - -import { PayoutsComponent } from './payouts.component'; - -const ROUTES: Routes = [ - { - path: '', - component: PayoutsComponent, - }, -]; - -@NgModule({ - imports: [RouterModule.forChild(ROUTES)], - exports: [RouterModule], -}) -export class PayoutsRoutingModule {} diff --git a/src/app/sections/payment-section/payouts/payouts-search-filters/index.ts b/src/app/sections/payment-section/payouts/payouts-search-filters/index.ts deleted file mode 100644 index c11399b7..00000000 --- a/src/app/sections/payment-section/payouts/payouts-search-filters/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './payouts-search-filters.module'; diff --git a/src/app/sections/payment-section/payouts/payouts-search-filters/payouts-search-filters.component.html b/src/app/sections/payment-section/payouts/payouts-search-filters/payouts-search-filters.component.html deleted file mode 100644 index 6e7cf8e0..00000000 --- a/src/app/sections/payment-section/payouts/payouts-search-filters/payouts-search-filters.component.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/src/app/sections/payment-section/payouts/payouts-search-filters/payouts-search-filters.component.ts b/src/app/sections/payment-section/payouts/payouts-search-filters/payouts-search-filters.component.ts deleted file mode 100644 index 65df4ea4..00000000 --- a/src/app/sections/payment-section/payouts/payouts-search-filters/payouts-search-filters.component.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { - ChangeDetectionStrategy, - Component, - EventEmitter, - Input, - OnChanges, - OnInit, - Output, -} from '@angular/core'; -import { FormBuilder } from '@angular/forms'; -import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; -import { ComponentChanges } from '@vality/ng-core'; -import { Shop } from '@vality/swag-payments'; - -import { - createDateRangeWithPreset, - DateRangeWithPreset, - Preset, -} from '@dsh/components/date-range-filter'; -import { getFormValueChanges } from '@dsh/utils'; - -import { SearchParams } from '../types/search-params'; - -export interface Filters { - shopIDs: Shop['id'][]; - dateRange: DateRangeWithPreset; -} - -@UntilDestroy() -@Component({ - selector: 'dsh-payouts-search-filters', - templateUrl: 'payouts-search-filters.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PayoutsSearchFiltersComponent implements OnInit, OnChanges { - @Input() initParams: SearchParams; - @Input() shops: Shop[]; - @Output() searchParamsChanges = new EventEmitter(); - - defaultDateRange = createDateRangeWithPreset(Preset.Last90days); - form = this.fb.group({ shopIDs: null, dateRange: this.defaultDateRange }); - - constructor(private fb: FormBuilder) {} - - ngOnInit(): void { - getFormValueChanges(this.form) - .pipe(untilDestroyed(this)) - .subscribe((filters) => this.searchParamsChanges.next(filters as unknown as Filters)); - } - - ngOnChanges({ initParams }: ComponentChanges): void { - if (initParams?.firstChange && initParams.currentValue) { - this.form.patchValue(initParams.currentValue as unknown); - } - } -} diff --git a/src/app/sections/payment-section/payouts/payouts-search-filters/payouts-search-filters.module.ts b/src/app/sections/payment-section/payouts/payouts-search-filters/payouts-search-filters.module.ts deleted file mode 100644 index e2ec54fa..00000000 --- a/src/app/sections/payment-section/payouts/payouts-search-filters/payouts-search-filters.module.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { ReactiveFormsModule } from '@angular/forms'; -import { FlexLayoutModule } from 'ng-flex-layout'; - -import { ShopsFilterModule } from '@dsh/app/shared/components/filters/shops-filter'; -import { DateRangeFilterModule } from '@dsh/components/date-range-filter'; -import { FiltersGroupModule } from '@dsh/components/filters-group'; - -import { PayoutsSearchFiltersComponent } from './payouts-search-filters.component'; - -@NgModule({ - imports: [ - CommonModule, - FlexLayoutModule, - ShopsFilterModule, - ReactiveFormsModule, - FiltersGroupModule, - DateRangeFilterModule, - ], - exports: [PayoutsSearchFiltersComponent], - declarations: [PayoutsSearchFiltersComponent], -}) -export class PayoutsSearchFiltersModule {} diff --git a/src/app/sections/payment-section/payouts/payouts.component.html b/src/app/sections/payment-section/payouts/payouts.component.html deleted file mode 100644 index 6e600371..00000000 --- a/src/app/sections/payment-section/payouts/payouts.component.html +++ /dev/null @@ -1,42 +0,0 @@ -
-
- - -
-
- - -
- - -
- diff --git a/src/app/sections/payment-section/payouts/payouts.component.ts b/src/app/sections/payment-section/payouts/payouts.component.ts deleted file mode 100644 index 77ebfc85..00000000 --- a/src/app/sections/payment-section/payouts/payouts.component.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; -import { MatDialog } from '@angular/material/dialog'; -import { TranslocoService } from '@ngneat/transloco'; -import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; -import { NotifyLogService, QueryParamsService } from '@vality/ng-core'; -import { Subject } from 'rxjs'; -import { filter, first, switchMap, switchMapTo } from 'rxjs/operators'; - -import { RealmMixService, PaymentInstitutionRealmService, RealmShopsService } from '../services'; - -import { CreatePayoutDialogComponent } from './create-payout/create-payout-dialog.component'; -import { FetchPayoutsService } from './fetch-payouts.service'; -import { PayoutsExpandedIdManager } from './payouts-expanded-id-manager.service'; -import { Filters } from './payouts-search-filters/payouts-search-filters.component'; -import { SearchParams } from './types/search-params'; - -@UntilDestroy() -@Component({ - selector: 'dsh-payouts', - templateUrl: 'payouts.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - providers: [FetchPayoutsService, PayoutsExpandedIdManager, RealmMixService], -}) -export class PayoutsComponent implements OnInit { - payouts$ = this.fetchPayoutsService.searchResult$; - isLoading$ = this.fetchPayoutsService.isLoading$; - hasMore$ = this.fetchPayoutsService.hasMore$; - lastUpdated$ = this.fetchPayoutsService.lastUpdated$; - expandedId$ = this.payoutsExpandedIdManager.expandedId$; - params$ = this.qp.params$; - fetchErrors$ = this.fetchPayoutsService.errors$; - shops$ = this.realmShopsService.shops$; - - private createPayout$ = new Subject(); - - constructor( - private fetchPayoutsService: FetchPayoutsService, - private payoutsExpandedIdManager: PayoutsExpandedIdManager, - private log: NotifyLogService, - private transloco: TranslocoService, - private realmService: PaymentInstitutionRealmService, - private qp: QueryParamsService, - private dialog: MatDialog, - private realmShopsService: RealmShopsService, - private realmMixService: RealmMixService, - ) {} - - ngOnInit(): void { - this.fetchPayoutsService.errors$ - .pipe(untilDestroyed(this)) - .subscribe((err) => - this.log.error( - err, - this.transloco.selectTranslate('shared.httpError', null, 'components'), - ), - ); - this.realmMixService.mixedValue$ - .pipe(untilDestroyed(this)) - .subscribe((v) => this.fetchPayoutsService.search(v)); - this.createPayout$ - .pipe( - switchMapTo(this.realmService.realm$.pipe(first())), - switchMap((realm) => - this.dialog - .open(CreatePayoutDialogComponent, { data: { realm } }) - .afterClosed() - .pipe(filter((r) => r === 'created')), - ), - untilDestroyed(this), - ) - .subscribe(() => { - this.log.success( - this.transloco.selectTranslate( - 'payouts.payouts.created', - null, - 'payment-section', - ), - ); - this.refresh(); - }); - } - - createPayout(): void { - this.createPayout$.next(); - } - - searchParamsChanges(p: Filters): void { - void this.qp.set(p); - const { dateRange, ...otherParams } = p; - this.realmMixService.mix({ - fromTime: dateRange.start.clone().utc().format(), - toTime: dateRange.end.clone().utc().format(), - realm: null, - ...otherParams, - }); - } - - expandedIdChange(id: number): void { - this.payoutsExpandedIdManager.expandedIdChange(id); - } - - fetchMore(): void { - this.fetchPayoutsService.fetchMore(); - } - - refresh(): void { - this.fetchPayoutsService.refresh(); - } -} diff --git a/src/app/sections/payment-section/payouts/payouts.module.ts b/src/app/sections/payment-section/payouts/payouts.module.ts deleted file mode 100644 index d93e43ea..00000000 --- a/src/app/sections/payment-section/payouts/payouts.module.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { MatCommonModule, MatOptionModule } from '@angular/material/core'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatSelectModule } from '@angular/material/select'; -import { TranslocoModule } from '@ngneat/transloco'; -import { FlexLayoutModule } from 'ng-flex-layout'; - -import { ApiModelTypesModule } from '@dsh/app/shared/pipes'; -import { ButtonModule } from '@dsh/components/buttons'; -import { DateRangeFilterModule } from '@dsh/components/date-range-filter'; -import { EmptySearchResultModule } from '@dsh/components/empty-search-result'; -import { FormatInputModule } from '@dsh/components/form-controls'; -import { SpinnerModule } from '@dsh/components/indicators'; -import { LayoutModule } from '@dsh/components/layout'; -import { ScrollUpModule } from '@dsh/components/navigation'; -import { ShowMorePanelModule } from '@dsh/components/show-more-panel'; - -import { CreatePayoutModule } from './create-payout'; -import { PayoutsListModule } from './payouts-list'; -import { PayoutsRoutingModule } from './payouts-routing.module'; -import { PayoutsSearchFiltersModule } from './payouts-search-filters'; -import { PayoutsComponent } from './payouts.component'; - -@NgModule({ - imports: [ - PayoutsRoutingModule, - MatCommonModule, - FlexLayoutModule, - ButtonModule, - TranslocoModule, - ReactiveFormsModule, - FormsModule, - LayoutModule, - MatFormFieldModule, - MatOptionModule, - CommonModule, - MatSelectModule, - MatInputModule, - SpinnerModule, - ScrollUpModule, - ShowMorePanelModule, - FormatInputModule, - ApiModelTypesModule, - PayoutsSearchFiltersModule, - PayoutsListModule, - EmptySearchResultModule, - CreatePayoutModule, - DateRangeFilterModule, - ], - declarations: [PayoutsComponent], - exports: [PayoutsComponent], -}) -export class PayoutsModule {} diff --git a/src/app/sections/payment-section/payouts/types/search-params.ts b/src/app/sections/payment-section/payouts/types/search-params.ts deleted file mode 100644 index 68c5f941..00000000 --- a/src/app/sections/payment-section/payouts/types/search-params.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PaymentInstitution } from '@vality/swag-payments'; - -import RealmEnum = PaymentInstitution.RealmEnum; - -export interface SearchParams { - fromTime: string; - toTime: string; - realm: RealmEnum; - shopIDs?: string[]; -} diff --git a/src/app/sections/payment-section/shops/services/shop-payout-tool-details/shop-payout-tool-details.service.spec.ts b/src/app/sections/payment-section/shops/services/shop-payout-tool-details/shop-payout-tool-details.service.spec.ts deleted file mode 100644 index 0f088db3..00000000 --- a/src/app/sections/payment-section/shops/services/shop-payout-tool-details/shop-payout-tool-details.service.spec.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { TestBed } from '@angular/core/testing'; -import { PayoutTool } from '@vality/swag-payments'; -import { cold } from 'jasmine-marbles'; -import { of } from 'rxjs'; -import { map, take } from 'rxjs/operators'; -import { instance, mock, when } from 'ts-mockito'; - -import { PayoutsService } from '@dsh/app/api/payouts'; - -import { ShopPayoutToolDetailsService } from './shop-payout-tool-details.service'; - -describe('ShopPayoutToolDetailsService', () => { - let service: ShopPayoutToolDetailsService; - let mockPayoutsService: PayoutsService; - - beforeEach(() => { - mockPayoutsService = mock(PayoutsService); - }); - - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [ - ShopPayoutToolDetailsService, - { - provide: PayoutsService, - useFactory: () => instance(mockPayoutsService), - }, - ], - }); - service = TestBed.inject(ShopPayoutToolDetailsService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); - - describe('getContract', () => { - it('should tick contract value if contracts came with no errors', () => { - // can't test it with cold/hot marbles cause it's an subject - service.shopPayoutTool$.pipe(take(1)).subscribe((data: PayoutTool) => { - expect(data).toEqual({ - currency: 'USD', - details: { - detailsType: 'any', - }, - id: 'my_id', - }); - }); - - when(mockPayoutsService.getPayoutToolByID('contract_id', 'payout_tool_id')).thenReturn( - of({ - currency: 'USD', - details: { - detailsType: 'any', - }, - id: 'my_id', - }), - ); - - service.requestPayoutTool({ - contractID: 'contract_id', - payoutToolID: 'payout_tool_id', - }); - - expect().nothing(); - }); - - it('should tick errors value if contracts came with errors', () => { - when(mockPayoutsService.getPayoutToolByID('contract_id', 'payout_tool_id')).thenReturn( - of(null).pipe( - map(() => { - throw new Error(`[TEST_ERROR]: Error in observable`); - }), - ), - ); - - service.requestPayoutTool({ - contractID: 'contract_id', - payoutToolID: 'payout_tool_id', - }); - - expect(service.errorOccurred$).toBeObservable( - cold('a', { - a: true, - }), - ); - }); - }); -}); diff --git a/src/app/sections/payment-section/shops/services/shop-payout-tool-details/shop-payout-tool-details.service.ts b/src/app/sections/payment-section/shops/services/shop-payout-tool-details/shop-payout-tool-details.service.ts deleted file mode 100644 index af9e7001..00000000 --- a/src/app/sections/payment-section/shops/services/shop-payout-tool-details/shop-payout-tool-details.service.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Injectable } from '@angular/core'; -import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; -import { PayoutTool } from '@vality/swag-payments'; -import { BehaviorSubject, defer, Observable, of, ReplaySubject, Subject } from 'rxjs'; -import { catchError, distinctUntilChanged, filter, switchMap, tap } from 'rxjs/operators'; - -import { PayoutsService } from '@dsh/app/api/payments'; - -import { PayoutToolParams } from '../../shops-list/shop-details/types/payout-tool-params'; - -@UntilDestroy() -@Injectable() -export class ShopPayoutToolDetailsService { - shopPayoutTool$: Observable; - errorOccurred$: Observable; - isLoading$ = defer(() => this._isLoading$.asObservable()); - - private getPayoutTool$ = new Subject(); - private error$ = new BehaviorSubject(false); - private payoutTool$ = new ReplaySubject(1); - private _isLoading$ = new BehaviorSubject(false); - - constructor(private payoutsService: PayoutsService) { - this.shopPayoutTool$ = this.payoutTool$.asObservable(); - this.errorOccurred$ = this.error$.asObservable(); - - this.getPayoutTool$ - .pipe( - tap(() => this.error$.next(false)), - distinctUntilChanged(), - tap(() => this._isLoading$.next(true)), - switchMap((payoutToolParams) => - payoutToolParams - ? this.payoutsService - .getPayoutToolByIDForParty({ - contractID: payoutToolParams.contractID, - payoutToolID: payoutToolParams.payoutToolID, - }) - .pipe( - catchError((e) => { - console.error(e); - this.error$.next(true); - return of('error'); - }), - ) - : of(null), - ), - tap(() => this._isLoading$.next(false)), - filter((result) => result !== 'error'), - untilDestroyed(this), - ) - .subscribe((payoutTool: PayoutTool) => { - this.payoutTool$.next(payoutTool); - }); - } - - requestPayoutTool(params: PayoutToolParams): void { - this.getPayoutTool$.next(params); - } -} diff --git a/src/app/sections/payment-section/shops/shops-list/shop-details/components/shop-payout-tool-details/shop-payout-tool-details.component.html b/src/app/sections/payment-section/shops/shops-list/shop-details/components/shop-payout-tool-details/shop-payout-tool-details.component.html deleted file mode 100644 index c4c26f32..00000000 --- a/src/app/sections/payment-section/shops/shops-list/shop-details/components/shop-payout-tool-details/shop-payout-tool-details.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
-
{{ t('title') }}
- -
{{ t('error') }}
-
diff --git a/src/app/sections/payment-section/shops/shops-list/shop-details/components/shop-payout-tool-details/shop-payout-tool-details.component.spec.ts b/src/app/sections/payment-section/shops/shops-list/shop-details/components/shop-payout-tool-details/shop-payout-tool-details.component.spec.ts deleted file mode 100644 index 4a78cce5..00000000 --- a/src/app/sections/payment-section/shops/shops-list/shop-details/components/shop-payout-tool-details/shop-payout-tool-details.component.spec.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { ChangeDetectionStrategy } from '@angular/core'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { deepEqual, instance, mock, verify, when } from 'ts-mockito'; - -import { getTranslocoModule } from '@dsh/app/shared/tests/get-transloco-module'; - -import { ShopPayoutToolDetailsService } from '../../../../services/shop-payout-tool-details/shop-payout-tool-details.service'; - -import { ShopPayoutToolDetailsComponent } from './shop-payout-tool-details.component'; - -describe('ShopPayoutToolDetailsComponent', () => { - let component: ShopPayoutToolDetailsComponent; - let fixture: ComponentFixture; - let mockPayoutsService: ShopPayoutToolDetailsService; - - beforeEach(() => { - mockPayoutsService = mock(ShopPayoutToolDetailsService); - }); - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [getTranslocoModule()], - declarations: [ShopPayoutToolDetailsComponent], - providers: [ - { - provide: ShopPayoutToolDetailsService, - useFactory: () => instance(mockPayoutsService), - }, - ], - }) - .overrideComponent(ShopPayoutToolDetailsComponent, { - set: { - providers: [], - changeDetection: ChangeDetectionStrategy.Default, - }, - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(ShopPayoutToolDetailsComponent); - component = fixture.componentInstance; - - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); - - describe('contractID', () => { - it('should call getContract on id change', () => { - when( - mockPayoutsService.requestPayoutTool( - deepEqual({ - contractID: 'my_contract_id', - payoutToolID: 'my_payout_tool_id', - }), - ), - ).thenReturn(); - - component.payoutToolParams = { - contractID: 'my_contract_id', - payoutToolID: 'my_payout_tool_id', - }; - - verify( - mockPayoutsService.requestPayoutTool( - deepEqual({ - contractID: 'my_contract_id', - payoutToolID: 'my_payout_tool_id', - }), - ), - ).once(); - expect().nothing(); - }); - }); -}); diff --git a/src/app/sections/payment-section/shops/shops-list/shop-details/components/shop-payout-tool-details/shop-payout-tool-details.component.ts b/src/app/sections/payment-section/shops/shops-list/shop-details/components/shop-payout-tool-details/shop-payout-tool-details.component.ts deleted file mode 100644 index 5995631a..00000000 --- a/src/app/sections/payment-section/shops/shops-list/shop-details/components/shop-payout-tool-details/shop-payout-tool-details.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; - -import { ShopPayoutToolDetailsService } from '../../../../services/shop-payout-tool-details/shop-payout-tool-details.service'; -import { PayoutToolParams } from '../../types/payout-tool-params'; - -@Component({ - selector: 'dsh-shop-payout-tool-details', - templateUrl: 'shop-payout-tool-details.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - providers: [ShopPayoutToolDetailsService], -}) -export class ShopPayoutToolDetailsComponent { - @Input() - set payoutToolParams(p: PayoutToolParams) { - this.shopPayoutToolDetailsService.requestPayoutTool(p); - } - - payoutTool$ = this.shopPayoutToolDetailsService.shopPayoutTool$; - errorOccurred$ = this.shopPayoutToolDetailsService.errorOccurred$; - - constructor(private shopPayoutToolDetailsService: ShopPayoutToolDetailsService) {} -} diff --git a/src/app/sections/payment-section/shops/shops-list/shop-details/shop-details.component.html b/src/app/sections/payment-section/shops/shops-list/shop-details/shop-details.component.html index 96a098e1..932ba5d7 100644 --- a/src/app/sections/payment-section/shops/shops-list/shop-details/shop-details.component.html +++ b/src/app/sections/payment-section/shops/shops-list/shop-details/shop-details.component.html @@ -4,10 +4,6 @@ - - diff --git a/src/app/sections/payment-section/shops/shops-list/shop-details/shop-details.component.spec.ts b/src/app/sections/payment-section/shops/shops-list/shop-details/shop-details.component.spec.ts deleted file mode 100644 index 9c2dfdd2..00000000 --- a/src/app/sections/payment-section/shops/shops-list/shop-details/shop-details.component.spec.ts +++ /dev/null @@ -1,142 +0,0 @@ -import { ClipboardModule } from '@angular/cdk/clipboard'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { MatDialogModule } from '@angular/material/dialog'; -import { MatDividerModule } from '@angular/material/divider'; -import { MatSnackBarModule } from '@angular/material/snack-bar'; -import { TranslocoTestingModule } from '@ngneat/transloco'; -import { FlexLayoutModule } from 'ng-flex-layout'; -import { of } from 'rxjs'; -import { instance, mock, when } from 'ts-mockito'; - -import { CategoriesModule } from '@dsh/app/api/categories'; -import { ContractsModule } from '@dsh/app/api/contracts'; -import { ContractDetailsModule, PayoutToolModule } from '@dsh/app/shared/components'; -import { ShopContractDetailsService } from '@dsh/app/shared/services/shop-contract-details'; -import { ButtonModule } from '@dsh/components/buttons'; -import { DetailsItemModule } from '@dsh/components/layout'; - -import { ShopPayoutToolDetailsService } from '../../services/shop-payout-tool-details/shop-payout-tool-details.service'; -import { generateMockShopItem } from '../../tests/generate-shop-item'; -import { ShopBalanceModule } from '../shop-balance'; - -import { ShopActionsComponent } from './components/shop-actions/shop-actions.component'; -import { ShopContractDetailsComponent } from './components/shop-contract-details/shop-contract-details.component'; -import { ShopIdComponent } from './components/shop-id/shop-id.component'; -import { ShopInfoComponent } from './components/shop-info/shop-info.component'; -import { ShopPayoutToolDetailsComponent } from './components/shop-payout-tool-details/shop-payout-tool-details.component'; -import { CategoryService } from './services/category/category.service'; -import { ShopActionsService } from './services/shop-actions/shop-actions.service'; -import { ShopDetailsComponent } from './shop-details.component'; -import { ShopActionResult } from './types/shop-action-result'; - -describe('ShopDetailsComponent', () => { - let component: ShopDetailsComponent; - let fixture: ComponentFixture; - let mockCategoryService: CategoryService; - let mockContractsService: ShopContractDetailsService; - let mockPayoutsService: ShopPayoutToolDetailsService; - let mockActionsService: ShopActionsService; - - beforeEach(() => { - mockCategoryService = mock(CategoryService); - mockContractsService = mock(ShopContractDetailsService); - mockPayoutsService = mock(ShopPayoutToolDetailsService); - mockActionsService = mock(ShopActionsService); - }); - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [ - FlexLayoutModule, - ButtonModule, - TranslocoTestingModule.withLangs({ - en: {}, - }), - MatDividerModule, - DetailsItemModule, - ClipboardModule, - ContractDetailsModule, - PayoutToolModule, - ShopBalanceModule, - CategoriesModule, - ContractsModule, - MatSnackBarModule, - MatDialogModule, - ], - declarations: [ - ShopDetailsComponent, - ShopContractDetailsComponent, - ShopPayoutToolDetailsComponent, - ShopActionsComponent, - ShopIdComponent, - ShopInfoComponent, - ], - providers: [ - { - provide: CategoryService, - useFactory: () => instance(mockCategoryService), - }, - { - provide: ShopContractDetailsService, - useFactory: () => instance(mockContractsService), - }, - { - provide: ShopPayoutToolDetailsService, - useFactory: () => instance(mockPayoutsService), - }, - { - provide: ShopActionsService, - useValue: mockActionsService, - }, - ], - }) - .overrideComponent(ShopActionsComponent, { - set: { - providers: [], - }, - }) - .overrideComponent(ShopContractDetailsComponent, { - set: { - providers: [], - }, - }) - .overrideComponent(ShopPayoutToolDetailsComponent, { - set: { - providers: [], - }, - }) - .compileComponents(); - }); - - beforeEach(() => { - when(mockCategoryService.category$).thenReturn(of(undefined)); - when(mockContractsService.shopContract$).thenReturn(of(null)); - when(mockContractsService.errorOccurred$).thenReturn(of(false)); - when(mockPayoutsService.shopPayoutTool$).thenReturn(of(null)); - when(mockPayoutsService.errorOccurred$).thenReturn(of(false)); - when(mockActionsService.suspend).thenReturn(() => of(ShopActionResult.Success)); - when(mockActionsService.activate).thenReturn(() => of(ShopActionResult.Success)); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(ShopDetailsComponent); - component = fixture.componentInstance; - - component.shop = generateMockShopItem(1); - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); - - describe('requestUpdateData', () => { - it('should emit updateData', () => { - const spyOnUpdateData = spyOn(component.updateData, 'emit').and.callThrough(); - - component.requestUpdateData(); - - expect(spyOnUpdateData).toHaveBeenCalledTimes(1); - }); - }); -}); diff --git a/src/app/sections/payment-section/shops/shops-list/shop-details/shop-details.module.ts b/src/app/sections/payment-section/shops/shops-list/shop-details/shop-details.module.ts index eab5c755..39612029 100644 --- a/src/app/sections/payment-section/shops/shops-list/shop-details/shop-details.module.ts +++ b/src/app/sections/payment-section/shops/shops-list/shop-details/shop-details.module.ts @@ -7,7 +7,7 @@ import { MatSnackBarModule } from '@angular/material/snack-bar'; import { TranslocoModule } from '@ngneat/transloco'; import { FlexLayoutModule } from 'ng-flex-layout'; -import { ContractDetailsModule, PayoutToolModule } from '@dsh/app/shared/components'; +import { ContractDetailsModule } from '@dsh/app/shared/components'; import { ShopContractDetailsModule } from '@dsh/app/shared/services/shop-contract-details'; import { ButtonModule } from '@dsh/components/buttons'; import { DetailsItemModule } from '@dsh/components/layout'; @@ -18,7 +18,6 @@ import { ShopActionsComponent } from './components/shop-actions/shop-actions.com import { ShopContractDetailsComponent } from './components/shop-contract-details/shop-contract-details.component'; import { ShopIdComponent } from './components/shop-id/shop-id.component'; import { ShopInfoComponent } from './components/shop-info/shop-info.component'; -import { ShopPayoutToolDetailsComponent } from './components/shop-payout-tool-details/shop-payout-tool-details.component'; import { CategoryService } from './services/category/category.service'; import { ShopDetailsComponent } from './shop-details.component'; @@ -32,7 +31,6 @@ import { ShopDetailsComponent } from './shop-details.component'; DetailsItemModule, ClipboardModule, ContractDetailsModule, - PayoutToolModule, ShopBalanceModule, MatSnackBarModule, MatDialogModule, @@ -41,7 +39,6 @@ import { ShopDetailsComponent } from './shop-details.component'; declarations: [ ShopDetailsComponent, ShopContractDetailsComponent, - ShopPayoutToolDetailsComponent, ShopActionsComponent, ShopIdComponent, ShopInfoComponent, diff --git a/src/app/sections/payment-section/utils/to-navbar-item-config.ts b/src/app/sections/payment-section/utils/to-navbar-item-config.ts index 3ecea1cd..e0b35a48 100644 --- a/src/app/sections/payment-section/utils/to-navbar-item-config.ts +++ b/src/app/sections/payment-section/utils/to-navbar-item-config.ts @@ -5,7 +5,6 @@ export enum NavbarRouterLink { Shops = 'shops', Analytics = 'analytics', Operations = 'operations', - Payouts = 'payouts', Reports = 'reports', Integrations = 'integrations', } @@ -24,7 +23,7 @@ export const toNavbarItemConfig = ({ operations, reports, }: Record< - 'shops' | 'analytics' | 'integrations' | 'operations' | 'payouts' | 'reports', + 'shops' | 'analytics' | 'integrations' | 'operations' | 'reports', string >): NavbarItemConfig[] => [ { @@ -49,12 +48,6 @@ export const toNavbarItemConfig = ({ RoleAccessName.ViewRefunds, ], }, - // { - // routerLink: NavbarRouterLink.Payouts, - // icon: BootstrapIconName.ArrowRightCircle, - // label: payouts, - // roles: [RoleAccessName.ViewPayouts], - // }, { routerLink: NavbarRouterLink.Reports, icon: BootstrapIconName.FileText, diff --git a/src/app/shared/components/api-model-details/index.ts b/src/app/shared/components/api-model-details/index.ts index c3a05d71..254ab378 100644 --- a/src/app/shared/components/api-model-details/index.ts +++ b/src/app/shared/components/api-model-details/index.ts @@ -1,8 +1,6 @@ export * from './contract-details'; export * from './contractor-details'; export * from './bank-account-details'; -export * from './payout-tool-details'; -export * from './payout-tool'; export * from './webhook-api-key'; export * from './refund-details'; export * from './invoice-details'; diff --git a/src/app/shared/components/api-model-details/payout-tool-details/index.ts b/src/app/shared/components/api-model-details/payout-tool-details/index.ts deleted file mode 100644 index d15eeeb3..00000000 --- a/src/app/shared/components/api-model-details/payout-tool-details/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './payout-tool-details.module'; -export * from './payout-tool-details.component'; diff --git a/src/app/shared/components/api-model-details/payout-tool-details/international-bank-account/index.ts b/src/app/shared/components/api-model-details/payout-tool-details/international-bank-account/index.ts deleted file mode 100644 index e4b1021f..00000000 --- a/src/app/shared/components/api-model-details/payout-tool-details/international-bank-account/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './international-bank-account.component'; diff --git a/src/app/shared/components/api-model-details/payout-tool-details/international-bank-account/international-bank-account.component.html b/src/app/shared/components/api-model-details/payout-tool-details/international-bank-account/international-bank-account.component.html deleted file mode 100644 index 93e3f7b6..00000000 --- a/src/app/shared/components/api-model-details/payout-tool-details/international-bank-account/international-bank-account.component.html +++ /dev/null @@ -1,63 +0,0 @@ -
- - {{ internationalBankAccount?.number }} - - - {{ internationalBankAccount?.iban }} - - - - - {{ bankDetails?.name }} - - - {{ bankDetails?.bic }} - - - {{ bankDetails?.abartn }} - - - {{ bankDetails?.address }} - - - {{ bankDetails?.countryCode }} - - - -
- -
{{ t('correspondentBankAccount') }}
- -
-
diff --git a/src/app/shared/components/api-model-details/payout-tool-details/international-bank-account/international-bank-account.component.ts b/src/app/shared/components/api-model-details/payout-tool-details/international-bank-account/international-bank-account.component.ts deleted file mode 100644 index 73b177ce..00000000 --- a/src/app/shared/components/api-model-details/payout-tool-details/international-bank-account/international-bank-account.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { InternationalCorrespondentBankAccount } from '@vality/swag-payments'; - -@Component({ - selector: 'dsh-international-bank-account', - templateUrl: 'international-bank-account.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class InternationalBankAccountComponent { - @Input() internationalBankAccount: InternationalCorrespondentBankAccount; -} diff --git a/src/app/shared/components/api-model-details/payout-tool-details/payout-tool-details.component.html b/src/app/shared/components/api-model-details/payout-tool-details/payout-tool-details.component.html deleted file mode 100644 index 43e0503a..00000000 --- a/src/app/shared/components/api-model-details/payout-tool-details/payout-tool-details.component.html +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/src/app/shared/components/api-model-details/payout-tool-details/payout-tool-details.component.ts b/src/app/shared/components/api-model-details/payout-tool-details/payout-tool-details.component.ts deleted file mode 100644 index b643c90b..00000000 --- a/src/app/shared/components/api-model-details/payout-tool-details/payout-tool-details.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { PayoutToolDetails } from '@vality/swag-payments'; - -@Component({ - selector: 'dsh-payout-tool-details', - templateUrl: 'payout-tool-details.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PayoutToolDetailsComponent { - @Input() payoutToolDetails: PayoutToolDetails; -} diff --git a/src/app/shared/components/api-model-details/payout-tool-details/payout-tool-details.module.ts b/src/app/shared/components/api-model-details/payout-tool-details/payout-tool-details.module.ts deleted file mode 100644 index 98937bf7..00000000 --- a/src/app/shared/components/api-model-details/payout-tool-details/payout-tool-details.module.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { MatDividerModule } from '@angular/material/divider'; -import { RouterModule } from '@angular/router'; -import { TranslocoModule } from '@ngneat/transloco'; -import { FlexLayoutModule } from 'ng-flex-layout'; - -import { LayoutModule } from '@dsh/components/layout'; - -import { ApiModelRefsModule } from '../../../pipes'; -import { BankAccountDetailsModule } from '../bank-account-details'; - -import { InternationalBankAccountComponent } from './international-bank-account'; -import { PayoutToolDetailsComponent } from './payout-tool-details.component'; -import { WalletComponent } from './wallet'; - -@NgModule({ - imports: [ - FlexLayoutModule, - TranslocoModule, - CommonModule, - LayoutModule, - BankAccountDetailsModule, - MatDividerModule, - ApiModelRefsModule, - RouterModule, - ], - declarations: [PayoutToolDetailsComponent, InternationalBankAccountComponent, WalletComponent], - exports: [PayoutToolDetailsComponent], -}) -export class PayoutToolDetailsModule {} diff --git a/src/app/shared/components/api-model-details/payout-tool-details/wallet/index.ts b/src/app/shared/components/api-model-details/payout-tool-details/wallet/index.ts deleted file mode 100644 index 75aa6460..00000000 --- a/src/app/shared/components/api-model-details/payout-tool-details/wallet/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './wallet.component'; diff --git a/src/app/shared/components/api-model-details/payout-tool-details/wallet/wallet.component.html b/src/app/shared/components/api-model-details/payout-tool-details/wallet/wallet.component.html deleted file mode 100644 index d8c2bd92..00000000 --- a/src/app/shared/components/api-model-details/payout-tool-details/wallet/wallet.component.html +++ /dev/null @@ -1,15 +0,0 @@ -
- - {{ - wallet?.walletID | walletDetails - }} - -
diff --git a/src/app/shared/components/api-model-details/payout-tool-details/wallet/wallet.component.ts b/src/app/shared/components/api-model-details/payout-tool-details/wallet/wallet.component.ts deleted file mode 100644 index c4629a22..00000000 --- a/src/app/shared/components/api-model-details/payout-tool-details/wallet/wallet.component.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { Router } from '@angular/router'; -import { PayoutToolDetailsWalletInfo } from '@vality/swag-payments'; - -@Component({ - selector: 'dsh-wallet', - templateUrl: 'wallet.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class WalletComponent { - @Input() wallet: PayoutToolDetailsWalletInfo; - - constructor(private router: Router) {} - - goToWalletDetails(walletID: string): void { - void this.router.navigate(['wallet-section', 'wallets', walletID]); - } -} diff --git a/src/app/shared/components/api-model-details/payout-tool/index.ts b/src/app/shared/components/api-model-details/payout-tool/index.ts deleted file mode 100644 index 118c46c2..00000000 --- a/src/app/shared/components/api-model-details/payout-tool/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './payout-tool.module'; -export * from './payout-tool.component'; diff --git a/src/app/shared/components/api-model-details/payout-tool/payout-tool.component.html b/src/app/shared/components/api-model-details/payout-tool/payout-tool.component.html deleted file mode 100644 index 01db431a..00000000 --- a/src/app/shared/components/api-model-details/payout-tool/payout-tool.component.html +++ /dev/null @@ -1,10 +0,0 @@ -
- - {{ payoutTool?.currency }} - - -
diff --git a/src/app/shared/components/api-model-details/payout-tool/payout-tool.component.ts b/src/app/shared/components/api-model-details/payout-tool/payout-tool.component.ts deleted file mode 100644 index 1a12e274..00000000 --- a/src/app/shared/components/api-model-details/payout-tool/payout-tool.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { PayoutTool } from '@vality/swag-payments'; - -@Component({ - selector: 'dsh-payout-tool', - templateUrl: 'payout-tool.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PayoutToolComponent { - @Input() payoutTool: PayoutTool; -} diff --git a/src/app/shared/components/api-model-details/payout-tool/payout-tool.module.ts b/src/app/shared/components/api-model-details/payout-tool/payout-tool.module.ts deleted file mode 100644 index 157203c2..00000000 --- a/src/app/shared/components/api-model-details/payout-tool/payout-tool.module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { MatDividerModule } from '@angular/material/divider'; -import { TranslocoModule } from '@ngneat/transloco'; -import { FlexLayoutModule } from 'ng-flex-layout'; - -import { LayoutModule } from '@dsh/components/layout'; - -import { BankAccountDetailsModule } from '../bank-account-details'; -import { PayoutToolDetailsModule } from '../payout-tool-details'; - -import { PayoutToolComponent } from './payout-tool.component'; - -@NgModule({ - imports: [ - FlexLayoutModule, - TranslocoModule, - CommonModule, - LayoutModule, - BankAccountDetailsModule, - MatDividerModule, - PayoutToolDetailsModule, - ], - declarations: [PayoutToolComponent], - exports: [PayoutToolComponent], -}) -export class PayoutToolModule {} diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/components/international-bank-account-form/international-bank-account-form.component.html b/src/app/shared/components/shop-creation/create-international-shop-entity/components/international-bank-account-form/international-bank-account-form.component.html deleted file mode 100644 index 9edcfe17..00000000 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/components/international-bank-account-form/international-bank-account-form.component.html +++ /dev/null @@ -1,22 +0,0 @@ -
-
- - -
- {{ t('correspondentAccount') }} - -
diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/components/international-bank-account-form/international-bank-account-form.component.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/components/international-bank-account-form/international-bank-account-form.component.ts deleted file mode 100644 index 788c6294..00000000 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/components/international-bank-account-form/international-bank-account-form.component.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { FormBuilder, FormGroup } from '@angular/forms'; -import { createControlProviders, FormGroupSuperclass } from '@vality/ng-core'; - -import { PayoutToolForm } from '../payout-tool-form/types/payout-tool-form'; - -export interface InternationalBankAccountForm { - payoutTool: PayoutToolForm; - currency: string; - correspondentPayoutTool?: PayoutToolForm; -} - -@Component({ - selector: 'dsh-international-bank-account-form', - templateUrl: 'international-bank-account-form.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - providers: createControlProviders(() => InternationalBankAccountFormComponent), -}) -export class InternationalBankAccountFormComponent extends FormGroupSuperclass< - Partial -> { - control = this.fb.group({ - payoutTool: null, - currency: null, - correspondentPayoutTool: { value: null, disabled: true }, - }) as FormGroup; - - constructor(private fb: FormBuilder) { - super(); - } - - toggleCorrespondentPayoutTool(): void { - const { correspondentPayoutTool } = this.control.controls; - if (correspondentPayoutTool.disabled) { - correspondentPayoutTool.enable(); - } else { - correspondentPayoutTool.disable(); - } - } -} diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/components/payout-tool-form/payout-tool-form.component.html b/src/app/shared/components/shop-creation/create-international-shop-entity/components/payout-tool-form/payout-tool-form.component.html deleted file mode 100644 index bf24e182..00000000 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/components/payout-tool-form/payout-tool-form.component.html +++ /dev/null @@ -1,44 +0,0 @@ -
- - {{ t('accountNumber') }} - - - -
{{ t('description') }}
- - - {{ t('iban') }} - - - - - {{ t('bic') }} - - - - - {{ t('abaRtn') }} - - - - - {{ t('bankName') }} - - - - - - - {{ t('bankAddress') }} - - -
diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/components/payout-tool-form/payout-tool-form.component.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/components/payout-tool-form/payout-tool-form.component.ts deleted file mode 100644 index b981eacf..00000000 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/components/payout-tool-form/payout-tool-form.component.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { Validators, FormBuilder } from '@angular/forms'; -import { createControlProviders, FormGroupSuperclass } from '@vality/ng-core'; - -import { PayoutToolForm } from './types/payout-tool-form'; -import { payoutToolFormValidator } from './utils/payout-tool-form-validator'; - -@Component({ - selector: 'dsh-payout-tool-form', - templateUrl: 'payout-tool-form.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - providers: createControlProviders(() => PayoutToolFormComponent), -}) -export class PayoutToolFormComponent extends FormGroupSuperclass> { - control = this.fb.group( - { - number: ['', [Validators.pattern(/^[0-9A-Z]{8,40}$/)]], - iban: ['', [Validators.pattern(/^[A-Z0-9]{14,35}$/)]], - bic: ['', [Validators.pattern(/^([A-Z0-9]{8}|[A-Z0-9]{11})$/)]], - abaRtn: ['', [Validators.pattern(/^[0-9]{9}$/)]], - name: ['', [Validators.maxLength(100)]], - country: [null], - address: ['', [Validators.maxLength(1000)]], - }, - { validators: payoutToolFormValidator }, - ); - - constructor(private fb: FormBuilder) { - super(); - } -} diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/components/payout-tool-form/types/payout-tool-form.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/components/payout-tool-form/types/payout-tool-form.ts deleted file mode 100644 index f04407dd..00000000 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/components/payout-tool-form/types/payout-tool-form.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface PayoutToolForm { - number: string; - iban: string; - abaRtn: string; - address: string; - bic: string; - name: string; - country: string; -} diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/components/payout-tool-form/utils/payout-tool-form-validator.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/components/payout-tool-form/utils/payout-tool-form-validator.ts deleted file mode 100644 index 665526cd..00000000 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/components/payout-tool-form/utils/payout-tool-form-validator.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ValidatorFn } from '@angular/forms'; -import { FormGroupByValue } from '@vality/ng-core'; -import isEmpty from 'lodash-es/isEmpty'; - -import { PayoutToolForm } from '../types/payout-tool-form'; - -// bic | iban | abaRtn | country & address & name should be provided; -export const payoutToolFormValidator: ValidatorFn = ( - form: FormGroupByValue, -): { error: boolean } | null => { - const { bic, iban, abaRtn, country, address, name } = form.controls; - - const isValidNumbers = [ - !isEmpty(bic.value) && bic.valid, - !isEmpty(iban.value) && iban.valid, - !isEmpty(abaRtn.value) && abaRtn.valid, - ].some(Boolean); - - const isValidGeo = [ - !isEmpty(country.value) && country.valid, - !isEmpty(address.value) && address.valid, - !isEmpty(name.value) && name.valid, - ].every(Boolean); - - return isValidNumbers || isValidGeo ? null : { error: true }; -}; diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/components/shop-form/shop-form.component.html b/src/app/shared/components/shop-creation/create-international-shop-entity/components/shop-form/shop-form.component.html index a8021a3a..a02bec64 100644 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/components/shop-form/shop-form.component.html +++ b/src/app/shared/components/shop-creation/create-international-shop-entity/components/shop-form/shop-form.component.html @@ -28,20 +28,4 @@ [label]="t('paymentInstitution')" formControlName="paymentInstitution" > - - - -

{{ t('payoutToolTitle') }}

- - - - - diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/components/shop-form/shop-form.component.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/components/shop-form/shop-form.component.ts index 8f24ed19..96cd28cc 100644 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/components/shop-form/shop-form.component.ts +++ b/src/app/shared/components/shop-creation/create-international-shop-entity/components/shop-form/shop-form.component.ts @@ -18,7 +18,6 @@ export class ShopFormComponent extends FormGroupSuperclass< shopDetails: null, orgDetails: createTypeUnionDefaultForm(), paymentInstitution: null, - bankAccount: createTypeUnionDefaultForm(), }) as FormGroup; constructor(private fb: FormBuilder) { diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/create-international-shop-entity.component.spec.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/create-international-shop-entity.component.spec.ts deleted file mode 100644 index bd22ed2f..00000000 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/create-international-shop-entity.component.spec.ts +++ /dev/null @@ -1,161 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormGroup } from '@angular/forms'; -import { MatDialogModule } from '@angular/material/dialog'; -import { MatSnackBar } from '@angular/material/snack-bar'; -import { Router } from '@angular/router'; -import { TranslocoService } from '@ngneat/transloco'; -import { Claim } from '@vality/swag-claim-management'; -import { FlexLayoutModule } from 'ng-flex-layout'; -import { of } from 'rxjs'; -import { switchMap } from 'rxjs/operators'; -import { deepEqual, instance, mock, verify, when } from 'ts-mockito'; - -import { getTranslocoModule } from '@dsh/app/shared/tests/get-transloco-module'; -import { ButtonModule } from '@dsh/components/buttons'; - -import { CreateInternationalShopEntityComponent } from './create-international-shop-entity.component'; -import { CreateInternationalShopEntityService } from './services/create-international-shop-entity/create-international-shop-entity.service'; - -@Component({ - selector: 'dsh-shop-form', - template: '', -}) -class MockShopFormComponent { - @Input() form: FormGroup; -} - -describe('CreateInternationalShopEntityComponent', () => { - let fixture: ComponentFixture; - let component: CreateInternationalShopEntityComponent; - let mockCreateInternationalShopEntityService: CreateInternationalShopEntityService; - let mockTranslocoService: TranslocoService; - let mockMatSnackBar: MatSnackBar; - let mockRouter: Router; - - beforeEach(() => { - mockCreateInternationalShopEntityService = mock(CreateInternationalShopEntityService); - mockTranslocoService = mock(TranslocoService); - mockMatSnackBar = mock(MatSnackBar); - mockRouter = mock(Router); - }); - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [getTranslocoModule(), MatDialogModule, ButtonModule, FlexLayoutModule], - declarations: [CreateInternationalShopEntityComponent, MockShopFormComponent], - providers: [ - { - provide: CreateInternationalShopEntityService, - useFactory: () => instance(mockCreateInternationalShopEntityService), - }, - { - provide: mockTranslocoService, - useFactory: () => instance(TranslocoService), - }, - { - provide: MatSnackBar, - useFactory: () => instance(mockMatSnackBar), - }, - { - provide: Router, - useFactory: () => instance(mockRouter), - }, - ], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(CreateInternationalShopEntityComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); - - describe('createShop', () => { - const claim: Claim = { - id: 100500, - status: 'active', - changeset: [], - revision: 5, - createdAt: new Date(), - }; - - it('should call create shop with form value', () => { - when( - mockCreateInternationalShopEntityService.createShop( - deepEqual(component.form.value), - ), - ).thenReturn(of(claim)); - - component.createShop(); - - verify( - mockCreateInternationalShopEntityService.createShop( - deepEqual(component.form.value), - ), - ).once(); - expect().nothing(); - }); - - it('should emit send on success', () => { - const spyOnSend = spyOn(component.send, 'emit').and.callThrough(); - - when( - mockCreateInternationalShopEntityService.createShop( - deepEqual(component.form.value), - ), - ).thenReturn(of(claim)); - - component.createShop(); - - expect(spyOnSend).toHaveBeenCalledTimes(1); - }); - - it('should navigate to claim with claim id', () => { - when( - mockCreateInternationalShopEntityService.createShop( - deepEqual(component.form.value), - ), - ).thenReturn(of(claim)); - when( - mockRouter.navigate(deepEqual(['claim-section', 'claims', claim.id])), - ).thenReturn(); - - component.createShop(); - - verify(mockRouter.navigate(deepEqual(['claim-section', 'claims', claim.id]))).once(); - expect().nothing(); - }); - - it('should show error snack bar if error happened', () => { - const error = new Error('Test error'); - when(mockCreateInternationalShopEntityService.createShop).thenReturn(() => - of(claim).pipe( - switchMap(() => { - throw error; - }), - ), - ); - when(mockMatSnackBar.open('Что-то пошло не так', 'OK')).thenReturn(); - - component.createShop(); - - verify(mockMatSnackBar.open('Что-то пошло не так', 'OK')).once(); - expect().nothing(); - }); - }); - - describe('cancelCreation', () => { - it('should emit cancel', () => { - const spyOnCancel = spyOn(component.cancel, 'emit').and.callThrough(); - - component.cancelCreation(); - - expect(spyOnCancel).toHaveBeenCalledTimes(1); - }); - }); -}); diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/create-international-shop-entity.component.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/create-international-shop-entity.component.ts index 910300d7..4b50eac8 100644 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/create-international-shop-entity.component.ts +++ b/src/app/shared/components/shop-creation/create-international-shop-entity/create-international-shop-entity.component.ts @@ -1,6 +1,5 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Output } from '@angular/core'; import { FormControl } from '@angular/forms'; -import { Router } from '@angular/router'; import { TranslocoService } from '@ngneat/transloco'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { progressTo, NotifyLogService } from '@vality/ng-core'; @@ -27,7 +26,6 @@ export class CreateInternationalShopEntityComponent { private createShopInternationalLegalEntityService: CreateInternationalShopEntityService, private transloco: TranslocoService, private log: NotifyLogService, - private router: Router, ) {} createShop(): void { diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/create-international-shop-entity.module.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/create-international-shop-entity.module.ts index 6eda31a4..607de80a 100644 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/create-international-shop-entity.module.ts +++ b/src/app/shared/components/shop-creation/create-international-shop-entity/create-international-shop-entity.module.ts @@ -15,10 +15,8 @@ import { CategoryAutocompleteFieldModule } from '@dsh/app/shared/components/inpu import { CountryAutocompleteFieldModule } from '@dsh/app/shared/components/inputs/country-autocomplete-field'; import { PaymentInstitutionFieldModule } from '@dsh/app/shared/components/inputs/payment-institution-field'; import { ShopFieldModule } from '@dsh/app/shared/components/inputs/shop-field'; -import { InternationalBankAccountFormComponent } from '@dsh/app/shared/components/shop-creation/create-international-shop-entity/components/international-bank-account-form/international-bank-account-form.component'; import { NewContractorFormComponent } from '@dsh/app/shared/components/shop-creation/create-international-shop-entity/components/new-contractor-form/new-contractor-form.component'; import { CreatedExistingSwitchModule } from '@dsh/app/shared/components/shop-creation/created-existing-switch/created-existing-switch.module'; -import { ExistingBankAccountModule } from '@dsh/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.module'; import { ExistingContractFormModule } from '@dsh/app/shared/components/shop-creation/existing-contract-form/existing-contract-form.module'; import { ShopDetailsFormModule } from '@dsh/app/shared/components/shop-creation/shop-details-form'; import { CountryCodesModule } from '@dsh/app/shared/services'; @@ -26,7 +24,6 @@ import { ButtonModule } from '@dsh/components/buttons'; import { CurrencyAutocompleteFieldModule } from '../../inputs/currency-autocomplete-field'; -import { PayoutToolFormComponent } from './components/payout-tool-form/payout-tool-form.component'; import { ShopFormComponent } from './components/shop-form/shop-form.component'; import { CreateInternationalShopEntityComponent } from './create-international-shop-entity.component'; import { CreateInternationalShopEntityService } from './services/create-international-shop-entity/create-international-shop-entity.service'; @@ -54,15 +51,12 @@ import { CreateInternationalShopEntityService } from './services/create-internat ContractorDetailsModule, ErrorMessageModule, ExistingContractFormModule, - ExistingBankAccountModule, CurrencyAutocompleteFieldModule, ], declarations: [ CreateInternationalShopEntityComponent, - PayoutToolFormComponent, ShopFormComponent, NewContractorFormComponent, - InternationalBankAccountFormComponent, ], exports: [CreateInternationalShopEntityComponent], providers: [CreateInternationalShopEntityService], diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/create-international-shop-entity.service.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/create-international-shop-entity.service.ts index ce9f5518..548ac9c5 100644 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/create-international-shop-entity.service.ts +++ b/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/create-international-shop-entity.service.ts @@ -10,17 +10,11 @@ import { createInternationalLegalEntityModification, createShopCreationModification, makeShopLocation, - createInternationalContractPayoutToolModification, } from '@dsh/app/api/claim-management'; import { IdGeneratorService } from '@dsh/app/shared/services/id-generator'; import { InternationalShopEntityFormValue } from '../../types/international-shop-entity-form-value'; -import { - payoutToolDetailsInternationalBankAccountToInternationalBankAccount, - payoutToolFormToInternationalBankAccount, -} from './utils'; - @Injectable() export class CreateInternationalShopEntityService { constructor( @@ -47,7 +41,6 @@ export class CreateInternationalShopEntityService { shopDetails, orgDetails: { created: newContractor, existing: contract }, paymentInstitution, - bankAccount: { created: newBankAccount, existing: payoutTool }, }: InternationalShopEntityFormValue): Modification[] { const contractorID = this.idGenerator.uuid(); const contractID = this.idGenerator.uuid(); @@ -80,30 +73,6 @@ export class CreateInternationalShopEntityService { contractorID, paymentInstitution: { id: paymentInstitution?.id ?? 1 }, }), - createInternationalContractPayoutToolModification( - contractID, - payoutToolID, - newBankAccount ? newBankAccount.currency : payoutTool.currency, - newBankAccount - ? { - ...payoutToolFormToInternationalBankAccount(newBankAccount.payoutTool), - correspondentAccount: newBankAccount.correspondentPayoutTool - ? payoutToolFormToInternationalBankAccount( - newBankAccount.correspondentPayoutTool, - ) - : null, - } - : { - ...payoutToolDetailsInternationalBankAccountToInternationalBankAccount( - payoutTool.details, - ), - correspondentAccount: payoutTool.details.correspondentBankAccount - ? payoutToolDetailsInternationalBankAccountToInternationalBankAccount( - payoutTool.details.correspondentBankAccount, - ) - : null, - }, - ), createShopCreationModification(shopID, { category: { categoryID: shopDetails.category?.categoryID ?? 1, diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/utils/index.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/utils/index.ts deleted file mode 100644 index 367526d5..00000000 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/utils/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './payout-tool-details-international-bank-account-to-international-bank-account'; -export * from './payout-tool-form-to-international-bank-account'; diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/utils/payout-tool-details-international-bank-account-to-international-bank-account.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/utils/payout-tool-details-international-bank-account-to-international-bank-account.ts deleted file mode 100644 index 7d6e0868..00000000 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/utils/payout-tool-details-international-bank-account-to-international-bank-account.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { InternationalBankAccount } from '@vality/swag-claim-management'; -import { PayoutToolDetailsInternationalBankAccount } from '@vality/swag-payments'; - -export function payoutToolDetailsInternationalBankAccountToInternationalBankAccount( - form: Omit, -): Required> { - const { bankDetails } = form; - return { - iban: form.iban, - number: form.number, - bank: { - abaRtn: bankDetails?.abartn, - address: bankDetails?.address, - bic: bankDetails?.bic, - name: bankDetails?.name, - country: bankDetails?.countryCode, - }, - }; -} diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/utils/payout-tool-form-to-international-bank-account.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/utils/payout-tool-form-to-international-bank-account.ts deleted file mode 100644 index f0123627..00000000 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/services/create-international-shop-entity/utils/payout-tool-form-to-international-bank-account.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { InternationalBankAccount } from '@vality/swag-claim-management'; - -import { PayoutToolForm } from '../../../components/payout-tool-form/types/payout-tool-form'; - -export function payoutToolFormToInternationalBankAccount( - form: PayoutToolForm, -): Required> { - return { - iban: form.iban, - number: form.number, - bank: { - abaRtn: form.abaRtn, - address: form.address, - bic: form.bic, - name: form.name, - country: form.country, - }, - }; -} diff --git a/src/app/shared/components/shop-creation/create-international-shop-entity/types/international-shop-entity-form-value.ts b/src/app/shared/components/shop-creation/create-international-shop-entity/types/international-shop-entity-form-value.ts index 6e5099dd..b59fe6b4 100644 --- a/src/app/shared/components/shop-creation/create-international-shop-entity/types/international-shop-entity-form-value.ts +++ b/src/app/shared/components/shop-creation/create-international-shop-entity/types/international-shop-entity-form-value.ts @@ -1,19 +1,13 @@ import { PaymentInstitution } from '@vality/swag-payments'; import { TypeUnion } from '@dsh/app/shared/components/shop-creation/created-existing-switch/created-existing-switch.component'; -import { ExistingBankAccountForm } from '@dsh/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.component'; import { ShopDetailsForm } from '@dsh/app/shared/components/shop-creation/shop-details-form/shop-details-form.component'; import { ExistingContractForm } from '../../existing-contract-form/existing-contract-form.component'; -import { InternationalBankAccountForm } from '../components/international-bank-account-form/international-bank-account-form.component'; import { NewContractorForm } from '../components/new-contractor-form/new-contractor-form.component'; export interface InternationalShopEntityFormValue { shopDetails: ShopDetailsForm; orgDetails: TypeUnion>; paymentInstitution: PaymentInstitution; - bankAccount: TypeUnion< - InternationalBankAccountForm, - ExistingBankAccountForm<'PayoutToolDetailsInternationalBankAccount'> - >; } diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/new-contractor-form/new-contractor-form.component.html b/src/app/shared/components/shop-creation/create-russian-shop-entity/components/new-contractor-form/new-contractor-form.component.html deleted file mode 100644 index a79822f6..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/new-contractor-form/new-contractor-form.component.html +++ /dev/null @@ -1,78 +0,0 @@ -
-
- - {{ p('form.registeredName') }} - - - - {{ p('form.inn') }} - - - - {{ p('form.registeredNumber') }} - - - - {{ p('form.actualAddress') }} - - - - {{ p('form.representativePosition') }} - - - - {{ p('form.representativeFullName') }} - - - - {{ p('form.representativeDocument') }} - - -
- - - - -
diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/new-contractor-form/new-contractor-form.component.ts b/src/app/shared/components/shop-creation/create-russian-shop-entity/components/new-contractor-form/new-contractor-form.component.ts deleted file mode 100644 index 90a69bf8..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/new-contractor-form/new-contractor-form.component.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Component } from '@angular/core'; -import { FormBuilder } from '@angular/forms'; -import { UntilDestroy } from '@ngneat/until-destroy'; -import { FormGroupSuperclass, createControlProviders } from '@vality/ng-core'; - -import { RussianBankAccountForm } from '../russian-bank-account-form/types/bank-account-form-data'; - -export interface NewContractorForm { - registeredName: string; - inn: string; - registeredNumber: string; - actualAddress: string; - representativePosition: string; - representativeFullName: string; - representativeDocument: string; - bankAccount: RussianBankAccountForm; -} - -@UntilDestroy() -@Component({ - selector: 'dsh-new-contractor-form', - templateUrl: 'new-contractor-form.component.html', - providers: createControlProviders(() => NewContractorFormComponent), -}) -export class NewContractorFormComponent extends FormGroupSuperclass> { - control = this.fb.group({ - registeredName: null, - inn: null, - registeredNumber: null, - actualAddress: null, - representativePosition: null, - representativeFullName: null, - representativeDocument: null, - bankAccount: null, - }); - - constructor(private fb: FormBuilder) { - super(); - } -} diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/org-details-form/org-details-form.component.html b/src/app/shared/components/shop-creation/create-russian-shop-entity/components/org-details-form/org-details-form.component.html deleted file mode 100644 index cd5abcfe..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/org-details-form/org-details-form.component.html +++ /dev/null @@ -1,19 +0,0 @@ -
-

{{ p('title') }}

- - - - - -
diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/org-details-form/org-details-form.component.ts b/src/app/shared/components/shop-creation/create-russian-shop-entity/components/org-details-form/org-details-form.component.ts deleted file mode 100644 index 51010cd3..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/org-details-form/org-details-form.component.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Component } from '@angular/core'; -import { UntilDestroy } from '@ngneat/until-destroy'; -import { createControlProviders, FormGroupSuperclass } from '@vality/ng-core'; - -import { - createTypeUnionDefaultForm, - TypeUnion, -} from '@dsh/app/shared/components/shop-creation/created-existing-switch/created-existing-switch.component'; - -import { ExistingContractForm } from '../../../existing-contract-form/existing-contract-form.component'; - -import { NewContractorForm } from './../new-contractor-form/new-contractor-form.component'; - -export type OrgDetailsForm = TypeUnion< - NewContractorForm, - ExistingContractForm<'RussianLegalEntity'> ->; - -@UntilDestroy() -@Component({ - selector: 'dsh-org-details-form', - templateUrl: 'org-details-form.component.html', - providers: createControlProviders(() => OrgDetailsFormComponent), -}) -export class OrgDetailsFormComponent extends FormGroupSuperclass> { - control = createTypeUnionDefaultForm< - NewContractorForm, - ExistingContractForm<'RussianLegalEntity'> - >(); -} diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/russian-bank-account-form/russian-bank-account-form.component.html b/src/app/shared/components/shop-creation/create-russian-shop-entity/components/russian-bank-account-form/russian-bank-account-form.component.html deleted file mode 100644 index c9b8d733..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/russian-bank-account-form/russian-bank-account-form.component.html +++ /dev/null @@ -1,33 +0,0 @@ -
-
- - {{ p('name') }} - - - - {{ p('bik') }} - - - - {{ p('postAccount') }} - - - - {{ p('account') }} - - -
-
diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/russian-bank-account-form/russian-bank-account-form.component.ts b/src/app/shared/components/shop-creation/create-russian-shop-entity/components/russian-bank-account-form/russian-bank-account-form.component.ts deleted file mode 100644 index 3ae94d04..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/russian-bank-account-form/russian-bank-account-form.component.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { FormBuilder } from '@angular/forms'; -import { createControlProviders, FormGroupSuperclass } from '@vality/ng-core'; - -import { RussianBankAccountForm } from './types/bank-account-form-data'; - -@Component({ - selector: 'dsh-russian-bank-account-form', - templateUrl: 'russian-bank-account-form.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - providers: createControlProviders(() => RussianBankAccountFormComponent), -}) -export class RussianBankAccountFormComponent extends FormGroupSuperclass< - Partial -> { - control = this.fb.group({ - account: null, - bankName: null, - bankPostAccount: null, - bankBik: null, - }); - - constructor(private fb: FormBuilder) { - super(); - } -} diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/russian-bank-account-form/types/bank-account-form-data.ts b/src/app/shared/components/shop-creation/create-russian-shop-entity/components/russian-bank-account-form/types/bank-account-form-data.ts deleted file mode 100644 index 02c88921..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/russian-bank-account-form/types/bank-account-form-data.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface RussianBankAccountForm { - bankName: string; - bankBik: string; - bankPostAccount: string; - account: string; -} diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/shop-form/shop-form.component.html b/src/app/shared/components/shop-creation/create-russian-shop-entity/components/shop-form/shop-form.component.html deleted file mode 100644 index cdf8332d..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/shop-form/shop-form.component.html +++ /dev/null @@ -1,35 +0,0 @@ -
- - - - - - - - -
-

{{ p('title') }}

-
{{ p('description') }}
-
- -
- - -
- -
-
-
diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/shop-form/shop-form.component.ts b/src/app/shared/components/shop-creation/create-russian-shop-entity/components/shop-form/shop-form.component.ts deleted file mode 100644 index bdb37fcd..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/components/shop-form/shop-form.component.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Component, ChangeDetectionStrategy } from '@angular/core'; -import { FormGroup, FormBuilder } from '@angular/forms'; -import { UntilDestroy } from '@ngneat/until-destroy'; -import { createControlProviders, FormGroupSuperclass } from '@vality/ng-core'; - -import { createTypeUnionDefaultForm } from '../../../created-existing-switch/created-existing-switch.component'; -import { RussianShopForm } from '../../types/russian-shop-entity'; - -@UntilDestroy() -@Component({ - selector: 'dsh-shop-form', - templateUrl: 'shop-form.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - providers: createControlProviders(() => ShopFormComponent), -}) -export class ShopFormComponent extends FormGroupSuperclass> { - control = this.fb.group({ - shopDetails: null, - orgDetails: null, - bankAccount: createTypeUnionDefaultForm(), - paymentInstitution: null, - currency: null, - }) as FormGroup; - - constructor(private fb: FormBuilder) { - super(); - } -} diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/create-russian-shop-entity.component.html b/src/app/shared/components/shop-creation/create-russian-shop-entity/create-russian-shop-entity.component.html deleted file mode 100644 index 7f2efdc0..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/create-russian-shop-entity.component.html +++ /dev/null @@ -1,19 +0,0 @@ - - -
- -
-
diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/create-russian-shop-entity.component.scss b/src/app/shared/components/shop-creation/create-russian-shop-entity/create-russian-shop-entity.component.scss deleted file mode 100644 index 848095c1..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/create-russian-shop-entity.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -mat-dialog-actions { - padding-bottom: 24px; -} diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/create-russian-shop-entity.component.ts b/src/app/shared/components/shop-creation/create-russian-shop-entity/create-russian-shop-entity.component.ts deleted file mode 100644 index 2c02a245..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/create-russian-shop-entity.component.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { ChangeDetectionStrategy, Component, EventEmitter, Output } from '@angular/core'; -import { FormControl } from '@angular/forms'; -import { Router } from '@angular/router'; -import { TranslocoService } from '@ngneat/transloco'; -import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; -import { NotifyLogService } from '@vality/ng-core'; - -import { CreateRussianShopEntityService } from './services/create-russian-shop-entity/create-russian-shop-entity.service'; - -@UntilDestroy() -@Component({ - selector: 'dsh-create-russian-shop-entity', - templateUrl: 'create-russian-shop-entity.component.html', - styleUrls: ['create-russian-shop-entity.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, - providers: [CreateRussianShopEntityService], -}) -export class CreateRussianShopEntityComponent { - @Output() cancel = new EventEmitter(); - @Output() send = new EventEmitter(); - - form = new FormControl(); - - constructor( - private createShopRussianLegalEntityService: CreateRussianShopEntityService, - private transloco: TranslocoService, - private log: NotifyLogService, - private router: Router, - ) {} - - cancelCreation(): void { - this.cancel.emit(); - } - - createShop(): void { - this.createShopRussianLegalEntityService - .createShop(this.form.value) - .pipe(untilDestroyed(this)) - .subscribe({ - next: () => { - this.send.emit(); - // TODO: Claims page disabled - // void this.router.navigate(['claim-section', 'claims', id]); - }, - error: (err) => { - this.log.error( - err, - this.transloco.selectTranslate('shared.commonError', null, 'components'), - ); - }, - }); - } -} diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/create-russian-shop-entity.module.ts b/src/app/shared/components/shop-creation/create-russian-shop-entity/create-russian-shop-entity.module.ts deleted file mode 100644 index 4342c86d..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/create-russian-shop-entity.module.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { ReactiveFormsModule } from '@angular/forms'; -import { MatDividerModule } from '@angular/material/divider'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatRadioModule } from '@angular/material/radio'; -import { MatSelectModule } from '@angular/material/select'; -import { TranslocoModule } from '@ngneat/transloco'; -import { FlexLayoutModule } from 'ng-flex-layout'; - -import { ContractorDetailsModule } from '@dsh/app/shared'; -import { PayoutToolDetailsModule } from '@dsh/app/shared/components'; -import { BaseDialogModule } from '@dsh/app/shared/components/dialog/base-dialog'; -import { PaymentInstitutionFieldModule } from '@dsh/app/shared/components/inputs/payment-institution-field'; -import { ShopFieldModule } from '@dsh/app/shared/components/inputs/shop-field'; -import { CreatedExistingSwitchModule } from '@dsh/app/shared/components/shop-creation/created-existing-switch/created-existing-switch.module'; -import { ExistingBankAccountModule } from '@dsh/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.module'; -import { ExistingContractFormModule } from '@dsh/app/shared/components/shop-creation/existing-contract-form/existing-contract-form.module'; -import { ShopDetailsFormModule } from '@dsh/app/shared/components/shop-creation/shop-details-form/shop-details-form.module'; -import { ButtonModule } from '@dsh/components/buttons'; -import { FormatInputModule } from '@dsh/components/form-controls'; -import { DetailsItemModule } from '@dsh/components/layout'; - -import { ShopPayoutToolDetailsService } from '../../../../sections/payment-section/shops/services/shop-payout-tool-details/shop-payout-tool-details.service'; -import { CurrencyAutocompleteFieldModule } from '../../inputs/currency-autocomplete-field'; - -import { NewContractorFormComponent } from './components/new-contractor-form/new-contractor-form.component'; -import { OrgDetailsFormComponent } from './components/org-details-form/org-details-form.component'; -import { RussianBankAccountFormComponent } from './components/russian-bank-account-form/russian-bank-account-form.component'; -import { ShopFormComponent } from './components/shop-form/shop-form.component'; -import { CreateRussianShopEntityComponent } from './create-russian-shop-entity.component'; -import { CreateRussianShopEntityService } from './services/create-russian-shop-entity/create-russian-shop-entity.service'; - -@NgModule({ - imports: [ - CommonModule, - TranslocoModule, - FlexLayoutModule, - ReactiveFormsModule, - MatFormFieldModule, - MatInputModule, - MatDividerModule, - MatRadioModule, - FormatInputModule, - MatSelectModule, - PayoutToolDetailsModule, - ButtonModule, - DetailsItemModule, - BaseDialogModule, - ShopFieldModule, - ShopDetailsFormModule, - ContractorDetailsModule, - PaymentInstitutionFieldModule, - CreatedExistingSwitchModule, - ExistingContractFormModule, - ExistingBankAccountModule, - CurrencyAutocompleteFieldModule, - ], - declarations: [ - CreateRussianShopEntityComponent, - OrgDetailsFormComponent, - ShopFormComponent, - RussianBankAccountFormComponent, - NewContractorFormComponent, - ], - exports: [CreateRussianShopEntityComponent], - providers: [CreateRussianShopEntityService, ShopPayoutToolDetailsService], -}) -export class CreateRussianShopEntityModule {} diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/index.ts b/src/app/shared/components/shop-creation/create-russian-shop-entity/index.ts deleted file mode 100644 index 32bc4db2..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './create-russian-shop-entity.module'; diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/services/create-russian-shop-entity/create-russian-shop-entity.service.ts b/src/app/shared/components/shop-creation/create-russian-shop-entity/services/create-russian-shop-entity/create-russian-shop-entity.service.ts deleted file mode 100644 index c895d41c..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/services/create-russian-shop-entity/create-russian-shop-entity.service.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Claim, PartyModification } from '@vality/swag-claim-management'; -import { forkJoin, Observable, of } from 'rxjs'; -import { pluck, switchMap } from 'rxjs/operators'; - -import { - ClaimsService, - createContractCreationModification, - createRussianBankAccountModification, - createRussianContractPayoutToolCreationModification, - createRussianLegalEntityModification, - createShopCreationModification, - makeShopLocation, -} from '@dsh/app/api/claim-management'; -import { IdGeneratorService } from '@dsh/app/shared/services/id-generator'; - -import { RussianShopForm } from '../../types/russian-shop-entity'; - -@Injectable() -export class CreateRussianShopEntityService { - constructor( - private claimsService: ClaimsService, - private idGenerator: IdGeneratorService, - ) {} - - createShop(creationData: RussianShopForm): Observable { - return this.claimsService - .createClaim({ changeset: this.createShopCreationModifications(creationData) }) - .pipe( - switchMap((claim) => { - return forkJoin([ - of(claim), - this.claimsService.requestReviewClaimByIDWithRevisionCheck({ - claimID: claim.id, - claimRevision: claim.revision, - }), - ]); - }), - pluck(0), - ); - } - - private createShopCreationModifications({ - shopDetails, - orgDetails: { created: newContractor, existing: contract }, - bankAccount: { created: bankAccount, existing: payoutTool }, - currency, - paymentInstitution, - }: RussianShopForm): PartyModification[] { - const contractorID = this.idGenerator.uuid(); - const contractID = this.idGenerator.uuid(); - const shopID = this.idGenerator.uuid(); - let payoutToolID = payoutTool?.id; - - const { - actualAddress, - bankAccount: russianBankAccount, - inn, - postAddress, - registeredName, - registeredNumber, - representativeDocument, - representativeFullName, - representativePosition, - } = contract?.contractor || { ...newContractor, postAddress: '' }; - - const payoutToolBankAccount = payoutTool?.details || bankAccount; - - const result: PartyModification[] = [ - createRussianLegalEntityModification(contractorID, { - actualAddress, - russianBankAccount: createRussianBankAccountModification(russianBankAccount), - inn, - postAddress, - registeredName, - registeredNumber, - representativeDocument, - representativeFullName, - representativePosition, - }), - createContractCreationModification(contractID, { - contractorID, - paymentInstitution: { id: paymentInstitution?.id ?? 1 }, - }), - ]; - if (!payoutToolID) { - payoutToolID = this.idGenerator.uuid(); - result.push( - createRussianContractPayoutToolCreationModification( - contractID, - payoutToolID, - payoutToolBankAccount, - currency, - ), - ); - } - return [ - ...result, - createShopCreationModification(shopID, { - category: { - categoryID: shopDetails.category?.categoryID ?? 1, - }, - location: makeShopLocation({ url: shopDetails.url }), - details: { name: shopDetails.name }, - contractID, - payoutToolID, - }), - ]; - } -} diff --git a/src/app/shared/components/shop-creation/create-russian-shop-entity/types/russian-shop-entity.ts b/src/app/shared/components/shop-creation/create-russian-shop-entity/types/russian-shop-entity.ts deleted file mode 100644 index 95e3b141..00000000 --- a/src/app/shared/components/shop-creation/create-russian-shop-entity/types/russian-shop-entity.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { PaymentInstitution } from '@vality/swag-payments'; - -import { TypeUnion } from '@dsh/app/shared/components/shop-creation/created-existing-switch/created-existing-switch.component'; -import { ExistingBankAccountForm } from '@dsh/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.component'; - -import { ShopDetailsForm } from '../../shop-details-form/shop-details-form.component'; -import { OrgDetailsForm } from '../components/org-details-form/org-details-form.component'; -import { RussianBankAccountForm } from '../components/russian-bank-account-form/types/bank-account-form-data'; - -export interface RussianShopForm { - shopDetails: ShopDetailsForm; - orgDetails: OrgDetailsForm; - paymentInstitution: PaymentInstitution; - bankAccount: TypeUnion< - RussianBankAccountForm, - ExistingBankAccountForm<'PayoutToolDetailsBankAccount'> - >; - currency: string; -} diff --git a/src/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.component.html b/src/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.component.html deleted file mode 100644 index b209e76e..00000000 --- a/src/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.component.html +++ /dev/null @@ -1,21 +0,0 @@ -
- - -
- {{ t('loading') }} -
- -
{{ error$ | async | errorMessage | async }}
-
- - - -
-
diff --git a/src/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.component.ts b/src/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.component.ts deleted file mode 100644 index 30376d06..00000000 --- a/src/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.component.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { TranslocoService } from '@ngneat/transloco'; -import { UntilDestroy } from '@ngneat/until-destroy'; -import { FormControlSuperclass, createControlProviders } from '@vality/ng-core'; -import { - PayoutTool, - PayoutToolDetailsBankAccount, - PayoutToolDetailsInternationalBankAccount, - Shop, -} from '@vality/swag-payments'; -import { Observable, BehaviorSubject, of, throwError, EMPTY } from 'rxjs'; -import { switchMap, tap, share, catchError } from 'rxjs/operators'; -import { Overwrite } from 'utility-types'; - -import { PayoutsService } from '@dsh/app/api/payments'; -import { CommonError } from '@dsh/app/shared'; -import { progressTo, errorTo } from '@dsh/utils'; - -type BankAccountType = 'PayoutToolDetailsInternationalBankAccount' | 'PayoutToolDetailsBankAccount'; - -export type ExistingBankAccountForm = Overwrite< - PayoutTool, - { - details: T extends 'PayoutToolDetailsInternationalBankAccount' - ? PayoutToolDetailsInternationalBankAccount - : PayoutToolDetailsBankAccount; - } ->; - -@UntilDestroy() -@Component({ - selector: 'dsh-existing-bank-account', - templateUrl: 'existing-bank-account.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - providers: createControlProviders(() => ExistingBankAccountComponent), -}) -export class ExistingBankAccountComponent extends FormControlSuperclass< - ExistingBankAccountForm, - Shop -> { - @Input() bankAccountType: BankAccountType; - - payoutTool: PayoutTool = null; - progress$ = new BehaviorSubject(0); - error$ = new BehaviorSubject(null); - - constructor( - private payoutsService: PayoutsService, - private transloco: TranslocoService, - ) { - super(); - } - - protected setUpInnerToOuterValue$(value$: Observable): Observable { - return value$.pipe( - switchMap((shop) => - (shop?.contractID && shop?.payoutToolID - ? this.getPayoutToolByShop(shop) - : of(null) - ).pipe( - progressTo(this.progress$), - errorTo(this.error$, true), - catchError((err) => (console.error(err), EMPTY)), - ), - ), - tap((payoutTool) => (this.payoutTool = payoutTool)), - share(), - ); - } - - protected outerToInnerValue(): Shop { - return null; - } - - private getPayoutToolByShop(shop: Shop): Observable { - return this.payoutsService - .getPayoutToolByIDForParty({ - contractID: shop.contractID, - payoutToolID: shop.payoutToolID, - }) - .pipe( - switchMap((payoutTool) => { - if (payoutTool.details.detailsType !== this.bankAccountType) { - return ( - this.bankAccountType === 'PayoutToolDetailsInternationalBankAccount' - ? this.transloco.selectTranslate( - 'existingBankAccount.errors.onlyInternationalShopCanBeSelected', - null, - 'components', - ) - : this.transloco.selectTranslate( - 'existingBankAccount.errors.onlyRussianShopCanBeSelected', - null, - 'components', - ) - ).pipe(switchMap((t) => throwError(new CommonError(t)))); - } - return of(payoutTool); - }), - ); - } -} diff --git a/src/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.module.ts b/src/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.module.ts deleted file mode 100644 index 6419d930..00000000 --- a/src/app/shared/components/shop-creation/existing-bank-account/existing-bank-account.module.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { ReactiveFormsModule } from '@angular/forms'; -import { TranslocoModule } from '@ngneat/transloco'; -import { FlexModule } from 'ng-flex-layout'; - -import { ErrorMessageModule, PayoutToolDetailsModule } from '@dsh/app/shared'; -import { ShopFieldModule } from '@dsh/app/shared/components/inputs/shop-field'; - -import { ExistingBankAccountComponent } from './existing-bank-account.component'; - -@NgModule({ - imports: [ - TranslocoModule, - FlexModule, - ShopFieldModule, - ReactiveFormsModule, - CommonModule, - PayoutToolDetailsModule, - ErrorMessageModule, - ], - declarations: [ExistingBankAccountComponent], - exports: [ExistingBankAccountComponent], -}) -export class ExistingBankAccountModule {} diff --git a/src/app/shared/components/shop-creation/shop-creation.module.ts b/src/app/shared/components/shop-creation/shop-creation.module.ts index 2ec54272..bc9b12ef 100644 --- a/src/app/shared/components/shop-creation/shop-creation.module.ts +++ b/src/app/shared/components/shop-creation/shop-creation.module.ts @@ -13,7 +13,6 @@ import { ButtonModule } from '@dsh/components/buttons'; import { CreateShopDialogComponent } from './components/create-shop-dialog/create-shop-dialog.component'; import { CreateInternationalShopEntityModule } from './create-international-shop-entity'; -import { CreateRussianShopEntityModule } from './create-russian-shop-entity'; @NgModule({ imports: [ @@ -23,7 +22,6 @@ import { CreateRussianShopEntityModule } from './create-russian-shop-entity'; MatDialogModule, FlexLayoutModule, MatRadioModule, - CreateRussianShopEntityModule, CreateInternationalShopEntityModule, BaseDialogModule, ShopContractDetailsModule, diff --git a/src/assets/i18n/components/en.json b/src/assets/i18n/components/en.json index 67c047b7..ff9e371f 100644 --- a/src/assets/i18n/components/en.json +++ b/src/assets/i18n/components/en.json @@ -26,26 +26,6 @@ "registeredOffice": "Registration postal address", "tradingName": "Trade name" }, - "payoutTool": { - "currency": "Currency" - }, - "payoutToolDetails": { - "internationalBankAccount": { - "bankDetails": { - "abartn": "ABA Routing Transit Number", - "address": "Legal entity address", - "bic": "BIC", - "countryCode": "Country of residence", - "name": "Legal entity name" - }, - "correspondentBankAccount": "Corr. account", - "iban": "IBAN", - "number": "Account number" - }, - "wallet": { - "walletName": "Name" - } - }, "russianLegalEntity": { "actualAddress": "Location postal address", "inn": "INN", @@ -127,10 +107,6 @@ "tr": "tr - Turkish" } }, - "createRussianShopEntity": { - "send": "Send for review", - "title": "Request to create a shop" - }, "createdExistingSwitch": { "created": "Specify new", "existing": "Use existing" @@ -150,13 +126,6 @@ }, "status": "Status" }, - "existingBankAccount": { - "errors": { - "onlyInternationalShopCanBeSelected": "You can only choose an international shop", - "onlyRussianShopCanBeSelected": "You can only choose a Russian shop" - }, - "shopLabel": "Use shop-based props" - }, "existingContractForm": { "errors": { "onlyInternationalShopCanBeSelected": "You can only choose an international shop", @@ -178,13 +147,9 @@ "label": "Wallet holder" } }, - "internationalBankAccountForm": { - "correspondentAccount": "Correspondent account" - }, "internationalShopForm": { "organization": "Organization details", - "paymentInstitution": "Payment organization", - "payoutToolTitle": "Withdrawal of funds" + "paymentInstitution": "Payment organization" }, "invoiceDetails": { "amount": "Amount", @@ -207,17 +172,6 @@ "lastUpdate": "Last update", "update": "Update" }, - "newContractorForm": { - "form": { - "actualAddress": "Location postal address", - "inn": "INN", - "registeredName": "Legal entity name", - "registeredNumber": "OGRN/OGRNIP", - "representativeDocument": "EEC/representative document", - "representativeFullName": "EEC/representative full name", - "representativePosition": "Position of EEC/representative" - } - }, "newInternationalContractorForm": { "actualAddress": "Address of location (if different from the place of registration)", "country": "Country of residence", @@ -225,9 +179,6 @@ "registeredAddress": "Address of the place of registration", "tradingName": "Trade name (if applicable)" }, - "orgDetailsForm": { - "title": "Organization details" - }, "pageNotFound": { "back": "Back" }, @@ -239,16 +190,6 @@ "paymentInstitutionField": { "label": "Payment Institution" }, - "payoutToolForm": { - "abaRtn": "ABA RTN", - "accountNumber": "Account number", - "bankAddress": "Address of the legal entity of the banking organization", - "bankCountry": "Country of residence of the banking organization", - "bankName": "Name of the legal entity of the banking organization", - "bic": "BIC", - "description": "Either IBAN, BIC, ABA RTN, or the name, country, and address must be filled in", - "iban": "IBAN" - }, "refundDetails": { "amount": "Amount", "createdAt": "Created at", @@ -259,12 +200,6 @@ "refundStatusFilter": { "label": "Refund status" }, - "russianBankAccountForm": { - "account": "Operating account", - "bik": "BIC", - "name": "Name", - "postAccount": "Correspondent account" - }, "select-active-organization-dialog": { "confirm": "Confirm", "title": "Choose an active organization" @@ -290,10 +225,6 @@ "name": "Name of the shop", "url": "Shop URL" }, - "shopForm": { - "description": "To receive payouts on accepted payments to your bank account you need to specify the details", - "title": "Withdrawal of funds" - }, "shopsField": { "label": "Shop" }, diff --git a/src/assets/i18n/components/ru.json b/src/assets/i18n/components/ru.json index 60254473..b7f1d1c3 100644 --- a/src/assets/i18n/components/ru.json +++ b/src/assets/i18n/components/ru.json @@ -26,26 +26,6 @@ "registeredOffice": "Адрес места регистрации", "tradingName": "Торговое наименование" }, - "payoutTool": { - "currency": "Валюта" - }, - "payoutToolDetails": { - "internationalBankAccount": { - "bankDetails": { - "abartn": "ABA Routing Transit Number", - "address": "Адрес юр. лица", - "bic": "BIC", - "countryCode": "Страна резиденции", - "name": "Наименование юр. лица" - }, - "correspondentBankAccount": "Корр. счет", - "iban": "IBAN", - "number": "Номер счета" - }, - "wallet": { - "walletName": "Наименование" - } - }, "russianLegalEntity": { "actualAddress": "Почтовый адрес места нахождения", "inn": "ИНН", @@ -127,10 +107,6 @@ "tr": "tr - Турецкий" } }, - "createRussianShopEntity": { - "send": "Отправить на рассмотрение", - "title": "Заявка на создание магазина" - }, "createdExistingSwitch": { "created": "Указать новые", "existing": "Использовать существующие" @@ -150,13 +126,6 @@ }, "status": "Статус" }, - "existingBankAccount": { - "errors": { - "onlyInternationalShopCanBeSelected": "Можно выбрать только международный магазин", - "onlyRussianShopCanBeSelected": "Можно выбрать только российский магазин" - }, - "shopLabel": "Использовать реквизиты на основе магазина" - }, "existingContractForm": { "errors": { "onlyInternationalShopCanBeSelected": "Можно выбрать только международный магазин", @@ -178,13 +147,9 @@ "label": "Владелец кошелька" } }, - "internationalBankAccountForm": { - "correspondentAccount": "Корреспондентский счет" - }, "internationalShopForm": { "organization": "Сведения об организации", - "paymentInstitution": "Платежная организация", - "payoutToolTitle": "Вывод средств" + "paymentInstitution": "Платежная организация" }, "invoiceDetails": { "amount": "Стоимость", @@ -207,17 +172,6 @@ "lastUpdate": "Последнее обновление", "update": "Обновить" }, - "newContractorForm": { - "form": { - "actualAddress": "Почтовый адрес места нахождения", - "inn": "ИНН", - "registeredName": "Наименование юр. лица", - "registeredNumber": "ОГРН/ОГРНИП", - "representativeDocument": "Документ ЕИО/представителя", - "representativeFullName": "ФИО ЕИО/представителя", - "representativePosition": "Должность ЕИО/представителя" - } - }, "newInternationalContractorForm": { "actualAddress": "Адрес места нахождения (если отличается от места регистрации)", "country": "Страна резиденции", @@ -225,9 +179,6 @@ "registeredAddress": "Адрес места регистрации", "tradingName": "Торговое наименование (если применимо)" }, - "orgDetailsForm": { - "title": "Сведения об организации" - }, "pageNotFound": { "back": "Назад" }, @@ -239,16 +190,6 @@ "paymentInstitutionField": { "label": "Платежная организация" }, - "payoutToolForm": { - "abaRtn": "ABA RTN", - "accountNumber": "Номер счета", - "bankAddress": "Адрес юридического лица банковской организации", - "bankCountry": "Страна резиденции банковской организации", - "bankName": "Наименование юридического лица банковской организации", - "bic": "BIC", - "description": "Необходимо заполнить либо IBAN, либо BIC, либо ABA RTN, либо наименование, страну и адрес", - "iban": "IBAN" - }, "refundDetails": { "amount": "Сумма", "createdAt": "Совершен", @@ -259,12 +200,6 @@ "refundStatusFilter": { "label": "Статус возврата" }, - "russianBankAccountForm": { - "account": "Расчетный счет", - "bik": "БИК", - "name": "Наименование", - "postAccount": "Корреспондентский счет" - }, "select-active-organization-dialog": { "confirm": "Подтвердить", "title": "Выбор активной организации" @@ -290,10 +225,6 @@ "name": "Наименование магазина", "url": "URL адрес магазина" }, - "shopForm": { - "description": "Для получения выплат по принятым платежам на ваш банковский счет необходимо указать реквизиты", - "title": "Вывод средств" - }, "shopsField": { "label": "Магазин" }, diff --git a/src/assets/i18n/payment-section/en.json b/src/assets/i18n/payment-section/en.json index ad443835..c888feb2 100644 --- a/src/assets/i18n/payment-section/en.json +++ b/src/assets/i18n/payment-section/en.json @@ -336,42 +336,6 @@ "testEnv": "Test environment" } }, - "payouts": { - "createPayoutReport": { - "cancel": "Cancel", - "create": "Generate", - "descriptionStep1": "A report with the transactions register will be generated. This will take some time. Downloading the report and tracking the formation status is possible in the \"Reports\" section", - "descriptionStep2": "The report was successfully created and is in the process of forming. You can download the report and track its status in the \"Reports\" section", - "title": "Forming a report with the register of operations", - "toReports": "Go to \"Reports\" section" - }, - "errors": { - "createError": "An error occurred while trying to create a payout", - "createReportError": "Failed to create report" - }, - "headerRow": { - "amount": "Amount", - "createdAt": "Created at", - "payoutTool": "Payout tool", - "shop": "Shop" - }, - "panel": { - "actions": "Actions", - "createReport": "Generate a register of operations", - "payoutID": "Payout #{{num}}", - "shop": "Shop" - }, - "payouts": { - "amount": "Payout amount", - "any": "Any", - "createPayout": "Create a payout", - "created": "A request for payout has been successfully created", - "noPayoutTools": "There are no payout tools available", - "payoutTool": "Payout tool", - "shop": "Shop", - "title": "Creating a payout to a wallet" - } - }, "reportTypesFilter": { "activeLabel": "Report type", "label": "All report types" @@ -451,10 +415,6 @@ "error": "Failed to retrieve contract data", "title": "Contract details" }, - "shopPayoutTool": { - "error": "Failed to receive the payout tool details", - "title": "Payout tool" - }, "suspend": { "error": "An error occurred while freezing the shop", "success": "The shop is frozen" diff --git a/src/assets/i18n/payment-section/ru.json b/src/assets/i18n/payment-section/ru.json index ec4c0986..9ba8eb50 100644 --- a/src/assets/i18n/payment-section/ru.json +++ b/src/assets/i18n/payment-section/ru.json @@ -336,42 +336,6 @@ "testEnv": "Тест. окружение" } }, - "payouts": { - "createPayoutReport": { - "cancel": "Отмена", - "create": "Сформировать", - "descriptionStep1": "Будет сформирован отчет с реестром операций. Для этого потребуется некоторое время. Загрузить отчет, и отслеживать статус формирования возможно в разделе \"Отчеты\"", - "descriptionStep2": "Отчет успешно создан и находится в процессе формирования. Загрузить отчет, и отслеживать статус формирования возможно в разделе \"Отчеты\"", - "title": "Формирование отчета с реестром операций", - "toReports": "Перейти в раздел \"Отчеты\"" - }, - "errors": { - "createError": "Произошла ошибка при попытке создания возмещения", - "createReportError": "Не удалось создать отчет" - }, - "headerRow": { - "amount": "Сумма", - "createdAt": "Дата возмещения", - "payoutTool": "Средство вывода", - "shop": "Магазин" - }, - "panel": { - "actions": "Действия", - "createReport": "Сформировать реестр операций", - "payoutID": "Выплата #{{num}}", - "shop": "Магазин" - }, - "payouts": { - "amount": "Сумма списания", - "any": "Любой", - "createPayout": "Создать выплату", - "created": "Заявка на выплату успешно создана", - "noPayoutTools": "Отсутствуют доступные инструменты вывода средств", - "payoutTool": "Инструмент вывода средств", - "shop": "Магазин", - "title": "Создание выплаты на кошелек" - } - }, "reportTypesFilter": { "activeLabel": "Типы формирования", "label": "Все типы формирования" @@ -451,10 +415,6 @@ "error": "Не удалось получить данные контракта", "title": "Данные контракта" }, - "shopPayoutTool": { - "error": "Не удалось получить данные средства вывода", - "title": "Средство вывода" - }, "suspend": { "error": "Произошла ошибка при заморозке магазина", "success": "Магазин заморожен"