package com.ywt.alipaympapi.face.impl;

import com.alipay.api.domain.AlipayTradeCreateModel;
import com.alipay.api.domain.AlipayTradeQueryModel;
import com.alipay.api.request.AlipayTradeCreateRequest;
import com.alipay.api.request.AlipayTradeQueryRequest;
import com.alipay.api.response.AlipayTradeCreateResponse;
import com.alipay.api.response.AlipayTradeQueryResponse;
import com.ywt.alipaympapi.face.IAlipayService;
import com.ywt.alipaympapi.face.IPayFace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PayFace implements IPayFace {
    @Autowired
    private IAlipayService alipayService;

    @Override
    public AlipayTradeCreateResponse tradeCreate(String appId, AlipayTradeCreateModel alipayTradeCreateModel) {
        AlipayTradeCreateRequest request = new AlipayTradeCreateRequest();
        request.setBizModel(alipayTradeCreateModel);
        return alipayService.execute(appId, request);
    }

    @Override
    public AlipayTradeQueryResponse tradeQuery(String appId, AlipayTradeQueryModel alipayTradeQueryModel) {
        AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
        request.setBizModel(alipayTradeQueryModel);
        return alipayService.execute(appId, request);

    }
}
