-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into issue/OCC-194
# Conflicts: # Directory.Packages.props # docs/releases/3.0.0.md # src/Modules/OrchardCore.Commerce.Payment.Stripe/Controllers/StripeController.cs
- Loading branch information
Showing
121 changed files
with
2,886 additions
and
528 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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
version: 2 | ||
|
||
build: | ||
os: ubuntu-22.04 | ||
os: ubuntu-24.04 | ||
tools: | ||
python: "3.11" | ||
|
||
|
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
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); | ||
} |
73 changes: 73 additions & 0 deletions
73
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,73 @@ | ||
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> | ||
/// Search for customers in Stripe with the given <paramref name="options"/>. | ||
/// </summary> | ||
Task<StripeSearchResult<Customer>> SearchCustomersAsync(CustomerSearchOptions options); | ||
|
||
/// <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); | ||
|
||
/// <summary> | ||
/// Populate the returned <see cref="CustomerCreateOptions"/> with the given details. | ||
/// </summary> | ||
CustomerCreateOptions PopulateCustomerCreateOptions( | ||
Address billingAddress, | ||
Address shippingAddress, | ||
string email, | ||
string phone); | ||
} |
31 changes: 31 additions & 0 deletions
31
src/Modules/OrchardCore.Commerce.Payment.Stripe/Abstractions/IStripeHelperService.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,31 @@ | ||
using Stripe; | ||
|
||
namespace OrchardCore.Commerce.Payment.Stripe.Abstractions; | ||
|
||
/// <summary> | ||
/// Stripe helping services, needed so we can mock this part of Stripe also. | ||
/// </summary> | ||
public interface IStripeHelperService | ||
{ | ||
/// <summary> | ||
/// Parses a JSON string from a Stripe webhook into a <see cref="Event"/> object, while | ||
/// verifying the <a href="https://stripe.com/docs/webhooks/signatures">webhook's | ||
/// signature</a>. | ||
/// </summary> | ||
/// <param name="json">The JSON string to parse.</param> | ||
/// <param name="stripeSignatureHeader"> | ||
/// The value of the <c>Stripe-Signature</c> header from the webhook request. | ||
/// </param> | ||
/// <param name="secret">The webhook endpoint's signing secret.</param> | ||
/// <param name="throwOnApiVersionMismatch"> | ||
/// If <see langword="true"/> (default), the method will throw a <see cref="StripeException"/> if the | ||
/// API version of the event doesn't match Stripe.net's default API version (see | ||
/// <see cref="StripeConfiguration.ApiVersion"/>). | ||
/// </param> | ||
/// <returns>The deserialized <see cref="Event"/>.</returns> | ||
/// <exception cref="StripeException"> | ||
/// Thrown if the signature verification fails for any reason, of if the API version of the | ||
/// event doesn't match Stripe.net's default API version. | ||
/// </exception> | ||
Event PrepareStripeEvent(string json, string stripeSignatureHeader, string secret, bool throwOnApiVersionMismatch); | ||
} |
41 changes: 41 additions & 0 deletions
41
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,41 @@ | ||
using OrchardCore.Commerce.MoneyDataType; | ||
using OrchardCore.Commerce.Payment.Stripe.Constants; | ||
using Stripe; | ||
using System.Threading.Tasks; | ||
|
||
namespace OrchardCore.Commerce.Payment.Stripe.Abstractions; | ||
|
||
/// <summary> | ||
/// Service for managing Stripe Payment Intents. | ||
/// </summary> | ||
public interface IStripePaymentIntentService | ||
{ | ||
/// <summary> | ||
/// Gets a PaymentIntent by its Stripe Id. | ||
/// </summary> | ||
/// <returns>Stripe <see cref="PaymentIntent"/> model.</returns> | ||
Task<PaymentIntent> GetPaymentIntentAsync(string paymentIntentId); | ||
|
||
/// <summary> | ||
/// Gets the PaymentIntent by its Stripe Id if it is <see cref="PaymentIntentStatuses.Succeeded"/> or | ||
/// <see cref="PaymentIntentStatuses.Processing"/>. Otherwise, updates it with the provided | ||
/// <paramref name="defaultTotal"/>. | ||
/// </summary> | ||
/// <returns>Updated or original Stripe <see cref="PaymentIntent"/> model.</returns> | ||
Task<PaymentIntent> GetOrUpdatePaymentIntentAsync( | ||
string paymentIntentId, | ||
Amount defaultTotal); | ||
|
||
/// <summary> | ||
/// Creates a PaymentIntent with the provided <paramref name="total"/>. And adds description and other values to | ||
/// the payment intent. Check the implementation for more details. | ||
/// </summary> | ||
/// <returns>Created Stripe <see cref="PaymentIntent"/>.</returns> | ||
Task<PaymentIntent> CreatePaymentIntentAsync(Amount total); | ||
|
||
/// <summary> | ||
/// Creates a PaymentIntent with the provided <paramref name="options"/>. | ||
/// </summary> | ||
/// <returns>Created Stripe <see cref="PaymentIntent"/> model.</returns> | ||
Task<PaymentIntent> CreatePaymentIntentAsync(PaymentIntentCreateOptions options); | ||
} |
Oops, something went wrong.