Compare commits
No commits in common. "4a5de68a8c1f380f0064e1741217241ce139e6ac" and "2181388f5bf19b4edc4715ea386b9b26ea1597ec" have entirely different histories.
4a5de68a8c
...
2181388f5b
@ -16,7 +16,6 @@ const (
|
|||||||
voucherTransfersPathPrefix = "/api/v1/transfers/last10"
|
voucherTransfersPathPrefix = "/api/v1/transfers/last10"
|
||||||
voucherDataPathPrefix = "/api/v1/token"
|
voucherDataPathPrefix = "/api/v1/token"
|
||||||
AliasPrefix = "api/v1/alias"
|
AliasPrefix = "api/v1/alias"
|
||||||
SendSMSPrefix = "api/v1/external/upsell"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -35,7 +34,6 @@ var (
|
|||||||
VoucherTransfersURL string
|
VoucherTransfersURL string
|
||||||
VoucherDataURL string
|
VoucherDataURL string
|
||||||
CheckAliasURL string
|
CheckAliasURL string
|
||||||
SendSMSURL string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func setBase() error {
|
func setBase() error {
|
||||||
@ -71,6 +69,5 @@ func LoadConfig() error {
|
|||||||
VoucherTransfersURL, _ = url.JoinPath(dataURLBase, voucherTransfersPathPrefix)
|
VoucherTransfersURL, _ = url.JoinPath(dataURLBase, voucherTransfersPathPrefix)
|
||||||
VoucherDataURL, _ = url.JoinPath(dataURLBase, voucherDataPathPrefix)
|
VoucherDataURL, _ = url.JoinPath(dataURLBase, voucherDataPathPrefix)
|
||||||
CheckAliasURL, _ = url.JoinPath(dataURLBase, AliasPrefix)
|
CheckAliasURL, _ = url.JoinPath(dataURLBase, AliasPrefix)
|
||||||
SendSMSURL, _ = url.JoinPath(dataURLBase, SendSMSPrefix)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
type SendSMSResponse struct {
|
|
||||||
Invitee string `json:"invitee"`
|
|
||||||
}
|
|
@ -17,5 +17,4 @@ type AccountService interface {
|
|||||||
TokenTransfer(ctx context.Context, amount, from, to, tokenAddress string) (*models.TokenTransferResponse, error)
|
TokenTransfer(ctx context.Context, amount, from, to, tokenAddress string) (*models.TokenTransferResponse, error)
|
||||||
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)
|
||||||
SendSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.TokenTransferResponse, error)
|
|
||||||
}
|
}
|
||||||
|
@ -248,37 +248,6 @@ func (as *HTTPAccountService) RequestAlias(ctx context.Context, publicKey string
|
|||||||
return svc.RequestAlias(ctx, publicKey, hint)
|
return svc.RequestAlias(ctx, publicKey, hint)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendSMS calls the API to send out an SMS.
|
|
||||||
// Parameters:
|
|
||||||
// - inviterPhone: The user initiating the SMS.
|
|
||||||
// - inviteePhone: The number being invited to Sarafu.
|
|
||||||
func (as *HTTPAccountService) SendSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) {
|
|
||||||
var r models.SendSMSResponse
|
|
||||||
|
|
||||||
// Create request payload
|
|
||||||
payload := map[string]string{
|
|
||||||
"inviterPhone": inviterPhone,
|
|
||||||
"inviteePhone": inviteePhone,
|
|
||||||
}
|
|
||||||
|
|
||||||
payloadBytes, err := json.Marshal(payload)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new request
|
|
||||||
req, err := http.NewRequest("POST", config.SendSMSURL, bytes.NewBuffer(payloadBytes))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
_, err = doRequest(ctx, req, &r)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &r, 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