Compare commits

...

24 Commits

Author SHA1 Message Date
alfred-mk
f32f93dff2 retain the original amount and use it for the transfer once the swap is performed 2026-02-18 13:15:41 +03:00
alfred-mk
5ee99cdcd8 convert the user input to uppercase before calling the pool Details API 2026-02-18 12:42:25 +03:00
alfred-mk
6abcb97f3a multiply the final amount by 1.015 to slightly increase the swapped amount 2026-02-18 12:27:22 +03:00
b908dc1881 Merge pull request 'have-single-send-node' (#113) from have-single-send-node into master
Reviewed-on: #113
2026-01-22 14:22:20 +01:00
Alfred Kamanda
523f680276 append the flag_swap_transaction once all checks pass
Some checks failed
release / docker (push) Has been cancelled
2026-01-15 11:25:02 +03:00
Alfred Kamanda
b337c9260b add a debug statement 2026-01-15 11:17:41 +03:00
Alfred Kamanda
c380915100 remove misplaced CATCH on the api_error flag 2026-01-15 10:56:52 +03:00
Alfred Kamanda
7d8fd065f0 default to a normal send if an error occurs on calculateSendCreditLimits 2026-01-15 10:56:20 +03:00
Alfred Kamanda
40292ebcdd removed unused send node specific files
Some checks failed
release / docker (push) Has been cancelled
2026-01-13 12:52:10 +03:00
Alfred Kamanda
4edcdfa987 change the order to only have Send 2026-01-13 12:46:34 +03:00
Alfred Kamanda
a56f94896d add a RELOAD for the reset_transaction_amount 2026-01-13 12:46:13 +03:00
Alfred Kamanda
a447f230ca refactor the code to handle credit send or normal transactions 2026-01-13 12:45:27 +03:00
Alfred Kamanda
65badc4ccc ignore the generated vise-asm file 2026-01-13 11:09:13 +03:00
89d3d19d77 Merge pull request 'use the ResetRoot config to clear the cache once a user quits' (#112) from cache-error-fix into master
Reviewed-on: #112
2025-12-09 10:29:37 +01:00
Alfred Kamanda
817b523135 Merge branch 'master' into cache-error-fix
Some checks failed
release / docker (push) Has been cancelled
2025-12-08 17:43:21 +03:00
e0e3d9b6cf Merge pull request 'mpesa-onramp-offramp' (#110) from mpesa-onramp-offramp into master
Reviewed-on: #110
2025-12-08 15:41:23 +01:00
Alfred Kamanda
2cabae1e74 use the ResetRoot config to clear the cache once a user quits
Some checks are pending
release / docker (push) Waiting to run
2025-12-08 17:29:13 +03:00
Alfred Kamanda
f949b83a51 change the go-vise source
Some checks failed
release / docker (push) Has been cancelled
2025-12-03 13:40:32 +03:00
Alfred Kamanda
d586c41cca add sleep for 1 second between requests
Some checks failed
release / docker (push) Has been cancelled
2025-12-03 13:12:24 +03:00
Alfred Kamanda
518baceee5 update the translations to add the approximation sign ~
Some checks failed
release / docker (push) Has been cancelled
2025-12-02 12:28:55 +03:00
Alfred Kamanda
1cb82e9099 call the mpesa rates API to get the rates 2025-12-02 12:28:28 +03:00
Alfred Kamanda
efc93397b2 use the updated sarafu-api 2025-12-02 12:26:52 +03:00
Alfred Kamanda
5b19b3409b remove the mpesa rates configs 2025-12-02 12:26:36 +03:00
Alfred Kamanda
2db97cde81 remove the hard-coded rates 2025-12-02 12:26:13 +03:00
20 changed files with 133 additions and 111 deletions

View File

@@ -32,10 +32,8 @@ INCLUDE_STABLES_PARAM=false
#Mpesa
DEFAULT_MPESA_ADDRESS=0x48a953cA5cf5298bc6f6Af3C608351f537AAcb9e
MPESA_RATE=129.5
MIN_MPESA_SEND_AMOUNT=100
MAX_MPESA_SEND_AMOUNT=250000
MPESA_SEND_RATE=130.2
DEFAULT_MPESA_ASSET=cUSD
MPESA_BEARER_TOKEN=eyJeSIsInRcCI6IkpXVCJ.yJwdWJsaWNLZXkiOiIwrrrrrr
MPESA_ONRAMP_BASE=https://pretium.v1.grassecon.net

1
.gitignore vendored
View File

@@ -8,3 +8,4 @@ id_*
*.gdbm
*.log
user-data
**/*/vise-asm

View File

@@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libgdbm-dev \
git \
&& rm -rf /var/lib/apt/lists/*
RUN git clone https://git.defalsify.org/vise.git go-vise
RUN git clone https://github.com/nolash/go-vise go-vise
COPY . ./sarafu-vise
WORKDIR /build/sarafu-vise/services/registration

View File

@@ -79,11 +79,12 @@ func main() {
pfp := path.Join(scriptDir, "pp.csv")
cfg := engine.Config{
Root: "root",
OutputSize: uint32(size),
FlagCount: uint32(128),
MenuSeparator: menuSeparator,
Root: "root",
OutputSize: uint32(size),
FlagCount: uint32(128),
MenuSeparator: menuSeparator,
ResetOnEmptyInput: true,
ResetRoot: true, // clear the cache once a user quits
}
if engineDebug {

View File

@@ -94,11 +94,12 @@ func main() {
pfp := path.Join(scriptDir, "pp.csv")
cfg := engine.Config{
Root: "root",
OutputSize: uint32(size),
FlagCount: uint32(128),
MenuSeparator: menuSeparator,
Root: "root",
OutputSize: uint32(size),
FlagCount: uint32(128),
MenuSeparator: menuSeparator,
ResetOnEmptyInput: true,
ResetRoot: true, // clear the cache once a user quits
}
if engineDebug {

View File

@@ -82,6 +82,7 @@ func main() {
MenuSeparator: menuSeparator,
EngineDebug: engineDebug,
ResetOnEmptyInput: true,
ResetRoot: true, // clear the cache once a user quits
}
menuStorageService := storage.NewMenuStorageService(conns)

View File

@@ -93,15 +93,6 @@ func DefaultMpesaAddress() string {
return env.GetEnv("DEFAULT_MPESA_ADDRESS", "")
}
func MpesaRate() float64 {
v := env.GetEnv("MPESA_RATE", "129.5")
f, err := strconv.ParseFloat(v, 64)
if err != nil {
return 129.5 // fallback default
}
return f
}
func MinMpesaSendAmount() float64 {
v := env.GetEnv("MIN_MPESA_SEND_AMOUNT", "100")
f, err := strconv.ParseFloat(v, 64)
@@ -120,15 +111,6 @@ func MaxMpesaSendAmount() float64 {
return f
}
func MpesaSendRate() float64 {
v := env.GetEnv("MPESA_SEND_RATE", "130.2")
f, err := strconv.ParseFloat(v, 64)
if err != nil {
return 130.2 // fallback default
}
return f
}
func DefaultMpesaAsset() string {
return env.GetEnv("DEFAULT_MPESA_ASSET", "")
}

2
go.mod
View File

@@ -7,7 +7,7 @@ toolchain go1.24.10
require (
git.defalsify.org/vise.git v0.3.2-0.20250528124150-03bf7bfc1b66
git.grassecon.net/grassrootseconomics/common v0.9.0-beta.1.0.20251127132814-8ceadabbc215
git.grassecon.net/grassrootseconomics/sarafu-api v0.9.0-beta.1.0.20251128071248-bfdeef125576
git.grassecon.net/grassrootseconomics/sarafu-api v0.9.0-beta.1.0.20251202085112-45469d4ba326
git.grassecon.net/grassrootseconomics/visedriver v0.9.0-beta.2.0.20250408094335-e2d1f65bb306
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250129070628-5a539172c694
github.com/alecthomas/assert/v2 v2.2.2

2
go.sum
View File

@@ -4,6 +4,8 @@ git.grassecon.net/grassrootseconomics/common v0.9.0-beta.1.0.20251127132814-8cea
git.grassecon.net/grassrootseconomics/common v0.9.0-beta.1.0.20251127132814-8ceadabbc215/go.mod h1:wgQJZGIS6QuNLHqDhcsvehsbn5PvgV7aziRebMnJi60=
git.grassecon.net/grassrootseconomics/sarafu-api v0.9.0-beta.1.0.20251128071248-bfdeef125576 h1:Ov4zENfEnzuU4ZpsNGbFjog9NUM0h1A7RYwWkmHRJWo=
git.grassecon.net/grassrootseconomics/sarafu-api v0.9.0-beta.1.0.20251128071248-bfdeef125576/go.mod h1:h/y/lJNJAVTcIzAxCMXXw8Dh2aoLxBFZ6F1nTB8C0nU=
git.grassecon.net/grassrootseconomics/sarafu-api v0.9.0-beta.1.0.20251202085112-45469d4ba326 h1:qH4QulgncvAD7b/YeHGPxcDJTBIychPeoZJACefYryI=
git.grassecon.net/grassrootseconomics/sarafu-api v0.9.0-beta.1.0.20251202085112-45469d4ba326/go.mod h1:h/y/lJNJAVTcIzAxCMXXw8Dh2aoLxBFZ6F1nTB8C0nU=
git.grassecon.net/grassrootseconomics/visedriver v0.9.0-beta.2.0.20250408094335-e2d1f65bb306 h1:Jo+yWysWw/N5BJQtAyEMN8ePVvAyPHv+JG4lQti+1N4=
git.grassecon.net/grassrootseconomics/visedriver v0.9.0-beta.2.0.20250408094335-e2d1f65bb306/go.mod h1:FdLwYtzsjOIcDiW4uDgDYnB4Wdzq12uJUe0QHSSPbSo=
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250129070628-5a539172c694 h1:DjJlBSz0S13acft5XZDWk7ZYnzElym0xLMYEVgyNJ+E=

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"strconv"
"time"
"git.defalsify.org/vise.git/resource"
"git.grassecon.net/grassrootseconomics/common/hex"
@@ -45,7 +46,15 @@ func (h *MenuHandlers) GetMpesaMaxLimit(ctx context.Context, sym string, input [
return res, err
}
rate := config.MpesaRate()
// call the mpesa rates API to get the rates
rates, err := h.accountService.GetMpesaOnrampRates(ctx)
if err != nil {
res.FlagSet = append(res.FlagSet, flag_api_call_error)
res.Content = l.Get("Your request failed. Please try again later.")
logg.ErrorCtxf(ctx, "failed on GetMpesaOnrampRates", "error", err)
return res, nil
}
txType := "swap"
mpesaAddress := config.DefaultMpesaAddress()
@@ -84,7 +93,7 @@ func (h *MenuHandlers) GetMpesaMaxLimit(ctx context.Context, sym string, input [
}
activeFloat, _ := strconv.ParseFloat(string(activeBal), 64)
ksh := fmt.Sprintf("%f", activeFloat*rate)
ksh := fmt.Sprintf("%f", activeFloat*rates.Buy)
kshFormatted, _ := store.TruncateDecimalString(ksh, 0)
@@ -158,7 +167,7 @@ func (h *MenuHandlers) GetMpesaMaxLimit(ctx context.Context, sym string, input [
return res, err
}
maxKsh := maxFloat * rate
maxKsh := maxFloat * rates.Buy
kshStr := fmt.Sprintf("%f", maxKsh)
kshFormatted, _ := store.TruncateDecimalString(kshStr, 0)
@@ -192,7 +201,15 @@ func (h *MenuHandlers) GetMpesaPreview(ctx context.Context, sym string, input []
l.AddDomain("default")
userStore := h.userdataStore
rate := config.MpesaRate()
// call the mpesa rates API to get the rates
rates, err := h.accountService.GetMpesaOnrampRates(ctx)
if err != nil {
res.FlagSet = append(res.FlagSet, flag_api_call_error)
res.Content = l.Get("Your request failed. Please try again later.")
logg.ErrorCtxf(ctx, "failed on GetMpesaOnrampRates", "error", err)
return res, nil
}
// Input in Ksh
kshAmount, err := strconv.ParseFloat(inputStr, 64)
@@ -202,8 +219,8 @@ func (h *MenuHandlers) GetMpesaPreview(ctx context.Context, sym string, input []
return res, nil
}
// divide by the rate
inputAmount := kshAmount / rate
// divide by the buy rate
inputAmount := kshAmount / rates.Buy
// store the user's raw input amount in the temporary value
err = userStore.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(inputStr))
@@ -252,7 +269,7 @@ func (h *MenuHandlers) GetMpesaPreview(ctx context.Context, sym string, input []
}
res.Content = l.Get(
"You are sending %s %s in order to receive %s ksh",
"You are sending %s %s in order to receive ~ %s ksh",
qouteInputAmount, swapData.ActiveSwapFromSym, inputStr,
)
@@ -311,7 +328,7 @@ func (h *MenuHandlers) GetMpesaPreview(ctx context.Context, sym string, input []
qouteInputAmount, _ := store.TruncateDecimalString(quoteInputStr, 2)
res.Content = l.Get(
"You are sending %s %s in order to receive %s ksh",
"You are sending %s %s in order to receive ~ %s ksh",
qouteInputAmount, swapData.ActiveSwapFromSym, inputStr,
)
@@ -370,7 +387,7 @@ func (h *MenuHandlers) InitiateGetMpesa(ctx context.Context, sym string, input [
logg.InfoCtxf(ctx, "TokenTransfer normal", "trackingId", tokenTransfer.TrackingId)
res.Content = l.Get("Your request has been sent. You will receive %s ksh", data.TemporaryValue)
res.Content = l.Get("Your request has been sent. You will receive ~ %s ksh", data.TemporaryValue)
res.FlagReset = append(res.FlagReset, flag_account_authorized)
return res, nil
@@ -395,7 +412,10 @@ func (h *MenuHandlers) InitiateGetMpesa(ctx context.Context, sym string, input [
return res, nil
}
logg.InfoCtxf(ctx, "poolSwap", "swapTrackingId", poolSwap.TrackingId)
logg.InfoCtxf(ctx, "mpesa poolSwap before transfer", "swapTrackingId", poolSwap.TrackingId)
// TODO: remove this temporary time delay and replace with a swap and send endpoint
time.Sleep(1 * time.Second)
finalKshStr, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
if err != nil {
@@ -418,7 +438,7 @@ func (h *MenuHandlers) InitiateGetMpesa(ctx context.Context, sym string, input [
logg.InfoCtxf(ctx, "final TokenTransfer after swap", "trackingId", tokenTransfer.TrackingId)
res.Content = l.Get("Your request has been sent. You will receive %s ksh", finalKshStr)
res.Content = l.Get("Your request has been sent. You will receive ~ %s ksh", finalKshStr)
res.FlagReset = append(res.FlagReset, flag_account_authorized)
return res, nil
}
@@ -468,13 +488,22 @@ func (h *MenuHandlers) SendMpesaPreview(ctx context.Context, sym string, input [
}
flag_invalid_amount, _ := h.flagManager.GetFlag("flag_invalid_amount")
flag_api_call_error, _ := h.flagManager.GetFlag("flag_api_call_error")
code := codeFromCtx(ctx)
l := gotext.NewLocale(translationDir, code)
l.AddDomain("default")
userStore := h.userdataStore
sendRate := config.MpesaSendRate()
// call the mpesa rates API to get the rates
rates, err := h.accountService.GetMpesaOnrampRates(ctx)
if err != nil {
res.FlagSet = append(res.FlagSet, flag_api_call_error)
res.Content = l.Get("Your request failed. Please try again later.")
logg.ErrorCtxf(ctx, "failed on GetMpesaOnrampRates", "error", err)
return res, nil
}
// Input in Ksh
kshAmount, err := strconv.ParseFloat(inputStr, 64)
@@ -502,12 +531,12 @@ func (h *MenuHandlers) SendMpesaPreview(ctx context.Context, sym string, input [
return res, err
}
estimateValue := kshAmount / sendRate
estimateValue := kshAmount / rates.Sell
estimateStr := fmt.Sprintf("%f", estimateValue)
estimateFormatted, _ := store.TruncateDecimalString(estimateStr, 2)
res.Content = l.Get(
"You will get a prompt for your M-Pesa PIN shortly to send %s ksh and receive %s cUSD",
"You will get a prompt for your M-Pesa PIN shortly to send %s ksh and receive ~ %s cUSD",
inputStr, estimateFormatted,
)

View File

@@ -3,6 +3,7 @@ package application
import (
"context"
"fmt"
"strings"
"git.defalsify.org/vise.git/db"
"git.defalsify.org/vise.git/resource"
@@ -104,6 +105,7 @@ func (h *MenuHandlers) GetDefaultPool(ctx context.Context, sym string, input []b
// ViewPool retrieves the pool details from the user store
// and displays it to the user for them to select it.
// if the data does not exist, it calls the API to get the pool details
func (h *MenuHandlers) ViewPool(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result
sessionId, ok := ctx.Value("SessionId").(string)
@@ -131,8 +133,11 @@ func (h *MenuHandlers) ViewPool(ctx context.Context, sym string, input []byte) (
if poolData == nil {
flag_api_call_error, _ := h.flagManager.GetFlag("flag_api_call_error")
// convert to uppercase before the call
poolSymbol := strings.ToUpper(inputStr)
// no match found. Call the API using the inputStr as the symbol
poolResp, err := h.accountService.RetrievePoolDetails(ctx, inputStr)
poolResp, err := h.accountService.RetrievePoolDetails(ctx, poolSymbol)
if err != nil {
res.FlagSet = append(res.FlagSet, flag_api_call_error)
return res, nil

View File

@@ -4,8 +4,10 @@ import (
"context"
"errors"
"fmt"
"math/big"
"strconv"
"strings"
"time"
"git.defalsify.org/vise.git/db"
"git.defalsify.org/vise.git/resource"
@@ -257,6 +259,7 @@ func (h *MenuHandlers) TransactionReset(ctx context.Context, sym string, input [
flag_invalid_recipient, _ := h.flagManager.GetFlag("flag_invalid_recipient")
flag_invalid_recipient_with_invite, _ := h.flagManager.GetFlag("flag_invalid_recipient_with_invite")
store := h.userdataStore
err = store.WriteEntry(ctx, sessionId, storedb.DATA_AMOUNT, []byte(""))
if err != nil {
@@ -335,28 +338,13 @@ func (h *MenuHandlers) MaxAmount(ctx context.Context, sym string, input []byte)
// Format the active balance amount to 2 decimal places
formattedBalance, _ := store.TruncateDecimalString(string(activeBal), 2)
// If normal transaction, or if the sym is send_max_amount, return balance
if string(transactionType) == "normal" || sym == "send_max_amount" {
// If normal transaction return balance
if string(transactionType) == "normal" {
res.FlagReset = append(res.FlagReset, flag_swap_transaction)
res.Content = l.Get("Maximum amount: %s %s\nEnter amount:", formattedBalance, string(activeSym))
return res, nil
}
res.FlagSet = append(res.FlagSet, flag_swap_transaction)
// Get the recipient's phone number to read other data items
recipientPhoneNumber, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_RECIPIENT_PHONE_NUMBER)
if err != nil {
// invalid state
return res, err
}
recipientActiveSym, recipientActiveAddress, recipientActiveDecimal, err := h.getRecipientData(ctx, string(recipientPhoneNumber))
if err != nil {
return res, err
}
// Resolve active pool address
activePoolAddress, err := h.resolveActivePoolAddress(ctx, sessionId)
if err != nil {
@@ -371,16 +359,31 @@ func (h *MenuHandlers) MaxAmount(ctx context.Context, sym string, input []byte)
logg.ErrorCtxf(ctx, "failed on CheckTokenInPool", "error", err)
return res, nil
}
res.FlagReset = append(res.FlagReset, flag_swap_transaction)
res.Content = l.Get("Maximum amount: %s %s\nEnter amount:", formattedBalance, string(activeSym))
return res, nil
}
// Get the recipient's phone number to read other data items
recipientPhoneNumber, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_RECIPIENT_PHONE_NUMBER)
if err != nil {
// invalid state
return res, err
}
recipientActiveSym, recipientActiveAddress, recipientActiveDecimal, err := h.getRecipientData(ctx, string(recipientPhoneNumber))
if err != nil {
return res, err
}
// retrieve the max credit send amounts
maxSAT, maxRAT, err := h.calculateSendCreditLimits(ctx, activePoolAddress, activeAddress, recipientActiveAddress, publicKey, activeDecimal, recipientActiveDecimal)
if err != nil {
res.FlagSet = append(res.FlagSet, flag_api_call_error)
// if an error (such as Swap rates not found for the speficied pool and tokens), fall back to a normal transaction
logg.ErrorCtxf(ctx, "failed on calculateSendCreditLimits", "error", err)
res.FlagReset = append(res.FlagReset, flag_swap_transaction)
res.Content = l.Get("Maximum amount: %s %s\nEnter amount:", formattedBalance, string(activeSym))
return res, nil
}
@@ -412,6 +415,9 @@ func (h *MenuHandlers) MaxAmount(ctx context.Context, sym string, input []byte)
return res, err
}
// only set the flag once all checks pass
res.FlagSet = append(res.FlagSet, flag_swap_transaction)
res.Content = l.Get(
"Credit Available: %s %s\n(You can swap up to %s %s -> %s %s).\nEnter %s amount:",
maxRAT,
@@ -752,8 +758,19 @@ func (h *MenuHandlers) TransactionSwapPreview(ctx context.Context, sym string, i
return res, err
}
// multiply by 1.015 (i.e. * 1015 / 1000)
amountInt, ok := new(big.Int).SetString(finalAmountStr, 10)
if !ok {
return res, fmt.Errorf("invalid amount: %s", finalAmountStr)
}
amountInt.Mul(amountInt, big.NewInt(1015))
amountInt.Div(amountInt, big.NewInt(1000))
scaledFinalAmountStr := amountInt.String()
// call the credit send API to get the reverse quote
r, err := h.accountService.GetCreditSendReverseQuote(ctx, swapData.ActivePoolAddress, swapData.ActiveSwapFromAddress, swapData.ActiveSwapToAddress, finalAmountStr)
r, err := h.accountService.GetCreditSendReverseQuote(ctx, swapData.ActivePoolAddress, swapData.ActiveSwapFromAddress, swapData.ActiveSwapToAddress, scaledFinalAmountStr)
if err != nil {
flag_api_call_error, _ := h.flagManager.GetFlag("flag_api_call_error")
res.FlagSet = append(res.FlagSet, flag_api_call_error)
@@ -765,23 +782,23 @@ func (h *MenuHandlers) TransactionSwapPreview(ctx context.Context, sym string, i
sendInputAmount := r.InputAmount // amount of SAT that should be swapped
sendOutputAmount := r.OutputAmount // amount of RAT that will be received
// store the sendOutputAmount as the final amount (that will be sent)
err = userStore.WriteEntry(ctx, sessionId, storedb.DATA_AMOUNT, []byte(sendOutputAmount))
// store the finalAmountStr as the final amount (that will be sent after the swap)
err = userStore.WriteEntry(ctx, sessionId, storedb.DATA_AMOUNT, []byte(finalAmountStr))
if err != nil {
logg.ErrorCtxf(ctx, "failed to write output amount value entry with", "key", storedb.DATA_AMOUNT, "value", sendOutputAmount, "error", err)
return res, err
}
// Scale down the quoted output amount
quoteAmountStr := store.ScaleDownBalance(sendOutputAmount, swapData.ActiveSwapToDecimal)
// quoteAmountStr := store.ScaleDownBalance(sendOutputAmount, swapData.ActiveSwapToDecimal)
// Format the qouteAmount amount to 2 decimal places
qouteAmount, _ := store.TruncateDecimalString(quoteAmountStr, 2)
// qouteAmount, _ := store.TruncateDecimalString(quoteAmountStr, 2)
// store the qouteAmount in the temporary value
err = userStore.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(qouteAmount))
err = userStore.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(inputStr))
if err != nil {
logg.ErrorCtxf(ctx, "failed to write temporary qouteAmount entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", qouteAmount, "error", err)
logg.ErrorCtxf(ctx, "failed to write temporary inputStr entry with", "key", storedb.DATA_TEMPORARY_VALUE, "value", inputStr, "error", err)
return res, err
}
@@ -794,7 +811,7 @@ func (h *MenuHandlers) TransactionSwapPreview(ctx context.Context, sym string, i
res.Content = l.Get(
"%s will receive %s %s",
string(recipientPhoneNumber), qouteAmount, swapData.ActiveSwapToSym,
string(recipientPhoneNumber), inputStr, swapData.ActiveSwapToSym,
)
return res, nil
@@ -842,7 +859,10 @@ func (h *MenuHandlers) TransactionInitiateSwap(ctx context.Context, sym string,
}
swapTrackingId := poolSwap.TrackingId
logg.InfoCtxf(ctx, "poolSwap", "swapTrackingId", swapTrackingId)
logg.InfoCtxf(ctx, "send poolSwap before transfer", "swapTrackingId", swapTrackingId)
// TODO: remove this temporary time delay and replace with a swap and send endpoint
time.Sleep(1 * time.Second)
// Initiate a send
recipientPublicKey, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_RECIPIENT)
@@ -874,7 +894,7 @@ func (h *MenuHandlers) TransactionInitiateSwap(ctx context.Context, sym string,
}
trackingId := tokenTransfer.TrackingId
logg.InfoCtxf(ctx, "TokenTransfer", "trackingId", trackingId)
logg.InfoCtxf(ctx, "send TokenTransfer after swap", "trackingId", trackingId)
res.Content = l.Get(
"Your request has been sent. %s will receive %s %s from %s.",

View File

@@ -1,4 +1,5 @@
LOAD reset_transaction_amount 10
RELOAD reset_transaction_amount
LOAD credit_max_amount 160
RELOAD credit_max_amount
CATCH api_failure flag_api_call_error 1
@@ -10,7 +11,6 @@ RELOAD clear_trans_type_flag
CATCH transaction_swap flag_swap_transaction 1
LOAD validate_amount 64
RELOAD validate_amount
CATCH api_failure flag_api_call_error 1
CATCH invalid_amount flag_invalid_amount 1
INCMP _ 0
LOAD get_recipient 0

View File

@@ -1 +0,0 @@
Credit-Send

View File

@@ -1 +0,0 @@
Tuma-Mkopo

View File

@@ -58,17 +58,17 @@ msgstr "%s atapokea %s %s"
msgid "Enter the amount of M-Pesa to get: (Max %s Ksh)\n"
msgstr "Weka kiasi cha M-Pesa cha kupata: (Kikomo %s Ksh)\n"
msgid "You are sending %s %s in order to receive %s ksh"
msgstr "Unatuma %s %s ili upoke %s ksh"
msgid "You are sending %s %s in order to receive ~ %s ksh"
msgstr "Unatuma ~ %s %s ili upoke %s ksh"
msgid "Your request has been sent. You will receive %s ksh"
msgstr "Ombi lako limetumwa. Utapokea %s ksh"
msgid "Your request has been sent. You will receive ~ %s ksh"
msgstr "Ombi lako limetumwa. Utapokea ~ %s ksh"
msgid "Enter the amount of M-Pesa to send: (Minimum %s Ksh)\n"
msgstr "Weka kiasi cha M-Pesa cha kutuma: (Kima cha chini %s Ksh)\n"
msgid "You will get a prompt for your M-Pesa PIN shortly to send %s ksh and receive %s cUSD"
msgstr "Utapokea kidokezo cha PIN yako ya M-Pesa hivi karibuni kutuma %s ksh na kupokea %s cUSD"
msgid "You will get a prompt for your M-Pesa PIN shortly to send %s ksh and receive ~ %s cUSD"
msgstr "Utapokea kidokezo cha PIN yako ya M-Pesa hivi karibuni kutuma %s ksh na kupokea ~ %s cUSD"
msgid "Your request has been sent. Thank you for using Sarafu"
msgstr "Ombi lako limetumwa. Asante kwa kutumia huduma ya Sarafu"

View File

@@ -7,22 +7,20 @@ LOAD check_balance 128
RELOAD check_balance
MAP check_balance
MOUT send 1
MOUT credit_send 2
MOUT swap 3
MOUT vouchers 4
MOUT select_pool 5
MOUT mpesa 6
MOUT account 7
MOUT help 8
MOUT swap 2
MOUT vouchers 3
MOUT select_pool 4
MOUT mpesa 5
MOUT account 6
MOUT help 7
MOUT quit 9
HALT
INCMP send 1
INCMP credit_send 2
INCMP swap_to_list 3
INCMP my_vouchers 4
INCMP select_pool 5
INCMP mpesa 6
INCMP my_account 7
INCMP help 8
INCMP credit_send 1
INCMP swap_to_list 2
INCMP my_vouchers 3
INCMP select_pool 4
INCMP mpesa 5
INCMP my_account 6
INCMP help 7
INCMP quit 9
INCMP . *

View File

@@ -1 +0,0 @@
Enter recipient's phone number/address/alias:

View File

@@ -1,12 +0,0 @@
LOAD transaction_reset 0
RELOAD transaction_reset
CATCH no_voucher flag_no_active_voucher 1
MOUT back 0
HALT
LOAD validate_recipient 50
RELOAD validate_recipient
CATCH api_failure flag_api_call_error 1
CATCH invalid_recipient flag_invalid_recipient 1
CATCH invite_recipient flag_invalid_recipient_with_invite 1
INCMP _ 0
INCMP amount *

View File

@@ -1 +0,0 @@
Weka nambari ya simu/Anwani/Lakabu: