package com.diaoyun.zion.chinafrica.controller;

import com.diaoyun.zion.chinafrica.service.PayPalService;
import com.diaoyun.zion.master.base.Result;
import com.egzosn.pay.common.api.PayService;
import com.egzosn.pay.common.bean.MethodType;
import com.egzosn.pay.common.bean.PayOrder;
import com.egzosn.pay.common.http.HttpConfigStorage;
import com.egzosn.pay.paypal.api.PayPalConfigStorage;
import com.egzosn.pay.paypal.api.PayPalPayService;
import com.egzosn.pay.paypal.bean.PayPalTransactionType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Map;
import java.util.UUID;


/**
 * PayPal支付
 */
@RestController
@RequestMapping("/paypal")
public class PayPalController {

    @Autowired
    private PayPalService payPalService;

    @PostMapping ("/pay")
    public Result payForOrder(@RequestParam("orderId") String orderId){

        return payPalService.payForOrder(orderId);
    }

    @GetMapping("/success")
    public Result payForSuccess(HttpServletRequest request,@RequestParam("orderId") String orderId){

        return payPalService.payForSuccess(request,orderId);
    }


    @GetMapping("/cancel")
    public Result cancelPay(){

        return new Result().setMessage("订单支付已取消");
    }

}
