package org.springblade.common.utils;

import org.springblade.core.tool.api.IResultCode;
import org.springblade.core.tool.api.ResultCode;
import org.springblade.payment.entity.SuccessParams;

/**
 * @author July
 * @version 1.0.0
 * @ClassName TradeException.java
 * @Description 交易异常处理
 * @createTime 2021年11月01日 11:22:00
 */
public class TradeException extends RuntimeException {
	private static final long serialVersionUID = 2359767895161832954L;
	private final IResultCode resultCode;
	private final SuccessParams successParams;

	public TradeException(String message, SuccessParams successParams) {
		super(message);
		this.successParams = successParams;
		this.resultCode = ResultCode.FAILURE;
	}

	public TradeException(IResultCode resultCode, SuccessParams successParams) {
		super(resultCode.getMessage());
		this.resultCode = resultCode;
		this.successParams = successParams;
	}

	public TradeException(IResultCode resultCode, Throwable cause, SuccessParams successParams) {
		super(cause);
		this.resultCode = resultCode;
		this.successParams = successParams;
	}

	public Throwable fillInStackTrace() {
		return this;
	}

	public Throwable doFillInStackTrace() {
		return super.fillInStackTrace();
	}

	public IResultCode getResultCode() {
		return this.resultCode;
	}

	public SuccessParams getSuccessParams() {
		return successParams;
	}
}
