Skip to content

Commit

Permalink
use alipay response code to decide result
Browse files Browse the repository at this point in the history
  • Loading branch information
wuqunlin committed May 27, 2017
1 parent c2c1621 commit ca7a3ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions const.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ const (
FixCharset = "utf-8"
FixVersion = "1.0"
FixSignType = "RSA2"

// https://doc.open.alipay.com/docs/doc.htm?treeId=291&articleId=105806&docType=1
// TODO:返回码根据文档统一处理,供外部调用解析
SUCCESS_CODE = "10000"
)
8 changes: 4 additions & 4 deletions trade_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type VoucherDetail struct {
}

func (this *AliPayTradeQueryResponse) IsSuccess() bool {
if this.AliPayTradeQuery.Msg == "Success" {
if this.AliPayTradeQuery.Code == SUCCESS_CODE {
return true
}
return false
Expand Down Expand Up @@ -174,7 +174,7 @@ type AliPayTradeRefundResponse struct {
}

func (this *AliPayTradeRefundResponse) IsSuccess() bool {
if this.AliPayTradeRefund.Msg == "Success" {
if this.AliPayTradeRefund.Code == SUCCESS_CODE {
return true
}
return false
Expand Down Expand Up @@ -224,7 +224,7 @@ type AliPayFastpayTradeRefundQueryResponse struct {
}

func (this *AliPayFastpayTradeRefundQueryResponse) IsSuccess() bool {
if this.AliPayTradeFastpayRefundQueryResponse.Msg == "Success" {
if this.AliPayTradeFastpayRefundQueryResponse.Code == SUCCESS_CODE {
return true
}
return false
Expand Down Expand Up @@ -408,7 +408,7 @@ type AliPayTradePayResponse struct {
}

func (this *AliPayTradePayResponse) IsSuccess() bool {
if this.AliPayTradePay.Msg == "Success" {
if this.AliPayTradePay.Code == SUCCESS_CODE {
return true
}
return false
Expand Down

0 comments on commit ca7a3ea

Please sign in to comment.