-
Notifications
You must be signed in to change notification settings - Fork 5
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
Changes from 13 commits
a80d614
96cb906
f996654
901f658
8f21b96
7777eba
0c38def
e73b405
348ab85
0fcae57
28d207c
7c90bb6
aa5a7d1
3fe03c9
d772773
268335c
f97b528
68c8c0e
9df8d40
bb868af
6b3e0c8
d89dc9e
623bda7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,11 @@ import { setCountryCode } from "src/Utils/setCountryCode"; | |
import { DONATE } from "src/Utils/donationStepConstants"; | ||
|
||
interface Props { | ||
projectDetails: Object; | ||
projectDetails?: Object; | ||
donationStep: any; | ||
giftDetails: Object; | ||
isGift: boolean; | ||
resolvedUrl: any; | ||
resolvedUrl?: any; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codefactor reports an issue here due to using type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will be fixed in #309 |
||
isDirectDonation: boolean; | ||
hideTaxDeduction: boolean; | ||
isTaxDeductible: boolean; | ||
|
@@ -28,7 +28,7 @@ interface Props { | |
allowTaxDeductionChange: boolean; | ||
currency: any; | ||
paymentSetup: any; | ||
treecount: any; | ||
treecount?: any; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codefactor reports an issue here due to using type There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
@@ -38,11 +38,9 @@ interface Props { | |
} | ||
|
||
function index({ | ||
projectDetails, | ||
donationStep, | ||
giftDetails, | ||
isGift, | ||
resolvedUrl, | ||
isDirectDonation, | ||
hideTaxDeduction, | ||
isTaxDeductible, | ||
|
@@ -53,7 +51,6 @@ function index({ | |
allowTaxDeductionChange, | ||
currency, | ||
paymentSetup, | ||
treecount, | ||
amount, | ||
meta, | ||
frequency, | ||
|
@@ -62,7 +59,6 @@ function index({ | |
callbackMethod, | ||
}: Props): ReactElement { | ||
const { | ||
setprojectDetails, | ||
setdonationStep, | ||
loadselectedProjects, | ||
setgiftDetails, | ||
|
@@ -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) { | ||
|
@@ -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) { | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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