1、接入paypal
2、修改支付宝支付
This commit is contained in:
@@ -9,6 +9,7 @@ import org.springframework.util.CollectionUtils;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -17,6 +18,10 @@ public class RedisUtil {
|
||||
@Resource
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
public Boolean hasKey(String key){
|
||||
return redisTemplate.hasKey(key);
|
||||
}
|
||||
|
||||
//- - - - - - - - - - - - - - - - - - - - - ZSet类型 - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
/**
|
||||
@@ -123,4 +128,14 @@ public class RedisUtil {
|
||||
public Long removeFromMap(String key, String hashKeys) {
|
||||
return redisTemplate.opsForHash().delete(key, hashKeys);
|
||||
}
|
||||
|
||||
//- - - - - - - - - - - - - - - - - - - - - String类型 - - - - - - - - - - - - - - - - - - - -
|
||||
public void addToString(String key, String value, Long expiresIn){
|
||||
redisTemplate.opsForValue().set(key,value,expiresIn, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public String getFromString(String key){
|
||||
return redisTemplate.opsForValue().get(key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ai.da.common.utils.paypalRequest;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.paypal.http.HttpRequest;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Component
|
||||
public class AuthenticationRequest extends HttpRequest<HashMap> {
|
||||
|
||||
public AuthenticationRequest() {
|
||||
super("/v1/oauth2/token", "POST", HashMap.class);
|
||||
this.header("Content-Type", "application/x-www-form-urlencoded");
|
||||
body();
|
||||
}
|
||||
|
||||
public AuthenticationRequest authorization(String clientId, String clientSecret) {
|
||||
this.header(clientId, clientSecret);
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuthenticationRequest body() {
|
||||
HashMap<String, String> body = new HashMap<>();
|
||||
body.put("grant_type", "client_credentials");
|
||||
this.requestBody(body);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ai.da.common.utils.paypalRequest;
|
||||
|
||||
import com.ai.da.model.dto.WebhookVerifyDTO;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.paypal.http.HttpRequest;
|
||||
import com.paypal.orders.OrdersCreateRequest;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class WebhookVerifyRequest extends HttpRequest<HashMap> {
|
||||
public WebhookVerifyRequest() {
|
||||
super("/v1/notifications/verify-webhook-signature", "POST", HashMap.class);
|
||||
this.header("Content-Type", "application/json");
|
||||
}
|
||||
|
||||
public WebhookVerifyRequest authorization(String authorization) {
|
||||
this.header("Authorization", "Bearer " + String.valueOf(authorization));
|
||||
return this;
|
||||
}
|
||||
|
||||
public WebhookVerifyRequest requestBody(HashMap<String,String> webhookVerify) {
|
||||
super.requestBody(webhookVerify);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user