Skip to content

Commit

Permalink
Merge pull request #310 from Plant-for-the-Planet-org/develop
Browse files Browse the repository at this point in the history
Release July 4th
  • Loading branch information
mariahosfeld authored Jul 11, 2022
2 parents 3c38bb3 + dc56de1 commit 14957f5
Show file tree
Hide file tree
Showing 24 changed files with 766 additions and 431 deletions.
3 changes: 2 additions & 1 deletion cypress/integration/bouquetDonations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ describe("Bouquet Donations", () => {

it("Testing Restore bouquetDonation", () => {
// cy.bouquetDonation("proj_bAwk5Agpfj1xcG61tFXMqKbu", "Germany{enter}", "de", "ten_1e5WejOp")
cy.bouquetDonation("proj_6x3GTD5cMRv0OeQAiIlJZ0Au", "United States of America{enter}", "us", "ten_1e5WejOp")
// cy.bouquetDonation("proj_6x3GTD5cMRv0OeQAiIlJZ0Au", "United States of America{enter}", "us", "ten_1e5WejOp")
cy.bouquetDonation("proj_lZIhXOL00Pw4cRUMIlnDGPaQ", "United States of America{enter}", "us", "ten_NxJq55pm")
cy.cardPayment("4242424242424242", "424", "242")
});
})
32 changes: 19 additions & 13 deletions cypress/integration/formError.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("Form Error Tests", () => {
cy.get('[data-test-id="test-country"]').clear().type("Germany{enter}").get('body').click(0,0)
cy.get('[data-test-id="test-continueToPayment"]').click()
cy.get('.form-errors').should("have.text", "First Name is required")
cy.get('[data-test-id="test-firstName"]').type("Peter")
cy.get('[data-test-id="test-firstName"]').click().type("Peter")
cy.get('body').should("not.have.text", "First Name is required")
})

Expand All @@ -31,7 +31,7 @@ describe("Form Error Tests", () => {
cy.get('[data-test-id="test-country"]').clear().type("Germany{enter}").get('body').click(0,0)
cy.get('[data-test-id="test-continueToPayment"]').click()
cy.get('.form-errors').should("have.text", "Last Name is required")
cy.get('[data-test-id="test-lastName"]').type("Payer")
cy.get('[data-test-id="test-lastName"]').click().type("Payer")
cy.get('body').should("not.have.text", "Last Name is required")
})

Expand Down Expand Up @@ -69,7 +69,7 @@ describe("Form Error Tests", () => {
cy.get('[data-test-id="test-country"]').clear().type("Germany{enter}").get('body').click(0, 0)
cy.get('[data-test-id="test-continueToPayment"]').click()
cy.get('.form-errors').should("have.text", "Address is required")
cy.get('[data-test-id="test-address"]').type("Unbekannt 1")
cy.get('[data-test-id="test-address"]').clear().type("Unbekannt 1")
cy.get('body').should("not.have.text", "Address is required")
})

Expand All @@ -83,11 +83,14 @@ describe("Form Error Tests", () => {
cy.get('[data-test-id="test-address"]').type("Unbekannt 1");
cy.get('[data-test-id="test-city"]').clear()
cy.get('[data-test-id="test-zipCode"]').clear().type("82449")
cy.get('[data-test-id="test-country"]').clear().type("Germany{enter}").get('body').click(0, 0)
cy.get('[data-test-id="test-continueToPayment"]').click()
cy.get('.form-errors').should("have.text", "City is required")
cy.get('[data-test-id="test-city"]').type("Uffing am Staffelsee")
cy.get('body').should("not.have.text", "City is required")
cy.get('[data-test-id="test-country"]').clear().type("Germany{enter}").get('body').click(0, 0).then(() => {
cy.get('[data-test-id="test-continueDisabled"]').click().then(() => {
cy.get('.form-errors').should("have.text", "City is required")
cy.get('[data-test-id="test-city"]').click().type("Uffing am Staffelsee").then(() => {
cy.get('body').should("not.have.text", "City is required")
})
})
})
})

it("ZipCode error", () => {
Expand All @@ -104,10 +107,13 @@ describe("Form Error Tests", () => {
cy.get('[data-test-id="test-address"]').type("Unbekannt 1");
cy.get('[data-test-id="test-city"]').clear().type("Uffing am Staffelsee")
cy.get('[data-test-id="test-zipCode"]').clear()
cy.get('[data-test-id="test-country"]').clear().type(`${selectedCountry}{enter}`).get('body').click(0, 0)
cy.get('[data-test-id="test-continueToPayment"]').click()
cy.get('.form-errors').should("have.text", "ZipCode is invalid")
cy.get('[data-test-id="test-zipCode"]').type(new RandExp(fiteredCountry[0].postal).gen())
cy.get('body').should("not.have.text", "ZipCode is invalid")
cy.get('[data-test-id="test-country"]').clear().type(`${selectedCountry}{enter}`).get('body').click(0, 0).then (() => {
cy.get('[data-test-id="test-continueDisabled"]').click().then(() => {
cy.get('.form-errors').should("have.text", "ZipCode is invalid")
cy.get('[data-test-id="test-zipCode"]').click().type(new RandExp(fiteredCountry[0].postal).gen()).then(() => {
cy.get('body').should("not.have.text", "ZipCode is invalid")
})
})
})
})
})
15 changes: 9 additions & 6 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,15 @@ Cypress.Commands.add('bankTransfer', () => {
cy.wait(5000)
// cy.get('.frequency-selection-option').eq(0).should("have.text", "Once").click()
cy.contactForm("Peter", "Payer", "[email protected]", "Unbekannt 1", "Uffing am Staffelsee", "Germany{enter}", "82449")
cy.wait(10000)
cy.get('[data-test-id="bankTransfer"]').click()
cy.get('[data-test-id="bankDonateContinue"]').click()
cy.wait(10000)
cy.get('[data-test-id="test-thankYou"]').should("exist")

cy.wait(15000).then(() => {
cy.get('[data-test-id="bankTransfer"]').click().then(() => {
cy.get('[data-test-id="bankDonateContinue"]').click().then(() => {
cy.wait(15000).then(() => {
cy.get('[data-test-id="test-thankYou"]').should("exist")
})
})
})
})
})


