Documentation ¶
Overview ¶
Package consumer provides services for EBS consumer APIs, and custom apis we have developed as well. It offers a seamless and unified api to be used for both merchant pos and mobile payment
EBS Services ¶
- Get Balance
- Working Key
- Is Alive
- Card transfer
- Billers
Special Payment ¶
Special Payment is a secure way to tokenize payments for external service providers through a custom url link. The URL is only valid once and it cannot be reused.
Workflow ¶
Here's how the system works.
- Generate a payment token (/consumer/generate_token)
Parameters: - amount
- biller id
It will return a new response with a UUID that to be used by the client's users for payment.
- Special payment (/consumer/special_payment/:UUID)
Parameters:
- tranAmount (the same as before!)
- billerId
- ConsumerServices payload
It will return 400 ONLY if the amount OR the biller id didn't match the specified UUID in the system
Examples ¶
cURL:
1. Generate Token curl -X POST https://api.soluspay.net/api/v1/payment_token -d '{"amount": 10}'
> {"result":{"amount":10,"uuid":"6eb3ae20-ecbc-4603-b079-ed98549cf9f2"},"uuid":"6eb3ae20-ecbc-4603-b079-ed98549cf9f2"}
2. Inquire token via UUID curl -X GET https://api.soluspay.net/api/v1/payment/6eb3ae20-ecbc-4603-b079-ed98549cf9f2 -d '{"amount": 10}'
3. Complete Payment curl -X POST https://api.soluspay.net/api/v1/payment/6eb3ae20-ecbc-4603-b079-ed98549cf9f2 -d '{"amount": 10}'
NOTE that in payment inquiry we use GET method, while we use POST for payment ¶
* Note authentication might be added to this API
PIN Block ¶
Please advice with ebs documentations about iPIN block encryption. You can cite these locations for iPIN implementation:
- https://github.com/adonese/donates (JS) - https://github.com/jadenfreude/noebs-wasm (GO) - https://github.com/adonese/cashq (Java)
Index ¶
- Constants
- Variables
- func BillerHooks()
- func GetRandomName(retry int) string
- func GetServiceID(c *gin.Context)
- func NewCashout(r *redis.Client) paymentTokens
- func NewPayment(r *redis.Client) *paymentTokens
- func Routes(groupName string, route *gin.Engine, db *gorm.DB, redisClient *redis.Client)
- type Auther
- type Service
- func (s *Service) AccountTransfer(c *gin.Context)
- func (s *Service) AddCards(c *gin.Context)
- func (s *Service) AddMobile(c *gin.Context)
- func (s *Service) Balance(c *gin.Context)
- func (s *Service) BillInquiry(c *gin.Context)
- func (s *Service) BillPayment(c *gin.Context)
- func (s *Service) BillerTrans(c *gin.Context)
- func (s *Service) CancelBiller(c *gin.Context)
- func (s *Service) CardFromNumber(c *gin.Context)
- func (s *Service) CardTransfer(c *gin.Context)
- func (s *Service) CashoutClaims(c *gin.Context)
- func (s *Service) CompleteIpin(c *gin.Context)
- func (s *Service) CompleteRegistration(c *gin.Context)
- func (s *Service) CreateMerchant(c *gin.Context)
- func (s *Service) EbsGetCardInfo(c *gin.Context)
- func (s *Service) EditCard(c *gin.Context)
- func (s *Service) GenerateCashoutClaim(c *gin.Context)
- func (s *Service) GenerateIpin(c *gin.Context)
- func (s *Service) GeneratePaymentToken(c *gin.Context)
- func (s *Service) GenerateVoucher(c *gin.Context)
- func (s *Service) GetCards(c *gin.Context)
- func (s *Service) GetMSISDNFromCard(c *gin.Context)
- func (s *Service) GetMobile(c *gin.Context)
- func (s *Service) GetPaymentToken(c *gin.Context)
- func (s *Service) IPinChange(c *gin.Context)
- func (s *Service) IsAlive(c *gin.Context)
- func (s *Service) NecToName(c *gin.Context)
- func (s *Service) NewBiller(c *gin.Context)
- func (s *Service) Purchase(c *gin.Context)
- func (s *Service) QRGeneration(c *gin.Context)
- func (s *Service) QRPayment(c *gin.Context)
- func (s *Service) QRRefund(c *gin.Context)
- func (s *Service) RegisterCard(c *gin.Context)
- func (s *Service) RegisterCashout(c *gin.Context)
- func (s *Service) RemoveCard(c *gin.Context)
- func (s *Service) ResetPassword(c *gin.Context)
- func (s *Service) SpecialPayment(c *gin.Context)
- func (s *Service) Status(c *gin.Context)
- func (s *Service) Transactions(c *gin.Context)
- func (s *Service) UpdateCashout(c *gin.Context)
- func (s *Service) WorkingKey(c *gin.Context)
- type State
- func (s *State) APIAuth() gin.HandlerFunc
- func (s *State) ApiKeyMiddleware(c *gin.Context)
- func (s *State) CreateUser(c *gin.Context)
- func (s *State) GenerateAPIKey(c *gin.Context)
- func (s *State) IpFilterMiddleware(c *gin.Context)
- func (s *State) LogOut(c *gin.Context)
- func (s *State) LoginHandler(c *gin.Context)
- func (s *State) RefreshHandler(c *gin.Context)
- Bugs
Constants ¶
const (
SPECIAL_BILLERS = "noebs:billers"
)
Variables ¶
var BillChan = make(chan ebs_fields.EBSParserFields)
BillChan it is used to asyncronysly parses ebs response to get and assign values to the billers such as assigning the name to utility personal payment info
var (
ErrCreateDbRow = errors.New("unable to create a new db row/column")
)
Functions ¶
func GetRandomName ¶
GetRandomName generates a random name from the list of adjectives and surnames in this package formatted as "adjective_surname". For example 'focused_turing'. If retry is non-zero, a random integer between 0 and 10 will be added to the end of the name, e.g `focused_turing3`
func NewCashout ¶
func NewCashout(r *redis.Client) paymentTokens
NewCashout experimental interface to make cashout publicaly availabe.
func NewPayment ¶
func NewPayment(r *redis.Client) *paymentTokens
NewPayment generate a new payment token to be used by consumers
Types ¶
type Service ¶
Service consumer for utils.Service struct
func (*Service) AccountTransfer ¶
AccountTransfer performs p2p transactions
func (*Service) AddCards ¶
AddCards Allow users to add card to their profile if main_card was set to true, then it will be their main card AND it will remove the previously selected one FIXME
func (*Service) BillInquiry ¶
BillInquiry for telecos, utility and government (billers inquiries)
func (*Service) BillPayment ¶
BillPayment is responsible for utility, telecos, e-government and other payment services
func (*Service) BillerTrans ¶
BillerTrans to get all transaction to specific biller_id
func (*Service) CancelBiller ¶
CancelBiller using its issued uuid
func (*Service) CardFromNumber ¶
CardFromNumber gets the gussesed associated mobile number to this pan
func (*Service) CardTransfer ¶
CardTransfer performs p2p transactions
func (*Service) CashoutClaims ¶
CashoutClaims used by merchants to make a cashout
func (*Service) CompleteIpin ¶
CompleteIpin performs an otp check from ebs to complete ipin change transaction
func (*Service) CompleteRegistration ¶
CompleteRegistration step 2 in card issuance process
func (*Service) CreateMerchant ¶
CreateMerchant creates new noebs merchant
func (*Service) EbsGetCardInfo ¶
EbsGetCardInfo get card holder name from pan. Currently is limited to telecos only
func (*Service) EditCard ¶
EditCard allow authorized users to edit their cards (e.g., edit pan / expdate)
func (*Service) GenerateCashoutClaim ¶
GenerateCashoutClaim generates a new cashout claim. Used by merchant to issue a new claim
func (*Service) GenerateIpin ¶
GenerateIpin generates a new ipin for card holder
func (*Service) GeneratePaymentToken ¶
GeneratePaymentToken generates a token BUG(adonese) we have to make it mandatory for biller id as well BUG(adonese) still not fixed -- but we really should fix it TODO(adonese) #94 API key should be mandatory
func (*Service) GenerateVoucher ¶
QRPayment performs QR payment transaction
func (*Service) GetMSISDNFromCard ¶
GetMSISDNFromCard for ussd to get pan info from sim card
func (*Service) GetPaymentToken ¶
GetPaymentToken retrieves a generated payment token by ID (UUID)
func (*Service) IPinChange ¶
IPinChange changes the ipin for the card holder provided card
func (*Service) NecToName ¶
NecToName gets an nec number from the context and maps it to its meter number
func (*Service) Purchase ¶
Purchase performs special payment api from ebs consumer services It requires: card info (src), amount fields, specialPaymentId (destination) in order to complete the transaction
func (*Service) QRGeneration ¶
QRGeneration generates a qr token for the registered merchant
func (*Service) RegisterCard ¶
QRPayment performs QR payment transaction
func (*Service) RegisterCashout ¶
RegisterCashout to register a new cashout biller in noebs
func (*Service) RemoveCard ¶
RemoveCard allow authorized users to remove their card when the send the card id (from its list in app view)
func (*Service) ResetPassword ¶
ResetPassword reset user password after passing some check
func (*Service) SpecialPayment ¶
SpecialPayment is a new api to allow for site users to securely request payment it is really just a payment request with: - tran amount - payee id later we can add more features such as expiration for the token and more.
func (*Service) Transactions ¶
Transactions get transactions stored in our redis data store
func (*Service) UpdateCashout ¶
UpdateCashout to register a new cashout biller in noebs
func (*Service) WorkingKey ¶
WorkingKey get ebs working key for encrypting ipin for consumer transactions
type State ¶
type State struct { Db *gorm.DB Redis *redis.Client Auth Auther UserModel gateway.UserModel UserLogin gateway.UserLogin }
func (*State) APIAuth ¶
func (s *State) APIAuth() gin.HandlerFunc
APIAuth API-Key middleware. Currently is used by consumer services FIXME issue #61
func (*State) ApiKeyMiddleware ¶
ApiKeyMiddleware used to authenticate clients using X-Email and X-API-Key headers FIXME issue #58 #61
func (*State) GenerateAPIKey ¶
GenerateAPIKey An Admin-only endpoint that is used to generate api key for our clients the user must submit their email to generate a unique token per email. FIXME #59 #58 #61 api generation should be decoupled from apigateway package
func (*State) IpFilterMiddleware ¶
FIXME issue #58 #61
func (*State) LoginHandler ¶
FIXME #60 make LoginHandler in consumer apis #61
func (*State) RefreshHandler ¶
FIXME #61 refactor some of these apis for consumer services only
Notes ¶
Bugs ¶
we have to make it mandatory for biller id as well
still not fixed -- but we really should fix it
safe but unclean; should be fixed. As reliable as the holding handler is
find a way to get hooks and to from here.