everydotorg / donate-button

A free donate and p2p fundraising button so nonprofit websites can accept cryptocurrency, stocks, and cash - credit, debit, bank, PayPal, Venmo, Apple Pay, Google Pay.
https://www.every.org
MIT License
49 stars 7 forks source link

feat: add support for fundraisers #311

Closed julianpoma closed 2 years ago

julianpoma commented 2 years ago

Closes #310

Passing a fundraiserSlug in the options will render the widget with fundraiser data and redirect to the proper URL.

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/everydotorg/donate-button/FAzfvBn9NwxmmGJtSqPjG4bHc6Aa
✅ Preview: https://donate-button-git-fundrisers-support-everydotorg.vercel.app

julianpoma commented 2 years ago

@markulrich

Which API endpoint can we use to get the fundarisers data? every.org/api is blocked by CORS (origins don't match). Does https://partners.every.org/ support fundraisers?

santiher commented 2 years ago

Which API endpoint can we use to get the fundrisers data? every.org/api is blocked by CORS (origins don't match). Does https://partners.every.org/ support fundrisers?

partners.every.org does not currently support fundraisers. I'll add it.

santiher commented 2 years ago

@markulrich

Which API endpoint can we use to get the fundrisers data? every.org/api is blocked by CORS (origins don't match). Does https://partners.every.org/ support fundrisers?

The uri will be: /nonprofit/:nonprofitIdentifier/fundraiser/:fundraiserIdentifier and the identifiers can be either ids or slugs.

Codec format:

{
  fundraiser: {
    entityName: "Fundraiser",
    id: uuidCodec,
    createdAt: dateFromStringCodec,
    nonprofitId: uuidCodec,
    creatorUserId: t.union([uuidCodec, t.null]),
    creatorNonprofitId: t.union([uuidCodec, t.null]),
    slug: t.string,
    title: t.string,
    description: t.union([t.string, t.null]),
    coverImageCloudinaryId: t.union([t.string, t.null]),
    active: t.boolean,
    startDate: t.union([dateFromStringCodec, t.null]),
    endDate: t.union([dateFromStringCodec, t.null]),
    pinnedAt: t.union([dateFromStringCodec, t.null]),
    goalCurrency: t.union([currencyCodec, t.null]),
    goalAmount: t.union([integerFromStringCodec, t.null]),
    metadata: t.union([
      t.partial({
        brandColor: t.string,
        coverAssetOverride: coverAssetCodec,
      }),
      t.null,
    ]),
    parentFundraiserId: t.union([uuidCodec, t.null]),
    childrenFundraiserIds: t.union([t.array(uuidCodec), t.null]),
    eventIds: t.union([t.array(uuidCodec), t.null]),
  },
  fundraiserEvents: fundraiserEventCodec[],  // will be empty for now
  nonprofits: nonprofitResponseCodec[], // same format as the nonprofit route
  users: userResponseCodec[]
});

Example:

{
  "message": "OK",
  "data": {
    "fundraiser": {
      "entityName": "Fundraiser",
      "id": "f45d0b40-7945-405c-a2b0-95bb0c91598f",
      "createdAt": "2021-10-19T17:59:03.011Z",
      "nonprofitId": "d59c98c6-9e9b-44b1-82df-146ca39c7263",
      "creatorUserId": "d1b4306f-ea0b-4c46-af55-18d5287571db",
      "creatorNonprofitId": "d59c98c6-9e9b-44b1-82df-146ca39c7263",
      "slug": "fun",
      "title": "Fun",
      "description": "Fun1",
      "coverImageCloudinaryId": "profile_pics/bjwcklqn8jplk5ksbecv",
      "active": true,
      "startDate": null,
      "endDate": null,
      "pinnedAt": "2021-10-19T17:59:03.009Z",
      "goalAmount": null,
      "goalCurrency": "USD",
      "metadata": null,
      "parentFundraiserId": null,
      "childrenFundraiserIds": [],
      "eventIds": []
    },
    "users": [
      {
        "entityName": "User",
        "id": "d1b4306f-ea0b-4c46-af55-18d5287571db",
        "firstName": "Sing",
        "lastName": "Tester",
        "username": "sing.tester",
        "twitterHandle": null,
        "facebookHandle": null,
        "instagramHandle": null,
        "linkedInHandle": null,
        "youtubeUrl": null,
        "locationAddress": null,
        "isPrivate": false,
        "verifiedStatus": "NOT_VERIFIED",
        "followedByCurrentUserStatus": "unset"
      }
    ],
    "nonprofits": [
      {
        "entityName": "Nonprofit",
        "id": "d59c98c6-9e9b-44b1-82df-146ca39c7263",
        "name": "Wikipedia",
        "primarySlug": "wikipedia",
        "ein": "200049703",
        "isDisbursable": true,
        "description": "A free, collaborative, multilingual Internet encyclopedia. A great way to test your trust in the wisdom of crowds. ",
        "descriptionLong": "The mission of the Wikimedia Foundation is to empower and engage people around the world to collect and develop educational content under a free license or in the public domain, and to disseminate it effectively and globally.  In collaboration with a network of chapters, the Foundation provides the essential infrastructure and an organizational framework for the support and development of multilingual wiki projects and other endeavors which serve this mission. The Foundation will make and keep useful information from its projects available on the Internet free of charge, in perpetuity.\nThe mission of the Wikimedia Foundation is to empower and engage people around the world to collect and develop educational content under a free license or in the public domain, and to disseminate it effectively and globally.  In collaboration with a network of chapters, the Foundation provides the essential infrastructure and an organizational framework for the support and development of multilingual wiki projects and other endeavors which serve this mission. The Foundation will make and keep useful information from its projects available on the Internet free of charge, in perpetuity.\nThe mission of the Wikimedia Foundation is to empower and engage people around the world to collect and develop educational content under a free license or in the public domain, and to disseminate it effectively and globally.  In collaboration with a network of chapters, the Foundation provides the essential infrastructure and an organizational framework for the support and development of multilingual wiki projects and other endeavors which serve this mission. The Foundation will make and keep useful information from its projects available on the Internet free of charge, in perpetuity.\nThe mission of the Wikimedia Foundation is to empower and engage people around the world to collect and develop educational content under a free license or in the public domain, and to disseminate it effectively and globally.  In collaboration with a network of chapters, the Foundation provides the essential infrastructure and an organizational framework for the support and development of multilingual wiki projects and other endeavors which serve this mission. The Foundation will make and keep useful information from its projects available on the Internet free of charge, in perpetuity.\nThe mission of the Wikimedia Foundation is to empower and engage people around the world to collect and develop educational content under a free license or in the public domain, and to disseminate it effectively and globally.  In collaboration with a network of chapters, the Foundation provides the essential infrastructure and an organizational framework for the support and development of multilingual wiki projects and other endeavors which serve this mission. The Foundation will make and keep useful information from its projects available on the Internet free of charge, in perpetuity.\nThe mission of the Wikimedia Foundation is to empower and engage people around the world to collect and develop educational content under a free license or in the public domain, and to disseminate it effectively and globally.  In collaboration with a network of chapters, the Foundation provides the essential infrastructure and an organizational framework for the support and development of multilingual wiki projects and other endeavors which serve this mission. The Foundation will make and keep useful information from its projects available on the Internet free of charge, in perpetuity.\nThe mission of the Wikimedia Foundation is to empower and engage people around the world to collect and develop educational content under a free license or in the public domain, and to disseminate it effectively and globally.  In collaboration with a network of chapters, the Foundation provides the essential infrastructure and an organizational framework for the support and development of multilingual wiki projects and other endeavors which serve this mission. The Foundation will make and keep useful information from its projects available on the Internet free of charge, in perpetuity.\nThe mission of the Wikimedia Foundation is to empower and engage people around the world to collect and develop educational content under a free license or in the public domain, and to disseminate it effectively and globally.  In collaboration with a network of chapters, the Foundation provides the essential infrastructure and an organizational framework for the support and development of multilingual wiki projects and other endeavors which serve this mission. The Foundation will make and keep useful information from its projects available on the Internet free of charge, in perpetuity.\nThe mission of the Wikimedia Foundation is to empower and engage people around the world to collect and develop educational content under a free license or in the public domain, and to disseminate it effectively and globally.  In collaboration with a network of chapters, the Foundation provides the essential infrastructure and an organizational framework for the support and development of multilingual wiki projects and other endeavors which serve this mission. The Foundation will make and keep useful information from its projects available on the Internet free of charge, in perpetuity.\nThe mission of the Wikimedia Foundation is to empower and engage people around the world to collect and develop educational content under a free license or in the public domain, and to disseminate it effectively and globally.  In collaboration with a network of chapters, the Foundation provides the essential infrastructure and an organizational framework for the support and development of multilingual wiki projects and other endeavors which serve this mission. The Foundation will make and keep useful information from its projects available on the Internet free of charge, in perpetuity.\nThe mission of the Wikimedia Foundation is to empower and engage people around the world to collect and develop educational content under a free license or in the public domain, and to disseminate it effectively and globally.  In collaboration with a network of chapters, the Foundation provides the essential infrastructure and an organizational framework for the support and development of multilingual wiki projects and other endeavors which serve this mission. The Foundation will make and keep useful information from its projects available on the Internet free of charge, in perpetuity.\nThe mission of the Wikimedia Foundation is to empower and engage people around the world to collect and develop educational content under a free license or in the public domain, and to disseminate it effectively and globally.  In collaboration with a network of chapters, the Foundation provides the essential infrastructure and an organizational framework for the support and development of multilingual wiki projects and other endeavors which serve this mission. The Foundation will make and keep useful information from its projects available on the Internet free of charge, in perpetuity.\n",
        "contactEmail": null,
        "locationAddress": "Washington, District of Columbia, 20090 United States",
        "locationLatLng": null,
        "nteeCode": "B60",
        "nteeCodeMeaning": {},
        "websiteUrl": "http://www.wikimediafoundation.org",
        "twitterHandle": "wikimedia",
        "facebookHandle": "wikipediaBook",
        "instagramHandle": "wikipediaaaaaaaa",
        "linkedInHandle": "wikipedia",
        "youtubeUrl": null,
        "revenueAmt": "10157555500",
        "causeCategory": "EDUCATION",
        "logoCloudinaryId": "profile_pics/mfyks8bndfkpbdoswgea",
        "coverImageCloudinaryId": "profile_pics/bjwcklqn8jplk5ksbecv",
        "displayType": "NONPROFIT",
        "type": "NONPROFIT",
        "fundCreatingEntityId": null,
        "fundCreatingEntityType": null,
        "countryCode": "US",
        "donationThankYouMessage": null,
        "endorsedNonprofitIds": null,
        "createdFundIds": null,
        "endorserNonprofitIds": null,
        "fundraiserEvents": null,
        "memberCount": null,
        "loggedInUserMembership": null,
        "donatedCurrencies": null
      }
    ],
    "fundraiserEvents": []
  }
}

Is the amount raised going to be needed?

julianpoma commented 2 years ago

@santiher Thank you !

Not, the amount raised is not going to be needed AFAIK. Currently we don't have a way to show that data in the widget.

julianpoma commented 2 years ago

@santiher just checking in that the partners API was updated, because this link is showing 404

https://partners.every.org/v0.2/nonprofit/wphfund/fundraiser/wphf-urgent-need-for

santiher commented 2 years ago

@santiher just checking in that the partners API was updated, because this link is showing 404

https://partners.every.org/v0.2/nonprofit/wphfund/fundraiser/wphf-urgent-need-for

Just deployed. It is working for me now: curl -o - https://partners.every.org/v0.2/nonprofit/wphfund/fundraiser/wphf-urgent-need-for

julianpoma commented 2 years ago

@markulrich this is ready for review

markulrich commented 2 years ago

Looks great, thank you Julian!