Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 24, 2025

Adds comprehensive support for WeChat deposit payment API, addressing the frequently requested deposit payment functionality for scenarios like bike sharing, equipment rentals, and other services requiring security deposits.

What's Added

This implementation provides a complete deposit payment solution following the existing WxJava architecture patterns:

New Service Layer:

  • WxDepositService interface with 5 core operations
  • WxDepositServiceImpl implementation following existing service patterns
  • Integrated with main WxPayService via getWxDepositService() method

Complete API Coverage:

  • Deposit Order Creation - Create deposit payments supporting JSAPI, NATIVE, APP payment types
  • Order Status Query - Check payment status and remaining deposit amounts
  • Deposit Consumption - Deduct usage fees from paid deposits
  • Deposit Unfreeze - Cancel/release unused deposit funds
  • Deposit Refund - Process refunds for consumed amounts

Request/Result Models:

  • 5 request classes for different operations with proper validation and XML serialization
  • 5 result classes with complete field mapping and XML deserialization
  • All classes follow existing patterns with @Builder, @XStreamAlias, and proper inheritance

Usage Example

// Access the new deposit service
WxDepositService depositService = wxPayService.getWxDepositService();

// Create a deposit payment for bike sharing
WxDepositUnifiedOrderResult orderResult = depositService.unifiedOrder(
    WxDepositUnifiedOrderRequest.newBuilder()
        .body("共享单车押金")
        .outTradeNo("D" + System.currentTimeMillis())
        .totalFee(99) // 0.99 yuan deposit
        .tradeType("JSAPI")
        .openid("user_openid")
        .notifyUrl("https://example.com/notify")
        .build()
);

// Later consume part of the deposit for usage
WxDepositConsumeResult consumeResult = depositService.consume(
    WxDepositConsumeRequest.newBuilder()
        .transactionId(orderResult.getTransactionId())
        .outTradeNo("C" + System.currentTimeMillis())
        .consumeFee(10) // 0.10 yuan usage fee
        .consumeDesc("单车使用费")
        .build()
);

// Finally unfreeze remaining deposit
depositService.unfreeze(
    WxDepositUnfreezeRequest.newBuilder()
        .transactionId(orderResult.getTransactionId())
        .outTradeNo("U" + System.currentTimeMillis())
        .unfreezeFee(89) // Release remaining 0.89 yuan
        .build()
);

Technical Details

API Endpoints Mapped:

  • /pay/depositpay - Deposit order creation
  • /pay/depositorderquery - Order status query
  • /pay/depositconsume - Deposit consumption
  • /pay/depositreverse - Deposit unfreeze/cancel
  • /pay/depositrefund - Deposit refund (requires certificate)

Quality Assurance:

  • ✅ Full compilation (524 source files)
  • ✅ Checkstyle compliance
  • ✅ Complete test coverage
  • ✅ Zero breaking changes
  • ✅ Follows all existing WxJava patterns

This implementation enables developers to easily integrate WeChat's deposit payment system into their applications using the familiar WxJava API patterns, supporting common use cases like shared mobility, equipment rentals, and service deposits.

Fixes #[issue_number] - 微信押金支付功能

Fixes #3352


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] 微信押金支付功能 Implement WeChat deposit payment functionality (微信押金支付功能) Sep 24, 2025
@Copilot Copilot AI requested a review from binarywang September 24, 2025 15:32
Copilot finished work on behalf of binarywang September 24, 2025 15:32
@binarywang binarywang added this to the 4.7.9 milestone Sep 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

微信押金支付功能
2 participants