From 7280784ee1968b27f05c40d3c7e9c797de36c528 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Thu, 6 Mar 2025 09:05:01 +0300 Subject: [PATCH 01/19] added the send sms endpoint configs --- config/config.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/config.go b/config/config.go index 6ebb5bc..6610c87 100644 --- a/config/config.go +++ b/config/config.go @@ -16,6 +16,7 @@ const ( voucherTransfersPathPrefix = "/api/v1/transfers/last10" voucherDataPathPrefix = "/api/v1/token" AliasPrefix = "api/v1/alias" + SendSMSPrefix = "api/v1/external/upsell" ) var ( @@ -34,6 +35,7 @@ var ( VoucherTransfersURL string VoucherDataURL string CheckAliasURL string + SendSMSURL string ) func setBase() error { @@ -69,5 +71,6 @@ func LoadConfig() error { VoucherTransfersURL, _ = url.JoinPath(dataURLBase, voucherTransfersPathPrefix) VoucherDataURL, _ = url.JoinPath(dataURLBase, voucherDataPathPrefix) CheckAliasURL, _ = url.JoinPath(dataURLBase, AliasPrefix) + SendSMSURL, _ = url.JoinPath(dataURLBase, SendSMSPrefix) return nil } From 6c4702e2baccb4ec5b7dcfe17ff9519cd7ee701b Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Thu, 6 Mar 2025 09:05:39 +0300 Subject: [PATCH 02/19] added the send sms response model --- models/send_sms_response.go | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 models/send_sms_response.go diff --git a/models/send_sms_response.go b/models/send_sms_response.go new file mode 100644 index 0000000..1f6a70f --- /dev/null +++ b/models/send_sms_response.go @@ -0,0 +1,5 @@ +package models + +type SendSMSResponse struct { + Invitee string `json:"invitee"` +} From 4a5de68a8c1f380f0064e1741217241ce139e6ac Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Thu, 6 Mar 2025 09:06:45 +0300 Subject: [PATCH 03/19] added the SendSMS func to the httpAccount service --- remote/account_service.go | 1 + remote/http/service.go | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/remote/account_service.go b/remote/account_service.go index 2c67b12..33a6380 100644 --- a/remote/account_service.go +++ b/remote/account_service.go @@ -17,4 +17,5 @@ type AccountService interface { TokenTransfer(ctx context.Context, amount, from, to, tokenAddress string) (*models.TokenTransferResponse, error) CheckAliasAddress(ctx context.Context, alias string) (*models.AliasAddress, error) RequestAlias(ctx context.Context, hint string, publicKey string) (*models.RequestAliasResult, error) + SendSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.TokenTransferResponse, error) } diff --git a/remote/http/service.go b/remote/http/service.go index aca8ae0..e398011 100644 --- a/remote/http/service.go +++ b/remote/http/service.go @@ -248,6 +248,37 @@ func (as *HTTPAccountService) RequestAlias(ctx context.Context, publicKey string 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 func doRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKResponse, error) { var okResponse api.OKResponse From 417e7f0179e59058527f1e3485fa1104c651f3e1 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Tue, 1 Apr 2025 14:53:30 +0300 Subject: [PATCH 04/19] fix: correct sendSms response --- remote/account_service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remote/account_service.go b/remote/account_service.go index 33a6380..74f388e 100644 --- a/remote/account_service.go +++ b/remote/account_service.go @@ -17,5 +17,5 @@ type AccountService interface { TokenTransfer(ctx context.Context, amount, from, to, tokenAddress string) (*models.TokenTransferResponse, error) CheckAliasAddress(ctx context.Context, alias string) (*models.AliasAddress, error) RequestAlias(ctx context.Context, hint string, publicKey string) (*models.RequestAliasResult, error) - SendSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.TokenTransferResponse, error) + SendSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) } From 5b41c8dc6440d8561cdd03814c082a6a87b48a7e Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Tue, 1 Apr 2025 14:55:03 +0300 Subject: [PATCH 05/19] chore: rename SendSMS to SendUpsellSMS --- remote/account_service.go | 2 +- remote/http/service.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/remote/account_service.go b/remote/account_service.go index 74f388e..07e697e 100644 --- a/remote/account_service.go +++ b/remote/account_service.go @@ -17,5 +17,5 @@ type AccountService interface { TokenTransfer(ctx context.Context, amount, from, to, tokenAddress string) (*models.TokenTransferResponse, error) CheckAliasAddress(ctx context.Context, alias string) (*models.AliasAddress, error) RequestAlias(ctx context.Context, hint string, publicKey string) (*models.RequestAliasResult, error) - SendSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) + SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) } diff --git a/remote/http/service.go b/remote/http/service.go index f58a7ba..7ddccde 100644 --- a/remote/http/service.go +++ b/remote/http/service.go @@ -317,7 +317,7 @@ func requestEnsAlias(ctx context.Context, publicKey string, hint string) (*model // 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) { +func (as *HTTPAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) { var r models.SendSMSResponse // Create request payload From 441e289854add7fefe5ce27b9707de355d3a0c43 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Tue, 1 Apr 2025 15:25:10 +0300 Subject: [PATCH 06/19] implement SendUpsellSMs --- testutil/mocks/service_mock.go | 7 ++++++- testutil/testservice/account_service.go | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/testutil/mocks/service_mock.go b/testutil/mocks/service_mock.go index bfa9222..b2cc015 100644 --- a/testutil/mocks/service_mock.go +++ b/testutil/mocks/service_mock.go @@ -53,7 +53,12 @@ func (m *MockAccountService) CheckAliasAddress(ctx context.Context, alias string return args.Get(0).(*models.AliasAddress), args.Error(1) } -func (m MockAccountService) RequestAlias(ctx context.Context, publicKey string, hint string) (*models.RequestAliasResult, error) { +func (m *MockAccountService) RequestAlias(ctx context.Context, publicKey string, hint string) (*models.RequestAliasResult, error) { args := m.Called(publicKey, hint) return args.Get(0).(*models.RequestAliasResult), args.Error(1) } + +func (m *MockAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) { + args := m.Called(inviterPhone, inviteePhone) + return args.Get(0).(*models.SendSMSResponse), args.Error(1) +} diff --git a/testutil/testservice/account_service.go b/testutil/testservice/account_service.go index 12b9de4..1d1e9f3 100644 --- a/testutil/testservice/account_service.go +++ b/testutil/testservice/account_service.go @@ -64,3 +64,7 @@ func (m TestAccountService) CheckAliasAddress(ctx context.Context, alias string) func (m TestAccountService) RequestAlias(ctx context.Context, publicKey string, hint string) (*models.RequestAliasResult, error) { return &models.RequestAliasResult{}, nil } + +func (m TestAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) { + return &models.SendSMSResponse{}, nil +} From 6597d6b6a2d8167f677bb9c1d302d18ffab692c0 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Fri, 11 Apr 2025 11:02:23 +0300 Subject: [PATCH 07/19] added the SendUpsellSMS to DevAccountService and MockApi --- dev/api.go | 7 +++++++ testutil/mocks/api_mock.go | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/dev/api.go b/dev/api.go index fc68c29..f2e0a45 100644 --- a/dev/api.go +++ b/dev/api.go @@ -653,3 +653,10 @@ func (das *DevAccountService) RequestAlias(ctx context.Context, publicKey string Alias: alias, }, nil } + +func (das *DevAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) { + logg.DebugCtxf(ctx, "sent an SMS", "inviterPhone", inviterPhone, "inviteePhone", inviteePhone) + return &models.SendSMSResponse{ + Invitee: inviteePhone, + }, nil +} diff --git a/testutil/mocks/api_mock.go b/testutil/mocks/api_mock.go index b020677..2293aa6 100644 --- a/testutil/mocks/api_mock.go +++ b/testutil/mocks/api_mock.go @@ -61,3 +61,7 @@ func (m MockApi) RequestAlias(ctx context.Context, publicKey string, hint string func (m MockApi) TokenTransfer(ctx context.Context, amount, from, to, tokenAddress string) (*models.TokenTransferResponse, error) { return nil, nil } + +func (m MockApi) SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) { + return nil, nil +} From 492b101aa4d2911d4dd266e8363606cdf4098ba2 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 17 Apr 2025 18:56:20 +0300 Subject: [PATCH 08/19] setup extra sms api endpoints --- config/config.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/config.go b/config/config.go index d1af7e8..c85b0a4 100644 --- a/config/config.go +++ b/config/config.go @@ -18,6 +18,7 @@ const ( AliasPrefix = "api/v1/alias" SendSMSPrefix = "api/v1/external/upsell" AliasEnsPrefix = "/api/v1/bypass" + ExtraSMSPrefix = "/api/v1/external" ) var ( @@ -25,6 +26,7 @@ var ( dataURLBase string BearerToken string aliasEnsURLBase string + extraSMSBase string ) var ( @@ -39,6 +41,7 @@ var ( CheckAliasURL string SendSMSURL string AliasEnsURL string + ExtraSMSURL string ) func setBase() error { @@ -47,6 +50,7 @@ func setBase() error { custodialURLBase = env.GetEnv("CUSTODIAL_URL_BASE", "http://localhost:5003") dataURLBase = env.GetEnv("DATA_URL_BASE", "http://localhost:5006") aliasEnsURLBase = env.GetEnv("ALIAS_ENS_BASE", "http://localhost:5015") + extraSMSBase = env.GetEnv("EXTRA_SMS__BASE", "http://localhost:5035") BearerToken = env.GetEnv("BEARER_TOKEN", "") _, err = url.Parse(custodialURLBase) @@ -77,5 +81,7 @@ func LoadConfig() error { CheckAliasURL, _ = url.JoinPath(dataURLBase, AliasPrefix) SendSMSURL, _ = url.JoinPath(dataURLBase, SendSMSPrefix) AliasEnsURL, _ = url.JoinPath(aliasEnsURLBase, AliasEnsPrefix) + ExtraSMSURL, _ = url.JoinPath(extraSMSBase, ExtraSMSPrefix) + return nil } From a243fe8c294306f3209e680f6f8b1b490858b4ba Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 17 Apr 2025 18:57:02 +0300 Subject: [PATCH 09/19] add SendAddressSMS and SendPINResetSMS --- remote/account_service.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/remote/account_service.go b/remote/account_service.go index 07e697e..f667586 100644 --- a/remote/account_service.go +++ b/remote/account_service.go @@ -18,4 +18,6 @@ type AccountService interface { CheckAliasAddress(ctx context.Context, alias string) (*models.AliasAddress, error) RequestAlias(ctx context.Context, hint string, publicKey string) (*models.RequestAliasResult, 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) } From b85511e4360e79492b266ab6bc838e989d76192a Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 17 Apr 2025 18:57:24 +0300 Subject: [PATCH 10/19] implement SendPINResetSMS and SendAddressSMS --- remote/http/service.go | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/remote/http/service.go b/remote/http/service.go index 7ddccde..64b5259 100644 --- a/remote/http/service.go +++ b/remote/http/service.go @@ -344,6 +344,56 @@ func (as *HTTPAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, i 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 func doRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKResponse, error) { var okResponse api.OKResponse From 58366274c3e1e899081737532fc8a3b6281481a2 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 17 Apr 2025 18:58:12 +0300 Subject: [PATCH 11/19] add required AccountService methods --- dev/api.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dev/api.go b/dev/api.go index f2e0a45..8c7ef90 100644 --- a/dev/api.go +++ b/dev/api.go @@ -660,3 +660,11 @@ func (das *DevAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, i Invitee: inviteePhone, }, 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") +} From 86cfb9c020284e1d123ed1ea33259270139c2bac Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 17 Apr 2025 22:18:30 +0300 Subject: [PATCH 12/19] match expected method signature --- remote/account_service.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remote/account_service.go b/remote/account_service.go index f667586..3a1b3ab 100644 --- a/remote/account_service.go +++ b/remote/account_service.go @@ -18,6 +18,6 @@ type AccountService interface { CheckAliasAddress(ctx context.Context, alias string) (*models.AliasAddress, error) RequestAlias(ctx context.Context, hint string, publicKey string) (*models.RequestAliasResult, 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) + SendAddressSMS(ctx context.Context, publicKey, originPhone string) error + SendPINResetSMS(ctx context.Context, admin, phone string) error } From 5ff139b6494b504a595a74597d7fe131f923af73 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 17 Apr 2025 23:07:33 +0300 Subject: [PATCH 13/19] add expected accountservice methods --- testutil/testservice/account_service.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/testutil/testservice/account_service.go b/testutil/testservice/account_service.go index 1d1e9f3..abb7c92 100644 --- a/testutil/testservice/account_service.go +++ b/testutil/testservice/account_service.go @@ -57,14 +57,22 @@ func (tas *TestAccountService) TokenTransfer(ctx context.Context, amount, from, }, nil } -func (m TestAccountService) CheckAliasAddress(ctx context.Context, alias string) (*models.AliasAddress, error) { +func (m *TestAccountService) CheckAliasAddress(ctx context.Context, alias string) (*models.AliasAddress, error) { return &models.AliasAddress{}, nil } -func (m TestAccountService) RequestAlias(ctx context.Context, publicKey string, hint string) (*models.RequestAliasResult, error) { +func (m *TestAccountService) RequestAlias(ctx context.Context, publicKey string, hint string) (*models.RequestAliasResult, error) { return &models.RequestAliasResult{}, nil } -func (m TestAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) { +func (m *TestAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, inviteePhone string) (*models.SendSMSResponse, error) { return &models.SendSMSResponse{}, nil } + +func (m *TestAccountService) SendAddressSMS(ctx context.Context, publicKey, originPhone string) error { + return nil +} + +func (m *TestAccountService) SendPINResetSMS(ctx context.Context, admin, phone string) error { + return nil +} From 5c0ed48e678cce7de3fc86e20ea3a3bbd985377b Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 17 Apr 2025 23:14:42 +0300 Subject: [PATCH 14/19] add required sms methods --- testutil/mocks/service_mock.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/testutil/mocks/service_mock.go b/testutil/mocks/service_mock.go index b2cc015..e6bdd5e 100644 --- a/testutil/mocks/service_mock.go +++ b/testutil/mocks/service_mock.go @@ -62,3 +62,11 @@ func (m *MockAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, in args := m.Called(inviterPhone, inviteePhone) return args.Get(0).(*models.SendSMSResponse), args.Error(1) } + +func (m *MockAccountService) SendPINResetSMS(ctx context.Context, admin, phone string) error { + return nil +} + +func (m *MockAccountService) SendAddressSMS(ctx context.Context, publicKey, originPhone string) error { + return nil +} From 4ea8fd1f04bf79899c7fc6be80a57ea26b51bae1 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Mon, 28 Apr 2025 10:56:05 +0300 Subject: [PATCH 15/19] chore: rename extrasms prefixes to external sms --- config/config.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/config.go b/config/config.go index c85b0a4..1ada3b0 100644 --- a/config/config.go +++ b/config/config.go @@ -18,7 +18,7 @@ const ( AliasPrefix = "api/v1/alias" SendSMSPrefix = "api/v1/external/upsell" AliasEnsPrefix = "/api/v1/bypass" - ExtraSMSPrefix = "/api/v1/external" + ExternalSMSPrefix = "/api/v1/external" ) var ( @@ -26,7 +26,7 @@ var ( dataURLBase string BearerToken string aliasEnsURLBase string - extraSMSBase string + externalSMSBase string ) var ( @@ -41,7 +41,7 @@ var ( CheckAliasURL string SendSMSURL string AliasEnsURL string - ExtraSMSURL string + ExternalSMSURL string ) func setBase() error { @@ -50,8 +50,8 @@ func setBase() error { custodialURLBase = env.GetEnv("CUSTODIAL_URL_BASE", "http://localhost:5003") dataURLBase = env.GetEnv("DATA_URL_BASE", "http://localhost:5006") aliasEnsURLBase = env.GetEnv("ALIAS_ENS_BASE", "http://localhost:5015") - extraSMSBase = env.GetEnv("EXTRA_SMS__BASE", "http://localhost:5035") - BearerToken = env.GetEnv("BEARER_TOKEN", "") + externalSMSBase = env.GetEnv("EXTRA_SMS__BASE", "http://localhost:5035") + BearerToken = env.GetEnv("BEARER_TOKEN", "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJwdWJsaWNLZXkiOiIweDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAiLCJzZXJ2aWNlIjp0cnVlLCJpc3MiOiJldGgtY3VzdG9kaWFsLTYzMDFkZjgiLCJzdWIiOiJhbGZham9yZXMtdGVzdCIsImV4cCI6MTc2Mjk0OTY5OCwiaWF0IjoxNzMxNDEzNjk4fQ.K5COKDKPKA8KwaA-jWFUJEPdS767pXlZhl1MX7pEzFplLYWIkr_w1oOz7bvOSxTWnOLpaaCOMTzBSiobnNdKCw") _, err = url.Parse(custodialURLBase) if err != nil { @@ -81,7 +81,7 @@ func LoadConfig() error { CheckAliasURL, _ = url.JoinPath(dataURLBase, AliasPrefix) SendSMSURL, _ = url.JoinPath(dataURLBase, SendSMSPrefix) AliasEnsURL, _ = url.JoinPath(aliasEnsURLBase, AliasEnsPrefix) - ExtraSMSURL, _ = url.JoinPath(extraSMSBase, ExtraSMSPrefix) + ExternalSMSURL, _ = url.JoinPath(externalSMSBase, ExternalSMSPrefix) return nil } From d509477de3d26a1d0135200707269661f6219372 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Mon, 28 Apr 2025 11:03:34 +0300 Subject: [PATCH 16/19] remove accidentallypushed bearer token --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 1ada3b0..32dc59a 100644 --- a/config/config.go +++ b/config/config.go @@ -51,7 +51,7 @@ func setBase() error { dataURLBase = env.GetEnv("DATA_URL_BASE", "http://localhost:5006") aliasEnsURLBase = env.GetEnv("ALIAS_ENS_BASE", "http://localhost:5015") externalSMSBase = env.GetEnv("EXTRA_SMS__BASE", "http://localhost:5035") - BearerToken = env.GetEnv("BEARER_TOKEN", "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJwdWJsaWNLZXkiOiIweDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAiLCJzZXJ2aWNlIjp0cnVlLCJpc3MiOiJldGgtY3VzdG9kaWFsLTYzMDFkZjgiLCJzdWIiOiJhbGZham9yZXMtdGVzdCIsImV4cCI6MTc2Mjk0OTY5OCwiaWF0IjoxNzMxNDEzNjk4fQ.K5COKDKPKA8KwaA-jWFUJEPdS767pXlZhl1MX7pEzFplLYWIkr_w1oOz7bvOSxTWnOLpaaCOMTzBSiobnNdKCw") + BearerToken = env.GetEnv("BEARER_TOKEN", "") _, err = url.Parse(custodialURLBase) if err != nil { From 6fc99661f750eddf0266a0d19a52c51ab9a85308 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Mon, 28 Apr 2025 11:08:39 +0300 Subject: [PATCH 17/19] chore: remove extra underscore in EXTRA_SMS_BASE env identifier --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 32dc59a..61a5115 100644 --- a/config/config.go +++ b/config/config.go @@ -50,7 +50,7 @@ func setBase() error { custodialURLBase = env.GetEnv("CUSTODIAL_URL_BASE", "http://localhost:5003") dataURLBase = env.GetEnv("DATA_URL_BASE", "http://localhost:5006") aliasEnsURLBase = env.GetEnv("ALIAS_ENS_BASE", "http://localhost:5015") - externalSMSBase = env.GetEnv("EXTRA_SMS__BASE", "http://localhost:5035") + externalSMSBase = env.GetEnv("EXTRA_SMS_BASE", "http://localhost:5035") BearerToken = env.GetEnv("BEARER_TOKEN", "") _, err = url.Parse(custodialURLBase) From ed416c57c7cfd3d786763ebf386a3e0804a21913 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Mon, 28 Apr 2025 11:15:11 +0300 Subject: [PATCH 18/19] chore: rename EXTRA_SMS_BASE to EXTERNAL_SMS_BASE --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 61a5115..1a44d2a 100644 --- a/config/config.go +++ b/config/config.go @@ -50,7 +50,7 @@ func setBase() error { custodialURLBase = env.GetEnv("CUSTODIAL_URL_BASE", "http://localhost:5003") dataURLBase = env.GetEnv("DATA_URL_BASE", "http://localhost:5006") aliasEnsURLBase = env.GetEnv("ALIAS_ENS_BASE", "http://localhost:5015") - externalSMSBase = env.GetEnv("EXTRA_SMS_BASE", "http://localhost:5035") + externalSMSBase = env.GetEnv("EXTERNAL_SMS_BASE", "http://localhost:5035") BearerToken = env.GetEnv("BEARER_TOKEN", "") _, err = url.Parse(custodialURLBase) From 341901ec83e2d4391a87727af5615b35be3096e9 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Mon, 28 Apr 2025 11:26:13 +0300 Subject: [PATCH 19/19] match new external sms endpoint --- remote/http/service.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remote/http/service.go b/remote/http/service.go index 64b5259..3810af3 100644 --- a/remote/http/service.go +++ b/remote/http/service.go @@ -345,7 +345,7 @@ func (as *HTTPAccountService) SendUpsellSMS(ctx context.Context, inviterPhone, i } func (as *HTTPAccountService) SendAddressSMS(ctx context.Context, publicKey, originPhone string) error { - ep, err := url.JoinPath(config.ExtraSMSURL, "address") + ep, err := url.JoinPath(config.ExternalSMSURL, "address") if err != nil { return err } @@ -370,7 +370,7 @@ func (as *HTTPAccountService) SendAddressSMS(ctx context.Context, publicKey, ori } func (as *HTTPAccountService) SendPINResetSMS(ctx context.Context, admin, phone string) error { - ep, err := url.JoinPath(config.ExtraSMSURL, "pinreset") + ep, err := url.JoinPath(config.ExternalSMSURL, "pinreset") if err != nil { return err }