-
Notifications
You must be signed in to change notification settings - Fork 0
/
WMXI.php
495 lines (402 loc) · 16.9 KB
/
WMXI.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
<?php
################################################################################
# #
# Webmoney XML Interfaces by DKameleon (http://dkameleon.com) #
# #
# Updates and new versions: http://my-tools.net/wmxi/ #
# #
# Server requirements: #
# - SimpleXML #
# #
################################################################################
# including classes
if (!defined('__DIR__')) { define('__DIR__', dirname(__FILE__)); }
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'WMXICore.php');
# WMXI class
class WMXI extends WMXICore {
# interface X1
# http://wiki.webmoney.ru/wiki/show/Interfeys_X1
public function X1($orderid, $customerwmid, $storepurse, $amount, $desc, $address, $period, $expiration) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($orderid.$customerwmid.$storepurse.$amount.$desc.$address.$period.$expiration.$reqn);
}
$group = 'invoice';
$req->$group->orderid = $orderid;
$req->$group->customerwmid = $customerwmid;
$req->$group->storepurse = $storepurse;
$req->$group->amount = $amount;
$req->$group->desc = $desc;
$req->$group->address = $address;
$req->$group->period = $period;
$req->$group->expiration = $expiration;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLInvoice.asp' : 'https://w3s.wmtransfer.com/asp/XMLInvoiceCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X2
# http://wiki.webmoney.ru/wiki/show/Interfeys_X2
public function X2($tranid, $pursesrc, $pursedest, $amount, $period, $pcode, $desc, $wminvid, $onlyauth) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($reqn.$tranid.$pursesrc.$pursedest.$amount.$period.$pcode.$desc.$wminvid);
}
$group = 'trans';
$req->$group->tranid = $tranid;
$req->$group->pursesrc = $pursesrc;
$req->$group->pursedest = $pursedest;
$req->$group->amount = $amount;
$req->$group->period = $period;
$req->$group->pcode = $pcode;
$req->$group->desc = $desc;
$req->$group->wminvid = $wminvid;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLTrans.asp' : 'https://w3s.wmtransfer.com/asp/XMLTransCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X3
# http://wiki.webmoney.ru/wiki/show/Interfeys_X3
public function X3($purse, $wmtranid, $tranid, $wminvid, $orderid, $datestart, $datefinish) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($purse.$reqn);
}
$group = 'getoperations';
$req->$group->purse = $purse;
$req->$group->wmtranid = $wmtranid;
$req->$group->tranid = $tranid;
$req->$group->wminvid = $wminvid;
$req->$group->orderid = $orderid;
$req->$group->datestart = $datestart;
$req->$group->datefinish = $datefinish;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLOperations.asp' : 'https://w3s.wmtransfer.com/asp/XMLOperationsCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X4
# http://wiki.webmoney.ru/wiki/show/Interfeys_X4
public function X4($purse, $wminvid, $orderid, $datestart, $datefinish) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($purse.$reqn);
}
$group = 'getoutinvoices';
$req->$group->purse = $purse;
$req->$group->wminvid = $wminvid;
$req->$group->orderid = $orderid;
$req->$group->datestart = $datestart;
$req->$group->datefinish = $datefinish;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLOutInvoices.asp' : 'https://w3s.webmoney.ru/asp/XMLOutInvoicesCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X5
# http://wiki.webmoney.ru/wiki/show/Interfeys_X5
public function X5($wmtranid, $pcode) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($wmtranid.$pcode.$reqn);
}
$group = 'finishprotect';
$req->$group->wmtranid = $wmtranid;
$req->$group->pcode = $pcode;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLFinishProtect.asp' : 'https://w3s.wmtransfer.com/asp/XMLFinishProtectCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X6
# http://wiki.webmoney.ru/wiki/show/Interfeys_X6
public function X6($receiverwmid, $msgsubj, $msgtext) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($receiverwmid.$reqn.$msgtext.$msgsubj);
}
$group = 'message';
$req->$group->receiverwmid = $receiverwmid;
$req->$group->msgsubj = $msgsubj;
$req->$group->msgtext = $msgtext;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLSendMsg.asp' : 'https://w3s.wmtransfer.com/asp/XMLSendMsgCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X7
# http://wiki.webmoney.ru/wiki/show/Interfeys_X7
public function X7($wmid, $plan, $sign) {
# $reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
# $req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($this->wmid.$wmid.$plan.$sign);
}
$group = 'testsign';
$req->$group->wmid = $wmid;
$req->$group->plan = $plan;
$req->$group->sign = $sign;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLClassicAuth.asp' : 'https://w3s.wmtransfer.com/asp/XMLClassicAuthCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X8
# http://wiki.webmoney.ru/wiki/show/Interfeys_X8
public function X8($wmid, $purse) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($wmid.$purse);
}
$group = 'testwmpurse';
$req->$group->wmid = $wmid;
$req->$group->purse = $purse;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLFindWMPurseNew.asp' : 'https://w3s.wmtransfer.com/asp/XMLFindWMPurseCertNew.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X9
# http://wiki.webmoney.ru/wiki/show/Interfeys_X9
public function X9($wmid) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($wmid.$reqn);
}
$group = 'getpurses';
$req->$group->wmid = $wmid;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLPurses.asp' : 'https://w3s.wmtransfer.com/asp/XMLPursesCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X10
# http://wiki.webmoney.ru/wiki/show/Interfeys_X10
public function X10($wmid, $wminvid, $datestart, $datefinish) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($wmid.$wminvid.$datestart.$datefinish.$reqn);
}
$group = 'getininvoices';
$req->$group->wmid = $wmid;
$req->$group->wminvid = $wminvid;
$req->$group->datestart = $datestart;
$req->$group->datefinish = $datefinish;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLInInvoices.asp' : 'https://w3s.webmoney.ru/asp/XMLInInvoicesCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X11
# http://wiki.webmoney.ru/wiki/show/Interfeys_X11
public function X11($passportwmid, $dict, $info, $mode) {
# $reqn = $this->_reqn();
$req = new SimpleXMLElement('<request/>');
# $req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($this->wmid.$passportwmid);
} else {
$req->wmid = '';
$req->sign = '';
}
$req->passportwmid = $passportwmid;
$group = 'params';
$req->$group->dict = $dict;
$req->$group->info = $info;
$req->$group->mode = $mode;
$url = 'https://passport.webmoney.ru/asp/XMLGetWMPassport.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X13
# http://wiki.webmoney.ru/wiki/show/Interfeys_X13
public function X13($wmtranid) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($wmtranid.$reqn);
}
$group = 'rejectprotect';
$req->$group->wmtranid = $wmtranid;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLRejectProtect.asp' : 'https://w3s.wmtransfer.com/asp/XMLRejectProtectCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X14
# http://wiki.webmoney.ru/wiki/show/Interfeys_X14
public function X14($inwmtranid, $amount) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($reqn.$inwmtranid.$amount);
}
$group = 'trans';
$req->$group->inwmtranid = $inwmtranid;
$req->$group->amount = $amount;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLTransMoneyback.asp' : 'https://w3s.wmtransfer.com/asp/XMLTransMoneybackCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X15
# http://wiki.webmoney.ru/wiki/show/Interfeys_X15
public function X15a($wmid) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($wmid.$reqn);
}
$group = 'gettrustlist';
$req->$group->wmid = $wmid;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLTrustList.asp' : 'https://w3s.webmoney.ru/asp/XMLTrustListCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X15
# http://wiki.webmoney.ru/wiki/show/Interfeys_X15
public function X15b($wmid) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($wmid.$reqn);
}
$group = 'gettrustlist';
$req->$group->wmid = $wmid;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLTrustList2.asp' : 'https://w3s.webmoney.ru/asp/XMLTrustList2Cert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X15
# http://wiki.webmoney.ru/wiki/show/Interfeys_X15
public function X15c($masterwmid, $slavewmid, $purse, $ainv, $atrans, $apurse, $atranshist, $limit, $daylimit, $weeklimit, $monthlimit) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($this->wmid.$purse.$masterwmid.$reqn);
}
$group = 'trust';
$req->$group->addAttribute('inv', $ainv);
$req->$group->addAttribute('trans', $atrans);
$req->$group->addAttribute('purse', $apurse);
$req->$group->addAttribute('transhist', $atranshist);
$req->$group->masterwmid = $masterwmid;
$req->$group->slavewmid = $slavewmid;
$req->$group->purse = $purse;
$req->$group->limit = $limit;
$req->$group->daylimit = $daylimit;
$req->$group->weeklimit = $weeklimit;
$req->$group->monthlimit = $monthlimit;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLTrustSave2.asp' : 'https://w3s.webmoney.ru/asp/XMLTrustSave2Cert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X16
# http://wiki.webmoney.ru/wiki/show/Interfeys_X16
public function X16($wmid, $pursetype, $desc) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<w3s.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($wmid.$pursetype.$reqn);
}
$group = 'createpurse';
$req->$group->wmid = $wmid;
$req->$group->pursetype = $pursetype;
$req->$group->desc = $desc;
$url = $this->classic ? 'https://w3s.webmoney.ru/asp/XMLCreatePurse.asp' : 'https://w3s.wmtransfer.com/asp/XMLCreatePurseCert.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X17
# http://wiki.webmoney.ru/wiki/show/Interfeys_X17
public function X17a($name, $ctype, $text, $wmidlist) {
# $reqn = $this->_reqn();
$req = new SimpleXMLElement('<contract.request/>');
# $req->reqn = $reqn;
if ($this->classic) {
$req->sign_wmid = $this->wmid;
$req->sign = $this->_sign($this->wmid.strlen($name).$ctype); # can be error due multibyte strings by default
}
foreach($wmidlist as $k => $v) {
$req->accesslist->addChild('wmid', $v);
}
$url = 'https://arbitrage.webmoney.ru/xml/X17_CreateContract.aspx';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X17
# http://wiki.webmoney.ru/wiki/show/Interfeys_X17
public function X17b($contractid) {
# $reqn = $this->_reqn();
$req = new SimpleXMLElement('<contract.request/>');
# $req->reqn = $reqn;
if ($this->classic) {
$req->wmid = $this->wmid;
$req->sign = $this->_sign($contractid.'acceptdate');
}
$req->contractid = $contractid;
$req->mode = 'acceptdate';
$url = 'https://arbitrage.webmoney.ru/xml/X17_GetContractInfo.aspx';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X18
# http://wiki.webmoney.ru/wiki/show/Interfeys_X18
public function X18($wmid, $lmi_payee_purse, $lmi_payment_no, $secret_key) {
# $reqn = $this->_reqn();
$req = new SimpleXMLElement('<merchant.request/>');
# $req->reqn = $reqn;
$req->wmid = $wmid;
$req->lmi_payee_purse = $lmi_payee_purse;
$req->lmi_payment_no = $lmi_payment_no;
if ($this->classic) {
$req->sign = $this->_sign($wmid.$lmi_payee_purse.$lmi_payment_no);
} elseif ($secret_key != '') {
$req->md5 = strtoupper(md5($wmid.$lmi_payee_purse.$lmi_payment_no.$secret_key));
}
# $req->secret_key = $secret_key;
$url = 'https://merchant.webmoney.ru/conf/xml/XMLTransGet.asp';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
# interface X19
# http://wiki.webmoney.ru/wiki/show/Interfeys_X19
public function X19($type, $direction, $pursetype, $amount, $wmid, $pnomer, $fname, $iname, $bank_name, $bank_account, $card_number, $emoney_name, $emoney_id) {
$reqn = $this->_reqn();
$req = new SimpleXMLElement('<passport.request/>');
$req->reqn = $reqn;
if ($this->classic) {
$req->signerwmid = $this->wmid;
$req->sign = $this->_sign($reqn.$type.$wmid);
}
$group = 'operation';
$req->$group->type = $type;
$req->$group->direction = $direction;
$req->$group->pursetype = $pursetype;
$req->$group->amount = $amount;
$group = 'userinfo';
$req->$group->wmid = $wmid;
$req->$group->pnomer = $pnomer;
$req->$group->fname = $fname;
$req->$group->iname = $iname;
$req->$group->bank_name = $bank_name;
$req->$group->bank_account = $bank_account;
$req->$group->card_number = $card_number;
$req->$group->emoney_name = $emoney_name;
$req->$group->emoney_id = $emoney_id;
$url = $this->classic ? 'https://apipassport.webmoney.ru/XMLCheckUser.aspx' : 'https://apipassportcrt.webmoney.ru/XMLCheckUserCert.aspx';
return $this->_request($url, $req->asXML(), __FUNCTION__);
}
}
?>