Compare commits
No commits in common. "5f3baa86aef2d29747441df540b9666c9393efac" and "cb31616a8710ad8c58af7a96284ef43af0600e74" have entirely different histories.
5f3baa86ae
...
cb31616a87
@ -9,9 +9,6 @@ import (
|
|||||||
"git.grassecon.net/urdt/ussd/internal/models"
|
"git.grassecon.net/urdt/ussd/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CheckBalance retrieves the balance for a given public key from the custodial balance API endpoint.
|
|
||||||
// Parameters:
|
|
||||||
// - publicKey: The public key associated with the account whose balance needs to be checked.
|
|
||||||
func CheckBalance(publicKey string) (string, error) {
|
func CheckBalance(publicKey string) (string, error) {
|
||||||
|
|
||||||
resp, err := http.Get(config.BalanceURL + publicKey)
|
resp, err := http.Get(config.BalanceURL + publicKey)
|
||||||
|
@ -9,12 +9,7 @@ import (
|
|||||||
"git.grassecon.net/urdt/ussd/internal/models"
|
"git.grassecon.net/urdt/ussd/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
//CreateAccount creates a new account in the custodial system.
|
|
||||||
// Returns:
|
|
||||||
// - *models.AccountResponse: A pointer to an AccountResponse struct containing the details of the created account.
|
|
||||||
// If there is an error during the request or processing, this will be nil.
|
|
||||||
// - error: An error if any occurred during the HTTP request, reading the response, or unmarshalling the JSON data.
|
|
||||||
// If no error occurs, this will be nil.
|
|
||||||
func CreateAccount() (*models.AccountResponse, error) {
|
func CreateAccount() (*models.AccountResponse, error) {
|
||||||
resp, err := http.Post(config.CreateAccountURL, "application/json", nil)
|
resp, err := http.Post(config.CreateAccountURL, "application/json", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -13,8 +13,8 @@ import (
|
|||||||
"git.defalsify.org/vise.git/lang"
|
"git.defalsify.org/vise.git/lang"
|
||||||
"git.defalsify.org/vise.git/resource"
|
"git.defalsify.org/vise.git/resource"
|
||||||
"git.defalsify.org/vise.git/state"
|
"git.defalsify.org/vise.git/state"
|
||||||
"git.grassecon.net/urdt/ussd/internal/handlers/server"
|
|
||||||
"git.grassecon.net/urdt/ussd/internal/models"
|
"git.grassecon.net/urdt/ussd/internal/models"
|
||||||
|
"git.grassecon.net/urdt/ussd/internal/handlers/server"
|
||||||
"git.grassecon.net/urdt/ussd/internal/utils"
|
"git.grassecon.net/urdt/ussd/internal/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -426,6 +426,8 @@ func (h *Handlers) CheckAccountStatus(ctx context.Context, sym string, input []b
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//status, err := checkAccountStatus(accountData["TrackingId"])
|
||||||
status, err := server.CheckAccountStatus(accountData["TrackingId"])
|
status, err := server.CheckAccountStatus(accountData["TrackingId"])
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -2,8 +2,7 @@ package utils
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
// CalculateAge calculates the age based on a given birthdate and the current date in the format dd/mm/yy
|
|
||||||
// It adjusts for cases where the current date is before the birthday in the current year.
|
|
||||||
func CalculateAge(birthdate, today time.Time) int {
|
func CalculateAge(birthdate, today time.Time) int {
|
||||||
today = today.In(birthdate.Location())
|
today = today.In(birthdate.Location())
|
||||||
ty, tm, td := today.Date()
|
ty, tm, td := today.Date()
|
||||||
|
Loading…
Reference in New Issue
Block a user