提交修改
This commit is contained in:
parent
9cc960158f
commit
b90f3886ef
@ -5,6 +5,7 @@ package com.heyu.api.jsapi;
|
||||
import com.heyu.api.jsapi.dto.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -28,12 +29,22 @@ public class JsapiPrepay {
|
||||
|
||||
private static String PATH = "/v3/pay/transactions/jsapi";
|
||||
|
||||
@Value("${eb.config.weixin.pay.appid}")
|
||||
private String appid;
|
||||
|
||||
@Value("${eb.config.weixin.pay.mchid}")
|
||||
private String mchid;
|
||||
|
||||
private String certificateSerialNo;
|
||||
private PrivateKey privateKey;
|
||||
private String wechatPayPublicKeyId;
|
||||
private PublicKey wechatPayPublicKey;
|
||||
|
||||
|
||||
@Value("${eb.config.weixin.pay.notifyUrl}")
|
||||
private String notifyUrl;
|
||||
|
||||
|
||||
public JsapiPrepay() {
|
||||
|
||||
}
|
||||
@ -46,40 +57,31 @@ public class JsapiPrepay {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public DirectAPIv3JsapiPrepayResponse prePay(){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public DirectAPIv3JsapiPrepayResponse prePay(String tradeOrderId,
|
||||
String skuInfo,
|
||||
Long amount,
|
||||
String openid,
|
||||
Long quantity
|
||||
) {
|
||||
DirectAPIv3JsapiPrepayRequest request = new DirectAPIv3JsapiPrepayRequest();
|
||||
request.setAppid("wx75fa59c097bd3dfd");
|
||||
request.setMchid("1731491745");
|
||||
request.setNotifyUrl("https://api.1024api.com/api-interface/app/weixin/payNotify");
|
||||
request.setAppid(appid);
|
||||
request.setMchid(mchid);
|
||||
request.setNotifyUrl(notifyUrl);
|
||||
|
||||
|
||||
|
||||
request.setDescription("Image形象店-深圳腾大-QQ公仔");
|
||||
request.setOutTradeNo("121775250");
|
||||
request.setDescription(skuInfo);
|
||||
request.setOutTradeNo(tradeOrderId);
|
||||
request.setTimeExpire(WXPayUtility.generateExpireTime()); // 2025-11-05T21:02:16+08:00
|
||||
request.setAttach("自定义数据说明");
|
||||
|
||||
request.setGoodsTag("WXG");
|
||||
request.setSupportFapiao(false);
|
||||
|
||||
|
||||
CommonAmountInfo commonAmountInfo = new CommonAmountInfo();
|
||||
commonAmountInfo.setTotal(5L);
|
||||
commonAmountInfo.setTotal(amount);
|
||||
commonAmountInfo.setCurrency("CNY");
|
||||
request.setAmount(commonAmountInfo);
|
||||
|
||||
JsapiReqPayerInfo payer = new JsapiReqPayerInfo();
|
||||
payer.setOpenid("o6t1512tT-JuBeT6rIu6RhF Gf3BQ");
|
||||
payer.setOpenid(openid);
|
||||
request.setPayer(payer);
|
||||
|
||||
CouponInfo couponInfo = new CouponInfo();
|
||||
@ -93,8 +95,9 @@ public class JsapiPrepay {
|
||||
goodsDetailItem.setMerchantGoodsId("1246464644");
|
||||
goodsDetailItem.setWechatpayGoodsId("1001");
|
||||
goodsDetailItem.setGoodsName("iPhoneX 256G");
|
||||
goodsDetailItem.setQuantity(1L);
|
||||
goodsDetailItem.setQuantity(quantity);
|
||||
goodsDetailItem.setUnitPrice(528800L);
|
||||
|
||||
goodsDetails.add(goodsDetailItem);
|
||||
couponInfo.setGoodsDetail(goodsDetails);
|
||||
|
||||
@ -103,6 +106,7 @@ public class JsapiPrepay {
|
||||
sceneInfo.setDeviceId("013467007045764");
|
||||
|
||||
StoreInfo setstoreInfo = new StoreInfo();
|
||||
|
||||
setstoreInfo.setId("0001");
|
||||
setstoreInfo.setName("腾讯大厦分店");
|
||||
setstoreInfo.setAreaCode("440305");
|
||||
@ -115,13 +119,7 @@ public class JsapiPrepay {
|
||||
sceneInfo.setStoreInfo(setstoreInfo);
|
||||
request.setSettleInfo(settleInfo);
|
||||
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -44,9 +44,8 @@ public class TestJSAPI {
|
||||
request.setAmount(commonAmountInfo);
|
||||
|
||||
JsapiReqPayerInfo payer = new JsapiReqPayerInfo();
|
||||
payer.setOpenid("o6t1512tT-JuBeT6rIu6RhF Gf3BQ");
|
||||
payer.setOpenid("o6t1512tT-JuBeT6rIu6RhFGf3BQ");
|
||||
request.setPayer(payer);
|
||||
|
||||
CouponInfo couponInfo = new CouponInfo();
|
||||
|
||||
couponInfo.setCostPrice(608800L);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user