wip-account-creation #4
32
cmd/main.go
32
cmd/main.go
@ -300,18 +300,7 @@ func (fsd *fsData) create_account(ctx context.Context, sym string, input []byte)
|
||||
}
|
||||
f.Close()
|
||||
|
||||
//accountResp, err := createAccount()
|
||||
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",
|
||||
}}
|
||||
accountResp, err := createAccount()
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Failed to create account:", err)
|
||||
@ -373,8 +362,21 @@ func (fsd *fsData) checkIdentifier(ctx context.Context, sym string, input []byte
|
||||
func (fsd *fsData) unLock(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||
res := resource.Result{}
|
||||
pin := string(input)
|
||||
if len(input) > 0 {
|
||||
if pin == "0000" {
|
||||
fp := fsd.path + "_data"
|
||||
|
||||
jsonData, err := os.ReadFile(fp)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
var accountData map[string]string
|
||||
err = json.Unmarshal(jsonData, &accountData)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
if len(input) > 1 {
|
||||
if pin != accountData["AccountPIN"] {
|
||||
res.FlagSet = append(res.FlagSet, USERFLAG_INCORRECTPIN)
|
||||
res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
|
||||
return res, nil
|
||||
@ -428,7 +430,7 @@ func (fsd *fsData) check_account_status(ctx context.Context, sym string, input [
|
||||
|
||||
accountData["Status"] = status
|
||||
|
||||
if status == "REVERTED" {
|
||||
if status == "SUCCESS" {
|
||||
res.FlagSet = append(res.FlagSet, USERFLAG_ACCOUNT_SUCCESS)
|
||||
res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_PENDING)
|
||||
} else {
|
||||
|
@ -3,4 +3,3 @@ RELOAD check_identifier
|
||||
MAP check_identifier
|
||||
HALT
|
||||
MOVE quit
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
LOAD reset_transaction_amount 0
|
||||
RELOAD validate_recipient
|
||||
CATCH invalid_recipient 13 1
|
||||
LOAD max_amount 10
|
||||
MAP max_amount
|
||||
MOUT back 0
|
||||
HALT
|
||||
INCMP _ 0
|
||||
LOAD validate_amount 64
|
||||
RELOAD validate_amount
|
||||
CATCH invalid_amount 17 1
|
||||
INCMP _ 0
|
||||
LOAD get_recipient 12
|
||||
LOAD get_sender 64
|
||||
INCMP transaction_pin *
|
||||
|
@ -6,4 +6,3 @@ HALT
|
||||
INCMP _ 0
|
||||
INCMP my_balance 1
|
||||
INCMP community_balance 2
|
||||
|
||||
|
@ -3,4 +3,3 @@ CATCH incorrect_pin 15 1
|
||||
CATCH pin_entry 12 0
|
||||
LOAD quit_with_balance 0
|
||||
HALT
|
||||
|
||||
|
@ -14,6 +14,3 @@ INCMP select_gender 2
|
||||
INCMP enter_yob 3
|
||||
INCMP enter_loca 4
|
||||
INCMP view_profile 6
|
||||
|
||||
|
||||
|
||||
|
@ -3,4 +3,3 @@ MOUT back 0
|
||||
HALT
|
||||
INCMP _ 0
|
||||
INCMP select_gender *
|
||||
|
||||
|
||||
|
8
services/registration/enter_offerings.vis
Normal file
8
services/registration/enter_offerings.vis
Normal file
@ -0,0 +1,8 @@
|
||||
LOAD save_location 0
|
||||
CATCH incorrect_pin 15 1
|
||||
CATCH update_success 16 1
|
||||
MOUT back 0
|
||||
HALT
|
||||
LOAD save_offerings 0
|
||||
INCMP _ 0
|
||||
INCMP pin_entry *
|
@ -3,5 +3,5 @@ RELOAD reset_transaction_amount
|
||||
MOUT retry 1
|
||||
MOUT quit 9
|
||||
HALT
|
||||
INCMP amount 1
|
||||
INCMP _ 1
|
||||
INCMP quit 9
|
||||
|
@ -3,5 +3,5 @@ RELOAD transaction_reset
|
||||
MOUT retry 1
|
||||
MOUT quit 9
|
||||
HALT
|
||||
INCMP send 1
|
||||
INCMP _ 1
|
||||
INCMP quit 9
|
||||
|
@ -12,4 +12,3 @@ INCMP edit_profile 1
|
||||
INCMP balances 3
|
||||
INCMP pin_management 5
|
||||
INCMP address 6
|
||||
|
||||
|
@ -3,4 +3,3 @@ CATCH incorrect_pin 15 1
|
||||
CATCH pin_entry 12 0
|
||||
LOAD quit_with_balance 0
|
||||
HALT
|
||||
|
||||
|
@ -2,5 +2,7 @@ LOAD transaction_reset 0
|
||||
MOUT back 0
|
||||
HALT
|
||||
LOAD validate_recipient 20
|
||||
RELOAD validate_recipient
|
||||
CATCH invalid_recipient 13 1
|
||||
INCMP _ 0
|
||||
INCMP amount *
|
||||
|
@ -1,6 +1,4 @@
|
||||
RELOAD validate_amount
|
||||
MAP validate_amount
|
||||
CATCH invalid_amount 17 1
|
||||
RELOAD get_recipient
|
||||
MAP get_recipient
|
||||
RELOAD get_sender
|
||||
|
Loading…
Reference in New Issue
Block a user
See https://git.grassecon.net/urdt/ussd/pulls/4/files#issuecomment-1194
No matter where you start in the menu, you always go ahead to the end.
Again, if this is how current USSD behaves, we can keep this for now. But we should add a nice-to-have task to change that behavior to only edit full profile when not already edited.