Back to Home

WmClasses: enjoy your health

webmoney · keeper · classic · light · enum · telepat · webmoney · keeper · pda

WmClasses: enjoy your health

    In the comments to the post about TinyWM, I promised to put in a free access library for working with WebMoney Transfer XML interfaces , which I wrote for my own needs.

    I keep my word: you can download the source code and an example of using the WmClasses library here .

    Everything is very simple, for each of the WM-interfaces there is a class:
    - CmdSendInvoice
    - CmdSendWebMoney
    - CmdOperationsHistory
    - CmdSendMessage
    - CmdInInvoices
    - CmdOutInvoices
    - CmdRejectInvoice
    - CmdVerifySignature
    - CmdPursesB

    All of them are descendants of the WmXmlCmd base class .
    It has the Execute () method , which actually executes the command, and the RetVal and RetDesc properties , the values ​​of which must be watched if an exception occurs during the execution of this method.

    You need to use these classes as follows:
    - create an instance of the class
    - set values ​​for the properties (wallet number, amount, etc.)
    - call the Execute method
    - process the result of the command (some classes except RetVal and RetDesc return something else - for example, a collection of objects type Purse for the CmdPursesBalance command ).

    Example:
    static void Purses()
    {
       WmClasses.CmdPursesBalance cmd = new WmClasses.CmdPursesBalance();
       cmd.Execute();
       Console.Write("Purse Name\tAmount\tDescription\n");
       foreach (Purse purse in cmd.Purses)
       {
          Console.Write(string.Format("{0}\t{1:N}\t{2}\n", purse.Number, purse.Amount, purse.Desc));
       }
    }

    Well, before using it, you need to set significant static properties of the WmSettings class such as:
    - SignerWMID - WMID of the person who signs the commands
    - TrustedWMID - WMID of the person who trusts to sign the team (if this property does not set it is equal to SignerWMID)
    - BKeys - if used for signing WMSignerFX commands
    - KeysFileName and AccessCode - if used to sign WMSigner commands

    Read Next