优化结构

This commit is contained in:
Yvan
2026-08-27 22:33:43 +08:00
parent 5052835fcb
commit e407d3ac10
86 changed files with 3151 additions and 726 deletions
+29
View File
@@ -133,6 +133,35 @@ func (a *vendorPaymentAdapter) call(ctx context.Context, endpointKey string, pay
}
result := &bizpayment.PaymentResult{Provider: a.provider, Status: "created", TradeNo: tradeNo, Payload: ensureJSON(body)}
if endpointKey != "query_url" {
if object := jsonObject(body); object != nil {
operation := strings.TrimSuffix(endpointKey, "_url")
statusField := text(c, operation+"_status_field")
if statusField == "" {
statusField = text(c, "query_status_field")
}
state := ""
if statusField != "" {
state = stringAtPath(object, statusField)
}
if state == "" {
for _, key := range []string{"status", "trade_status", "order_status", "pay_status", "refund_status"} {
if value := stringAtPath(object, key); value != "" {
state = value
break
}
}
}
if state != "" {
switch {
case containsFold(configuredValues(c, operation+"_failure_values"), state):
result.Status = "failed"
case containsFold(configuredValues(c, operation+"_success_values"), state):
result.Status = "created"
default:
result.Status = normalizePaymentStatus(state, "created")
}
}
}
return result, nil
}
object := jsonObject(body)