Compare commits
No commits in common. "be6c0d6afbe764a42ab07679c2746ef071fc09b3" and "7ba5815375a3e54b19bf16e03f9a3b90f5671a6a" have entirely different histories.
be6c0d6afb
...
7ba5815375
60
cmd/main.go
60
cmd/main.go
@ -23,7 +23,6 @@ const (
|
||||
USERFLAG_ACCOUNT_CREATED
|
||||
USERFLAG_ACCOUNT_PENDING
|
||||
USERFLAG_ACCOUNT_SUCCESS
|
||||
USERFLAG_ACCOUNT_UNLOCKED
|
||||
)
|
||||
|
||||
const (
|
||||
@ -55,7 +54,6 @@ type trackStatusResponse struct {
|
||||
|
||||
type fsData struct {
|
||||
path string
|
||||
st *state.State
|
||||
}
|
||||
|
||||
func (fsd *fsData) SetLanguageSelected(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
@ -85,24 +83,12 @@ func (fsd *fsData) create_account(ctx context.Context, sym string, input []byte)
|
||||
}
|
||||
f.Close()
|
||||
|
||||
// accountResp, err := createAccount()
|
||||
accountResp, err := createAccount()
|
||||
|
||||
// if err != nil {
|
||||
// fmt.Println("Failed to create account:", err)
|
||||
// return res, err
|
||||
// }
|
||||
|
||||
accountResp := accountResponse{
|
||||
Ok: true,
|
||||
Result: struct {
|
||||
CustodialId json.Number `json:"custodialId"`
|
||||
PublicKey string `json:"publicKey"`
|
||||
TrackingId string `json:"trackingId"`
|
||||
}{
|
||||
CustodialId: "636",
|
||||
PublicKey: "0x8d86F9D4A4eae41Dc3B68034895EA97BcA90e8c1",
|
||||
TrackingId: "45c67314-7995-4890-89d6-e5af987754ac",
|
||||
}}
|
||||
if err != nil {
|
||||
fmt.Println("Failed to create account:", err)
|
||||
return res, err
|
||||
}
|
||||
|
||||
accountData := map[string]string{
|
||||
"TrackingId": accountResp.Result.TrackingId,
|
||||
@ -145,18 +131,6 @@ func (fsd *fsData) checkIdentifier(ctx context.Context, sym string, input []byte
|
||||
return res, nil
|
||||
}
|
||||
|
||||
|
||||
func (fsd *fsData) unlock(ctx context.Context,sym string,input []byte) (resource.Result,error){
|
||||
res := resource.Result{}
|
||||
//res.FlagSet = []uint32{USERFLAG_ACCOUNT_UNLOCKED}
|
||||
if fsd.st.MatchFlag(USERFLAG_ACCOUNT_UNLOCKED, false) {
|
||||
res.FlagSet = append(res.FlagSet, USERFLAG_ACCOUNT_UNLOCKED)
|
||||
} else {
|
||||
res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
|
||||
}
|
||||
return res,nil
|
||||
}
|
||||
|
||||
func (fsd *fsData) check_account_status(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
res := resource.Result{}
|
||||
fp := fsd.path + "_data"
|
||||
@ -182,15 +156,13 @@ func (fsd *fsData) check_account_status(ctx context.Context, sym string, input [
|
||||
accountData["Status"] = status
|
||||
|
||||
if status == "SUCCESS" {
|
||||
res.FlagSet = append(res.FlagSet, USERFLAG_ACCOUNT_SUCCESS)
|
||||
res.FlagReset = append(res.FlagReset,USERFLAG_ACCOUNT_PENDING)
|
||||
res.FlagSet = []uint32{USERFLAG_ACCOUNT_SUCCESS}
|
||||
res.FlagReset = []uint32{USERFLAG_ACCOUNT_PENDING}
|
||||
} else {
|
||||
res.FlagReset = append(res.FlagSet, USERFLAG_ACCOUNT_SUCCESS)
|
||||
res.FlagSet = append(res.FlagReset,USERFLAG_ACCOUNT_PENDING)
|
||||
res.FlagSet = []uint32{USERFLAG_ACCOUNT_PENDING}
|
||||
res.FlagReset = []uint32{USERFLAG_ACCOUNT_SUCCESS}
|
||||
}
|
||||
|
||||
|
||||
|
||||
updatedJsonData, err := json.Marshal(accountData)
|
||||
if err != nil {
|
||||
return res, err
|
||||
@ -249,17 +221,9 @@ func checkAccountStatus(trackingId string) (string, error) {
|
||||
}
|
||||
|
||||
func (fsd *fsData) quit(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
res := resource.Result{
|
||||
return resource.Result{
|
||||
Content: "",
|
||||
}
|
||||
st := fsd.st
|
||||
if(st.MatchFlag(USERFLAG_ACCOUNT_UNLOCKED,true)){
|
||||
//res.FlagReset = []uint32{USERFLAG_ACCOUNT_UNLOCKED}
|
||||
// res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
|
||||
}else {
|
||||
res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
|
||||
}
|
||||
return res, nil
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@ -319,13 +283,11 @@ func main() {
|
||||
fp := path.Join(dp, sessionId)
|
||||
fs := &fsData{
|
||||
path: fp,
|
||||
st: &st,
|
||||
}
|
||||
rfs.AddLocalFunc("select_language", fs.SetLanguageSelected)
|
||||
rfs.AddLocalFunc("create_account", fs.create_account)
|
||||
rfs.AddLocalFunc("check_identifier", fs.checkIdentifier)
|
||||
rfs.AddLocalFunc("check_account_status", fs.check_account_status)
|
||||
rfs.AddLocalFunc("unlock_account", fs.unlock)
|
||||
rfs.AddLocalFunc("quit",fs.quit)
|
||||
|
||||
cont, err := en.Init(ctx)
|
||||
|
2
services/registration/profile
Normal file
2
services/registration/profile
Normal file
@ -0,0 +1,2 @@
|
||||
Balance: 0.00 SRF
|
||||
|
9
services/registration/profile.vis
Normal file
9
services/registration/profile.vis
Normal file
@ -0,0 +1,9 @@
|
||||
LOAD check_identifier 64
|
||||
RELOAD check_identifier
|
||||
MAP check_identifier
|
||||
MOUT send 1
|
||||
MOUT vouchers 2
|
||||
MOUT account 3
|
||||
MOUT help 4
|
||||
HALT
|
||||
|
1
services/registration/profile_swa
Normal file
1
services/registration/profile_swa
Normal file
@ -0,0 +1 @@
|
||||
Salio: 0.00 SRF
|
Loading…
Reference in New Issue
Block a user