修复拉卡拉退款成功状态识别
This commit is contained in:
@@ -612,17 +612,21 @@ func normalizePaymentStatus(raw map[string]string) string {
|
||||
|
||||
func normalizeRefundStatus(raw map[string]string) string {
|
||||
value := strings.ToUpper(firstNonEmpty(raw["refund_status"], raw["trade_state"], raw["trade_status"], raw["status"]))
|
||||
if value == "" && responseOK(raw) {
|
||||
return "refunded"
|
||||
}
|
||||
switch value {
|
||||
case "SUCCESS", "REFUND_SUCCESS", "TRADE_SUCCESS", "REFUNDED", "S", "11":
|
||||
return "refunded"
|
||||
case "FAIL", "FAILED", "REFUND_FAIL", "TRADE_FAIL", "F", "12":
|
||||
return "failed"
|
||||
default:
|
||||
return "refunding"
|
||||
}
|
||||
if hasSuccessResponseCode(raw) {
|
||||
return "refunded"
|
||||
}
|
||||
return "refunding"
|
||||
}
|
||||
|
||||
func hasSuccessResponseCode(raw map[string]string) bool {
|
||||
code := firstNonEmpty(raw["code"], raw["resp_code"], raw["result_code"], raw["return_code"])
|
||||
return code != "" && responseOK(raw)
|
||||
}
|
||||
|
||||
func responseOK(raw map[string]string) bool {
|
||||
|
||||
Reference in New Issue
Block a user