WxJava icon indicating copy to clipboard operation
WxJava copied to clipboard

Implement WeChat Mini Program complaint handling service with comprehensive API support

Open Copilot opened this issue 7 months ago • 0 comments

This PR implements a complete complaint handling service for WeChat Mini Programs, addressing the request for transaction complaint interfaces including message push notifications and query capabilities.

Features Added

Core Complaint Management APIs

  • Query complaint lists with pagination and date filtering
  • Get detailed complaint information including user contact details and order information
  • Query negotiation history to track complaint resolution progress
  • Submit responses to complaints with text content and image attachments
  • Mark complaints as completed when resolved

Notification Management

  • Create/update/delete notification callback URLs for real-time complaint updates
  • Query current notification settings for webhook management

File Upload Support

  • Upload response images with support for both File objects and InputStreams
  • Proper integration with WxJava's existing file upload patterns

Implementation Details

The implementation follows WxJava's established patterns and conventions:

// Example usage - setting up complaint notifications
WxMaComplaintService complaintService = wxMaService.getComplaintService();

// Set notification callback
WxMaComplaintNotifyUrlRequest notifyRequest = WxMaComplaintNotifyUrlRequest.newBuilder()
    .url("https://your-domain.com/complaint/notify")
    .build();
complaintService.addComplaintNotifyUrl(notifyRequest);

// Query recent complaints
WxMaComplaintRequest request = WxMaComplaintRequest.newBuilder()
    .beginDate("2025-01-01")
    .endDate("2025-01-31")
    .limit(20)
    .build();
WxMaComplaintResult complaints = complaintService.queryComplaints(request);

// Submit response with image
String mediaId = complaintService.uploadResponseImage(responseImage);
WxMaResponseRequest response = WxMaResponseRequest.newBuilder()
    .complaintId("complaint_123")
    .responseContent("We are processing your complaint...")
    .responseImages(Arrays.asList(mediaId))
    .build();
complaintService.submitResponse(response);

Technical Components

  • 10 bean classes for comprehensive request/response handling
  • WxMaComplaintService interface with 11 methods covering all complaint operations
  • WxMaComplaintServiceImpl implementation following project conventions
  • URL constants properly organized in WxMaApiUrlConstants.Complaint
  • Integration with main WxMaService interface via getComplaintService()

Quality Assurance

  • All builds pass successfully including full project compilation
  • Checkstyle validation passes with Google Java Style compliance
  • Proper error handling with WxErrorException integration
  • Comprehensive JavaDoc documentation
  • Follows existing WxJava patterns for consistency

This implementation provides merchants with complete tools to handle user complaints effectively, enabling automated notifications and comprehensive complaint tracking as requested in the original issue.

Fixes #3519.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot avatar Aug 31 '25 14:08 Copilot