Skip to content

Commit

Permalink
Merge pull request #476 from Plant-for-the-Planet-org/feature/update-…
Browse files Browse the repository at this point in the history
…gift-param-logic

Allow gift query parameter for more project types
  • Loading branch information
mariahosfeld authored Dec 4, 2024
2 parents 0f124bf + 68c040a commit b35826d
Show file tree
Hide file tree
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
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/Common/Types/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit b35826d

Please sign in to comment.