matrix.business.pay.controller.ForwardPayController Maven / Gradle / Ivy
package matrix.business.pay.controller;
import matrix.boot.based.utils.WebUtil;
import matrix.business.pay.selector.PayTemplateSelector;
import matrix.business.pay.templates.AbstractTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
/**
* 转向接口,统一对外封装
*
* @author wangcheng
*/
@RestController
public class ForwardPayController {
/**
* 获取返回地址或信息
*
* @param name 模板名称
* @param payId 支付ID
* @return 地址或信息
* @throws IOException 异常
*/
@GetMapping("/forward-pay/{name}/{payId}")
public String pay(@PathVariable String name, @PathVariable String payId) throws IOException {
AbstractTemplate template = WebUtil.getBean(PayTemplateSelector.class).get(name);
return template.obtainSDKPayInfo(payId);
}
}