Merge branch 'develop'

# Conflicts:
#	src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java
#	src/main/ui/static/templates/payment/v1/card_pay.js
master
taylor.dang 4 years ago
commit 75d04d22a6

@ -1500,6 +1500,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
if (StringUtils.isEmpty(profileKey)) {
throw new BadRequestException("Key not provided");
}
clientModifySupport.processModify(new CustomSwitchModify(manager, clientMoniker, profileKey, allow, cli -> { clientModifySupport.processModify(new CustomSwitchModify(manager, clientMoniker, profileKey, allow, cli -> {
JSONObject profileUpdate = new JSONObject(); JSONObject profileUpdate = new JSONObject();
profileUpdate.put(profileKey, allow); profileUpdate.put(profileKey, allow);
@ -5671,7 +5674,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
try { try {
Element responseElement = resultElement.element("response").element("alipay"); Element responseElement = resultElement.element("response").element("alipay");
if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) { if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) {
throw new BadRequestException(responseElement.elementText("result_code")); throw new BadRequestException(responseElement.elementText("result_code") +
":" + responseElement.elementText("reject_reason"));
} }
} catch (Exception e) { } catch (Exception e) {
throw new ServerErrorException(e); throw new ServerErrorException(e);
@ -5691,7 +5695,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return "查询成功:" + resultElement.elementText("error"); return "查询成功:" + resultElement.elementText("error");
} }
Element responseElement = resultElement.element("response").element("alipay"); Element responseElement = resultElement.element("response").element("alipay");
return "查询成功:" + responseElement.elementText("secondary_merchant_id") + "报备状态 : " + responseElement.elementText("status"); String rejectReason = responseElement.elementText("reject_reason");
return "查询成功:" + responseElement.elementText("secondary_merchant_id") +
"报备状态:" + responseElement.elementText("status") + StringUtils.defaultString(rejectReason, "");
} }
@Override @Override
@ -5795,7 +5802,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
try { try {
Element responseElement = resultElement.element("response").element("alipay"); Element responseElement = resultElement.element("response").element("alipay");
if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) { if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) {
throw new BadRequestException(responseElement.elementText("result_code")); throw new BadRequestException(responseElement.elementText("result_code") +
":" + responseElement.elementText("reject_reason"));
} }
} catch (Exception e) { } catch (Exception e) {
throw new ServerErrorException(e); throw new ServerErrorException(e);
@ -5839,7 +5847,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
return "查询成功:" + resultElement.elementText("error"); return "查询成功:" + resultElement.elementText("error");
} }
Element responseElement = resultElement.element("response").element("alipay"); Element responseElement = resultElement.element("response").element("alipay");
return "查询成功:" + responseElement.elementText("secondary_merchant_id") + "报备状态 : " + responseElement.elementText("status"); String rejectReason = responseElement.elementText("reject_reason");
return "查询成功:" + responseElement.elementText("secondary_merchant_id") +
"报备状态:" + responseElement.elementText("status") + StringUtils.defaultString(rejectReason, "");
} }
@Override @Override

@ -1003,7 +1003,7 @@ public class PartnerManageController {
*/ */
@ManagerMapping(value = "/{clientMoniker}/payment_card_permission", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) @ManagerMapping(value = "/{clientMoniker}/payment_card_permission", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR})
public void switchInternationalCard(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { public void switchInternationalCard(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.modifyUPayProfile(manager, clientMoniker, "enable_international_card", pass.getBooleanValue("allow")); clientManager.modifyUPayProfile(manager, clientMoniker, pass.getString("key"), pass.getBooleanValue("allow"));
} }
} }

