forked from gongxuegit/tiku-backend.net
feat: add payment sdk and tenant secret foundation
This commit is contained in:
41
Tiku.Infrastructure/Commerce/ManualPaymentProvider.cs
Normal file
41
Tiku.Infrastructure/Commerce/ManualPaymentProvider.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Text.Json;
|
||||
using Tiku.Application.Commerce;
|
||||
|
||||
namespace Tiku.Infrastructure.Commerce;
|
||||
|
||||
internal sealed class ManualPaymentProvider : IPaymentProvider
|
||||
{
|
||||
public string Provider => PaymentProviders.Manual;
|
||||
|
||||
public Task<CreatePaymentProviderResult> CreatePaymentAsync(
|
||||
PaymentProviderAccount account,
|
||||
CreatePaymentProviderRequest request,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var payload = JsonSerializer.SerializeToElement(new
|
||||
{
|
||||
request.OrderNo,
|
||||
request.AmountCents,
|
||||
request.Subject,
|
||||
Message = "manual_payment_requires_tenant_admin_confirmation"
|
||||
});
|
||||
|
||||
return Task.FromResult(new CreatePaymentProviderResult(
|
||||
Provider,
|
||||
request.Method,
|
||||
"pending",
|
||||
null,
|
||||
payload,
|
||||
payload));
|
||||
}
|
||||
|
||||
public Task<PaymentNotificationResult> ParsePaymentNotificationAsync(
|
||||
PaymentProviderAccount account,
|
||||
PaymentNotificationRequest request,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
throw new PaymentProviderException(
|
||||
"Manual payment does not accept provider notifications.",
|
||||
"manual_payment_notification_not_supported");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user