diff --git a/src/document/cn/overview.md b/src/document/cn/overview.md index f54adc878..e221ad5a2 100644 --- a/src/document/cn/overview.md +++ b/src/document/cn/overview.md @@ -37,7 +37,7 @@ ## 支付宝渠道区分 支付宝根据调用接口不同分为线上和线下两个渠道,两个渠道分别使用不同的汇率和手续费费率,为避免混淆在此区分: -+ 线上渠道:包含H5 Mobile、Web支付以及APP SDK(未上线)三种支付方式 ++ 线上渠道:包含H5 Mobile、Web支付以及APP SDK三种支付方式 + 线下渠道:包含JSAPI、QR Code、Retail Pay 3种支付方式 相似接口区别 diff --git a/src/document/en/overview.md b/src/document/en/overview.md index dc4428d35..1aadf8293 100644 --- a/src/document/en/overview.md +++ b/src/document/en/overview.md @@ -37,7 +37,7 @@ System error message supports Simplified Chinese and English. The system by defa ## Alipay Channels According to different Api used, Alipay channel was distributed to Retail channel and Online channel. Two channels has different exchange rate and surcharge rate. -+ Online Channel: Including H5 Mobile, Online Payment and APP SDK(coming soon) ++ Online Channel: Including H5 Mobile, Online Payment and APP SDK + Retail Channel: Including JSAPI, QR Code Api, Retail Pay Difference diff --git a/src/document/tpl/resouorces/api/AlipaySDKForiOS.zip b/src/document/tpl/resources/api/AlipaySDKForiOS.zip similarity index 100% rename from src/document/tpl/resouorces/api/AlipaySDKForiOS.zip rename to src/document/tpl/resources/api/AlipaySDKForiOS.zip diff --git a/src/document/tpl/resouorces/api/alipaySdk-20160825.jar b/src/document/tpl/resources/api/alipaySdk-20160825.jar similarity index 100% rename from src/document/tpl/resouorces/api/alipaySdk-20160825.jar rename to src/document/tpl/resources/api/alipaySdk-20160825.jar diff --git a/src/main/java/au/com/royalpay/payment/manage/support/wechatclients/NAPWechatApi.java b/src/main/java/au/com/royalpay/payment/manage/support/wechatclients/NAPWechatApi.java new file mode 100644 index 000000000..61151721f --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/support/wechatclients/NAPWechatApi.java @@ -0,0 +1,45 @@ +package au.com.royalpay.payment.manage.support.wechatclients; + +import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; +import au.com.royalpay.payment.tools.connections.mpsupport.beans.WechatRedpack; +import au.com.royalpay.payment.tools.connections.mpsupport.impls.AbstractMpWechatClientApi; +import au.com.royalpay.payment.tools.exceptions.ServerErrorException; +import com.alibaba.fastjson.JSONObject; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; + +/** + * Created by yishuqian on 11/01/2017. + */ +@Service +public class NAPWechatApi extends AbstractMpWechatClientApi implements MpWechatApi { + @PostConstruct + public void initTemplates() { + } + + @Override + public String targetMpAccount() { + return "globalpay"; + } + + @Override + public String getOpenIdKey() { + return "globalpay_openid"; + } + + @Override + public JSONObject sendRedpack(WechatRedpack redpackInfo) { + throw new ServerErrorException("Cannot send redpack with this merchant"); + } + + @Override + public JSONObject redpackStatus(String redpackId) { + throw new ServerErrorException("Cannot send redpack with this merchant"); + } + + @Override + public boolean matchOpenId(String openId) { + return openId.startsWith("olHWD"); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java index 5d0b357b1..e7676339b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java @@ -21,7 +21,9 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.annotation.Resource; @@ -171,7 +173,22 @@ public class ClientContractServiceImpl implements ClientContractService { return result; } int waringDays = sysConfigManager.getSysConfig().getIntValue("rate_warning_days"); - for (JSONObject p : rateInfo) { + Map filterMap = new HashMap<>(); + rateInfo.forEach((p)->{ + String key = p.getString("rate_name"); + JSONObject tmp = filterMap.get(key); + if(tmp==null){ + filterMap.put(key,p); + }else { + if(tmp.getDate("expiry_time").compareTo(p.getDate("expiry_time"))<0){ + filterMap.put(key,p); + } + } + }); + + + + for (JSONObject p : filterMap.values()) { if (now.compareTo(DateUtils.addDays(p.getDate("expiry_time"),1)) > -1) { result.put("rate_expire", true); } diff --git a/src/main/resources/application-wechat.properties b/src/main/resources/application-wechat.properties index db572596a..308010bef 100644 --- a/src/main/resources/application-wechat.properties +++ b/src/main/resources/application-wechat.properties @@ -10,4 +10,11 @@ app.wechatpay.merchants.1431999902.app-id=wx703febcbd34dae38 app.wechatpay.merchants.1431999902.merchant-id=1431999902 app.wechatpay.merchants.1431999902.mch-key=p3tgzrAJbe6eQrunbv8jb8gz5yXxvJdE app.wechatpay.merchants.1431999902.key-file=classpath:apiclient_new_cert.p12 -app.wechatpay.merchants.1431999902.example-sub-merchant-id=42991963 \ No newline at end of file +app.wechatpay.merchants.1431999902.example-sub-merchant-id=42991963 + +app.wechatpay.merchants.1487387142.app-id=wx3e14d1144d898197 +app.wechatpay.merchants.1487387142.mp-id=globalpay +app.wechatpay.merchants.1487387142.merchant-id=1487387142 +app.wechatpay.merchants.1487387142.mch-key=OuvLIL93STqFhTngNaBGT8751ZJn4FKL +app.wechatpay.merchants.1487387142.key-file=classpath:napclient_cert.p12 +app.wechatpay.merchants.1487387142.example-sub-merchant-id=117551742 \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.xml index 87e6219b2..e471d54b3 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.xml @@ -96,6 +96,8 @@ SELECT max(active_time) FROM sys_client_rates WHERE client_id = #{client_id} ) + and rate_name in('Wechat','Alipay') + order by expiry_time desc \ No newline at end of file diff --git a/src/main/resources/napclient_cert.p12 b/src/main/resources/napclient_cert.p12 new file mode 100644 index 000000000..2c9e2f5cc Binary files /dev/null and b/src/main/resources/napclient_cert.p12 differ