forked from smartwalle/alipay
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18deeb6
commit 4a647ab
Showing
2 changed files
with
9 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,30 @@ | ||
package alipay | ||
|
||
import ( | ||
"io/ioutil" | ||
"strings" | ||
"net/http" | ||
"net/url" | ||
) | ||
|
||
// TradeWapPay https://doc.open.alipay.com/docs/api.htm?spm=a219a.7395905.0.0.stK0ff&docType=4&apiId=1046 | ||
func (this *AliPay) TradeWapPay(param AliPayTradeWapPay) (html string, url *url.URL, err error) { | ||
func (this *AliPay) TradeWapPay(param AliPayTradeWapPay) (url *url.URL, err error) { | ||
var buf = strings.NewReader(this.URLValues(param).Encode()) | ||
|
||
req, err := http.NewRequest("POST", this.apiDomain, buf) | ||
if err != nil { | ||
return "", nil, err | ||
return nil, err | ||
} | ||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded;charset=utf-8") | ||
|
||
rep, err := this.client.Do(req) | ||
if err != nil { | ||
return "", nil, err | ||
return nil, err | ||
} | ||
defer rep.Body.Close() | ||
|
||
data, err := ioutil.ReadAll(rep.Body) | ||
if err != nil { | ||
return "", nil, err | ||
return nil, err | ||
} | ||
html = string(data) | ||
url = rep.Request.URL | ||
return html, url, err | ||
return url, err | ||
} |