menu-voucherlist #101

Merged
lash merged 63 commits from menu-voucherlist into master 2024-10-25 15:59:47 +02:00
Member
  • Adds the My vouchers menu option with a vouchers pagination
  • Updated the PIN creation on registration to use the temporary PIN before writing to the account PIN
  • Adds a function to call the vouchers endpoint. Currently using mock data ahead of the actual endpoint
  • Stores the vouchers and balances using the subprefix
  • Display the balance based on the active voucher
  • Validate the amount in the Send node based on the active symbol balance
- Adds the My vouchers menu option with a vouchers pagination - Updated the PIN creation on registration to use the temporary PIN before writing to the account PIN - Adds a function to call the vouchers endpoint. Currently using mock data ahead of the actual endpoint - Stores the vouchers and balances using the subprefix - Display the balance based on the active voucher - Validate the amount in the Send node based on the active symbol balance
Alfred-mk added 6 commits 2024-09-27 18:13:58 +02:00
Alfred-mk added 1 commit 2024-09-28 10:07:57 +02:00
Alfred-mk added 1 commit 2024-09-28 11:27:01 +02:00
Alfred-mk added 1 commit 2024-09-28 13:08:00 +02:00
Alfred-mk added 1 commit 2024-10-05 15:57:18 +02:00
Alfred-mk added 4 commits 2024-10-07 07:35:04 +02:00
Alfred-mk added 1 commit 2024-10-07 07:59:41 +02:00
Alfred-mk added 1 commit 2024-10-07 12:49:34 +02:00
Alfred-mk added 2 commits 2024-10-07 15:17:16 +02:00
Alfred-mk requested review from lash 2024-10-07 23:13:20 +02:00
Alfred-mk changed title from WIP: menu-voucherlist to menu-voucherlist 2024-10-07 23:13:25 +02:00
carlos added 4 commits 2024-10-08 13:34:40 +02:00
Alfred-mk added 1 commit 2024-10-09 14:06:26 +02:00
Alfred-mk added 2 commits 2024-10-09 14:39:20 +02:00
Alfred-mk added 5 commits 2024-10-11 08:42:31 +02:00
Alfred-mk added 3 commits 2024-10-12 15:29:31 +02:00
Alfred-mk added 2 commits 2024-10-12 17:06:10 +02:00
Alfred-mk added 2 commits 2024-10-12 19:07:18 +02:00
lash requested changes 2024-10-14 14:38:52 +02:00
@ -113,0 +110,4 @@
// FetchVouchers retrieves the token holdings for a given public key from the custodial holdings API endpoint
// Parameters:
// - publicKey: The public key associated with the account.
func (as *AccountService) FetchVouchers(publicKey string) (*models.VoucherHoldingResponse, error) {
Owner

Is this in use? Looks like test code?

Is this in use? Looks like test code?
@ -654,2 +640,3 @@
balance, err := h.accountService.CheckBalance(string(publicKey))
// check if the user has an active sym
activeSym, err := store.ReadEntry(ctx, sessionId, utils.DATA_ACTIVE_SYM)
Owner

If no active sym then the user has no vouchers yet, and then no balance should be displayed, I think?

If no active sym then the user has no vouchers yet, and then no balance should be displayed, I think?
Author
Member

For this, I've added a function that sets the default voucher, (expecting it to be SRF) if no active voucher is set for the user.

This will be loaded on the main.vis, ensuring that one has the default sym if they haven't set their own

For this, I've added a function that sets the default voucher, (expecting it to be SRF) if no active voucher is set for the user. This will be loaded on the main.vis, ensuring that one has the default sym if they haven't set their own
Alfred-mk marked this conversation as resolved
@ -803,0 +793,4 @@
if err != nil {
return res, fmt.Errorf("failed to parse active balance: %v", err)
}
} else {
Owner

Same here, if there is no symbol there is no balance.

Same here, if there is no symbol there is no balance.
Alfred-mk marked this conversation as resolved
@ -1002,1 +1005,4 @@
}
// CheckVouchers retrieves the token holdings from the API using the "PublicKey" and stores
// them to gdbm
Owner

s/gdbm/db/

