| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- import { Injectable } from "@angular/core";
- import { of as observableOf, Observable, throwError } from "rxjs";
- import { HttpClient, HttpHeaders } from "@angular/common/http";
- import { retry, catchError, map, timeout } from "rxjs/operators";
- import { environment } from "@environments/environment";
- @Injectable({
- providedIn: "root"
- })
- export class CatalogsService {
- time: number = 6000;
- constructor(private http: HttpClient) {}
- getCatalogInfo(url: string) {
- return this.http
- .get<any>(`${environment.productionApiUrl}/${url}`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // paises
- getCountries() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/paises`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // empresas
- getCompanies() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/empresas`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // entidades-financieras
- getFinancialEntities() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/entidades-financieras`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // origenes-fondos
- getFundsOrigins() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/origenes-fondos`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // periodicidades
- getPeriodicities() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/periodicidades`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // plazos
- getPaymentTerms() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/plazos`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // tipos-bases
- getBaseTypes() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/tipos-bases`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // tipos-emisores
- getEmitterTypes() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/tipos-emisores`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // tipos-entidades
- getEntityTypes() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/tipos-entidades`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // tipos-instrumentos
- getInstrumentTypes() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/tipos-instrumentos`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // tipos-mercados
- getMarketTypes() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/tipos-mercados`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // tipos-operaciones
- getOperationTypes() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/tipos-operaciones`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // tipos-pagos
- getPaymentTypes() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/tipos-pagos`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // tipos-rentas
- getRevenueTypes() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/tipos-rentas`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // tipos-tasas
- getRateTypes() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/tipos-tasas`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // calificadoras
- getRateAgencies() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/calificadoras`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // calificaciones
- getScores() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/calificaciones`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- // formato ingreso
- getIncomeFormat() {
- return this.http
- .get<any>(`${environment.productionApiUrl}/formato-ingresos`, {})
- .pipe(
- map(response => {
- return response;
- }),
- catchError(this.errorHandl)
- );
- }
- /**
- *
- * api/calificacion/<int:pk>
- ^ api/calificaciones
- ^ api/calificadora/<int:pk>
- ^ api/calificadoras
- ^ api/empresa/<int:pk>
- ^ api/empresas
- ^ api/entidad-financiera/<int:pk>
- ^ api/entidades-financieras
- ^ api/estado-inversion/<int:pk>
- ^ api/estados-inversiones
- *
- *
- *
- */
- //if(error.error instanceof ErrorEvent) {
- errorHandl(error) {
- let errorMessage = "";
- if (error.error) {
- // Get client-side error
- errorMessage = error.error;
- } else {
- // Get server-side error
- errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`;
- }
- return throwError(errorMessage);
- }
- }
|