Merge remote-tracking branch 'origin/production' into production

master
ycfxx 4 years ago
commit 90a44fdb07

@ -511,7 +511,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
PayChannel payChannel = PayChannel.fromChannelCode(channel); PayChannel payChannel = PayChannel.fromChannelCode(channel);
if (payChannel == PayChannel.ALIPAY_APS_IN_STORE || payChannel == PayChannel.ALIPAY_APS_CASHIER) { if (payChannel == PayChannel.ALIPAY_APS_IN_STORE || payChannel == PayChannel.ALIPAY_APS_CASHIER) {
Map<Boolean, List<JSONObject>> groupByPayType = oneChannel.getValue().stream().collect(Collectors.groupingBy(e -> e.getString("pay_type").equals("alipay_cn"))); Map<Boolean, List<JSONObject>> groupByPayType = oneChannel.getValue().stream().collect(Collectors.groupingBy(e -> "alipay_cn".equalsIgnoreCase(e.getString("pay_type"))));
for (Map.Entry<Boolean, List<JSONObject>> payType : groupByPayType.entrySet()) { for (Map.Entry<Boolean, List<JSONObject>> payType : groupByPayType.entrySet()) {
BigDecimal totalAps = BigDecimal.ZERO; BigDecimal totalAps = BigDecimal.ZERO;
BigDecimal total_surageAps = BigDecimal.ZERO; BigDecimal total_surageAps = BigDecimal.ZERO;
@ -525,7 +525,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
BigDecimal channelRate = null; BigDecimal channelRate = null;
if (payChannel == PayChannel.ALIPAY_APS_IN_STORE) { if (payChannel == PayChannel.ALIPAY_APS_IN_STORE) {
if ("alipay_cn".equalsIgnoreCase(params.getString("pay_type"))) { if ("alipay_cn".equalsIgnoreCase(params.getString("pay_type"))) {
channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal("aliapy_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal("alipay_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN));
} else { } else {
channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : ((orgInfo.getBigDecimal("retail_interchange_fee_value").add(orgInfo.getBigDecimal("retail_service_fee_value"))).divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : ((orgInfo.getBigDecimal("retail_interchange_fee_value").add(orgInfo.getBigDecimal("retail_service_fee_value"))).divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN));
} }

@ -1,10 +1,13 @@
package au.com.royalpay.payment.manage.gateway.beans; package au.com.royalpay.payment.manage.gateway.beans;
import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.manage.merchants.core.bank.AustraliaBank;
import au.com.royalpay.payment.manage.merchants.core.bank.AustraliaBankInfo;
import au.com.royalpay.payment.manage.system.core.impl.ClientContractServiceImpl; import au.com.royalpay.payment.manage.system.core.impl.ClientContractServiceImpl;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import cn.yixblog.platform.http.HttpRequestGenerator; import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult; import cn.yixblog.platform.http.HttpRequestResult;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data; import lombok.Data;
@ -18,6 +21,7 @@ import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -47,7 +51,7 @@ public class ClientSettleConfig {
private String activeTime; private String activeTime;
@JSONField(name = "expire_time") @JSONField(name = "expire_time")
private String expireTime; private String expireTime;
private JSONObject bankQueryInfo; private AustraliaBankInfo bankQueryInfo;
private Date activeTimeDate; private Date activeTimeDate;
private static String[] WHITE_LIST = {"bankQueryInfo", "activeTimeDate"}; private static String[] WHITE_LIST = {"bankQueryInfo", "activeTimeDate"};
@ -79,10 +83,10 @@ public class ClientSettleConfig {
} }
if (sandboxMode) { if (sandboxMode) {
bankQueryInfo = new JSONObject(); bankQueryInfo = new AustraliaBankInfo();
} else { } else {
bankQueryInfo = getBankInfo(bsbNo); bankQueryInfo = AustraliaBank.getBankInfo(bsbNo);
if (bankQueryInfo == null || bankQueryInfo.isEmpty() || !bankQueryInfo.getBooleanValue("valid")) { if (bankQueryInfo.isNone()) {
throw new BadRequestException("PARAM_ERROR:BSB No is invalid"); throw new BadRequestException("PARAM_ERROR:BSB No is invalid");
} }
} }
@ -99,25 +103,7 @@ public class ClientSettleConfig {
bankInfo.put("bsb_no", bsbNo); bankInfo.put("bsb_no", bsbNo);
bankInfo.put("account_no", accountNo); bankInfo.put("account_no", accountNo);
bankInfo.put("account_name", accountName); bankInfo.put("account_name", accountName);
bankInfo.putAll(bankQueryInfo); bankInfo.putAll((JSONObject) JSON.toJSON(bankQueryInfo));
return bankInfo; return bankInfo;
} }
private JSONObject getBankInfo(String bsb_no) {
// bd451cc3e3ad66c75165dc852507e8f0
// 收费 ab9379cfdab559509bbdcdd11923489f
String url = "https://api.bank.codes/au-bsb/json/ab9379cfdab559509bbdcdd11923489f/" + bsb_no;
JSONObject res = new JSONObject();
try {
HttpRequestResult result = new HttpRequestGenerator(url, RequestMethod.GET).execute();
if (result.isSuccess()) {
res = result.getResponseContentJSONObj();
} else {
logger.error("Request bsb info error {}-->{}", bsb_no, result.getResponseContentString());
}
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
return res;
}
} }

@ -102,6 +102,7 @@ import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.lock.Locker; import au.com.royalpay.payment.tools.lock.Locker;
import au.com.royalpay.payment.tools.mail.SendMail; import au.com.royalpay.payment.tools.mail.SendMail;
import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig; import au.com.royalpay.payment.tools.merchants.beans.QRCodeConfig;
import au.com.royalpay.payment.tools.merchants.beans.TransactionFee;
import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO; import au.com.royalpay.payment.tools.merchants.beans.UpdateSurchargeDTO;
import au.com.royalpay.payment.tools.merchants.core.MerchantChannelPermissionResolver; import au.com.royalpay.payment.tools.merchants.core.MerchantChannelPermissionResolver;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
@ -400,7 +401,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
@Override @Override
@Cacheable(value = ":app_client_info_moniker:", key = "#clientMoniker",unless="#result == null") @Cacheable(value = ":app_client_info_moniker:", key = "#clientMoniker", unless = "#result == null")
public JSONObject getClientInfoByMoniker(String clientMoniker) { public JSONObject getClientInfoByMoniker(String clientMoniker) {
return clientMapper.findClientByMonikerAll(clientMoniker); return clientMapper.findClientByMonikerAll(clientMoniker);
} }
@ -624,7 +625,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
assert client != null; assert client != null;
JSONObject clientConfig = clientConfigService.find(clientId); JSONObject clientConfig = clientConfigService.find(clientId);
if(clientConfig !=null) { if (clientConfig != null) {
client.putAll(clientConfig); client.putAll(clientConfig);
} }
return client; return client;
@ -1990,6 +1991,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
convertExtRateValueDataVersion(rate, extRates, "overseas_rate_value"); convertExtRateValueDataVersion(rate, extRates, "overseas_rate_value");
rate.put("ext_rates", extRates); rate.put("ext_rates", extRates);
} }
TransactionFee transFee = Optional.ofNullable(paymentApi.channelCalculator(rate.getString("rate_name")))
.map(calculator -> calculator.convertTransactionFee(rate.getBigDecimal("transaction_fee")))
.orElse(TransactionFee.ZERO);
rate.put("transaction_fee", transFee.displayValue());
} }
} catch (Exception ignore) { } catch (Exception ignore) {
} }
@ -2035,6 +2040,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
configJson.put("manager_name", manager.getString("display_name")); configJson.put("manager_name", manager.getString("display_name"));
configJson.put("create_time", new Date()); configJson.put("create_time", new Date());
configJson.put("update_time", new Date()); configJson.put("update_time", new Date());
TransactionFee transFee = Optional.ofNullable(paymentApi.channelCalculator(config.getRateName()))
.map(calculator -> calculator.convertTransactionFee(config.getTransactionFee()))
.orElse(TransactionFee.ZERO);
configJson.put("transaction_fee", transFee.storeValue());
clientRateMapper.saveRate(configJson); clientRateMapper.saveRate(configJson);
// clientMapper.updateCleanDays(clientId, config.getCleanDays()); // clientMapper.updateCleanDays(clientId, config.getCleanDays());
} }
@ -2059,7 +2068,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
config.put("update_time", new Date()); config.put("update_time", new Date());
config.put("active_time", DateFormatUtils.format(config.getDate("active_time"), "yyyy-MM-dd")); config.put("active_time", DateFormatUtils.format(config.getDate("active_time"), "yyyy-MM-dd"));
config.put("expiry_time", DateFormatUtils.format(config.getDate("expiry_time"), "yyyy-MM-dd")); config.put("expiry_time", DateFormatUtils.format(config.getDate("expiry_time"), "yyyy-MM-dd"));
if (isAddCardPaymentRate(config, clientId)) { if (isAddCardPaymentRate(config, clientId)) {
return; return;
} }
@ -2107,6 +2115,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
newConfig.put("rate_value", config.getBigDecimal(rateKey)); newConfig.put("rate_value", config.getBigDecimal(rateKey));
newConfig.put("rate_name", channel); newConfig.put("rate_name", channel);
newConfig.put("pay_type", config.getString("pay_type")); newConfig.put("pay_type", config.getString("pay_type"));
BigDecimal transactionFeeDecimal = config.getBigDecimal("transaction_fee");
TransactionFee transFee = Optional.ofNullable(paymentApi.channelCalculator(channel))
.map(calculator -> calculator.convertTransactionFee(transactionFeeDecimal))
.orElse(TransactionFee.ZERO);
newConfig.put("transaction_fee", transFee.storeValue());
if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getBigDecimal("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), config.getBigDecimal("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) {
return; return;
} }
@ -2164,6 +2177,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
checkOrgPermission(manager, client); checkOrgPermission(manager, client);
JSONObject configJson = config.toJSON(); JSONObject configJson = config.toJSON();
BigDecimal transactionFeeDecimal = config.getTransactionFee();
TransactionFee transFee = Optional.ofNullable(paymentApi.channelCalculator(config.getRateName()))
.map(calculator->calculator.convertTransactionFee(transactionFeeDecimal))
.orElse(TransactionFee.ZERO);
configJson.put("transaction_fee", transFee.storeValue());
JSONObject org = orgMapper.findOne(client.getIntValue("org_id")); JSONObject org = orgMapper.findOne(client.getIntValue("org_id"));
checkModifyRate(org, configJson, "Wechat", "min_wechat_rate"); checkModifyRate(org, configJson, "Wechat", "min_wechat_rate");
checkModifyRate(org, configJson, "Alipay", "min_alipay_rate"); checkModifyRate(org, configJson, "Alipay", "min_alipay_rate");
@ -2186,7 +2204,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
int clientId = client.getIntValue("client_id"); int clientId = client.getIntValue("client_id");
JSONObject changeRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "Wechat"); JSONObject changeRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "Wechat");
int cleanDays = changeRate.getIntValue("clean_days"); int cleanDays = changeRate.getIntValue("clean_days");
if (cleanDays != client.getIntValue("clean_days") && StringUtils.equalsIgnoreCase("Wechat", config.getRateName())) { if (cleanDays != client.getIntValue("clean_days")) {
clientModifySupport.processClientConfigModify(new ClearDaysModify(manager, clientMoniker, cleanDays)); clientModifySupport.processClientConfigModify(new ClearDaysModify(manager, clientMoniker, cleanDays));
} }
} }
@ -3085,13 +3103,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
} }
JSONObject alipayApsCashierRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), PayChannel.ALIPAY_APS_CASHIER.getChannelCode()); JSONObject alipayApsCashierRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), PayChannel.ALIPAY_APS_CASHIER.getChannelCode());
if (alipayApsCashierRate != null) { if (alipayApsCashierRate != null) {
client.put("aps_cashier_rate", alipayApsCashierRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN)+"%"); client.put("aps_cashier_rate", alipayApsCashierRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN) + "%");
client.put("aps_cashier_service_rate", alipayApsCashierRate.getBigDecimal("transaction_fee").setScale(2, RoundingMode.DOWN)+"%"); client.put("aps_cashier_service_rate", alipayApsCashierRate.getBigDecimal("transaction_fee").setScale(2, RoundingMode.DOWN) + "%");
} }
JSONObject alipayApsInstoreRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), PayChannel.ALIPAY_APS_IN_STORE.getChannelCode()); JSONObject alipayApsInstoreRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), PayChannel.ALIPAY_APS_IN_STORE.getChannelCode());
if (alipayApsInstoreRate != null) { if (alipayApsInstoreRate != null) {
client.put("aps_instore_rate", alipayApsInstoreRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN)+"%"); client.put("aps_instore_rate", alipayApsInstoreRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN) + "%");
client.put("aps_instore_service_rate", alipayApsInstoreRate.getBigDecimal("transaction_fee").setScale(2, RoundingMode.DOWN)+"%"); client.put("aps_instore_service_rate", alipayApsInstoreRate.getBigDecimal("transaction_fee").setScale(2, RoundingMode.DOWN) + "%");
client.put("alipayplus_clean", alipayApsInstoreRate.getString("clean_days")); client.put("alipayplus_clean", alipayApsInstoreRate.getString("clean_days"));
} }
} catch (Exception ignored) { } catch (Exception ignored) {
@ -6841,7 +6859,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
partner.put("lessComplianceFiles", signInAccountService.checkAuthFileStatus(partner.getJSONObject("client")).getBoolean("client_less_file")); partner.put("lessComplianceFiles", signInAccountService.checkAuthFileStatus(partner.getJSONObject("client")).getBoolean("client_less_file"));
} }
JSONObject clientConfig = clientConfigMapper.find(client.getIntValue("client_id")); JSONObject clientConfig = clientConfigMapper.find(client.getIntValue("client_id"));
if(clientConfig !=null) { if (clientConfig != null) {
partner.put("geek_shop_status", clientConfig.getBooleanValue("geek_shop_status")); partner.put("geek_shop_status", clientConfig.getBooleanValue("geek_shop_status"));
} }
return partner; return partner;