@ -656,10 +656,6 @@ public class TradeLogServiceImpl implements TradeLogService {
.filter(log -> log.getBigDecimal("settle_amount") != null) .filter(log -> log.getBigDecimal("settle_amount") != null)
.map(log -> getSymbol(log).multiply(log.getBigDecimal("incremental_surcharge").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP))) .map(log -> getSymbol(log).multiply(log.getBigDecimal("incremental_surcharge").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP)))
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); .reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
analysis.put("total_transaction_fee_tax", logs.parallelStream()
.filter(log -> log.getBigDecimal("settle_amount") != null)
.map(log -> getSymbol(log).multiply(log.getBigDecimal("transaction_fee").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP)))
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
analysis.put("total_surcharge", logs.parallelStream() analysis.put("total_surcharge", logs.parallelStream()
.filter(log -> log.getBigDecimal("settle_amount") != null) .filter(log -> log.getBigDecimal("settle_amount") != null)
.map(log -> getSymbol(log).multiply(log.getBigDecimal("total_surcharge").add(log.getBigDecimal("tax_amount")))) .map(log -> getSymbol(log).multiply(log.getBigDecimal("total_surcharge").add(log.getBigDecimal("tax_amount"))))
@ -972,15 +968,14 @@ public class TradeLogServiceImpl implements TradeLogService {
parmerters.put("incremental_fee", takeDecimalOrDefault(analysis, "total_incremental_surcharge", BigDecimal.ZERO)); parmerters.put("incremental_fee", takeDecimalOrDefault(analysis, "total_incremental_surcharge", BigDecimal.ZERO));
parmerters.put("incremental_gst", takeDecimalOrDefault(analysis, "total_incremental_tax", BigDecimal.ZERO)); parmerters.put("incremental_gst", takeDecimalOrDefault(analysis, "total_incremental_tax", BigDecimal.ZERO));
parmerters.put("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP)); parmerters.put("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP));
BigDecimal totalTransactionFee = analysis.getBigDecimal("total_transaction_fee").add(analysis.getBigDecimal("total_transaction_fee_tax")).setScale(2, RoundingMode.HALF_UP); BigDecimal totalTransactionFee = analysis.getBigDecimal("total_transaction_fee").setScale(2, RoundingMode.HALF_UP);
BigDecimal totalRoyalpayFee = analysis.getBigDecimal("total_surcharge") BigDecimal totalRoyalpaySvcFee = analysis.getBigDecimal("total_surcharge")
.subtract(analysis.getBigDecimal("total_transaction_fee")) .subtract(analysis.getBigDecimal("total_transaction_fee"))
.subtract(analysis.getBigDecimal("total_transaction_fee_tax"))
.subtract(analysis.getBigDecimal("total_incremental_surcharge")) .subtract(analysis.getBigDecimal("total_incremental_surcharge"))
.subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP); .subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP);
parmerters.put("total_transaction_fee", totalTransactionFee); parmerters.put("total_transaction_fee", totalTransactionFee);
parmerters.put("total_royalpay_fee", totalRoyalpayFee); parmerters.put("total_royalpay_fee", totalRoyalpaySvcFee);
parmerters.put("total_card_fee", totalRoyalpayFee.add(totalTransactionFee)); parmerters.put("total_card_fee", totalRoyalpaySvcFee.add(totalTransactionFee));
parmerters.put("total_incremental_fee", parmerters.getBigDecimal("incremental_fee").add(parmerters.getBigDecimal("incremental_gst"))); parmerters.put("total_incremental_fee", parmerters.getBigDecimal("incremental_fee").add(parmerters.getBigDecimal("incremental_gst")));
dataList.parallelStream().forEach(item -> { dataList.parallelStream().forEach(item -> {
BigDecimal incrementalSurcharge = item.containsKey("incremental_surcharge") ? item.getBigDecimal("incremental_surcharge") : BigDecimal.ZERO; BigDecimal incrementalSurcharge = item.containsKey("incremental_surcharge") ? item.getBigDecimal("incremental_surcharge") : BigDecimal.ZERO;
@ -991,12 +986,11 @@ public class TradeLogServiceImpl implements TradeLogService {
item.put("transaction_fee", BigDecimal.ZERO); item.put("transaction_fee", BigDecimal.ZERO);
} }
BigDecimal transactionFee = item.getBigDecimal("transaction_fee"); BigDecimal transactionFee = item.getBigDecimal("transaction_fee");
BigDecimal transactionFeeTax = item.getBigDecimal("transaction_fee").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP); BigDecimal royalpaySvcFee = (item.containsKey("total_surcharge") ? item.getBigDecimal("total_surcharge") : BigDecimal.ZERO)
BigDecimal realRoyalpayCharge = (item.containsKey("total_surcharge")?item.getBigDecimal("total_surcharge"):BigDecimal.ZERO) .add(taxAmount).subtract(incrementalSurcharge).subtract(incrementalTax).subtract(transactionFee);
.add(taxAmount).subtract(transactionFee).subtract(transactionFeeTax).subtract(incrementalSurcharge).subtract(incrementalTax);
item.put("incremental_surcharge", incrementalSurcharge.add(incrementalTax).setScale(2, RoundingMode.HALF_UP)); item.put("incremental_surcharge", incrementalSurcharge.add(incrementalTax).setScale(2, RoundingMode.HALF_UP));
item.put("total_surcharge_intax", realRoyalpayCharge.setScale(2, RoundingMode.HALF_UP)); item.put("total_surcharge_intax", royalpaySvcFee.setScale(2, RoundingMode.HALF_UP));
item.put("transaction_fee_intax", transactionFee.add(transactionFeeTax).setScale(2, RoundingMode.HALF_UP)); item.put("transaction_fee_intax", transactionFee.setScale(2, RoundingMode.HALF_UP));
scaleDecimalVal(item, "display_amount", item.getString("currency")); scaleDecimalVal(item, "display_amount", item.getString("currency"));
String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency(); String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency();
scaleDecimalVal(item, "clearing_amount", platformCurrency); scaleDecimalVal(item, "clearing_amount", platformCurrency);

@ -0,0 +1 @@
f2f97656020f8839d638986e22a2b24f

@ -1813,7 +1813,32 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
$scope.init.enable_International_card = true; $scope.init.enable_International_card = true;
return; return;
} }
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_card_permission', {allow: $scope.paymentInfo.enable_international_card}).then(function () { $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_card_permission', {
key: 'enable_international_card',
allow: $scope.paymentInfo.enable_international_card
}).then(function () {
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
title: 'failed to change international card permission status',
content: resp.data.message,
type: 'error'
})
})
};
$scope.switchThreeDS = function () {
if (!$scope.paymentInfo) {
return;
}
if (!$scope.init.enable_threeds) {
$scope.init.enable_threeds = true;
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_card_permission', {
allow: $scope.paymentInfo.enable_threeds,
'key': 'enable_threeds'
}).then(function () {
$scope.loadPartnerPaymentInfo(); $scope.loadPartnerPaymentInfo();
}, function (resp) { }, function (resp) {
commonDialog.alert({ commonDialog.alert({

@ -470,6 +470,13 @@
switch-change="switchInternationalCard()"> switch-change="switchInternationalCard()">
</div> </div>
</div> </div>
<div class="form-group" ng-if="'111'|withRole">
<label class="col-sm-2 control-label">Enable 3DS</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="paymentInfo.enable_threeds" bs-switch
switch-change="switchThreeDS()">
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

@ -14,10 +14,10 @@ $(function () {
if (res.sdk_params) { if (res.sdk_params) {
let threeDsParams = JSON.parse(res.sdk_params); let threeDsParams = JSON.parse(res.sdk_params);
let form = $('<form></form>').attr('action', threeDsParams.acs_url).attr('method', 'post').css('display', 'none'); let form = $('<form></form>').attr('action', threeDsParams.acs_url).attr('method', 'post').css('display', 'none');
$('<input>').attr('name', 'PaReq').val(threeDsParams.pa_req).attr('type', 'hidden').appendTo(form); $('<input>').attr('name', 'paReq').val(threeDsParams.pa_req).attr('type', 'hidden').appendTo(form);
$('<input>').attr('name', 'TermUrl').val(threeDsParams.term_url).attr('type', 'hidden').appendTo(form); $('<input>').attr('name', 'TermURL').val(threeDsParams.term_url).attr('type', 'hidden').appendTo(form);
$('body').append(form); $('body').append(form);
form.submit(); form.commit();
return; return;
} }
startCheckOrder(window.client_moniker, window.partner_order_id); startCheckOrder(window.client_moniker, window.partner_order_id);

Loading…
Cancel
Save