Add Balance and Withdrawal
This commit is contained in:
@@ -31,6 +31,7 @@ type Config struct {
|
||||
Midtrans Midtrans `mapstructure:"midtrans"`
|
||||
Brevo Brevo `mapstructure:"brevo"`
|
||||
Email Email `mapstructure:"email"`
|
||||
Withdraw Withdraw `mapstructure:"withdrawal"`
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -73,5 +74,9 @@ func (c *Config) Auth() *AuthConfig {
|
||||
secret: c.Jwt.TokenResetPassword.Secret,
|
||||
expireTTL: c.Jwt.TokenResetPassword.ExpiresTTL,
|
||||
},
|
||||
jwtWithdraw: JWT{
|
||||
secret: c.Jwt.TokenWithdraw.Secret,
|
||||
expireTTL: c.Jwt.TokenWithdraw.ExpiresTTL,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ type AuthConfig struct {
|
||||
jwtOrderSecret string
|
||||
jwtOrderExpiresTTL int
|
||||
jwtSecretResetPassword JWT
|
||||
jwtWithdraw JWT
|
||||
}
|
||||
|
||||
type JWT struct {
|
||||
@@ -23,6 +24,15 @@ func (c *AuthConfig) AccessTokenOrderSecret() string {
|
||||
return c.jwtOrderSecret
|
||||
}
|
||||
|
||||
func (c *AuthConfig) AccessTokenWithdrawSecret() string {
|
||||
return c.jwtWithdraw.secret
|
||||
}
|
||||
|
||||
func (c *AuthConfig) AccessTokenWithdrawExpire() time.Time {
|
||||
duration := time.Duration(c.jwtWithdraw.expireTTL)
|
||||
return time.Now().UTC().Add(time.Minute * duration)
|
||||
}
|
||||
|
||||
func (c *AuthConfig) AccessTokenOrderExpiresDate() time.Time {
|
||||
duration := time.Duration(c.jwtOrderExpiresTTL)
|
||||
return time.Now().UTC().Add(time.Minute * duration)
|
||||
|
||||
@@ -4,6 +4,7 @@ type Jwt struct {
|
||||
Token Token `mapstructure:"token"`
|
||||
TokenOrder Token `mapstructure:"token-order"`
|
||||
TokenResetPassword Token `mapstructure:"token-reset-password"`
|
||||
TokenWithdraw Token `mapstructure:"token-withdraw"`
|
||||
}
|
||||
|
||||
type Token struct {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
type Withdraw struct {
|
||||
PlatformFee int64 `mapstructure:"platform_fee"`
|
||||
}
|
||||
|
||||
func (w *Withdraw) GetPlatformFee() int64 {
|
||||
return w.PlatformFee
|
||||
}
|
||||
Reference in New Issue
Block a user