@ -35,6 +35,7 @@ import org.springframework.util.Assert;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.MessageFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -154,7 +155,7 @@ public class RefundServiceImpl implements RefundService, ApplicationEventPublish
OperatorType type = account != null ? OperatorType.PARTNER : OperatorType.MANAGER; OperatorType type = account != null ? OperatorType.PARTNER : OperatorType.MANAGER;
boolean requireAudit = type == OperatorType.PARTNER && PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER boolean requireAudit = type == OperatorType.PARTNER && PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER
&& clientConfig.getBooleanValue("enable_refund_auth"); && clientConfig.getBooleanValue("enable_refund_auth");
logger.debug("applyer type=" + type + "; require audit=" + requireAudit); logger.debug("applyer type={}; require audit={}", type, requireAudit);
paymentApi.clientRefundBalanceCheck(clientId, orderId, currency, feeAmount); paymentApi.clientRefundBalanceCheck(clientId, orderId, currency, feeAmount);
Assert.notNull(order, "Order Not exists"); Assert.notNull(order, "Order Not exists");

@ -72,7 +72,8 @@
<input type="number" name="transaction_fee" class="form-control" <input type="number" name="transaction_fee" class="form-control"
ng-model="rate.transaction_fee" ng-model="rate.transaction_fee"
min="0" step="0.1" max="1" id="transaction_fee_input" required> min="0" step="0.1" max="1" id="transaction_fee_input" required>
<div class="input-group-addon">$</div> <div class="input-group-addon" ng-if="rate.rate_name != 'ApsInStore' && rate.rate_name != 'ApsCashier'">$</div>
<div class="input-group-addon" ng-if="rate.rate_name == 'ApsInStore' || rate.rate_name == 'ApsCashier'">%</div>
</div> </div>
<div ng-messages="rate_form.transaction_fee.$error" ng-if="rate_form.transaction_fee.$dirty"> <div ng-messages="rate_form.transaction_fee.$error" ng-if="rate_form.transaction_fee.$dirty">
<div class="small text-danger" ng-message="min"> <div class="small text-danger" ng-message="min">

Loading…
Cancel
Save