Compare commits
No commits in common. "58366274c3e1e899081737532fc8a3b6281481a2" and "34957e5b6ff81ba3d5f3fcd0a776f41dd1a74e18" have entirely different histories.
58366274c3
...
34957e5b6f
@ -18,7 +18,6 @@ const (
|
|||||||
AliasPrefix = "api/v1/alias"
|
AliasPrefix = "api/v1/alias"
|
||||||
SendSMSPrefix = "api/v1/external/upsell"
|
SendSMSPrefix = "api/v1/external/upsell"
|
||||||
AliasEnsPrefix = "/api/v1/bypass"
|
AliasEnsPrefix = "/api/v1/bypass"
|
||||||
ExtraSMSPrefix = "/api/v1/external"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -26,7 +25,6 @@ var (
|
|||||||
dataURLBase string
|
dataURLBase string
|
||||||
BearerToken string
|
BearerToken string
|
||||||
aliasEnsURLBase string
|
aliasEnsURLBase string
|
||||||
extraSMSBase string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -41,7 +39,6 @@ var (
|
|||||||
CheckAliasURL string
|
CheckAliasURL string
|
||||||
SendSMSURL string
|
SendSMSURL string
|
||||||
AliasEnsURL string
|
AliasEnsURL string
|
||||||
ExtraSMSURL string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func setBase() error {
|
func setBase() error {
|
||||||
@ -50,7 +47,6 @@ func setBase() error {
|
|||||||
custodialURLBase = env.GetEnv("CUSTODIAL_URL_BASE", "http://localhost:5003")
|
custodialURLBase = env.GetEnv("CUSTODIAL_URL_BASE", "http://localhost:5003")
|
||||||
dataURLBase = env.GetEnv("DATA_URL_BASE", "http://localhost:5006")
|
dataURLBase = env.GetEnv("DATA_URL_BASE", "http://localhost:5006")
|
||||||
aliasEnsURLBase = env.GetEnv("ALIAS_ENS_BASE", "http://localhost:5015")
|
aliasEnsURLBase = env.GetEnv("ALIAS_ENS_BASE", "http://localhost:5015")
|
||||||
extraSMSBase = env.GetEnv("EXTRA_SMS__BASE", "http://localhost:5035")
|
|
||||||
BearerToken = env.GetEnv("BEARER_TOKEN", "")
|
BearerToken = env.GetEnv("BEARER_TOKEN", "")
|
||||||
|
|
||||||
_, err = url.Parse(custodialURLBase)
|
_, err = url.Parse(custodialURLBase)
|
||||||
@ -81,7 +77,5 @@ func LoadConfig() error {
|
|||||||
CheckAliasURL, _ = url.JoinPath(dataURLBase, AliasPrefix)
|
CheckAliasURL, _ = url.JoinPath(dataURLBase, AliasPrefix)
|
||||||
SendSMSURL, _ = url.JoinPath(dataURLBase, SendSMSPrefix)
|
SendSMSURL, _ = url.JoinPath(dataURLBase, SendSMSPrefix)
|
||||||
AliasEnsURL, _ = url.JoinPath(aliasEnsURLBase, AliasEnsPrefix)
|
AliasEnsURL, _ = url.JoinPath(aliasEnsURLBase, AliasEnsPrefix)
|
||||||
ExtraSMSURL, _ = url.JoinPath(extraSMSBase, ExtraSMSPrefix)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -660,11 +660,3 @@ func (das *DevAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, i
|
|||||||
Invitee: inviteePhone,
|
Invitee: inviteePhone,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (das *DevAccountService) SendPINResetSMS(ctx context.Context, admin, phone string) error {
|
|
||||||
return fmt.Errorf("unimplemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (das *DevAccountService) SendAddressSMS(ctx context.Context, publicKey, originPhone string) error {
|
|
||||||
return fmt.Errorf("unimplemented")
|
|
||||||
}
|
|
||||||
|
|||||||
@ -18,6 +18,4 @@ type AccountService interface {
|
|||||||
CheckAliasAddress(ctx context.Context, alias string) (*models.AliasAddress, error)
|
CheckAliasAddress(ctx context.Context, alias string) (*models.AliasAddress, error)
|
||||||
RequestAlias(ctx context.Context, hint string, publicKey string) (*models.RequestAliasResult, error)
|
RequestAlias(ctx context.Context, hint string, publicKey string) (*models.RequestAliasResult, error)
|
||||||
SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error)
|
SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error)
|
||||||
SendAddressSMS(ctx context.Context, publicKey, originPhone string)
|
|
||||||
SendPINResetSMS(ctx context.Context, admin, phone string)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -344,56 +344,6 @@ func (as *HTTPAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, i
|
|||||||
return &r, nil
|
return &r, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (as *HTTPAccountService) SendAddressSMS(ctx context.Context, publicKey, originPhone string) error {
|
|
||||||
ep, err := url.JoinPath(config.ExtraSMSURL, "address")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
logg.InfoCtxf(ctx, "sending an address sms", "endpoint", ep, "address", publicKey, "origin-phone", originPhone)
|
|
||||||
payload := map[string]string{
|
|
||||||
"address": publicKey,
|
|
||||||
"originPhone": originPhone,
|
|
||||||
}
|
|
||||||
payloadBytes, err := json.Marshal(payload)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
req, err := http.NewRequest("POST", ep, bytes.NewBuffer(payloadBytes))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
_, err = doRequest(ctx, req, nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (as *HTTPAccountService) SendPINResetSMS(ctx context.Context, admin, phone string) error {
|
|
||||||
ep, err := url.JoinPath(config.ExtraSMSURL, "pinreset")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
logg.InfoCtxf(ctx, "sending pin reset sms", "endpoint", ep, "admin", admin, "phone", phone)
|
|
||||||
payload := map[string]string{
|
|
||||||
"admin": admin,
|
|
||||||
"phone": phone,
|
|
||||||
}
|
|
||||||
payloadBytes, err := json.Marshal(payload)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
req, err := http.NewRequest("POST", ep, bytes.NewBuffer(payloadBytes))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
_, err = doRequest(ctx, req, nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: remove eth-custodial api dependency
|
// TODO: remove eth-custodial api dependency
|
||||||
func doRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKResponse, error) {
|
func doRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKResponse, error) {
|
||||||
var okResponse api.OKResponse
|
var okResponse api.OKResponse
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user