diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 19e4fc2f2..9ca43cbfb 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -289,6 +289,12 @@ public class RetailAppServiceImp implements RetailAppService { res.put("rate", paymentApi.channelApi("Wechat").queryExchangeRateDecimal(clientId)); res.put("alipay_rate", paymentApi.channelApi("Alipay").queryExchangeRateDecimal(clientId)); } + params.put("channel", "system"); + res.put("sys_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); + params.put("channel", "rpaypmt_card"); + res.put("rpaypmt_card_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); + params.put("channel", "rpaypmt_dd"); + res.put("rpaypmt_dd_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params))); return res; } @@ -864,7 +870,7 @@ public class RetailAppServiceImp implements RetailAppService { String clientType = device.getString("client_type"); deviceSupport.findRegister(clientType); int clientId = device.getIntValue("client_id"); - JSONObject client = clientManager.getClientInfo(clientId); + JSONObject client = clientManager.getClientInfo(9); String timezoneClient = client.getString("timezone"); if (timezoneClient != null && !timezone.isEmpty()) { timezone = timezoneClient; @@ -3110,6 +3116,10 @@ public class RetailAppServiceImp implements RetailAppService { channels.add(cbBankPay); } res.put("channels", channels); + if (res.containsKey("rate_value")) { + BigDecimal minRate = res.getBigDecimal("rate_value").add(new BigDecimal(0.01)).setScale(2, RoundingMode.DOWN); + res.put("customer_rage_title", (minRate.toPlainString() + "~" + res.getString("max_customer_surcharge_rate"))); + } return res; } diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java index 349aa4013..50abd1285 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java @@ -1,88 +1,39 @@ package au.com.royalpay.payment.manage.citypartner.core.impls; -import java.io.IOException; -import java.io.OutputStream; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import javax.swing.plaf.basic.BasicScrollPaneUI; - -import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper; -import au.com.royalpay.payment.tools.CommonConsts; -import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.time.DateFormatUtils; -import org.apache.commons.lang3.time.DateUtils; -import org.apache.poi.hssf.usermodel.HSSFCellStyle; -import org.apache.poi.hssf.usermodel.HSSFFont; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.hssf.util.HSSFColor; -import org.apache.poi.ss.usermodel.*; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.alibaba.fastjson.JSONObject; - import au.com.royalpay.payment.manage.citypartner.beans.AgentCommissionAnalysis; import au.com.royalpay.payment.manage.citypartner.beans.CityPartnerCommissionAnalysis; import au.com.royalpay.payment.manage.citypartner.beans.ReferrerCommissionAnalysis; import au.com.royalpay.payment.manage.citypartner.core.CityPartnerPrizeService; -import au.com.royalpay.payment.manage.mappers.financial.FinancialAgentCommissionDetailMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialAgentCommissionMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialPartnerCommissionDetailMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialPartnerCommissionMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialReferrerCommissionDetailMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialReferrerCommissionMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialSeniorPartnerCommissionDetailMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialSeniorPartnerCommissionMapper; +import au.com.royalpay.payment.manage.mappers.financial.*; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.system.OrgMapper; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException; - +import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import com.alibaba.fastjson.JSONObject; - import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFFont; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.*; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.OutputStream; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; /** * Created by yixian on 2017-03-08. @@ -476,6 +427,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { BigDecimal total_surage = BigDecimal.ZERO; BigDecimal net_surage = BigDecimal.ZERO; BigDecimal royalpay_surage = BigDecimal.ZERO; + BigDecimal transaction_fee = BigDecimal.ZERO; JSONObject json = new JSONObject(); String channel = oneChannel.getKey(); if ("hf".equals(oneChannel.getKey().toLowerCase()) || "yeepay".equals(oneChannel.getKey().toLowerCase()) || "lakalapay".equals(oneChannel.getKey().toLowerCase())) { @@ -491,7 +443,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { for (JSONObject params : oneChannel.getValue()) { BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount"); BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); - BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); + BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")).subtract(params.getBigDecimal("transaction_fee")); //增加货币判断 int i = currencyScale(params.getString("clearing_currency")); total = total.add(tmpClearingAmount); @@ -499,11 +451,13 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { royalpay_surage = royalpay_surage.add(tmpClearingAmount.multiply(channelRate).setScale(i, RoundingMode.HALF_UP)); // net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge)); net_surage = net_surage.add(params.getBigDecimal("channel_surcharge")); + transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee")); } BigDecimal org_charge = total_surage.subtract(royalpay_surage); json.put("channel", oneChannel.getKey()); json.put("gross_amount", total); json.put("total_charge", total_surage); + json.put("transaction_fee", transaction_fee); json.put("net_charge", net_surage); json.put("org_rate", orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value")); json.put("royalpay_charge", royalpay_surage); @@ -525,6 +479,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { BigDecimal net_surage = BigDecimal.ZERO; BigDecimal royalpay_surage = BigDecimal.ZERO; BigDecimal share_surage = BigDecimal.ZERO; + BigDecimal transaction_fee = BigDecimal.ZERO; JSONObject json = new JSONObject(); String channel = oneChannel.getKey(); @@ -534,7 +489,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { for (JSONObject params : oneChannel.getValue()) { BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount"); BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); - BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); + BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")).subtract(params.getBigDecimal("transaction_fee")); //增加货币判断 int i = currencyScale(params.getString("clearing_currency")); BigDecimal parent_surage = tmpClearingAmount.multiply(parentOrgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP); @@ -545,6 +500,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { //net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge)); net_surage = net_surage.add(params.getBigDecimal("channel_surcharge")); share_surage = share_surage.add(roy_surage.subtract(parent_surage)).setScale(i, RoundingMode.HALF_UP); + transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee")); } BigDecimal org_charge = total_surage.subtract(royalpay_surage); @@ -556,6 +512,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { json.put("partner_charge", royalpay_surage); json.put("share_charge", share_surage); json.put("org_charge", org_charge); + json.put("transaction_fee", transaction_fee); json.put("commission_type", "1"); json.put("create_time", new Date()); amountByChannel.add(json); @@ -579,6 +536,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { BigDecimal total_surage = BigDecimal.ZERO; BigDecimal net_surage = BigDecimal.ZERO; BigDecimal royalpay_surage = BigDecimal.ZERO; + BigDecimal transaction_fee = BigDecimal.ZERO; Date datefrom = new Date(); Date dateto = new Date(); JSONObject json = new JSONObject(); @@ -617,6 +575,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { royalpay_surage = royalpay_surage.add(tmpClearingAmount.multiply(channelRate).setScale(i, RoundingMode.HALF_UP)); //net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge)); net_surage = net_surage.add(params.getBigDecimal("channel_surcharge")); + transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee")); } BigDecimal org_charge = total_surage.subtract(royalpay_surage); if (channel.toLowerCase().equals("alipay_direct")) { @@ -642,6 +601,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { json.put("org_net_charge", net_surage); } json.put("org_charge", org_charge); + json.put("transaction_fee", transaction_fee); json.put("commission_type", "1"); json.put("create_time", new Date()); json.put("date_from", DateFormatUtils.format(datefrom, "yyyy-MM-dd")); @@ -825,6 +785,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { temp.put("total_charge", 0); temp.put("royalpay_charge", 0); temp.put("org_charge", 0); + temp.put("transaction_fee", 0); temp.put("share_charge", 0); temp.put("channel", channel.getString("channel")); temp.put("net_charge", 0); @@ -839,28 +800,8 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { mineCommission.put("share_charge", mineCommission.getBigDecimal("share_charge").subtract(channel.getBigDecimal("share_charge"))); financialPartnerCommissionMapper.update(mineCommission); } - channel.put("month", month); - channel.put("year", year); - channel.put("org_id", orgId); - //撤销agent表 -// financialAgentCommissionMapper.save(channel); } } - //撤销agent表 -// Map> groupByClientMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("client_id"))); -// for (Map.Entry> oneClient : groupByClientMap.entrySet()) { -// -// JSONObject org = orgMapper.findOne(oneClient.getValue().get(0).getInteger("org_id")); -// Map> groupByChannel = oneClient.getValue().stream().collect(Collectors.groupingBy(e -> e.getString("channel"))); -// -// List clientChannelAmount = clientChannelAmount(oneClient.getKey(),org, groupByChannel, channelCharge,year,month,2); -// for (JSONObject channel : clientChannelAmount) { -// financialAgentCommissionDetailMapper.save(channel); -// } -// -// } - - } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAuditProcessMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAuditProcessMapper.java index 9ebfae667..c277cfa4b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAuditProcessMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAuditProcessMapper.java @@ -20,5 +20,5 @@ public interface ClientAuditProcessMapper { int update(JSONObject partner); @AutoSql(SqlType.SELECT) - PageList getAuditLog(@Param("client_id") int client_id, PageBounds pagination); + PageList getAuditLog(@Param("client_id") int client_id, @Param("type") int type, PageBounds pagination); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java index 1d036096e..d7169064e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java @@ -52,6 +52,8 @@ public interface ClientFilesMapper { JSONObject getSourceAgreeFilesByClientId(@Param("client_id") int clientId); + JSONObject getSourceCardAgreeFilesByClientId(@Param("client_id") int clientId,@Param("file_name")String file_name); + void deleteByClientAndFileId(@Param("file_id") String file_id); void deleteAggreeByClientId(@Param("client_id") int file_id); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMWFilesMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMWFilesMapper.java index 88efbe614..e5064a1cf 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMWFilesMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMWFilesMapper.java @@ -1,6 +1,7 @@ package au.com.royalpay.payment.manage.mappers.system; import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect; import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; @@ -22,5 +23,5 @@ public interface ClientMWFilesMapper { @AutoSql(SqlType.SELECT) @AdvanceSelect(addonWhereClause = "is_valid = 1") - List findClientFile(@Param("client_id") int clientId); + List findClientFile(@Param("client_id") int clientId, PageBounds pageBounds); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java index 98ecbd655..a6972d809 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java @@ -53,6 +53,8 @@ public interface ClientRateMapper { JSONObject latestChannelCleanDays(@Param("rate_name")String rate_name, @Param("client_id")int client_id); + JSONObject latestCardChannelCleanDays(@Param("rate_name")String rate_name, @Param("client_id")int client_id); + JSONObject latestExpiryConfig(@Param("client_id")int client_id,@Param("rate_name") String rate_name); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysClientUpayProfileMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysClientUpayProfileMapper.java new file mode 100644 index 000000000..2e9842a40 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysClientUpayProfileMapper.java @@ -0,0 +1,19 @@ +package au.com.royalpay.payment.manage.mappers.system; + +import com.alibaba.fastjson.JSONObject; +import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; +import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; +import com.yixsoft.support.mybatis.autosql.annotations.SqlType; +import org.apache.ibatis.annotations.Param; + +@AutoMapper(tablename = "sys_client_upay_profile", pkName = "client_id") +public interface SysClientUpayProfileMapper { + @AutoSql(SqlType.INSERT) + void save(JSONObject info); + + @AutoSql(SqlType.UPDATE) + void update(JSONObject info); + + @AutoSql(SqlType.SELECT) + JSONObject findInfo(@Param("client_id") int clientId); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientMWAuthFilesInfo.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientMWAuthFilesInfo.java index 51d263c92..fde67b19e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientMWAuthFilesInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientMWAuthFilesInfo.java @@ -7,13 +7,20 @@ import org.apache.commons.lang3.StringUtils; * Created by yishuqian on 07/03/2017. */ public class ClientMWAuthFilesInfo { - private String upay_application_form; - private String upay_agreement_file; + private String client_bank_file; + private String client_company_file; + private String refund_exchange_policy; + private String upay_privacy_policy; + private String card_security_policy; + private String upay_promotional_offer; + private String upay_terms_conditions; private String upay_offer_letter; private String upay_driver_license; - private String upay_residence_certificate; + private String kyc_utility_bill_file; private String upay_risk_level; private String upay_risk_remark; + private String upay_application_form; + private String upay_desc_file; public JSONObject toJson(){ return (JSONObject)JSONObject.toJSON(this); @@ -30,14 +37,6 @@ public class ClientMWAuthFilesInfo { return params; } - public String getUpay_agreement_file() { - return upay_agreement_file; - } - - public String getUpay_application_form() { - return upay_application_form; - } - public String getUpay_driver_license() { return upay_driver_license; } @@ -46,18 +45,6 @@ public class ClientMWAuthFilesInfo { return upay_offer_letter; } - public void setUpay_agreement_file(String upay_agreement_file) { - this.upay_agreement_file = upay_agreement_file; - } - - public void setUpay_application_form(String upay_application_form) { - this.upay_application_form = upay_application_form; - } - - public String getUpay_residence_certificate() { - return upay_residence_certificate; - } - public String getUpay_risk_level() { return upay_risk_level; } @@ -70,10 +57,6 @@ public class ClientMWAuthFilesInfo { this.upay_offer_letter = upay_offer_letter; } - public void setUpay_residence_certificate(String upay_residence_certificate) { - this.upay_residence_certificate = upay_residence_certificate; - } - public String getUpay_risk_remark() { return upay_risk_remark; } @@ -85,4 +68,84 @@ public class ClientMWAuthFilesInfo { public void setUpay_risk_remark(String upay_risk_remark) { this.upay_risk_remark = upay_risk_remark; } + + public String getCard_security_policy() { + return card_security_policy; + } + + public String getClient_bank_file() { + return client_bank_file; + } + + public String getClient_company_file() { + return client_company_file; + } + + public String getUpay_privacy_policy() { + return upay_privacy_policy; + } + + public String getUpay_promotional_offer() { + return upay_promotional_offer; + } + + public void setCard_security_policy(String card_security_policy) { + this.card_security_policy = card_security_policy; + } + + public String getUpay_terms_conditions() { + return upay_terms_conditions; + } + + public void setClient_bank_file(String client_bank_file) { + this.client_bank_file = client_bank_file; + } + + public void setClient_company_file(String client_company_file) { + this.client_company_file = client_company_file; + } + + public void setUpay_privacy_policy(String upay_privacy_policy) { + this.upay_privacy_policy = upay_privacy_policy; + } + + public void setUpay_promotional_offer(String upay_promotional_offer) { + this.upay_promotional_offer = upay_promotional_offer; + } + + public void setUpay_terms_conditions(String upay_terms_conditions) { + this.upay_terms_conditions = upay_terms_conditions; + } + + public String getRefund_exchange_policy() { + return refund_exchange_policy; + } + + public void setRefund_exchange_policy(String refund_exchange_policy) { + this.refund_exchange_policy = refund_exchange_policy; + } + + public String getKyc_utility_bill_file() { + return kyc_utility_bill_file; + } + + public void setKyc_utility_bill_file(String kyc_utility_bill_file) { + this.kyc_utility_bill_file = kyc_utility_bill_file; + } + + public void setUpay_application_form(String upay_application_form) { + this.upay_application_form = upay_application_form; + } + + public String getUpay_application_form() { + return upay_application_form; + } + + public String getUpay_desc_file() { + return upay_desc_file; + } + + public void setUpay_desc_file(String upay_desc_file) { + this.upay_desc_file = upay_desc_file; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRegisterInfo.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRegisterInfo.java index 5a961a42b..e7764f981 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRegisterInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRegisterInfo.java @@ -112,8 +112,27 @@ public class ClientRegisterInfo { private String client_pay_type; @NotEmpty(message = "error.payment.valid.param_missing") private String client_pay_desc; + @JSONField(name = "it_contact_person_email") + private String itContactPersonEmail; + @JSONField(name = "acceptor_name") + private String acceptorName; + @JSONField(name = "expected_card_revenue") + private String expectCardRevenue; + @JSONField(name = "average_card_transaction") + private String averageCardTransaction; + @JSONField(name = "mw_industry") + private String mwIndustry; + @JSONField(name = "enable_international_card") + private boolean enableInternaltionCard; + @JSONField(name = "enable_cross_payment") + private boolean enableCrossPayment; + @JSONField(name = "enable_card_payment") + private boolean enableCardPayment; public JSONObject insertObject() { + if (industry == null) { + setIndustry("331"); + } JSONObject res = (JSONObject) JSON.toJSON(this); if (client_apply_id==null){ res.remove("client_apply_id"); @@ -550,4 +569,68 @@ public class ClientRegisterInfo { public void setMarketingWechatId(String marketingWechatId) { this.marketingWechatId = marketingWechatId; } + + public String getItContactPersonEmail() { + return itContactPersonEmail; + } + + public void setItContactPersonEmail(String itContactPersonEmail) { + this.itContactPersonEmail = itContactPersonEmail; + } + + public void setAcceptorName(String acceptorName) { + this.acceptorName = acceptorName; + } + + public String getAcceptorName() { + return acceptorName; + } + + public boolean isEnableInternaltionCard() { + return enableInternaltionCard; + } + + public String getAverageCardTransaction() { + return averageCardTransaction; + } + + public String getExpectCardRevenue() { + return expectCardRevenue; + } + + public String getMwIndustry() { + return mwIndustry; + } + + public void setAverageCardTransaction(String averageCardTransaction) { + this.averageCardTransaction = averageCardTransaction; + } + + public void setEnableInternaltionCard(boolean enableInternaltionCard) { + this.enableInternaltionCard = enableInternaltionCard; + } + + public void setExpectCardRevenue(String expectCardRevenue) { + this.expectCardRevenue = expectCardRevenue; + } + + public void setMwIndustry(String mwIndustry) { + this.mwIndustry = mwIndustry; + } + + public boolean isEnableCardPayment() { + return enableCardPayment; + } + + public boolean isEnableCrossPayment() { + return enableCrossPayment; + } + + public void setEnableCardPayment(boolean enableCardPayment) { + this.enableCardPayment = enableCardPayment; + } + + public void setEnableCrossPayment(boolean enableCrossPayment) { + this.enableCrossPayment = enableCrossPayment; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/PartnerQuery.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/PartnerQuery.java index 56e39c370..4f2503bbd 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/PartnerQuery.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/PartnerQuery.java @@ -51,6 +51,7 @@ public class PartnerQuery { private boolean bd_upload_material = false; private boolean is_valid = false; private String merchant_id; + private boolean card_approving = false; public String getClient_moniker() { return StringUtils.isEmpty(client_moniker) ? null : client_moniker; @@ -120,6 +121,9 @@ public class PartnerQuery { if (approving) { param.put("approving", true); } + if(card_approving){ + param.put("card_approving",true); + } if (org_id != null) { param.put("org_id", org_id); } @@ -472,4 +476,12 @@ public class PartnerQuery { public void setSuburb(String suburb) { this.suburb = suburb; } + + public boolean isCard_approving() { + return card_approving; + } + + public void setCard_approving(boolean card_approving) { + this.card_approving = card_approving; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index e78be6bb6..b204554ce 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -81,6 +81,9 @@ public interface ClientManager { @Transactional(noRollbackFor = EmailException.class) void auditClient(JSONObject manager, String clientMoniker, int pass); + @Transactional(noRollbackFor = EmailException.class) + void auditCardClient(JSONObject manager, String clientMoniker, int pass); + @Transactional(noRollbackFor = EmailException.class) void auditClientGreenChannel(JSONObject manager, String clientMoniker); @@ -269,6 +272,8 @@ public interface ClientManager { JSONObject getSourceAgreeFiles(JSONObject manage, String clientMoniker); + JSONObject getSourceCardAgreeFiles(String clientMoniker, JSONObject manager, String fileName); + void deleteAuthFiles(String fileId); void deleteAuthFilesByAdmin(String fileId); @@ -297,8 +302,17 @@ public interface ClientManager { void commitToCompliance(String clientMoniker, JSONObject manager); + void commitToCardCompliance(String clientMoniker, JSONObject manager); + void commitToDoAgreeFile(String clientMoniker, JSONObject manager); + /** + * 提交资料,申请卡支付 + * @param clientMoniker + * @param manager + */ + void commitToDoCardAgreeFile(String clientMoniker, JSONObject manager); + void commitToGreenChannel(String clientMoniker, JSONObject manager); void changePaymentPage(JSONObject manager, String clientMoniker, String paypad_version); @@ -335,6 +349,8 @@ public interface ClientManager { void refusePartner(String clientMoniker, JSONObject manager, String refuse_remark); + void cardRefusePartner(String clientMoniker, JSONObject manager, String refuse_remark); + JSONArray getAllClientIds(int clientId); void updateAppClient(JSONObject account, int client_id, AppClientBean appClientBean); @@ -375,6 +391,10 @@ public interface ClientManager { void getAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; + void getAggregateCardAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; + + void getAggregateCardPromotionaAgreeFile(String clientMoniker, JSONObject manager, boolean renewal,String promotionalEffectiveDate,int promotionalPeriod) throws Exception; + void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; void temporaryExportPdf(String clientMoniker, JSONObject manager, HttpServletResponse httpResponse) throws Exception; @@ -383,6 +403,8 @@ public interface ClientManager { void completeAgree(String clientMoniker, JSONObject manager); + void cardCompleteAgree(String clientMoniker, JSONObject manager); + void downloadComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception; void downloadMWComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception; 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 9e3f7fac3..75f188080 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 @@ -142,6 +142,7 @@ import java.security.InvalidParameterException; import java.security.KeyPair; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.List; import java.util.*; @@ -183,6 +184,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private ClientIncrementalMapper clientIncrementalMapper; + @Value("${client_card.account_reserve}") + private String cardAccountReserve; + @Value("${client_card.annual_rate}") + private String cardAnnualRate; + @Value("${app.redis.prefix}") private String redisPrefix; private ApplicationEventPublisher publisher; @@ -326,6 +332,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private RPayPaymentCardSvcApi rPayPaymentCardSvcApi; @Resource private RPayMerchantMapper rPayMerchantMapper; + @Resource + private SysClientUpayProfileMapper sysClientUpayProfileMapper; @Resource @@ -336,6 +344,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private static final String CLIENT_AGREE_FILE = "client_agree_file"; private static final String CLIENT_COMPANY_FILE = "client_company_file"; private static final String CLIENT_APPLY_FILE = "client_apply_file"; + + //卡支付合同文件 + private static final String LETTER_OF_OFFER_FILE="letter_of_offer_file"; + private static final String PROMOTIONAL_OFFER_FILE="promotional_offer_file"; + private static final String TERMS_AND_CONDITIONS_FILE="terms_and_conditions_file"; + + private static final List tags = new ArrayList<>(); private static final String KYC_UTILITY_BILL_FILE = "kyc_utility_bill_file"; @@ -433,6 +448,10 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientConfig.put("ext_params",client.getString("ext_params")); } client.putAll(clientConfig); + JSONObject upayInfo = sysClientUpayProfileMapper.findInfo(client.getIntValue("client_id")); + if (upayInfo != null) { + client.putAll(upayInfo); + } client.put("unsubscribe", mailUnsubMapper.findOneByClientMoniker(clientMoniker) == null ? false : true); client.put("show_all_permission", true); int role = manager != null ? manager.getIntValue("role") : 0; @@ -447,7 +466,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("show_all_permission", checkBDPermission > 0); if (checkBDPermission > 0) { JSONObject org = orgMapper.findOne(manager.getIntValue("org_id")); - boolean bdRateEditable = client.getIntValue("approve_result") != 1 || org.getBooleanValue("rate_editable"); + boolean bdRateEditable = client.getIntValue("approve_result") != 1 || org.getBooleanValue("rate_editable") || + //开起信用卡支付申请,并且申请结果不是:null.新建 1.通过 4.BD已提交资料状态 + ( !clientConfig.getBoolean("enable_card_payment") && !client.containsKey("upay_approve_result") && client.getIntValue("upay_approve_result") !=1 && client.getIntValue("upay_approve_result") !=4); client.put("rate_editable", bdRateEditable); } else { client.put("company_phone", "******"); @@ -486,12 +507,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("min_customer_surcharge_rate", client.getBigDecimal("rate_value").add(new BigDecimal("0.1"))); } - // 商户审核过程日志 - PageList audit_logs = clientAuditProcessMapper.getAuditLog(client.getIntValue("client_id"), + // 商户跨境支付审核过程日志 + PageList audit_logs = clientAuditProcessMapper.getAuditLog(client.getIntValue("client_id"),1, new PageBounds(Order.formString("create_time"))); if (audit_logs != null && !audit_logs.isEmpty()) { client.put("audit_logs", audit_logs); } + //商户卡支付审核过程日志 + PageList audit_card_logs = clientAuditProcessMapper.getAuditLog(client.getIntValue("client_id"),2, + new PageBounds(Order.formString("create_time"))); + if (audit_card_logs != null && !audit_card_logs.isEmpty()) { + client.put("audit_card_logs", audit_card_logs); + } //HF支付链接二维码 if (client.getString("hf_pay_url") != null) { @@ -782,10 +809,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid partner.put("ali_sub_merchant_id", registery.getClientMoniker()); partner.put("credential_code", RandomStringUtils.random(32, true, true)); partner.put("creator", manager.getString("manager_id")); - // if (manager.getIntValue("org_id") == 0) { - // throw new ForbiddenException("You were not belong to any organizations so that you cannot create new - // client"); - // } partner.put("org_id", manager.getIntValue("org_id")); if (StringUtils.isNotEmpty(registery.getLogoId())) { partner.put("logo_url", attachmentClient.getFileUrl(registery.getLogoId())); @@ -807,43 +830,24 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid //isRiskyMerchant(partner, null); try { - clientMapper.save(partner); JSONObject clientConfig = new JSONObject(); clientConfig.put("client_id", partner.getIntValue("client_id")); clientConfig.put("client_moniker", partner.getString("client_moniker")); clientConfig.put("client_pay_type", partner.getString("client_pay_type")); clientConfig.put("client_pay_desc", partner.get("client_pay_desc")); + clientConfig.put("enable_cross_payment", partner.get("enable_cross_payment")); + clientConfig.put("enable_card_payment", partner.get("enable_card_payment")); clientConfigService.save(clientConfig); permissionPartnerManagerImpl.permissionClientModuleSave(partner.getIntValue("client_id"), partner.getString("client_moniker")); + saveLegalAndMarketingInfo(partner); + if (registery.isEnableCardPayment()) { + sysClientUpayProfileMapper.save(partner); + } } catch (Exception e) { throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); } - - try { - JSONObject representativeInfo = new JSONObject(); - representativeInfo.put("client_id", partner.getIntValue("client_id")); - representativeInfo.put("representative_person", partner.getString("legal_representative_person")); - representativeInfo.put("phone", partner.getString("legal_representative_phone")); - representativeInfo.put("email", partner.getString("legal_representative_email")); - representativeInfo.put("job_title", partner.getString("legal_representative_job")); - representativeInfo.put("address", partner.getString("registered_address")); - representativeInfo.put("suburb", partner.getString("registered_suburb")); - representativeInfo.put("postcode", partner.getString("registered_postcode")); - representativeInfo.put("state", partner.getString("registered_state")); - representativeInfo.put("legal_representative_wechatid", partner.getString("legal_representative_wechatid")); -// marking联系人 - representativeInfo.put("marketing_person", partner.getString("marketing_person")); - representativeInfo.put("marketing_phone", partner.getString("marketing_phone")); - representativeInfo.put("marketing_email", partner.getString("marketing_email")); - representativeInfo.put("marketing_job_title", partner.getString("marketing_job")); - representativeInfo.put("marketing_wechatid", partner.getString("marketing_wechatid")); - sysClientLegalPersonMapper.save(representativeInfo); - } catch (Exception e) { - throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); - } - if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { JSONObject client_bd = new JSONObject(); client_bd.put("client_id", partner.getIntValue("client_id")); @@ -917,6 +921,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid sysClientLegalPersonMapper.save(representativeInfo); } + if (info.isEnableCardPayment()) { + JSONObject upay = sysClientUpayProfileMapper.findInfo(clientId); + if (upay == null) { + sysClientUpayProfileMapper.save(updateInfo); + }else { + upay.putAll(updateInfo); + sysClientUpayProfileMapper.update(upay); + } + } + int originReferrerId = client.getIntValue("referrer_id"); int updateReferrerId = Integer.parseInt(info.getReferrer_id() == null ? "0" : info.getReferrer_id()); if (originReferrerId == 0 && updateReferrerId != 0) { @@ -932,6 +946,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject clientConfig = new JSONObject(); clientConfig.put("client_id", clientId); clientConfig.put("client_moniker", client.getString("client_moniker")); + clientConfig.put("enable_cross_payment", updateInfo.getBooleanValue("enable_cross_payment")); + clientConfig.put("enable_card_payment", updateInfo.getBooleanValue("enable_card_payment")); if (StringUtils.isNotBlank(updateInfo.getString("client_pay_type")) && StringUtils.isNotBlank(updateInfo.getString("client_pay_desc"))) { clientConfig.put("client_pay_type", updateInfo.getString("client_pay_type")); clientConfig.put("client_pay_desc", updateInfo.getString("client_pay_desc")); @@ -1174,30 +1190,61 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientModifySupport.processClientModify(auditModify); sendCommissionWechatMessage(client);// wxMessage if (pass == 1) { - createKycAuthStatus(manager,client); + createKycAuthStatus(manager, client); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false)); if (client.getIntValue("source") == 4 || client.getIntValue("source") == 5) { List accounts = clientAccountMapper.listAdminAccounts(client.getIntValue("client_id")); JSONObject account = accounts.get(0); - sendInitEmail(client, account.getString("username"), "*****"); + sendInitEmail(client, account.getString("username"), "*****", false); // sendInitEmail(manager, client, account.getString("username"), "*****"); - saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager,1); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false)); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "common_sub_merchant_id", false)); gatewayMerchantApply.notifyOrgMerchantStatus(client); } else if (checkGreenChannel && client.getIntValue("open_status") == 5) { // 绿色通道通过后不发邮件 logger.info("PASS 绿色通道:" + clientMoniker); - saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager,1); } else { - initAdminUserAndSendEmail(manager, clientMoniker, client); - saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager); + initAdminUserAndSendEmail(manager, clientMoniker, client, false); + saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager,1); } } clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id")); } - private void createKycAuthStatus(JSONObject manager,JSONObject client){ + @Override + public void auditCardClient(JSONObject manager, String clientMoniker, int pass) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + //检查商户是否进入平台黑名单 + int clientId = client.getIntValue("client_id"); + isRiskyMerchant(client, clientBankAccountMapper.clientBankAccounts(clientId).get(0)); + + JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(clientId); + client.putAll(clientConfigService.find(client.getIntValue("client_id"))); + Integer open_status_to = cardFlowInfo != null? cardFlowInfo.getIntValue("upay_open_status") : null; + cardFlowInfo.put("upay_open_status",5); + cardFlowInfo.put("upay_approve_result",1); + sysClientUpayProfileMapper.update(cardFlowInfo); + sendCardCommissionWechatMessage(client);// wxMessage + if (pass == 1) { + createKycAuthStatus(manager, client); + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false)); + List accounts = clientAccountMapper.listAdminAccounts(clientId); + if (accounts != null && accounts.size() > 0) { + sendInitEmail(client, accounts.get(0).getString("username"), "*******", true); + }else { + initAdminUserAndSendEmail(manager, clientMoniker, client, true); + } + saveClientAuditProcess(client.getIntValue("client_id"), open_status_to, 5, "合规通过", manager,2); + } + clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id")); + } + + private void createKycAuthStatus(JSONObject manager, JSONObject client) { JSONObject compliance = clientComplianceCompanyMapper.findKycFileByClientId(client.getIntValue("client_id")); if (compliance != null) { compliance.put("client_id", client.getIntValue("client_id")); @@ -1240,15 +1287,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new BadRequestException("该商户未设置微信 Sub Merchant ID!"); } clientModifySupport.processClientModify(new GreenChannelModify(manager, clientMoniker, manager.getString("manager_id"))); - saveClientAuditProcess(client.getIntValue("client_id"), 10, 1, "绿色通道申请通过", manager); + saveClientAuditProcess(client.getIntValue("client_id"), 10, 1, "绿色通道申请通过", manager,1); sendCommissionWechatMessage(client); - initAdminUserAndSendEmail(manager, clientMoniker, client); + initAdminUserAndSendEmail(manager, clientMoniker, client, false); } - private void initAdminUserAndSendEmail(JSONObject manager, String clientMoniker, JSONObject client) { - if (StringUtils.isEmpty(client.getString("sub_merchant_id"))) { - throw new BadRequestException("Sub Merchant ID Can't be null "); - } + private void initAdminUserAndSendEmail(JSONObject manager, String clientMoniker, JSONObject client,boolean isUpayEmail) { String username = clientMoniker; boolean duplicated = true; String pwd = RandomStringUtils.random(8, true, true); @@ -1265,7 +1309,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid username += "0"; } } - sendInitEmail(client, username.toLowerCase(), pwd); + sendInitEmail(client, username.toLowerCase(), pwd, isUpayEmail); // sendInitEmail(manager, client, username, pwd); } @@ -1291,16 +1335,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client.getIntValue("source") == 4) { JSONObject account = accounts.get(0); // sendInitEmail(manager, client, account.getString("username"), "*****"); - sendInitEmail(client, account.getString("username"), "*****"); + sendInitEmail(client, account.getString("username"), "*****", false); } else { if (accounts.size() == 0) { - initAdminUserAndSendEmail(manager, clientMoniker, client); + initAdminUserAndSendEmail(manager, clientMoniker, client, false); } else { JSONObject account = accounts.get(0); String pwd = RandomStringUtils.random(8, true, true); resetAccountPwd(manager, clientMoniker, account.getString("account_id"), pwd); // sendInitEmail(manager, client, account.getString("username"), pwd); - sendInitEmail(client, account.getString("username"), pwd); + sendInitEmail(client, account.getString("username"), pwd, false); } } } @@ -1372,7 +1416,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid }.start(); } - public void sendInitEmail(final JSONObject client, String username, String pwd) { + public void sendInitEmail(final JSONObject client, String username, String pwd,boolean isUpayAuditPass) { logger.debug("sending email after comply"); JSONObject model = new JSONObject(); model.put("username", username); @@ -1422,16 +1466,30 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","), "", contentBd); JSONObject clientUpdate = new JSONObject(); - clientUpdate.put("client_id", client.getIntValue("client_id")); - clientUpdate.put("approve_email_send", 3); - clientUpdate.put("approve_email_id", emailId); - clientMapper.update(clientUpdate); + if (isUpayAuditPass) { + clientUpdate.put("client_id", client.getIntValue("client_id")); + clientUpdate.put("upay_approve_email_send", 3); + clientUpdate.put("upay_approve_email_id", emailId); + sysClientUpayProfileMapper.update(clientUpdate); + }else { + clientUpdate.put("client_id", client.getIntValue("client_id")); + clientUpdate.put("approve_email_send", 3); + clientUpdate.put("approve_email_id", emailId); + clientMapper.update(clientUpdate); + } } catch (Exception e) { JSONObject clientUpdate = new JSONObject(); - clientUpdate.put("client_id", client.getIntValue("client_id")); - clientUpdate.put("approve_email_send", 0); - clientUpdate.put("approve_email_id", null); - clientMapper.update(clientUpdate); + if (isUpayAuditPass) { + clientUpdate.put("client_id", client.getIntValue("client_id")); + clientUpdate.put("upay_approve_email_send", 0); + clientUpdate.put("upay_approve_email_id", null); + sysClientUpayProfileMapper.update(clientUpdate); + }else { + clientUpdate.put("client_id", client.getIntValue("client_id")); + clientUpdate.put("approve_email_send", 0); + clientUpdate.put("approve_email_id", null); + clientMapper.update(clientUpdate); + } throw new EmailException("Email Sending Failed", e); } } @@ -1605,7 +1663,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, permissionKey, allow)); + JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id")); + upayProfileInfo.put(permissionKey,allow); + sysClientUpayProfileMapper.update(upayProfileInfo); } @Override @@ -2064,7 +2124,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientRateMapper.updateConfig(rateLog); } if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getString("type"))) { - JSONObject extRateParams = new JSONObject(){{ + JSONObject extRateParams = new JSONObject() {{ put("domestic_rate_value", config.getBigDecimal("rate_value")); put("overseas_rate_value", config.getJSONObject("ext_rates").getBigDecimal("international_rate_value")); }}; @@ -2094,6 +2154,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid configJson.put("manager_id", manager.getString("manager_id")); configJson.put("manager_name", manager.getString("username")); configJson.put("update_time", new Date()); + if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getRateName())) { + JSONObject extParams = configJson.getJSONObject("ext_rates"); + extParams.put("domestic_rate_value", config.getRateValue()); + configJson.put("ext_rates", extParams.toJSONString()); + } clientRateMapper.updateConfig(configJson); // if ("Rpay".equals(configJson.getString("rate_name"))) { // rpayApi.modifySurchargeConfig(client); @@ -2101,7 +2166,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid int clientId = client.getIntValue("client_id"); JSONObject changeRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "Wechat"); int cleanDays = changeRate.getIntValue("clean_days"); - if (cleanDays != client.getIntValue("clean_days") && StringUtils.equalsIgnoreCase("Wechat",config.getRateName())) { + if (cleanDays != client.getIntValue("clean_days") && StringUtils.equalsIgnoreCase("Wechat", config.getRateName())) { clientModifySupport.processClientConfigModify(new ClearDaysModify(manager, clientMoniker, cleanDays)); } // clientMapper.updateCleanDays(clientId, config.getCleanDays()); @@ -2140,7 +2205,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); List listChildClients = clientMapper.listChildClients(client.getIntValue("client_id")); JSONObject mchConfig = merchantInfoProvider.getMchExtParams(client.getIntValue("client_id")); - if(mchConfig.getBooleanValue("hide_sub_mch")){ + if (mchConfig.getBooleanValue("hide_sub_mch")) { return new ArrayList<>(); } if (mchConfig.getBooleanValue("level3_mch_config")) { @@ -2158,7 +2223,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker,String searchText, int page) { + public JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker, String searchText, int page) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -2166,7 +2231,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); PageBounds pageBounds; - pageBounds= new PageBounds(page, 20, Order.formString("create_time.desc")); + pageBounds = new PageBounds(page, 20, Order.formString("create_time.desc")); JSONObject params = new JSONObject() {{ put("parent_client_id", client.getIntValue("client_id")); }}; @@ -2766,7 +2831,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client_ids != null) { params.put("client_ids", Arrays.asList(client_ids)); params.remove("client_id"); - }else { + } else { queryModifyClientIds(client.getIntValue("client_id"), params); } List deviceIds = clientDeviceMapper.listClientDeviceIds(params); @@ -3120,6 +3185,35 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } + @Override + @Transactional + public void getAggregateCardAgreeFile(String clientMoniker, JSONObject manager, boolean renewal){ + JSONObject client = clientMapper.findClientByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + exportLetterOfferPDF(clientMoniker,manager); + exportTermsConditionsPDF(clientMoniker,manager); + + if (!renewal) { + JSONObject cardFlow = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id")); + cardFlow.put("upay_open_status",2); + sysClientUpayProfileMapper.update(cardFlow); + } + if (manager != null) { + saveClientAuditProcess(client.getIntValue("client_id"), 1, 2, "Compliance合同制作中", manager,2); + } + } + @Override + @Transactional + public void getAggregateCardPromotionaAgreeFile(String clientMoniker, JSONObject manager, boolean renewal,String promotionalEffectiveDate,int promotionalPeriod) throws ParseException { + JSONObject client = clientMapper.findClientByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + exportPromotionalOfferPDF(clientMoniker,manager,promotionalEffectiveDate,promotionalPeriod); + } + @Override public void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -3317,7 +3411,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } if (manager != null) { - saveClientAuditProcess(client.getIntValue("client_id"), 1, 2, "Compliance合同制作中", manager); + saveClientAuditProcess(client.getIntValue("client_id"), 1, 2, "Compliance合同制作中", manager,1); } } } @@ -3334,11 +3428,29 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } client.put("open_status", 3); clientModifySupport.processClientModify(new OpenStatusModify(manager, clientMoniker, 3)); - saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成,等待BD处理", manager); + saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成,等待BD处理", manager,1); // sendAgreeFileMsgToBD(client,null); sendCommissionWechatMessage(client); } + @Override + public void cardCompleteAgree(String clientMoniker, JSONObject manager) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + List existLeffterFiles = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), LETTER_OF_OFFER_FILE); + List existConditionsFiles = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), TERMS_AND_CONDITIONS_FILE); + if (CollectionUtils.isEmpty(existLeffterFiles) && CollectionUtils.isEmpty(existConditionsFiles)) { + throw new BadRequestException("The Agree File is not Complete!"); + } + JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id")); + cardFlowInfo.put("upay_open_status", 3); + sysClientUpayProfileMapper.update(cardFlowInfo); + saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成,等待BD处理", manager,2); + sendCardCommissionWechatMessage(client); + } + @Override public void downloadComplianceZip(String clientMoniker, HttpServletResponse response) throws Exception { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -3385,7 +3497,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - List files = clientMWAuthFilesInfo.findClientFile(client.getIntValue("client_id")); + List files = clientMWAuthFilesInfo.findClientFile(client.getIntValue("client_id"), new PageBounds(1, 999999, Order.formString("last_update_date.asc"))); if (files != null && files.size() > 0) { List filePaths = new ArrayList<>(); for (JSONObject file : files) { @@ -3527,7 +3639,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - clientModifySupport.processClientModify( new SwitchAllowSurchargeCreditModify(manager, clientMoniker, "enable_presettle", presettle)); + clientModifySupport.processClientModify(new SwitchAllowSurchargeCreditModify(manager, clientMoniker, "enable_presettle", presettle)); } @Override @@ -3580,7 +3692,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } params.put("display_name", manager.getString("display_name")); - clientApproveIdInfo(params,client); + clientApproveIdInfo(params, client); } @Override @@ -3591,7 +3703,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } int clientId = client.getIntValue("client_id"); params.put("client_id", client.getIntValue("client_id")); - clientConfigMapper.update(params); + JSONObject upayInfo = sysClientUpayProfileMapper.findInfo(clientId); + if (upayInfo == null) { + sysClientUpayProfileMapper.save(params); + }else { + sysClientUpayProfileMapper.update(params); + } } @Override @@ -3669,10 +3786,23 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return sourceFile; } + @Override + public JSONObject getSourceCardAgreeFiles(String clientMoniker, JSONObject manager, String fileName){ + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + JSONObject sourceFile = clientFilesMapper.getSourceCardAgreeFilesByClientId(client.getIntValue("client_id"),fileName); + if (sourceFile != null) { + sourceFile.put(sourceFile.getString("file_name"), sourceFile.getString("file_value")); + } + return sourceFile; + } + @Override public JSONObject getAllAuthFiles(JSONObject manager, String clientMoniker) { JSONObject client = getClientInfoByMoniker(clientMoniker); - String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file", "client_apply_file","kyc_utility_bill_file"}; + String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file", "client_apply_file", "kyc_utility_bill_file"}; if (client == null) { throw new InvalidShortIdException(); } @@ -3709,7 +3839,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - List clientFiles = clientMWAuthFilesInfo.findClientFile(client.getIntValue("client_id")); + List clientFiles = clientMWAuthFilesInfo.findClientFile(client.getIntValue("client_id"), new PageBounds(1,999999, Order.formString("last_update_date.asc"))); JSONObject fileJson = new JSONObject(); for (JSONObject file : clientFiles) { fileJson.put(file.getString("file_name"), file.getString("file_value")); @@ -3727,7 +3857,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid List clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id")); JSONObject fileJson = new JSONObject(); JSONObject companyFile = clientComplianceCompanyMapper.findKycFileByClientId(client.getIntValue("client_id")); - fileJson.put("companyFile",companyFile); + fileJson.put("companyFile", companyFile); if (clientFiles != null && clientFiles.size() > 0) { for (String fileKey : fileKeys) { List clientFileUrl = clientFiles.stream() @@ -3867,11 +3997,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } int clientId = client.getIntValue("client_id"); try { - updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_APPLICATION_FORM.getFileName(), filesInfo.getUpay_application_form()); - updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_AGREEMENT_FILE.getFileName(), filesInfo.getUpay_agreement_file()); - updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_OFFER_LETTER.getFileName(), filesInfo.getUpay_offer_letter()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.CLIENT_BANK_FILE.getFileName(), filesInfo.getClient_bank_file()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.CLIENT_COMPANY_FILE.getFileName(), filesInfo.getClient_company_file()); updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_DRIVER_LICENSE.getFileName(), filesInfo.getUpay_driver_license()); - updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_RESIDENCE_CERTIFICATE.getFileName(), filesInfo.getUpay_residence_certificate()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.REFUND_EXCHANGE_POLICY.getFileName(), filesInfo.getRefund_exchange_policy()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_PRIVACY_POLICY.getFileName(), filesInfo.getUpay_privacy_policy()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.CARD_SECURITY_POLICY.getFileName(), filesInfo.getCard_security_policy()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_OFFER_LETTER.getFileName(), filesInfo.getUpay_offer_letter()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_PROMOTIONAL_OFFER.getFileName(), filesInfo.getUpay_promotional_offer()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_TERMS_CONDITIONS.getFileName(), filesInfo.getUpay_terms_conditions()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.KYC_UTILITY_BILL_FILE.getFileName(), filesInfo.getKyc_utility_bill_file()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_APPLICATION_FORM.getFileName(), filesInfo.getUpay_application_form()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_DESC_FILE.getFileName(), filesInfo.getUpay_desc_file()); } catch (Exception e) { logger.error("上传合规文件失败", e); } @@ -3938,7 +4075,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override @Transactional - public List uploadKycFilesForWaitComplianceForApp(JSONObject account, String clientMoniker, JSONObject filesInfo,String fileType) { + public List uploadKycFilesForWaitComplianceForApp(JSONObject account, String clientMoniker, JSONObject filesInfo, String fileType) { JSONObject client = getClientInfoByMoniker(clientMoniker); List fileResult = new ArrayList<>(); if (client == null) { @@ -3946,7 +4083,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } int clientId = client.getIntValue("client_id"); try { - updateFilesForWaitAuditWithoutRepeatForApp(account,clientId, fileType, filesInfo.getString("url"),fileResult); + updateFilesForWaitAuditWithoutRepeatForApp(account, clientId, fileType, filesInfo.getString("url"), fileResult); } catch (Exception e) { logger.error("上传KYC文件失败", e); throw new BadRequestException("上传KYC文件失败" + e.getMessage()); @@ -3955,7 +4092,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } - @Override @Transactional public void commitAuthFilesToCompliance(String clientMoniker, JSONObject account, String source) { @@ -4534,14 +4670,53 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } client.put("open_status", 4); clientModifySupport.processClientModify(openStatusModify); - saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "BD完成签字提交compliance审核", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "BD完成签字提交compliance审核", manager,1); if (manager != null) { // sendMessagetoCompliance(client, manager.getString("display_name")); sendCommissionWechatMessage(client); } } - private void saveClientAuditProcess(int client_id, Integer open_status_form, Integer open_status_to, String remark, JSONObject manager) { + @Override + @Transactional + public void commitToCardCompliance(String clientMoniker, JSONObject manager) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + client.putAll(clientConfigService.find(client.getIntValue("client_id"))); + if (manager != null && ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { + int bdOperatClientRole = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id")); + if (bdOperatClientRole <= 0) { + throw new ForbiddenException(); + } + } + // 提交合规启用银行、费率验证 add by Tayl0r 2017/06/13 + JSONObject rate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "rpaypmt_card"); + if (rate == null) { + throw new BadRequestException("The Partner's Rate is not config!"); + } + List clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id")); + if (clientFiles == null || clientFiles.equals("")) { + throw new BadRequestException("The Compliance File Must Be Uploaded!"); + } + JSONObject account = getBankAccountByClientId(client.getIntValue("client_id")); + if (account == null) { + throw new BadRequestException("The Partner's Bank Account is not config!"); + } + JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id")); + int open_status_from = cardFlowInfo.getIntValue("upay_open_status"); + cardFlowInfo.put("upay_approve_time",new Date()); + cardFlowInfo.put("upay_approve_result",4); + cardFlowInfo.put("upay_open_status", 4); + sysClientUpayProfileMapper.update(cardFlowInfo); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "BD完成签字提交compliance审核", manager,2); + if (manager != null) { + sendCardCommissionWechatMessage(client); + } + } + + private void saveClientAuditProcess(int client_id, Integer open_status_form, Integer open_status_to, String remark, JSONObject manager,int type) { JSONObject log = new JSONObject(); try { log.put("client_id", client_id); @@ -4552,6 +4727,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid log.put("operator_id", StringUtils.isNotEmpty(manager.getString("manager_id")) ? manager.getString("manager_id") : manager.getString("account_id")); log.put("operator", manager.getString("display_name")); log.put("create_time", new Date()); + log.put("type",type); log.put("remark", remark); clientAuditProcessMapper.save(log); } catch (Exception e) { @@ -4567,6 +4743,48 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } client.putAll(clientConfigService.find(client.getIntValue("client_id"))); + + beforeCommitToDoAgreeValid(client, manager,"Wechat"); + + OpenStatusModify openStatusModify = new OpenStatusModify(manager, clientMoniker, 1); + openStatusModify.setApprove_result(4); + openStatusModify.setApprove_time(new Date()); + clientModifySupport.processClientModify(openStatusModify); + saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Card Payment Compliance制作合同", manager,1); + if (manager != null) { +// sendAgreeFileMsgtoCompliance(client, manager.getString("display_name")); + sendCommissionWechatMessage(client); + } + } + + @Override + @Transactional + public void commitToDoCardAgreeFile(String clientMoniker, JSONObject manager) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + int clientId = client.getIntValue("client_id"); + client.putAll(clientConfigService.find(clientId)); + beforeCommitToDoAgreeValid(client, manager,"rpaypmt_card"); + + JSONObject surCharge = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "rpaypmt_card"); + if (surCharge == null || surCharge.size() <= 0) { + throw new BadRequestException("The Partner's Rpaypmt Card Rate is not config!"); + } + + JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(clientId); + JSONObject cardFlow = new JSONObject(){{ + put("client_id",clientId); + put("upay_approve_result",4); + put("upay_open_status",1); + put("upay_approve_time",new Date()); + }}; + sysClientUpayProfileMapper.update(cardFlow); + saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Compliance制作合同", manager,2); + } + + private void beforeCommitToDoAgreeValid(JSONObject client, JSONObject manager, String channel) { if (manager != null && ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { int bdOperatClientRole = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id")); if (bdOperatClientRole <= 0) { @@ -4574,7 +4792,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } - JSONObject surCharge = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat"); + JSONObject surCharge = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), channel); if (surCharge == null || surCharge.size() <= 0) { throw new BadRequestException("The Partner's Rate is not config!"); } @@ -4583,15 +4801,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (account == null || account.size() <= 0) { throw new BadRequestException("The Partner's Bank Account is not config!"); } - OpenStatusModify openStatusModify = new OpenStatusModify(manager, clientMoniker, 1); - openStatusModify.setApprove_result(4); - openStatusModify.setApprove_time(new Date()); - clientModifySupport.processClientModify(openStatusModify); - saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Compliance制作合同", manager); - if (manager != null) { - // sendAgreeFileMsgtoCompliance(client, manager.getString("display_name")); - sendCommissionWechatMessage(client); - } } @Override @@ -4623,7 +4832,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid openStatusModify.setApprove_result(4); openStatusModify.setApprove_time(new Date()); clientModifySupport.processClientModify(openStatusModify); - saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 10, "提交绿色通道申请Compliance审核", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 10, "提交绿色通道申请Compliance审核", manager,1); if (manager != null) { // sendGreenChannelMessagetoCompliance(client, manager.getString("display_name")); sendCommissionWechatMessage(client); @@ -4913,7 +5122,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (refuse_remark != null && !refuse_remark.isEmpty()) { auditModify.setRefuse_remark(refuse_remark); } - saveClientAuditProcess(client.getIntValue("client_id"), open_status, client.getInteger("open_status"), "打回," + refuse_remark, manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status, client.getInteger("open_status"), "打回," + refuse_remark, manager,1); clientModifySupport.processClientModify(auditModify); try { @@ -4938,6 +5147,55 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } + @Override + public void cardRefusePartner(String clientMoniker, JSONObject manager, String refuse_remark) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + Integer clientId = client.getInteger("client_id"); + JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(clientId); + Integer open_status = null; + if(null != cardFlowInfo){ + open_status = cardFlowInfo.getIntValue("upay_open_status"); + if (open_status == 1) { + cardFlowInfo.put("upay_open_status",null); + } else { + cardFlowInfo.put("upay_open_status",open_status - 1); + } + if ( cardFlowInfo.getIntValue("upay_approve_result") == 4 || client.getIntValue("source") == 4) { + cardFlowInfo.put("upay_approve_result",5); + } + if (refuse_remark != null && !refuse_remark.isEmpty()) { + cardFlowInfo.put("upay_refuse_remark",refuse_remark); + } + }else{ + cardFlowInfo.put("upay_open_status",null); + } + saveClientAuditProcess(client.getIntValue("client_id"), open_status, cardFlowInfo.getIntValue("open_status"), "打回," + refuse_remark, manager,2); + sysClientUpayProfileMapper.update(cardFlowInfo); + + try { + if (client.getIntValue("source") == 4) { + String contact_phone = client.getString("contact_phone"); + if (contact_phone.startsWith("+61")) { + ArrayList param = new ArrayList<>(); + param.add(refuse_remark); + try { + smsSender.getSender().sendWithParam("61", contact_phone.replace("+61", ""), REFUSE_CLIENT_TEMPLID, param, "RoyalPay", "", ""); + } catch (Exception ignore) { + throw new ServerErrorException("Phone number is wrong :" + contact_phone); + } + } + } + if (client.getIntValue("source") == 5) { + gatewayMerchantApply.notifyOrgMerchantStatus(client); + } + } catch (Exception e) { + logger.error("RefusePartnerError=======:" + clientMoniker + "," + e.getMessage()); + } + } + @Override @Cacheable(value = ":all_clients:", key = "''+#clientId") public JSONArray getAllClientIds(int clientId) { @@ -5455,6 +5713,94 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } + private void sendCardCommissionWechatMessage(JSONObject client) { + String bd_user_name = client.getString("bd_user_name"); + String client_moniker = "[" + client.getString("client_moniker") + "]"; + String short_name = client.getString("short_name"); + JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id")); + if(null == cardFlowInfo){ + return; + } + if (cardFlowInfo.getIntValue("upay_open_status") == 1) { + List complianceList = managerMapper.getOnlyCompliance(); + if (complianceList != null && complianceList.size() > 0) { + for (JSONObject compliance : complianceList) { + String wxopenid = compliance.getString("wx_openid"); + try { + MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), "BD申请制作信用卡支付合同" + client_moniker, + bd_user_name, "制作卡支付合同申请", "BD申请制作" + short_name + "的卡支付合同"); + paymentApi.sendTemplateMessage(msg); + } catch (WechatException e) { + logger.error("Wechat Message Error,open_status=1" + e.getMessage()); + publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid)); + } + } + } + return; + } + if (cardFlowInfo.getIntValue("upay_open_status") == 3) { + List bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); + for (JSONObject bd : bds) { + String wxopenid = bd.getString("wx_openid"); + if (wxopenid != null) { + try { + MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "信用卡支付合同制作完成", + "Compliance", "合规材料", "上传完整合规材料,商户:" + short_name); + paymentApi.sendTemplateMessage(msg); + } catch (WechatException e) { + logger.error("Wechat Message Error,open_status=3" + e.getMessage()); + publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=3,openid=" + wxopenid)); + + } + } + + } + return; + } + if (cardFlowInfo.getIntValue("upay_open_status") == 4) { + if (client.getIntValue("source") == 4 && !StringUtils.isNotEmpty(bd_user_name)) { + bd_user_name = "自助开通商户"; + } + List complianceList = managerMapper.getOnlyCompliance(); + if (complianceList != null && complianceList.size() > 0) { + for (JSONObject compliance : complianceList) { + String wxopenid = compliance.getString("wx_openid"); + try { + MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "信用卡卡支付合规材料已提交", + bd_user_name, "审核材料", "已提交合规材料,等待审核"); + paymentApi.sendTemplateMessage(msg); + } catch (WechatException e) { + logger.error("Wechat Message Error,open_status=1" + e.getMessage()); + publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid)); + } catch (Exception e) { + logger.error("Wechat Message Error,open_status=1" + e.getMessage()); + } + } + } + return; + } + if (cardFlowInfo.getIntValue("upay_open_status") == 5) { + List bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); + for (JSONObject bd : bds) { + String wxopenid = bd.getString("wx_openid"); + if (wxopenid != null) { + try { + TemplateMessage msg = initTaskFinishTemplate(wxopenid, client_moniker + "已正式开通", "Card Payment Compliance审核通过", ""); + MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); + paymentApi.sendTemplateMessage(msg); + } catch (WechatException e) { + logger.error("Wechat Message Error,open_status=5" + e.getMessage()); + publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=5,openid=" + wxopenid)); + } + } + } + return; + } + } + @Override @Cacheable(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") public List listSubMerchantIdApplys(JSONObject manager, String clientMoniker) { @@ -6061,7 +6407,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } client.put("open_status", 4); clientModifySupport.processClientModify(openStatusModify); - saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "自助开通商户提交compliance审核", client_account); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "自助开通商户提交compliance审核", client_account,1); if (params != null) { params.put("display_name", client_account.getString("display_name")); @@ -6661,7 +7007,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject isLessFiles(JSONObject partner){ + public JSONObject isLessFiles(JSONObject partner) { JSONObject client = clientMapper.findClientByMoniker(partner.getString("client_moniker")); if (client == null) { throw new InvalidShortIdException(); @@ -6669,7 +7015,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if ((client.getIntValue("approve_result") == 2 || client.getIntValue("open_status") == 10 || client.getIntValue("approve_result") == 1 || client.getIntValue("open_status") == 5)) { boolean lessKycFiles = isPartnerKycfilesComplete(partner.getString("client_moniker")); partner.put("lessKycFiles", lessKycFiles); - partner.put("lessComplianceFiles",signInAccountService.checkAuthFileStatus(partner.getJSONObject("client")).getBoolean("client_less_file")); + partner.put("lessComplianceFiles", signInAccountService.checkAuthFileStatus(partner.getJSONObject("client")).getBoolean("client_less_file")); } partner.put("lessKycFiles", false); partner.put("lessComplianceFiles", false); @@ -6692,14 +7038,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } JSONObject KycFilesAuth = clientComplianceCompanyMapper.findKycFileComplete(client.getIntValue("client_id")); - if(KycFilesAuth != null){ + if (KycFilesAuth != null) { lessKycFiles = false; } return lessKycFiles; } @Override - public JSONObject partnerIncrementalServiceInfo(String clientMoniker,String channel){ + public JSONObject partnerIncrementalServiceInfo(String clientMoniker, String channel) { JSONObject client = clientMapper.findClientByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -6713,16 +7059,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject getClientIncrementalServiceLoginToken(JSONObject account,String sourceCode){ + public JSONObject getClientIncrementalServiceLoginToken(JSONObject account, String sourceCode) { JSONObject client = clientMapper.findClient(account.getIntValue("client_id")); if (client == null) { throw new InvalidShortIdException(); } JSONObject clientConfig = clientConfigMapper.find(account.getIntValue("client_id")); - if(!clientConfig.getBooleanValue("geek_shop_status")){ + if (!clientConfig.getBooleanValue("geek_shop_status")) { throw new BadRequestException("Merchant service not opened"); } - return retailRSvcService.getGeekSsoTokenInfo(sourceCode,client.getString("client_moniker")); + return retailRSvcService.getGeekSsoTokenInfo(sourceCode, client.getString("client_moniker")); } @Override @@ -6926,18 +7272,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void changeExtParams(String clientMoniker,JSONObject manager, JSONObject params){ + public void changeExtParams(String clientMoniker, JSONObject manager, JSONObject params) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } JSONObject extParmas = JSONObject.parseObject(client.getString("ext_params")); - if("true".equals(params.getString("value"))||"false".equals(params.getString("value"))){ - extParmas.put(params.getString("key"),params.getBoolean("value")); - }else{ - extParmas.put(params.getString("key"),params.getString("value")); + if ("true".equals(params.getString("value")) || "false".equals(params.getString("value"))) { + extParmas.put(params.getString("key"), params.getBoolean("value")); + } else { + extParmas.put(params.getString("key"), params.getString("value")); } - client.put("ext_params",extParmas.toString()); + client.put("ext_params", extParmas.toString()); clientMapper.update(client); } @@ -6983,7 +7329,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void selectBillCodeVersion(JSONObject manager, String clientMoniker, String version){ + public void selectBillCodeVersion(JSONObject manager, String clientMoniker, String version) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -6993,4 +7339,195 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id")); } + private void exportLetterOfferPDF(String clientMoniker,JSONObject manage) { + JSONObject info = convertClientLetterOfferInfo(clientMoniker); + String pdfPath = this.getClass().getClassLoader().getResource("").getPath() + "/templates/pdf/letter_of_offer.pdf"; + String fileName = clientMoniker + "_Letter_of_Offer.pdf"; + publishExcelCardPDFFile(clientMoniker,manage,fileName, pdfPath, info,LETTER_OF_OFFER_FILE); + } + + private JSONObject convertClientLetterOfferInfo(String clientMoniker) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + //合规状态 + if (client.getIntValue("approve_result") != 1 && client.getIntValue("approve_result") == 3) { + throw new BadRequestException("The merchant failed the audit!"); + } + //获取数据源 + int clientId = client.getInteger("client_id"); + JSONObject clientRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "rpaypmt_card"); + if (clientRate == null) { + throw new BadRequestException("rpaypmt_card rate Not configured"); + } + JSONObject cardRate = clientRate.getJSONObject("ext_rates"); + JSONObject bankAccountInfo = clientBankAccountMapper.clientBankAccounts(clientId).get(0); + JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(clientId); + JSONObject legalInfo = sysClientLegalPersonMapper.findRepresentativeInfo(clientId); + //装在数据 + JSONObject info = new JSONObject(); + info.put("down_date", convertDateEnglish(new Date()));//下载文件日期 + 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"));//国家 + info.put("partner_state", client.getString("state"));//洲 + info.put("partner_bussiness_name", client.getString("business_name"));//商户商用名称 + info.put("clean_days", client.getInteger("clean_days"));//T+规则清算天数 + info.put("partner_industry_mcc", upayProfileInfo.getString("mw_industry"));//信用卡注册商户行业编码 + info.put("legal_bussiness", legalInfo.getString("representative_person") + " AS " + (client.containsKey("business_name")?client.getString("business_name"):legalInfo.getString("representative_person")) + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 + info.put("annual_rate",cardAnnualRate);//年费率 + info.put("cost_per_transaction", clientRate.getString("transaction_fee"));//每次交易成本 + info.put("domestic_fee", cardRate.getString("domestic_rate_value"));//国内服务费 + info.put("international_fee", cardRate.getString("overseas_rate_value"));//国际服务费 + BigDecimal reserve = (upayProfileInfo.getBigDecimal("expected_card_revenue").multiply(new BigDecimal(0.005)).setScale(0, RoundingMode.HALF_UP)); + info.put("account_reserve", reserve.compareTo(new BigDecimal(200)) <= 0 ? new BigDecimal(200).toPlainString() : reserve.toPlainString());//账户储备金 + //银行账号信息 + info.put("account_name", bankAccountInfo.getString("account_name"));// + info.put("bsb", bankAccountInfo.getString("bsb_no")); + info.put("account_no", bankAccountInfo.getString("account_no")); + info.put("card_acceptor_name", upayProfileInfo.getString("acceptor_name")); + return info; + } + + private void exportPromotionalOfferPDF(String clientMoniker,JSONObject manager,String promotionalEffectiveDate,int promotionalPeriod) throws ParseException { + Date date = DateUtils.parseDate(promotionalEffectiveDate,"yyyy-MM-dd"); + JSONObject info = convertPromotionalOfferInfo(clientMoniker,convertDateEnglish(date),promotionalPeriod); + String pdfPath = this.getClass().getClassLoader().getResource("").getPath() + "/templates/pdf/promotional_offer.pdf"; + String fileName = clientMoniker + "_Promotional_Offer.pdf"; + publishExcelCardPDFFile(clientMoniker,manager,fileName, pdfPath, info,PROMOTIONAL_OFFER_FILE); + } + + private JSONObject convertPromotionalOfferInfo(String clientMoniker,String promotionalEffectiveDate,int promotionalPeriod) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + //合规状态 + if (client.getIntValue("approve_result") != 1 && client.getIntValue("approve_result") == 3) { + throw new BadRequestException("The merchant failed the audit!"); + } + int clientId = client.getInteger("client_id"); + JSONObject clientRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "rpaypmt_card"); + if (clientRate == null) { + throw new BadRequestException("rpaypmt_card rate Not configured"); + } + JSONObject cardRate = clientRate.getJSONObject("ext_rates"); + JSONObject legalInfo = sysClientLegalPersonMapper.findRepresentativeInfo(clientId); + + JSONObject info = new JSONObject(); + info.put("down_date", convertDateEnglish(new Date()));//下载文件日期 + 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"));//国家 + info.put("partner_state", client.getString("state"));//洲 + info.put("partner_bussiness_name", client.getString("business_name"));//商户商用名称 + info.put("legal_bussiness", legalInfo.getString("representative_person") + " AS " + (client.containsKey("business_name")?client.getString("business_name"):legalInfo.getString("representative_person")) + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 + info.put("domestic_fee", cardRate.getString("domestic_rate_value"));//国内服务费 + info.put("international_fee", cardRate.getString("overseas_rate_value"));//国际服务费 + info.put("promotional_effective_date", promotionalEffectiveDate); + info.put("promotional_period", promotionalPeriod); + return info; + } + + private void exportTermsConditionsPDF(String clientMoniker,JSONObject manage) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + if (client.getIntValue("approve_result") != 1 && client.getIntValue("approve_result") == 3) { + throw new BadRequestException("The merchant failed the audit!"); + } + String pdfPath = this.getClass().getClassLoader().getResource("").getPath() + "/templates/pdf/terms_and_conditions.pdf"; + String fileName = clientMoniker + "_Terms_And_Conditions.pdf"; + publishExcelCardPDFFile(clientMoniker,manage,fileName, pdfPath, new JSONObject(),TERMS_AND_CONDITIONS_FILE); + } + + private void publishExcelCardPDFFile(String clientMoniker,JSONObject manager, String fileName, String pdfPath, JSONObject info, String fileLabel) { + try { + PdfUtils pdu = new PdfUtils(); + pdu.setTemplatePdfPath(pdfPath); + pdu.setPdfTemplate(info); + try { + File file = new File(fileName); + ByteArrayOutputStream bos = pdu.templetPdfBos(file); + InputStream stream = new ByteArrayInputStream(bos.toByteArray()); + JSONObject fileRes = attachmentClient.uploadFile(stream, fileName, false); + if (fileRes != null) { + importCardAgreeFile(clientMoniker, manager, fileRes.getString("url"), fileLabel); + } + stream.close(); + } catch (Exception e) { + logger.error("合同制作出现问题:", e); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + private String convertDateEnglish(Date date) { + String[] months = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Spt", "Oct", "Nov", "Dec"}; + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + int year = calendar.get(Calendar.YEAR); + int month = calendar.get(Calendar.MONTH); + int day = calendar.get(Calendar.DAY_OF_MONTH); + return day + " " + months[month] + " " + year; + } + + private void importCardAgreeFile(String clientMoniker, JSONObject manager, String sourceFile, String fileLabel) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + if (sourceFile != null) { + List existFiles = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), fileLabel); + JSONObject existFile = null; + if (!CollectionUtils.isEmpty(existFiles)) { + existFile = existFiles.get(0); + } + Date now = new Date(); + JSONObject file = new JSONObject(); + file.put("file_name", fileLabel); + file.put("file_value", sourceFile); + file.put("client_id", client.getIntValue("client_id")); + file.put("last_update_date", now); + file.put("status", 1); + file.put("is_valid", 1); + if (manager == null) { + file.put("last_update_by", "System Import"); + } else { + file.put("last_update_by", manager.getString("display_name")); + } + JSONObject contract = clientsContractMapper.findByClientId(client.getIntValue("client_id")); + if (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0 || !contract.getBoolean("has_sign") || existFile == null + || existFile.isEmpty()) { + clientFilesMapper.save(file); + } else { + file.put("file_id", existFile.getString("file_id")); + clientFilesMapper.update(file); + } + } + } + + public void saveLegalAndMarketingInfo(JSONObject partner) { + JSONObject representativeInfo = new JSONObject(); + representativeInfo.put("client_id", partner.getIntValue("client_id")); + representativeInfo.put("representative_person", partner.getString("legal_representative_person")); + representativeInfo.put("phone", partner.getString("legal_representative_phone")); + representativeInfo.put("email", partner.getString("legal_representative_email")); + representativeInfo.put("job_title", partner.getString("legal_representative_job")); + representativeInfo.put("address", partner.getString("registered_address")); + representativeInfo.put("suburb", partner.getString("registered_suburb")); + representativeInfo.put("postcode", partner.getString("registered_postcode")); + representativeInfo.put("state", partner.getString("registered_state")); + representativeInfo.put("legal_representative_wechatid", partner.getString("legal_representative_wechatid")); + representativeInfo.put("marketing_person", partner.getString("marketing_person")); + representativeInfo.put("marketing_phone", partner.getString("marketing_phone")); + representativeInfo.put("marketing_email", partner.getString("marketing_email")); + representativeInfo.put("marketing_job_title", partner.getString("marketing_job")); + representativeInfo.put("marketing_wechatid", partner.getString("marketing_wechatid")); + sysClientLegalPersonMapper.save(representativeInfo); + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/enums/UPayAuthFileEnum.java b/src/main/java/au/com/royalpay/payment/manage/merchants/enums/UPayAuthFileEnum.java index 4118df321..bdaa59ecf 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/enums/UPayAuthFileEnum.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/enums/UPayAuthFileEnum.java @@ -2,11 +2,18 @@ package au.com.royalpay.payment.manage.merchants.enums; public enum UPayAuthFileEnum { ALL(""), - UPAY_APPLICATION_FORM("upay_application_form"), - UPAY_AGREEMENT_FILE("upay_agreement_file"), - UPAY_OFFER_LETTER("upay_offer_letter"), + CLIENT_BANK_FILE("client_bank_file"), + CLIENT_COMPANY_FILE("client_company_file"), UPAY_DRIVER_LICENSE("upay_driver_license"), - UPAY_RESIDENCE_CERTIFICATE("upay_residence_certificate"); + REFUND_EXCHANGE_POLICY("refund_exchange_policy"), + UPAY_PRIVACY_POLICY("upay_privacy_policy"), + CARD_SECURITY_POLICY("card_security_policy"), + UPAY_OFFER_LETTER("upay_offer_letter"), + UPAY_PROMOTIONAL_OFFER("upay_promotional_offer"), + UPAY_TERMS_CONDITIONS("upay_terms_conditions"), + KYC_UTILITY_BILL_FILE("kyc_utility_bill_file"), + UPAY_APPLICATION_FORM("upay_application_form"), + UPAY_DESC_FILE("upay_desc_file"); private final String fileName; @@ -19,10 +26,17 @@ public enum UPayAuthFileEnum { } public String[] getFileNameArrays() { - return new String[]{UPAY_APPLICATION_FORM.getFileName(), - UPAY_AGREEMENT_FILE.getFileName(), + return new String[]{CLIENT_BANK_FILE.getFileName(), + CLIENT_COMPANY_FILE.getFileName(), + UPAY_OFFER_LETTER.getFileName(), + REFUND_EXCHANGE_POLICY.getFileName(), + UPAY_PRIVACY_POLICY.getFileName(), + CARD_SECURITY_POLICY.getFileName(), UPAY_OFFER_LETTER.getFileName(), - UPAY_DRIVER_LICENSE.getFileName(), - UPAY_RESIDENCE_CERTIFICATE.getFileName()}; + UPAY_PROMOTIONAL_OFFER.getFileName(), + UPAY_TERMS_CONDITIONS.getFileName(), + KYC_UTILITY_BILL_FILE.getFileName(), + UPAY_APPLICATION_FORM.getFileName(), + UPAY_DESC_FILE.getFileName()}; } } 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 8a0fa3db1..1ea7c90d1 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 @@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.io.OutputStream; +import java.util.Date; import java.util.List; /** @@ -279,6 +280,11 @@ public class PartnerManageController { clientManager.auditClient(manager, clientMoniker, pass.getIntValue("pass")); } + @ManagerMapping(value = "/{clientMoniker}/card_audit", method = RequestMethod.PUT, role = ManagerRole.OPERATOR) + public void auditCardPartner(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject pass) { + clientManager.auditCardClient(manager, clientMoniker, pass.getIntValue("pass")); + } + @ManagerMapping(value = "/{clientMoniker}/aduit/green_channel", method = RequestMethod.PUT, role = ManagerRole.OPERATOR) public void auditPartnerGreenChannel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker) { clientManager.auditClientGreenChannel(manager, clientMoniker); @@ -299,6 +305,11 @@ public class PartnerManageController { clientManager.refusePartner(clientMoniker, manager, refuse.getString("refuse_remark")); } + @ManagerMapping(value = "/{clientMoniker}/card_audit/refuse", method = RequestMethod.PUT, role = ManagerRole.OPERATOR) + public void cardRefusePartner(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody JSONObject refuse) { + clientManager.cardRefusePartner(clientMoniker, manager, refuse.getString("refuse_remark")); + } + @ManagerMapping(value = "/{clientMoniker}/common_sub_merchant_id", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR}) public void switchCommonSubMerchantId(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.switchPermission(manager, clientMoniker, "common_sub_merchant_id", pass.getBooleanValue("allow")); @@ -584,6 +595,17 @@ public class PartnerManageController { return clientManager.getSourceAgreeFiles(manager, clientMoniker); } + /** + * 下载商户卡支付合规文件 + * + * @param clientMoniker + */ + @ManagerMapping(value = "/{clientMoniker}/file/source_card_agree_file", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER, ManagerRole.SERVANT}) + public JSONObject getSourceCardAgreeAuthFiles(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, + @RequestParam("fileName") String fileName){ + return clientManager.getSourceCardAgreeFiles(clientMoniker,manager,fileName); + } + @ManagerMapping(value = "/auth_file/{fileId}/delete", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER}) public void deleteAuthFiles(@PathVariable String fileId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.deleteAuthFilesByAdmin(fileId); @@ -623,11 +645,31 @@ public class PartnerManageController { clientManager.commitToCompliance(clientMoniker, manager); } + /** + * 提交资料,BD提交卡支付最终审核 + * @param clientMoniker + * @param manager + */ + @ManagerMapping(value = "/{clientMoniker}/to_card_compliance", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.BD_USER}) + public void commitToCardCompliance(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.commitToCardCompliance(clientMoniker, manager); + } + @ManagerMapping(value = "/{clientMoniker}/make_agree_file", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER}) public void commitToDoAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.commitToDoAgreeFile(clientMoniker, manager); } + /** + * 提交资料,申请卡支付 + * @param clientMoniker + * @param manager + */ + @ManagerMapping(value = "/{clientMoniker}/make_card_agree_file", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER}) + public void commitToDoCardAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.commitToDoCardAgreeFile(clientMoniker, manager); + } + @ManagerMapping(value = "/{clientMoniker}/compliance/green_channel", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.BD_USER}) public void commitToGreenChannel(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.commitToGreenChannel(clientMoniker, manager); @@ -643,6 +685,29 @@ public class PartnerManageController { clientManager.getAggregateAgreeFile(clientMoniker, manager, false); } + /** + * 制作卡支付合同 + * @param clientMoniker + * @param manager + * @throws Exception + */ + @ManagerMapping(value = "/{clientMoniker}/export/aggregate/card_agree_pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR}) + public void exportAggregateCardAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) throws Exception { + clientManager.getAggregateCardAgreeFile(clientMoniker, manager, false); + } + + /** + * 制作促销合同 + * @param clientMoniker + * @param manager + * @throws Exception + */ + @ManagerMapping(value = "/{clientMoniker}/export/aggregate/card_promotiona_agree_pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR}) + public void exportAggregateCardPromotionaAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, + @RequestParam("date") String promotionalEffectiveDate,@RequestParam("period") int promotionalPeriod) throws Exception { + clientManager.getAggregateCardPromotionaAgreeFile(clientMoniker, manager, false,promotionalEffectiveDate,promotionalPeriod); + } + @ManagerMapping(value = "/{clientMoniker}/temp/export/pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.DIRECTOR, ManagerRole.OPERATOR}) public void temporaryExportPDF(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) throws Exception { clientManager.temporaryExportPdf(clientMoniker, manager, httpResponse); @@ -658,6 +723,16 @@ public class PartnerManageController { clientManager.completeAgree(clientMoniker, manager); } + /** + * 信用卡合同生成完毕通知BD + * @param clientMoniker + * @param manager + */ + @ManagerMapping(value = "/{clientMoniker}/notify/cardCompleteAgree", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) + public void cardCompleteAgree(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.cardCompleteAgree(clientMoniker, manager); + } + @ManagerMapping(value = "/{clientMoniker}/download/complianceAsZIP", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) public void downloadComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception { clientManager.downloadComplianceZip(clientMoniker, response); @@ -929,4 +1004,14 @@ public class PartnerManageController { public RPayMerchantEntity queryMWMerchantInfo(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { return clientManager.queryMWMerchantInfo(clientMoniker, manager); } + + /** + * 启用/禁用国际卡支付 + * @param clientMoniker + */ + @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.switchPermission(manager, clientMoniker, "enable_international_card", pass.getBooleanValue("allow")); + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java index b7627151d..a9e3a978a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java @@ -36,6 +36,8 @@ public interface TradeLogService { void exportTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception; + void exportUpayTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception; + void exportTransFlowApi(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception; void exportExcel(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception; 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 8d06b70dc..b6046766c 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 @@ -136,6 +136,8 @@ public class TradeLogServiceImpl implements TradeLogService { private org.springframework.core.io.Resource trans_flow; @Value("classpath:/jasper/incremental_partner_invoice_gst.jasper") private org.springframework.core.io.Resource incremental_trans_flow; + @Value("classpath:/jasper/partner_upay_invoice_gst.jasper") + private org.springframework.core.io.Resource upay_trans_flow; @Value("classpath:/jasper/royalpay_logo.png") private org.springframework.core.io.Resource logo; @Value("classpath:/jasper/trans_excel.jasper") @@ -573,6 +575,30 @@ public class TradeLogServiceImpl implements TradeLogService { return result; } + private JSONObject listPartnerTransFlowByExportPdf(TradeLogQuery query, JSONObject partner, String[] channels) throws Exception { + int clientId = partner.getIntValue("client_id"); + String timezone = partner.getJSONObject("client").getString("timezone"); + JSONObject params = query.toParams(timezone); + params.put("channel", channels); + clientManager.validateClients(clientId, params); + params.put("client_id", clientId); + clientManager.queryModifyClientIds(clientId, params); + List logs = transactionMapper.listTransFlow(params); + TimeZoneUtils.switchTimeZoneToString(logs, timezone, "dd/MM/yyyy HH:mm:ss", Collections.singletonList("transaction_time")); + TimeZoneUtils.switchTimeZoneToString(logs, timezone, "dd/MM/yyyy", Collections.singletonList("clearing_time")); + + final JSONObject analysis = analysisTransLogs(logs); + + JSONObject result = new JSONObject(); + result.put("data", logs); + analysis.put("balance", transactionMapper.analysisBalance(params)); + if (analysis.containsKey("paid_fee") && analysis.containsKey("refund_fee")) { + analysis.put("actual_fee", analysis.getBigDecimal("paid_fee").add(analysis.getBigDecimal("refund_fee"))); + } + result.put("analysis", analysis); + return result; + } + private JSONObject analysisTransLogs(List logs) { final JSONObject analysis = new JSONObject(); analysis.put("order_count", logs.size()); @@ -633,10 +659,18 @@ public class TradeLogServiceImpl implements TradeLogService { .filter(log -> log.getBigDecimal("settle_amount") != null) .map(log -> getSymbol(log).multiply(log.getBigDecimal("incremental_surcharge"))) .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); + analysis.put("total_transaction_fee", logs.parallelStream() + .filter(log -> log.getBigDecimal("settle_amount") != null) + .map(log -> getSymbol(log).multiply(log.getBigDecimal("transaction_fee"))) + .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); analysis.put("total_incremental_tax", logs.parallelStream() .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")))) @@ -679,7 +713,7 @@ public class TradeLogServiceImpl implements TradeLogService { @Override public void exportTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { - JSONObject transFlow = listPartnerTransFlow(query, partner); + JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner,new String[]{"Wechat","Alipay","AlipayOnline"}); JSONObject analysis = transFlow.getJSONObject("analysis"); JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id")); if (!transFlow.getJSONArray("data").isEmpty()) { @@ -736,7 +770,7 @@ public class TradeLogServiceImpl implements TradeLogService { }); JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList); response.setContentType("application/pdf"); - String fileName = client.getString("client_moniker") + "_" + parmerters.getString("dateRange").replaceAll("/", ""); + String fileName = client.getString("client_moniker") + "_Cross_Border_" + parmerters.getString("dateRange").replaceAll("/", ""); response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf"); OutputStream outs = response.getOutputStream(); JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城"); @@ -752,6 +786,84 @@ public class TradeLogServiceImpl implements TradeLogService { } } + @Override + public void exportUpayTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { + JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner,new String[]{"rpaypmt_card","rpaypmt_dd"}); + JSONObject analysis = transFlow.getJSONObject("analysis"); + JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id")); + if (!transFlow.getJSONArray("data").isEmpty()) { + try { + List dataList = transFlow.getJSONArray("data").toJavaList(JSONObject.class); + JSONObject parmerters = new JSONObject(); + parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom()) + ? DateFormatUtils.format(DateUtils.parseDate(query.getDatefrom(), "yyyyMMdd"), "dd/MM/yyyy") : ""); + parmerters.put("dateTo", + StringUtils.isNotBlank(query.getDateto()) + ? DateFormatUtils.format(DateUtils.parseDate(query.getDateto(), "yyyyMMdd"), "dd/MM/yyyy") + : DateFormatUtils.format(new Date(), "dd/MM/yyyy")); + parmerters.put("dateRange", (StringUtils.isNotBlank(parmerters.getString("dateFrom")) ? parmerters.getString("dateFrom") : "") + "~" + + parmerters.getString("dateTo")); + parmerters.put("partnerCode", client.getString("client_moniker")); + parmerters.put("clientName", client.getString("company_name")); + parmerters.put("clientAddress", client.getString("address")); + parmerters.put("balance", analysis.getDoubleValue("balance")); + parmerters.put("logo", logo.getInputStream()); + parmerters.put("actual_fee", takeDecimalOrDefault(analysis, "actual_fee", BigDecimal.ZERO)); + parmerters.put("totalSettledAmount", takeDecimalOrDefault(analysis, "total_settle_amount", BigDecimal.ZERO)); + parmerters.put("royalpay_charge", takeDecimalOrDefault(analysis, "total_royal_surcharge", BigDecimal.ZERO)); + parmerters.put("total_fee", takeDecimalOrDefault(analysis, "total_surcharge", BigDecimal.ZERO)); + parmerters.put("alipay_fee", takeDecimalOrDefault(analysis, "alipay_fee", BigDecimal.ZERO)); + parmerters.put("wechat_fee", takeDecimalOrDefault(analysis, "wechat_fee", BigDecimal.ZERO)); + parmerters.put("bestpay_fee", takeDecimalOrDefault(analysis, "bestpay_fee", BigDecimal.ZERO)); + parmerters.put("jd_fee", takeDecimalOrDefault(analysis, "jd_fee", BigDecimal.ZERO)); + parmerters.put("alipay_online_fee", takeDecimalOrDefault(analysis, "alipay_online_fee", BigDecimal.ZERO)); + parmerters.put("gst", takeDecimalOrDefault(analysis, "tax_amount", BigDecimal.ZERO)); + parmerters.put("royalpay_fee", takeDecimalOrDefault(analysis, "total_royalpay_fee", 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("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2,RoundingMode.HALF_UP)); + parmerters.put("total_transaction_fee", analysis.getBigDecimal("total_transaction_fee").add(analysis.getBigDecimal("total_transaction_fee_tax")).setScale(2,RoundingMode.HALF_UP)); + parmerters.put("total_royalpay_fee", analysis.getBigDecimal("total_surcharge").subtract(parmerters.getBigDecimal("total_transaction_fee")).setScale(2,RoundingMode.HALF_UP)); + + dataList.parallelStream().forEach(item -> { + BigDecimal incrementalSurcharge = item.containsKey("incremental_surcharge") ? item.getBigDecimal("incremental_surcharge") : BigDecimal.ZERO; + BigDecimal taxAmount = item.containsKey("tax_amount") ? item.getBigDecimal("tax_amount") : BigDecimal.ZERO; + BigDecimal royalpaySurhcarge = item.containsKey("royal_surcharge") ? item.getBigDecimal("royal_surcharge") : BigDecimal.ZERO; + BigDecimal surhcargeBack = item.containsKey("surcharge_cashback") ? item.getBigDecimal("surcharge_cashback") : BigDecimal.ZERO; + BigDecimal channelSurcharge = item.containsKey("channel_surcharge") ? item.getBigDecimal("channel_surcharge") : BigDecimal.ZERO; + BigDecimal incrementalTax = incrementalSurcharge.divide(new BigDecimal(10), 2, RoundingMode.HALF_UP); + BigDecimal transactionFee = item.getBigDecimal("transaction_fee"); + BigDecimal transactionFeeTax = item.getBigDecimal("transaction_fee").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP); + BigDecimal royalpayTax = taxAmount.subtract(incrementalTax).subtract(transactionFeeTax); + BigDecimal realRoyalpayCharge = item.getBigDecimal("total_surcharge").add(taxAmount).subtract(transactionFee).subtract(transactionFeeTax); + 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)); + scaleDecimalVal(item, "display_amount", item.getString("currency")); + String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency(); + scaleDecimalVal(item, "clearing_amount", platformCurrency); + scaleDecimalVal(item, "settle_amount", platformCurrency); + scaleDecimalVal(item, "total_surcharge", platformCurrency); + }); + JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList); + response.setContentType("application/pdf"); + String fileName = client.getString("client_moniker") + "_Card_Payment_" + parmerters.getString("dateRange").replaceAll("/", ""); + response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf"); + OutputStream outs = response.getOutputStream(); +// JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城"); +// InputStream jasper = clientIncrement == null ? trans_flow.getInputStream() : incremental_trans_flow.getInputStream(); + InputStream jasper = upay_trans_flow.getInputStream(); + byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource); + outs.write(bytes, 0, bytes.length); + outs.flush(); + outs.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + } + @Override public void exportTransFlowApi(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { query.setClearing_status(-1); diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/web/TradeFlowController.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/web/TradeFlowController.java index 42c2660fa..ea744807d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/web/TradeFlowController.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/web/TradeFlowController.java @@ -39,6 +39,12 @@ public class TradeFlowController { tradeLogService.exportTransFlow(query, partner, httpResponse); } + @PartnerMapping(value = "/report/upay_pdf", method = RequestMethod.GET) + @ReadOnlyConnection + public void exportUpayPDF(TradeLogQuery query, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, HttpServletResponse httpResponse) throws Exception { + tradeLogService.exportUpayTransFlow(query, partner, httpResponse); + } + @PartnerMapping(value = "/report/excel", method = RequestMethod.GET) @ReadOnlyConnection public void exportExcel(TradeLogQuery query, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, HttpServletResponse httpResponse) throws Exception { diff --git a/src/main/resources/application-common.yml b/src/main/resources/application-common.yml index 238e4f272..6932e382e 100644 --- a/src/main/resources/application-common.yml +++ b/src/main/resources/application-common.yml @@ -73,3 +73,6 @@ spring: preferred-json-mapper: fastjson stockholder: mails: leo.huang@royalpay.com.au +client_card: + account_reserve: 1000 + annual_rate: 0 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d409e8f01..904c4779b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -17,7 +17,7 @@ app: cms: host: http://127.0.0.1:9533 customer: - host: https://customer.royalpay.com.au/ + host: http://192.168.0.33:9008/ foreign-currency: AUD hanyin-secure: pid: ROYALPAY @@ -26,10 +26,10 @@ app: sftp-pwd: royalpay sftp-username: royalpay host: - main: http://192.168.0.8:9009/ + main: http://192.168.0.33:9009/ regions: - au: http://192.168.0.8:9009/ - cn: http://192.168.0.8:9009/ + au: http://192.168.0.33:9009/ + cn: http://192.168.0.33:9009/ mail: appid: 1 host: https://mailsupport.royalpay.com.au @@ -156,8 +156,8 @@ settle: - RPAY_SVC_DIRECTDEBIT spring: mail: - host: smtp.office365.com - port: 587 + host: '' + port: '' profiles: active: dev,alipay,bestpay,jd,wechat,rpay,yeepay,rppaysvc,common redis: @@ -166,6 +166,12 @@ spring: port: 6379 thymeleaf: mode: HTML +logging: + level: + au: + com: + royalpay: + payment: debug diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml index a71c233a1..38e1504a7 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml @@ -576,9 +576,11 @@ (SELECT min(r.rate_value) FROM sys_client_rates r WHERE r.client_id = t.client_id AND date(r.expiry_time) >= DATE(t.clearing_time) AND date(r.active_time) <= DATE(t.clearing_time)) rate, - t.clearing_order clear_detail_id + t.clearing_order clear_detail_id, + lc.balance_group FROM pmt_transactions t left join log_clearing_detail cd on cd.clear_detail_id=t.clearing_order + left join log_clearing lc on cd.clearing_id = lc.clearing_id left join sys_clients sc on t.client_id = sc.client_id WHERE t.channel='Settlement' @@ -938,6 +940,7 @@ t.transaction_time, if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount) clearing_amount, if(t.transaction_type = 'Credit', t.total_surcharge, -t.total_surcharge) total_surcharge, + if(t.transaction_type = 'Credit', t.transaction_fee, -t.transaction_fee) transaction_fee, if(t.transaction_type = 'Credit', t.channel_surcharge, -t.channel_surcharge) channel_surcharge, if(t.transaction_type = 'Credit', t.settle_amount, -t.settle_amount) settle_amount, t.order_id, @@ -965,12 +968,13 @@ t.transaction_time, if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount) clearing_amount, if(t.transaction_type = 'Credit', t.total_surcharge, -t.total_surcharge) total_surcharge, + if(t.transaction_type = 'Credit', t.transaction_fee, -t.transaction_fee) transaction_fee, if(t.transaction_type = 'Credit', t.channel_surcharge, -t.channel_surcharge) channel_surcharge, if(t.transaction_type = 'Credit', t.settle_amount, -t.settle_amount) settle_amount, t.order_id, t.org_rate, t.surcharge_cashback, - o.customer_surcharge + o.customer_surcharge, from pmt_transactions t LEFT JOIN pmt_orders o on o.order_id = t.order_id INNER JOIN sys_org so ON t.org_id = so.org_id AND so.is_valid = 1 diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml index 2fec0585a..e2914bf54 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.xml @@ -19,6 +19,14 @@ and file_name = 'source_agree_file' order by last_update_date desc limit 1 + + + + + - \ No newline at end of file + diff --git a/src/main/resources/jasper/partner_upay_invoice_gst.jasper b/src/main/resources/jasper/partner_upay_invoice_gst.jasper new file mode 100644 index 000000000..e017ea279 Binary files /dev/null and b/src/main/resources/jasper/partner_upay_invoice_gst.jasper differ diff --git a/src/main/resources/templates/letter_of_offer.pdf b/src/main/resources/templates/letter_of_offer.pdf new file mode 100644 index 000000000..b9fa8f7e0 Binary files /dev/null and b/src/main/resources/templates/letter_of_offer.pdf differ diff --git a/src/main/resources/templates/pdf/letter_of_offer.pdf b/src/main/resources/templates/pdf/letter_of_offer.pdf new file mode 100644 index 000000000..a6a8a6ade Binary files /dev/null and b/src/main/resources/templates/pdf/letter_of_offer.pdf differ diff --git a/src/main/resources/templates/pdf/promotional_offer.pdf b/src/main/resources/templates/pdf/promotional_offer.pdf new file mode 100644 index 000000000..0977927a4 Binary files /dev/null and b/src/main/resources/templates/pdf/promotional_offer.pdf differ diff --git a/src/main/resources/templates/pdf/terms_and_conditions.pdf b/src/main/resources/templates/pdf/terms_and_conditions.pdf new file mode 100644 index 000000000..c741f21e1 Binary files /dev/null and b/src/main/resources/templates/pdf/terms_and_conditions.pdf differ diff --git a/src/main/ui/static/analysis/templates/settlement_transactions.html b/src/main/ui/static/analysis/templates/settlement_transactions.html index 4b118af1c..4126077bc 100644 --- a/src/main/ui/static/analysis/templates/settlement_transactions.html +++ b/src/main/ui/static/analysis/templates/settlement_transactions.html @@ -53,6 +53,16 @@ +
  • + + + +
  • +
  • + + + +
  • diff --git a/src/main/ui/static/commons/commons.js b/src/main/ui/static/commons/commons.js index 1f764d66c..51e7b3204 100644 --- a/src/main/ui/static/commons/commons.js +++ b/src/main/ui/static/commons/commons.js @@ -13,6 +13,7 @@ define(['./app', './services/yeepayIndustryMap', './services/stateMap', './services/industryMap', + './services/upayIndustryMap', './services/wechatGoodMcc', './services/sectorMap', './services/countryMap', diff --git a/src/main/ui/static/commons/services/clearingDetailService.js b/src/main/ui/static/commons/services/clearingDetailService.js index 7e0bd7faa..1acf1105a 100644 --- a/src/main/ui/static/commons/services/clearingDetailService.js +++ b/src/main/ui/static/commons/services/clearingDetailService.js @@ -19,6 +19,21 @@ define(['../app','decimal'], function (app,Decimal) { size: 'lg' }) } + function openDetailOfUpaySettle(url, is_partner, client_id, detailId) { + $uibModal.open({ + templateUrl: '/static/payment/tradelog/templates/partner_settlement_upay_settle_dialog.html', + controller: 'clearingDetailOfUpaySettleCtrl', + resolve: { + detail: ['$http', function ($http) { + return $http.get(url); + }], + is_partner: is_partner, + client_id: client_id, + detailId: detailId + }, + size: 'lg' + }) + } function openDetailOfMergeSettle(url,client_id) { $uibModal.open({ templateUrl: '/static/payment/tradelog/templates/partner_settlement_merge_settle_dialog.html', @@ -37,6 +52,9 @@ define(['../app','decimal'], function (app,Decimal) { clientClearingDetail: function (client_id, detailId, is_partner) { openDetail('/client/clean_logs/' + client_id + '/settlement_logs/' + detailId, is_partner,client_id,detailId); }, + clientClearingDetailOfUpaySettle: function (client_id, detailId, is_partner) { + openDetailOfUpaySettle('/client/clean_logs/' + client_id + '/settlement_logs/' + detailId, is_partner,client_id,detailId); + }, clientClearingDetailOfMergeSettle: function (client_id, reportDate) { openDetailOfMergeSettle('/client/clean_logs/' + client_id + '/settlement_logs/report_date/' + reportDate, client_id); } @@ -55,6 +73,18 @@ define(['../app','decimal'], function (app,Decimal) { } $scope.channelAndDayOfAnalysis(); }]); + app.controller('clearingDetailOfUpaySettleCtrl', ['$scope', 'detail', 'is_partner','client_id','detailId','$http', function ($scope, detail, is_partner,client_id,detailId,$http) { + $scope.ctrl = {channel: null,day:null}; + $scope.report = detail.data; + $scope.is_partner = is_partner; + $scope.channelAndDayOfAnalysis = function () { + $http.get('/client/clean_logs/' + client_id + '/settlement_logs/' + detailId+'/analysis/'+$scope.ctrl.channel).then(function (resp) { + $scope.channelAndDayMap = resp.data; + $scope.index = 0; + }) + } + $scope.channelAndDayOfAnalysis(); + }]); app.controller('clearingDetailOfMergeSettleCtrl', ['$scope', 'detail','client_id','$http', function ($scope, detail,client_id,$http) { $scope.ctrl = {channel: null,day:null}; $scope.report = detail.data; diff --git a/src/main/ui/static/commons/services/upayIndustryMap.js b/src/main/ui/static/commons/services/upayIndustryMap.js new file mode 100644 index 000000000..ebc3c6cfb --- /dev/null +++ b/src/main/ui/static/commons/services/upayIndustryMap.js @@ -0,0 +1,81 @@ +define(['../app'], function (app) { + 'use strict'; + + var upayIndustry = [ + { + "label": "Professional Services", + "value": "Professional Services" + }, + { + "label": "Mail/Telephone Order", + "value": "Mail/Telephone Order" + }, + { + "label": "Business Services", + "value": "Business Services" + }, + { + "label": "Retail Store", + "value": "Retail Store" + }, + { + "label": "Airline Services", + "value": "Airline Services" + }, + { + "label": "Entertainment", + "value": "Entertainment" + }, + { + "label": "Automobiles", + "value": "Automobiles" + }, + { + "label": "Clothing", + "value": "Clothing" + }, + { + "label": "Contracted Services", + "value": "Contracted Services" + }, + { + "label": "Government", + "value": "Government" + }, + { + "label": "Hotel", + "value": "Hotel" + }, + { + "label": "Personal Services", + "value": "Personal Services" + }, + { + "label": "Repair Services", + "value": "Repair Services" + }, + { + "label": "Transportation", + "value": "Transportation" + }, + { + "label": "Utilities", + "value": "Utilities" + }, + { + "label": "Wholesale", + "value": "Wholesale" + }, + { + "label": "Other", + "value": "Other" + } + ]; + app.factory('upayIndustryMap', function () { + return { + configs: function () { + return upayIndustry; + } + } + }); +}); diff --git a/src/main/ui/static/commons/templates/promotiona_commit.html b/src/main/ui/static/commons/templates/promotiona_commit.html new file mode 100644 index 000000000..1ee5f2610 --- /dev/null +++ b/src/main/ui/static/commons/templates/promotiona_commit.html @@ -0,0 +1,19 @@ + + + \ No newline at end of file diff --git a/src/main/ui/static/payment/partner/add-partner.js b/src/main/ui/static/payment/partner/add-partner.js new file mode 100644 index 000000000..ac6ad6580 --- /dev/null +++ b/src/main/ui/static/payment/partner/add-partner.js @@ -0,0 +1,908 @@ +/** + * Created by yixian on 2016-06-29. + */ +define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiSelect'], function (angular, Decimal) { + 'use strict'; + var removeClientPayDesc = function (items, key) { + for (var i = 0; i < items.length; i++) { + var item = items[i]; + if (item.indexOf(key) >= 0) { + items.splice(items.indexOf(item), 1); + i = i - 1; + } + } + }; + + + var app = angular.module('addPartnerApp', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ui.select', 'ngFileUpload']); + app.config(['$stateProvider', function ($stateProvider) { + $stateProvider.state('newPartners', { + url: '/partners/new', + templateUrl: '/static/payment/partner/templates/add_partner.html', + controller: 'addPartnerCtrl' + }).state('partners.edit', { + url: '/{clientMoniker}/edit', + params: {"commitCardPayment": false, commitCrossBorderPayment: false}, + templateUrl: '/static/payment/partner/templates/partner_edit.html', + controller: 'partnerEditCtrl', + resolve: { + partner: ['$http', '$stateParams', function ($http, $stateParams) { + return $http.get('/sys/partners/' + $stateParams.clientMoniker); + }] + } + }) + }]); + app.controller('addPartnerCtrl', ['$rootScope', '$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'businessStructuresMap', 'upayIndustryMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap', function ($rootScope, $scope, $http, $state, Upload, commonDialog, timezone, businessStructuresMap, upayIndustryMap, industryMap, stateMap, sectorMap, countryMap) { + if ($scope.partner_application) { + $scope.partner = angular.copy($scope.partner_application); + delete $rootScope.partner_application; + } else { + $scope.partner = {timezone: 'Australia/Melbourne'}; + } + $scope.partner.enable_cross_payment = false; + $scope.partner.enable_cross_payment = false; + $scope.initMerchantCode = function () { + $http.get('/sys/partners/init/merchant_code').then(function (response) { + $scope.partner.client_moniker = response.data.partner_code; + $scope.merchantCodeChecked = true; + $scope.merchantIsValid = true; + }); + }; + $scope.enablePaymentType = function (type) { + $scope.partner[type] = !$scope.partner[type]; + }; + $scope.enablePaymentType('enable_cross_payment'); + $scope.initMerchantCode(); + $scope.partner.company_phone_c = 61; + $scope.partner.contact_phone_c = 61; + $scope.partner.client_pay_type = []; + $scope.partner.client_pay_desc = []; + + var resetClientPayDescByTpey = function (type) { + type = parseInt(type); + if (type == 1) { + removeClientPayDesc($scope.partner.client_pay_desc, '10'); + } + if (type == 2) { + removeClientPayDesc($scope.partner.client_pay_desc, '20'); + } + }; + $scope.partner.sameAsContactPerson = false; + + $scope.checkboxOnclick = function (){ + $scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson); + if($scope.partner.sameAsContactPerson) { + $scope.partner.legal_representative_person = $scope.partner.contact_person; + $scope.partner.legal_representative_phone_a = $scope.partner.contact_phone_a; + $scope.partner.legal_representative_phone_c = $scope.partner.contact_phone_c; + $scope.partner.legal_representative_phone_p = $scope.partner.contact_phone_p; + $scope.partner.legal_representative_email = $scope.partner.contact_email; + $scope.partner.legal_representative_job = $scope.partner.contact_job; + $scope.partner.legal_representative_wechatid = $scope.partner.contact_wechatid; + } + } + + $scope.partner.marketingSameAsContact = false; + $scope.checkMarketingSameAsContact = function (){ + $scope.partner.marketingSameAsContact = !($scope.partner.marketingSameAsContact); + if($scope.partner.marketingSameAsContact) { + $scope.partner.marketing_person = $scope.partner.contact_person; + $scope.partner.marketing_phone_a = $scope.partner.contact_phone_a; + $scope.partner.marketing_phone_c = $scope.partner.contact_phone_c; + $scope.partner.marketing_phone_p = $scope.partner.contact_phone_p; + $scope.partner.marketing_email = $scope.partner.contact_email; + $scope.partner.marketing_job = $scope.partner.contact_job; + $scope.partner.marketing_wechatid = $scope.partner.contact_wechatid; + } + } + + $scope.partner.sameAsAddress=false; + $scope.sameAddress = function (){ + $scope.partner.sameAsAddress = !($scope.partner.sameAsAddress); + if($scope.partner.sameAsAddress) { + $scope.partner.registered_address = $scope.partner.address; + $scope.partner.registered_suburb = $scope.partner.suburb; + $scope.partner.registered_postcode = $scope.partner.postcode; + $scope.partner.registered_state = $scope.partner.state; + } + } + + var compare = function (x, y) { + x = parseInt(x); + y = parseInt(y); + if (x < y) { + return -1; + } else if (x > y) { + return 1; + } else { + return 0; + } + } + $scope.toggleClientPayType = function (type) { + if ($scope.partner.client_pay_type == null || $scope.partner.client_pay_type == undefined) { + $scope.partner.client_pay_type = []; + } + var $idx = $scope.partner.client_pay_type.indexOf(type); + if ($idx >= 0) { + $scope.partner.client_pay_type.splice($idx, 1); + resetClientPayDescByTpey(type); + } else { + $scope.partner.client_pay_type.push(type); + $scope.partner.client_pay_type.sort(compare); + } + }; + $scope.toggleClientPayDesc = function (type) { + if ($scope.partner.client_pay_desc == null || $scope.partner.client_pay_desc == undefined) { + $scope.partner.client_pay_desc = []; + } + var $idx = $scope.partner.client_pay_desc.indexOf(type); + if ($idx >= 0) { + if (type == '203') { + removeClientPayDesc($scope.partner.client_pay_desc, '2030') + } + $scope.partner.client_pay_desc.splice($idx, 1); + } else { + $scope.partner.client_pay_desc.push(type); + $scope.partner.client_pay_desc.sort(compare); + } + }; + $scope.pagination = {}; + $scope.industries = industryMap.configs(); + $scope.upayIndustrys = upayIndustryMap.configs(); + $scope.states = stateMap.configs(); + $scope.countries = countryMap.configs(); + $scope.sectors = sectorMap.configs(); + $scope.business_structures = businessStructuresMap.configs(); + $scope.params = {textType: 'all', org_name: 'ALL'}; + $scope.merchantIsValid = false; + $scope.merchantCodeChecked = false; + + function remove(arr, val) { + if (angular.isArray(arr)) { + for (var i = arr.length; i--;) { + if (arr[i].value == val) { + arr.splice(i, 1); + break; + } + } + } + return arr; + } + + var industries = angular.copy($scope.industries); + $scope.industries = remove(industries, 331); + + $scope.listReferrers = function () { + $http.get('/sys/orgs/referrer').then(function (resp) { + $scope.referrers = resp.data; + }) + }; + $scope.listReferrers(); + + $scope.loadAlipayCategory = function () { + $http.get('/static/data/alipayMcc.json').then(function (resp) { + $scope.alipayMccCategory = resp.data; + }) + }; + $scope.loadAlipayCategory(); + $scope.loadJDindustry = function () { + $http.get('/static/data/jdindustry.json').then(function (resp) { + $scope.jdindustry = resp.data; + }) + }; + $scope.loadJDindustry(); + + $scope.loadLakalaPayindustry = function () { + $http.get('/static/data/lakalapayindustry.json').then(function (resp) { + $scope.lakalapayindustry = resp.data; + }) + }; + $scope.loadLakalaPayindustry(); + + $scope.loadLakalaPaySettle = function () { + $http.get('/static/data/lakalapaysettle.json').then(function (resp) { + $scope.lakalapaysettle = resp.data; + }) + }; + $scope.loadLakalaPaySettle(); + + $scope.loadLakalaPayGoods = function () { + $http.get('/static/data/lakalapaygoods.json').then(function (resp) { + $scope.lakalapaygoods = resp.data; + }) + }; + $scope.loadLakalaPayGoods(); + + $scope.loadRoyalpayindustry = function () { + $http.get('/static/data/royalpayindustry.json').then(function (resp) { + $scope.royalpayindustry = resp.data; + }) + }; + $scope.loadRoyalpayindustry(); + + $scope.loadHfindustry = function () { + $http.get('/static/data/hfindustry.json').then(function (resp) { + $scope.hfindustry = resp.data; + }) + }; + $scope.loadHfindustry(); + + $scope.onAlipayMccSelect = function (selectedItem) { + $scope.partner.alipay_category = selectedItem.label; + $scope.partner.alipayindustry = selectedItem.mccCode; + }; + + $scope.onRoyalPayIndustrySelect = function (selectedItem) { + $scope.partner.royalpay_label = selectedItem.label; + $scope.partner.royalpayindustry = selectedItem.mccCode; + }; + + $scope.onHfIndustrySelect = function (selectedItem) { + $scope.partner.hf_label = selectedItem.label; + $scope.partner.hfindustry = selectedItem.mccCode; + }; + + // $scope.t2city_map = angular.copy(t2city_map); + + $scope.timezones = timezone.configs(); + $scope.checkMerchantCodeIsValid = function (code) { + if (code.length != 4) { + $scope.merchantCodeChecked = false; + $scope.merchantIsValid = false; + return; + } + $http.get('/sys/partners/init/check_code_isvalid', {params: {clientMoniker: code}}).then(function (response) { + $scope.merchantIsValid = response.data; + $scope.merchantCodeChecked = true; + }); + }; + $scope.save = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + if (!$scope.partner.enable_cross_payment && !$scope.partner.enable_card_payment) { + alert("商户至少开通一种支付方式,请检查是否选择了跨境支付或卡支付!"); + return; + } + + if ($scope.partner.company_name.indexOf("Migration") != -1) { + alert("Company Name包含敏感词汇,请检查后重新提交!"); + return; + } + if ($scope.partner.company_phone_a && ('' + $scope.partner.company_phone_a != '')) { + if ($scope.partner.company_phone_a.indexOf('0') == 0) { + alert("Please remove the first character '0' of area code"); + return; + } + } + if ($scope.partner.contact_phone && ('' + $scope.partner.contact_phone != '')) { + if ($scope.partner.contact_phone.indexOf('0') == 0) { + alert("Please remove the first character '0' of area code"); + return; + } + } + $scope.partner.company_phone = '+' + $scope.partner.company_phone_c + ($scope.partner.company_phone_a || '') + $scope.partner.company_phone_p; + $scope.partner.contact_phone = '+' + $scope.partner.contact_phone_c + ($scope.partner.contact_phone_a || '') + $scope.partner.contact_phone_p; + $scope.partner.legal_representative_phone = '+' + $scope.partner.legal_representative_phone_c + ( $scope.partner.legal_representative_phone_a || '') + $scope.partner.legal_representative_phone_p; + $scope.partner.marketing_phone = '+' + $scope.partner.marketing_phone_c + ( $scope.partner.marketing_phone_a || '') + $scope.partner.marketing_phone_p; + if ($scope.partner.company_phone.indexOf(' ') != -1) { + alert('Company Phone can not contain space character'); + return; + } + if ($scope.partner.contact_phone.indexOf(' ') != -1) { + alert('Contact Phone can not contain space character'); + return; + } + if ($scope.partner.legal_representative_phone.indexOf(' ') != -1) { + alert('Representative phone can not contain space character'); + return; + } + if ($scope.partner.marketing_phone.indexOf(' ') != -1) { + alert('Marketing phone can not contain space character'); + return; + } + if ($scope.partner.contact_email.indexOf(' ') != -1) { + alert('Contact email Phone can not contain space character'); + return; + } + if ($scope.partner.legal_representative_email.indexOf(' ') != -1) { + alert('Representative email Phone can not contain space character'); + return; + } + + if ($scope.partner.marketing_email && $scope.partner.marketing_email.indexOf(' ') != -1) { + alert('Marketing email Phone can not contain space character'); + return; + } + if ($scope.partner.suburb.indexOf(' ') != -1) { + alert('suburb can not contain two and more continuous space characters'); + return; + } + if ($scope.partner.registered_suburb.indexOf(' ') != -1) { + alert('Registered suburb can not contain two and more continuous space characters'); + return; + } + if ($scope.partner.acn && $scope.partner.business_structure == 'Company') { + if ($scope.partner.acn.length != 9) { + alert('Acn is not valid'); + return; + } + } + if (!$scope.partner.logo_url) { + alert("Logo is necessary!"); + return; + } + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { + if (!$scope.partner.company_photo) { + alert('Shop Photo1 is necessary'); + return; + } + if (!$scope.partner.store_photo) { + alert('Shop Photo2 is necessary'); + return; + } + } + + if ($scope.partner.referrer_id) { + $scope.referrers.forEach(function (e) { + if ($scope.partner.referrer_id == e.org_id) { + $scope.partner.referrer_name = e.name; + return; + } + }) + } + + if ($scope.partner.client_pay_type.length == 0) { + alert('请选择商户支付场景') + return; + } + if ($scope.partner.client_pay_desc.length == 0) { + alert('请选择商户支付方式') + return; + } + if (typeof ($scope.partner.client_pay_type) == 'string' || typeof ($scope.partner.client_pay_desc) == 'string') { + $scope.partner.client_pay_type = $scope.partner.client_pay_type.split(","); + $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.split(","); + + } + if ($scope.partner.client_pay_type.indexOf('1') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) { + alert("请检查线上支付场景是否已选择支付方式"); + return; + } + } + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { + alert("请检查线下支付场景是否已选择支付方式"); + return; + } + } + if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0 && $scope.partner.client_pay_desc.join(',').indexOf('20399') < 0) { + alert("请检查线下支付是否已选择收银系统类型"); + return; + } + } + $scope.partner.client_pay_type = $scope.partner.client_pay_type.join(','); + $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(','); + $http.post('/sys/partners', $scope.partner).then(function (resp) { + commonDialog.alert({title: 'Success', content: 'Register new partner successfully', type: 'success'}); + $scope.updateMerchantLocation(); + // $scope.loadPartners(); + $state.go('partners.detail', {clientMoniker: resp.data.client_moniker}) + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }); + }; + $scope.uploadLogo = function (file) { + if (file != null) { + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.uploadShopPhoto = function (file) { + if (file != null) { + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.uploadStorePhoto = function (file) { + if (file != null) { + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.updateMerchantLocation = function () { + var params = window.frames['merchant_detail'].merchant_location; + if (params) { + $http.put('/sys/partners/modify/' + $scope.partner.client_moniker + '/location', params).then(function () { + }); + } + } + }]); + app.controller('partnerEditCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'partner','upayIndustryMap', + function ($scope, $http, $state, Upload, commonDialog, timezone, partner,upayIndustryMap) { + $scope.upayIndustrys = upayIndustryMap.configs(); + $scope.timezones = timezone.configs(); + $scope.partner = partner.data; + if (!$scope.partner.client_type) { + $scope.partner.client_type = 'cross-border'; + } + if($scope.partner.representativeInfo != null) + { + $scope.partner.registered_address = $scope.partner.representativeInfo.address; + $scope.partner.registered_suburb = $scope.partner.representativeInfo.suburb; + $scope.partner.registered_postcode = $scope.partner.representativeInfo.postcode; + $scope.partner.registered_state = $scope.partner.representativeInfo.state; + $scope.partner.legal_representative_person = $scope.partner.representativeInfo.representative_person; + $scope.partner.legal_representative_phone = $scope.partner.representativeInfo.phone; + $scope.partner.legal_representative_email = $scope.partner.representativeInfo.email; + $scope.partner.legal_representative_job = $scope.partner.representativeInfo.job_title; + + $scope.partner.marketing_person = $scope.partner.representativeInfo.marketing_person; + $scope.partner.marketing_phone = $scope.partner.representativeInfo.marketing_phone; + $scope.partner.marketing_email = $scope.partner.representativeInfo.marketing_email; + $scope.partner.marketing_job = $scope.partner.representativeInfo.marketing_job_title; + + $scope.partner.legal_representative_wechatid = $scope.partner.representativeInfo.legal_representative_wechatid; + $scope.partner.marketing_wechatid = $scope.partner.representativeInfo.marketing_wechatid; + } + + $scope.enablePaymentType = function (type) { + $scope.partner[type] = !$scope.partner[type]; + }; + + if ($state.params.commitCardPayment) { + $scope.enablePaymentType('enable_card_payment'); + } + + if ($state.params.commitCrossBorderPayment) { + $scope.enablePaymentType('enable_cross_payment'); + } + + function hasRole() { + var rolenum; + switch (sessionStorage.getItem('role')) { + case "administrator": + rolenum = 1; + break; + case "bduser": + rolenum = 4; + break; + case "salesmanager": + rolenum = 8192; + break; + case "accountant": + rolenum = 8; + break; + case "sitemanager": + rolenum = 128; + break; + case "director": + rolenum = 64; + break; + case "developer": + rolenum = 256; + break; + case "compliance": + rolenum = 2; + break; + case "guest": + rolenum = 2048; + break; + case "orgmanager": + rolenum = 4096; + break; + case "riskmanager": + rolenum = 1024; + break; + default: + break; + } + if ((window.currentUser.role & rolenum) >0) { + return true; + }else { + sessionStorage.removeItem('role'); + return false; + } + } + + if (hasRole()) { + $scope.role = sessionStorage.getItem('role'); + } + + var origin_referrer_id = angular.copy($scope.partner.referrer_id); + var resetClientPayDescByTpey = function (type) { + type = parseInt(type); + if (type == 1) { + removeClientPayDesc($scope.partner.client_pay_desc, '10'); + } + if (type == 2) { + removeClientPayDesc($scope.partner.client_pay_desc, '20'); + } + }; + var compare = function (x, y) { + x = parseInt(x); + y = parseInt(y); + if (x < y) { + return -1; + } else if (x > y) { + return 1; + } else { + return 0; + } + } + $scope.toggleClientPayType = function (type) { + if (!$scope.partner.client_pay_type) { + $scope.partner.client_pay_type = []; + } + var $idx = $scope.partner.client_pay_type.indexOf(type); + if ($idx >= 0) { + $scope.partner.client_pay_type.splice($idx, 1); + resetClientPayDescByTpey(type); + } else { + $scope.partner.client_pay_type.push(type); + $scope.partner.client_pay_type.sort(compare); + } + }; + $scope.toggleClientPayDesc = function (type) { + if (!$scope.partner.client_pay_desc) { + $scope.partner.client_pay_desc = []; + } + var $idx = $scope.partner.client_pay_desc.indexOf(type); + if ($idx >= 0) { + if (type == '203') { + removeClientPayDesc($scope.partner.client_pay_desc, '2030') + } + $scope.partner.client_pay_desc.splice($idx, 1); + } else { + $scope.partner.client_pay_desc.push(type); + $scope.partner.client_pay_desc.sort(compare); + } + }; + + $scope.partner.sameAsContactPerson = false; + $scope.checkboxOnclick = function (){ + $scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson); + if($scope.partner.sameAsContactPerson) { + $scope.partner.legal_representative_person = $scope.partner.contact_person; + $scope.partner.legal_representative_phone = $scope.partner.contact_phone; + $scope.partner.legal_representative_email = $scope.partner.contact_email; + $scope.partner.legal_representative_job = $scope.partner.contact_job; + $scope.partner.legal_representative_wechatid = $scope.partner.contact_wechatid; + } + } + + $scope.partner.marketingSameAsContact = false; + $scope.checkMarketingSameAsContact = function (){ + $scope.partner.marketingSameAsContact = !($scope.partner.marketingSameAsContact); + if($scope.partner.marketingSameAsContact) { + $scope.partner.marketing_person = $scope.partner.contact_person; + $scope.partner.marketing_phone = $scope.partner.contact_phone; + $scope.partner.marketing_email = $scope.partner.contact_email; + $scope.partner.marketing_job = $scope.partner.contact_job; + $scope.partner.marketing_wechatid = $scope.partner.contact_wechatid; + } + } + + $scope.partner.sameAsAddress=false; + $scope.sameAddress = function (){ + $scope.partner.sameAsAddress=!($scope.partner.sameAsAddress); + if($scope.partner.sameAsAddress) { + $scope.partner.registered_address = $scope.partner.address; + $scope.partner.registered_suburb = $scope.partner.suburb; + $scope.partner.registered_postcode = $scope.partner.postcode; + $scope.partner.registered_state = $scope.partner.state; + } + } + + $scope.listReferrers = function () { + $http.get('/sys/orgs/referrer').then(function (resp) { + $scope.referrers = resp.data; + }) + }; + $scope.listReferrers(); + + $scope.loadAlipayCategory = function () { + $http.get('/static/data/alipayMcc.json').then(function (resp) { + $scope.alipayMccCategory = resp.data; + }) + }; + $scope.loadAlipayCategory(); + $scope.loadJDindustry = function () { + $http.get('/static/data/jdindustry.json').then(function (resp) { + $scope.jdindustry = resp.data; + }) + }; + $scope.loadJDindustry(); + + $scope.loadLakalaPayindustry = function () { + $http.get('/static/data/lakalapayindustry.json').then(function (resp) { + $scope.lakalapayindustry = resp.data; + }) + }; + $scope.loadLakalaPayindustry(); + + $scope.loadLakalaPaySettle = function () { + $http.get('/static/data/lakalapaysettle.json').then(function (resp) { + $scope.lakalapaysettle = resp.data; + }) + }; + $scope.loadLakalaPaySettle(); + + $scope.loadLakalaPayGoods = function () { + $http.get('/static/data/lakalapaygoods.json').then(function (resp) { + $scope.lakalapaygoods = resp.data; + }) + }; + $scope.loadLakalaPayGoods(); + + $scope.loadRoyalpayindustry = function () { + $http.get('/static/data/royalpayindustry.json').then(function (resp) { + $scope.royalpayindustry = resp.data; + }) + }; + $scope.loadRoyalpayindustry(); + + $scope.loadHfindustry = function () { + $http.get('/static/data/hfindustry.json').then(function (resp) { + $scope.hfindustry = resp.data; + }) + }; + $scope.loadHfindustry(); + + $scope.onAlipayMccSelect = function (selectedItem) { + $scope.partner.alipay_category = selectedItem.label; + $scope.partner.alipayindustry = selectedItem.mccCode; + }; + $scope.onRoyalPayIndustrySelect = function (selectedItem) { + $scope.partner.royalpay_label = selectedItem.label; + $scope.partner.royalpayindustry = selectedItem.mccCode; + }; + $scope.onHfIndustrySelect = function (selectedItem) { + $scope.partner.hf_label = selectedItem.label; + $scope.partner.hfindustry = selectedItem.mccCode; + }; + + + $scope.updatePartner = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + + if ($scope.partner.company_name.indexOf("Migration") != -1) { + alert("Company Name包含敏感词汇,请检查后重新提交!"); + return; + } + if ($scope.partner.company_phone.indexOf(' ') != -1) { + alert('Company Phone can not contain space character'); + return; + } + if ($scope.partner.contact_email.indexOf(' ') != -1) { + alert('Contact email Phone can not contain space character'); + return; + } + if ($scope.partner.suburb.indexOf(' ') != -1) { + alert('suburb can not contain two and more continuous space characters'); + return; + } + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { + if (!$scope.partner.company_photo) { + alert('Shop Photo1 is necessary'); + return; + } + if (!$scope.partner.store_photo) { + alert('Shop Photo2 is necessary'); + return; + } + } + + if ($scope.partner.acn && $scope.partner.business_structure == 'Company') { + if ($scope.partner.acn.length != 9) { + alert('Acn is not valid'); + } + } + if ($scope.partner.referrer_id) { + $scope.referrers.forEach(function (e) { + if ($scope.partner.referrer_id == e.org_id) { + $scope.partner.referrer_name = e.name; + return; + } + }) + } + var content = ''; + if (!origin_referrer_id && $scope.partner.referrer_id) { + content = 'Update partner info successfully,But You Had add new Referrer,Please Change the BD Commission Proportion!'; + } + if ($scope.partner.client_pay_type.length == 0) { + alert('请选择商户支付场景') + return; + } + if ($scope.partner.client_pay_desc.length == 0) { + alert('请选择商户支付方式') + return; + } + if ($scope.partner.client_pay_type.indexOf('1') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) { + alert("请检查线上支付场景是否已选择支付方式"); + return; + } + } + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { + alert("请检查线下支付场景是否已选择支付方式"); + return; + } + } + if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0 && $scope.partner.client_pay_desc.join(',').indexOf('20399') < 0) { + alert("请检查线下支付是否已选择收银系统类型"); + return; + } + } + $scope.partner.client_pay_type = $scope.partner.client_pay_type.join(','); + $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(','); + $http.put('/sys/partners/' + $scope.partner.client_moniker, $scope.partner).then(function () { + if (content != '') { + commonDialog.alert({ + title: 'Warning', + content: content, + type: 'error' + }); + } else { + commonDialog.alert({ + title: 'Success', + content: 'Update partner information successfully', + type: 'success' + }); + } + $scope.updateMerchantLocation(); + $scope.loadPartners(); + $state.go('^.detail', {clientMoniker: $scope.partner.client_moniker}, {reload: true}); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + }); + }; + $scope.uploadLogo = function (file) { + if (file != null) { + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.uploadShopPhoto = function (file) { + if (file != null) { + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.uploadStorePhoto = function (file) { + if (file != null) { + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.getMerchantLocation = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/location').then(function (resp) { + $scope.merchant_location = resp.data; + }); + }; + $scope.getMerchantLocation(); + + $scope.updateMerchantLocation = function () { + var params = window.frames['merchant_detail'].merchant_location; + if (params) { + $http.put('/sys/partners/modify/' + $scope.partner.client_moniker + '/location', params).then(function () { + }); + } + } + }]); + return app; +}); diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 2db44bf3f..acd67a9ac 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -96,10 +96,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter templateUrl: '/static/payment/partner/templates/partners.html', controller: 'partnerListCtrl', data: {label: '商户列表'} - }).state('newPartners', { - url: '/partners/new', - templateUrl: '/static/payment/partner/templates/add_partner.html', - controller: 'addPartnerCtrl' }).state('businessCompliance', { url: '/partners/compliance', templateUrl: '/static/payment/partner/templates/partner_compliance.html', @@ -117,15 +113,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter return $http.get('/sys/partners/' + $stateParams.clientMoniker); }] } - }).state('partners.edit', { - url: '/{clientMoniker}/edit', - templateUrl: '/static/payment/partner/templates/partner_edit.html', - controller: 'partnerEditCtrl', - resolve: { - partner: ['$http', '$stateParams', function ($http, $stateParams) { - return $http.get('/sys/partners/' + $stateParams.clientMoniker); - }] - } }).state('partners.detail.payment_info', { url: '/payment', templateUrl: '/static/payment/partner/templates/partner_payment_info.html', @@ -161,13 +148,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }).state('partners.detail.files', { url: '/files', templateUrl: '/static/payment/partner/templates/partner_auth_files.html', - controller: 'partnerAuthFileCtrl', + controller: 'partnerAuthFileCtrl' + }).state('partners.detail.files.CP_files', { + url: '/cp_files', + templateUrl: '/static/payment/partner/templates/partner_cp_auth_files.html', + controller: 'partnerCPAuthFileCtrl', resolve: { file: ['$http', '$stateParams', function ($http, $stateParams) { return $http.get('/sys/partners/' + $stateParams.clientMoniker + '/file'); }] } - }).state('partners.detail.MW_files', { + }).state('partners.detail.files.MW_files', { url: '/mw_files', templateUrl: '/static/payment/partner/templates/partner_mw_auth_files.html', controller: 'partnerMWAuthFileCtrl', @@ -427,442 +418,13 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; }]); - app.controller('addPartnerCtrl', ['$rootScope', '$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'businessStructuresMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap', function ($rootScope, $scope, $http, $state, Upload, commonDialog, timezone, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) { - if ($scope.partner_application) { - $scope.partner = angular.copy($scope.partner_application); - delete $rootScope.partner_application; - } else { - $scope.partner = {timezone: 'Australia/Melbourne'}; - } - $scope.initMerchantCode = function () { - $http.get('/sys/partners/init/merchant_code').then(function (response) { - $scope.partner.client_moniker = response.data.partner_code; - $scope.merchantCodeChecked = true; - $scope.merchantIsValid = true; - }); - }; - $scope.initMerchantCode(); - $scope.partner.company_phone_c = 61; - $scope.partner.contact_phone_c = 61; - $scope.partner.client_pay_type = []; - $scope.partner.client_pay_desc = []; - var resetClientPayDescByTpey = function (type) { - type = parseInt(type); - if (type == 1) { - removeClientPayDesc($scope.partner.client_pay_desc, '10'); - } - if (type == 2) { - removeClientPayDesc($scope.partner.client_pay_desc, '20'); - } - }; - $scope.partner.sameAsContactPerson = false; - $scope.checkboxOnclick = function (){ - $scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson); - if($scope.partner.sameAsContactPerson) { - $scope.partner.legal_representative_person = $scope.partner.contact_person; - $scope.partner.legal_representative_phone_a = $scope.partner.contact_phone_a; - $scope.partner.legal_representative_phone_c = $scope.partner.contact_phone_c; - $scope.partner.legal_representative_phone_p = $scope.partner.contact_phone_p; - $scope.partner.legal_representative_email = $scope.partner.contact_email; - $scope.partner.legal_representative_job = $scope.partner.contact_job; - $scope.partner.legal_representative_wechatid = $scope.partner.contact_wechatid; - } - } - - $scope.partner.marketingSameAsContact = false; - $scope.checkMarketingSameAsContact = function (){ - $scope.partner.marketingSameAsContact = !($scope.partner.marketingSameAsContact); - if($scope.partner.marketingSameAsContact) { - $scope.partner.marketing_person = $scope.partner.contact_person; - $scope.partner.marketing_phone_a = $scope.partner.contact_phone_a; - $scope.partner.marketing_phone_c = $scope.partner.contact_phone_c; - $scope.partner.marketing_phone_p = $scope.partner.contact_phone_p; - $scope.partner.marketing_email = $scope.partner.contact_email; - $scope.partner.marketing_job = $scope.partner.contact_job; - $scope.partner.marketing_wechatid = $scope.partner.contact_wechatid; - } - } - - $scope.partner.sameAsAddress=false; - $scope.sameAddress = function (){ - $scope.partner.sameAsAddress = !($scope.partner.sameAsAddress); - if($scope.partner.sameAsAddress) { - $scope.partner.registered_address = $scope.partner.address; - $scope.partner.registered_suburb = $scope.partner.suburb; - $scope.partner.registered_postcode = $scope.partner.postcode; - $scope.partner.registered_state = $scope.partner.state; - } - } - - var compare = function (x, y) { - x = parseInt(x); - y = parseInt(y); - if (x < y) { - return -1; - } else if (x > y) { - return 1; - } else { - return 0; - } - } - $scope.toggleClientPayType = function (type) { - if ($scope.partner.client_pay_type == null || $scope.partner.client_pay_type == undefined) { - $scope.partner.client_pay_type = []; - } - var $idx = $scope.partner.client_pay_type.indexOf(type); - if ($idx >= 0) { - $scope.partner.client_pay_type.splice($idx, 1); - resetClientPayDescByTpey(type); - } else { - $scope.partner.client_pay_type.push(type); - $scope.partner.client_pay_type.sort(compare); - } - }; - $scope.toggleClientPayDesc = function (type) { - if ($scope.partner.client_pay_desc == null || $scope.partner.client_pay_desc == undefined) { - $scope.partner.client_pay_desc = []; - } - var $idx = $scope.partner.client_pay_desc.indexOf(type); - if ($idx >= 0) { - if (type == '203') { - removeClientPayDesc($scope.partner.client_pay_desc, '2030') - } - $scope.partner.client_pay_desc.splice($idx, 1); - } else { - $scope.partner.client_pay_desc.push(type); - $scope.partner.client_pay_desc.sort(compare); - } - }; - $scope.pagination = {}; - $scope.industries = industryMap.configs(); - $scope.states = stateMap.configs(); - $scope.countries = countryMap.configs(); - $scope.sectors = sectorMap.configs(); - $scope.business_structures = businessStructuresMap.configs(); - $scope.clean_days = angular.copy(clean_days_map); - $scope.bd_citys = angular.copy(bd_city_map); - $scope.params = {textType: 'all', org_name: 'ALL'}; - $scope.merchantIsValid = false; - $scope.merchantCodeChecked = false; - - function remove(arr, val) { - if (angular.isArray(arr)) { - for (var i = arr.length; i--;) { - if (arr[i].value == val) { - arr.splice(i, 1); - break; - } - } - } - return arr; - } - - var industries = angular.copy($scope.industries); - $scope.industries = remove(industries, 331); - - $scope.listReferrers = function () { - $http.get('/sys/orgs/referrer').then(function (resp) { - $scope.referrers = resp.data; - }) - }; - $scope.listReferrers(); - - $scope.loadAlipayCategory = function () { - $http.get('/static/data/alipayMcc.json').then(function (resp) { - $scope.alipayMccCategory = resp.data; - }) - }; - $scope.loadAlipayCategory(); - $scope.loadJDindustry = function () { - $http.get('/static/data/jdindustry.json').then(function (resp) { - $scope.jdindustry = resp.data; - }) - }; - $scope.loadJDindustry(); - - $scope.loadLakalaPayindustry = function () { - $http.get('/static/data/lakalapayindustry.json').then(function (resp) { - $scope.lakalapayindustry = resp.data; - }) - }; - $scope.loadLakalaPayindustry(); - - $scope.loadLakalaPaySettle = function () { - $http.get('/static/data/lakalapaysettle.json').then(function (resp) { - $scope.lakalapaysettle = resp.data; - }) - }; - $scope.loadLakalaPaySettle(); - - $scope.loadLakalaPayGoods = function () { - $http.get('/static/data/lakalapaygoods.json').then(function (resp) { - $scope.lakalapaygoods = resp.data; - }) - }; - $scope.loadLakalaPayGoods(); - - $scope.loadRoyalpayindustry = function () { - $http.get('/static/data/royalpayindustry.json').then(function (resp) { - $scope.royalpayindustry = resp.data; - }) - }; - $scope.loadRoyalpayindustry(); - - $scope.loadHfindustry = function () { - $http.get('/static/data/hfindustry.json').then(function (resp) { - $scope.hfindustry = resp.data; - }) - }; - $scope.loadHfindustry(); - - $scope.onAlipayMccSelect = function (selectedItem) { - $scope.partner.alipay_category = selectedItem.label; - $scope.partner.alipayindustry = selectedItem.mccCode; - }; - - $scope.onRoyalPayIndustrySelect = function (selectedItem) { - $scope.partner.royalpay_label = selectedItem.label; - $scope.partner.royalpayindustry = selectedItem.mccCode; - }; - - $scope.onHfIndustrySelect = function (selectedItem) { - $scope.partner.hf_label = selectedItem.label; - $scope.partner.hfindustry = selectedItem.mccCode; - }; - - // $scope.t2city_map = angular.copy(t2city_map); - - $scope.timezones = timezone.configs(); - $scope.checkMerchantCodeIsValid = function (code) { - if (code.length != 4) { - $scope.merchantCodeChecked = false; - $scope.merchantIsValid = false; - return; - } - $http.get('/sys/partners/init/check_code_isvalid', {params: {clientMoniker: code}}).then(function (response) { - $scope.merchantIsValid = response.data; - $scope.merchantCodeChecked = true; - }); - }; - $scope.save = function (form) { - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true; - } - }); - return; - } - - if ($scope.partner.company_name.indexOf("Migration") != -1) { - alert("Company Name包含敏感词汇,请检查后重新提交!"); - return; - } - if ($scope.partner.company_phone_a && ('' + $scope.partner.company_phone_a != '')) { - if ($scope.partner.company_phone_a.indexOf('0') == 0) { - alert("Please remove the first character '0' of area code"); - return; - } - } - if ($scope.partner.contact_phone && ('' + $scope.partner.contact_phone != '')) { - if ($scope.partner.contact_phone.indexOf('0') == 0) { - alert("Please remove the first character '0' of area code"); - return; - } - } - $scope.partner.company_phone = '+' + $scope.partner.company_phone_c + ($scope.partner.company_phone_a || '') + $scope.partner.company_phone_p; - $scope.partner.contact_phone = '+' + $scope.partner.contact_phone_c + ($scope.partner.contact_phone_a || '') + $scope.partner.contact_phone_p; - $scope.partner.legal_representative_phone = '+' + $scope.partner.legal_representative_phone_c + ( $scope.partner.legal_representative_phone_a || '') + $scope.partner.legal_representative_phone_p; - $scope.partner.marketing_phone = '+' + $scope.partner.marketing_phone_c + ( $scope.partner.marketing_phone_a || '') + $scope.partner.marketing_phone_p; - if ($scope.partner.company_phone.indexOf(' ') != -1) { - alert('Company Phone can not contain space character'); - return; - } - if ($scope.partner.contact_phone.indexOf(' ') != -1) { - alert('Contact Phone can not contain space character'); - return; - } - if ($scope.partner.legal_representative_phone.indexOf(' ') != -1) { - alert('Representative phone can not contain space character'); - return; - } - if ($scope.partner.marketing_phone.indexOf(' ') != -1) { - alert('Marketing phone can not contain space character'); - return; - } - if ($scope.partner.contact_email.indexOf(' ') != -1) { - alert('Contact email Phone can not contain space character'); - return; - } - if ($scope.partner.legal_representative_email.indexOf(' ') != -1) { - alert('Representative email Phone can not contain space character'); - return; - } - if ($scope.partner.marketing_email.indexOf(' ') != -1) { - alert('Marketing email Phone can not contain space character'); - return; - } - if ($scope.partner.suburb.indexOf(' ') != -1) { - alert('suburb can not contain two and more continuous space characters'); - return; - } - if ($scope.partner.registered_suburb.indexOf(' ') != -1) { - alert('Registered suburb can not contain two and more continuous space characters'); - return; - } - if ($scope.partner.acn && $scope.partner.business_structure == 'Company') { - if ($scope.partner.acn.length != 9) { - alert('Acn is not valid'); - return; - } - } - if (!$scope.partner.logo_url) { - alert("Logo is necessary!"); - return; - } - if ($scope.partner.client_pay_type.indexOf('2') >= 0) { - if (!$scope.partner.company_photo) { - alert('Shop Photo1 is necessary'); - return; - } - if (!$scope.partner.store_photo) { - alert('Shop Photo2 is necessary'); - return; - } - } - - if ($scope.partner.referrer_id) { - $scope.referrers.forEach(function (e) { - if ($scope.partner.referrer_id == e.org_id) { - $scope.partner.referrer_name = e.name; - return; - } - }) - } - - if ($scope.partner.client_pay_type.length == 0) { - alert('请选择商户支付场景') - return; - } - if ($scope.partner.client_pay_desc.length == 0) { - alert('请选择商户支付方式') - return; - } - if (typeof ($scope.partner.client_pay_type) == 'string' || typeof ($scope.partner.client_pay_desc) == 'string') { - $scope.partner.client_pay_type = $scope.partner.client_pay_type.split(","); - $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.split(","); - - } - if ($scope.partner.client_pay_type.indexOf('1') >= 0) { - if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) { - alert("请检查线上支付场景是否已选择支付方式"); - return; - } - } - if ($scope.partner.client_pay_type.indexOf('2') >= 0) { - if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { - alert("请检查线下支付场景是否已选择支付方式"); - return; - } - } - if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) { - if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0 && $scope.partner.client_pay_desc.join(',').indexOf('20399') < 0) { - alert("请检查线下支付是否已选择收银系统类型"); - return; - } - } - $scope.partner.client_pay_type = $scope.partner.client_pay_type.join(','); - $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(','); - $http.post('/sys/partners', $scope.partner).then(function (resp) { - commonDialog.alert({title: 'Success', content: 'Register new partner successfully', type: 'success'}); - $scope.updateMerchantLocation(); - // $scope.loadPartners(); - $state.go('partners.detail', {clientMoniker: resp.data.client_moniker}) - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }); - }; - $scope.uploadLogo = function (file) { - if (file != null) { - if (file.size > 1 * 1024 * 1024) { - commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) - } else { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) - } - } - }; - - $scope.uploadShopPhoto = function (file) { - if (file != null) { - if (file.size > 2 * 1024 * 1024) { - commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) - } else { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) - } - } - }; - - $scope.uploadStorePhoto = function (file) { - if (file != null) { - if (file.size > 2 * 1024 * 1024) { - commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) - } else { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - delete $scope.storePhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) - } - } - }; - - $scope.updateMerchantLocation = function () { - var params = window.frames['merchant_detail'].merchant_location; - if (params) { - $http.put('/sys/partners/modify/' + $scope.partner.client_moniker + '/location', params).then(function () { - }); - } - } - }]); app.controller('partnerDetailCtrl', ['$scope', '$http', '$state', '$uibModal', '$rootScope', 'Upload', 'commonDialog', 'partner', '$sce', function ($scope, $http, $state, $uibModal, $rootScope, Upload, commonDialog, partner, $sce) { $scope.init = {wechat_compliance: false, local_merchant: false}; $scope.partner = partner.data; $scope.isComplianceOfCompanyName = false; $scope.isComplianceOfShortName = false; $scope.isComplianceOfBusinessStructure = false; + $scope.cardPromotionaparams={} var website = partner.data.company_website; if (website != null) { if (website.indexOf('http') != 0) { @@ -899,7 +461,21 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.fileManager = resp.data; }); }; + + $scope.showCardFile = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_card_agree_file?fileName=letter_of_offer_file').then(function (resp) { + $scope.letterOfOfferFileManager = resp.data; + }); + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_card_agree_file?fileName=promotional_offer_file').then(function (resp) { + $scope.promotionalOfferFileManager = resp.data; + }); + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_card_agree_file?fileName=terms_and_conditions_file').then(function (resp) { + $scope.termsAndConditionsFile = resp.data; + }); + }; + $scope.showFile(); + $scope.showCardFile(); $scope.passClient = function () { if ($scope.partner.enable_hf) { if ($scope.partner.hfindustry == null) { @@ -972,23 +548,89 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }); }; - $scope.pass2GreenChannel = function () { + $scope.passCardClient = function () { + if (!$rootScope.complianceCheck) { + alert("please check first"); + return; + } + if (!$rootScope.complianceCheck.authFile) { + alert("Compliance Files not checked"); + return; + } + if (!$rootScope.complianceCheck.clientInfo) { + alert("Partner Detail not checked"); + return; + } + if (!$rootScope.complianceCheck.bankAccount) { + alert("Bank Account not checked"); + return; + } + var title = 'Audit Partner Card'; + var content = 'Are you sure to mark partner ' + $scope.partner.company_name + ' audited?'; + var choises = ''; + var contentHtml = ''; + if ($scope.isComplianceOfCompanyName || $scope.isComplianceOfShortName + || $scope.isComplianceOfBusinessStructure) { + var info = []; + if ($scope.isComplianceOfCompanyName) { + info.push('Company Name'); + } + if ($scope.isComplianceOfShortName) { + info.push('Short Name'); + } + if ($scope.isComplianceOfBusinessStructure) { + info.push('Business Structure'); + } + title = 'Warning'; + contentHtml = $sce.trustAsHtml('本次提交的商户[' + $scope.partner.company_name + '],' + info.toString() + '存在微信渠道不合规信息'); + choises = [{label: '取消', className: 'btn-danger', key: '2', dismiss: true}, + {label: '确认提交', className: 'btn-success', key: '1'}]; + content = ''; + } commonDialog.confirm({ - title: 'Green Channel Audit Partner', - content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' green channel audited ?' + title: title, + content: content, + choises: choises, + contentHtml: contentHtml }).then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/aduit/green_channel').then(function () { - commonDialog.alert({ - title: 'Success', - content: 'Comply Passed! Email will send to contact email address soon.', - type: 'success' - }); - $state.reload(); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - }) - }; + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/card_audit', {pass: 1}).then(function () { + if ($scope.partner.approve_result == 2 && ($scope.partner.source == 1 || $scope.partner.source == 2)) { + commonDialog.alert({ + title: 'Success', + content: 'Comply Passed!', + type: 'success' + }); + } else { + commonDialog.alert({ + title: 'Success', + content: 'Comply Passed! Email will send to contact email address soon.', + type: 'success' + }); + } + delete $rootScope.complianceCheck; + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }); + }; + $scope.pass2GreenChannel = function () { + commonDialog.confirm({ + title: 'Green Channel Audit Partner', + content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' green channel audited ?' + }).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/aduit/green_channel').then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Comply Passed! Email will send to contact email address soon.', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; $scope.showBg = false; $scope.exportPDF = function () { $scope.showBg = true; @@ -1022,8 +664,71 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $state.reload(); commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); }); - }; + + //制作卡支付合同 + $scope.exportCardAgreegatePDF = function(){ + $scope.showBg = true; + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/aggregate/card_agree_pdf').then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Agreement File Generate Succeed! Please notify BD!', + type: 'success' + }); + $scope.showBg = false; + $state.reload(); + }, function (resp) { + $scope.showBg = false; + $state.reload(); + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }); + } + + //制作促销合同 + $scope.exportCardPromotionaAgreegatePDF = function(){ + var title = '确认生成Promotional Offer合同'; + var promotiona_date=''; + var promotiona_period =''; + var contentHtml = $sce.trustAsHtml( + '请输入优惠开始日期(eg:2020-02-01): '+ + '' + + '
    ' + + '请输入活动周数(unit:week): ' + + ''); + var choises = [{label: '取消', className: 'btn-danger', key: '2', dismiss: true}, + {label: '确认生成', className: 'btn-success', key: '1'}]; + var content = ''; + + commonDialog.confirm({ + title: title, + content: content, + choises: choises, + contentHtml: contentHtml + }).then(function (res) { + $scope.showBg = true; + var date = document.getElementById("promotiona_date").value; + var period = document.getElementById("promotiona_period").value; + if(date=='' || period==''){ + commonDialog.alert({title: 'Error', content: '选项不得未空', type: 'error'}); + }else{ + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/aggregate/card_promotiona_agree_pdf?date='+date+'&period='+period).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Agreement File Generate Succeed! Please notify BD!', + type: 'success' + }); + $scope.showBg = false; + $state.reload(); + }, function (resp) { + $scope.showBg = false; + $state.reload(); + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }); + } + + }); + } + $scope.Export = function () { var url = '/dev/' + $scope.partner.client_moniker + '/export/aggregate/agreepdf'; return url; @@ -1054,6 +759,33 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } } }; + + $scope.uploadCardAgreeFile = function (file) { + if (file != null) { + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.agree_file_import = resp.data.url; + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/import/agreepdf', {source_agree_file: $scope.agree_file_import}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Succeed Imported! Please notify BD', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }, function (resp) { + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }) + } + } + }; $scope.notifyBD = function () { $http.get('/sys/partners/' + $scope.partner.client_moniker + '/notify/completeAgree').then(function () { commonDialog.alert({ @@ -1067,6 +799,19 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }); }; + $scope.cardNotifyBD = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/notify/cardCompleteAgree').then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Notify BD Successed!.', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}); + }); + }; + $scope.downTempPdf = function () { var url = '/sys/partners/' + $scope.partner.client_moniker + '/temp/export/pdf'; return url; @@ -1087,6 +832,21 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }; + $scope.cardRefuse = function(){ + commonDialog.inputText({title: 'refuse cause'}).then(function (text) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/card_audit/refuse', {refuse_remark: text}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Card Audit application has been refused.', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + } + $scope.deleteClient = function () { commonDialog.confirm({ title: 'Delete Partner', @@ -1137,7 +897,43 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } }) }; + + $scope.commitToCardCompliance = function(){ + commonDialog.confirm({ + title: 'Commit to Compliance', + content: 'Are you sure to commit ' + $scope.partner.company_name + ' to compliance?', + choises: [ + {label: 'Submit', className: 'btn-success', key: 1}, + {label: 'Cancel', className: 'btn-warning', key: 0, dismiss: true} + ] + }).then(function (choice) { + if (choice == 1) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/to_card_compliance', {}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Commit to Compliance successfully', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + } + }) + } $scope.apply2makeAgreeFile = function () { + if (!$scope.partner.enable_cross_payment) { + commonDialog.alert({ + title: 'Error!', + content: '请完善商户跨境支付基本信息、签约费率、合规文件!', + type: 'error' + }); + $state.go('partners.edit',{ + clientMoniker:$scope.partner.client_moniker, + commitCardPayment:false, + commitCrossBorderPayment:true}); + return; + } $http.get('/sys/partners/' + $scope.partner.client_moniker + '/make_agree_file').then(function () { commonDialog.alert({ title: 'Success!', @@ -1151,6 +947,43 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter ); }; + $scope.apply2makeCardAgreeFile = function () { + if (!$scope.partner.enable_card_payment) { + commonDialog.alert({ + title: 'Error!', + content: '请完善商户卡支付基本信息、签约费率、合规文件!', + type: 'error' + }); + $state.go('partners.edit',{ + clientMoniker:$scope.partner.client_moniker, + commitCardPayment:true, + commitCrossBorderPayment: false}); + return; + } + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/make_card_agree_file').then(function () { + commonDialog.alert({ + title: 'Success!', + content: '已提交制作合同!', + type: 'success' + }); + $state.reload(); + }, function (resp) { + if (String(resp.data.message).match("No Rate Config")) { + commonDialog.alert({ + title: 'Error!', + content: '商户卡支付签约费率未配置,请添加商户卡支付签约费率!', + type: 'error' + }); + $state.go('partners.detail.rates', { + clientMoniker: $scope.partner.client_moniker + }); + }else { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + } + } + ); + }; + $scope.commit2GreenChannel = function () { commonDialog.confirm({ title: 'Audit Partner', @@ -1165,582 +998,168 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $state.reload(); }, function (resp) { commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - - }) - }; - - $scope.markAuditEmail = function () { - commonDialog.confirm({ - title: 'Warning', - content: 'Make sure you have send the email to client.' - }).then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/email_sending_status').then(function () { - $state.reload(); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - }) - }; - $scope.resendApproveEmail = function () { - commonDialog.confirm({ - title: 'Warning', - content: 'This operation will reset the password of admin user. Are you sure this email is correct ? Or you may update this information first.' - }).then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/send_email').then(function () { - $state.reload(); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - }) - }; - $scope.editBDUser = function () { - $uibModal.open({ - templateUrl: '/static/payment/partner/templates/bd_user_choose_dialog.html', - controller: 'partnerChooseBDUserDialogCtrl', - resolve: { - bdUsers: ['$http', function ($http) { - return $http.get('/sys/manager_accounts/roles/bd_user'); - }], - partner: function () { - return $scope.partner; - }, - type: function () { - return 'edit'; - } - } - }).result.then(function () { - $state.reload(); - }) - }; - $scope.bindBDUser = function () { - $uibModal.open({ - templateUrl: '/static/payment/partner/templates/bd_user_choose_dialog.html', - controller: 'partnerChooseBDUserDialogCtrl', - resolve: { - bdUsers: ['$http', function ($http) { - return $http.get('/sys/manager_accounts/roles/bd_user'); - }], - partner: function () { - return $scope.partner; - }, - type: function () { - return 'add'; - } - } - }).result.then(function () { - $state.reload(); - }) - }; - - $scope.configMasterMerchant = function () { - commonDialog.inputText({title: 'Input Master Merchant Code'}).then(function (text) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/master_configuration', {master_merchant: text}).then(function () { - commonDialog.alert({title: 'Success', content: "Master Merchant Code:" + text, type: 'success'}); - }, function (resp) { - commonDialog.alert({ - title: 'Config Master Merchant Failed', - content: resp.data.message, - type: 'error' - }); - }) - }) - }; - - $scope.getMerchantLocation = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/location').then(function (resp) { - $scope.merchant_location = resp.data; - }); - }; - $scope.getMerchantLocation(); - - - $scope.complianceCheck = function () { - if (!$rootScope.complianceCheck) { - $rootScope.complianceCheck = {}; - } - $rootScope.complianceCheck.client_id = $scope.partner.client_id; - $rootScope.complianceCheck.clientInfo = true; - }; - $scope.complianceChangeCheck = function () { - if ($rootScope.complianceCheck) { - if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { - delete $rootScope.complianceCheck; - } - } - }; - $scope.complianceChangeCheck(); - - $scope.changeWechatCompliance = function () { - if (!$scope.partner) { - return; - } - if (!$state.is('partners.detail')) { - $scope.init.wechat_compliance = false; - return; - } - if (!$scope.init.wechat_compliance) { - $scope.init.wechat_compliance = true; - return; - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_compliance_permission', {allow: $scope.partner.wechat_compliance}).then(function () { - - }, function (resp) { - commonDialog.alert({ - title: 'failed to change wechat_compliance permission status', - content: resp.data.message, - type: 'error' - }) - }) - }; - $scope.changeLocalMerchant = function () { - if (!$scope.partner) { - return; - } - if (!$state.is('partners.detail')) { - $scope.init.local_merchant = false; - return; - } - if (!$scope.init.local_merchant) { - $scope.init.local_merchant = true; - return; - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/local_merchant_permission', {allow: $scope.partner.local_merchant}).then(function () { - - }, function (resp) { - commonDialog.alert({ - title: 'failed to change local_merchant permission status', - content: resp.data.message, - type: 'error' - }) - }) - }; - - $scope.removeSub = function () { - $http.delete('/sys/partners/unsub/' + $scope.partner.client_moniker).then(function (resp) { - $state.reload(); - }); - }; - $scope.addSub = function () { - $http.put('/sys/partners/unsub/' + $scope.partner.client_moniker).then(function (resp) { - $state.reload(); - }); - }; - }]); - app.controller('partnerEditCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'partner', - function ($scope, $http, $state, Upload, commonDialog, timezone, partner) { - $scope.timezones = timezone.configs(); - $scope.partner = partner.data; - if($scope.partner.representativeInfo != null) - { - $scope.partner.registered_address = $scope.partner.representativeInfo.address; - $scope.partner.registered_suburb = $scope.partner.representativeInfo.suburb; - $scope.partner.registered_postcode = $scope.partner.representativeInfo.postcode; - $scope.partner.registered_state = $scope.partner.representativeInfo.state; - $scope.partner.legal_representative_person = $scope.partner.representativeInfo.representative_person; - $scope.partner.legal_representative_phone = $scope.partner.representativeInfo.phone; - $scope.partner.legal_representative_email = $scope.partner.representativeInfo.email; - $scope.partner.legal_representative_job = $scope.partner.representativeInfo.job_title; - - $scope.partner.marketing_person = $scope.partner.representativeInfo.marketing_person; - $scope.partner.marketing_phone = $scope.partner.representativeInfo.marketing_phone; - $scope.partner.marketing_email = $scope.partner.representativeInfo.marketing_email; - $scope.partner.marketing_job = $scope.partner.representativeInfo.marketing_job_title; - - $scope.partner.legal_representative_wechatid = $scope.partner.representativeInfo.legal_representative_wechatid; - $scope.partner.marketing_wechatid = $scope.partner.representativeInfo.marketing_wechatid; - } - - function hasRole() { - var rolenum; - switch (sessionStorage.getItem('role')) { - case "administrator": - rolenum = 1; - break; - case "bduser": - rolenum = 4; - break; - case "salesmanager": - rolenum = 8192; - break; - case "accountant": - rolenum = 8; - break; - case "sitemanager": - rolenum = 128; - break; - case "director": - rolenum = 64; - break; - case "developer": - rolenum = 256; - break; - case "compliance": - rolenum = 2; - break; - case "guest": - rolenum = 2048; - break; - case "orgmanager": - rolenum = 4096; - break; - case "riskmanager": - rolenum = 1024; - break; - default: - break; - } - if ((window.currentUser.role & rolenum) >0) { - return true; - }else { - sessionStorage.removeItem('role'); - return false; - } - } - - if (hasRole()) { - $scope.role = sessionStorage.getItem('role'); - } - - var origin_referrer_id = angular.copy($scope.partner.referrer_id); - var resetClientPayDescByTpey = function (type) { - type = parseInt(type); - if (type == 1) { - removeClientPayDesc($scope.partner.client_pay_desc, '10'); - } - if (type == 2) { - removeClientPayDesc($scope.partner.client_pay_desc, '20'); - } - }; - var compare = function (x, y) { - x = parseInt(x); - y = parseInt(y); - if (x < y) { - return -1; - } else if (x > y) { - return 1; - } else { - return 0; - } - } - $scope.toggleClientPayType = function (type) { - if (!$scope.partner.client_pay_type) { - $scope.partner.client_pay_type = []; - } - var $idx = $scope.partner.client_pay_type.indexOf(type); - if ($idx >= 0) { - $scope.partner.client_pay_type.splice($idx, 1); - resetClientPayDescByTpey(type); - } else { - $scope.partner.client_pay_type.push(type); - $scope.partner.client_pay_type.sort(compare); - } - }; - $scope.toggleClientPayDesc = function (type) { - if (!$scope.partner.client_pay_desc) { - $scope.partner.client_pay_desc = []; - } - var $idx = $scope.partner.client_pay_desc.indexOf(type); - if ($idx >= 0) { - if (type == '203') { - removeClientPayDesc($scope.partner.client_pay_desc, '2030') - } - $scope.partner.client_pay_desc.splice($idx, 1); - } else { - $scope.partner.client_pay_desc.push(type); - $scope.partner.client_pay_desc.sort(compare); - } - }; - - $scope.partner.sameAsContactPerson = false; - $scope.checkboxOnclick = function (){ - $scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson); - if($scope.partner.sameAsContactPerson) { - $scope.partner.legal_representative_person = $scope.partner.contact_person; - $scope.partner.legal_representative_phone = $scope.partner.contact_phone; - $scope.partner.legal_representative_email = $scope.partner.contact_email; - $scope.partner.legal_representative_job = $scope.partner.contact_job; - $scope.partner.legal_representative_wechatid = $scope.partner.contact_wechatid; - } - } - - $scope.partner.marketingSameAsContact = false; - $scope.checkMarketingSameAsContact = function (){ - $scope.partner.marketingSameAsContact = !($scope.partner.marketingSameAsContact); - if($scope.partner.marketingSameAsContact) { - $scope.partner.marketing_person = $scope.partner.contact_person; - $scope.partner.marketing_phone = $scope.partner.contact_phone; - $scope.partner.marketing_email = $scope.partner.contact_email; - $scope.partner.marketing_job = $scope.partner.contact_job; - $scope.partner.marketing_wechatid = $scope.partner.contact_wechatid; - } - } - - $scope.partner.sameAsAddress=false; - $scope.sameAddress = function (){ - $scope.partner.sameAsAddress=!($scope.partner.sameAsAddress); - if($scope.partner.sameAsAddress) { - $scope.partner.registered_address = $scope.partner.address; - $scope.partner.registered_suburb = $scope.partner.suburb; - $scope.partner.registered_postcode = $scope.partner.postcode; - $scope.partner.registered_state = $scope.partner.state; - } - } - - $scope.listReferrers = function () { - $http.get('/sys/orgs/referrer').then(function (resp) { - $scope.referrers = resp.data; - }) - }; - $scope.listReferrers(); - - $scope.loadAlipayCategory = function () { - $http.get('/static/data/alipayMcc.json').then(function (resp) { - $scope.alipayMccCategory = resp.data; - }) - }; - $scope.loadAlipayCategory(); - $scope.loadJDindustry = function () { - $http.get('/static/data/jdindustry.json').then(function (resp) { - $scope.jdindustry = resp.data; - }) - }; - $scope.loadJDindustry(); - - $scope.loadLakalaPayindustry = function () { - $http.get('/static/data/lakalapayindustry.json').then(function (resp) { - $scope.lakalapayindustry = resp.data; - }) - }; - $scope.loadLakalaPayindustry(); - - $scope.loadLakalaPaySettle = function () { - $http.get('/static/data/lakalapaysettle.json').then(function (resp) { - $scope.lakalapaysettle = resp.data; - }) - }; - $scope.loadLakalaPaySettle(); - - $scope.loadLakalaPayGoods = function () { - $http.get('/static/data/lakalapaygoods.json').then(function (resp) { - $scope.lakalapaygoods = resp.data; - }) - }; - $scope.loadLakalaPayGoods(); - - $scope.loadRoyalpayindustry = function () { - $http.get('/static/data/royalpayindustry.json').then(function (resp) { - $scope.royalpayindustry = resp.data; - }) - }; - $scope.loadRoyalpayindustry(); - - $scope.loadHfindustry = function () { - $http.get('/static/data/hfindustry.json').then(function (resp) { - $scope.hfindustry = resp.data; - }) - }; - $scope.loadHfindustry(); - - $scope.onAlipayMccSelect = function (selectedItem) { - $scope.partner.alipay_category = selectedItem.label; - $scope.partner.alipayindustry = selectedItem.mccCode; - }; - $scope.onRoyalPayIndustrySelect = function (selectedItem) { - $scope.partner.royalpay_label = selectedItem.label; - $scope.partner.royalpayindustry = selectedItem.mccCode; - }; - $scope.onHfIndustrySelect = function (selectedItem) { - $scope.partner.hf_label = selectedItem.label; - $scope.partner.hfindustry = selectedItem.mccCode; - }; - - - $scope.updatePartner = function (form) { - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true; - } - }); - return; - } - - if ($scope.partner.company_name.indexOf("Migration") != -1) { - alert("Company Name包含敏感词汇,请检查后重新提交!"); - return; - } - if ($scope.partner.company_phone.indexOf(' ') != -1) { - alert('Company Phone can not contain space character'); - return; - } - if ($scope.partner.contact_email.indexOf(' ') != -1) { - alert('Contact email Phone can not contain space character'); - return; - } - if ($scope.partner.suburb.indexOf(' ') != -1) { - alert('suburb can not contain two and more continuous space characters'); - return; - } - if ($scope.partner.client_pay_type.indexOf('2') >= 0) { - if (!$scope.partner.company_photo) { - alert('Shop Photo1 is necessary'); - return; - } - if (!$scope.partner.store_photo) { - alert('Shop Photo2 is necessary'); - return; - } - } - - if ($scope.partner.acn && $scope.partner.business_structure == 'Company') { - if ($scope.partner.acn.length != 9) { - alert('Acn is not valid'); - } - } - if ($scope.partner.referrer_id) { - $scope.referrers.forEach(function (e) { - if ($scope.partner.referrer_id == e.org_id) { - $scope.partner.referrer_name = e.name; - return; - } - }) - } - var content = ''; - if (!origin_referrer_id && $scope.partner.referrer_id) { - content = 'Update partner info successfully,But You Had add new Referrer,Please Change the BD Commission Proportion!'; - } - if ($scope.partner.client_pay_type.length == 0) { - alert('请选择商户支付场景') - return; - } - if ($scope.partner.client_pay_desc.length == 0) { - alert('请选择商户支付方式') - return; - } - if ($scope.partner.client_pay_type.indexOf('1') >= 0) { - if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) { - alert("请检查线上支付场景是否已选择支付方式"); - return; - } - } - if ($scope.partner.client_pay_type.indexOf('2') >= 0) { - if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { - alert("请检查线下支付场景是否已选择支付方式"); - return; + }) + + }) + }; + + $scope.markAuditEmail = function () { + commonDialog.confirm({ + title: 'Warning', + content: 'Make sure you have send the email to client.' + }).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/email_sending_status').then(function () { + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; + $scope.resendApproveEmail = function () { + commonDialog.confirm({ + title: 'Warning', + content: 'This operation will reset the password of admin user. Are you sure this email is correct ? Or you may update this information first.' + }).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/send_email').then(function () { + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; + $scope.editBDUser = function () { + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/bd_user_choose_dialog.html', + controller: 'partnerChooseBDUserDialogCtrl', + resolve: { + bdUsers: ['$http', function ($http) { + return $http.get('/sys/manager_accounts/roles/bd_user'); + }], + partner: function () { + return $scope.partner; + }, + type: function () { + return 'edit'; } } - if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) { - if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0 && $scope.partner.client_pay_desc.join(',').indexOf('20399') < 0) { - alert("请检查线下支付是否已选择收银系统类型"); - return; + }).result.then(function () { + $state.reload(); + }) + }; + $scope.bindBDUser = function () { + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/bd_user_choose_dialog.html', + controller: 'partnerChooseBDUserDialogCtrl', + resolve: { + bdUsers: ['$http', function ($http) { + return $http.get('/sys/manager_accounts/roles/bd_user'); + }], + partner: function () { + return $scope.partner; + }, + type: function () { + return 'add'; } } - $scope.partner.client_pay_type = $scope.partner.client_pay_type.join(','); - $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(','); - $http.put('/sys/partners/' + $scope.partner.client_moniker, $scope.partner).then(function () { - if (content != '') { - commonDialog.alert({ - title: 'Warning', - content: content, - type: 'error' - }); - } else { - commonDialog.alert({ - title: 'Success', - content: 'Update partner information successfully', - type: 'success' - }); - } - $scope.updateMerchantLocation(); - $scope.loadPartners(); - $state.go('^.detail', {clientMoniker: $scope.partner.client_moniker}, {reload: true}); + }).result.then(function () { + $state.reload(); + }) + }; + + $scope.configMasterMerchant = function () { + commonDialog.inputText({title: 'Input Master Merchant Code'}).then(function (text) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/master_configuration', {master_merchant: text}).then(function () { + commonDialog.alert({title: 'Success', content: "Master Merchant Code:" + text, type: 'success'}); }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) - }); - }; - $scope.uploadLogo = function (file) { - if (file != null) { - if (file.size > 1 * 1024 * 1024) { - commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) - } else { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) - } - } - }; + commonDialog.alert({ + title: 'Config Master Merchant Failed', + content: resp.data.message, + type: 'error' + }); + }) + }) + }; - $scope.uploadShopPhoto = function (file) { - if (file != null) { - if (file.size > 2 * 1024 * 1024) { - commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) - } else { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) - } - } - }; + $scope.getMerchantLocation = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/location').then(function (resp) { + $scope.merchant_location = resp.data; + }); + }; + $scope.getMerchantLocation(); - $scope.uploadStorePhoto = function (file) { - if (file != null) { - if (file.size > 2 * 1024 * 1024) { - commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) - } else { - $scope.storePhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.storePhotoProgress; - $scope.partner.store_photo = resp.data.url; - }, function (resp) { - delete $scope.storePhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) - } + + $scope.complianceCheck = function () { + if (!$rootScope.complianceCheck) { + $rootScope.complianceCheck = {}; + } + $rootScope.complianceCheck.client_id = $scope.partner.client_id; + $rootScope.complianceCheck.clientInfo = true; + }; + $scope.complianceChangeCheck = function () { + if ($rootScope.complianceCheck) { + if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { + delete $rootScope.complianceCheck; } - }; + } + }; + $scope.complianceChangeCheck(); - $scope.getMerchantLocation = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/location').then(function (resp) { - $scope.merchant_location = resp.data; - }); - }; - $scope.getMerchantLocation(); + $scope.changeWechatCompliance = function () { + if (!$scope.partner) { + return; + } + if (!$state.is('partners.detail')) { + $scope.init.wechat_compliance = false; + return; + } + if (!$scope.init.wechat_compliance) { + $scope.init.wechat_compliance = true; + return; + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_compliance_permission', {allow: $scope.partner.wechat_compliance}).then(function () { - $scope.updateMerchantLocation = function () { - var params = window.frames['merchant_detail'].merchant_location; - if (params) { - $http.put('/sys/partners/modify/' + $scope.partner.client_moniker + '/location', params).then(function () { - }); - } + }, function (resp) { + commonDialog.alert({ + title: 'failed to change wechat_compliance permission status', + content: resp.data.message, + type: 'error' + }) + }) + }; + $scope.changeLocalMerchant = function () { + if (!$scope.partner) { + return; } - }]); + if (!$state.is('partners.detail')) { + $scope.init.local_merchant = false; + return; + } + if (!$scope.init.local_merchant) { + $scope.init.local_merchant = true; + return; + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/local_merchant_permission', {allow: $scope.partner.local_merchant}).then(function () { + + }, function (resp) { + commonDialog.alert({ + title: 'failed to change local_merchant permission status', + content: resp.data.message, + type: 'error' + }) + }) + }; + + $scope.removeSub = function () { + $http.delete('/sys/partners/unsub/' + $scope.partner.client_moniker).then(function (resp) { + $state.reload(); + }); + }; + $scope.addSub = function () { + $http.put('/sys/partners/unsub/' + $scope.partner.client_moniker).then(function (resp) { + $state.reload(); + }); + }; + }]); app.controller('partnerPaymentInfoCtrl', ['$scope', '$http', '$state', 'commonDialog', '$uibModal', '$sce', function ($scope, $http, $state, commonDialog, $uibModal, $sce) { $scope.convertExtParams = []; $scope.copyHfLink = function () { @@ -1777,7 +1196,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { $scope.extParams = {}; $scope.paymentInfo = resp.data; - $scope.extParams = $scope.paymentInfo?JSON.parse($scope.paymentInfo.ext_params):null; + $scope.extParams = $scope.paymentInfo.ext_params?JSON.parse($scope.paymentInfo.ext_params):null; $scope.convertExtParams = $scope.extParamsEditFlags() $scope.ctrl.editSubMerchant = false; $scope.ctrl.editAliSubMerchant = false; @@ -1966,10 +1385,8 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.refreshWechatInstitutionMerchantId = function () { $http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', {wechat_institution_merchant_id: $scope.paymentInfo.wechat_institution_merchant_id}).then(function (resp) { - debugger $scope.loadPartnerPaymentInfo(); }, function (resp) { - debugger commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) }); }; @@ -2385,29 +1802,48 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.init.enable_pre_refund = true; return; } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/pre_refund_permission', {allow: $scope.paymentInfo.enable_pre_refund}).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/pre_refund_permission', {allow: $scope.paymentInfo.enable_pre_refund}).then(function () { + $scope.loadPartnerPaymentInfo(); + }, function (resp) { + commonDialog.alert({ + title: 'failed to change Refund permission status', + content: resp.data.message, + type: 'error' + }) + }) + }; + $scope.toggleOffline = function () { + if (!$scope.paymentInfo) { + return; + } + if (!$scope.init.offline) { + $scope.init.offline = true; + return; + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/offline_permission', {allow: $scope.paymentInfo.enable_retail}).then(function () { $scope.loadPartnerPaymentInfo(); }, function (resp) { commonDialog.alert({ - title: 'failed to change Refund permission status', + title: 'failed to change Offline permission status', content: resp.data.message, type: 'error' }) }) }; - $scope.toggleOffline = function () { + + $scope.switchInternationalCard = function () { if (!$scope.paymentInfo) { return; } - if (!$scope.init.offline) { - $scope.init.offline = true; + if (!$scope.init.enable_International_card) { + $scope.init.enable_International_card = true; return; } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/offline_permission', {allow: $scope.paymentInfo.enable_retail}).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_card_permission', {allow: $scope.paymentInfo.enable_international_card}).then(function () { $scope.loadPartnerPaymentInfo(); }, function (resp) { commonDialog.alert({ - title: 'failed to change Offline permission status', + title: 'failed to change international card permission status', content: resp.data.message, type: 'error' }) @@ -2618,7 +2054,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }]); - app.controller('partnerRatesCtrl', ['$scope', '$rootScope', '$http', '$uibModal', 'commonDialog', '$sce', function ($scope, $rootScope, $http, $uibModal, commonDialog, $sce) { + app.controller('partnerRatesCtrl', ['$scope', '$rootScope', '$http', '$uibModal', 'commonDialog', '$sce','$state', function ($scope, $rootScope, $http, $uibModal, commonDialog, $sce,$state) { $scope.bankCtrl = {edit: true, rate_name: 'Wechat'}; $scope.init = { skip_clearing: false, @@ -3937,7 +3373,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }, function (resp) { $scope.ctrl.sending = false; $scope.errmsg = resp.data.message; - }) + }); } else { $http.post('/sys/partners/' + clientMoniker + '/rates', $scope.rate).then(function () { $scope.ctrl.sending = false; @@ -3945,7 +3381,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }, function (resp) { $scope.ctrl.sending = false; $scope.errmsg = resp.data.message; - }) + }); } } }]); @@ -4097,7 +3533,14 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.listRedpackLogs(1); }]); - app.controller('partnerAuthFileCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', 'Upload', 'file', function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) { + app.controller('partnerAuthFileCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', function ($scope, $http, $rootScope, commonDialog, $state) { + if ($scope.partner.client_type=='card-payment'){ + $state.go('partners.detail.files.MW_files'); + }else { + $state.go('partners.detail.files.CP_files'); + } + }]); + app.controller('partnerCPAuthFileCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', 'Upload', 'file', function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) { $scope.id_info_form = {edit: false}; $scope.file = file.data || {}; //audit files @@ -4349,7 +3792,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); }) }) -}; + }; $scope.updateFile = function () { @@ -4389,30 +3832,110 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.complianceChangeCheck(); }]); - app.controller('partnerMWAuthFileCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', 'Upload', 'file', function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) { $scope.id_info_form = {edit: false}; $scope.file = file.data || {}; + $scope.uploadFile = {}; $scope.file.upay_risk_level = $scope.partner.upay_risk_level; $scope.file.upay_risk_remark = $scope.partner.upay_risk_remark; - $scope.uploadApplyFile = function (file) { + + $scope.bankIsImage = true; + $scope.asicIsImage = true; + $scope.idIsImage = true; + $scope.utilityIsImage = true; + $scope.refundIsImage = true; + $scope.privacyIsImage = true; + $scope.cardIsImage = true; + $scope.letterIsImage = true; + $scope.promotionalIsImage = true; + $scope.termsIsImage = true; + $scope.applicationIsImage = true; + $scope.descIsImage = true; + if ($scope.file.client_bank_file && $scope.file.client_bank_file.endsWith('pdf')) { + $scope.bankIsImage = false; + } + if ($scope.file.client_company_file && $scope.file.client_company_file.endsWith('pdf')) { + $scope.asicIsImage = false; + } + if ($scope.file.upay_driver_license && $scope.file.upay_driver_license.endsWith('pdf')) { + $scope.idIsImage = false; + } + if ($scope.file.kyc_utility_bill_file && $scope.file.kyc_utility_bill_file.endsWith('pdf')) { + $scope.utilityIsImage = false; + } + if ($scope.file.refund_exchange_policy && $scope.file.refund_exchange_policy.endsWith('pdf')) { + $scope.refundIsImage = false; + } + if ($scope.file.upay_privacy_policy && $scope.file.upay_privacy_policy.endsWith('pdf')) { + $scope.privacyIsImage = false; + } + if ($scope.file.card_security_policy && $scope.file.card_security_policy.endsWith('pdf')) { + $scope.cardIsImage = false; + } + if ($scope.file.upay_offer_letter && $scope.file.upay_offer_letter.endsWith('pdf')) { + $scope.letterIsImage = false; + } + if ($scope.file.upay_promotional_offer && $scope.file.upay_promotional_offer.endsWith('pdf')) { + $scope.promotionalIsImage = false; + } + if ($scope.file.upay_terms_conditions && $scope.file.upay_terms_conditions.endsWith('pdf')) { + $scope.termsIsImage = false; + } + if ($scope.file.upay_application_form && $scope.file.upay_application_form.endsWith('pdf')) { + $scope.applicationIsImage = false; + } + if ($scope.file.upay_desc_file && $scope.file.upay_desc_file.endsWith('pdf')) { + $scope.descIsImage = false; + } + $scope.uploadApplicationFile = function (file) { if (file != null) { if (file.size > 3 * 1024 * 1024) { commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) } else { - $scope.bankFileProgress = {value: 0}; + $scope.applicationFileProgress = {value: 0}; Upload.upload({ url: '/attachment/files', data: {file: file} }).then(function (resp) { - delete $scope.bankFileProgress; + $scope.uploadFile = {}; + delete $scope.applicationFileProgress; $scope.file.upay_application_form = resp.data.url; + $scope.uploadFile.upay_application_form = resp.data.url; $scope.updateFile(); if ($scope.file.upay_application_form.endsWith('pdf')) { $scope.bankIsImage = false; } else { $scope.bankIsImage = true; } + }, function (resp) { + delete $scope.applicationFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.applicationFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadBankFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.bankFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.bankFileProgress; + $scope.file.client_bank_file = resp.data.url; + $scope.uploadFile.client_bank_file = resp.data.url; + $scope.updateFile(); + if ($scope.file.client_bank_file.endsWith('pdf')) { + $scope.bankIsImage = false; + } else { + $scope.bankIsImage = true; + } }, function (resp) { delete $scope.bankFileProgress; commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) @@ -4422,136 +3945,297 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } } }; - $scope.agreeIsImage = true; - if ($scope.file.file_agreement_info && $scope.file.file_agreement_info.endsWith('pdf')) { - $scope.agreeIsImage = false; - } - $scope.bankIsImage = true; - if ($scope.file.upay_application_form && $scope.file.upay_application_form.endsWith('pdf')) { - $scope.bankIsImage = false; - } - $scope.companyIsImage = true; - if ($scope.file.file_company_info && $scope.file.file_company_info.endsWith('pdf')) { - $scope.companyIsImage = false; - } - $scope.applyIsImage = true; - if ($scope.file.file_apply_info && $scope.file.file_apply_info.endsWith('pdf')) { - $scope.applyIsImage = false; - } - $scope.idIsImage = true; - if ($scope.file.file_id_info && $scope.file.file_id_info.endsWith('pdf')) { - $scope.idIsImage = false; - } - - $scope.uploadAgreementFile = function (file) { + $scope.uploadASICFile = function (file) { if (file != null) { if (file.size > 3 * 1024 * 1024) { commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) } else { - $scope.companyFileProgress = {value: 0}; + $scope.ASICProgress = {value: 0}; Upload.upload({ url: '/attachment/files', data: {file: file} }).then(function (resp) { - delete $scope.companyFileProgress; - $scope.file.upay_agreement_file = resp.data.url; + $scope.uploadFile = {}; + delete $scope.ASICProgress; + $scope.file.client_company_file = resp.data.url; + $scope.uploadFile.client_company_file = resp.data.url; $scope.updateFile(); - if ($scope.file.upay_agreement_file.endsWith('pdf')) { - $scope.companyIsImage = false; + if ($scope.file.client_company_file.endsWith('pdf')) { + $scope.bankIsImage = false; } else { - $scope.companyIsImage = true; + $scope.bankIsImage = true; } }, function (resp) { - delete $scope.companyFileProgress; + delete $scope.ASICProgress; commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) }, function (evt) { - $scope.companyFileProgress.value = parseInt(100 * evt.loaded / evt.total); + $scope.ASICProgress.value = parseInt(100 * evt.loaded / evt.total); }) } } }; - $scope.uploadOfferFile = function (file) { + $scope.uploadIdFile = function (file) { if (file != null) { if (file.size > 3 * 1024 * 1024) { commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) } else { - $scope.idFileProgress = {value: 0}; + $scope.idProgress = {value: 0}; Upload.upload({ url: '/attachment/files', data: {file: file} }).then(function (resp) { - delete $scope.idFileProgress; - $scope.file.upay_offer_letter = resp.data.url; + $scope.uploadFile = {}; + delete $scope.idProgress; + $scope.file.upay_driver_license = resp.data.url; + $scope.uploadFile.upay_driver_license = resp.data.url; $scope.updateFile(); - if ($scope.file.upay_offer_letter.endsWith('pdf')) { + if ($scope.file.upay_driver_license.endsWith('pdf')) { $scope.idIsImage = false; } else { $scope.idIsImage = true; } }, function (resp) { - delete $scope.idFileProgress; + delete $scope.idProgress; commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) }, function (evt) { - $scope.idFileProgress.value = parseInt(100 * evt.loaded / evt.total); + $scope.idProgress.value = parseInt(100 * evt.loaded / evt.total); }) } } }; - $scope.uploadDriverFile = function (file) { + $scope.uploadResidenceFile = function (file) { if (file != null) { - if (file.size > 10 * 1024 * 1024) { - commonDialog.alert({title: 'Error', content: '文件大小不能超过10MB,请压缩后重试', type: 'error'}) + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) } else { - $scope.agreementFileProgress = {value: 0}; + $scope.residenceFileProgress = {value: 0}; Upload.upload({ url: '/attachment/files', data: {file: file} }).then(function (resp) { - delete $scope.agreementFileProgress; - $scope.file.upay_driver_license = resp.data.url; + $scope.uploadFile = {}; + delete $scope.residenceFileProgress; + $scope.file.kyc_utility_bill_file = resp.data.url; + $scope.uploadFile.kyc_utility_bill_file = resp.data.url; $scope.updateFile(); - if ($scope.file.upay_driver_license.endsWith('pdf')) { - $scope.agreeIsImage = false; + if ($scope.file.kyc_utility_bill_file.endsWith('pdf')) { + $scope.utilityIsImage = false; } else { - $scope.agreeIsImage = true; + $scope.utilityIsImage = true; } }, function (resp) { - delete $scope.agreementFileProgress; + delete $scope.residenceFileProgress; commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) }, function (evt) { - $scope.agreementFileProgress.value = parseInt(100 * evt.loaded / evt.total); + $scope.residenceFileProgress.value = parseInt(100 * evt.loaded / evt.total); }) } } }; - $scope.uploadResidenceFile = function (file) { + $scope.uploadRefundPolicyFile = function (file) { if (file != null) { if (file.size > 3 * 1024 * 1024) { commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) } else { - $scope.applyFileProgress = {value: 0}; + $scope.refundPolicyFileProgress = {value: 0}; Upload.upload({ url: '/attachment/files', data: {file: file} }).then(function (resp) { - delete $scope.applyFileProgress; - $scope.file.upay_residence_certificate = resp.data.url; + $scope.uploadFile = {}; + delete $scope.refundPolicyFileProgress; + $scope.file.refund_exchange_policy = resp.data.url; + $scope.uploadFile.refund_exchange_policy = resp.data.url; $scope.updateFile(); - if ($scope.file.upay_residence_certificate.endsWith('pdf')) { - $scope.applyIsImage = false; + if ($scope.file.refund_exchange_policy.endsWith('pdf')) { + $scope.utilityIsImage = false; } else { - $scope.applyIsImage = true; + $scope.utilityIsImage = true; } }, function (resp) { - delete $scope.applyFileProgress; + delete $scope.refundPolicyFileProgress; commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) }, function (evt) { - $scope.applyFileProgress.value = parseInt(100 * evt.loaded / evt.total); + $scope.refundPolicyFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadPrivacyPolicyFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.privacyFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.privacyFileProgress; + $scope.file.upay_privacy_policy = resp.data.url; + $scope.uploadFile.upay_privacy_policy = resp.data.url; + $scope.updateFile(); + if ($scope.file.upay_privacy_policy.endsWith('pdf')) { + $scope.privacyIsImage = false; + } else { + $scope.privacyIsImage = true; + } + }, function (resp) { + delete $scope.privacyFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.privacyFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadCardPolicyFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.cardFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.cardFileProgress; + $scope.file.card_security_policy = resp.data.url; + $scope.uploadFile.card_security_policy = resp.data.url; + $scope.updateFile(); + if ($scope.file.card_security_policy.endsWith('pdf')) { + $scope.privacyIsImage = false; + } else { + $scope.privacyIsImage = true; + } + }, function (resp) { + delete $scope.cardFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.cardFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadLetterOfOfferFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.letterFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.letterFileProgress; + $scope.file.upay_offer_letter = resp.data.url; + $scope.uploadFile.upay_offer_letter = resp.data.url; + $scope.updateFile(); + if ($scope.file.upay_offer_letter.endsWith('pdf')) { + $scope.letterIsImage = false; + } else { + $scope.letterIsImage = true; + } + }, function (resp) { + delete $scope.letterFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.letterFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadPromotionalFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.promotionalFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.promotionalFileProgress; + $scope.file.upay_promotional_offer = resp.data.url; + $scope.uploadFile.upay_promotional_offer = resp.data.url; + $scope.updateFile(); + if ($scope.file.upay_promotional_offer.endsWith('pdf')) { + $scope.promotionalIsImage = false; + } else { + $scope.promotionalIsImage = true; + } + }, function (resp) { + delete $scope.promotionalFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.promotionalFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadTermsFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.termsFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.termsFileProgress; + $scope.file.upay_terms_conditions = resp.data.url; + $scope.uploadFile.upay_terms_conditions = resp.data.url; + $scope.updateFile(); + if ($scope.file.upay_terms_conditions.endsWith('pdf')) { + $scope.termsIsImage = false; + } else { + $scope.termsIsImage = true; + } + }, function (resp) { + delete $scope.termsFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.termsFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadDescFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.descFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.descFileProgress; + $scope.file.upay_desc_file = resp.data.url; + $scope.uploadFile.upay_desc_file = resp.data.url; + $scope.updateFile(); + if ($scope.file.upay_desc_file.endsWith('pdf')) { + $scope.descIsImage = false; + } else { + $scope.descIsImage = true; + } + }, function (resp) { + delete $scope.descFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.descFileProgress.value = parseInt(100 * evt.loaded / evt.total); }) - } } }; + $scope.saveIdInfo = function () { if (!$scope.file.upay_risk_level) { commonDialog.alert({title: 'Error', content: '请选择商户风险等级', type: 'error'}); @@ -4579,34 +4263,14 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter return url; }; - - $scope.deleteComplianceFiles = function (file_id) { - commonDialog.confirm({ - title: 'Warning', - content: 'This operation will delete the file, Are you sure?' - }).then(function () { - $http.put('/sys/partners/auth_file/' + file_id + '/delete').then(function (resp) { - commonDialog.alert({ - title: 'Success', - content: 'Delete Successful', - type: 'success' - }); - $state.reload(); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - }) - }; - - $scope.updateFile = function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/mw_file', $scope.file).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/mw_file', $scope.uploadFile).then(function () { commonDialog.alert({ title: 'Success', content: 'Upload Successful', type: 'success' }); - $state.reload(); + $state.go('partners.detail.files.MW_files', {reload: true}); }, function (resp) { commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); }) diff --git a/src/main/ui/static/payment/partner/templates/add_partner.html b/src/main/ui/static/payment/partner/templates/add_partner.html index 1bec9f8b7..cd24bc7f2 100644 --- a/src/main/ui/static/payment/partner/templates/add_partner.html +++ b/src/main/ui/static/payment/partner/templates/add_partner.html @@ -16,6 +16,17 @@ background-color: #f7bf90; border-color: #adadad; } + .form-control-float { + float: left; + width: 93%; !important; + } + .form-control-span{ + height: 34px; + } + .check-box { + zoom: 130%; + margin-right: 5px; + }

    New Partner

    @@ -26,11 +37,22 @@
  • New Partner
  • -
    +
    Partner Basic Information
    @@ -112,21 +134,40 @@
    -
    -
    + +
    + +
    +

    Required + Field

    +

    Less + Than 19 + Characters(including symbols and spaces)

    +
    +
    +
    +
    @@ -148,7 +189,7 @@
    -
    @@ -176,31 +217,19 @@
    - - - - - - - - - - - - - -
    - + ng-if="partner.business_structure != 'Company' || partner.enable_card_payment"> +
    +

    Required + Field

    Less Than 20 Characters(including symbols and spaces)

    @@ -209,7 +238,7 @@
    + ng-if="partner.business_structure == 'Company' && partner.enable_cross_payment">
    - - - - - - - - - - - - - - - - -
    -
    +
    @@ -296,7 +299,6 @@ Than 11 Characters

    -
    @@ -353,7 +355,7 @@ ng-click="toggleClientPayType('1')"> 线上 -
    -
    +
    @@ -420,7 +422,7 @@
    -
    +
    @@ -491,7 +493,7 @@
    -
    +
    1:  @@ -503,9 +505,9 @@ - +
    @@ -518,16 +520,48 @@ - +
    +
    + +
    + + $ +
    +

    Required + Field

    +
    +
    +
    +
    + +
    + + $ +
    +

    Required + Field

    +
    +
    +
    -
    +
    Alipay Information  (Optional)
    @@ -687,7 +721,6 @@ Characters(including symbols and spaces)

    -
    @@ -697,16 +730,26 @@ maxlength="50">
    + +
    + +
    + +
    +
    -
    - -
    + +
    +
    -
    -

    + +
      Legal Representative
    @@ -781,7 +824,7 @@
    + E-mail
    -
    -
      Marketing Person
    -
    +
    +
      Marketing Person
    +
    @@ -1185,105 +1228,6 @@
    - - -
    Industry @@ -1308,7 +1252,7 @@
    -
    @@ -1327,7 +1271,7 @@
    -
    @@ -1346,6 +1290,44 @@
    + +
    + +
    + +
    +

    Required + Field

    +
    +
    +
    +
    + +
    + + + + + + +
    +
    diff --git a/src/main/ui/static/payment/partner/templates/client_partner_detail.html b/src/main/ui/static/payment/partner/templates/client_partner_detail.html index 2a1f185f7..e13c7127f 100644 --- a/src/main/ui/static/payment/partner/templates/client_partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/client_partner_detail.html @@ -390,9 +390,17 @@ + +
    + +
    +

    + +

    +
    +
    -

    diff --git a/src/main/ui/static/payment/partner/templates/client_partner_edit.html b/src/main/ui/static/payment/partner/templates/client_partner_edit.html index 7cb3edb4f..40b9b1cbf 100644 --- a/src/main/ui/static/payment/partner/templates/client_partner_edit.html +++ b/src/main/ui/static/payment/partner/templates/client_partner_edit.html @@ -392,6 +392,15 @@ Characters(including symbols and spaces)

    + +
    + +
    + +
    +
    - -
    + +
    + +
    +

    Required + Field

    +

    Less + Than 19 + Characters(including symbols and spaces)

    +
    +
    +
    +
    @@ -206,20 +249,6 @@
    - - - - - - - - - - - - - -
    @@ -319,7 +348,7 @@ ng-click="toggleClientPayType('1')"> 线上 -
    -
    +
    @@ -386,7 +415,7 @@
    -
    +
    @@ -457,7 +486,7 @@
    -
    +
    1:  @@ -488,11 +517,43 @@
    +
    + +
    + + $ +
    +

    Required + Field

    +
    +
    +
    +
    + +
    + + $ +
    +

    Required + Field

    +
    +
    +
    -
    +
    Alipay Information   (Optional)
    @@ -578,7 +639,6 @@ Characters(including symbols and spaces)

    -
    +
    @@ -604,10 +665,20 @@ maxlength="50">
    + +
    + +
    + +
    +
    -
    +
    @@ -719,8 +790,8 @@ -
      Marketing Person
    -
    +
      Marketing Person
    +
    @@ -1070,81 +1141,6 @@
    - -
    Industry
    @@ -1168,7 +1164,7 @@
    -
    @@ -1187,7 +1183,7 @@
    -
    @@ -1206,6 +1202,42 @@
    +
    + +
    + +
    +

    Required + Field

    +
    +
    +
    +
    + +
    + + + + + + +
    diff --git a/src/main/ui/static/payment/partner/templates/partner_mw_auth_files.html b/src/main/ui/static/payment/partner/templates/partner_mw_auth_files.html index 079916613..37833aa4b 100644 --- a/src/main/ui/static/payment/partner/templates/partner_mw_auth_files.html +++ b/src/main/ui/static/payment/partner/templates/partner_mw_auth_files.html @@ -3,192 +3,274 @@ width: 100%; } -
    -
    Audit Files     - - 一键下载 - -
    -
    -
    -
    -

    - Merchant Warrior商户风险评级 - - -

    -
    -
    -
    - -
    -
    - -
    +
    Audit Files     + + 一键下载 + +
    +
    +
    +
    +

    + Merchant Warrior商户风险评级 + + +

    +
    +
    +
    + +
    +
    +
    -
    - -
    -
    - -
    +
    +
    + +
    +
    +
    -
    - -
    -
    - 低风险 - 中风险 - 高风险 -
    +
    +
    + +
    +
    + 低风险 + 中风险 + 高风险
    -
    - -
    -
    - -
    +
    +
    + +
    +
    +
    - + +
    +
    + +
    +
    + + +
    + + + +
    -
    - -
    -
    - - - -
    - - - - - - - -
    - - -
    +
    +
    + +
    +
    + + +
    + + + +
    - -
    - -
    -
    - - - -
    - - - - - - -
    - - -
    +
    +
    + +
    +
    + + +
    + + + +
    - -
    - -
    -
    - - - -
    - - - - - -
    - - -
    +
    +
    + +
    +
    + + +
    + + + +
    - -
    -
    - -
    -
    - - - -
    - - - - - - -
    - - -
    -
    +
    +
    + +
    +
    + + +
    + + + +
    - -
    -
    - -
    -
    - - - -
    - - - - - - -
    - - -
    -
    +
    +
    + +
    +
    + + +
    + + + + +
    +
    +
    + +
    +
    + + + +
    + + + + +
    +
    +
    + +
    +
    + + + +
    + + + + +
    +
    +
    + +
    +
    + + + +
    + + + + +
    +
    +
    + +
    +
    + + + +
    + + + + +
    +
    +
    + +
    +
    + + + +
    + + + + +
    +
    +
    + +
    +
    + + + +
    + + + +
    -
    +
    +
    + check +
    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 80df579ba..05445da42 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 @@ -205,36 +205,12 @@
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    @@ -489,6 +465,23 @@
    + +
    +
    Card Payment Config
    +
    +
    + +
    + +
    + +
    +
    +
    +
    +
    +
    Retail In Store Payment(App, WePayLite, Albert)
    diff --git a/src/main/ui/static/payment/partner/templates/partner_settlement.html b/src/main/ui/static/payment/partner/templates/partner_settlement.html index 32df9ee0a..a455f5aa6 100644 --- a/src/main/ui/static/payment/partner/templates/partner_settlement.html +++ b/src/main/ui/static/payment/partner/templates/partner_settlement.html @@ -220,6 +220,7 @@ Settle Time + Settle Version Transaction Amount to Merchant Service Fee @@ -229,11 +230,15 @@ - {{log.report_date}} + {{log.report_date|limitTo:10}}   + + Card Payment + Cross-border Payment + diff --git a/src/main/ui/static/payment/partner/templates/partners.html b/src/main/ui/static/payment/partner/templates/partners.html index 34b0bfea2..5d2879422 100644 --- a/src/main/ui/static/payment/partner/templates/partners.html +++ b/src/main/ui/static/payment/partner/templates/partners.html @@ -370,6 +370,16 @@ + + + + @@ -476,19 +486,40 @@ - - 通过({{partner.approve_time}}) - 资料完善中 - (自助开通)资料完善中 - 自助开通试用中({{partner.approve_time}}~{{partner.expiry_time}}) - 不通过({{partner.approve_time}}) - 申请打回({{partner.refuse_remark|limitTo:15}}) - 等待合规 - 自助开通(等待合规) - 合同制作完成 - 等待BD上传材料审核 - 绿色通道申请中 - 等待合规 + +
    + + 通过({{partner.approve_time}}) + 资料完善中 + (自助开通)资料完善中 + 自助开通试用中({{partner.approve_time}}~{{partner.expiry_time}}) + 不通过({{partner.approve_time}}) + 申请打回({{partner.refuse_remark|limitTo:15}}) + 等待合规 + 自助开通(等待合规) + 合同制作完成 + 等待BD上传材料审核 + 绿色通道申请中 + 等待合规 +
    + +
    +
    + 资料完善中 +
    +
    + + 通过({{partner.upay_approve_time}}) + 资料完善中 + (自助开通)资料完善中 + 不通过({{partner.upay_approve_time}}) + 申请打回({{partner.upay_refuse_remark|limitTo:15}}) + 等待合规 + 合同制作完成 + 等待BD上传材料审核 + 等待合规 +
    +
    diff --git a/src/main/ui/static/payment/tradelog/partner-settlement-log.js b/src/main/ui/static/payment/tradelog/partner-settlement-log.js index 0a0705f81..fd4179fe1 100644 --- a/src/main/ui/static/payment/tradelog/partner-settlement-log.js +++ b/src/main/ui/static/payment/tradelog/partner-settlement-log.js @@ -222,6 +222,9 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { $scope.getClearingTransactions = function (client_id, detailId) { clearingDetailService.clientClearingDetail(client_id, detailId, true) } + $scope.getClearingTransactionsOfUpaySettle = function (client_id, detailId) { + clearingDetailService.clientClearingDetailOfUpaySettle(client_id, detailId, true) + } $scope.getClearingTransactionsOfMergeSettle = function (client_id, reportDate) { clearingDetailService.clientClearingDetailOfMergeSettle(client_id, reportDate) } diff --git a/src/main/ui/static/payment/tradelog/templates/balance_report.html b/src/main/ui/static/payment/tradelog/templates/balance_report.html index aa142c3cd..896b3fc43 100644 --- a/src/main/ui/static/payment/tradelog/templates/balance_report.html +++ b/src/main/ui/static/payment/tradelog/templates/balance_report.html @@ -389,7 +389,8 @@
    diff --git a/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html b/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html index 2c18f8311..906f5cd97 100644 --- a/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html +++ b/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html @@ -271,6 +271,7 @@ Date + Settle Version Transaction Amount(AUD) Transfer to Merchant(AUD) GST(AUD) @@ -285,6 +286,10 @@ {{log.clearing_time|limitTo:10}}   + + Card Payment + Cross-border Payment + @@ -304,6 +309,19 @@ + + + + + + + + + + + + + +

    Transactions{{report.client_moniker?'('+report.client_moniker+')':''}}

    +
    + diff --git a/src/main/ui/static/payment/tradelog/transflow.js b/src/main/ui/static/payment/tradelog/transflow.js index f58a24060..db1d86ed4 100644 --- a/src/main/ui/static/payment/tradelog/transflow.js +++ b/src/main/ui/static/payment/tradelog/transflow.js @@ -219,6 +219,9 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { if (type=='pdf'){ url = '/client/trans_flow/report/pdf'; } + if (type=='upay-pdf'){ + url = '/client/trans_flow/report/upay_pdf'; + } if (type=='excel'){ url='/client/trans_flow/report/excel'; }