Library API WebMoney Transfer for the language Python, implementing a whole set of functions HTTPS-interface for WebMoney Transfer Keeper Classic, requires an external program for generation of electronic signature algorithm SIGN, cross-platform (Python'om required to support SSL-sockets for the platform / availability features socket.ssl () /).
The variants of the implementation procedures SIGN-signature module extensions Python (for C / C ++), thus eliminating the use of an external (optional) program.
Developer Documentation is not yet available, but there is a test file test.py, which are checked (use) all realized functions.
#! / Usr / bin / python2.2 -O
"" "WebMoney Transfer
Keeper Classic HTTPS interface test module (c) 2003 eugene_beast
Encoding: cp1251
Instead xxxxxxxxxxxx substitute wmid & wm purse store and the client.
"" "
__version__ = (0, 0, 1, 'alpha')
from base import WMTError
from wmhttps import ClassicHTTPS as WMThttps
from wmxml import ClassicXML as WMTxml
# WMID customer
cl_wmid = 'xxxxxxxxxxxx'
# WM-purse of the client
cl_wmpurse = 'Zxxxxxxxxxxxx'
# WMID store
t = WMThttps ('xxxxxxxxxxxx)
x = WMTxml ('xxxxxxxxxxxx')
# WM-purse shop
t.shop_wmpurse = x.shop_wmpurse = 'Zxxxxxxxxxxxx'
# Period under the patronage of money (for TransCreateProt) - 1 Day (default 3 days)
t.trans_prtime = x.trans_prtime = 1
# Account number and transfer transactions in the store
shop_inv_number = shop_trans_number = 1
------------------------------------------------- # ------------------------------
print 'statement accounts, WMThttps.InvCreate () ...'
wm_inv_id = None
try:
wm_inv_id = int (open ('test.wmt_inv_id', 'r'). readline ())
print 'Info: saved WMT Invoice ID found ...'
except:
try:
wm_inv_id = t.InvCreate (cl_wmid, 1.21, shop_inv_number, 'descr: test', 'address: void')
open ('test.wmt_inv_id', 'w'). write (str (wm_inv_id))
except WMTError, error:
print 'Error% s:'% error.errno, error.strerror
print 'WM Invoice ID:' + str (wm_inv_id)
------------------------------------------------- # ------------------------------
print 'Checking account status, WMThttps.InvCheck () ...'
states = {-2: 'Account not found', \\
-1 'Bill has not been paid by the buyer refused to pay the bill', \\
0 'bill has not yet been paid by the buyer', \\
1 'bills paid, but protected transaction - money is not in the store to complete the protection code must be entered within the time limit patronage shop', \\
2 'bills paid, the money has already been transferred to the purse store}
try:
state = x.InvCheck (shop_inv_number, cl_wmid, wm_inv_id)
print 'Classic XML:% d:% s'% (state, states [state])
except WMTError, error:
print 'Error% s:'% error.errno, error.strerror
# Test - stop right here
import sys
sys.exit (0)
try:
state = t.InvCheck (shop_inv_number, cl_wmid, wm_inv_id)
print 'Classic HTTPS:% d:% s'% (state, states [state])
except WMTError, error:
print 'Error% s:'% error.errno, error.strerror
------------------------------------------------- # ------------------------------
print 'Checking the purse identifier, WMThttps.CheckWMIDPurse () ...'
states = {0, 'The specified WM identifier does not exist', \\
1: 'WM identifier there, but he has said the purse', \\
2: 'WM identifier exists and has given a purse}
print '% s /% s must exist and have the wallet'% (cl_wmid, cl_wmpurse)
try:
state = t.CheckWMIDPurse (cl_wmid, cl_wmpurse)
print state, states [state]
except WMTError, error:
print 'Error% s:'% error.errno, error.strerror
wrong_purse = 'Z813374817225'
print '% s /% s must exist but should not have the wallet'% (cl_wmid, wrong_purse)
try:
state = t.CheckWMIDPurse (cl_wmid, wrong_purse)
print state, states [state]
except WMTError, error:
print 'Error% s:'% error.errno, error.strerror
wrong_wmid = '001000300000'
print '% s /% s should not exist identifier'% (wrong_wmid, wrong_purse)
try:
state = t.CheckWMIDPurse (cl_wmid, wrong_purse)
print state, states [state]
except WMTError, error:
print 'Error% s:'% error.errno, error.strerror
------------------------------------------------- # ---------------------
No feedback yet