package com.izouma.nineth;

import com.alibaba.fastjson.JSON;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.huifu.adapay.model.Payment;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

public class AdapayTest extends ApplicationTests {
    @Test
    public void testPay() throws BaseAdaPayException {
        Map<String, Object> paymentParams = new HashMap<String, Object>(10);
        paymentParams.put("app_id", "app_f8760acc-f4d8-46f6-8f70-d80e36517075");
        paymentParams.put("order_no", "jsdk_payment" + System.currentTimeMillis());
        paymentParams.put("pay_channel", "alipay_qr");
        paymentParams.put("pay_amt", "0.01");
        paymentParams.put("goods_title", "your goods title");
        paymentParams.put("goods_desc", "your goods desc");
        paymentParams.put("div_members", "");
        Map<String, Object> payment = Payment.create(paymentParams);
        System.out.println("payment result=" + JSON.toJSONString(payment));
    }
}
