From 7cd24561bdd023d4efa036f20aa74be236a63a38 Mon Sep 17 00:00:00 2001 From: Tejas Sonar Date: Tue, 14 Dec 2021 14:35:02 +0530 Subject: [PATCH 01/14] Enable sepa without login for funding donations --- src/Donations/Components/PaymentsForm.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Donations/Components/PaymentsForm.tsx b/src/Donations/Components/PaymentsForm.tsx index 8a74d0cd..ca2f38da 100644 --- a/src/Donations/Components/PaymentsForm.tsx +++ b/src/Donations/Components/PaymentsForm.tsx @@ -118,11 +118,7 @@ function PaymentsForm({}: Props): ReactElement { const onPaymentFunction = async (paymentMethod: any, paymentRequest: any) => { setPaymentType(paymentRequest._activeBackingLibraryName); const gateway = "stripe"; - onSubmitPayment( - gateway, - "card", - paymentMethod - ); + onSubmitPayment(gateway, "card", paymentMethod); }; async function getDonation() { @@ -306,7 +302,8 @@ function PaymentsForm({}: Props): ReactElement { showSepa={showPaymentMethod({ paymentMethod: "sepa_debit", currencies: ["EUR"], - authenticatedMethod: true, + authenticatedMethod: + projectDetails.purpose === "funds" ? false : true, })} showSofort={showPaymentMethod({ paymentMethod: "sofort", From 9ce06769ac99a74b14ab9633d5277512764c8be2 Mon Sep 17 00:00:00 2001 From: Sagar Aryal Date: Tue, 14 Dec 2021 12:20:47 +0100 Subject: [PATCH 02/14] Update getTenantBackground.ts --- src/Utils/getTenantBackground.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utils/getTenantBackground.ts b/src/Utils/getTenantBackground.ts index afadc097..82ed04c0 100644 --- a/src/Utils/getTenantBackground.ts +++ b/src/Utils/getTenantBackground.ts @@ -29,7 +29,7 @@ export function getTenantBackground(tenant: any, projectDetails: any) { imageUrl = tenantImage; } else { if (projectDetails && projectDetails.image) { - imageUrl = getImageUrl("project", "medium", projectDetails.image); + imageUrl = getImageUrl("project", "large", projectDetails.image); } else { imageUrl = defaultForest; } From 076b58c0fecc8d1de9d7be6728eb47b53195f304 Mon Sep 17 00:00:00 2001 From: ankitecd Date: Tue, 14 Dec 2021 18:28:43 +0530 Subject: [PATCH 03/14] added consoles for paypal testing --- src/Donations/PaymentMethods/NewPaypal.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Donations/PaymentMethods/NewPaypal.tsx b/src/Donations/PaymentMethods/NewPaypal.tsx index b8a520d6..bb170629 100644 --- a/src/Donations/PaymentMethods/NewPaypal.tsx +++ b/src/Donations/PaymentMethods/NewPaypal.tsx @@ -56,7 +56,11 @@ function NewPaypal({ } function onApprove(data, actions) { + console.log(`data onApprove`, data); + console.log(`actions onApprove`, actions); + return actions.order.capture().then(function (details) { + console.log(`actions.order details`, details); // This function shows a transaction success message to your buyer. data = { ...data, @@ -67,10 +71,13 @@ function NewPaypal({ } const onError = (data) => { + console.log(`data onError`, data); setPaymentError(`Your order ${data.orderID} failed due to some error.`); }; const onCancel = (data) => { + console.log(`data onCancel`, data); + setPaymentError("Order was cancelled, please try again"); }; From 36849ef136259f2498a8acc78385bc962a66a1b3 Mon Sep 17 00:00:00 2001 From: ankitecd Date: Tue, 14 Dec 2021 18:47:10 +0530 Subject: [PATCH 04/14] added api request for onError and onCancel --- src/Donations/PaymentMethods/NewPaypal.tsx | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Donations/PaymentMethods/NewPaypal.tsx b/src/Donations/PaymentMethods/NewPaypal.tsx index bb170629..3733cb02 100644 --- a/src/Donations/PaymentMethods/NewPaypal.tsx +++ b/src/Donations/PaymentMethods/NewPaypal.tsx @@ -60,7 +60,7 @@ function NewPaypal({ console.log(`actions onApprove`, actions); return actions.order.capture().then(function (details) { - console.log(`actions.order details`, details); + console.log(`actions.order details onApprove`, details); // This function shows a transaction success message to your buyer. data = { ...data, @@ -73,12 +73,32 @@ function NewPaypal({ const onError = (data) => { console.log(`data onError`, data); setPaymentError(`Your order ${data.orderID} failed due to some error.`); + + // This function shows a transaction success message to your buyer. + data = { + ...data, + type: "sdk", + status: "error", + }; + payDonationFunction("paypal", "paypal", data); }; - const onCancel = (data) => { + const onCancel = (data, actions) => { console.log(`data onCancel`, data); + console.log(`actions onCancel`, actions); setPaymentError("Order was cancelled, please try again"); + + return actions.order.capture().then(function (details) { + console.log(`actions.order details onCancel`, details); + // This function shows a transaction success message to your buyer. + data = { + ...data, + type: "sdk", + status: "cancel", + }; + payDonationFunction("paypal", "paypal", data); + }); }; return ( From 48e636bdb9ace94111fb3c7b95bf8f98cc4d1f67 Mon Sep 17 00:00:00 2001 From: ankitecd Date: Tue, 14 Dec 2021 18:59:49 +0530 Subject: [PATCH 05/14] fixed cancellation actions error --- src/Donations/PaymentMethods/NewPaypal.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Donations/PaymentMethods/NewPaypal.tsx b/src/Donations/PaymentMethods/NewPaypal.tsx index 3733cb02..0464373e 100644 --- a/src/Donations/PaymentMethods/NewPaypal.tsx +++ b/src/Donations/PaymentMethods/NewPaypal.tsx @@ -89,16 +89,13 @@ function NewPaypal({ setPaymentError("Order was cancelled, please try again"); - return actions.order.capture().then(function (details) { - console.log(`actions.order details onCancel`, details); - // This function shows a transaction success message to your buyer. - data = { - ...data, - type: "sdk", - status: "cancel", - }; - payDonationFunction("paypal", "paypal", data); - }); + // This function shows a transaction success message to your buyer. + data = { + ...data, + type: "sdk", + status: "cancel", + }; + payDonationFunction("paypal", "paypal", data); }; return ( From 8a8ed9506e6fa0ede13174e9db03123179ad1c4b Mon Sep 17 00:00:00 2001 From: ankitecd Date: Tue, 14 Dec 2021 19:17:48 +0530 Subject: [PATCH 06/14] commented reqex for paypal error testing --- src/Donations/Micros/DonationTypes/FundingDonations.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Donations/Micros/DonationTypes/FundingDonations.tsx b/src/Donations/Micros/DonationTypes/FundingDonations.tsx index a6731fc3..f584aaf8 100644 --- a/src/Donations/Micros/DonationTypes/FundingDonations.tsx +++ b/src/Donations/Micros/DonationTypes/FundingDonations.tsx @@ -160,7 +160,7 @@ function FundingDonations({ setopenCurrencyModal }: Props): ReactElement { className={"funding-custom-tree-input"} onInput={(e) => { // replaces any character other than number to blank - e.target.value = e.target.value.replace(/[^0-9]/g, ""); + // e.target.value = e.target.value.replace(/[^0-9]/g, ""); // if length of input more than 12, display only 12 digits if (e.target.value.toString().length >= 12) { e.target.value = e.target.value From b7757778f8fb1fae01091a57cc1b10720fb1f503 Mon Sep 17 00:00:00 2001 From: ankitecd Date: Tue, 14 Dec 2021 19:53:20 +0530 Subject: [PATCH 07/14] added error message in paypal --- src/Donations/PaymentMethods/NewPaypal.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Donations/PaymentMethods/NewPaypal.tsx b/src/Donations/PaymentMethods/NewPaypal.tsx index 0464373e..35f95257 100644 --- a/src/Donations/PaymentMethods/NewPaypal.tsx +++ b/src/Donations/PaymentMethods/NewPaypal.tsx @@ -71,14 +71,18 @@ function NewPaypal({ } const onError = (data) => { - console.log(`data onError`, data); - setPaymentError(`Your order ${data.orderID} failed due to some error.`); + console.log(`\n\n data onError`, data); + console.log(`\n\n Object.keys(data) onError`, Object.keys(data)); + console.log(`\n\n data?.message onError`, data?.message); + console.log(`\n\n data?.code onError`, data?.code); + setPaymentError(`Your order failed due to some error.`); // This function shows a transaction success message to your buyer. data = { ...data, type: "sdk", status: "error", + errorMessage: data?.message, }; payDonationFunction("paypal", "paypal", data); }; From dc8239afbbf14652dad9a51ebab6d9e2d5e2f319 Mon Sep 17 00:00:00 2001 From: ankitecd Date: Tue, 14 Dec 2021 20:14:28 +0530 Subject: [PATCH 08/14] reverted decimal regex check --- src/Donations/Micros/DonationTypes/FundingDonations.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Donations/Micros/DonationTypes/FundingDonations.tsx b/src/Donations/Micros/DonationTypes/FundingDonations.tsx index f584aaf8..a6731fc3 100644 --- a/src/Donations/Micros/DonationTypes/FundingDonations.tsx +++ b/src/Donations/Micros/DonationTypes/FundingDonations.tsx @@ -160,7 +160,7 @@ function FundingDonations({ setopenCurrencyModal }: Props): ReactElement { className={"funding-custom-tree-input"} onInput={(e) => { // replaces any character other than number to blank - // e.target.value = e.target.value.replace(/[^0-9]/g, ""); + e.target.value = e.target.value.replace(/[^0-9]/g, ""); // if length of input more than 12, display only 12 digits if (e.target.value.toString().length >= 12) { e.target.value = e.target.value From 6ba969e2829b30892f5792571ade6c5a8f55c3fa Mon Sep 17 00:00:00 2001 From: ankitecd Date: Tue, 14 Dec 2021 21:20:18 +0530 Subject: [PATCH 09/14] removed logs --- .../Micros/DonationTypes/FundingDonations.tsx | 2 +- src/Donations/PaymentMethods/NewPaypal.tsx | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/Donations/Micros/DonationTypes/FundingDonations.tsx b/src/Donations/Micros/DonationTypes/FundingDonations.tsx index a6731fc3..1f976195 100644 --- a/src/Donations/Micros/DonationTypes/FundingDonations.tsx +++ b/src/Donations/Micros/DonationTypes/FundingDonations.tsx @@ -76,7 +76,7 @@ function FundingDonations({ setopenCurrencyModal }: Props): ReactElement { }, [paymentSetup]); const customInputRef = React.useRef(null); - console.log(`option.quantity , quantity `, paymentSetup.options, quantity); + return ( <>
{ - console.log(`\n\n data onError`, data); - console.log(`\n\n Object.keys(data) onError`, Object.keys(data)); - console.log(`\n\n data?.message onError`, data?.message); - console.log(`\n\n data?.code onError`, data?.code); setPaymentError(`Your order failed due to some error.`); // This function shows a transaction success message to your buyer. @@ -88,9 +80,6 @@ function NewPaypal({ }; const onCancel = (data, actions) => { - console.log(`data onCancel`, data); - console.log(`actions onCancel`, actions); - setPaymentError("Order was cancelled, please try again"); // This function shows a transaction success message to your buyer. From ae90813f2fb62aa1e8232a4a352b95cd30d9402f Mon Sep 17 00:00:00 2001 From: Norbert Schuler Date: Wed, 15 Dec 2021 20:12:05 +0100 Subject: [PATCH 10/14] removed duplicate Sentry config, added env examples for sentry --- .env.production | 4 +++- next.config.js | 7 ------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.env.production b/.env.production index 6cdc7384..fed5dc6a 100644 --- a/.env.production +++ b/.env.production @@ -12,6 +12,8 @@ ESRI_CLIENT_SECRET= SCHEME=https # Only required to upload sourcemaps +NEXT_PUBLIC_SENTRY_DSN=https://379fe47664a541efbb2833ed3923c56b@o78291.ingest.sentry.io/5433504 SENTRY_ORG=plant-for-the-planet SENTRY_PROJECT=app-20-next -NEXT_PUBLIC_SENTRY_DSN=https://379fe47664a541efbb2833ed3923c56b@o78291.ingest.sentry.io/5433504 +SENTRY_AUTH_TOKEN= +SOURCE_VERSION= diff --git a/next.config.js b/next.config.js index aa3e2d2f..9cad9c62 100644 --- a/next.config.js +++ b/next.config.js @@ -87,13 +87,6 @@ module.exports = withPlugins([[withBundleAnalyzer], [withSourceMaps]], { NODE_ENV === "production" ) { config.plugins.push( - new SentryWebpackPlugin({ - include: ".next", - ignore: ["node_modules"], - stripPrefix: ["webpack://_N_E/"], - urlPrefix: `~${basePath}/_next`, - release: COMMIT_SHA, - }), new SentryWebpackPlugin({ include: ".next", ignore: ["node_modules"], From d9c2cae0a2c833bd637fef0dee5ed32029be75bc Mon Sep 17 00:00:00 2001 From: Sagar Date: Wed, 15 Dec 2021 20:45:07 +0100 Subject: [PATCH 11/14] Update .env.production --- .env.production | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.production b/.env.production index fed5dc6a..7f657b09 100644 --- a/.env.production +++ b/.env.production @@ -12,7 +12,7 @@ ESRI_CLIENT_SECRET= SCHEME=https # Only required to upload sourcemaps -NEXT_PUBLIC_SENTRY_DSN=https://379fe47664a541efbb2833ed3923c56b@o78291.ingest.sentry.io/5433504 +NEXT_PUBLIC_SENTRY_DSN=https://ff1dd354f7b94b459fd45c9f173fab7c@o78291.ingest.sentry.io/6108978 SENTRY_ORG=plant-for-the-planet SENTRY_PROJECT=app-20-next SENTRY_AUTH_TOKEN= From c0ade36a4c21407dae4dca2af90f053e7a1af9ab Mon Sep 17 00:00:00 2001 From: Sagar Date: Wed, 15 Dec 2021 20:45:31 +0100 Subject: [PATCH 12/14] Update .env.production --- .env.production | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.production b/.env.production index 7f657b09..5806b7e9 100644 --- a/.env.production +++ b/.env.production @@ -14,6 +14,6 @@ SCHEME=https # Only required to upload sourcemaps NEXT_PUBLIC_SENTRY_DSN=https://ff1dd354f7b94b459fd45c9f173fab7c@o78291.ingest.sentry.io/6108978 SENTRY_ORG=plant-for-the-planet -SENTRY_PROJECT=app-20-next +SENTRY_PROJECT=planet-donations SENTRY_AUTH_TOKEN= SOURCE_VERSION= From c511500a880ae7d14275aa99059b8e61f7c6f2a0 Mon Sep 17 00:00:00 2001 From: Jorgo Miridis Date: Wed, 15 Dec 2021 15:10:42 -0500 Subject: [PATCH 13/14] Potential fix for 'intermediate valued.toFixed' in NewPaypal.tsx --- src/Donations/PaymentMethods/NewPaypal.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Donations/PaymentMethods/NewPaypal.tsx b/src/Donations/PaymentMethods/NewPaypal.tsx index b8a520d6..3faa4398 100644 --- a/src/Donations/PaymentMethods/NewPaypal.tsx +++ b/src/Donations/PaymentMethods/NewPaypal.tsx @@ -35,14 +35,14 @@ function NewPaypal({ const { donationUid } = React.useContext(QueryParamContext); function createOrder(data, actions) { + const value = paymentSetup.unitBased + ? quantity * unitCost + : quantity; return actions.order.create({ purchase_units: [ { amount: { - value: (paymentSetup.unitBased - ? quantity * unitCost - : quantity - ).toFixed(2), + value: value.toFixed(2), currency: currency, }, invoice_id: `planet-${donationID}`, From 3ab2f0131c491d24b0200d9883c52c7ada86b8d9 Mon Sep 17 00:00:00 2001 From: Norbert Schuler Date: Wed, 15 Dec 2021 22:25:49 +0100 Subject: [PATCH 14/14] changed source maps generation --- next.config.js | 8 ++++---- package-lock.json | 12 ------------ package.json | 1 - 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/next.config.js b/next.config.js index 9cad9c62..b538ae0d 100644 --- a/next.config.js +++ b/next.config.js @@ -1,7 +1,4 @@ const withPlugins = require("next-compose-plugins"); -// Use the hidden-source-map option when you don't want the source maps to be -// publicly available on the servers, only to the error reporting -const withSourceMaps = require("@zeit/next-source-maps")(); const withBundleAnalyzer = require("@next/bundle-analyzer")({ enabled: process.env.ANALYZE === "true", }); @@ -16,6 +13,7 @@ const { SENTRY_PROJECT, SENTRY_AUTH_TOKEN, NODE_ENV, + VERCEL_GIT_COMMIT_SHA, VERCEL_GITHUB_COMMIT_SHA, VERCEL_GITLAB_COMMIT_SHA, VERCEL_BITBUCKET_COMMIT_SHA, @@ -23,6 +21,7 @@ const { } = process.env; const COMMIT_SHA = + VERCEL_GIT_COMMIT_SHA || VERCEL_GITHUB_COMMIT_SHA || VERCEL_GITLAB_COMMIT_SHA || VERCEL_BITBUCKET_COMMIT_SHA || @@ -46,7 +45,8 @@ if (process.env.NEXT_PUBLIC_VERCEL_ENV === "preview") { const hasAssetPrefix = process.env.ASSET_PREFIX !== "" && process.env.ASSET_PREFIX !== undefined; -module.exports = withPlugins([[withBundleAnalyzer], [withSourceMaps]], { +module.exports = withPlugins([[withBundleAnalyzer]], { + productionBrowserSourceMaps: true, serverRuntimeConfig: { rootDir: __dirname, }, diff --git a/package-lock.json b/package-lock.json index 6bd3f124..e36221da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,6 @@ "@sentry/webpack-plugin": "^1.14.2", "@stripe/react-stripe-js": "^1.4.0", "@stripe/stripe-js": "^1.13.2", - "@zeit/next-source-maps": "0.0.4-canary.1", "axios": "^0.21.1", "dom-to-image": "^2.6.0", "geocoder-arcgis": "^2.0.5", @@ -1896,12 +1895,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@zeit/next-source-maps": { - "version": "0.0.4-canary.1", - "resolved": "https://registry.npmjs.org/@zeit/next-source-maps/-/next-source-maps-0.0.4-canary.1.tgz", - "integrity": "sha512-SPQCLs7ToaqzQnqXqGSCoL7KTlnOAao+1F5hy7Hkuq85TjHsUC3eeLsmVrBIraIhXG/ARHmZ0JHOesPDtBfpzw==", - "deprecated": "Next.js now has built-in support for Source Maps: https://nextjs.org/docs/advanced-features/source-maps" - }, "node_modules/abortcontroller-polyfill": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.3.tgz", @@ -9673,11 +9666,6 @@ "eslint-visitor-keys": "^2.0.0" } }, - "@zeit/next-source-maps": { - "version": "0.0.4-canary.1", - "resolved": "https://registry.npmjs.org/@zeit/next-source-maps/-/next-source-maps-0.0.4-canary.1.tgz", - "integrity": "sha512-SPQCLs7ToaqzQnqXqGSCoL7KTlnOAao+1F5hy7Hkuq85TjHsUC3eeLsmVrBIraIhXG/ARHmZ0JHOesPDtBfpzw==" - }, "abortcontroller-polyfill": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.3.tgz", diff --git a/package.json b/package.json index 560e7943..775de245 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "@sentry/webpack-plugin": "^1.14.2", "@stripe/react-stripe-js": "^1.4.0", "@stripe/stripe-js": "^1.13.2", - "@zeit/next-source-maps": "0.0.4-canary.1", "axios": "^0.21.1", "dom-to-image": "^2.6.0", "geocoder-arcgis": "^2.0.5",