feat: add GetPaymentPlans graphQL query

This commit is contained in:
Faruk AYDIN
2023-03-20 19:12:21 +03:00
parent 40862fcd01
commit f1358c7ad1
6 changed files with 42 additions and 0 deletions

View File

@@ -39,6 +39,8 @@ type AppConfig = {
smtpPassword: string;
fromEmail: string;
isCloud: boolean;
paddleVendorId: string;
paddleVendorAuthCode: string;
stripeSecretKey: string;
stripeSigningSecret: string;
stripeStarterPriceKey: string;
@@ -111,6 +113,8 @@ const appConfig: AppConfig = {
smtpPassword: process.env.SMTP_PASSWORD,
fromEmail: process.env.FROM_EMAIL,
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,
stripeSigningSecret: process.env.STRIPE_SIGNING_SECRET,
stripeStarterPriceKey: process.env.STRIPE_STARTER_PRICE_KEY,

View 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;

View File

@@ -12,6 +12,7 @@ import getDynamicData from './queries/get-dynamic-data';
import getDynamicFields from './queries/get-dynamic-fields';
import getCurrentUser from './queries/get-current-user';
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 getAutomatischInfo from './queries/get-automatisch-info';
import healthcheck from './queries/healthcheck';
@@ -31,6 +32,7 @@ const queryResolvers = {
getDynamicFields,
getCurrentUser,
getUsageData,
getPaymentPlans,
getPaymentPortalUrl,
getAutomatischInfo,
healthcheck,

View File

@@ -36,6 +36,7 @@ type Query {
getCurrentUser: User
getUsageData: GetUsageData
getPaymentPortalUrl: GetPaymentPortalUrl
getPaymentPlans: [PaymentPlan]
getAutomatischInfo: GetAutomatischInfo
healthcheck: AppHealth
}
@@ -481,6 +482,13 @@ type GetPaymentPortalUrl {
url: String
}
type PaymentPlan {
name: String
limit: String
price: String
productId: String
}
schema {
query: Query
mutation: Mutation

View File

@@ -4,6 +4,7 @@ import PaymentPlan from '../../models/payment-plan.ee';
import UsageData from '../../models/usage-data.ee';
import appConfig from '../../config/app';
import handleWebhooks from './webhooks.ee';
import paddlePlans from './plans.ee';
const plans = [
{
@@ -95,6 +96,7 @@ const billing = {
handleWebhooks,
stripe,
plans,
paddlePlans,
};
export default billing;

View 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;