package org.springblade.payment.plugin;

import org.springblade.core.tool.api.R;
import org.springblade.payment.entity.PayParam;

import javax.servlet.http.HttpServletRequest;

/**
 * @author July
 * @version 1.0.0
 * @ClassName Withdraw.java
 * @Description 提现插件抽象层
 * @createTime 2021年10月22日 16:24:00
 */
public interface Withdraw {
	String CALLBACK_DOMAIN = "https://ldt.guosen-fumao.cn/api";

	String CALLBACK_PREFIX = "/withdraw/callback/";
	String CSURL_PREFIX = "/withdraw/csurl/";

	/**
	 * 积分提现回调
	 */
	void callback(HttpServletRequest request);

	/**
	 * 余额提现回调
	 */
	void csUrl(HttpServletRequest request);

	/**
	 * 用户提现
	 *
	 * @param payParam
	 * @return
	 */
	R userWithdraw(PayParam payParam);

	/**
	 * 用户积分提现
	 */
	R userPointWithdraw(PayParam payParam);

	/**
	 * 获取回调地址
	 */
	default String callbackUrl(String paymentType) {
		return CALLBACK_DOMAIN + CALLBACK_PREFIX + paymentType;
	}

	/**
	 * 获取回调地址
	 */
	default String csUrl(String paymentType) {
		return CALLBACK_DOMAIN + CSURL_PREFIX + paymentType;
	}
}
