package com.greenorange.promotion.service.wechat;

import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
import com.wechat.pay.java.service.payments.model.Transaction;
import com.wechat.pay.java.service.refund.model.Refund;
import com.wechat.pay.java.service.refund.model.RefundNotification;
import jakarta.servlet.http.HttpServletRequest;

import java.io.IOException;
import java.math.BigDecimal;

/**
 * @author 陈新知
 */
public interface WechatPayService {

    /**
     * 微信支付
     */
    PrepayWithRequestPaymentResponse createPayment(String orderId, String miniOpenId, BigDecimal amount);


    /**
     * 支付回调
     */
    boolean paymentCallback(Transaction transaction) throws IOException;


    /**
     * 部分退款申请
     */
    Refund refundPartPayment(String orderId, BigDecimal refundAmount);


    /**
     * 部分退款回调
     */
    boolean refundPartCallback(RefundNotification refundNotification);


    /**
     * 获取支付回调信息
     */
    Transaction getTransactionInfo(HttpServletRequest request);


    /**
     * 获取退款回调信息
     */
    RefundNotification getRefundInfo(HttpServletRequest request);


}
