📜 ⬆️ ⬇️

WmClasses: use on health

In the comments to the post about TinyWM, I promised to put the library into free access to work with the XML interfaces of WebMoney Transfer, which was written by me 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
- CmdPursesBalance

All of them are the heirs of the base class WmXmlCmd .
It has the Execute () method, which actually executes the command, and the RetVal and RetDesc properties , the values ​​of which need to be looked at if an exception occurred during the execution of this method.
')
These classes should be used like this:
- create an instance of the class
- set values ​​for properties (wallet number, amount, etc.)
- call the Execute method
- process the result of the command execution (some classes other than RetVal and RetDesc return something else - for example, a collection of objects of type Purse for the command CmdPursesBalance ).

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, you need to set the 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 commands (unless it is set not to set it equal to SignerWMID)
- BKeys - if you use WMSignerFX for signing commands
- KeysFileName and AccessCode - if used to sign WMSigner commands

Source: https://habr.com/ru/post/14617/


All Articles