ManualHandlerApi.java 1.27 KB
package com.diligrp.cashier.mall.api;

import com.diligrp.cashier.shared.domain.Message;
import com.diligrp.cashier.shared.spi.IPaymentEventListener;
import com.diligrp.cashier.shared.spi.domain.PaymentResultBO;
import com.diligrp.cashier.shared.spi.domain.RefundResultBO;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName ManualHandlerApi.java
 * @author dengwei
 * @version 1.0.0
 * @Description ManualHandlerApi
 */
@RestController
@RequestMapping(path = "/mall/manual")
@Validated
public class ManualHandlerApi {
    @Resource
    private IPaymentEventListener payNotifyServiceImpl;

    @PostMapping("/payment/event")
    public Message<?> handlePaymentEvent(@RequestBody PaymentResultBO payment) {
        payNotifyServiceImpl.onEvent(payment);
        return Message.success();
    }

    @PostMapping("/refund/event")
    public Message<?> handlePaymentEvent(@RequestBody RefundResultBO refund) {
        payNotifyServiceImpl.onEvent(refund);
        return Message.success();
    }

}