2023-05-16 01:12:07 +00:00
|
|
|
package initialize
|
|
|
|
|
|
|
|
import (
|
2023-05-17 20:27:09 +00:00
|
|
|
"go.uber.org/zap"
|
2023-06-13 10:42:23 +00:00
|
|
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/interface/client"
|
2023-05-16 04:01:55 +00:00
|
|
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models"
|
2023-05-16 01:12:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ClientsDeps struct {
|
2023-06-13 16:21:20 +00:00
|
|
|
Logger *zap.Logger
|
|
|
|
AuthURL *models.AuthMicroserviceURL
|
|
|
|
HubadminURL *models.HubadminMicroserviceURL
|
|
|
|
CurrencyURL *models.CurrencyMicroserviceURL
|
|
|
|
DiscountServiceConfiguration *models.DiscountMicroserviceConfiguration
|
|
|
|
PaymentServiceConfiguration *models.PaymentMicroserviceConfiguration
|
2023-05-16 01:12:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Clients struct {
|
2023-05-19 09:08:15 +00:00
|
|
|
AuthClient *client.AuthClient
|
|
|
|
HubadminClient *client.HubadminClient
|
2023-05-23 16:09:06 +00:00
|
|
|
CurrencyClient *client.CurrencyClient
|
2023-05-30 11:33:57 +00:00
|
|
|
DiscountClient *client.DiscountClient
|
2023-06-13 16:09:17 +00:00
|
|
|
PaymentClient *client.PaymentClient
|
2023-05-16 01:12:07 +00:00
|
|
|
}
|
|
|
|
|
2023-06-13 22:51:34 +00:00
|
|
|
func NewClients(deps ClientsDeps) *Clients {
|
2023-05-16 01:12:07 +00:00
|
|
|
return &Clients{
|
2023-06-13 22:51:34 +00:00
|
|
|
AuthClient: client.NewAuthClient(client.AuthClientDeps{
|
2023-05-16 01:12:07 +00:00
|
|
|
Logger: deps.Logger,
|
|
|
|
URLs: deps.AuthURL,
|
|
|
|
}),
|
2023-06-13 22:51:34 +00:00
|
|
|
HubadminClient: client.NewHubadminClient(client.HubadminClientDeps{
|
2023-05-19 09:08:15 +00:00
|
|
|
Logger: deps.Logger,
|
|
|
|
URLs: deps.HubadminURL,
|
|
|
|
}),
|
2023-06-13 22:51:34 +00:00
|
|
|
CurrencyClient: client.NewCurrencyClient(client.CurrencyClientDeps{
|
2023-05-23 16:09:06 +00:00
|
|
|
Logger: deps.Logger,
|
|
|
|
URLs: deps.CurrencyURL,
|
|
|
|
}),
|
2023-06-13 22:51:34 +00:00
|
|
|
DiscountClient: client.NewDiscountClient(client.DiscountClientDeps{
|
2023-05-30 11:33:57 +00:00
|
|
|
Logger: deps.Logger,
|
2023-06-13 16:21:20 +00:00
|
|
|
DiscountServiceHost: deps.DiscountServiceConfiguration.HostGRPC,
|
2023-06-13 16:09:17 +00:00
|
|
|
}),
|
|
|
|
PaymentClient: client.NewPaymentClient(client.PaymentClientDeps{
|
|
|
|
Logger: deps.Logger,
|
2023-06-13 16:21:20 +00:00
|
|
|
PaymentServiceHost: deps.PaymentServiceConfiguration.HostGRPC,
|
2023-05-30 11:33:57 +00:00
|
|
|
}),
|
2023-05-16 01:12:07 +00:00
|
|
|
}
|
|
|
|
}
|