feat: add GetPaymentPlans graphQL query
This commit is contained in:
@@ -39,6 +39,8 @@ type AppConfig = {
|
|||||||
smtpPassword: string;
|
smtpPassword: string;
|
||||||
fromEmail: string;
|
fromEmail: string;
|
||||||
isCloud: boolean;
|
isCloud: boolean;
|
||||||
|
paddleVendorId: string;
|
||||||
|
paddleVendorAuthCode: string;
|
||||||
stripeSecretKey: string;
|
stripeSecretKey: string;
|
||||||
stripeSigningSecret: string;
|
stripeSigningSecret: string;
|
||||||
stripeStarterPriceKey: string;
|
stripeStarterPriceKey: string;
|
||||||
@@ -111,6 +113,8 @@ const appConfig: AppConfig = {
|
|||||||
smtpPassword: process.env.SMTP_PASSWORD,
|
smtpPassword: process.env.SMTP_PASSWORD,
|
||||||
fromEmail: process.env.FROM_EMAIL,
|
fromEmail: process.env.FROM_EMAIL,
|
||||||
isCloud: process.env.AUTOMATISCH_CLOUD === 'true',
|
isCloud: process.env.AUTOMATISCH_CLOUD === 'true',
|
||||||
|
paddleVendorId: process.env.PADDLE_VENDOR_ID,
|
||||||
|
paddleVendorAuthCode: process.env.PADDLE_VENDOR_AUTH_CODE,
|
||||||
stripeSecretKey: process.env.STRIPE_SECRET_KEY,
|
stripeSecretKey: process.env.STRIPE_SECRET_KEY,
|
||||||
stripeSigningSecret: process.env.STRIPE_SIGNING_SECRET,
|
stripeSigningSecret: process.env.STRIPE_SIGNING_SECRET,
|
||||||
stripeStarterPriceKey: process.env.STRIPE_STARTER_PRICE_KEY,
|
stripeStarterPriceKey: process.env.STRIPE_STARTER_PRICE_KEY,
|
||||||
|
10
packages/backend/src/graphql/queries/get-payment-plans.ee.ts
Normal file
10
packages/backend/src/graphql/queries/get-payment-plans.ee.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import appConfig from '../../config/app';
|
||||||
|
import Billing from '../../helpers/billing/index.ee';
|
||||||
|
|
||||||
|
const getPaymentPlans = async () => {
|
||||||
|
if (!appConfig.isCloud) return;
|
||||||
|
|
||||||
|
return Billing.paddlePlans;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default getPaymentPlans;
|
@@ -12,6 +12,7 @@ import getDynamicData from './queries/get-dynamic-data';
|
|||||||
import getDynamicFields from './queries/get-dynamic-fields';
|
import getDynamicFields from './queries/get-dynamic-fields';
|
||||||
import getCurrentUser from './queries/get-current-user';
|
import getCurrentUser from './queries/get-current-user';
|
||||||
import getUsageData from './queries/get-usage-data.ee';
|
import getUsageData from './queries/get-usage-data.ee';
|
||||||
|
import getPaymentPlans from './queries/get-payment-plans.ee';
|
||||||
import getPaymentPortalUrl from './queries/get-payment-portal-url.ee';
|
import getPaymentPortalUrl from './queries/get-payment-portal-url.ee';
|
||||||
import getAutomatischInfo from './queries/get-automatisch-info';
|
import getAutomatischInfo from './queries/get-automatisch-info';
|
||||||
import healthcheck from './queries/healthcheck';
|
import healthcheck from './queries/healthcheck';
|
||||||
@@ -31,6 +32,7 @@ const queryResolvers = {
|
|||||||
getDynamicFields,
|
getDynamicFields,
|
||||||
getCurrentUser,
|
getCurrentUser,
|
||||||
getUsageData,
|
getUsageData,
|
||||||
|
getPaymentPlans,
|
||||||
getPaymentPortalUrl,
|
getPaymentPortalUrl,
|
||||||
getAutomatischInfo,
|
getAutomatischInfo,
|
||||||
healthcheck,
|
healthcheck,
|
||||||
|
@@ -36,6 +36,7 @@ type Query {
|
|||||||
getCurrentUser: User
|
getCurrentUser: User
|
||||||
getUsageData: GetUsageData
|
getUsageData: GetUsageData
|
||||||
getPaymentPortalUrl: GetPaymentPortalUrl
|
getPaymentPortalUrl: GetPaymentPortalUrl
|
||||||
|
getPaymentPlans: [PaymentPlan]
|
||||||
getAutomatischInfo: GetAutomatischInfo
|
getAutomatischInfo: GetAutomatischInfo
|
||||||
healthcheck: AppHealth
|
healthcheck: AppHealth
|
||||||
}
|
}
|
||||||
@@ -481,6 +482,13 @@ type GetPaymentPortalUrl {
|
|||||||
url: String
|
url: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PaymentPlan {
|
||||||
|
name: String
|
||||||
|
limit: String
|
||||||
|
price: String
|
||||||
|
productId: String
|
||||||
|
}
|
||||||
|
|
||||||
schema {
|
schema {
|
||||||
query: Query
|
query: Query
|
||||||
mutation: Mutation
|
mutation: Mutation
|
||||||
|
@@ -4,6 +4,7 @@ import PaymentPlan from '../../models/payment-plan.ee';
|
|||||||
import UsageData from '../../models/usage-data.ee';
|
import UsageData from '../../models/usage-data.ee';
|
||||||
import appConfig from '../../config/app';
|
import appConfig from '../../config/app';
|
||||||
import handleWebhooks from './webhooks.ee';
|
import handleWebhooks from './webhooks.ee';
|
||||||
|
import paddlePlans from './plans.ee';
|
||||||
|
|
||||||
const plans = [
|
const plans = [
|
||||||
{
|
{
|
||||||
@@ -95,6 +96,7 @@ const billing = {
|
|||||||
handleWebhooks,
|
handleWebhooks,
|
||||||
stripe,
|
stripe,
|
||||||
plans,
|
plans,
|
||||||
|
paddlePlans,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default billing;
|
export default billing;
|
||||||
|
16
packages/backend/src/helpers/billing/plans.ee.ts
Normal file
16
packages/backend/src/helpers/billing/plans.ee.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
const plans = [
|
||||||
|
{
|
||||||
|
name: '10k - monthly',
|
||||||
|
limit: '10,000',
|
||||||
|
price: '€20',
|
||||||
|
productId: '47384',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '30k - monthly',
|
||||||
|
limit: '30,000',
|
||||||
|
price: '€50',
|
||||||
|
productId: '47419',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default plans;
|
Reference in New Issue
Block a user