|
|
@ -1,8 +1,13 @@
|
|
|
|
package au.com.royalpay.payment.manage.ofei.core.impl;
|
|
|
|
package au.com.royalpay.payment.manage.ofei.core.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.dom4j.Element;
|
|
|
|
import org.dom4j.Element;
|
|
|
|
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
@ -10,6 +15,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.ofei.TopUpOrderMapper;
|
|
|
|
import au.com.royalpay.payment.manage.mappers.ofei.TopUpOrderMapper;
|
|
|
|
import au.com.royalpay.payment.manage.ofei.core.OfeiClient;
|
|
|
|
import au.com.royalpay.payment.manage.ofei.core.OfeiClient;
|
|
|
|
import au.com.royalpay.payment.manage.ofei.core.OfeiServer;
|
|
|
|
import au.com.royalpay.payment.manage.ofei.core.OfeiServer;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Created by wangning on 2017/12/8.
|
|
|
|
* Created by wangning on 2017/12/8.
|
|
|
@ -20,6 +26,8 @@ public class OfeiServceImpl implements OfeiServer {
|
|
|
|
private TopUpOrderMapper topUpOrderMapper;
|
|
|
|
private TopUpOrderMapper topUpOrderMapper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private OfeiClient ofeiClient;
|
|
|
|
private OfeiClient ofeiClient;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private StringRedisTemplate stringRedisTemplate;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkOrderForNotify(JSONObject param) {
|
|
|
|
public void checkOrderForNotify(JSONObject param) {
|
|
|
@ -74,4 +82,16 @@ public class OfeiServceImpl implements OfeiServer {
|
|
|
|
topUpOrderMapper.update(order);
|
|
|
|
topUpOrderMapper.update(order);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void phoneTopUp(String price, boolean quickTopUp, String topUpDelayTime, String phoneNumber) {
|
|
|
|
|
|
|
|
String reidsCheckCodeKey = "topup"+phoneNumber;
|
|
|
|
|
|
|
|
String value = stringRedisTemplate.boundValueOps(reidsCheckCodeKey).get();
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(value)) {
|
|
|
|
|
|
|
|
throw new ForbiddenException("A phone number can only be recharged in 10 minutes");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ofeiClient.phoneTopUp(price,quickTopUp,topUpDelayTime,phoneNumber);
|
|
|
|
|
|
|
|
String bindId = RandomStringUtils.random(6, false, true);
|
|
|
|
|
|
|
|
stringRedisTemplate.boundValueOps(reidsCheckCodeKey).set(bindId, 10, TimeUnit.MINUTES);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|