✨ Award post
This commit is contained in:
@@ -97,7 +97,19 @@ public static class GrpcClientHelper
|
||||
return new PermissionService.PermissionServiceClient(CreateCallInvoker(url, clientCertPath, clientKeyPath,
|
||||
clientCertPassword));
|
||||
}
|
||||
|
||||
|
||||
public static async Task<PaymentService.PaymentServiceClient> CreatePaymentServiceClient(
|
||||
IEtcdClient etcdClient,
|
||||
string clientCertPath,
|
||||
string clientKeyPath,
|
||||
string? clientCertPassword = null
|
||||
)
|
||||
{
|
||||
var url = await GetServiceUrlFromEtcd(etcdClient, "DysonNetwork.Pass");
|
||||
return new PaymentService.PaymentServiceClient(CreateCallInvoker(url, clientCertPath, clientKeyPath,
|
||||
clientCertPassword));
|
||||
}
|
||||
|
||||
public static async Task<PusherService.PusherServiceClient> CreatePusherServiceClient(
|
||||
IEtcdClient etcdClient,
|
||||
string clientCertPath,
|
||||
|
@@ -126,6 +126,7 @@ message CreateOrderRequest {
|
||||
optional string product_identifier = 8;
|
||||
// Using bytes for meta to represent JSON.
|
||||
optional bytes meta = 6;
|
||||
optional string remarks = 9;
|
||||
bool reuseable = 7;
|
||||
}
|
||||
|
||||
|
@@ -71,6 +71,20 @@ public static class ServiceInjectionHelper
|
||||
.GetResult();
|
||||
});
|
||||
|
||||
services.AddSingleton<PaymentService.PaymentServiceClient>(sp =>
|
||||
{
|
||||
var etcdClient = sp.GetRequiredService<IEtcdClient>();
|
||||
var config = sp.GetRequiredService<IConfiguration>();
|
||||
var clientCertPath = config["Service:ClientCert"]!;
|
||||
var clientKeyPath = config["Service:ClientKey"]!;
|
||||
var clientCertPassword = config["Service:CertPassword"];
|
||||
|
||||
return GrpcClientHelper
|
||||
.CreatePaymentServiceClient(etcdClient, clientCertPath, clientKeyPath, clientCertPassword)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
});
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user