diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index f3318a2a9..3a46dabec 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -1500,6 +1500,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } + if (StringUtils.isEmpty(profileKey)) { + throw new BadRequestException("Key not provided"); + } clientModifySupport.processModify(new CustomSwitchModify(manager, clientMoniker, profileKey, allow, cli -> { JSONObject profileUpdate = new JSONObject(); profileUpdate.put(profileKey, allow); @@ -5671,7 +5674,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid try { Element responseElement = resultElement.element("response").element("alipay"); 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) { throw new ServerErrorException(e); @@ -5691,7 +5695,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return "查询成功:" + resultElement.elementText("error"); } 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 @@ -5795,7 +5802,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid try { Element responseElement = resultElement.element("response").element("alipay"); 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) { throw new ServerErrorException(e); @@ -5839,7 +5847,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return "查询成功:" + resultElement.elementText("error"); } 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 @@ -7060,7 +7070,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(clientId); JSONObject info = new JSONObject(); info.put("down_date", formatter.print(new DateTime()));//下载文件日 - info.put("letter_offer_sub_time",currentRate.getDate("active_time")); + info.put("letter_offer_sub_time", currentRate.getDate("active_time")); info.put("bussiness_name", (client.containsKey("business_name") ? client.getString("business_name") : legalInfo.getString("representative_person")) + " " + client.getString("abn"));//商圈类型 info.put("partner_address", client.getString("address"));//商家店铺地址 info.put("partner_country", client.getString("country"));//国家 diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index a0172d106..162eb3f1c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -1003,7 +1003,7 @@ public class PartnerManageController { */ @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) { - clientManager.modifyUPayProfile(manager, clientMoniker, "enable_international_card", pass.getBooleanValue("allow")); + clientManager.modifyUPayProfile(manager, clientMoniker, pass.getString("key"), pass.getBooleanValue("allow")); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index 263dd12a5..fe8016808 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -656,10 +656,6 @@ public class TradeLogServiceImpl implements TradeLogService { .filter(log -> log.getBigDecimal("settle_amount") != null) .map(log -> getSymbol(log).multiply(log.getBigDecimal("incremental_surcharge").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP))) .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() .filter(log -> log.getBigDecimal("settle_amount") != null) .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_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)); - BigDecimal totalTransactionFee = analysis.getBigDecimal("total_transaction_fee").add(analysis.getBigDecimal("total_transaction_fee_tax")).setScale(2, RoundingMode.HALF_UP); - BigDecimal totalRoyalpayFee = analysis.getBigDecimal("total_surcharge") + BigDecimal totalTransactionFee = analysis.getBigDecimal("total_transaction_fee").setScale(2, RoundingMode.HALF_UP); + BigDecimal totalRoyalpaySvcFee = analysis.getBigDecimal("total_surcharge") .subtract(analysis.getBigDecimal("total_transaction_fee")) - .subtract(analysis.getBigDecimal("total_transaction_fee_tax")) .subtract(analysis.getBigDecimal("total_incremental_surcharge")) .subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP); parmerters.put("total_transaction_fee", totalTransactionFee); - parmerters.put("total_royalpay_fee", totalRoyalpayFee); - parmerters.put("total_card_fee", totalRoyalpayFee.add(totalTransactionFee)); + parmerters.put("total_royalpay_fee", totalRoyalpaySvcFee); + parmerters.put("total_card_fee", totalRoyalpaySvcFee.add(totalTransactionFee)); parmerters.put("total_incremental_fee", parmerters.getBigDecimal("incremental_fee").add(parmerters.getBigDecimal("incremental_gst"))); dataList.parallelStream().forEach(item -> { 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); } BigDecimal transactionFee = item.getBigDecimal("transaction_fee"); - BigDecimal transactionFeeTax = item.getBigDecimal("transaction_fee").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP); - BigDecimal realRoyalpayCharge = (item.containsKey("total_surcharge")?item.getBigDecimal("total_surcharge"):BigDecimal.ZERO) - .add(taxAmount).subtract(transactionFee).subtract(transactionFeeTax).subtract(incrementalSurcharge).subtract(incrementalTax); + BigDecimal royalpaySvcFee = (item.containsKey("total_surcharge") ? item.getBigDecimal("total_surcharge") : BigDecimal.ZERO) + .add(taxAmount).subtract(incrementalSurcharge).subtract(incrementalTax).subtract(transactionFee); 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("transaction_fee_intax", transactionFee.add(transactionFeeTax).setScale(2, RoundingMode.HALF_UP)); + item.put("total_surcharge_intax", royalpaySvcFee.setScale(2, RoundingMode.HALF_UP)); + item.put("transaction_fee_intax", transactionFee.setScale(2, RoundingMode.HALF_UP)); scaleDecimalVal(item, "display_amount", item.getString("currency")); String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency(); scaleDecimalVal(item, "clearing_amount", platformCurrency); diff --git a/src/main/resources/jasper/partner_upay_invoice_gst.jasper b/src/main/resources/jasper/partner_upay_invoice_gst.jasper index e017ea279..cd6a18014 100644 Binary files a/src/main/resources/jasper/partner_upay_invoice_gst.jasper and b/src/main/resources/jasper/partner_upay_invoice_gst.jasper differ diff --git a/src/main/ui/SRChoE1QZN.txt b/src/main/ui/SRChoE1QZN.txt new file mode 100644 index 000000000..26e0cd770 --- /dev/null +++ b/src/main/ui/SRChoE1QZN.txt @@ -0,0 +1 @@ +f2f97656020f8839d638986e22a2b24f \ No newline at end of file diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 64aeefc11..9b939928f 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -1813,7 +1813,32 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.init.enable_International_card = true; 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(); }, function (resp) { commonDialog.alert({ diff --git a/src/main/ui/static/payment/partner/templates/partner_payment_info.html b/src/main/ui/static/payment/partner/templates/partner_payment_info.html index 59c8f5422..444069381 100644 --- a/src/main/ui/static/payment/partner/templates/partner_payment_info.html +++ b/src/main/ui/static/payment/partner/templates/partner_payment_info.html @@ -470,6 +470,13 @@ switch-change="switchInternationalCard()"> +
+ +
+ +
+
diff --git a/src/main/ui/static/templates/payment/v1/card_pay.js b/src/main/ui/static/templates/payment/v1/card_pay.js index 837ad66ac..190694812 100644 --- a/src/main/ui/static/templates/payment/v1/card_pay.js +++ b/src/main/ui/static/templates/payment/v1/card_pay.js @@ -14,10 +14,10 @@ $(function () { if (res.sdk_params) { let threeDsParams = JSON.parse(res.sdk_params); let form = $('
').attr('action', threeDsParams.acs_url).attr('method', 'post').css('display', 'none'); - $('').attr('name', 'PaReq').val(threeDsParams.pa_req).attr('type', 'hidden').appendTo(form); - $('').attr('name', 'TermUrl').val(threeDsParams.term_url).attr('type', 'hidden').appendTo(form); + $('').attr('name', 'paReq').val(threeDsParams.pa_req).attr('type', 'hidden').appendTo(form); + $('').attr('name', 'TermURL').val(threeDsParams.term_url).attr('type', 'hidden').appendTo(form); $('body').append(form); - form.submit(); + form.commit(); return; } startCheckOrder(window.client_moniker, window.partner_order_id);