Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit f307d58

Browse files
committed
added user invoices download endpoints
1 parent 76b53a0 commit f307d58

File tree

7 files changed

+88
-19
lines changed

7 files changed

+88
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@funixproductions/angular-core",
3-
"version": "0.1.9",
3+
"version": "0.1.10",
44
"description": "Package used in all FunixProductions Angular projects",
55
"scripts": {
66
"ng": "ng",

projects/funixproductions-requests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@funixproductions/funixproductions-requests",
3-
"version": "0.1.9",
3+
"version": "0.1.10",
44
"description": "Package used in all FunixProductions Angular projects",
55
"peerDependencies": {
66
"@angular/common": "^17.1.0",
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {ApiDTO} from "../../../core/dtos/api-dto";
2+
3+
export class FunixprodBillingDto extends ApiDTO {
4+
billingDescription: string = '';
5+
paymentType: PaymentType = PaymentType.PAYPAL
6+
billedEntity: BilledEntity = new BilledEntity()
7+
paymentOrigin: PaymentOrigin = PaymentOrigin.OTHER
8+
amountTotal: Price = new Price()
9+
vatInformation?: string
10+
}
11+
12+
export enum PaymentType {
13+
PAYPAL = "PAYPAL",
14+
CREDIT_CARD = "CREDIT_CARD",
15+
PAYSAFE_CARD = "PAYSAFE_CARD"
16+
}
17+
18+
export enum PaymentOrigin {
19+
PACIFISTA = "PACIFISTA",
20+
FUNIXGAMING = "FUNIXGAMING",
21+
OTHER = "OTHER"
22+
}
23+
24+
export class BilledEntity {
25+
name: string = ''
26+
address?: string
27+
zipCode?: string
28+
city?: string
29+
phone?: string
30+
email: string = ''
31+
website?: string
32+
siret?: string
33+
tvaCode?: string
34+
userFunixProdId?: string
35+
}
36+
37+
export class Price {
38+
ht: number = 0
39+
tax: number = 0
40+
ttc: number = 0
41+
discount?: number
42+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import {CrudHttpClient} from "../../../core/components/requests/crud-http-client";
2+
import {FunixprodBillingDto} from "../dtos/funixprod-billing-dto";
3+
import {HttpClient} from "@angular/common/http";
4+
import {environment} from "../../../../../environments/environment";
5+
import {environmentDev} from "../../../../../environments/environment-dev";
6+
7+
export class FunixprodBillingService extends CrudHttpClient<FunixprodBillingDto> {
8+
9+
constructor(protected httpClient: HttpClient, production: boolean) {
10+
super(
11+
httpClient,
12+
production ? environment.funixproductionsApiUrl : environmentDev.funixproductionsApiUrl,
13+
"billing/user"
14+
);
15+
}
16+
17+
downloadInvoice(invoiceId: string) {
18+
this.http.get<Blob>(this.domain + this.path + '/' + invoiceId + '/invoice').subscribe({
19+
next: (data: Blob) => {
20+
const blob = new Blob([data], { type: 'application/pdf' });
21+
const url = window.URL.createObjectURL(blob);
22+
const link = document.createElement('a');
23+
link.href = url;
24+
link.download = 'funixproductions_facture_' + invoiceId + '.pdf';
25+
link.click();
26+
}
27+
});
28+
}
29+
30+
}

projects/funixproductions-requests/src/lib/services/funixproductions-api/user/services/user-auth-service.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ export class UserAuthService extends FunixprodHttpClient {
1818

1919
constructor(protected httpClient: HttpClient, production: boolean) {
2020
super();
21-
this.url = (production ? environment.funixproductionsApiUrl : environmentDev.funixproductionsApiUrl) + 'user/auth/';
21+
this.url = (production ? environment.funixproductionsApiUrl : environmentDev.funixproductionsApiUrl) + 'user/auth';
2222
}
2323

2424
register(request: UserCreationDTO, captchaCode: string): Observable<UserDTO> {
25-
return this.httpClient.post<UserDTO>(this.url + 'register', request, {headers: super.getHeaders(captchaCode)})
25+
return this.httpClient.post<UserDTO>(this.url + '/register', request, {headers: super.getHeaders(captchaCode)})
2626
.pipe(
2727
catchError((error: HttpErrorResponse) => {
2828
return throwError(() => this.buildErrorDto(error));
@@ -31,7 +31,7 @@ export class UserAuthService extends FunixprodHttpClient {
3131
}
3232

3333
login(request: UserLoginDTO, captchaCode: string): Observable<UserTokenDTO> {
34-
return this.httpClient.post<UserTokenDTO>(this.url + 'login', request, {headers: super.getHeaders(captchaCode)})
34+
return this.httpClient.post<UserTokenDTO>(this.url + '/login', request, {headers: super.getHeaders(captchaCode)})
3535
.pipe(
3636
catchError((error: HttpErrorResponse) => {
3737
return throwError(() => this.buildErrorDto(error));
@@ -40,7 +40,7 @@ export class UserAuthService extends FunixprodHttpClient {
4040
}
4141

4242
logout(): Observable<void> {
43-
return this.httpClient.post<void>(this.url + 'logout', null, {headers: super.getHeaders()})
43+
return this.httpClient.post<void>(this.url + '/logout', null, {headers: super.getHeaders()})
4444
.pipe(
4545
catchError((error: HttpErrorResponse) => {
4646
return throwError(() => this.buildErrorDto(error));
@@ -49,7 +49,7 @@ export class UserAuthService extends FunixprodHttpClient {
4949
}
5050

5151
currentUser(): Observable<UserDTO> {
52-
return this.httpClient.get<UserDTO>(this.url + 'current', {headers: super.getHeaders()})
52+
return this.httpClient.get<UserDTO>(this.url + '/current', {headers: super.getHeaders()})
5353
.pipe(
5454
catchError((error: HttpErrorResponse) => {
5555
return throwError(() => this.buildErrorDto(error));
@@ -59,7 +59,7 @@ export class UserAuthService extends FunixprodHttpClient {
5959

6060
getSessions(page: string = '0', elemsPerPage: string = '30'): Observable<Paginated<UserTokenDTO>> {
6161
const params: HttpParams = new HttpParams().set('page', page).set('elementsPerPage', elemsPerPage);
62-
return this.httpClient.get<Paginated<UserTokenDTO>>(this.url + 'sessions', {headers: super.getHeaders(), params: params})
62+
return this.httpClient.get<Paginated<UserTokenDTO>>(this.url + '/sessions', {headers: super.getHeaders(), params: params})
6363
.pipe(
6464
catchError((error: HttpErrorResponse) => {
6565
return throwError(() => this.buildErrorDto(error));
@@ -75,7 +75,7 @@ export class UserAuthService extends FunixprodHttpClient {
7575
params = new HttpParams().set('id', ids as string);
7676
}
7777

78-
return this.httpClient.delete<void>(this.url + 'sessions', {headers: super.getHeaders(), params: params})
78+
return this.httpClient.delete<void>(this.url + '/sessions', {headers: super.getHeaders(), params: params})
7979
.pipe(
8080
catchError((error: HttpErrorResponse) => {
8181
return throwError(() => this.buildErrorDto(error));
@@ -84,7 +84,7 @@ export class UserAuthService extends FunixprodHttpClient {
8484
}
8585

8686
resetPasswordRequest(request: UserPasswordResetRequestDTO, captchaCode: string): Observable<void> {
87-
return this.httpClient.post<void>(this.url + 'resetPasswordRequest', request, {headers: super.getHeaders(captchaCode)})
87+
return this.httpClient.post<void>(this.url + '/resetPasswordRequest', request, {headers: super.getHeaders(captchaCode)})
8888
.pipe(
8989
catchError((error: HttpErrorResponse) => {
9090
return throwError(() => this.buildErrorDto(error));
@@ -93,7 +93,7 @@ export class UserAuthService extends FunixprodHttpClient {
9393
}
9494

9595
resetPassword(request: UserPasswordResetDTO, captchaCode: string): Observable<void> {
96-
return this.httpClient.post<void>(this.url + 'resetPassword', request, {headers: super.getHeaders(captchaCode)})
96+
return this.httpClient.post<void>(this.url + '/resetPassword', request, {headers: super.getHeaders(captchaCode)})
9797
.pipe(
9898
catchError((error: HttpErrorResponse) => {
9999
return throwError(() => this.buildErrorDto(error));
@@ -102,7 +102,7 @@ export class UserAuthService extends FunixprodHttpClient {
102102
}
103103

104104
requestValidationCode(): Observable<void> {
105-
return this.httpClient.post<void>(this.url + 'valid-account', null, {headers: super.getHeaders()})
105+
return this.httpClient.post<void>(this.url + '/valid-account', null, {headers: super.getHeaders()})
106106
.pipe(
107107
catchError((error: HttpErrorResponse) => {
108108
return throwError(() => this.buildErrorDto(error));
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import {ApiDTO} from "../../../../../../core/dtos/api-dto";
2+
import {PaymentType} from "../../../../../../funixproductions-api/billing/dtos/funixprod-billing-dto";
23

34
export class PacifistaPaymentResponseDTO extends ApiDTO {
45
paymentExternalOrderId?: string;
56
paymentType?: PaymentType;
67
orderPaid?: boolean;
78
urlClientRedirection?: string;
8-
}
9-
10-
export enum PaymentType {
11-
PAYPAL = 'PAYPAL',
12-
CREDIT_CARD = 'CREDIT_CARD',
13-
PAYSAFE_CARD = 'PAYSAFE_CARD',
14-
}
9+
}

projects/funixproductions-requests/src/public-api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export * from './lib/services/funixproductions-api/accounting/services/income-ac
3333
export * from './lib/services/funixproductions-api/accounting/services/product-accounting-service';
3434
export * from './lib/services/funixproductions-api/accounting/dtos/income-dto';
3535
export * from './lib/services/funixproductions-api/accounting/dtos/product-dto';
36+
export * from './lib/services/funixproductions-api/billing/dtos/funixprod-billing-dto';
37+
export * from './lib/services/funixproductions-api/billing/services/funixprod-billing-service';
3638
export * from './lib/services/funixproductions-api/user/services/user-jwt-checker-service';
3739
export * from './lib/services/funixproductions-api/user/dtos/user-session-jwt';
3840
export * from './lib/services/funixproductions-api/user/services/user-auth-service';

0 commit comments

Comments
 (0)