-
Notifications
You must be signed in to change notification settings - Fork 10
/
x20.go
65 lines (55 loc) · 1.86 KB
/
x20.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
package webmoney
type X20Request struct {
merchantRequest
LmiPayeePurse string `xml:"lmi_payee_purse"`
LmiPaymentNo string `xml:"lmi_payment_no"`
LmiPaymentNoType string `xml:"lmi_payment_no_type"`
LmiPaymentAmount string `xml:"lmi_payment_amount"`
LmiPaymentDesc string `xml:"lmi_payment_desc"`
LmiPaymentDescBase64 string `xml:"lmi_payment_desc_base64"`
LmiClientnumber string `xml:"lmi_clientnumber"`
LmiClientnubmerType string `xml:"lmi_clientnumber_type"`
LmiSmsType string `xml:"lmi_sms_type"`
LmiShopId string `xml:"lmi_shop_id"`
LmiHold string `xml:"LMI_HOLD"`
Lang string `xml:"lang"`
EnulatedFlag string `xml:"emulated_flag"`
}
func (x X20Request) GetSignSource(s string) (string, error) {
return x.LmiPayeePurse + x.LmiPaymentNo + x.LmiClientnumber + x.LmiClientnubmerType, nil
}
type X202Request struct {
merchantRequest
LmiPayeePurse string `xml:"lmi_payee_purse"`
LmiClientnumberCode string `xml:"lmi_clientnumber_code"`
LmiWminvoiceid string `xml:"lmi_wminvoiceid"`
}
func (x X202Request) GetSignSource(s string) (string, error) {
return x.LmiPayeePurse + x.LmiWminvoiceid + x.LmiClientnumberCode, nil
}
func (w *WmClient) TransRequest(x X20Request) (MerchantOperation, error) {
X := Merchant{
Request: &x,
Interface: XInterface{Name: "TransRequest", Type: "merchant"},
Client: w,
}
result := struct {
merchantResponse
Operation MerchantOperation
}{}
err := X.getResult(&result)
return result.Operation, err
}
func (w *WmClient) TransConfirm(x X202Request) (MerchantOperation, error) {
X := Merchant{
Request: &x,
Interface: XInterface{Name: "TransConfirm", Type: "merchant"},
Client: w,
}
result := struct {
merchantResponse
Operation MerchantOperation
}{}
err := X.getResult(&result)
return result.Operation, err
}