Coder Social home page Coder Social logo

Comments (3)

jdupas22 avatar jdupas22 commented on September 16, 2024

Hey Agallan ! Yes it's possible to have account with negative values, there is a mapping system with some rules you can use to allow this, and soon you'll be able to do apply some rules 'per transaction' if you want to allow overdraft on some accounts !

Here's one example :

You can use the endpoint PUT /mappings
https://docs.formance.com/oss/ledger/reference/api#tag/mapping/operation/updateMapping

with this kind of body :
{ "contracts": [ { "account": "banks:account:*", "expr": { "$or": [ {"$gte": ["$balance", 0]}, {"$lte": ["$balance", 0]}, ] } } ] }

Of course, you hsould update the 'account' value depending of your needs ! Let me know if that answers your question :) And sorry for the delay !

from ledger.

edwardmp avatar edwardmp commented on September 16, 2024

@jdupas22 we are interested in this too, do you have an example Numscript that shows how to allow overdrafting on a transaction level? Could not find it in the docs.

from ledger.

jdupas22 avatar jdupas22 commented on September 16, 2024

Hey Edward ! Sorry for the delay ! Yes of course !

send [USD/2 500] (
  source = @foo allowing overdraft up to [USD/2 100]
  destination = @world
)

from ledger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.