修改paypal支付配置
This commit is contained in:
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.peanut.modules.common.entity.BuyOrder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
@@ -12,25 +14,17 @@ import java.util.*;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@PropertySource(value = "classpath:application.yml") //读取配置文件
|
||||
public class PaypalConfig {
|
||||
|
||||
//沙盒
|
||||
public static final String modeUrl = "https://api-m.sandbox.paypal.com";
|
||||
public static final String CLIENID ="Ab8SeEuhkLGp6Fts9V3Cti0UcXQhITRWZkiHDM3U1fDY9YrrRc5IOcYHPfV6qROhmh0hvgysqrfOCSUr";
|
||||
public static final String SECRET ="EF63FGWI9fd4q07Ndvc_h8P7jxiZcGOWn8Ul_y1_EKpluKJNFHOW8BP62Kf1wBDQ3XYIeqF8_kVrDF7C";
|
||||
public static final String WEBSCR ="https://www.sandbox.paypal.com/cgi-bin/webscr";//回调验证地址
|
||||
//sb-in47yk34022562@personal.example.com
|
||||
//p#54df;P
|
||||
|
||||
//sb-n2lz015338486@business.example.com
|
||||
//4lnAJn.G
|
||||
|
||||
//正式
|
||||
// public static final String modeUrl = "https://api-m.paypal.com";
|
||||
// public static final String CLIENID ="";
|
||||
// public static final String SECRET ="";
|
||||
// public static final String WEBSCR ="https://www.paypal.com/cgi-bin/webscr";
|
||||
|
||||
@Value("${paypal.modeUrl}")
|
||||
private String modeUrl;
|
||||
@Value("${paypal.CLIENID}")
|
||||
private String CLIENID;
|
||||
@Value("${paypal.SECRET}")
|
||||
private String SECRET;
|
||||
@Value("${paypal.WEBSCR}")
|
||||
private String WEBSCR;
|
||||
|
||||
public static final String accessTokenURL = "/v1/oauth2/token";
|
||||
public static final String createOrderURL = "/v2/checkout/orders";
|
||||
@@ -39,8 +33,6 @@ public class PaypalConfig {
|
||||
public static final String refundURL = "/v2/payments/captures/%1s/refund";
|
||||
public static final String refundInfoURL = "/v2/payments/refunds/";
|
||||
|
||||
|
||||
|
||||
//回调验证
|
||||
public String receiveVerify(String verifyData) throws Exception{
|
||||
URL url = new URL(WEBSCR);
|
||||
@@ -133,7 +125,7 @@ public class PaypalConfig {
|
||||
}catch (Exception e) {
|
||||
log.error(">>>>>>>>>>:PayPal扣款失败 reason = {}", e.getMessage());
|
||||
e.printStackTrace();
|
||||
return JSONObject.parseObject("{'error':'PayPal扣款失败,请联系管理员'}");
|
||||
return JSONObject.parseObject("{'error':'PayPal Deduction failed'}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +173,7 @@ public class PaypalConfig {
|
||||
}catch (Exception e) {
|
||||
log.error(">>>>>>>>>>:PayPal创建订单网络连接失败 reason = {}", e.getMessage());
|
||||
e.printStackTrace();
|
||||
return JSONObject.parseObject("{'error':'PayPal创建订单网络连接失败,请联系管理员'}");
|
||||
return JSONObject.parseObject("{'error':'PayPal Failed to create order network connection'}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,3 +90,13 @@ wxpay:
|
||||
|
||||
redisAddress: redis://47.93.127.115:6379
|
||||
redisPassword: Jgll2015
|
||||
|
||||
paypal:
|
||||
modeUrl: https://api-m.sandbox.paypal.com
|
||||
CLIENID: AQkg_c8PaJBDymgPEHw73rzaVyPvIQS-wgku0QeK-SrzXqLzQKmhzrLiV7861rqFUOgXO6eAbYMp3LDc
|
||||
SECRET: EBZLhPpW9L-MqB2TYUDCbIHqgTy7HCgjZzlUztVcY8dCoSVta3gr7oUTyv04dr9GG8-dp-ul7UAeP2Hm
|
||||
WEBSCR: https://www.sandbox.paypal.com/cgi-bin/webscr
|
||||
#sb-jmwzq36331220@personal.example.com
|
||||
# gnO)bN1V
|
||||
#sb-vsgku36351028@business.example.com
|
||||
# aP1#jU51
|
||||
@@ -91,3 +91,13 @@ wxpay:
|
||||
|
||||
redisAddress: redis://13.215.57.194:6379
|
||||
redisPassword: Jgll2015
|
||||
|
||||
paypal:
|
||||
modeUrl: https://api-m.paypal.com
|
||||
CLIENID: ATpnbatZQMNKiDpWiXAUp9MWlvqkA6B37F_Evrh2EkC8H0xZJMkCTqwMYvzw_V__v52uaUE1H9mRtnN8
|
||||
SECRET: EGfILHvnvLUZ8dzWPa8J3DG35j4K7X8Oe4YAcTjm9oDVkbJSpnvThOUESy6NbuFlME7UTjI-EhxXYIZf
|
||||
WEBSCR: https://www.paypal.com/cgi-bin/webscr
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ server:
|
||||
|
||||
connection-timeout: 6000000ms
|
||||
spring:
|
||||
# 环境 dev/dev1|test|prod
|
||||
# 环境 dev|prod
|
||||
profiles:
|
||||
active: dev
|
||||
# jackson时间格式化
|
||||
|
||||
@@ -209,7 +209,7 @@
|
||||
<!-- </root>-->
|
||||
|
||||
<!-- <!– 4.2 生产环境:输出到文档–>-->
|
||||
<springProfile name="aws">
|
||||
<springProfile name="prod">
|
||||
<logger name="com.peanut" level="ERROR" additivity="false">
|
||||
<!-- <appender-ref ref="DEBUG_FILE"/>-->
|
||||
<appender-ref ref="ERROR_FILE"/>
|
||||
|
||||
Reference in New Issue
Block a user