-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create non profit endpoint support added
- Loading branch information
1 parent
a5e741b
commit 153d286
Showing
26 changed files
with
730 additions
and
583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
namespace Rest.GetChangeio.Abstractions | ||
namespace Rest.GetChangeio.Abstractions; | ||
|
||
public interface IGetChangeioConfig | ||
{ | ||
public interface IGetChangeioConfig | ||
{ | ||
public string? GetChangeioPublicKey { get; set; } | ||
public string? GetChangeioPublicKey { get; set; } | ||
|
||
public string? GetChangeioSecretKey { get; set; } | ||
} | ||
public string? GetChangeioSecretKey { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,76 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Rest.GetChangeio.Requests; | ||
using Rest.GetChangeio.Responses; | ||
using Rest.GetChangeio.ServiceModel; | ||
|
||
namespace Rest.GetChangeio.Abstractions | ||
namespace Rest.GetChangeio.Abstractions; | ||
|
||
/// <summary> | ||
/// Most U.S. nonprofits exist in the CHANGE platform. Each nonprofit has a CHANGE-issued ID; | ||
/// these IDs are used to reference nonprofits throughout our APIs. You can search for nonprofits manually on | ||
/// the dashboard, or you can search programmatically. | ||
/// </summary> | ||
public interface INonprofitsService | ||
{ | ||
/// <summary> | ||
/// Most U.S. nonprofits exist in the CHANGE platform. Each nonprofit has a CHANGE-issued ID; | ||
/// these IDs are used to reference nonprofits throughout our APIs. You can search for nonprofits manually on | ||
/// the dashboard, or you can search programmatically. | ||
/// Retrieves information for a nonprofit. | ||
/// </summary> | ||
/// <param name="id">The id of a nonprofit from the CHANGE network.</param> | ||
/// <param name="token"></param> | ||
/// <returns></returns> | ||
Task<Nonprofit?> GetAsync(string id, CancellationToken token = default); | ||
|
||
/// <summary> | ||
/// Retrieves a list of nonprofits whose names match the provided name. This endpoint is paginated. | ||
/// </summary> | ||
public interface INonprofitsService | ||
{ | ||
/// <summary> | ||
/// Retrieves information for a nonprofit. | ||
/// </summary> | ||
/// <param name="id">The id of a nonprofit from the CHANGE network.</param> | ||
/// <param name="token"></param> | ||
/// <returns></returns> | ||
Task<Nonprofit?> GetAsync(string id, CancellationToken token = default); | ||
/// <param name="name">A string to search.</param> | ||
/// <param name="page">The page to return. This endpoint is paginated, and returns up to 30 nonprofits at a time.</param> | ||
/// <param name="token"></param> | ||
/// <returns>A paginated list of nonprofits.</returns> | ||
Task<SearchNonprofitsResponse?> SearchAsync(string name, int page = 1, CancellationToken token = default); | ||
|
||
/// <summary> | ||
/// Retrieves a list of nonprofits whose names match the provided name. This endpoint is paginated. | ||
/// </summary> | ||
/// <param name="name">A string to search.</param> | ||
/// <param name="page">The page to return. This endpoint is paginated, and returns up to 30 nonprofits at a time.</param> | ||
/// <param name="token"></param> | ||
/// <returns>A paginated list of nonprofits.</returns> | ||
Task<SearchNonprofitsResponse?> SearchAsync(string name, int page = 1, CancellationToken token = default); | ||
/// <summary> | ||
/// Retrieves a list of nonprofits whose names match the provided name. This endpoint is paginated. | ||
/// </summary> | ||
/// <param name="name">A string to search.</param> | ||
/// <param name="categories">List of categories to search. Valid categories are: 'arts and culture', | ||
/// 'education', 'environment', 'animals', 'healthcare', 'human services', 'international affairs', | ||
/// 'public benefit', 'religion', 'mutual benefit', 'unclassified'.</param> | ||
/// <param name="page">The page to return. This endpoint is paginated, and returns up to 30 nonprofits at a time.</param> | ||
/// <param name="token"></param> | ||
/// <returns>A paginated list of nonprofits.</returns> | ||
Task<SearchNonprofitsResponse?> SearchAsync( | ||
string name, | ||
string[] categories, | ||
int page = 1, | ||
CancellationToken token = default); | ||
|
||
/// <summary> | ||
/// Retrieves a list of nonprofits whose names match the provided name. This endpoint is paginated. | ||
/// </summary> | ||
/// <param name="name">A string to search.</param> | ||
/// <param name="categories">List of categories to search. Valid categories are: 'arts and culture', | ||
/// 'education', 'environment', 'animals', 'healthcare', 'human services', 'international affairs', | ||
/// 'public benefit', 'religion', 'mutual benefit', 'unclassified'.</param> | ||
/// <param name="page">The page to return. This endpoint is paginated, and returns up to 30 nonprofits at a time.</param> | ||
/// <param name="token"></param> | ||
/// <returns>A paginated list of nonprofits.</returns> | ||
Task<SearchNonprofitsResponse?> SearchAsync( | ||
string name, | ||
string[] categories, | ||
int page = 1, | ||
CancellationToken token = default); | ||
/// <summary> | ||
/// Immediately starts a payout to a nonprofit. Normally, nonprofits are paid once per month. | ||
/// If you want a nonprofit to receive your donations sooner, use this endpoint. You will receive an invoice | ||
/// for the donation funds within 24 hours of using this endpoint. | ||
/// </summary> | ||
/// <param name="id">The id of a nonprofit from the CHANGE network.</param> | ||
/// <param name="token"></param> | ||
/// <returns>The payout created</returns> | ||
Task<CreateInstantPayoutResponse?> CreateInstantPayoutAsync(string id, CancellationToken token = default); | ||
|
||
/// <summary> | ||
/// Immediately starts a payout to a nonprofit. Normally, nonprofits are paid once per month. | ||
/// If you want a nonprofit to receive your donations sooner, use this endpoint. You will receive an invoice | ||
/// for the donation funds within 24 hours of using this endpoint. | ||
/// </summary> | ||
/// <param name="id">The id of a nonprofit from the CHANGE network.</param> | ||
/// <param name="token"></param> | ||
/// <returns>The payout created</returns> | ||
Task<CreateInstantPayoutResponse?> CreateInstantPayoutAsync(string id, CancellationToken token = default); | ||
/// <summary> | ||
/// Retrieves a list of instant payouts you've previously made that are either pending or complete for the | ||
/// last month. The instant payouts are returned in order of creation, with the most recent instant payouts | ||
/// appearing first. | ||
/// </summary> | ||
/// <param name="id">The id of a nonprofit from the CHANGE network.</param> | ||
/// <param name="token"></param> | ||
/// <returns>A list of instant payouts you've previously made</returns> | ||
Task<GetInstantPayoutsResponse?> GetInstantPayoutsAsync(string id, CancellationToken token = default); | ||
|
||
/// <summary> | ||
/// Retrieves a list of instant payouts you've previously made that are either pending or complete for the | ||
/// last month. The instant payouts are returned in order of creation, with the most recent instant payouts | ||
/// appearing first. | ||
/// </summary> | ||
/// <param name="id">The id of a nonprofit from the CHANGE network.</param> | ||
/// <param name="token"></param> | ||
/// <returns>A list of instant payouts you've previously made</returns> | ||
Task<GetInstantPayoutsResponse?> GetInstantPayoutsAsync(string id, CancellationToken token = default); | ||
} | ||
/// <summary> | ||
/// Requests a nonprofit. | ||
/// </summary> | ||
/// <param name="request">The create non-profit request.</param> | ||
/// <param name="token"></param> | ||
/// <returns>A list of instant payouts you've previously made</returns> | ||
Task<CreateNonprofitResponse?> CreateNonprofitAsync(CreateNonprofitRequest request, CancellationToken token = default); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<LangVersion>latest</LangVersion> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Rest.GetChangeio.Enums; | ||
|
||
|
||
[JsonConverter(typeof(JsonStringEnumConverter))] | ||
public enum SocialType | ||
{ | ||
Facebook, | ||
Instagram, | ||
TikTok, | ||
Twitter, | ||
YouTube | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Rest.GetChangeio.Requests | ||
{ | ||
/// <summary> | ||
/// Creates a Stripe Checkout link to collect donations for a specific nonprofit. | ||
/// Donation processing fees are automatically deducted from the collected amount. | ||
/// </summary> | ||
/// <param name="Amount">The amount of the donation in cents.</param> | ||
/// <param name="NonprofitId">The id of a nonprofit from the Change network.</param> | ||
/// <param name="SuccessUrl">The url the donor will be redirected to upon a successful donation.</param> | ||
/// <param name="CancelUrl">The url the donor will be redirected to if they cancel checkout.</param> | ||
public record CreateCheckoutRequest( | ||
long Amount, | ||
namespace Rest.GetChangeio.Requests; | ||
|
||
[property: JsonPropertyName("nonprofit_id")] | ||
string NonprofitId, | ||
/// <summary> | ||
/// Creates a Stripe Checkout link to collect donations for a specific nonprofit. | ||
/// Donation processing fees are automatically deducted from the collected amount. | ||
/// </summary> | ||
/// <param name="Amount">The amount of the donation in cents.</param> | ||
/// <param name="NonprofitId">The id of a nonprofit from the Change network.</param> | ||
/// <param name="SuccessUrl">The url the donor will be redirected to upon a successful donation.</param> | ||
/// <param name="CancelUrl">The url the donor will be redirected to if they cancel checkout.</param> | ||
public record CreateCheckoutRequest( | ||
long Amount, | ||
|
||
[property: JsonPropertyName("success_url")] | ||
string SuccessUrl, | ||
[property: JsonPropertyName("nonprofit_id")] | ||
string NonprofitId, | ||
|
||
[property: JsonPropertyName("cancel_url")] | ||
string CancelUrl); | ||
} | ||
[property: JsonPropertyName("success_url")] | ||
string SuccessUrl, | ||
|
||
[property: JsonPropertyName("cancel_url")] | ||
string CancelUrl); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Rest.GetChangeio.Requests | ||
namespace Rest.GetChangeio.Requests; | ||
|
||
/// <summary> | ||
/// Creates a Stripe Checkout link to collect donations for a specific nonprofit. | ||
/// Donation processing fees are automatically deducted from the collected amount. | ||
/// </summary> | ||
/// <param name="Amount">The amount of the donation in cents.</param> | ||
/// <param name="NonprofitId">The id of a nonprofit from the Change network.</param> | ||
public record CreateCryptoCheckoutRequest( | ||
long Amount, | ||
|
||
[property: JsonPropertyName("nonprofit_id")] | ||
string NonprofitId) | ||
{ | ||
/// <summary> | ||
/// Creates a Stripe Checkout link to collect donations for a specific nonprofit. | ||
/// Donation processing fees are automatically deducted from the collected amount. | ||
/// A set of key-value pairs that you can attach to a donation. | ||
/// This information will be returned in a webhook upon successful payment. | ||
/// </summary> | ||
/// <param name="Amount">The amount of the donation in cents.</param> | ||
/// <param name="NonprofitId">The id of a nonprofit from the Change network.</param> | ||
public record CreateCryptoCheckoutRequest( | ||
long Amount, | ||
|
||
[property: JsonPropertyName("nonprofit_id")] | ||
string NonprofitId) | ||
{ | ||
/// <summary> | ||
/// A set of key-value pairs that you can attach to a donation. | ||
/// This information will be returned in a webhook upon successful payment. | ||
/// </summary> | ||
public Dictionary<string, string>? Metadata { get; set; } | ||
} | ||
public Dictionary<string, string>? Metadata { get; set; } | ||
} |
Oops, something went wrong.