Expand Down
63 changes: 33 additions & 30 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;
donationStep: any;
giftDetails: Object;
isGift: boolean;
resolvedUrl: any;
resolvedUrl?: any;
isDirectDonation: boolean;
hideTaxDeduction: boolean;
isTaxDeductible: boolean;
Expand All @@ -28,7 +28,7 @@ interface Props {
allowTaxDeductionChange: boolean;
currency: any;
paymentSetup: any;
treecount: any;
treecount?: any;
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,16 +51,15 @@ function index({
allowTaxDeductionChange,
currency,
paymentSetup,
treecount,
amount,
meta,
frequency,
tenant,
callbackUrl,
callbackMethod,
projectDetails,
}: Props): ReactElement {
const {
setprojectDetails,
setdonationStep,
loadselectedProjects,
setgiftDetails,
Expand All @@ -82,6 +79,7 @@ function index({
settenant,
setcallbackUrl,
setCallbackMethod,
setprojectDetails,
} = React.useContext(QueryParamContext);

const router = useRouter();
Expand Down Expand Up @@ -116,6 +114,8 @@ function index({
}, []);

// If project details are present set project details
// This will be set from getServerSideProps.

React.useEffect(() => {
if (projectDetails) {
setprojectDetails(projectDetails);
Expand Down Expand Up @@ -250,30 +250,33 @@ 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,
locale,
};
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 Expand Up @@ -321,7 +324,7 @@ export async function getServerSideProps(context: any) {
// This will fetch the payment options
try {
const requestParams = {
url: `/app/paymentOptions/${donation.data.project.id}?country=${country}`,
url: `/app/paymentOptions/${donation.data.destination.id}?country=${country}`,
setshowErrorCard,
tenant,
locale,
Expand Down
2 changes: 1 addition & 1 deletion public/locales/cs/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"contact": "Kontakt",
"faqs": "FAQ",
"selectLanguage": "Zvolit jazyk",
"trees": "stromy",
"trees": "stromy",
"logout": "Odhlásit se",
"directGiftRecipient": "Tento dar podporuje Les od {{name}}",
"saveGiftDetails": "Uloži darovací údaje",
Expand Down
11 changes: 9 additions & 2 deletions public/locales/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"expDate": "Gültigkeitsdatum (MM/JJJJ)",
"donate": "Spenden",
"noPaymentMethodError": "Deine Zahlung konnte nicht verarbeitet werden, bitte versuche es erneut.",
"sofortDisclaimer": "SOFORT Zahlungen dauern in der Regel 1-3 Werktage. Sobald wir den Zahlungseingang verbucht haben, vervollständigen wir die Spende und schicken wir dir eine Bestätigungs-Mail.",
"sofortDisclaimer": "SOFORT Zahlungen dauern in der Regel 1-3 Werktage. Sobald wir den Zahlungseingang verbucht haben, vervollständigen wir die Spende und schicken dir eine Bestätigungs-Mail.",
"payWithSofort": "Spende mit SOFORT",
"payWithGiroPay": "Spende mit GiroPay",
"sepaDisclaimer": "SEPA-Bankeinzüge dauern in der Regel 1-4 Werktage. Sobald der Zahlungseingang verarbeitet wurde, vervollständigen wir die Spende und schicken wir dir eine Bestätigungs-E-Mail.",
Expand Down Expand Up @@ -167,5 +167,12 @@
"fundsPurpose": "Spende",
"bouquetPurpose": "Spende",
"conservationPurpose": "Naturschutzspende",
"planet-cashPurpose": "PlanetCash-Spende"
"planet-cashPurpose": "PlanetCash-Spende",
"pfpSupportsUNEP": "Plant-for-the-Planet unterstützt das Umweltprogramm der Vereinten Nationen",
"noPlanetCashAccount": "Du hast noch kein PlanetCash-Konto, kannst dich aber unten für eines anmelden",
"planetCashSignup": "Anmeldung für PlanetCash",
"planetCashTC": "Indem ich auf \"PlanetCash-Konto erstellen\" klicke, erkläre ich mich mit den <0>Allgemeinen Geschäftsbedingungen</0> der Plant-for-the-Planet-Plattform und von PlanetCash einverstanden.",
"planetCashIUnderstand": "Ich verstehe, dass PlanetCash Spenden/Zahlungen nicht zurückerstattet werden können, und dass nicht zugewiesene Zahlungen nach sechs Monaten automatisch Projekten auf der Plattform zugewiesen werden.",
"createPlanetCashAccount": "PlanetCash Konto erstellen",
"myContributionIsPartOfThat": "Und meine Spende ist Teil davon."
}
8 changes: 7 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,11 @@
"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.",
"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",
"myContributionIsPartOfThat": "And my contribution is a part of that."
}
Loading

1 comment on commit 14957f5

@vercel
Copy link

@vercel vercel bot commented on 14957f5 Jul 11, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.