feat(premium): add App Store and Google Play purchases (#3052)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-30 01:55:19 +02:00
1 parent 0b3418dcbe
commit e8cb167dbf
202 files changed
+17095 -49

No files matched your search

@@ -6,8 +6,14 @@ import type {FluxerErrorData} from '@fluxer/errors/src/FluxerError';
type PremiumPurchaseBlockedReason = 'lifetime' | 'existing_subscription' | 'purchase_disabled';
type PremiumPurchaseBlockingProvider = 'stripe' | 'app_store' | 'google_play';
interface PremiumPurchaseBlockedData extends FluxerErrorData {
provider?: PremiumPurchaseBlockingProvider;
}
export class PremiumPurchaseBlockedError extends ForbiddenError {
constructor(reason: PremiumPurchaseBlockedReason = 'purchase_disabled', data: FluxerErrorData = {}) {
constructor(reason: PremiumPurchaseBlockedReason = 'purchase_disabled', data: PremiumPurchaseBlockedData = {}) {
super({
code: APIErrorCodes.PREMIUM_PURCHASE_BLOCKED,
data: {
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';
import {ServiceUnavailableError} from '@fluxer/errors/src/domains/core/ServiceUnavailableError';
export class StoreBillingUnavailableError extends ServiceUnavailableError {
constructor() {
super({
code: APIErrorCodes.STORE_BILLING_UNAVAILABLE,
});
}
}
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';
import {FluxerError} from '@fluxer/errors/src/FluxerError';
export class StoreNotificationUnauthorizedError extends FluxerError {
constructor() {
super({
code: APIErrorCodes.STORE_NOTIFICATION_UNAUTHORIZED,
status: 401,
});
}
}
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';
import {BadRequestError} from '@fluxer/errors/src/domains/core/BadRequestError';
export class StorePurchaseInvalidError extends BadRequestError {
constructor() {
super({
code: APIErrorCodes.STORE_PURCHASE_INVALID,
});
}
}
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';
import {ForbiddenError} from '@fluxer/errors/src/domains/core/ForbiddenError';
export class StorePurchaseOwnedByOtherAccountError extends ForbiddenError {
constructor() {
super({
code: APIErrorCodes.STORE_PURCHASE_OWNED_BY_OTHER_ACCOUNT,
});
}
}
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';
import {ForbiddenError} from '@fluxer/errors/src/domains/core/ForbiddenError';
export class StorePurchaseSandboxNotEntitledError extends ForbiddenError {
constructor() {
super({
code: APIErrorCodes.STORE_PURCHASE_SANDBOX_NOT_ENTITLED,
});
}
}
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';
import {NotFoundError} from '@fluxer/errors/src/domains/core/NotFoundError';
export class UnknownStorePurchaseError extends NotFoundError {
constructor() {
super({
code: APIErrorCodes.UNKNOWN_STORE_PURCHASE,
});
}
}