-
Notifications
You must be signed in to change notification settings - Fork 10
/
x8.go
82 lines (75 loc) · 2.29 KB
/
x8.go
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
package webmoney
// Copyright (c) 2016 The Constantin Karataev. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd.
//
// desc
// https://wiki.wmtransfer.com/projects/webmoney/wiki/Interface_X8
/*<w3s.request>
<reqn></reqn>
<wmid></wmid>
<sign></sign>
<testwmpurse>
<wmid></wmid>
<purse></purse>
</testwmpurse>
</w3s.request>*/
/*
<w3s.response>
<reqn></reqn>
<retval></retval>
<retdesc></retdesc>
<testwmpurse>
<wmid available="-1" themselfcorrstate="-1" newattst="-1"> </wmid>
<purse merchant_active_mode="-1" merchant_allow_cashier="-1"></purse>
</testwmpurse>
</w3s.response>
*/
import (
"encoding/xml"
)
// request
type TestWmPurse struct {
XMLName xml.Name `xml:"testwmpurse"`
Wmid string `xml:"wmid"`
Purse string `xml:"purse"`
}
func (t TestWmPurse) GetSignSource(reqn string) (string, error) {
return t.Wmid + t.Purse, nil
}
type TestWmPurseResponse struct {
XMLName xml.Name `xml:"testwmpurse"`
Wmid Wmid `xml:"wmid"`
Purse ReturnedPurse `xml:"purse"`
}
type ReturnedPurse struct {
XMLName xml.Name `xml:"purse"`
Value string `xml:",chardata"`
MerchantActiveMode string `xml:"merchant_active_mode,attr"`
MerchantAllowCashier string `xml:"merchant_allow_cashier,attr"`
BlockedinByPT string `xml:"blockedinByPT,attr"`
ByPTLimit string `xml:"ByPTLimit,attr"`
Deleted_flag string `xml:"deleted_flag,attr"`
}
type Wmid struct {
XMLName xml.Name `xml:"wmid"`
Value string `xml:",chardata"`
Available string `xml:"available,attr"`
Themselfcorrstate string `xml:"themselfcorrstate,attr"`
Newattst string `xml:"newattst,attr"`
Pasdoc string `xml:"pasdoc,attr"`
Blockedin string `xml:"blockedin"`
Blockedout string `xml:"blockedout"`
}
func (w *WmClient) FindWmidPurse(t TestWmPurse) (TestWmPurseResponse, error) {
X := W3s{
Interface: XInterface{Name: "FindWMPurseNew", Type: "w3s"},
Request: t,
Client: w,
}
result := TestWmPurseResponse{}
X.getResult(&result)
return result, nil
}