Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
275 changes: 168 additions & 107 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@funixproductions/angular-core",
"version": "0.4.5",
"version": "0.4.6",
"description": "Package used in all FunixProductions Angular projects",
"scripts": {
"ng": "ng",
Expand Down
2 changes: 1 addition & 1 deletion projects/funixproductions-requests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@funixproductions/funixproductions-requests",
"version": "0.4.5",
"version": "0.4.6",
"description": "Package used in all FunixProductions Angular projects",
"peerDependencies": {
"@angular/common": "^19.1.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import {ApiDTO} from "../../../core/dtos/api-dto";

export class PaypalPlanDTO extends ApiDTO {
/**
* The plan id de paypal
*/
planId?: string;

/**
* The subscription name.
*/
name: string;

/**
* The subscription description
*/
description: string;

/**
* The image URL for the product.
*/
imageUrl: string;

/**
* The home page URL for the product.
*/
homeUrl: string;

/**
* The subscription price. HT Hors taxes
*/
price: number;

/**
* Le nom du projet auquel est associé le plan, exemple pacifista pour un pacifista+
*/
projectName: string;

constructor(
name: string,
description: string,
imageUrl: string,
homeUrl: string,
price: number,
projectName: string,
planId?: string
) {
super();
this.name = name;
this.description = description;
this.imageUrl = imageUrl;
this.homeUrl = homeUrl;
this.price = price;
this.projectName = projectName;
this.planId = planId;
}

equals(other: PaypalPlanDTO): boolean {
return (
this.name === other.name &&
this.description === other.description &&
this.imageUrl === other.imageUrl &&
this.homeUrl === other.homeUrl &&
this.price === other.price &&
this.projectName === other.projectName &&
(this.planId ? this.planId === other.planId : true)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {PaypalPlanDTO} from "./PaypalPlanDTO";
import {ApiDTO} from "../../../core/dtos/api-dto";

export class PaypalSubscriptionDTO extends ApiDTO {
/**
* Le plan, pour lequel l'abonnement est créé. Doit au moins contenir l'id et le planId du plan pour la création.
*/
plan!: PaypalPlanDTO;

/**
* L'id de l'abonnement par PayPal
*/
subscriptionId?: string;

/**
* L'id utilisateur de la funixproductions
*/
funixProdUserId!: string;

/**
* Si l'abonnement est actif ou non. (pause ou pas)
*/
active!: boolean;

/**
* Le nombre de cycles d'abonnement terminés
*/
cyclesCompleted!: number;

/**
* La date du dernier paiement
*/
lastPaymentDate?: Date;

/**
* La date du prochain paiement
*/
nextPaymentDate?: Date;

/**
* Le lien pour approuver l'abonnement
*/
approveLink?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,33 @@ import {PacifistaShopCategoryDTO} from "../../categories/dtos/PacifistaShopCateg
import {PacifistaServerType} from "../../../../core/enums/PacifistaServerType";

export class PacifistaShopArticleDTO extends ApiDTO {
category?: PacifistaShopCategoryDTO;
name?: string;
description?: string;
htmlDescription?: string;
price?: number;
category: PacifistaShopCategoryDTO;
name: string;
description: string;
htmlDescription: string;
markDownDescription: string;
price: number;
tax?: number;
priceWithTax?: number;
commandExecuted?: string;
commandExecuted: string;
serverType?: PacifistaServerType;

constructor(category: PacifistaShopCategoryDTO,
name: string,
description: string,
htmlDescription: string,
markDownDescription: string,
price: number,
commandExecuted: string,
serverType?: PacifistaServerType) {
super();
this.category = category;
this.name = name;
this.description = description;
this.htmlDescription = htmlDescription;
this.markDownDescription = markDownDescription;
this.price = price;
this.commandExecuted = commandExecuted;
this.serverType = serverType;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import {ApiDTO} from "../../../../../core/dtos/api-dto";

export class PacifistaShopCategoryDTO extends ApiDTO {
name?: string;
description?: string;
multiPurchaseAllowed?: boolean;
name: string;
description: string;
multiPurchaseAllowed: boolean;

constructor(name: string, description: string, multiPurchaseAllowed: boolean) {
super();
this.name = name;
this.description = description;
this.multiPurchaseAllowed = multiPurchaseAllowed;
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@

export class PacifistaPaymentRequestDTO {
articles?: PacifistaShopArtcileRequestDTO[];
articles: PacifistaShopArtcileRequestDTO[];
creditCard?: PacifistaShopCreditCardDTO;

constructor(articles: PacifistaShopArtcileRequestDTO[],
creditCard?: PacifistaShopCreditCardDTO) {
this.articles = articles;
this.creditCard = creditCard;
}
}

export class PacifistaShopArtcileRequestDTO {
articleId?: string;
quantity?: number;
articleId: string;
quantity: number;

constructor(articleId: string, quantity: number) {
this.articleId = articleId;
this.quantity = quantity;
}
}

export class PacifistaShopCreditCardDTO {
cardHolderName?: string;
cardNumber?: string;
securityCode?: string;
expirationMonth?: number;
expirationYear?: number;
cardHolderName: string;
cardNumber: string;
securityCode: string;
expirationMonth: number;
expirationYear: number;

constructor(cardHolderName: string,
cardNumber: string,
securityCode: string,
expirationMonth: number,
expirationYear: number) {
this.cardHolderName = cardHolderName;
this.cardNumber = cardNumber;
this.securityCode = securityCode;
this.expirationMonth = expirationMonth;
this.expirationYear = expirationYear;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import {FunixprodHttpClient} from "../../../../../core/components/requests/funixprod-http-client";
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
import {environment} from "../../../../../../../environments/environment";
import {environmentDev} from "../../../../../../../environments/environment-dev";
import {catchError, Observable, throwError} from "rxjs";
import {PaypalSubscriptionDTO} from "../../../../../funixproductions-api/billing/dtos/PaypalSubscriptionDTO";

export class PacifistaPlusPaymentService extends FunixprodHttpClient {

url: string;

constructor(protected httpClient: HttpClient, production: boolean) {
super();
this.url = production ? environment.pacifistaApiUrl : environmentDev.pacifistaApiUrl + 'web/shop/pacifistaplus';
}

createSubscription(): Observable<PaypalSubscriptionDTO> {
return this.httpClient.post<PaypalSubscriptionDTO>(this.url, null, {headers: super.getHeaders()})
.pipe(
catchError((error: HttpErrorResponse) => {
return throwError(() => this.buildErrorDto(error));
})
);
}

getSubscriptionStatus(): Observable<PaypalSubscriptionDTO> {
return this.httpClient.get<PaypalSubscriptionDTO>(this.url, {headers: super.getHeaders()})
.pipe(
catchError((error: HttpErrorResponse) => {
return throwError(() => this.buildErrorDto(error));
})
);
}

pauseSubscription(): Observable<PaypalSubscriptionDTO> {
return this.httpClient.post<PaypalSubscriptionDTO>(this.url + '/pause', null, {headers: super.getHeaders()})
.pipe(
catchError((error: HttpErrorResponse) => {
return throwError(() => this.buildErrorDto(error));
})
);
}

resumeSubscription(): Observable<PaypalSubscriptionDTO> {
return this.httpClient.post<PaypalSubscriptionDTO>(this.url + '/resume', null, {headers: super.getHeaders()})
.pipe(
catchError((error: HttpErrorResponse) => {
return throwError(() => this.buildErrorDto(error));
})
);
}

cancelSubscription(): Observable<PaypalSubscriptionDTO> {
return this.httpClient.post<PaypalSubscriptionDTO>(this.url + '/cancel', null, {headers: super.getHeaders()})
.pipe(
catchError((error: HttpErrorResponse) => {
return throwError(() => this.buildErrorDto(error));
})
);
}

}
3 changes: 3 additions & 0 deletions projects/funixproductions-requests/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export * from './lib/services/funixproductions-api/accounting/dtos/income-dto';
export * from './lib/services/funixproductions-api/accounting/dtos/product-dto';
export * from './lib/services/funixproductions-api/billing/dtos/funixprod-billing-dto';
export * from './lib/services/funixproductions-api/billing/services/funixprod-billing-service';
export * from './lib/services/funixproductions-api/billing/dtos/PaypalPlanDTO';
export * from './lib/services/funixproductions-api/billing/dtos/PaypalSubscriptionDTO';
export * from './lib/services/funixproductions-api/user/services/user-jwt-checker-service';
export * from './lib/services/funixproductions-api/user/dtos/user-session-jwt';
export * from './lib/services/funixproductions-api/user/services/user-auth-service';
Expand Down Expand Up @@ -83,6 +85,7 @@ export * from './lib/services/pacifista-api/web/shop/categories/dtos/PacifistaSh
export * from './lib/services/pacifista-api/web/shop/payment/dtos/responses/PacifistaPaymentResponseDTO';
export * from './lib/services/pacifista-api/web/shop/payment/dtos/requests/PacifistaPaymentRequestDTO';
export * from './lib/services/pacifista-api/web/shop/payment/services/PacifistaPaymentService';
export * from './lib/services/pacifista-api/web/shop/payment/services/PacifistaPlusPaymentService';

export * from './lib/services/pacifista-api/server/players/data/dtos/PacifistaPlayerDataDTO';
export * from './lib/services/pacifista-api/server/players/data/dtos/PacifistaPlayerChatMessageDTO';
Expand Down