s/gdbm/db/
@ -1003,0 +1027,4 @@
var numberedSymbols []string
var numberedBalances []string
for i, voucher := range vouchersResp.Result.Holdings {
Owner

Can we put this in a separate method please (that can be unit-tested with data only)

Can we put this in a separate method please (that can be unit-tested with data only)
Alfred-mk marked this conversation as resolved
@ -1003,0 +1082,4 @@
inputStr := string(input)
if inputStr == "0" || inputStr == "99" {
Owner

Now this is code smell; we don't want to use menu selectors in branching here.

But I assume it is done because it is necessary to determine whether we are selecting token or merely navigating laterally? If that is the case, I will make an issue for go-vise to provide whether lateral is indeed the case.

Now this is code smell; we don't want to use menu selectors in branching here. But I assume it is done because it is necessary to determine whether we are selecting token or merely navigating laterally? If that is the case, I will make an issue for go-vise to provide whether lateral is indeed the case.
Author
Member

This was added because the vise runs the function when we're navigating, instead of prioritizing the INCMP and navigate to the specified node

This was added because the vise runs the function when we're navigating, instead of prioritizing the INCMP and navigate to the specified node
lash marked this conversation as resolved
@ -1003,0 +1102,4 @@
}
// Convert the symbol and balance lists from byte arrays to strings
voucherSymbols := string(voucherSymbolList)
Owner

Please put in separate, unit-testable method.

Please put in separate, unit-testable method.
Alfred-mk marked this conversation as resolved
@ -172,3 +172,3 @@
}
func TestSavePin(t *testing.T) {
func TestSaveTemporaryPIn(t *testing.T) {
Owner

CAps

CAps
Alfred-mk marked this conversation as resolved
@ -0,0 +1,18 @@
package models
type ApiResponse struct {
Owner

These should be gotten from the api provider go code instead, #106

Since we are introducing new ones here, may as well go directly to the source.

These should be gotten from the api provider go code instead, https://git.grassecon.net/urdt/ussd/issues/106 Since we are introducing new ones here, may as well go directly to the source.
Alfred-mk added 2 commits 2024-10-15 14:46:29 +02:00
Alfred-mk added 1 commit 2024-10-15 14:55:02 +02:00
Alfred-mk added 1 commit 2024-10-15 15:17:40 +02:00
Alfred-mk added 1 commit 2024-10-15 15:30:00 +02:00
Alfred-mk added 1 commit 2024-10-15 16:03:03 +02:00
Alfred-mk added 1 commit 2024-10-15 16:09:24 +02:00
Alfred-mk added 2 commits 2024-10-17 12:50:07 +02:00
Alfred-mk added a new dependency 2024-10-18 09:31:13 +02:00
Alfred-mk changed title from menu-voucherlist to WIP: menu-voucherlist 2024-10-18 11:55:17 +02:00
Alfred-mk added a new dependency 2024-10-18 12:10:29 +02:00
Alfred-mk added 1 commit 2024-10-18 17:32:13 +02:00
Alfred-mk added 2 commits 2024-10-19 15:07:47 +02:00
Alfred-mk added 2 commits 2024-10-21 16:15:23 +02:00
Alfred-mk added 1 commit 2024-10-22 13:28:12 +02:00
Owner

will resolve #114

will resolve https://git.grassecon.net/urdt/ussd/issues/114
Alfred-mk added 1 commit 2024-10-22 16:08:34 +02:00
Alfred-mk added 1 commit 2024-10-22 16:11:07 +02:00
Alfred-mk changed title from WIP: menu-voucherlist to menu-voucherlist 2024-10-22 21:40:46 +02:00
lash requested changes 2024-10-23 01:54:25 +02:00
@ -655,2 +641,3 @@
activeSym, err := store.ReadEntry(ctx, sessionId, utils.DATA_ACTIVE_SYM)
if err != nil {
return res, err
res.Content = "0.00"
Owner

Why should it be 0.00 when error?

Why should it be 0.00 when error?
Author
Member

The 0.00 is a placeholder. I set it like this without a symbol since the error indicates no symbol exists.

I have updated this to check the specific db error

The 0.00 is a placeholder. I set it like this without a symbol since the error indicates no symbol exists. I have updated this to check the specific db error
lash marked this conversation as resolved
@ -1048,0 +1000,4 @@
if err != nil {
if db.IsNotFound(err) {
publicKey, err := store.ReadEntry(ctx, sessionId, utils.DATA_PUBLIC_KEY)
Owner

space

space
Author
Member

Kindly expound on this

Kindly expound on this
Alfred-mk marked this conversation as resolved
@ -1048,0 +1108,4 @@
// Read vouchers from the store
store := h.userdataStore
prefixdb := storage.NewSubPrefixDb(store, []byte("pfx"))
Owner

Not a very descriptive prefix?

Not a very descriptive prefix?
Alfred-mk marked this conversation as resolved
Alfred-mk added 1 commit 2024-10-23 05:35:23 +02:00
Alfred-mk added 2 commits 2024-10-23 13:02:42 +02:00
Alfred-mk added 1 commit 2024-10-23 16:45:46 +02:00
Alfred-mk changed title from menu-voucherlist to WIP: menu-voucherlist 2024-10-24 15:24:11 +02:00
Alfred-mk added 1 commit 2024-10-24 15:26:58 +02:00
Alfred-mk added 1 commit 2024-10-24 15:30:51 +02:00
Alfred-mk added 1 commit 2024-10-24 15:32:26 +02:00
Alfred-mk added 1 commit 2024-10-24 16:50:43 +02:00
Alfred-mk added 1 commit 2024-10-24 17:16:02 +02:00
Alfred-mk added 1 commit 2024-10-24 19:21:37 +02:00
Alfred-mk added 1 commit 2024-10-24 19:39:52 +02:00
Alfred-mk added 1 commit 2024-10-24 19:44:36 +02:00
Alfred-mk changed title from WIP: menu-voucherlist to menu-voucherlist 2024-10-24 19:45:47 +02:00
lash removed a dependency 2024-10-25 15:59:38 +02:00
lash merged commit 2dee47404d into master 2024-10-25 15:59:47 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Depends on
Reference: urdt/ussd#101
No description provided.