add pay
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled

This commit is contained in:
guwandyk committed 2026-09-19 03:54:40 +05:00
1 parent 848a07324f
commit 6c7c402390
16 files changed
+891 -324

No files matched your search

+11 -1
View File
@@ -71,7 +71,7 @@ func New(cfg *config.Config, client *pgxpool.Pool, logger *logging.Logger) *gin.
lending.Register(adminGroup, client, logger)
cards.Register(adminGroup, client, logger)
currencyRepo := currencydb.NewRepository(client, logger)
payment.Register(adminGroup, client, logger, currencyRepo, paymentgateway.NewLogClient(logger))
payment.Register(adminGroup, client, logger, currencyRepo, paymentGatewayClient(cfg, logger), cfg.PublicBaseURL)
currency.NewHandler(logger, currencyRepo).Register(adminGroup)
dashboard.NewHandler(logger, dashboarddb.NewRepository(client, logger)).Register(adminGroup)
@@ -86,3 +86,13 @@ func New(cfg *config.Config, client *pgxpool.Pool, logger *logging.Logger) *gin.
return router
}
// paymentGatewayClient picks the real GBÜS client outside debug mode, and
// the logging stub in debug mode, so local/dev runs never hit the live
// bank gateway by accident.
func paymentGatewayClient(cfg *config.Config, logger *logging.Logger) paymentgateway.Client {
if cfg.IsDebug != nil && *cfg.IsDebug {
return paymentgateway.NewLogClient(logger)
}
return paymentgateway.NewHTTPClient(logger)
}