Fix cancel payment & refactor orgs (#91)

This commit is contained in:
Rinat Arsaev 2022-11-11 18:48:05 +06:00 committed by GitHub
parent 9bab9eb029
commit 3a7bd802a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 28 additions and 55 deletions

14
package-lock.json generated
View File

@ -36,7 +36,7 @@
"@vality/swag-dark-api": "0.1.1-a3f1678.0",
"@vality/swag-messages": "1.0.1-03e1014.0",
"@vality/swag-organizations": "1.0.1-cd6cc10.0",
"@vality/swag-payments": "0.1.1-37e6f46.0",
"@vality/swag-payments": "0.1.1-d71aebc.0",
"@vality/swag-questionary-aggr-proxy": "0.1.1-1dc5add.0",
"@vality/swag-url-shortener": "0.1.1-f780d07.0",
"@vality/swag-wallet": "0.1.1-9a236df.0",
@ -5039,9 +5039,9 @@
}
},
"node_modules/@vality/swag-payments": {
"version": "0.1.1-37e6f46.0",
"resolved": "https://registry.npmjs.org/@vality/swag-payments/-/swag-payments-0.1.1-37e6f46.0.tgz",
"integrity": "sha512-mnINBuklAgRzkx/Q9RboScrdl2TZlXrHEywDZq4AaJFznoJLfR1yNrqjxh9g7SrNJfoTh+qbuJjxPgd+5oG7Tg==",
"version": "0.1.1-d71aebc.0",
"resolved": "https://registry.npmjs.org/@vality/swag-payments/-/swag-payments-0.1.1-d71aebc.0.tgz",
"integrity": "sha512-i+3Fzz/VEFwGprs+vQxqECR5EshFYS5Cb/peeqgYs3RQVucu9D/gunRZNxSe437rw1wOmW9kkxPImFpap90gOQ==",
"dependencies": {
"tslib": "^2.3.0"
},
@ -21325,9 +21325,9 @@
}
},
"@vality/swag-payments": {
"version": "0.1.1-37e6f46.0",
"resolved": "https://registry.npmjs.org/@vality/swag-payments/-/swag-payments-0.1.1-37e6f46.0.tgz",
"integrity": "sha512-mnINBuklAgRzkx/Q9RboScrdl2TZlXrHEywDZq4AaJFznoJLfR1yNrqjxh9g7SrNJfoTh+qbuJjxPgd+5oG7Tg==",
"version": "0.1.1-d71aebc.0",
"resolved": "https://registry.npmjs.org/@vality/swag-payments/-/swag-payments-0.1.1-d71aebc.0.tgz",
"integrity": "sha512-i+3Fzz/VEFwGprs+vQxqECR5EshFYS5Cb/peeqgYs3RQVucu9D/gunRZNxSe437rw1wOmW9kkxPImFpap90gOQ==",
"requires": {
"tslib": "^2.3.0"
}

View File

@ -54,7 +54,7 @@
"@vality/swag-dark-api": "0.1.1-a3f1678.0",
"@vality/swag-messages": "1.0.1-03e1014.0",
"@vality/swag-organizations": "1.0.1-cd6cc10.0",
"@vality/swag-payments": "0.1.1-37e6f46.0",
"@vality/swag-payments": "0.1.1-d71aebc.0",
"@vality/swag-questionary-aggr-proxy": "0.1.1-1dc5add.0",
"@vality/swag-url-shortener": "0.1.1-f780d07.0",
"@vality/swag-wallet": "0.1.1-9a236df.0",

View File

@ -1,7 +1,8 @@
import { Injectable } from '@angular/core';
import { AnalyticsService as ApiAnalyticsService } from '@vality/swag-anapi-v2';
import { createApi, PartyIdExtension } from '../utils';
import { createApi } from '../utils';
import { PartyIdExtension } from '../utils/extensions';
@Injectable({
providedIn: 'root',

View File

@ -1,7 +1,8 @@
import { Injectable } from '@angular/core';
import { ReportsService as ApiReportsService } from '@vality/swag-anapi-v2';
import { createApi, PartyIdExtension } from '../utils';
import { createApi } from '../utils';
import { PartyIdExtension } from '../utils/extensions';
@Injectable({
providedIn: 'root',

View File

@ -1,7 +1,8 @@
import { Injectable } from '@angular/core';
import { SearchService as ApiSearchService } from '@vality/swag-anapi-v2';
import { createApi, PartyIdExtension } from '../utils';
import { createApi } from '../utils';
import { PartyIdExtension } from '../utils/extensions';
@Injectable({
providedIn: 'root',

View File

@ -4,7 +4,8 @@ import { ClaimsService as ApiClaimsService } from '@vality/swag-claim-management
import { throwError } from 'rxjs';
import { catchError, switchMap } from 'rxjs/operators';
import { createApi, PartyIdExtension, ApiMethodParams } from '../utils';
import { createApi, ApiMethodParams } from '../utils';
import { PartyIdExtension } from '../utils/extensions';
@Injectable({
providedIn: 'root',

View File

@ -1,2 +1,2 @@
export * from './party-id-extension';
export * from './api-method-params';
export * from './api-extension';

View File

@ -0,0 +1 @@
export * from './party-id-extension';

View File

@ -3,7 +3,7 @@ import { first, map } from 'rxjs/operators';
import { KeycloakTokenInfoService } from '@dsh/app/shared/services/keycloak-token-info';
import { ApiExtension } from './api-extension';
import { ApiExtension } from '../create-api';
@Injectable({
providedIn: 'root',

View File

@ -1,6 +1,4 @@
export * from './auth.module';
export * from './app-auth-guard.service';
export * from './roles';
export * from './protected-route';
// eslint-disable-next-line import/export
export * from './keycloak';

View File

@ -1,12 +0,0 @@
import { Route } from '@angular/router';
import { AppAuthGuardService } from './app-auth-guard.service';
import { Roles } from './roles';
export function protectedRoute(route: Route, roles: Roles[]): Route {
return {
...route,
canActivate: [...(route.canActivate || []), AppAuthGuardService],
data: { ...(route.data || {}), roles },
};
}

View File

@ -1,15 +0,0 @@
export enum Roles {
InvoicesPaymentsRead = 'invoices.*.payments:read',
CustomersBindingsRead = 'customers.*.bindings:read',
PartyRead = 'party:read',
InvoicesRead = 'invoices:read',
PayoutsWrite = 'payouts:write',
PaymentResourcesWrite = 'payment_resources:write',
PayoutsRead = 'payouts:read',
CustomersWrite = 'customers:write',
InvoicesPaymentsWrite = 'invoices.*.payments:write',
InvoicesWrite = 'invoices:write',
PartyWrite = 'party:write',
CustomersRead = 'customers:read',
CustomersBindingsWrite = 'customers.*.bindings:write',
}

View File

@ -2,7 +2,6 @@ import { Component, Inject } from '@angular/core';
import { Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { FormBuilder, FormGroup } from '@ngneat/reactive-forms';
import { Reason } from '@vality/swag-payments';
import { PaymentsService } from '@dsh/api/payments';
import { BaseDialogResponseStatus } from '@dsh/app/shared/components/dialog/base-dialog';
@ -35,17 +34,15 @@ export class CancelHoldDialogComponent {
const { reason } = this.form.value;
const { invoiceID, paymentID } = this.dialogData;
this.paymentsService
.cancelPayment({ invoiceID, paymentID, cancelPayment: reason as unknown as Reason })
.subscribe({
next: () => {
this.dialogRef.close(BaseDialogResponseStatus.Success);
},
error: (err: Error) => {
this.errorService.error(err);
this.dialogRef.close(BaseDialogResponseStatus.Error);
},
});
this.paymentsService.cancelPayment({ invoiceID, paymentID, cancelPayment: { reason } }).subscribe({
next: () => {
this.dialogRef.close(BaseDialogResponseStatus.Success);
},
error: (err: Error) => {
this.errorService.error(err);
this.dialogRef.close(BaseDialogResponseStatus.Error);
},
});
}
decline(): void {