Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/planet cash topup #307

Merged
merged 23 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a80d614
load Profile
Shreyaschorge Jun 16, 2022
96cb906
add and handle redirection to planetCash topup
Shreyaschorge Jun 17, 2022
f996654
Restrict fetching paymentOptions in getSerserSideProps if to is plane…
Shreyaschorge Jun 20, 2022
901f658
Handle No PlanetCash Account Case
Shreyaschorge Jun 20, 2022
8f21b96
Fix CodeRefactor Issues
Shreyaschorge Jun 21, 2022
7777eba
make planetCash in to case insensitive
Shreyaschorge Jun 21, 2022
0c38def
fix profile check condition
Shreyaschorge Jun 21, 2022
e73b405
Static UI for Create PlanetCash Account
Shreyaschorge Jun 21, 2022
348ab85
Add Select country dropdown in planetCash create account
Shreyaschorge Jun 21, 2022
0fcae57
Integrate PlanetCash create and activate account API
Shreyaschorge Jun 23, 2022
28d207c
Remove CZ from allowedCountries
Shreyaschorge Jun 23, 2022
7c90bb6
fix flashing of PlanetCash signup screen after donation bug
Shreyaschorge Jun 23, 2022
aa5a7d1
fix eslint issue
Shreyaschorge Jun 24, 2022
3fe03c9
Replace router with window
Shreyaschorge Jun 27, 2022
d772773
redirect user to login and add null checks
Shreyaschorge Jun 27, 2022
268335c
Update signup message and add link to t&c
Shreyaschorge Jun 27, 2022
f97b528
Remove Activate PlanetCash Screen
Shreyaschorge Jun 28, 2022
68c8c0e
Remove redundant code
Shreyaschorge Jun 29, 2022
9df8d40
change variable name
Shreyaschorge Jun 29, 2022
bb868af
Rename onChange to onValueChange
Shreyaschorge Jun 30, 2022
6b3e0c8
Resolve merge conflict
Shreyaschorge Jul 4, 2022
d89dc9e
Fix Continue button reload issue
Shreyaschorge Jul 4, 2022
623bda7
Restrict loading anything with pcash_*
Shreyaschorge Jul 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 27 additions & 36 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import { setCountryCode } from "src/Utils/setCountryCode";
import { DONATE } from "src/Utils/donationStepConstants";

interface Props {
projectDetails: Object;
projectDetails?: Object;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codefactor reports an issue here due to using type Object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I am aware of that.
This will be fixed in #309

donationStep: any;
giftDetails: Object;
isGift: boolean;
resolvedUrl: any;
resolvedUrl?: any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codefactor reports an issue here due to using type any

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be fixed in #309

isDirectDonation: boolean;
hideTaxDeduction: boolean;
isTaxDeductible: boolean;
Expand All @@ -28,7 +28,7 @@ interface Props {
allowTaxDeductionChange: boolean;
currency: any;
paymentSetup: any;
treecount: any;
treecount?: any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codefactor reports an issue here due to using type any.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be fixed in #309

amount: any;
meta: { title: string; description: string; image: string; url: string };
frequency: string;
Expand All @@ -38,11 +38,9 @@ interface Props {
}

function index({
projectDetails,
donationStep,
giftDetails,
isGift,
resolvedUrl,
isDirectDonation,
hideTaxDeduction,
isTaxDeductible,
Expand All @@ -53,7 +51,6 @@ function index({
allowTaxDeductionChange,
currency,
paymentSetup,
treecount,
amount,
meta,
frequency,
Expand All @@ -62,7 +59,6 @@ function index({
callbackMethod,
}: Props): ReactElement {
const {
setprojectDetails,
setdonationStep,
loadselectedProjects,
setgiftDetails,
Expand Down Expand Up @@ -115,13 +111,6 @@ function index({
setCountryCode({ setcountry, setcurrency, country });
}, []);

// If project details are present set project details
mohitb35 marked this conversation as resolved.
Show resolved Hide resolved
React.useEffect(() => {
if (projectDetails) {
setprojectDetails(projectDetails);
}
}, [projectDetails]);

settenant(tenant);
// If gift details are present set gift
if (giftDetails && isGift) {
Expand Down Expand Up @@ -250,30 +239,32 @@ export async function getServerSideProps(context: any) {
) {
const to = context.query?.to?.replace(/\//g, "") || "";
donationStep = 1;
try {
const requestParams = {
url: `/app/paymentOptions/${to}?country=${country}`,
setshowErrorCard,
tenant,
};
const paymentOptionsResponse = await apiRequest(requestParams);
if (paymentOptionsResponse.data) {
projectDetails = {
id: paymentOptionsResponse.data.id,
name: paymentOptionsResponse.data.name,
description: paymentOptionsResponse.data.description,
purpose: paymentOptionsResponse.data.purpose,
ownerName: paymentOptionsResponse.data.ownerName,
taxDeductionCountries:
paymentOptionsResponse.data.taxDeductionCountries,
projectImage: paymentOptionsResponse.data.image,
ownerAvatar: paymentOptionsResponse.data.ownerAvatar,
if (to !== "planetCash") {
try {
const requestParams = {
url: `/app/paymentOptions/${to}?country=${country}`,
setshowErrorCard,
tenant,
};
donationStep = 1;
const paymentOptionsResponse = await apiRequest(requestParams);
if (paymentOptionsResponse.data) {
projectDetails = {
id: paymentOptionsResponse.data.id,
name: paymentOptionsResponse.data.name,
description: paymentOptionsResponse.data.description,
purpose: paymentOptionsResponse.data.purpose,
ownerName: paymentOptionsResponse.data.ownerName,
taxDeductionCountries:
paymentOptionsResponse.data.taxDeductionCountries,
projectImage: paymentOptionsResponse.data.image,
ownerAvatar: paymentOptionsResponse.data.ownerAvatar,
};
donationStep = 1;
}
} catch (err) {
donationStep = 0;
console.log("err", err);
}
} catch (err) {
donationStep = 0;
console.log("err", err);
}
} else {
if (!context.query.context) {
Expand Down
9 changes: 7 additions & 2 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,10 @@
"bouquetPurpose": "donation",
"conservationPurpose": "conservation donation",
"planet-cashPurpose": "PlanetCash donation",
"pfpSupportsUNEP": "Plant-for-the-Planet Supports the United Nations Environment Program"
}
"pfpSupportsUNEP": "Plant-for-the-Planet Supports the United Nations Environment Program",
"noPlanetCashAccount": "You do not have a PlanetCash account, however you can signup for one below",
"planetCashSignup": "Sign Up for PlanetCash",
"planetCashTC": "By clicking \"Create PlanetCash Account\", I agree to the <0>Terms and Conditions</0> of Plant-for-the-Planet Platform, and PlanetCash.",
mohitb35 marked this conversation as resolved.
Show resolved Hide resolved
"planetCashIUnderstand": "I understand that PlanetCash donation/payments are non-refundable, and unallocated payments will be auto allocated to projects on the Platform after six months of Payment.",
"createPlanetCashAccount": "Create PlanetCash Account"
}
Loading