@lokavaluto/lokapi-backend-cyclos
v0.1.1-alpha.202411231556
Published
Cyclos backend for Lokavaluto API
Downloads
166
Readme
This is a backend for managing any cyclos currency through LokAPI.
The latter aims at providing a simple framework for building client
app to manage currency payments. You can refer to @lokavaluto/lokapi
's doc to
get more knowledge of how to use it.
Adding @lokavaluto/lokapi-backend-cyclos
to your project
From the root of your project:
npm install --save @lokavaluto/lokapi-backend-cyclos
Or better, as @lokavaluto/lokapi-backend-cyclos
is still in early release,
npm install --save Lokavaluto/lokapi-backend-cyclos#master
To be sure to get the latest version, relaunch this last command whenever you want to update.
Usage
You can provide this backend when subclassing LokAPI:
For instance:
import LokAPIBrowserAbstract from "@lokavaluto/lokapi-browser"
import cyclos from '@lokavaluto/lokapi-backend-cyclos'
class LokAPI extends LokAPIBrowserAbstract {
BackendFactories = {
cyclos,
}
requestLocalPassword = async function (state: string) {
// ... your UI code to request password from user
}
requestLogin() {
// ... your UI code to request password from user
}
}
if (!process.env.VUE_APP_LOKAPI_HOST) {
throw new Error("Please specify VUE_APP_LOKAPI_HOST in '.env'")
}
if (!process.env.VUE_APP_LOKAPI_DB) {
throw new Error("Please specify VUE_APP_LOKAPI_DB in '.env'")
}
export var lokAPI = new LokAPI(
process.env.VUE_APP_LOKAPI_HOST,
process.env.VUE_APP_LOKAPI_DB,
)
For usage of @lokavaluto/lokapi
, please refer to @lokavaluto/lokapi
's documentation.
Developers
To get started developing and tinkering with this code, you can:
Install dependencies
npm install
Build the project
npx tsc -w
Changelog
(unreleased)
New
- Do not cache failure of ``Backend.getAccounts(..)`` [Valentin Lab]
- Add implementation of split memo interface. [Valentin Lab]
Note that there are no split memo support yet on cyclos backends, but
we still need to advertise this and support the new prototypes.
- Provide implementation of ``CreditRequest`` [Valentin Lab]
All backends now require to provide an implementation of
``CreditRequest`` as they could be displayed before actual payment and
canceled.
Changes
- Make
Recipient.transfer()
return a fullTransaction
object. [Valentin Lab]
Fix
- Return cyclos symbol identifier as ``Transaction.currency`` instead of
cyclos currency name. [Valentin Lab]
0.1.0 (2023-05-08)
------------------
New
- New: enforce
@0k.io/types-request
version0.0.4
or higher for timeout support. [Valentin Lab] - Add date filter to
getTransactions(..)
[Valentin Lab] - Resolve transaction's related name using odoo's new
cyclos/contact
API endpoint. [Valentin Lab] - Add
Recipient.getSymbol()
method implementation. [Valentin Lab] - Add
Recipient.fromUserAccount
property. [Valentin Lab] - Add
UserAccount.getSymbol()
implementation. [Valentin Lab] - Make
UserAccount.getAccounts()
debounced and cached. [Valentin Lab] - Provide
UserAccount.requiresUnlock()
to advertise if an unlock is required on currentuserAccount
[Valentin Lab] - Single out insufficient balance error to throw common exception. [Seddik Kadi]
- Make accounts answer to
creditable
boolean property. [Valentin Lab] - Inactive user account don't have any money account accessible. [Valentin Lab]
Backend.internalId
property is now implemented on super class. [Valentin Lab]
Changes
- Chg: use new package ``@0k.io/types-request`` [Valentin Lab]
This new package refactored out from lokapi some
exceptions and types.
Fix
~~~
- Prevent exception upon listing transaction data with deleted user
account. [Valentin Lab]
- New: api v12 changed structure of backend data ``bank_accounts`` ->
``accounts`` [Valentin Lab]
- Use new location of lokapi exceptions. [Valentin Lab]
Re-introduce the ``instanceof`` check as it was tested as working
on different builds (dev, production), and minified.
0.0.1 (2021-11-17)
------------------
- First import. [Valentin Lab]