支持客服主动发起申诉
This commit is contained in:
@@ -74,10 +74,12 @@ type AdminActionDTO struct {
|
||||
}
|
||||
|
||||
type ActiveDisputeDTO struct {
|
||||
ID uint64 `json:"id"`
|
||||
InitiatorID uint64 `json:"initiator_id"`
|
||||
Type string `json:"type"`
|
||||
Status string `json:"status"`
|
||||
ID uint64 `json:"id"`
|
||||
InitiatorID uint64 `json:"initiator_id"`
|
||||
InitiatorType string `json:"initiator_type"`
|
||||
InitiatorAdminID *uint64 `json:"initiator_admin_id,omitempty"`
|
||||
Type string `json:"type"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type CreateRequest struct {
|
||||
|
||||
@@ -336,7 +336,9 @@ func (r *Repository) AdminPlatformCheckoutDispute(ctx context.Context, adminID u
|
||||
beforeSettlementStatus := order.SettlementStatus
|
||||
row := model.Dispute{
|
||||
OrderID: order.ID,
|
||||
InitiatorID: adminID,
|
||||
InitiatorID: 0,
|
||||
InitiatorType: "admin",
|
||||
InitiatorAdminID: &adminID,
|
||||
TargetUserID: order.RenterID,
|
||||
Type: "checkout_dispute",
|
||||
Status: "open",
|
||||
|
||||
@@ -203,13 +203,22 @@ func (r *Repository) activeDisputeDTO(ctx context.Context, orderID uint64) *Acti
|
||||
return nil
|
||||
}
|
||||
return &ActiveDisputeDTO{
|
||||
ID: row.ID,
|
||||
InitiatorID: row.InitiatorID,
|
||||
Type: row.Type,
|
||||
Status: row.Status,
|
||||
ID: row.ID,
|
||||
InitiatorID: row.InitiatorID,
|
||||
InitiatorType: effectiveDisputeInitiatorType(row),
|
||||
InitiatorAdminID: row.InitiatorAdminID,
|
||||
Type: row.Type,
|
||||
Status: row.Status,
|
||||
}
|
||||
}
|
||||
|
||||
func effectiveDisputeInitiatorType(row model.Dispute) string {
|
||||
if row.InitiatorType == "admin" {
|
||||
return "admin"
|
||||
}
|
||||
return "user"
|
||||
}
|
||||
|
||||
func shouldAttachCheckout(status string) bool {
|
||||
switch status {
|
||||
case orderStatusPendingCheckoutConfirm, orderStatusPendingCheckoutAccept, orderStatusCheckoutDisputing, orderStatusCompleted:
|
||||
|
||||
@@ -1068,7 +1068,7 @@ func TestAdminPlatformCheckoutDisputeCreatesArbitrationCase(t *testing.T) {
|
||||
if err := db.Where("order_id = ?", order.ID).First(&dispute).Error; err != nil {
|
||||
t.Fatalf("load dispute failed: %v", err)
|
||||
}
|
||||
if dispute.InitiatorID != adminID || dispute.TargetUserID != renter.ID || dispute.Type != "checkout_dispute" {
|
||||
if dispute.InitiatorID != 0 || dispute.InitiatorType != "admin" || dispute.InitiatorAdminID == nil || *dispute.InitiatorAdminID != adminID || dispute.TargetUserID != renter.ID || dispute.Type != "checkout_dispute" {
|
||||
t.Fatalf("dispute = %#v, want admin initiated checkout dispute to renter", dispute)
|
||||
}
|
||||
if dispute.CheckoutID == nil || *dispute.CheckoutID != checkout.ID || dispute.PreviousCheckoutStatus != checkoutStatusSubmitted {
|
||||
|
||||
Reference in New Issue
Block a user