fix: Parameterize Stripe Payment Fee configs (#6024)

* Parameterize Stripe Payment Fee configs

* Restore constant values for Payment Fee params

* Restore constant values for all Payment Fee params

* Remove STRIPE_ prefix on payment fee vars

* Cast Payment Fee params as Number

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Omar López <zomars@me.com>
pull/5904/head^2
Josh Avant 2023-01-09 19:50:49 -06:00 committed by GitHub
parent 8b873e2828
commit 4e65c30e18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -102,6 +102,8 @@ STRIPE_TEAM_MONTHLY_PRICE_ID=
STRIPE_WEBHOOK_SECRET= STRIPE_WEBHOOK_SECRET=
STRIPE_PRIVATE_KEY= STRIPE_PRIVATE_KEY=
STRIPE_CLIENT_ID= STRIPE_CLIENT_ID=
PAYMENT_FEE_FIXED=
PAYMENT_FEE_PERCENTAGE=
# Use for internal Public API Keys and optional # Use for internal Public API Keys and optional
API_KEY_PREFIX=cal_ API_KEY_PREFIX=cal_

View File

@ -274,13 +274,15 @@ export default async function main() {
process.env.STRIPE_CLIENT_ID && process.env.STRIPE_CLIENT_ID &&
process.env.STRIPE_PRIVATE_KEY && process.env.STRIPE_PRIVATE_KEY &&
process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY && process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY &&
process.env.STRIPE_WEBHOOK_SECRET process.env.STRIPE_WEBHOOK_SECRET &&
process.env.PAYMENT_FEE_FIXED &&
process.env.PAYMENT_FEE_PERCENTAGE
) { ) {
await createApp("stripe", "stripepayment", ["payment"], "stripe_payment", { await createApp("stripe", "stripepayment", ["payment"], "stripe_payment", {
client_id: process.env.STRIPE_CLIENT_ID, client_id: process.env.STRIPE_CLIENT_ID,
client_secret: process.env.STRIPE_PRIVATE_KEY, client_secret: process.env.STRIPE_PRIVATE_KEY,
payment_fee_fixed: 10, payment_fee_fixed: Number(process.env.PAYMENT_FEE_FIXED),
payment_fee_percentage: 0.005, payment_fee_percentage: Number(process.env.PAYMENT_FEE_PERCENTAGE),
public_key: process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY, public_key: process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY,
webhook_secret: process.env.STRIPE_WEBHOOK_SECRET, webhook_secret: process.env.STRIPE_WEBHOOK_SECRET,
}); });

View File

@ -247,6 +247,8 @@
"$STRIPE_CLIENT_ID", "$STRIPE_CLIENT_ID",
"$STRIPE_PRIVATE_KEY", "$STRIPE_PRIVATE_KEY",
"$STRIPE_WEBHOOK_SECRET", "$STRIPE_WEBHOOK_SECRET",
"$PAYMENT_FEE_FIXED",
"$PAYMENT_FEE_PERCENTAGE",
"$TELEMETRY_DEBUG", "$TELEMETRY_DEBUG",
"$VERCEL_ENV", "$VERCEL_ENV",
"$VERCEL_URL", "$VERCEL_URL",