Skip to content

Commit

Permalink
Merge pull request #477 from Plant-for-the-Planet-org/develop
Browse files Browse the repository at this point in the history
Release: Expansion of direct access to Gift Step in Donation form via query parameter
mariahosfeld authored Dec 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 0892f98 + b35826d commit 60e20ce
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -455,8 +455,13 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
}
}

// Set gift details if gift = true in the query params (only for tree projects)
if (context.query.gift === "true" && projectDetails?.purpose === "trees") {
// Set gift details if gift = true in the query params
if (
giftDetails?.type !== "direct" &&
context.query.gift === "true" &&
projectDetails !== null &&
!NON_GIFTABLE_PROJECT_PURPOSES.includes(projectDetails.purpose)
) {
isGift = true;
giftDetails = {
type: "invitation",
6 changes: 3 additions & 3 deletions src/Common/Types/index.tsx
Original file line number Diff line number Diff line change
@@ -14,11 +14,11 @@ import {
} from "@planet-sdk/common";

/** planet-donations only allows direct or invitation gifts */
export type DirectGiftDetails = SentDirectGift & {
export interface DirectGiftDetails extends SentDirectGift {
recipientName?: string;
recipientProfile?: string;
};
export type InvitationGiftDetails = SentInvitationGift;
}
export interface InvitationGiftDetails extends SentInvitationGift {}

export type SentGift = SentDirectGift | SentInvitationGift;

0 comments on commit 60e20ce

Please sign in to comment.