-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
387 additions
and
207 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
16 changes: 16 additions & 0 deletions
16
...dules/OrchardCore.Commerce.Payment.Stripe/Abstractions/IStripeConfirmationTokenService.cs
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,16 @@ | ||
using Stripe; | ||
using System.Threading.Tasks; | ||
|
||
namespace OrchardCore.Commerce.Payment.Stripe.Abstractions; | ||
|
||
/// <summary> | ||
/// Service for managing Stripe confirmation tokens. | ||
/// </summary> | ||
public interface IStripeConfirmationTokenService | ||
{ | ||
/// <summary> | ||
/// Gets the Stripe confirmation token with an Id of <paramref name="confirmationTokenId"/>. | ||
/// </summary> | ||
/// <returns>The Stripe <see cref="ConfirmationToken"/>.</returns> | ||
Task<ConfirmationToken> GetConfirmationTokenAsync(string confirmationTokenId); | ||
} |
59 changes: 59 additions & 0 deletions
59
src/Modules/OrchardCore.Commerce.Payment.Stripe/Abstractions/IStripeCustomerService.cs
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,59 @@ | ||
using Stripe; | ||
using System.Threading.Tasks; | ||
using Address = OrchardCore.Commerce.AddressDataType.Address; | ||
|
||
namespace OrchardCore.Commerce.Payment.Stripe.Abstractions; | ||
|
||
/// <summary> | ||
/// Stripe customer related services. | ||
/// </summary> | ||
public interface IStripeCustomerService | ||
{ | ||
/// <summary> | ||
/// Get the first customer with the given email in Stripe. | ||
/// </summary> | ||
Task<Customer> GetFirstCustomerByEmailAsync(string customerEmail); | ||
|
||
/// <summary> | ||
/// Returns <see cref="Customer"/> with the given Id in Stripe. | ||
/// </summary> | ||
Task<Customer> GetCustomerByIdAsync(string customerId); | ||
|
||
/// <summary> | ||
/// Returns <see cref="Customer"/> with the given email in Stripe. If not found, create a new customer. | ||
/// </summary> | ||
/// <param name="email">If not provided the current user's email will be used.</param> | ||
Task<Customer> GetAndUpdateOrCreateCustomerAsync( | ||
Address billingAddress, | ||
Address shippingAddress, | ||
string email, | ||
string phone); | ||
|
||
/// <summary> | ||
/// Create a new customer in Stripe with the given <paramref name="customerCreateOptions"/>. | ||
/// </summary> | ||
/// <returns>The created Stripe <see cref="Customer"/>.</returns> | ||
Task<Customer> CreateCustomerAsync(CustomerCreateOptions customerCreateOptions); | ||
|
||
/// <summary> | ||
/// Create the customer in Stripe with the given details which will be used to create the | ||
/// <see cref="CustomerCreateOptions"/>. | ||
/// </summary> | ||
/// <returns>The created Stripe <see cref="Customer"/>.</returns> | ||
Task<Customer> CreateCustomerAsync( | ||
Address billingAddress, | ||
Address shippingAddress, | ||
string email, | ||
string phone); | ||
|
||
/// <summary> | ||
/// Update the customer in Stripe with the given details. | ||
/// </summary> | ||
/// <returns>The updated Stripe <see cref="Customer"/>.</returns> | ||
Task<Customer> UpdateCustomerAsync( | ||
string customerId, | ||
Address billingAddress, | ||
Address shippingAddress, | ||
string email, | ||
string phone); | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Modules/OrchardCore.Commerce.Payment.Stripe/Abstractions/IStripePaymentIntentService.cs
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,17 @@ | ||
using OrchardCore.Commerce.MoneyDataType; | ||
using Stripe; | ||
using System.Threading.Tasks; | ||
|
||
namespace OrchardCore.Commerce.Payment.Stripe.Abstractions; | ||
|
||
public interface IStripePaymentIntentService | ||
{ | ||
Task<PaymentIntent> GetPaymentIntentAsync(string paymentIntentId); | ||
|
||
Task<PaymentIntent> CreatePaymentIntentAsync(Amount total); | ||
Task<PaymentIntent> CreatePaymentIntentAsync(PaymentIntentCreateOptions options); | ||
|
||
Task<PaymentIntent> GetOrUpdatePaymentIntentAsync( | ||
string paymentIntentId, | ||
Amount defaultTotal); | ||
} |
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
22 changes: 22 additions & 0 deletions
22
src/Modules/OrchardCore.Commerce.Payment.Stripe/Abstractions/IStripeSessionEventHandler.cs
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,22 @@ | ||
using Stripe.Checkout; | ||
using System.Threading.Tasks; | ||
|
||
namespace OrchardCore.Commerce.Payment.Stripe.Abstractions; | ||
|
||
/// <summary> | ||
/// Event handler for Stripe sessions. | ||
/// </summary> | ||
public interface IStripeSessionEventHandler | ||
{ | ||
/// <summary> | ||
/// Called before a Stripe session is created with a prepopulated <see cref="SessionCreateOptions"/> | ||
/// <paramref name="options"/>. Here you can modify the options before the session is created. | ||
/// </summary> | ||
Task StripeSessionCreatingAsync(SessionCreateOptions options) => Task.CompletedTask; | ||
|
||
/// <summary> | ||
/// Called after a Stripe session is created with the created <paramref name="session"/> and the | ||
/// <paramref name="options"/> used during creation. | ||
/// </summary> | ||
Task StripeSessionCreatedAsync(Session session, SessionCreateOptions options) => Task.CompletedTask; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Modules/OrchardCore.Commerce.Payment.Stripe/Abstractions/IStripeSessionService.cs
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,16 @@ | ||
using Stripe.Checkout; | ||
using System.Threading.Tasks; | ||
|
||
namespace OrchardCore.Commerce.Payment.Stripe.Abstractions; | ||
|
||
/// <summary> | ||
/// Service for managing Stripe sessions. | ||
/// </summary> | ||
public interface IStripeSessionService | ||
{ | ||
/// <summary> | ||
/// Creates a Stripe session using the given <paramref name="options"/>. | ||
/// </summary> | ||
/// <returns>The created Stripe <see cref="Session"/>.</returns> | ||
Task<Session> CreateSessionAsync(SessionCreateOptions options); | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Modules/OrchardCore.Commerce.Payment.Stripe/Abstractions/IStripeSubscriptionService.cs
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,34 @@ | ||
using OrchardCore.Commerce.Payment.Stripe.Models; | ||
using OrchardCore.Commerce.Payment.Stripe.ViewModels; | ||
using Stripe; | ||
using System.Threading.Tasks; | ||
|
||
namespace OrchardCore.Commerce.Payment.Stripe.Abstractions; | ||
|
||
/// <summary> | ||
/// Service for managing Stripe subscriptions. | ||
/// </summary> | ||
public interface IStripeSubscriptionService | ||
{ | ||
/// <summary> | ||
/// Updates a Stripe subscription. | ||
/// </summary> | ||
Task UpdateSubscriptionAsync(string subscriptionId, SubscriptionUpdateOptions options); | ||
|
||
/// <summary> | ||
/// Gets a Stripe subscription. | ||
/// </summary> | ||
Task<Subscription> GetSubscriptionAsync(string subscriptionId, SubscriptionGetOptions options); | ||
|
||
/// <summary> | ||
/// Creates a Stripe subscription using the given <paramref name="options"/>. | ||
/// </summary> | ||
/// <returns>The created Stripe <see cref="Subscription"/>.</returns> | ||
Task<Subscription> CreateSubscriptionAsync(SubscriptionCreateOptions options); | ||
|
||
/// <summary> | ||
/// Creates a Stripe subscription using the given <paramref name="viewModel"/>. | ||
/// </summary> | ||
/// <returns>The created Stripe <see cref="Subscription"/>.</returns> | ||
Task<SubscriptionCreateResponse> CreateSubscriptionAsync(StripeCreateSubscriptionViewModel viewModel); | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Modules/OrchardCore.Commerce.Payment.Stripe/Abstractions/IStripeWebhookEventHandler.cs
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,16 @@ | ||
using Stripe; | ||
using System.Threading.Tasks; | ||
|
||
namespace OrchardCore.Commerce.Payment.Stripe.Abstractions; | ||
|
||
/// <summary> | ||
/// Event handler for the Stripe webhook. | ||
/// </summary> | ||
public interface IStripeWebhookEventHandler | ||
{ | ||
/// <summary> | ||
/// Called when a Stripe event is received. This is where you can handle the event. | ||
/// </summary> | ||
/// <param name="stripeEvent">Contains the Stripe Event parameters.</param> | ||
Task ReceivedStripeEventAsync(Event stripeEvent); | ||
} |
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
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
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
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
Oops, something went wrong.