From 8b840be0523b835e49abcf84f532a6039fd0a032 Mon Sep 17 00:00:00 2001 From: Antoine PRONNIER Date: Thu, 24 Apr 2025 21:22:06 +0200 Subject: [PATCH 1/2] wip p+ --- .../articles/dtos/PacifistaShopArticleDTO.ts | 32 ++++++++++++--- .../dtos/PacifistaShopCategoryDTO.ts | 13 ++++-- .../requests/PacifistaPaymentRequestDTO.ts | 40 ++++++++++++++----- .../services/PacifistaPlusPaymentService.ts | 0 4 files changed, 67 insertions(+), 18 deletions(-) create mode 100644 projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/payment/services/PacifistaPlusPaymentService.ts diff --git a/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/articles/dtos/PacifistaShopArticleDTO.ts b/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/articles/dtos/PacifistaShopArticleDTO.ts index 60760be..9dd4523 100644 --- a/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/articles/dtos/PacifistaShopArticleDTO.ts +++ b/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/articles/dtos/PacifistaShopArticleDTO.ts @@ -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; + } } diff --git a/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/categories/dtos/PacifistaShopCategoryDTO.ts b/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/categories/dtos/PacifistaShopCategoryDTO.ts index cfc99a1..6857c5b 100644 --- a/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/categories/dtos/PacifistaShopCategoryDTO.ts +++ b/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/categories/dtos/PacifistaShopCategoryDTO.ts @@ -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; + } } diff --git a/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/payment/dtos/requests/PacifistaPaymentRequestDTO.ts b/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/payment/dtos/requests/PacifistaPaymentRequestDTO.ts index 0b028e9..204dd85 100644 --- a/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/payment/dtos/requests/PacifistaPaymentRequestDTO.ts +++ b/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/payment/dtos/requests/PacifistaPaymentRequestDTO.ts @@ -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; + } } diff --git a/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/payment/services/PacifistaPlusPaymentService.ts b/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/payment/services/PacifistaPlusPaymentService.ts new file mode 100644 index 0000000..e69de29 From 54b54a28c01b42d75975da968338a2b4762abf9c Mon Sep 17 00:00:00 2001 From: Antoine PRONNIER Date: Fri, 25 Apr 2025 01:08:59 +0200 Subject: [PATCH 2/2] p+ --- package-lock.json | 275 +++++++++++------- package.json | 2 +- .../funixproductions-requests/package.json | 2 +- .../billing/dtos/PaypalPlanDTO.ts | 69 +++++ .../billing/dtos/PaypalSubscriptionDTO.ts | 44 +++ .../services/PacifistaPlusPaymentService.ts | 62 ++++ .../src/public-api.ts | 3 + 7 files changed, 348 insertions(+), 109 deletions(-) create mode 100644 projects/funixproductions-requests/src/lib/services/funixproductions-api/billing/dtos/PaypalPlanDTO.ts create mode 100644 projects/funixproductions-requests/src/lib/services/funixproductions-api/billing/dtos/PaypalSubscriptionDTO.ts diff --git a/package-lock.json b/package-lock.json index 5c32791..b22339d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@funixproductions/angular-core", - "version": "0.4.5", + "version": "0.4.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@funixproductions/angular-core", - "version": "0.4.5", + "version": "0.4.6", "dependencies": { "@angular/animations": "^19.1.7", "@angular/common": "^19.1.7", @@ -1421,27 +1421,27 @@ } }, "node_modules/@babel/helpers": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", - "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.0.tgz", + "integrity": "sha512-U5eyP/CTFPuNE3qk+WZMxFkp/4zUzdceQlfzf7DdGdhp+Fezd7HD+i8Y24ZuTMKX3wQBld449jijbGq6OdGNQg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/template": "^7.25.9", - "@babel/types": "^7.26.0" + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.9.tgz", - "integrity": "sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz", + "integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.26.9" + "@babel/types": "^7.27.0" }, "bin": { "parser": "bin/babel-parser.js" @@ -2589,15 +2589,15 @@ } }, "node_modules/@babel/template": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", - "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.0.tgz", + "integrity": "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.25.9", - "@babel/parser": "^7.25.9", - "@babel/types": "^7.25.9" + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0" }, "engines": { "node": ">=6.9.0" @@ -2623,9 +2623,9 @@ } }, "node_modules/@babel/types": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.9.tgz", - "integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz", + "integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==", "dev": true, "license": "MIT", "dependencies": { @@ -5048,6 +5048,21 @@ "linux" ] }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.40.0.tgz", + "integrity": "sha512-rKmSj6EXQRnhSkE22+WvrqOqRtk733x3p5sWpZilhmjnkHkpeCgWsFFo0dGnUGeA+OZjRl3+VYq+HyCOEuwcxQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true + }, "node_modules/@rollup/rollup-linux-s390x-gnu": { "version": "4.30.1", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.30.1.tgz", @@ -8325,6 +8340,22 @@ "node": ">=0.8.0" } }, + "node_modules/fdir": { + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz", + "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==", + "dev": true, + "license": "MIT", + "peer": true, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -14874,6 +14905,24 @@ "dev": true, "license": "MIT" }, + "node_modules/tinyglobby": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.13.tgz", + "integrity": "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -15405,16 +15454,19 @@ } }, "node_modules/vite": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.0.tgz", - "integrity": "sha512-7dPxoo+WsT/64rDcwoOjk76XHj+TqNTIvHKcuMQ1k4/SeHDaQt5GFAeLYzrimZrMpn/O6DtdI03WUjdxuPM0oQ==", + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.3.tgz", + "integrity": "sha512-5nXH+QsELbFKhsEfWLkHrvgRpTdGJzqOZ+utSdmPTvwHmvU6ITTm3xx+mRusihkcI8GeC7lCDyn3kDtiki9scw==", "dev": true, "license": "MIT", "peer": true, "dependencies": { "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", "postcss": "^8.5.3", - "rollup": "^4.30.1" + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" }, "bin": { "vite": "bin/vite.js" @@ -15928,9 +15980,9 @@ } }, "node_modules/vite/node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.8.tgz", - "integrity": "sha512-q217OSE8DTp8AFHuNHXo0Y86e1wtlfVrXiAlwkIvGRQv9zbc6mE3sjIVfwI8sYUyNxwOg0j/Vm1RKM04JcWLJw==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.40.0.tgz", + "integrity": "sha512-+Fbls/diZ0RDerhE8kyC6hjADCXA1K4yVNlH0EYfd2XjyH0UGgzaQ8MlT0pCXAThfxv3QUAczHaL+qSv1E4/Cg==", "cpu": [ "arm" ], @@ -15943,9 +15995,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-android-arm64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.8.tgz", - "integrity": "sha512-Gigjz7mNWaOL9wCggvoK3jEIUUbGul656opstjaUSGC3eT0BM7PofdAJaBfPFWWkXNVAXbaQtC99OCg4sJv70Q==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.40.0.tgz", + "integrity": "sha512-PPA6aEEsTPRz+/4xxAmaoWDqh67N7wFbgFUJGMnanCFs0TV99M0M8QhhaSCks+n6EbQoFvLQgYOGXxlMGQe/6w==", "cpu": [ "arm64" ], @@ -15958,9 +16010,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.8.tgz", - "integrity": "sha512-02rVdZ5tgdUNRxIUrFdcMBZQoaPMrxtwSb+/hOfBdqkatYHR3lZ2A2EGyHq2sGOd0Owk80oV3snlDASC24He3Q==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.40.0.tgz", + "integrity": "sha512-GwYOcOakYHdfnjjKwqpTGgn5a6cUX7+Ra2HeNj/GdXvO2VJOOXCiYYlRFU4CubFM67EhbmzLOmACKEfvp3J1kQ==", "cpu": [ "arm64" ], @@ -15973,9 +16025,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-darwin-x64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.8.tgz", - "integrity": "sha512-qIP/elwR/tq/dYRx3lgwK31jkZvMiD6qUtOycLhTzCvrjbZ3LjQnEM9rNhSGpbLXVJYQ3rq39A6Re0h9tU2ynw==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.40.0.tgz", + "integrity": "sha512-CoLEGJ+2eheqD9KBSxmma6ld01czS52Iw0e2qMZNpPDlf7Z9mj8xmMemxEucinev4LgHalDPczMyxzbq+Q+EtA==", "cpu": [ "x64" ], @@ -15988,9 +16040,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.8.tgz", - "integrity": "sha512-IQNVXL9iY6NniYbTaOKdrlVP3XIqazBgJOVkddzJlqnCpRi/yAeSOa8PLcECFSQochzqApIOE1GHNu3pCz+BDA==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.40.0.tgz", + "integrity": "sha512-r7yGiS4HN/kibvESzmrOB/PxKMhPTlz+FcGvoUIKYoTyGd5toHp48g1uZy1o1xQvybwwpqpe010JrcGG2s5nkg==", "cpu": [ "arm64" ], @@ -16003,9 +16055,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.8.tgz", - "integrity": "sha512-TYXcHghgnCqYFiE3FT5QwXtOZqDj5GmaFNTNt3jNC+vh22dc/ukG2cG+pi75QO4kACohZzidsq7yKTKwq/Jq7Q==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.40.0.tgz", + "integrity": "sha512-mVDxzlf0oLzV3oZOr0SMJ0lSDd3xC4CmnWJ8Val8isp9jRGl5Dq//LLDSPFrasS7pSm6m5xAcKaw3sHXhBjoRw==", "cpu": [ "x64" ], @@ -16018,9 +16070,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.8.tgz", - "integrity": "sha512-A4iphFGNkWRd+5m3VIGuqHnG3MVnqKe7Al57u9mwgbyZ2/xF9Jio72MaY7xxh+Y87VAHmGQr73qoKL9HPbXj1g==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.40.0.tgz", + "integrity": "sha512-y/qUMOpJxBMy8xCXD++jeu8t7kzjlOCkoxxajL58G62PJGBZVl/Gwpm7JK9+YvlB701rcQTzjUZ1JgUoPTnoQA==", "cpu": [ "arm" ], @@ -16033,9 +16085,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.8.tgz", - "integrity": "sha512-S0lqKLfTm5u+QTxlFiAnb2J/2dgQqRy/XvziPtDd1rKZFXHTyYLoVL58M/XFwDI01AQCDIevGLbQrMAtdyanpA==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.40.0.tgz", + "integrity": "sha512-GoCsPibtVdJFPv/BOIvBKO/XmwZLwaNWdyD8TKlXuqp0veo2sHE+A/vpMQ5iSArRUz/uaoj4h5S6Pn0+PdhRjg==", "cpu": [ "arm" ], @@ -16048,9 +16100,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.8.tgz", - "integrity": "sha512-jpz9YOuPiSkL4G4pqKrus0pn9aYwpImGkosRKwNi+sJSkz+WU3anZe6hi73StLOQdfXYXC7hUfsQlTnjMd3s1A==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.40.0.tgz", + "integrity": "sha512-L5ZLphTjjAD9leJzSLI7rr8fNqJMlGDKlazW2tX4IUF9P7R5TMQPElpH82Q7eNIDQnQlAyiNVfRPfP2vM5Avvg==", "cpu": [ "arm64" ], @@ -16063,9 +16115,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.8.tgz", - "integrity": "sha512-KdSfaROOUJXgTVxJNAZ3KwkRc5nggDk+06P6lgi1HLv1hskgvxHUKZ4xtwHkVYJ1Rep4GNo+uEfycCRRxht7+Q==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.40.0.tgz", + "integrity": "sha512-ATZvCRGCDtv1Y4gpDIXsS+wfFeFuLwVxyUBSLawjgXK2tRE6fnsQEkE4csQQYWlBlsFztRzCnBvWVfcae/1qxQ==", "cpu": [ "arm64" ], @@ -16078,9 +16130,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.8.tgz", - "integrity": "sha512-NyF4gcxwkMFRjgXBM6g2lkT58OWztZvw5KkV2K0qqSnUEqCVcqdh2jN4gQrTn/YUpAcNKyFHfoOZEer9nwo6uQ==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.40.0.tgz", + "integrity": "sha512-wG9e2XtIhd++QugU5MD9i7OnpaVb08ji3P1y/hNbxrQ3sYEelKJOq1UJ5dXczeo6Hj2rfDEL5GdtkMSVLa/AOg==", "cpu": [ "loong64" ], @@ -16093,9 +16145,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.8.tgz", - "integrity": "sha512-LMJc999GkhGvktHU85zNTDImZVUCJ1z/MbAJTnviiWmmjyckP5aQsHtcujMjpNdMZPT2rQEDBlJfubhs3jsMfw==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.40.0.tgz", + "integrity": "sha512-vgXfWmj0f3jAUvC7TZSU/m/cOE558ILWDzS7jBhiCAFpY2WEBn5jqgbqvmzlMjtp8KlLcBlXVD2mkTSEQE6Ixw==", "cpu": [ "ppc64" ], @@ -16108,9 +16160,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.8.tgz", - "integrity": "sha512-xAQCAHPj8nJq1PI3z8CIZzXuXCstquz7cIOL73HHdXiRcKk8Ywwqtx2wrIy23EcTn4aZ2fLJNBB8d0tQENPCmw==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.40.0.tgz", + "integrity": "sha512-uJkYTugqtPZBS3Z136arevt/FsKTF/J9dEMTX/cwR7lsAW4bShzI2R0pJVw+hcBTWF4dxVckYh72Hk3/hWNKvA==", "cpu": [ "riscv64" ], @@ -16123,9 +16175,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.8.tgz", - "integrity": "sha512-DdePVk1NDEuc3fOe3dPPTb+rjMtuFw89gw6gVWxQFAuEqqSdDKnrwzZHrUYdac7A7dXl9Q2Vflxpme15gUWQFA==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.40.0.tgz", + "integrity": "sha512-SpnYlAfKPOoVsQqmTFJ0usx0z84bzGOS9anAC0AZ3rdSo3snecihbhFTlJZ8XMwzqAcodjFU4+/SM311dqE5Sw==", "cpu": [ "s390x" ], @@ -16138,9 +16190,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.8.tgz", - "integrity": "sha512-8y7ED8gjxITUltTUEJLQdgpbPh1sUQ0kMTmufRF/Ns5tI9TNMNlhWtmPKKHCU0SilX+3MJkZ0zERYYGIVBYHIA==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.40.0.tgz", + "integrity": "sha512-RcDGMtqF9EFN8i2RYN2W+64CdHruJ5rPqrlYw+cgM3uOVPSsnAQps7cpjXe9be/yDp8UC7VLoCoKC8J3Kn2FkQ==", "cpu": [ "x64" ], @@ -16153,9 +16205,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.8.tgz", - "integrity": "sha512-SCXcP0ZpGFIe7Ge+McxY5zKxiEI5ra+GT3QRxL0pMMtxPfpyLAKleZODi1zdRHkz5/BhueUrYtYVgubqe9JBNQ==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.40.0.tgz", + "integrity": "sha512-HZvjpiUmSNx5zFgwtQAV1GaGazT2RWvqeDi0hV+AtC8unqqDSsaFjPxfsO6qPtKRRg25SisACWnJ37Yio8ttaw==", "cpu": [ "x64" ], @@ -16168,9 +16220,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.8.tgz", - "integrity": "sha512-YHYsgzZgFJzTRbth4h7Or0m5O74Yda+hLin0irAIobkLQFRQd1qWmnoVfwmKm9TXIZVAD0nZ+GEb2ICicLyCnQ==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.40.0.tgz", + "integrity": "sha512-UtZQQI5k/b8d7d3i9AZmA/t+Q4tk3hOC0tMOMSq2GlMYOfxbesxG4mJSeDp0EHs30N9bsfwUvs3zF4v/RzOeTQ==", "cpu": [ "arm64" ], @@ -16183,9 +16235,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.8.tgz", - "integrity": "sha512-r3NRQrXkHr4uWy5TOjTpTYojR9XmF0j/RYgKCef+Ag46FWUTltm5ziticv8LdNsDMehjJ543x/+TJAek/xBA2w==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.40.0.tgz", + "integrity": "sha512-+m03kvI2f5syIqHXCZLPVYplP8pQch9JHyXKZ3AGMKlg8dCyr2PKHjwRLiW53LTrN/Nc3EqHOKxUxzoSPdKddA==", "cpu": [ "ia32" ], @@ -16198,9 +16250,9 @@ "peer": true }, "node_modules/vite/node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.8.tgz", - "integrity": "sha512-U0FaE5O1BCpZSeE6gBl3c5ObhePQSfk9vDRToMmTkbhCOgW4jqvtS5LGyQ76L1fH8sM0keRp4uDTsbjiUyjk0g==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.40.0.tgz", + "integrity": "sha512-lpPE1cLfP5oPzVjKMx10pgBmKELQnFJXHgvtHCtuJWOv8MxqdEIMNtgHgBFf7Ea2/7EuVwa9fodWUfXAlXZLZQ==", "cpu": [ "x64" ], @@ -16212,6 +16264,14 @@ ], "peer": true }, + "node_modules/vite/node_modules/@types/estree": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", + "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/vite/node_modules/esbuild": { "version": "0.25.0", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.0.tgz", @@ -16285,14 +16345,14 @@ } }, "node_modules/vite/node_modules/rollup": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.8.tgz", - "integrity": "sha512-489gTVMzAYdiZHFVA/ig/iYFllCcWFHMvUHI1rpFmkoUtRlQxqh6/yiNqnYibjMZ2b/+FUQwldG+aLsEt6bglQ==", + "version": "4.40.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.40.0.tgz", + "integrity": "sha512-Noe455xmA96nnqH5piFtLobsGbCij7Tu+tb3c1vYjNbTkfzGqXqQXG3wJaYXkRZuQ0vEYN4bhwg7QnIrqB5B+w==", "dev": true, "license": "MIT", "peer": true, "dependencies": { - "@types/estree": "1.0.6" + "@types/estree": "1.0.7" }, "bin": { "rollup": "dist/bin/rollup" @@ -16302,25 +16362,26 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.34.8", - "@rollup/rollup-android-arm64": "4.34.8", - "@rollup/rollup-darwin-arm64": "4.34.8", - "@rollup/rollup-darwin-x64": "4.34.8", - "@rollup/rollup-freebsd-arm64": "4.34.8", - "@rollup/rollup-freebsd-x64": "4.34.8", - "@rollup/rollup-linux-arm-gnueabihf": "4.34.8", - "@rollup/rollup-linux-arm-musleabihf": "4.34.8", - "@rollup/rollup-linux-arm64-gnu": "4.34.8", - "@rollup/rollup-linux-arm64-musl": "4.34.8", - "@rollup/rollup-linux-loongarch64-gnu": "4.34.8", - "@rollup/rollup-linux-powerpc64le-gnu": "4.34.8", - "@rollup/rollup-linux-riscv64-gnu": "4.34.8", - "@rollup/rollup-linux-s390x-gnu": "4.34.8", - "@rollup/rollup-linux-x64-gnu": "4.34.8", - "@rollup/rollup-linux-x64-musl": "4.34.8", - "@rollup/rollup-win32-arm64-msvc": "4.34.8", - "@rollup/rollup-win32-ia32-msvc": "4.34.8", - "@rollup/rollup-win32-x64-msvc": "4.34.8", + "@rollup/rollup-android-arm-eabi": "4.40.0", + "@rollup/rollup-android-arm64": "4.40.0", + "@rollup/rollup-darwin-arm64": "4.40.0", + "@rollup/rollup-darwin-x64": "4.40.0", + "@rollup/rollup-freebsd-arm64": "4.40.0", + "@rollup/rollup-freebsd-x64": "4.40.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.40.0", + "@rollup/rollup-linux-arm-musleabihf": "4.40.0", + "@rollup/rollup-linux-arm64-gnu": "4.40.0", + "@rollup/rollup-linux-arm64-musl": "4.40.0", + "@rollup/rollup-linux-loongarch64-gnu": "4.40.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.40.0", + "@rollup/rollup-linux-riscv64-gnu": "4.40.0", + "@rollup/rollup-linux-riscv64-musl": "4.40.0", + "@rollup/rollup-linux-s390x-gnu": "4.40.0", + "@rollup/rollup-linux-x64-gnu": "4.40.0", + "@rollup/rollup-linux-x64-musl": "4.40.0", + "@rollup/rollup-win32-arm64-msvc": "4.40.0", + "@rollup/rollup-win32-ia32-msvc": "4.40.0", + "@rollup/rollup-win32-x64-msvc": "4.40.0", "fsevents": "~2.3.2" } }, @@ -16511,9 +16572,9 @@ } }, "node_modules/webpack-dev-server/node_modules/http-proxy-middleware": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.7.tgz", - "integrity": "sha512-fgVY8AV7qU7z/MmXJ/rxwbrtQH4jBQ9m7kp3llF0liB7glmFeVZFBepQb32T3y8n8k2+AEYuMPCpinYW+/CuRA==", + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.9.tgz", + "integrity": "sha512-c1IyJYLYppU574+YI7R4QyX2ystMtVXZwIdzazUIPIJsHuWNd+mho2j+bKoHftndicGj9yh+xjd+l0yj7VeT1Q==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 8cf055b..e328c49 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/projects/funixproductions-requests/package.json b/projects/funixproductions-requests/package.json index 0f4b409..ce1d7f6 100644 --- a/projects/funixproductions-requests/package.json +++ b/projects/funixproductions-requests/package.json @@ -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", diff --git a/projects/funixproductions-requests/src/lib/services/funixproductions-api/billing/dtos/PaypalPlanDTO.ts b/projects/funixproductions-requests/src/lib/services/funixproductions-api/billing/dtos/PaypalPlanDTO.ts new file mode 100644 index 0000000..5bea367 --- /dev/null +++ b/projects/funixproductions-requests/src/lib/services/funixproductions-api/billing/dtos/PaypalPlanDTO.ts @@ -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) + ); + } +} \ No newline at end of file diff --git a/projects/funixproductions-requests/src/lib/services/funixproductions-api/billing/dtos/PaypalSubscriptionDTO.ts b/projects/funixproductions-requests/src/lib/services/funixproductions-api/billing/dtos/PaypalSubscriptionDTO.ts new file mode 100644 index 0000000..72fd694 --- /dev/null +++ b/projects/funixproductions-requests/src/lib/services/funixproductions-api/billing/dtos/PaypalSubscriptionDTO.ts @@ -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; +} \ No newline at end of file diff --git a/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/payment/services/PacifistaPlusPaymentService.ts b/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/payment/services/PacifistaPlusPaymentService.ts index e69de29..53c7a7f 100644 --- a/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/payment/services/PacifistaPlusPaymentService.ts +++ b/projects/funixproductions-requests/src/lib/services/pacifista-api/web/shop/payment/services/PacifistaPlusPaymentService.ts @@ -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 { + return this.httpClient.post(this.url, null, {headers: super.getHeaders()}) + .pipe( + catchError((error: HttpErrorResponse) => { + return throwError(() => this.buildErrorDto(error)); + }) + ); + } + + getSubscriptionStatus(): Observable { + return this.httpClient.get(this.url, {headers: super.getHeaders()}) + .pipe( + catchError((error: HttpErrorResponse) => { + return throwError(() => this.buildErrorDto(error)); + }) + ); + } + + pauseSubscription(): Observable { + return this.httpClient.post(this.url + '/pause', null, {headers: super.getHeaders()}) + .pipe( + catchError((error: HttpErrorResponse) => { + return throwError(() => this.buildErrorDto(error)); + }) + ); + } + + resumeSubscription(): Observable { + return this.httpClient.post(this.url + '/resume', null, {headers: super.getHeaders()}) + .pipe( + catchError((error: HttpErrorResponse) => { + return throwError(() => this.buildErrorDto(error)); + }) + ); + } + + cancelSubscription(): Observable { + return this.httpClient.post(this.url + '/cancel', null, {headers: super.getHeaders()}) + .pipe( + catchError((error: HttpErrorResponse) => { + return throwError(() => this.buildErrorDto(error)); + }) + ); + } + +} diff --git a/projects/funixproductions-requests/src/public-api.ts b/projects/funixproductions-requests/src/public-api.ts index 611e650..fbcd763 100644 --- a/projects/funixproductions-requests/src/public-api.ts +++ b/projects/funixproductions-requests/src/public-api.ts @@ -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'; @@ -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';