Skip to content

Commit

Permalink
feat: adds env vars to enable Google/ApplePay
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitb35 committed Jan 3, 2024
1 parent 0741a44 commit 2d16d70
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ SENTRY_AUTH_TOKEN=
SOURCE_VERSION=
RECURRENCY=true

TRACKING_KEY=
TRACKING_KEY=

ENABLE_APPLE_PAY=
ENABLE_GOOGLE_PAY=
4 changes: 3 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const nextConfig = {
stripPrefix: ["webpack://_N_E/"],
urlPrefix: `~${basePath}/_next`,
release: COMMIT_SHA,
})
}),
);
}
return config;
Expand All @@ -115,6 +115,8 @@ const nextConfig = {
ESRI_CLIENT_SECRET: process.env.ESRI_CLIENT_SECRET,
RECURRENCY: process.env.RECURRENCY,
TRACKING_KEY: process.env.TRACKING_KEY,
ENABLE_GOOGLE_PAY: process.env.ENABLE_GOOGLE_PAY,
ENABLE_APPLE_PAY: process.env.ENABLE_APPLE_PAY,
},
trailingSlash: false,
reactStrictMode: true,
Expand Down
8 changes: 6 additions & 2 deletions src/Donations/PaymentMethods/PaymentRequestCustomButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export const PaymentRequestCustomButton = ({
frequency,
paymentSetup,
}: PaymentButtonProps): ReactElement | null => {
const isApplePayEnabled = process.env.ENABLE_APPLE_PAY === "true" || false;
const isGooglePayEnabled = process.env.ENABLE_GOOGLE_PAY === "true" || true;
const { t, ready } = useTranslation(["common"]);
const { paymentRequest, setPaymentRequest } = useContext(QueryParamContext);

Expand Down Expand Up @@ -140,7 +142,8 @@ export const PaymentRequestCustomButton = ({
(frequency !== "once"
? paymentSetup?.recurrency?.methods?.includes("card")
: true) ? (
paymentRequest._canMakePaymentAvailability.APPLE_PAY ? ( //TODOO - is _canMakePaymentAvailability a private variable?
paymentRequest._canMakePaymentAvailability.APPLE_PAY &&
isApplePayEnabled ? ( //TODOO - is _canMakePaymentAvailability a private variable?
<div className="w-100">
<button
onClick={() => paymentRequest.show()}
Expand All @@ -163,7 +166,8 @@ export const PaymentRequestCustomButton = ({
<div className="separator-text mb-10">{t("or")}</div>
)}
</div>
) : paymentRequest._canMakePaymentAvailability.GOOGLE_PAY ? ( //TODOO - is _canMakePaymentAvailability a private variable?
) : paymentRequest._canMakePaymentAvailability.GOOGLE_PAY &&
isGooglePayEnabled ? ( //TODOO - is _canMakePaymentAvailability a private variable?
<div className="w-100">
<button
onClick={() => {
Expand Down

0 comments on commit 2d16d70

Please sign in to comment.