| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- package com.izouma.nineth.service;
- import com.alibaba.fastjson.JSON;
- import com.alibaba.fastjson.serializer.SerializerFeature;
- import com.huifu.adapay.core.exception.BaseAdaPayException;
- import com.huifu.adapay.model.Payment;
- import com.izouma.nineth.ApplicationTests;
- import org.junit.Test;
- import org.springframework.beans.factory.annotation.Autowired;
- import java.math.BigDecimal;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- public class AdapayServiceTest extends ApplicationTests {
- @Autowired
- private AdapayService adapayService;
- @Test
- public void testPay() throws BaseAdaPayException {
- Map<String, Object> paymentParams = new HashMap<String, Object>(10);
- List<Map<String, Object>> divMembers = new ArrayList<>();
- divMembers.add(new HashMap<>() {{
- put("member_id", "0");
- put("amount", BigDecimal.valueOf(0.05));
- put("fee_flag", "Y");
- }});
- divMembers.add(new HashMap<>() {{
- put("member_id", "1110");
- put("amount", BigDecimal.valueOf(0.05));
- }});
- paymentParams.put("app_id", "app_f8760acc-f4d8-46f6-8f70-d80e36517075");
- paymentParams.put("order_no", "jsdk_payment" + System.currentTimeMillis());
- paymentParams.put("pay_channel", "wx_pub");
- paymentParams.put("pay_amt", "0.10");
- paymentParams.put("goods_title", "your goods title");
- paymentParams.put("goods_desc", "your goods desc");
- paymentParams.put("div_members", JSON.toJSONString(divMembers));
- paymentParams.put("notify_url", "http://9th.frp.izouma.com/notify/adapay/order/1");
- paymentParams.put("description", "orderId=1");
- Map<String, Object> expend = new HashMap<>();
- expend.put("open_id", "oWJG55wLnwdVzXoKka1-DzQKOd_Y");
- paymentParams.put("expend", expend);
- Map<String, Object> payment = Payment.create(paymentParams);
- System.out.println("payment result=" + JSON.toJSONString(payment, SerializerFeature.PrettyFormat));
- }
- @Test
- public void createMember() throws BaseAdaPayException {
- adapayService.createMember(99999999999999L, "15077886171", "熊竹", "321002199408304614");
- }
- @Test
- public void createSettleAccount() throws BaseAdaPayException {
- adapayService.createSettleAccount("99999999999999", "熊竹", "321002199408304614",
- "15077886171", "6222024301070380163");
- }
- @Test
- public void delSettleAccount() throws BaseAdaPayException {
- adapayService.delSettleAccount("99999999999999", "0288070028826880");
- }
- @Test
- public void queryBalance() throws BaseAdaPayException {
- adapayService.queryBalance("1110", "0288514678171392");
- }
- }
|