mirror of
https://github.com/valitydev/dashboard.git
synced 2024-11-06 02:25:23 +00:00
Fix cancel payment & refactor orgs (#91)
This commit is contained in:
parent
9bab9eb029
commit
3a7bd802a3
14
package-lock.json
generated
14
package-lock.json
generated
@ -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"
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -1,2 +1,2 @@
|
||||
export * from './party-id-extension';
|
||||
export * from './api-method-params';
|
||||
export * from './api-extension';
|
||||
|
1
src/app/api/utils/extensions/index.ts
Normal file
1
src/app/api/utils/extensions/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './party-id-extension';
|
@ -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',
|
@ -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';
|
||||
|
@ -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 },
|
||||
};
|
||||
}
|
@ -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',
|
||||
}
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user