1.0.1 • Published 2 years ago

mprint-xmlrpc v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

mprint-xmlrpc

XMLRPC library for MPrint Server

This is based on the node-xmlrpc repository, which has a bug dealing with Float values, but is no longer maintained.

In essence, PaperCut's XMLRPC server uses Java and is very strictly-typed, so its methods expect, for example, a Double vs. an Int in some cases. This is an issue when we're trying to adjust a user's balance by an integer value, because JavaScript is not strictly typed -- all 'number' types are represented by floats but are displayed with or without a decimal point, based on if it's an integer or not. When the XMLRPC library tries to serialize the values into XML, it sees something like 10 and says "it's an integer", even though the Java server requires it to be a Double. To work around that, if you try to run parseFloat to force a decimal point, it returns a String value, so the library sends it as a String instead of a Double.

So! We need to throw a condition into the serializer to say, if it's a String value, but is actually representative of a number, send it as a Double.