From 8890cab76f29749517c7cd055bb17fdc5986f970 Mon Sep 17 00:00:00 2001 From: dalong306 <304592994@qq.com> Date: Tue, 7 Sep 2021 19:55:58 +0800 Subject: [PATCH 01/50] test --- .../au/com/royalpay/payment/manage/dev/web/TestController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java index 27d1a9919..db7ca8c13 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java @@ -220,7 +220,7 @@ public class TestController { client.put("located_country", "Australia"); if("1".equalsIgnoreCase(weChatRate.getString("clean_days"))){ // clean_1 clean_1_friday clean_1_saturday - // second, third or fourth + // first, second, third or fourth client.put("clean_1", weChatRate.getString("clean_days")); client.put("clean_1_friday", "first"); client.put("clean_1_saturday", "second"); From 7b0f130ffe2bef37ca1f69df28c8923e165d0e94 Mon Sep 17 00:00:00 2001 From: Todking Date: Mon, 13 Sep 2021 13:53:19 +0800 Subject: [PATCH 02/50] =?UTF-8?q?add=20=E6=96=B0=E5=A2=9Eaps=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8CalipayCN=E6=B8=A0=E9=81=93=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../mappers/system/aps/ApsConfigMapper.java | 20 + .../merchants/core/ApsConfigService.java | 13 + .../core/descriptor/ApsConfigDescriptor.java | 17 + .../core/impls/ApsConfigServiceImpl.java | 38 + .../core/impls/ClientManagerImpl.java | 153 +- .../merchants/entity/ApsConfigData.java | 46 + .../merchants/web/ApsConfigController.java | 55 + .../mappers/system/aps/ApsConfigMapper.xml | 23 + .../static/payment/partner/partner-manage.js | 16485 ++++++++-------- .../templates/partner_payment_info.html | 150 +- 11 files changed, 8681 insertions(+), 8321 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/mappers/system/aps/ApsConfigMapper.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/merchants/core/ApsConfigService.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/merchants/core/descriptor/ApsConfigDescriptor.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ApsConfigServiceImpl.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/merchants/entity/ApsConfigData.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/merchants/web/ApsConfigController.java create mode 100644 src/main/resources/au/com/royalpay/payment/manage/mappers/system/aps/ApsConfigMapper.xml diff --git a/pom.xml b/pom.xml index 2934cc261..d66c495f6 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ au.com.royalpay.payment payment-parent - 2.2.31 + 2.3.0 4.0.0 manage diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/aps/ApsConfigMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/aps/ApsConfigMapper.java new file mode 100644 index 000000000..e819edb63 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/aps/ApsConfigMapper.java @@ -0,0 +1,20 @@ +package au.com.royalpay.payment.manage.mappers.system.aps; + +import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData; +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_aps_config", pkName = "id") +public interface ApsConfigMapper { + + @AutoSql(SqlType.SELECT) + ApsConfigData findByClientId(@Param("client_id") String clientId); + + @AutoSql(SqlType.INSERT) + void saveApsConfigClientId(ApsConfigData apsConfigData); + + void updateApsConfigClientId(JSONObject apsConfigData); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ApsConfigService.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ApsConfigService.java new file mode 100644 index 000000000..6fa193b6d --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ApsConfigService.java @@ -0,0 +1,13 @@ +package au.com.royalpay.payment.manage.merchants.core; + +import au.com.royalpay.payment.manage.merchants.core.descriptor.ApsConfigDescriptor; +import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData; +import com.alibaba.fastjson.JSONObject; + +public interface ApsConfigService { + ApsConfigData getApsConfigByClientId(String clientId); + + ApsConfigData saveApsConfigClientId(String managerId, String clientId, ApsConfigDescriptor apsConfigDescriptor); + + ApsConfigData updateApsConfigClientId(String managerId,String clientId, JSONObject apsConfig); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/descriptor/ApsConfigDescriptor.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/descriptor/ApsConfigDescriptor.java new file mode 100644 index 000000000..9274fc04c --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/descriptor/ApsConfigDescriptor.java @@ -0,0 +1,17 @@ +package au.com.royalpay.payment.manage.merchants.core.descriptor; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = true) +public class ApsConfigDescriptor { + + private Boolean enableAlipayAps = false; + + private Boolean alipayCnSwitch = false; +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ApsConfigServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ApsConfigServiceImpl.java new file mode 100644 index 000000000..6444876b4 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ApsConfigServiceImpl.java @@ -0,0 +1,38 @@ +package au.com.royalpay.payment.manage.merchants.core.impls; + +import au.com.royalpay.payment.manage.mappers.system.aps.ApsConfigMapper; +import au.com.royalpay.payment.manage.merchants.core.ApsConfigService; +import au.com.royalpay.payment.manage.merchants.core.descriptor.ApsConfigDescriptor; +import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData; +import com.alibaba.fastjson.JSONObject; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + + +@Service +public class ApsConfigServiceImpl implements ApsConfigService { + + @Resource + private ApsConfigMapper apsConfigMapper; + + @Override + public ApsConfigData getApsConfigByClientId(String clientId) { + return apsConfigMapper.findByClientId(clientId); + } + + @Override + public ApsConfigData saveApsConfigClientId(String managerId, String clientId, ApsConfigDescriptor apsConfigDescriptor) { + ApsConfigData apsConfigData = ApsConfigData.saveData(managerId, clientId, apsConfigDescriptor); + apsConfigMapper.saveApsConfigClientId(apsConfigData); + return apsConfigMapper.findByClientId(clientId); + } + + @Override + public ApsConfigData updateApsConfigClientId(String managerId, String clientId, JSONObject apsConfig) { + apsConfig.put("clientId", clientId); + apsConfig.put("modifier", managerId); + apsConfigMapper.updateApsConfigClientId(apsConfig); + return apsConfigMapper.findByClientId(clientId); + } +} 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 209f609dc..7e016ae24 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 @@ -55,13 +55,12 @@ import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMap import au.com.royalpay.payment.manage.mappers.risk.RiskAttentionMerchantsMapper; import au.com.royalpay.payment.manage.mappers.system.*; import au.com.royalpay.payment.manage.merchants.beans.*; -import au.com.royalpay.payment.manage.merchants.core.ClientConfigService; -import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport; -import au.com.royalpay.payment.manage.merchants.core.ClientManager; -import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport; +import au.com.royalpay.payment.manage.merchants.core.*; import au.com.royalpay.payment.manage.merchants.core.bank.AustraliaBank; import au.com.royalpay.payment.manage.merchants.core.bank.AustraliaBankClientNullException; import au.com.royalpay.payment.manage.merchants.core.bank.AustraliaBankInfo; +import au.com.royalpay.payment.manage.merchants.core.descriptor.ApsConfigDescriptor; +import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData; import au.com.royalpay.payment.manage.merchants.entity.impls.*; import au.com.royalpay.payment.manage.merchants.enums.UPayAuthFileEnum; import au.com.royalpay.payment.manage.notice.core.MailService; @@ -329,6 +328,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private PaymentApi paymentApi; @Resource private MerchantChannelPermissionManager merchantChannelPermissionManager; + @Resource + private ApsConfigService apsConfigService; DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMM yyyy"); @@ -356,7 +357,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private String agreetemplatePdfPath; @Value("${app.agreetemplate.aggregate.path}") private String aggregateAgreetemplatePdfPath; -// private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2020/04/08/1586313342533_41vI3w9R8OHrhAVYWvdv7S2IyQra4z.pdf"; + // private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2020/04/08/1586313342533_41vI3w9R8OHrhAVYWvdv7S2IyQra4z.pdf"; private final String IMG_AGGREGATE_FILE = "https://file.royalpay.com.au/open/2021/09/07/1630997571126_fqWcLQ5Rx0wFm8pVwpKuI1gjf6FmwX.pdf"; @@ -554,7 +555,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid resolver.newOrderEnabled(client, null, PlatformEnvironment.getEnv().getForeignCurrency())) { client.put("enable_alipayplus", true); } - + ApsConfigData apsConfig = apsConfigService.getApsConfigByClientId(client.getString("client_id")); + if (apsConfig == null) { + apsConfig = apsConfigService.saveApsConfigClientId(manager.getString("manager_id"), client.getString("client_id"), new ApsConfigDescriptor()); + } + client.put("aps_config_id", apsConfig.getId()); + client.put("enable_alipayaps", apsConfig.getEnableAlipayAps()); + client.put("alipay_cn_switch", apsConfig.getAlipayCnSwitch()); return client; } @@ -1583,11 +1590,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new NotFoundException("Client Not Exists"); } - merchantChannelPermissionManager.switchMerchantChannelPermission(channelApi.getMetadata().payChannel(), client.getIntValue("client_id"), allow); - try { - clientModifySupport.processModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow)); - } catch (Exception e) { - logger.error("Failed to change channel switch:{}", channel); + if (channelApi.channel().equalsIgnoreCase("alipayaps")) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("enableAlipayAps", allow); + apsConfigService.updateApsConfigClientId(manager.getString("manager_id"), client.getString("client_id"), jsonObject); + } else { + merchantChannelPermissionManager.switchMerchantChannelPermission(channelApi.getMetadata().payChannel(), client.getIntValue("client_id"), allow); + try { + clientModifySupport.processModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow)); + } catch (Exception e) { + logger.error("Failed to change channel switch:{}", channel); + } } logger.info("{}({}) switched client {} channel {} to {}", manager.getString("display_name"), manager.getString("manager_id"), clientMoniker, channel, allow); if (allow && (StringUtils.equalsAnyIgnoreCase("Wechat", channel) || StringUtils.equalsAnyIgnoreCase("Alipay", channel))) { @@ -2050,12 +2063,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } else { List existRate = clientRateMapper.listCurrentClientRates(clientId, config.getDate("active_time"), channel); existRate.stream().filter(existConfig -> { - if (existConfig.getDate("active_time").equals(config.getDate("active_time")) && existConfig.getDate("expiry_time").equals(config.getDate("expiry_time"))) { - return false; - } - return true; - } - ) + if (existConfig.getDate("active_time").equals(config.getDate("active_time")) && existConfig.getDate("expiry_time").equals(config.getDate("expiry_time"))) { + return false; + } + return true; + } + ) .forEach((rateLog) -> { rateLog.put("expiry_time", DateUtils.addDays(config.getDate("active_time"), -1)); clientRateMapper.updateConfig(rateLog); @@ -2980,24 +2993,24 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new BadRequestException("The Partner's Rate is not config!"); } client.put("wechat_rate", weChatRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN)); - client.put("clean", "T+"+weChatRate.getString("clean_days")); + client.put("clean", "T+" + weChatRate.getString("clean_days")); client.put("clean_days", weChatRate.getString("clean_days")); client.put("located_country", "Australia"); - if("1".equalsIgnoreCase(weChatRate.getString("clean_days"))){ + if ("1".equalsIgnoreCase(weChatRate.getString("clean_days"))) { // clean_1 clean_1_friday clean_1_saturday // second, third or fourth - client.put("clean_1", weChatRate.getString("clean_days")); - client.put("clean_1_friday", "first"); - client.put("clean_1_saturday", "second"); - }else if("2".equalsIgnoreCase(weChatRate.getString("clean_days"))){ - client.put("clean_1", weChatRate.getString("clean_days")); - client.put("clean_1_friday", "second"); - client.put("clean_1_saturday", "third"); - - }else if("3".equalsIgnoreCase(weChatRate.getString("clean_days"))){ - client.put("clean_1", weChatRate.getString("clean_days")); - client.put("clean_1_friday", "third"); - client.put("clean_1_saturday", "fourth"); + client.put("clean_1", weChatRate.getString("clean_days")); + client.put("clean_1_friday", "first"); + client.put("clean_1_saturday", "second"); + } else if ("2".equalsIgnoreCase(weChatRate.getString("clean_days"))) { + client.put("clean_1", weChatRate.getString("clean_days")); + client.put("clean_1_friday", "second"); + client.put("clean_1_saturday", "third"); + + } else if ("3".equalsIgnoreCase(weChatRate.getString("clean_days"))) { + client.put("clean_1", weChatRate.getString("clean_days")); + client.put("clean_1_friday", "third"); + client.put("clean_1_saturday", "fourth"); } try { JSONObject alipayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Alipay"); @@ -3116,19 +3129,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("wechat_rate", p.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN)); client.put("clean", "T+" + p.getString("clean_days")); client.put("clean_days", p.getString("clean_days")); - if("1".equalsIgnoreCase(p.getString("clean_days"))){ - client.put("clean_1", p.getString("clean_days")); - client.put("clean_1_friday", "first"); - client.put("clean_1_saturday", "second"); - }else if("2".equalsIgnoreCase(p.getString("clean_days"))){ - client.put("clean_1", p.getString("clean_days")); - client.put("clean_1_friday", "second"); - client.put("clean_1_saturday", "third"); - - }else if("3".equalsIgnoreCase(p.getString("clean_days"))){ - client.put("clean_1", p.getString("clean_days")); - client.put("clean_1_friday", "third"); - client.put("clean_1_saturday", "fourth"); + if ("1".equalsIgnoreCase(p.getString("clean_days"))) { + client.put("clean_1", p.getString("clean_days")); + client.put("clean_1_friday", "first"); + client.put("clean_1_saturday", "second"); + } else if ("2".equalsIgnoreCase(p.getString("clean_days"))) { + client.put("clean_1", p.getString("clean_days")); + client.put("clean_1_friday", "second"); + client.put("clean_1_saturday", "third"); + + } else if ("3".equalsIgnoreCase(p.getString("clean_days"))) { + client.put("clean_1", p.getString("clean_days")); + client.put("clean_1_friday", "third"); + client.put("clean_1_saturday", "fourth"); } } else if ("Alipay".equals(rate_name)) { client.put("alipay_rate", p.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN)); @@ -3205,21 +3218,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("clean", "T+" + weChatRate.getString("clean_days")); client.put("clean_days", weChatRate.getString("clean_days")); client.put("located_country", "Australia"); - if("1".equalsIgnoreCase(weChatRate.getString("clean_days"))){ + if ("1".equalsIgnoreCase(weChatRate.getString("clean_days"))) { // clean_1 clean_1_friday clean_1_saturday // second, third or fourth - client.put("clean_1", weChatRate.getString("clean_days")); - client.put("clean_1_friday", "first"); - client.put("clean_1_saturday", "second"); - }else if("2".equalsIgnoreCase(weChatRate.getString("clean_days"))){ - client.put("clean_1", weChatRate.getString("clean_days")); - client.put("clean_1_friday", "second"); - client.put("clean_1_saturday", "third"); + client.put("clean_1", weChatRate.getString("clean_days")); + client.put("clean_1_friday", "first"); + client.put("clean_1_saturday", "second"); + } else if ("2".equalsIgnoreCase(weChatRate.getString("clean_days"))) { + client.put("clean_1", weChatRate.getString("clean_days")); + client.put("clean_1_friday", "second"); + client.put("clean_1_saturday", "third"); - }else if("3".equalsIgnoreCase(weChatRate.getString("clean_days"))){ - client.put("clean_1", weChatRate.getString("clean_days")); - client.put("clean_1_friday", "third"); - client.put("clean_1_saturday", "fourth"); + } else if ("3".equalsIgnoreCase(weChatRate.getString("clean_days"))) { + client.put("clean_1", weChatRate.getString("clean_days")); + client.put("clean_1_friday", "third"); + client.put("clean_1_saturday", "fourth"); } try { @@ -4106,21 +4119,21 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("clean", "T+" + weChatRate.getString("clean_days")); client.put("clean_days", weChatRate.getString("clean_days")); client.put("located_country", "Australia"); - if("1".equalsIgnoreCase(weChatRate.getString("clean_days"))){ + if ("1".equalsIgnoreCase(weChatRate.getString("clean_days"))) { // clean_1 clean_1_friday clean_1_saturday // second, third or fourth - client.put("clean_1", weChatRate.getString("clean_days")); - client.put("clean_1_friday", "first"); - client.put("clean_1_saturday", "second"); - }else if("2".equalsIgnoreCase(weChatRate.getString("clean_days"))){ - client.put("clean_1", weChatRate.getString("clean_days")); - client.put("clean_1_friday", "second"); - client.put("clean_1_saturday", "third"); - - }else if("3".equalsIgnoreCase(weChatRate.getString("clean_days"))){ - client.put("clean_1", weChatRate.getString("clean_days")); - client.put("clean_1_friday", "third"); - client.put("clean_1_saturday", "fourth"); + client.put("clean_1", weChatRate.getString("clean_days")); + client.put("clean_1_friday", "first"); + client.put("clean_1_saturday", "second"); + } else if ("2".equalsIgnoreCase(weChatRate.getString("clean_days"))) { + client.put("clean_1", weChatRate.getString("clean_days")); + client.put("clean_1_friday", "second"); + client.put("clean_1_saturday", "third"); + + } else if ("3".equalsIgnoreCase(weChatRate.getString("clean_days"))) { + client.put("clean_1", weChatRate.getString("clean_days")); + client.put("clean_1_friday", "third"); + client.put("clean_1_saturday", "fourth"); } String rateConfig = sysConfigManager.getSysConfig().getString("sys_rates"); JSONObject sysConfigRate = JSON.parseObject(rateConfig); @@ -4201,7 +4214,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid new PageBounds(query.getPage(), query.getLimit(), Order.formString("clearing_time.desc"))); logs.forEach(log -> log.put("padding", log.getBooleanValue("editable"))); JSONObject result = PageListUtils.buildPageListResult(logs); - result.put("padding", logs.stream().anyMatch(log->log.getBooleanValue("editable"))); + result.put("padding", logs.stream().anyMatch(log -> log.getBooleanValue("editable"))); logger.info("##editable{}", result.getBooleanValue("padding")); return result; } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ApsConfigData.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ApsConfigData.java new file mode 100644 index 000000000..5a945f842 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ApsConfigData.java @@ -0,0 +1,46 @@ +package au.com.royalpay.payment.manage.merchants.entity; + + +import au.com.royalpay.payment.manage.merchants.core.descriptor.ApsConfigDescriptor; +import com.alibaba.fastjson.JSONObject; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +import java.util.UUID; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = true) +public class ApsConfigData implements Serializable { + + private String id; + + private String creator; + + private Date createTime; + + private String modifier; + + private Date modifyTime; + + private String clientId; + + private Boolean enableAlipayAps; + + private Boolean alipayCnSwitch; + + public static ApsConfigData saveData(String managerId, String clientId, ApsConfigDescriptor apsConfigDescriptor) { + return new ApsConfigData() + .setClientId(clientId) + .setId(UUID.randomUUID().toString().replace("-", "")) + .setAlipayCnSwitch(apsConfigDescriptor.getAlipayCnSwitch()) + .setEnableAlipayAps(apsConfigDescriptor.getEnableAlipayAps()) + .setCreator(managerId) + .setCreateTime(new Date()); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/ApsConfigController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/ApsConfigController.java new file mode 100644 index 000000000..5b64f54bc --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/ApsConfigController.java @@ -0,0 +1,55 @@ +package au.com.royalpay.payment.manage.merchants.web; + +import au.com.royalpay.payment.manage.merchants.core.ApsConfigService; +import au.com.royalpay.payment.manage.merchants.core.descriptor.ApsConfigDescriptor; +import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData; +import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; +import au.com.royalpay.payment.tools.CommonConsts; +import au.com.royalpay.payment.tools.permission.enums.ManagerRole; +import com.alibaba.fastjson.JSONObject; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +@RestController +@RequestMapping("/sys/partners/aps") +public class ApsConfigController { + + @Resource + private ApsConfigService apsConfigService; + + /** + * 获取aps配置信息 + * + * @param clientId + * @return + */ + @GetMapping("/{clientId}") + public ApsConfigData getApsConfigByClientId(@PathVariable("clientId") String clientId) { + return apsConfigService.getApsConfigByClientId(clientId); + } + + /** + * 初始化aps配置 + * + * @param clientId + * @param apsConfigDescriptor + * @return + */ + @ManagerMapping(value = "/{clientId}", method = RequestMethod.POST, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER }) + public ApsConfigData saveApsConfigClientId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable("clientId") String clientId, @RequestBody ApsConfigDescriptor apsConfigDescriptor) { + return apsConfigService.saveApsConfigClientId(manager.getString("managerId"), clientId, apsConfigDescriptor); + } + + /** + * 修改aps配置 + * + * @param clientId + * @param apsConfig + * @return + */ + @ManagerMapping(value = "/{clientId}", method = RequestMethod.PUT, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER }) + public ApsConfigData updateApsConfigClientId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable("clientId") String clientId, @RequestBody JSONObject apsConfig) { + return apsConfigService.updateApsConfigClientId(manager.getString("managerId"),clientId, apsConfig); + } +} diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/aps/ApsConfigMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/aps/ApsConfigMapper.xml new file mode 100644 index 000000000..3c0630c8f --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/aps/ApsConfigMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + UPDATE sys_client_aps_config SET modify_time = now(), modifier = #{modifier} + , alipay_cn_switch = #{alipayCnSwitch} + , enable_alipayaps = #{enableAlipayAps} + WHERE client_id = #{clientId} + + + \ No newline at end of file diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 4e63e0fb4..d3b0b07e2 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -2,459 +2,459 @@ * Created by yixian on 2016-06-29. */ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiSelect'], function (angular, Decimal) { - 'use strict' - var clean_days_map = [ - { - label: 'T+1', - value: '1', - }, - { - label: 'T+2', - value: '2', - }, - { - label: 'T+3', - value: '3', - }, - ] - var bd_city_map = [ - { - label: 'Sydney', - value: 'Sydney', - }, - { - label: 'Melbourne', - value: 'Melbourne', - }, - ] - var partnerRoles = [ - { code: 1, label: 'Admin' }, - { code: 2, label: 'Manager' }, - { code: 3, label: 'Cashier' }, - ] - // var wxMerchantIndustries = [ - // { - // "label": "鞋包服饰|Shoes&Garments", - // "value": "343" - // }, - // { - // "label": "机票行业|Air Ticket", - // "value": "493" - // }, - // { - // "label": "文具/办公用品|Stationery/office supplies", - // "value": "492" - // }, - // { - // "label": "酒店行业|Hotel Industry", - // "value": "491" - // }, - // { - // "label": "教育行业|Education Industry", - // "value": "490" - // }, - // { - // "label": "国际物流|Logistics", - // "value": "489" - // }, - // { - // "label": "数码电器|Digital appliance", - // "value": "488" - // }, - // { - // "label": "母婴|Maternal and infant", - // "value": "487" - // }, - // { - // "label": "化妆品|Cosmetics", - // "value": "486" - // }, - // { - // "label": "食品|Food", - // "value": "485" - // }, - // { - // "label": "综合商城|Comprehensive mall", - // "value": "484" - // }, - // { - // "label": "其它货物贸易行业|Other trade industry", - // "value": "494" - // } - // ]; - - var wxMerchantIndustries = [ - { - label: 'Shoes&Garments', - value: '343', - }, - { - label: 'Comprehensive mall', - value: '484', - }, - { - label: 'Food', - value: '485', - }, - { - label: 'Cosmetics', - value: '486', - }, - { - label: 'Maternal and infant', - value: '487', - }, - { - label: 'Digital appliance', - value: '488', - }, - { - label: 'Logistics', - value: '489', - }, - { - label: 'Education Industry', - value: '490', - }, - { - label: 'Hotel Industry', - value: '491', - }, - { - label: 'Stationery/office supplies', - value: '492', - }, - { - label: 'Air Ticket', - value: '493', - }, - { - label: 'Other trade industry', - value: '494', - }, - { - label: 'Overseas Education', - value: '528', - }, - { - label: 'Travel ticket', - value: '529', - }, - { - label: 'Car rental', - value: '530', - }, - { - label: 'International Conference', - value: '531', - }, - { - label: 'Software', - value: '532', - }, - { - label: 'Medical Service', - value: '533', - }, - { - label: 'Online games (Top-up)', - value: '644', - }, - { - label: 'Online Shopping Mall', - value: '648', - }, - { - label: 'Supermarket', - value: '649', - }, - { - label: 'Convenience Store', - value: '651', - }, - { - label: 'Duty-free Shop', - value: '652', - }, - { - label: 'Pharmacy', - value: '653', - }, - { - label: 'Vending Machine', - value: '654', - }, - { - label: 'Department Store /Shopping Centre', - value: '655', - }, - { - label: 'Food/Beverages', - value: '656', - }, - { - label: 'Catering Services', - value: '657', - }, - { - label: 'Furniture/Household Products', - value: '658', - }, - { - label: 'Home Appliances/Camera Equipment/Office Equipment', - value: '659', - }, - { - label: 'Beauty/Personal Care Products', - value: '660', - }, - { - label: 'Flowers/Plants/Interior Decorations/Decorations', - value: '661', - }, - { - label: 'Nursery Products/Toys', - value: '662', - }, - { - label: 'Clothing/Shoes/Other Accessories', - value: '663', - }, - { - label: 'Sports/Fitness Equipment/Security', - value: '664', - }, - { - label: 'Watches/Eyewear/Jewellery', - value: '665', - }, - { - label: 'Outdoor Products /Travel Products', - value: '666', - }, - { - label: 'Books / Records / Stationery / Musical Instruments', - value: '667', - }, - { - label: 'Flight ticket/ticketing agent', - value: '668', - }, - { - label: 'Sightseeing Passes', - value: '669', - }, - { - label: 'Hotel/Resort', - value: '670', - }, - { - label: 'Online Books/Video/Music', - value: '671', - }, - { - label: 'Online games (Download)', - value: '672', - }, - { - label: 'University Education', - value: '677', - }, - { - label: 'Public hospitals/Medical Institutions', - value: '679', - }, - { - label: 'Private hospitals/Clinics/Medical institutions', - value: '678', - }, - { - label: 'Public transit', - value: '680', - }, - { - label: 'Logistics/ Courier Service', - value: '684', - }, - ] - 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 - } + 'use strict' + var clean_days_map = [ + { + label: 'T+1', + value: '1', + }, + { + label: 'T+2', + value: '2', + }, + { + label: 'T+3', + value: '3', + }, + ] + var bd_city_map = [ + { + label: 'Sydney', + value: 'Sydney', + }, + { + label: 'Melbourne', + value: 'Melbourne', + }, + ] + var partnerRoles = [ + {code: 1, label: 'Admin'}, + {code: 2, label: 'Manager'}, + {code: 3, label: 'Cashier'}, + ] + // var wxMerchantIndustries = [ + // { + // "label": "鞋包服饰|Shoes&Garments", + // "value": "343" + // }, + // { + // "label": "机票行业|Air Ticket", + // "value": "493" + // }, + // { + // "label": "文具/办公用品|Stationery/office supplies", + // "value": "492" + // }, + // { + // "label": "酒店行业|Hotel Industry", + // "value": "491" + // }, + // { + // "label": "教育行业|Education Industry", + // "value": "490" + // }, + // { + // "label": "国际物流|Logistics", + // "value": "489" + // }, + // { + // "label": "数码电器|Digital appliance", + // "value": "488" + // }, + // { + // "label": "母婴|Maternal and infant", + // "value": "487" + // }, + // { + // "label": "化妆品|Cosmetics", + // "value": "486" + // }, + // { + // "label": "食品|Food", + // "value": "485" + // }, + // { + // "label": "综合商城|Comprehensive mall", + // "value": "484" + // }, + // { + // "label": "其它货物贸易行业|Other trade industry", + // "value": "494" + // } + // ]; + + var wxMerchantIndustries = [ + { + label: 'Shoes&Garments', + value: '343', + }, + { + label: 'Comprehensive mall', + value: '484', + }, + { + label: 'Food', + value: '485', + }, + { + label: 'Cosmetics', + value: '486', + }, + { + label: 'Maternal and infant', + value: '487', + }, + { + label: 'Digital appliance', + value: '488', + }, + { + label: 'Logistics', + value: '489', + }, + { + label: 'Education Industry', + value: '490', + }, + { + label: 'Hotel Industry', + value: '491', + }, + { + label: 'Stationery/office supplies', + value: '492', + }, + { + label: 'Air Ticket', + value: '493', + }, + { + label: 'Other trade industry', + value: '494', + }, + { + label: 'Overseas Education', + value: '528', + }, + { + label: 'Travel ticket', + value: '529', + }, + { + label: 'Car rental', + value: '530', + }, + { + label: 'International Conference', + value: '531', + }, + { + label: 'Software', + value: '532', + }, + { + label: 'Medical Service', + value: '533', + }, + { + label: 'Online games (Top-up)', + value: '644', + }, + { + label: 'Online Shopping Mall', + value: '648', + }, + { + label: 'Supermarket', + value: '649', + }, + { + label: 'Convenience Store', + value: '651', + }, + { + label: 'Duty-free Shop', + value: '652', + }, + { + label: 'Pharmacy', + value: '653', + }, + { + label: 'Vending Machine', + value: '654', + }, + { + label: 'Department Store /Shopping Centre', + value: '655', + }, + { + label: 'Food/Beverages', + value: '656', + }, + { + label: 'Catering Services', + value: '657', + }, + { + label: 'Furniture/Household Products', + value: '658', + }, + { + label: 'Home Appliances/Camera Equipment/Office Equipment', + value: '659', + }, + { + label: 'Beauty/Personal Care Products', + value: '660', + }, + { + label: 'Flowers/Plants/Interior Decorations/Decorations', + value: '661', + }, + { + label: 'Nursery Products/Toys', + value: '662', + }, + { + label: 'Clothing/Shoes/Other Accessories', + value: '663', + }, + { + label: 'Sports/Fitness Equipment/Security', + value: '664', + }, + { + label: 'Watches/Eyewear/Jewellery', + value: '665', + }, + { + label: 'Outdoor Products /Travel Products', + value: '666', + }, + { + label: 'Books / Records / Stationery / Musical Instruments', + value: '667', + }, + { + label: 'Flight ticket/ticketing agent', + value: '668', + }, + { + label: 'Sightseeing Passes', + value: '669', + }, + { + label: 'Hotel/Resort', + value: '670', + }, + { + label: 'Online Books/Video/Music', + value: '671', + }, + { + label: 'Online games (Download)', + value: '672', + }, + { + label: 'University Education', + value: '677', + }, + { + label: 'Public hospitals/Medical Institutions', + value: '679', + }, + { + label: 'Private hospitals/Clinics/Medical institutions', + value: '678', + }, + { + label: 'Public transit', + value: '680', + }, + { + label: 'Logistics/ Courier Service', + value: '684', + }, + ] + 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('partnerManageApp', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ui.select', 'ngFileUpload']) - app.config([ - '$stateProvider', - function ($stateProvider) { - $stateProvider - .state('partners', { - url: '/partners', - templateUrl: '/static/payment/partner/templates/partners.html', - controller: 'partnerListCtrl', - data: { label: '商户列表' }, - }) - .state('businessCompliance', { - url: '/partners/compliance', - templateUrl: '/static/payment/partner/templates/partner_compliance.html', - controller: 'compliancePartnerCtrl', - }) - .state('complianceDocumentAudit', { - url: '/partners/compliance', - templateUrl: '/static/payment/partner/templates/partner_compliance.html', - controller: 'compliancePartnerCtrl', - }) - .state('partners.detail', { - url: '/{clientMoniker}/detail', - templateUrl: '/static/payment/partner/templates/partner_detail.html', - controller: 'partnerDetailCtrl', - 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', - controller: 'partnerPaymentInfoCtrl', - }) - .state('partners.detail.payment_info_invalid', { - url: '/payment_invalid', - templateUrl: '/static/payment/partner/templates/partner_payment_info_invalid.html', - controller: 'partnerPaymentInfoCtrl', - }) - .state('partners.detail.subpartners', { - url: '/sub_partners', - templateUrl: '/static/payment/partner/templates/sub_partners.html', - controller: 'partnerSubCtrl', - }) - .state('partners.detail.accounts', { - url: '/accounts', - templateUrl: '/static/payment/partner/templates/partner_accounts.html', - controller: 'partnerAccountsCtrl', - }) - .state('partners.detail.paylogs', { - url: '/pay_logs', - templateUrl: '/static/payment/partner/templates/partner_pay_logs.html', - controller: 'partnerPayLogCtrl', - }) - .state('partners.detail.rates', { - url: '/rates', - templateUrl: '/static/payment/partner/templates/partner_bankaccounts.html', - controller: 'partnerRatesCtrl', - }) - .state('partners.detail.plugins', { - url: '/plugins', - templateUrl: '/static/payment/partner/templates/partner_plugins.html', - controller: 'partnerPluginsCtrl', - }) - .state('partners.detail.devices', { - url: '/devices', - templateUrl: '/static/payment/partner/templates/partner_devices.html', - controller: 'partnerDeviceCtrl', - }) - .state('partners.detail.files', { - url: '/files', - params: { commitType: 'cross-border' }, - templateUrl: '/static/payment/partner/templates/partner_auth_files.html', - 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.files.MW_files', { - url: '/mw_files', - templateUrl: '/static/payment/partner/templates/partner_mw_auth_files.html', - controller: 'partnerMWAuthFileCtrl', - resolve: { - file: [ - '$http', - '$stateParams', - function ($http, $stateParams) { - return $http.get('/sys/partners/' + $stateParams.clientMoniker + '/mw_file') - }, - ], - }, - }) - .state('partners.detail.kyc_files', { - url: '/kyc_files', - templateUrl: '/static/payment/kyc/templates/partner_kyc_files.html', - controller: 'partnerKycFileCtrl', - resolve: { - file: [ - '$http', - '$stateParams', - function ($http, $stateParams) { - return $http.get('/sys/partners/' + $stateParams.clientMoniker + '/kycFile') - }, - ], - }, - }) - .state('partners.detail.settlement', { - url: '/settlement', - templateUrl: '/static/payment/partner/templates/partner_settlement.html', - controller: 'partnerSettlementCtrl', - resolve: { - clientMoniker: [ - '$stateParams', - function ($stateParams) { - return $stateParams.clientMoniker - }, - ], - }, - }) - .state('partners.detail.surcharge_account', { - url: '/surcharge_account', - templateUrl: '/static/payment/partner/templates/partner_surcharge_account.html', - controller: 'partnerSurchargeAccountCtrl', - resolve: { - clientMoniker: [ - '$stateParams', - function ($stateParams) { - return $stateParams.clientMoniker - }, - ], - }, - }) - .state('partners.detail.product', { - url: '/partner_product', - templateUrl: 'static/payment/product/templates/partner_product.html', - controller: 'productCtrl', - }) - .state('partners.detail.sub_merchant_applicaitons', { - url: '/sub_merchant_applicaitons', - templateUrl: 'static/payment/partner/templates/sub_merchant_id_apply.html', - controller: 'subMerchantIdApplicaitonsCtrl', - }) - .state('partners.detail.permission_client', { - url: '/permission_client', - templateUrl: 'static/payment/partner/templates/partner_permission.html', - controller: 'permissionClientCtrl', - }) - .state('partners.detail.incremental_service', { - url: '/incremental_service', - templateUrl: 'static/payment/partner/templates/incremental_service.html', - controller: 'incrementalServiceCtrl', - }) /*.state('partners.edit', { + var app = angular.module('partnerManageApp', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ui.select', 'ngFileUpload']) + app.config([ + '$stateProvider', + function ($stateProvider) { + $stateProvider + .state('partners', { + url: '/partners', + templateUrl: '/static/payment/partner/templates/partners.html', + controller: 'partnerListCtrl', + data: {label: '商户列表'}, + }) + .state('businessCompliance', { + url: '/partners/compliance', + templateUrl: '/static/payment/partner/templates/partner_compliance.html', + controller: 'compliancePartnerCtrl', + }) + .state('complianceDocumentAudit', { + url: '/partners/compliance', + templateUrl: '/static/payment/partner/templates/partner_compliance.html', + controller: 'compliancePartnerCtrl', + }) + .state('partners.detail', { + url: '/{clientMoniker}/detail', + templateUrl: '/static/payment/partner/templates/partner_detail.html', + controller: 'partnerDetailCtrl', + 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', + controller: 'partnerPaymentInfoCtrl', + }) + .state('partners.detail.payment_info_invalid', { + url: '/payment_invalid', + templateUrl: '/static/payment/partner/templates/partner_payment_info_invalid.html', + controller: 'partnerPaymentInfoCtrl', + }) + .state('partners.detail.subpartners', { + url: '/sub_partners', + templateUrl: '/static/payment/partner/templates/sub_partners.html', + controller: 'partnerSubCtrl', + }) + .state('partners.detail.accounts', { + url: '/accounts', + templateUrl: '/static/payment/partner/templates/partner_accounts.html', + controller: 'partnerAccountsCtrl', + }) + .state('partners.detail.paylogs', { + url: '/pay_logs', + templateUrl: '/static/payment/partner/templates/partner_pay_logs.html', + controller: 'partnerPayLogCtrl', + }) + .state('partners.detail.rates', { + url: '/rates', + templateUrl: '/static/payment/partner/templates/partner_bankaccounts.html', + controller: 'partnerRatesCtrl', + }) + .state('partners.detail.plugins', { + url: '/plugins', + templateUrl: '/static/payment/partner/templates/partner_plugins.html', + controller: 'partnerPluginsCtrl', + }) + .state('partners.detail.devices', { + url: '/devices', + templateUrl: '/static/payment/partner/templates/partner_devices.html', + controller: 'partnerDeviceCtrl', + }) + .state('partners.detail.files', { + url: '/files', + params: {commitType: 'cross-border'}, + templateUrl: '/static/payment/partner/templates/partner_auth_files.html', + 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.files.MW_files', { + url: '/mw_files', + templateUrl: '/static/payment/partner/templates/partner_mw_auth_files.html', + controller: 'partnerMWAuthFileCtrl', + resolve: { + file: [ + '$http', + '$stateParams', + function ($http, $stateParams) { + return $http.get('/sys/partners/' + $stateParams.clientMoniker + '/mw_file') + }, + ], + }, + }) + .state('partners.detail.kyc_files', { + url: '/kyc_files', + templateUrl: '/static/payment/kyc/templates/partner_kyc_files.html', + controller: 'partnerKycFileCtrl', + resolve: { + file: [ + '$http', + '$stateParams', + function ($http, $stateParams) { + return $http.get('/sys/partners/' + $stateParams.clientMoniker + '/kycFile') + }, + ], + }, + }) + .state('partners.detail.settlement', { + url: '/settlement', + templateUrl: '/static/payment/partner/templates/partner_settlement.html', + controller: 'partnerSettlementCtrl', + resolve: { + clientMoniker: [ + '$stateParams', + function ($stateParams) { + return $stateParams.clientMoniker + }, + ], + }, + }) + .state('partners.detail.surcharge_account', { + url: '/surcharge_account', + templateUrl: '/static/payment/partner/templates/partner_surcharge_account.html', + controller: 'partnerSurchargeAccountCtrl', + resolve: { + clientMoniker: [ + '$stateParams', + function ($stateParams) { + return $stateParams.clientMoniker + }, + ], + }, + }) + .state('partners.detail.product', { + url: '/partner_product', + templateUrl: 'static/payment/product/templates/partner_product.html', + controller: 'productCtrl', + }) + .state('partners.detail.sub_merchant_applicaitons', { + url: '/sub_merchant_applicaitons', + templateUrl: 'static/payment/partner/templates/sub_merchant_id_apply.html', + controller: 'subMerchantIdApplicaitonsCtrl', + }) + .state('partners.detail.permission_client', { + url: '/permission_client', + templateUrl: 'static/payment/partner/templates/partner_permission.html', + controller: 'permissionClientCtrl', + }) + .state('partners.detail.incremental_service', { + url: '/incremental_service', + templateUrl: 'static/payment/partner/templates/incremental_service.html', + controller: 'incrementalServiceCtrl', + }) /*.state('partners.edit', { url: '/{clientMoniker}/edit', params: {"commitCardPayment": false, "commitCrossBorderPayment": false}, templateUrl: 'static/payment/partner/templates/partner_edit.html', @@ -465,4326 +465,4396 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }] } })*/ - }, - ]) - 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 - } - } + }, + ]) + 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 + } - if (hasRole()) { - $scope.role = sessionStorage.getItem('role') - } + $scope.enablePaymentType = function (type) { + $scope.partner[type] = !$scope.partner[type] + } - 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.partner.address = $scope.partner.registered_address - $scope.partner.suburb = $scope.partner.registered_suburb - $scope.partner.postcode = $scope.partner.registered_postcode - $scope.partner.state = $scope.partner.registered_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 ($state.params.commitCardPayment) { + $scope.enablePaymentType('enable_card_payment') + } - 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 ($state.params.commitCrossBorderPayment) { + $scope.enablePaymentType('enable_cross_payment') + } - 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 + 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 + } } - }) - } - 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 () {}) - } - } - }, - ]) - app.controller('partnerListCtrl', [ - '$scope', - '$sce', - '$http', - '$filter', - '$uibModal', - 'businessStructuresMap', - 'industryMap', - 'stateMap', - 'sectorMap', - 'countryMap', - function ($scope, $sce, $http, $filter, $uibModal, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) { - $scope.analysisClients = function () { - $http.get('/sys/partners/analysis').then(function (resp) { - $scope.analysis = resp.data - }) - } - if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) { - $scope.analysisClients() - } - $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', industry: '0' } - $scope.loadRoyalpayindustry = function () { - $http.get('/static/data/royalpayindustry.json').then(function (resp) { - $scope.royalpayindustry = resp.data - var selectAll = { - label: 'All', - mccCode: '0', - children: {}, - } - $scope.royalpayindustry.unshift(selectAll) - }) - } - - $scope.loadRoyalpayindustry() - - $scope.onRoyalPayIndustrySelect = function (selectedItem) { - $scope.params.royalpay_label = selectedItem.label - $scope.params.industry = selectedItem.mccCode - $scope.loadPartners(1) - } - - $scope.loadPartners = function (page) { - var params = angular.copy($scope.params) - params.page = page || $scope.pagination.page || 1 - $http.get('/sys/partners', { params: params }).then(function (resp) { - $scope.partners = resp.data.data - $scope.pagination = resp.data.pagination - }) - } - - $scope.exportPartnersExcel = function () { - var params = angular.copy($scope.params) - var param_str = Object.keys(params) - .map(function (key) { - var value = params[key] - if (angular.isDate(value)) { - value = $filter('date')(value, 'yyyy-MM-ddTHH:mm:ssZ') - } - return key + '=' + encodeURIComponent(value) - }) - .join('&') - window.open('/sys/partners/exporting_excel?' + param_str) - } - - /*$scope.loadLocations = function () { - var params = angular.copy($scope.params); - $http.get('/sys/partners/merchant/list_locations', {params: params}).then(function (resp) { - $scope.locations = resp.data; - window.merchant_maps.initMap($scope.locations); - }); - };*/ - $scope.today = new Date() - - $scope.listBDUsers = function () { - $http.get('/sys/manager_accounts/roles/bd_user').then(function (resp) { - $scope.bdUserSource = resp.data - }) - } - $scope.listBDUsers() - - if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) { - $scope.showOrg = 'Organization' - $http.get('/sys/orgs/list_all_Org', { params: {} }).then(function (resp) { - $scope.orgs = resp.data - }) - } - - $scope.loadOrgs = function () { - var params = angular.copy($scope.params) - $http.get('/sys/orgs/orgChild', { params: params }).then(function (resp) { - $scope.orgs_child = resp.data - }) - } - $scope.loadOrgs() - - /* $scope.onOrgsSelect = function (selectedItem) { - $scope.params.org_id = selectedItem.org_id; - $scope.params.org_name = selectedItem.label; - $scope.loadPartners(); - }; - */ - /* $scope.chooseOrg = function (org) { - if (org == 'all') { - delete $scope.params.org_id; - $scope.showOrg = 'All' - } else { - $scope.params.org_id = org.org_id; - $scope.showOrg = org.name; - } - $scope.loadPartners(1); - };*/ - $scope.loadPartners(1) - - $scope.openClientBoard = function (client) { - $uibModal.open({ - templateUrl: '/static/analysis/templates/partner_card.html', - controller: 'partnerCardCtrl', - resolve: { - clientMoniker: function () { - return client.client_moniker - }, - }, - size: 'lg', - }) - } - /*$scope.toogleMapSelect = function () { - $scope.mapFrame = 'all_locations.html'; - $scope.loadLocations(); + if (hasRole()) { + $scope.role = sessionStorage.getItem('role') } - $scope.toogleMerchantSelect = function () { - $scope.mapFrame = null; + + 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') + } } - $scope.toogleMerchantSelect();*/ - }, - ]) - app.controller('compliancePartnerCtrl', [ - '$scope', - '$sce', - '$http', - '$filter', - '$uibModal', - 'businessStructuresMap', - 'industryMap', - 'stateMap', - 'sectorMap', - 'countryMap', - function ($scope, $sce, $http, $filter, $uibModal, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) { - $scope.analysisClients = function () { - $http.get('/sys/partners/analysis').then(function (resp) { - $scope.analysis = resp.data - }) - } - if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) { - $scope.analysisClients() - } - $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', approving_flag: false, card_approving_flag: false } - - $scope.loadPartners = function (page) { - $scope.validAndCleanApproveStatus() - var params = angular.copy($scope.params) - params.page = page || $scope.pagination.page || 1 - $http.get('/sys/partners/compliance', { params: params }).then(function (resp) { - $scope.partners = resp.data.data - $scope.pagination = resp.data.pagination - }) - } - - $scope.validAndCleanApproveStatus = function () { - if (!$scope.params.cross_approving_flag && !$scope.params.card_approving_flag) { - $scope.params.approving = false - $scope.params.card_approving = false - $scope.params.waitingCompliance = false - $scope.params.tempMchId = false - $scope.params.bd_upload_material = false - $scope.params.quickPass = false - $scope.params.greenChannel = false - $scope.params.pass = false - $scope.params.completed_contract = false - $scope.params.apply_to_back = false - $scope.params.is_valid = false - } - if (!$scope.params.cross_approving_flag && $scope.params.card_approving_flag) { - $scope.params.tempMchId = false - $scope.params.quickPass = false - $scope.params.greenChannel = false - } - } - - $scope.today = new Date() - - $scope.listBDUsers = function () { - $http.get('/sys/manager_accounts/roles/bd_user').then(function (resp) { - $scope.bdUserSource = resp.data - }) - } - $scope.listBDUsers() - - if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) { - $scope.showOrg = 'Organization' - $http.get('/sys/orgs/list_all_Org', { params: {} }).then(function (resp) { - $scope.orgs = resp.data - }) - } - - $scope.loadOrgs = function () { - var params = angular.copy($scope.params) - $http.get('/sys/orgs/orgChild', { params: params }).then(function (resp) { - $scope.orgs_child = resp.data - }) - } - $scope.loadOrgs() - - $scope.loadPartners(1) - - $scope.openClientBoard = function (client) { - $uibModal.open({ - templateUrl: '/static/analysis/templates/partner_card.html', - controller: 'partnerCardCtrl', - resolve: { - clientMoniker: function () { - return client.client_moniker - }, - }, - size: 'lg', - }) - } - }, - ]) - 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 = {} - if ($scope.partner.mc_code) { - $scope.partner.mc_code = parseInt($scope.partner.mc_code) - } - var website = partner.data.company_website - if (website != null) { - if (website.indexOf('http') !== 0) { - $scope.partner.company_website = 'http://' + angular.copy(website) - } - } - $scope.decideCompliance = function (name) { - var keywords = ['education', 'financial', 'train', 'immigrant', 'invest', '律师咨询', '会计事务所', '移民', '留学', '娱乐', '金融', '地产', '投资'] - for (var i = 0; i < keywords.length; i++) { - if (name.indexOf(keywords[i]) !== -1) { - return true - } - } - return false - } - if (partner.data.company_name != null) { - $scope.isComplianceOfCompanyName = $scope.decideCompliance(partner.data.company_name) - } - if (partner.data.short_name != null) { - $scope.isComplianceOfShortName = $scope.decideCompliance(partner.data.short_name) - } - if (partner.data.business_structure != null) { - $scope.isComplianceOfBusinessStructure = $scope.decideCompliance(partner.data.business_structure) - } - $scope.showDBUsers = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/bd_user').then(function (resp) { - $scope.partner.client_bds = resp.data - }) - } - $scope.showDBUsers() - $scope.showFile = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_agree_file').then(function (resp) { - $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 (!$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' - 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: title, - content: content, - choises: choises, - contentHtml: contentHtml, - }) - .then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/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', - }) + var compare = function (x, y) { + x = parseInt(x) + y = parseInt(y) + if (x < y) { + return -1 + } else if (x > y) { + return 1 } else { - commonDialog.alert({ - title: 'Success', - content: 'Comply Passed! Email will send to contact email address soon.', - type: 'success', - }) + return 0 } - delete $rootScope.complianceCheck - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - }) - } - $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: title, - content: content, - choises: choises, - contentHtml: contentHtml, - }) - .then(function () { - $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', - }) + } + $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 { - commonDialog.alert({ - title: 'Success', - content: 'Comply Passed! Email will send to contact email address soon.', - type: 'success', - }) + $scope.partner.client_pay_type.push(type) + $scope.partner.client_pay_type.sort(compare) } - 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', + } + $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.partner.address = $scope.partner.registered_address + $scope.partner.suburb = $scope.partner.registered_suburb + $scope.partner.postcode = $scope.partner.registered_postcode + $scope.partner.state = $scope.partner.registered_state + } + } + + $scope.listReferrers = function () { + $http.get('/sys/orgs/referrer').then(function (resp) { + $scope.referrers = resp.data }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - }) - } - $scope.showBg = false - $scope.exportPDF = function () { - $scope.showBg = true - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/agreepdf').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.exportAgreegatePDF = function () { - $scope.showBg = true - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/aggregate/agreepdf').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.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.Export = function () { - var url = '/dev/' + $scope.partner.client_moniker + '/export/aggregate/agreepdf' - return url - } - $scope.uploadAgreeFile = 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', - }) + } + $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 () { + }) + } + } + }, + ]) + app.controller('partnerListCtrl', [ + '$scope', + '$sce', + '$http', + '$filter', + '$uibModal', + 'businessStructuresMap', + 'industryMap', + 'stateMap', + 'sectorMap', + 'countryMap', + function ($scope, $sce, $http, $filter, $uibModal, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) { + $scope.analysisClients = function () { + $http.get('/sys/partners/analysis').then(function (resp) { + $scope.analysis = resp.data + }) + } + if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) { + $scope.analysisClients() + } + $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', industry: '0'} + $scope.loadRoyalpayindustry = function () { + $http.get('/static/data/royalpayindustry.json').then(function (resp) { + $scope.royalpayindustry = resp.data + var selectAll = { + label: 'All', + mccCode: '0', + children: {}, + } + $scope.royalpayindustry.unshift(selectAll) + }) + } + + $scope.loadRoyalpayindustry() + + $scope.onRoyalPayIndustrySelect = function (selectedItem) { + $scope.params.royalpay_label = selectedItem.label + $scope.params.industry = selectedItem.mccCode + $scope.loadPartners(1) + } + + $scope.loadPartners = function (page) { + var params = angular.copy($scope.params) + params.page = page || $scope.pagination.page || 1 + $http.get('/sys/partners', {params: params}).then(function (resp) { + $scope.partners = resp.data.data + $scope.pagination = resp.data.pagination + }) + } + + $scope.exportPartnersExcel = function () { + var params = angular.copy($scope.params) + var param_str = Object.keys(params) + .map(function (key) { + var value = params[key] + if (angular.isDate(value)) { + value = $filter('date')(value, 'yyyy-MM-ddTHH:mm:ssZ') + } + return key + '=' + encodeURIComponent(value) + }) + .join('&') + window.open('/sys/partners/exporting_excel?' + param_str) + } + + /*$scope.loadLocations = function () { + var params = angular.copy($scope.params); + $http.get('/sys/partners/merchant/list_locations', {params: params}).then(function (resp) { + $scope.locations = resp.data; + window.merchant_maps.initMap($scope.locations); + }); + };*/ + $scope.today = new Date() + + $scope.listBDUsers = function () { + $http.get('/sys/manager_accounts/roles/bd_user').then(function (resp) { + $scope.bdUserSource = resp.data + }) + } + $scope.listBDUsers() + + if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) { + $scope.showOrg = 'Organization' + $http.get('/sys/orgs/list_all_Org', {params: {}}).then(function (resp) { + $scope.orgs = resp.data + }) + } + + $scope.loadOrgs = function () { + var params = angular.copy($scope.params) + $http.get('/sys/orgs/orgChild', {params: params}).then(function (resp) { + $scope.orgs_child = resp.data + }) + } + $scope.loadOrgs() + + /* $scope.onOrgsSelect = function (selectedItem) { + $scope.params.org_id = selectedItem.org_id; + $scope.params.org_name = selectedItem.label; + $scope.loadPartners(); + }; + */ + /* $scope.chooseOrg = function (org) { + if (org == 'all') { + delete $scope.params.org_id; + $scope.showOrg = 'All' + } else { + $scope.params.org_id = org.org_id; + $scope.showOrg = org.name; + } + $scope.loadPartners(1); + };*/ + + $scope.loadPartners(1) + + $scope.openClientBoard = function (client) { + $uibModal.open({ + templateUrl: '/static/analysis/templates/partner_card.html', + controller: 'partnerCardCtrl', + resolve: { + clientMoniker: function () { + return client.client_moniker + }, + }, + size: 'lg', + }) + } + /*$scope.toogleMapSelect = function () { + $scope.mapFrame = 'all_locations.html'; + $scope.loadLocations(); + } + $scope.toogleMerchantSelect = function () { + $scope.mapFrame = null; + } + $scope.toogleMerchantSelect();*/ + }, + ]) + app.controller('compliancePartnerCtrl', [ + '$scope', + '$sce', + '$http', + '$filter', + '$uibModal', + 'businessStructuresMap', + 'industryMap', + 'stateMap', + 'sectorMap', + 'countryMap', + function ($scope, $sce, $http, $filter, $uibModal, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) { + $scope.analysisClients = function () { + $http.get('/sys/partners/analysis').then(function (resp) { + $scope.analysis = resp.data + }) + } + if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) { + $scope.analysisClients() + } + $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', approving_flag: false, card_approving_flag: false} + + $scope.loadPartners = function (page) { + $scope.validAndCleanApproveStatus() + var params = angular.copy($scope.params) + params.page = page || $scope.pagination.page || 1 + $http.get('/sys/partners/compliance', {params: params}).then(function (resp) { + $scope.partners = resp.data.data + $scope.pagination = resp.data.pagination + }) + } + + $scope.validAndCleanApproveStatus = function () { + if (!$scope.params.cross_approving_flag && !$scope.params.card_approving_flag) { + $scope.params.approving = false + $scope.params.card_approving = false + $scope.params.waitingCompliance = false + $scope.params.tempMchId = false + $scope.params.bd_upload_material = false + $scope.params.quickPass = false + $scope.params.greenChannel = false + $scope.params.pass = false + $scope.params.completed_contract = false + $scope.params.apply_to_back = false + $scope.params.is_valid = false + } + if (!$scope.params.cross_approving_flag && $scope.params.card_approving_flag) { + $scope.params.tempMchId = false + $scope.params.quickPass = false + $scope.params.greenChannel = false + } + } + + $scope.today = new Date() + + $scope.listBDUsers = function () { + $http.get('/sys/manager_accounts/roles/bd_user').then(function (resp) { + $scope.bdUserSource = resp.data + }) + } + $scope.listBDUsers() + + if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) { + $scope.showOrg = 'Organization' + $http.get('/sys/orgs/list_all_Org', {params: {}}).then(function (resp) { + $scope.orgs = resp.data + }) + } + + $scope.loadOrgs = function () { + var params = angular.copy($scope.params) + $http.get('/sys/orgs/orgChild', {params: params}).then(function (resp) { + $scope.orgs_child = resp.data + }) + } + $scope.loadOrgs() + + $scope.loadPartners(1) + + $scope.openClientBoard = function (client) { + $uibModal.open({ + templateUrl: '/static/analysis/templates/partner_card.html', + controller: 'partnerCardCtrl', + resolve: { + clientMoniker: function () { + return client.client_moniker + }, + }, + size: 'lg', + }) + } + }, + ]) + 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 = {} + if ($scope.partner.mc_code) { + $scope.partner.mc_code = parseInt($scope.partner.mc_code) + } + var website = partner.data.company_website + if (website != null) { + if (website.indexOf('http') !== 0) { + $scope.partner.company_website = 'http://' + angular.copy(website) + } + } + $scope.decideCompliance = function (name) { + var keywords = ['education', 'financial', 'train', 'immigrant', 'invest', '律师咨询', '会计事务所', '移民', '留学', '娱乐', '金融', '地产', '投资'] + for (var i = 0; i < keywords.length; i++) { + if (name.indexOf(keywords[i]) !== -1) { + return true + } + } + return false + } + if (partner.data.company_name != null) { + $scope.isComplianceOfCompanyName = $scope.decideCompliance(partner.data.company_name) + } + if (partner.data.short_name != null) { + $scope.isComplianceOfShortName = $scope.decideCompliance(partner.data.short_name) + } + if (partner.data.business_structure != null) { + $scope.isComplianceOfBusinessStructure = $scope.decideCompliance(partner.data.business_structure) + } + $scope.showDBUsers = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/bd_user').then(function (resp) { + $scope.partner.client_bds = resp.data + }) + } + $scope.showDBUsers() + $scope.showFile = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_agree_file').then(function (resp) { + $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 (!$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' + 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: title, + content: content, + choises: choises, + contentHtml: contentHtml, + }) + .then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/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.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: title, + content: content, + choises: choises, + contentHtml: contentHtml, + }) + .then(function () { + $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 + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/agreepdf').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.exportAgreegatePDF = function () { + $scope.showBg = true + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/aggregate/agreepdf').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.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.Export = function () { + var url = '/dev/' + $scope.partner.client_moniker + '/export/aggregate/agreepdf' + return url + } + $scope.uploadAgreeFile = 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.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({ + title: 'Success', + content: 'Notify BD Successed!.', + type: 'success', + }) + $state.reload() + }, + function (resp) { + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + } + ) + } + + $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 () { + return '/sys/partners/' + $scope.partner.client_moniker + '/temp/export/pdf' + } + + $scope.refuse = function () { + commonDialog.inputText({title: 'refuse cause'}).then(function (text) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/refuse', {refuse_remark: text}).then( + function () { + commonDialog.alert({ + title: 'Success', + content: 'Audit application has been refused.', + type: 'success', + }) + $state.reload() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + }) + } + + $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', + content: 'Are you sure to delete ' + $scope.partner.company_name + '?', + }) + .then(function () { + $http.delete('/sys/partners/' + $scope.partner.client_moniker).then( + function () { + $state.go('^') + commonDialog.alert({ + title: 'Delete', + content: 'Partner Already Disabled', + type: 'error' + }) + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + }) + } + $scope.revertClient = function () { + commonDialog + .confirm({ + title: 'Revert Partner', + content: 'Are you sure to Revert ' + $scope.partner.company_name + '?', + }) + .then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/revert').then( + function () { + $state.go('^') + commonDialog.alert({ + title: 'Revert', + content: 'Partner Already Revert', + type: 'success' + }) + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + }) + } + + $scope.commitToCompliance = 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_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.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!', + content: '已提交制作合同!', + type: 'success', + }) + $state.reload() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + + $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', + content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' Green Channel?', + }) + .then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/compliance/green_channel').then( + function () { + commonDialog.alert({ + title: 'Success', + content: 'Commit to Green Channel successfully', + type: 'success', + }) + $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 (type) { + 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?type=' + type).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() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } + }) + } + $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 () { + var e = document.getElementById('cpbt') + e.select() + var successful = document.execCommand('Copy') + if (successful) { + commonDialog.alert({title: 'Success', content: '已复制到剪切板!', type: 'success'}) + } else { + commonDialog.alert({title: 'Error', content: '您的浏览器不支持!', type: 'error'}) + } + } + $scope.copyYeepayLink = function () { + var e = document.getElementById('cpyeepay') + e.select() + var successful = document.execCommand('Copy') + if (successful) { + commonDialog.alert({title: 'Success', content: '已复制到剪切板!', type: 'success'}) + } else { + commonDialog.alert({title: 'Error', content: '您的浏览器不支持!', type: 'error'}) + } + } + $scope.copyCBBankPayLink = function () { + var e = document.getElementById('cpcbbankpay') + e.select() + var successful = document.execCommand('Copy') + if (successful) { + commonDialog.alert({title: 'Success', content: '已复制到剪切板!', type: 'success'}) + } else { + commonDialog.alert({title: 'Error', content: '您的浏览器不支持!', type: 'error'}) + } + } + $scope.loadPartnerPaymentInfo = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { + $scope.extParams = {} + $scope.paymentInfo = resp.data + $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 + $scope.ctrl.editMaxOrderAmount = false + $scope.ctrl.editOrderExpiryConfig = false + $scope.ctrl.editRefundPwd = false + $scope.ctrl.editRefundCreditLine = false + }) + } + $scope.extParamsEditFlags = function () { + var paramList = [] + if ($scope.extParams != null) { + for (var key in $scope.extParams) { + var obj = {} + if (typeof $scope.extParams[key] != 'boolean') { + obj.name = key + obj.value = $scope.extParams[key] + obj.type = 'string' + obj.flag = false + } else { + obj.name = key + obj.value = $scope.extParams[key] + obj.type = 'boolean' + } + paramList.push(obj) + } + } + return paramList + } + $scope.qrConfig = {currency: 'AUD'} + $scope.reloadQRCode = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/qrcode', {params: $scope.qrConfig}).then(function (resp) { + $scope.qrcode = resp.data + }) + } + $scope.reloadQRCode() + $scope.loadPartnerPaymentInfo() + + $scope.showSubMerchantLogs = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/client_sub_merchant_id_log.html', + controller: 'clientSubMerchantIdLogCtrl', + size: 'lg', + resolve: { + logs: [ + '$http', + function ($http) { + return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_sub_merchant_id_logs') + }, + ], + }, + }) + .result.then(function () { + $scope.loadSubClients() + }) + } + + $scope.saveMaxOrderAmount = function (limit) { + if (limit != null && isNaN(limit)) { + commonDialog.alert({title: 'Error', content: 'Your input is not a number!', type: 'error'}) + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/max_order_amount', {limit: limit}).then( + function (resp) { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + + $scope.saveCustomerSurchargeRate = function (cofig) { + if (cofig != null && isNaN(cofig)) { + commonDialog.alert({title: 'Error', content: 'Your input is not a number!', type: 'error'}) + return + } + if (!$scope.paymentInfo.rate_value) { + commonDialog.alert({ + title: 'Error', + content: 'The merchant has not pass approval process', + type: 'error', + }) + return + } + if (cofig > 3 || cofig < parseFloat(Decimal.add($scope.paymentInfo.rate_value, 0.1).toFixed(2))) { + commonDialog.alert({title: 'Error', content: 'Not in the valid range', type: 'error'}) + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/customer_surcharge_rate', {customer_surcharge_rate: cofig}).then( + function (resp) { + $scope.loadPartnerPaymentInfo() + $scope.ctrl.editCustomerSurchargeRate = false + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + + $scope.saveOrderExpiryConfig = function (config) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/order_expiry_config', {order_expiry_config: config}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + + $scope.resetRefundPwd = function (config) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/reset/refund_pwd', {new_refund_password: config}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + + $scope.setRefundCreditLine = function () { + if (!$scope.paymentInfo) { + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/refund_credit_line', {refund_credit_line: $scope.paymentInfo.refund_credit_line}).then( + function (resp) { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + + $scope.updateClientQRCodePaySurCharge = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.qrcode_surcharge) { + $scope.init.qrcode_surcharge = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/qrcode_surcharge', {qrcode_surcharge: $scope.paymentInfo.qrcode_surcharge}).then( + function (resp) { + $scope.loadPartnerPaymentInfo() + }, + function () { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + $scope.updateClientCBBankPaySurCharge = function () { + if (!$scope.paymentInfo) { + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/cbbank_surcharge', {cbbank_surcharge: $scope.paymentInfo.cbbank_surcharge}).then( + function () { + // $scope.loadPartnerPaymentInfo(); + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change Customer Pay for Surcharge for Retail', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.updateClientApiSurCharge = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.api_surcharge) { + $scope.init.api_surcharge = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/api_surcharge', {api_surcharge: $scope.paymentInfo.api_surcharge}).then( + function (resp) { + $scope.loadPartnerPaymentInfo() + }, + function () { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + $scope.updateClientRetailPaySurCharge = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.retail_surcharge) { + $scope.init.retail_surcharge = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/retail_surcharge', {retail_surcharge: $scope.paymentInfo.retail_surcharge}).then( + function (resp) { + $scope.loadPartnerPaymentInfo() + }, + function () { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + $scope.ctrl = {} + $scope.saveSubMerchantId = function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: $scope.paymentInfo.sub_merchant_id}).then( + function (resp) { + $scope.refreshWechatInstitutionMerchantId() + $scope.ctrl.editSubMerchant = false + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + + $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) { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + $scope.saveAliSubMerchantId = function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/ali_sub_merchant_id', {ali_sub_merchant_id: $scope.paymentInfo.ali_sub_merchant_id}).then( + function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Modify Ali Sub Merchant ID successfully', + type: 'success', + }) + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + $scope.submitAlipaySubId = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms_json').then(function (resp) { + $scope.alipay_gms_json = resp.data + commonDialog + .confirm({ + title: 'Warning', + content: '是否使用该商户的现有信息进件?', + json: $scope.alipay_gms_json, + }) + .then(function () { + $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms').then( + function () { + commonDialog.alert({title: 'Success', content: 'Alipay进件成功', type: 'success'}) + }, + function (resp) { + commonDialog.alert({ + title: 'Error', + content: '进件失败:' + resp.data.message, + type: 'error' + }) + } + ) + }) + }) + } + $scope.queryAlipayGms = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms').then( + function (resp) { + commonDialog.alert({title: 'Success', content: resp.data.result_status, type: 'success'}) + }, + function (resp) { + commonDialog.alert({title: 'Error', content: '查询失败:' + resp.data.message, type: 'error'}) + } + ) + } + $scope.submitAlipayOnlineSubId = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms_json').then(function (resp) { + $scope.alipayOnline_gms_json = resp.data + commonDialog + .confirm({ + title: 'Warning', + content: '是否使用该商户的现有信息进件?', + json: $scope.alipayOnline_gms_json, + }) + .then(function () { + $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipayOnline_gms').then( + function () { + commonDialog.alert({ + title: 'Success', + content: '提示:AlipayOnline进件成功', + type: 'success' + }) + }, + function (resp) { + commonDialog.alert({ + title: 'Error', + content: '进件失败:' + resp.data.message, + type: 'error' + }) + } + ) + }) + }) + } + $scope.queryAlipayOnlineGms = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms').then( + function (resp) { + commonDialog.alert({title: 'Success', content: resp.data.result_status, type: 'success'}) + }, + function (resp) { + commonDialog.alert({title: 'Error', content: '查询失败:' + resp.data.message, type: 'error'}) + } + ) + } + $scope.refreshCredential = function () { + commonDialog + .confirm({ + title: 'Warning', + content: 'Refresh Credential will expire the current one, which will cause the current payment service disabled. Are you sure going on?', + }) + .then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/credential_code').then( + function () { + $state.reload() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + }) + } + $scope.init = { + jsapi: false, + gateway: false, + offline: false, + refund: false, + common_sub_merchant_id: false, + channel: {}, + gateway_alipay_online: false, + hf_Link: false, + enable_hf_email_notice: false, + enable_yeepay_link: false, + enable_yeepay_email_notice: false, + } + $scope.switchCommonSubMerchantId = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.common_sub_merchant_id) { + $scope.init.common_sub_merchant_id = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/common_sub_merchant_id', {allow: $scope.paymentInfo.common_sub_merchant_id}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change common_sub_merchant_id permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.switchSubManage = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.sub_manage) { + $scope.init.sub_manage = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/sub_manage', {allow: $scope.paymentInfo.sub_manage}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change Sub Partners Manage status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + var info = [] + $scope.decideCompliance = function (name) { + var keywords = ['education', 'financial', 'train', 'immigrant', 'invest', '律师咨询', '会计事务所', '移民', '留学', '娱乐', '金融', '地产', '投资'] + for (var i = 0; i < keywords.length; i++) { + if (name.indexOf(keywords[i]) != -1) { + return true + } + } + return false + } + $scope.getComplianceInfo = function () { + if ($scope.paymentInfo.company_name != null) { + if ($scope.decideCompliance($scope.paymentInfo.company_name)) { + info.push('Company Name') + } + } + if ($scope.paymentInfo.short_name != null) { + if ($scope.decideCompliance($scope.paymentInfo.short_name)) { + info.push('Short Name') + } + } + if ($scope.paymentInfo.business_structure != null) { + if ($scope.decideCompliance($scope.paymentInfo.business_structure)) { + info.push('Business Structure') + } + } + } + $scope.switchAlipayCn = function (clientId, apsConfigId, alipayCn) { + if (!$scope.paymentInfo.enable_alipayaps) { + commonDialog.alert({ + title: 'ERROR', + content: "AlipayCN channel can be switched only after Alipay+(APS) is enabled", + type: 'error', + }) + $scope.loadPartnerPaymentInfo() + } else { + $http.put('/sys/partners/aps/' + clientId, {id: apsConfigId, alipayCnSwitch: alipayCn}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change alipayCN channel permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + } + $scope.toggleChannel = function (channel) { + if (!channel) { + return + } + if (!$scope.paymentInfo) { + return + } + // if (!$scope.init.channel[channel]) { + // $scope.init.channel[channel] = true + // return + // } + if($scope.paymentInfo.alipay_cn_switch){ + commonDialog.alert({ + title: 'ERROR', + content: "Please switch AlipayCN to Alipay channel, and then close Alipay+(APS) channel", + type: 'error', + }) + $scope.loadPartnerPaymentInfo() + return; + } + $scope.getComplianceInfo() + if ($scope.paymentInfo['enable_wechat'] && channel == 'wechat' && $scope.paymentInfo.open_status == 5 && info.length > 0) { + commonDialog + .confirm({ + title: 'Warning', + contentHtml: $sce.trustAsHtml('本次提交的商户[' + $scope.partner.company_name + '],' + info.toString() + '存在微信渠道不合规信息'), + }) + .then(function () { + $scope.saveChannel(channel) + }) + } else { + $scope.saveChannel(channel) + } + info = [] + } + $scope.saveChannel = function (channel) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/channels/' + channel + '/permission', {allow: $scope.paymentInfo['enable_' + channel]}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change ' + channel + ' channel permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + $scope.toggleHfLink = function (channel) { + if (!channel) { + return + } + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.hf_Link) { + $scope.init.hf_Link = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/hf', {allow: $scope.paymentInfo.enable_link}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change enable_link permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.toggleGatewayLink = function (channel) { + if (!channel) { + return + } + if (!$scope.paymentInfo) { + return + } + var channelLink = 'enable_' + channel + '_link' + if (!$scope.init[channelLink]) { + $scope.init[channelLink] = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/' + channel, {allow: $scope.paymentInfo[channelLink]}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change ' + channelLink + ' permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.toggleCBBankPayLink = function () { + if (!$scope.paymentInfo) { + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/cb_bankpay', {allow: $scope.paymentInfo.enable_cb_bankpay_link}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change cb_bankpay permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + $scope.cb_bankpay = [] + $scope.cbChannelConfig = function () { + $http.get('/sysconfig/payment/config').then(function (resp) { + resp.data.forEach(function (channel) { + if (channel.type === 1) { + $scope.cb_bankpay.push(channel) + } + }) + }) + } + $scope.cbChannelConfig() + $scope.updateCBBankPayConfig = function (key, channel) { + var content = '' + if (channel == null) { + content = '你确定要将支付通道跟随系统' + } else { + content = '你确定要将支付通道更改为:' + channel + } + commonDialog + .confirm({ + title: 'Confirm', + content: content, + }) + .then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/cb_bankpay/' + key + '/channel_id', {channel_id: channel}).then( + function (resp) { + commonDialog.alert({type: 'success', title: 'Success', content: '修改成功'}) + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message}) + $scope.loadPartnerPaymentInfo() + } + ) + }) + } + $scope.toggleGatewayEmailNotice = function (channel) { + if (!$scope.paymentInfo) { + return + } + var channelNotice = 'enable_' + channel + '_email_notice' + if (!$scope.init[channelNotice]) { + $scope.init[channelNotice] = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/' + channel + '/email_notice', {allow: $scope.paymentInfo[channelNotice]}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change ' + channelNotice + ' permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.toggleHfEmailNotice = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.enable_hf_email_notice) { + $scope.init.enable_hf_email_notice = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/hf/email_notice', {allow: $scope.paymentInfo.enable_hf_email_notice}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change enable_hf_email_notice permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.toggleJsApi = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.jsapi) { + $scope.init.jsapi = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/jsapi_permission', {allow: $scope.paymentInfo.enable_jsapi}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change JSApi permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + $scope.toggleGateway = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.gateway) { + $scope.init.gateway = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/gateway_permission', {allow: $scope.paymentInfo.enable_gateway}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change Gateway permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + $scope.toggleGatewayUpgrade = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.gateway_upgrade) { + $scope.init.gateway_upgrade = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/gateway_upgrade', {gateway_upgrade: $scope.paymentInfo.gateway_upgrade}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change Gateway Upgrade status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + $scope.toggleGatewayAlipayOnline = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.gateway_alipay_online) { + $scope.init.gateway_alipay_online = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/gateway_alipay_online', {gateway_alipay_online: $scope.paymentInfo.gateway_alipay_online}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change Gateway Alipay Online status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + $scope.toggleRefund = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.enable_refund) { + $scope.init.enable_refund = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/refund_permission', {allow: $scope.paymentInfo.enable_refund}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change Refund permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + $scope.togglePreRefund = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.enable_pre_refund) { + $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 () { + $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 Offline permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.switchInternationalCard = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.enable_International_card) { + $scope.init.enable_International_card = true + return + } + $http + .put('/sys/partners/' + $scope.partner.client_moniker + '/payment_card_permission', { + key: 'enable_international_card', + allow: $scope.paymentInfo.enable_international_card, + }) + .then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change international card permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.switchThreeDS = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.enable_threeds) { + $scope.init.enable_threeds = true + return + } + $http + .put('/sys/partners/' + $scope.partner.client_moniker + '/payment_card_permission', { + allow: $scope.paymentInfo.enable_threeds, + key: 'enable_threeds', + }) + .then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change international card permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.changePaymentPage = function () { + if (!$scope.paymentInfo) { + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_page_version', {paypad_version: $scope.paymentInfo.paypad_version}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change Payment Page Version', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.changeCBBankPaymentPage = function () { + if (!$scope.paymentInfo) { + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/cbbank_payment_page_version', {cbbank_paypad_version: $scope.paymentInfo.cbbank_paypad_version}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change CBBank Payment Page Version', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + // 更改支付成功页 + $scope.changePaySuccessPage = function () { + if (!$scope.paymentInfo) { + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/paysuccess_version', {paysuccess_version: $scope.paymentInfo.paysuccess_version}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change Payment Success Page Version', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.toggleRequireCustInfo = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.require_custinfo) { + $scope.init.require_custinfo = true + return + } + $http.post('/sys/partners/' + $scope.partner.client_moniker + '/requireCustinfo', {allow: $scope.paymentInfo.require_custinfo}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change require customer Info permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.toggleRequireRemark = function () { + if (!$scope.paymentInfo) { + return + } + if (!$scope.init.require_remark) { + $scope.init.require_remark = true + return + } + $http.post('/sys/partners/' + $scope.partner.client_moniker + '/requireRemark', {allow: $scope.paymentInfo.require_remark}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change require remark permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.changeBillCodeVersion = function () { + if (!$scope.paymentInfo) { + return + } + $http.post('/sys/partners/' + $scope.partner.client_moniker + '/selectBillVersion', {version: $scope.paymentInfo.billcode_version}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'failed to change require bill version permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.extChangeParam = function (name, value) { + var flag = true + $scope.convertExtParams.forEach(function (params) { + if (params.name == name && value == '' && params.type == 'string') { + flag = false + } + }) + if (flag) { + $http + .put('/sys/partners/' + $scope.partner.client_moniker + '/ext_config', { + key: name, + value: value, + }) + .then(function () { + $scope.loadPartnerPaymentInfo() + }) + } + } + + $scope.queryWechatSubMerchantIdStatus = function () { + $scope.paymentInfo.sub_merchant_id + $http.get('/sys/partners/' + $scope.paymentInfo.client_moniker + '/get_merchant_ids/' + $scope.paymentInfo.sub_merchant_id + '/status').then(function (resp) { + commonDialog.alert({ + title: 'Wechat Apply Status(' + resp.data.apply_status + ')', + content: resp.data.response_str, + type: 'info', + }) + }) + } + // GatewayAlipay渠道 + $scope.setAlipayChannel = function () { + if (!$scope.paymentInfo) { + return + } + $http.put('/sys/partners/modifyAlipayPaymentChannels/' + $scope.partner.client_id + '/' + $scope.paymentInfo.alipay_payment_channels).then( + function (resp) { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'error', + }) + } + ) + } + }, + ]) + app.controller('clientSubMerchantIdLogCtrl', [ + '$scope', + '$http', + 'logs', + function ($scope, $http, logs) { + $scope.logs = logs.data + }, + ]) + app.controller('partnerSubCtrl', [ + '$scope', + '$http', + '$uibModal', + function ($scope, $http, $uibModal) { + $scope.toShow = false + $scope.init = { + child_each_refund: false, + sub_manage: false, + } + + $scope.newSubClient = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/add_sub_partner_dialog.html', + controller: 'partnerNewSubPartnerDialogCtrl', + size: 'lg', + resolve: { + clientMoniker: function () { + return $scope.partner.client_moniker + }, + }, + }) + .result.then(function () { + $scope.loadSubClients(1) + }) + } + + $scope.loadSubClients = function (page) { + var params = {} + params.page = page || $scope.pagination.page || 1 + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients/page', {params: params}).then(function (resp) { + $scope.subPartners = resp.data.data + $scope.pagination = resp.data.pagination + }) + } + + $scope.loadSubClients(1) + + $scope.loadPartnerPaymentInfo = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { + $scope.paymentInfo = resp.data + }) + } + $scope.loadPartnerPaymentInfo() + + $scope.switchSubManage = function () { + if (!$scope.paymentInfo) { + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/sub_manage', {allow: $scope.partner.sub_manage}).then( + function () { + //$scope.loadPartnerPaymentInfo(); + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change Sub Partners Manage status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.switchChildEachRefund = function () { + if (!$scope.partner) { + return + } + if (!$scope.init.child_each_refund) { + $scope.init.child_each_refund = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/child_each_refund', {allow: $scope.partner.child_each_refund}).then( + function () { + $scope.loadPartnerPaymentInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change Sub Partners Manage status', + content: resp.data.message, + type: 'error', + }) + } + ) + } + + $scope.showClient = function (sub_client) { + if ($scope.sub_client_id == sub_client.client_id) { + return + } + $scope.client_monikers = sub_client.level3Clients + $scope.sub_client_id = sub_client.client_id + } + }, + ]) + 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', modify_min_settle: false} + $scope.init = { + skip_clearing: false, + tax_in_surcharge: false, + customer_tax_free: false, + allow_surcharge_credit: false, + } + $scope.getBankAccount = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/bank_account').then(function (resp) { + $scope.bankaccount = resp.data + $scope.bankCtrl.edit = false + }) + } + $scope.switchSurchargeMode = function () { + if ($scope.partner.surcharge_mode === 'balance') { + commonDialog + .confirm({ + title: 'Warning', + content: '启用收支分离模式清算将使消费者支付手续费模式失效,请确认是否切换?', + }) + .then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_mode', {surcharge_mode: 'distributed'}).then( + function () { + commonDialog.alert({title: 'Success', content: '已切换为收支分离模式', type: 'success'}) + $scope.partner.surcharge_mode = 'distributed' + $scope.getBalance() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + }) + } else { + commonDialog + .confirm({ + title: 'Warning', + content: '请确认是否切换成净值清算模式?', + }) + .then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_mode', {surcharge_mode: 'balance'}).then( + function () { + commonDialog.alert({title: 'Success', content: '已切换为净值清算模式', type: 'success'}) + $scope.partner.surcharge_mode = 'balance' + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + }) + } + } + $scope.modifyMinSettle = function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/min_settle', {min_settle: $scope.partner.min_settle}).then( + function () { + commonDialog.alert({title: 'Success', content: '修改起结金额成功', type: 'success'}) + $scope.bankCtrl.modify_min_settle = false + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + $scope.getBalance = function () { + $scope.surcharge = {} + + if ($scope.partner.surcharge_mode != undefined && $scope.partner.surcharge_mode === 'distributed') { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_account').then(function (resp) { + $scope.surcharge = resp.data + }) + } + } + $scope.getBalance() + $scope.getBankAccount() + $scope.getRates = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/rates').then(function (resp) { + $scope.rates = resp.data + angular.forEach($scope.rates, function (rate) { + rate.active_time = new Date(rate.active_time.substr(0, 10).replace(/-/g, '/')) + rate.expiry_time = new Date(rate.expiry_time.substr(0, 10).replace(/-/g, '/')) + }) + }) + } + $scope.skipClearing = function (skipClearing) { + if (!$scope.init.skip_clearing) { + $scope.init.skip_clearing = true + return + } + if (skipClearing) { + commonDialog + .confirm({ + title: 'Warning', + content: 'This operation will switch skip clearing status. Are you sure?', + }) + .then(function () { + commonDialog.inputText({title: '请输入跳过清算的原因'}).then(function (text) { + $http + .put('/sys/partners/' + $scope.partner.client_moniker + '/skip_clearing', { + skip_clearing: skipClearing, + remark: text, + }) + .then(function (resp) { + $scope.getBankAccount() + }) + }) + }) + } else { + commonDialog + .confirm({ + title: 'Warning', + content: 'This operation will switch skip clearing status. Are you sure?', + // contentHtml: $sce.trustAsHtml('This operation will switch skip clearing status. Are you sure?') + }) + .then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/skip_clearing', {skip_clearing: skipClearing}).then(function (resp) { + $scope.getBankAccount() + }) + }) + } + } + $scope.surchargeAccountDetail = function () { + $uibModal + .open({ + templateUrl: '/static/payment/surchargeaccount/templates/partner_surcharge_account_dialog.html', + controller: 'surchargeAccountDetailCtrl', + size: 'lg', + resolve: { + balance: function () { + return $scope.surcharge + }, + partner: function () { + return $scope.partner + }, + transactions: [ + '$http', + function ($http) { + return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/account/transactions') + }, + ], + }, + }) + .result.then( + function () { + $scope.getBalance() + }, + function () { + $scope.getBalance() + } + ) + } + $scope.allowSurchargeCredit = function (allowSurchargeCredit) { + if (!$scope.init.allow_surcharge_credit) { + $scope.init.allow_surcharge_credit = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/allow_surcharge_credit', {allow_surcharge_credit: allowSurchargeCredit}).then(function (resp) { + }) + } + $scope.taxInSurcharge = function (taxInSurcharge) { + if (!$scope.init.tax_in_surcharge) { + $scope.init.tax_in_surcharge = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/tax_in_surcharge', {tax_in_surcharge: taxInSurcharge}).then(function (resp) { + $scope.getBankAccount() + }) + } + $scope.switchPreSettle = function (presettle) { + if (!$scope.init.enable_presettle) { + $scope.init.enable_presettle = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/presettle', {enable_presettle: presettle}).then(function (resp) { + $scope.getBankAccount() + }) + } + $scope.customerTaxFree = function (customerTaxFree) { + if (!$scope.init.customer_tax_free) { + $scope.init.customer_tax_free = true + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/customer_tax_free', {customer_tax_free: customerTaxFree}).then(function (resp) { + $scope.getBankAccount() + }) + } + $scope.settleHours = [{value: undefined, label: 'Default(24:00, GMT+10)'}] + for (var h = 24; h > 0; h--) { + $scope.settleHours.push({value: h, label: ('00' + h).substr(-2) + ':00, ' + $scope.partner.timezone}) + } + $scope.settleHourConfig = function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/settle_hour', {hour: $scope.partner.settle_hour || null}).then( + function () { + commonDialog.alert({type: 'success', title: 'OK', content: 'Settle Hour configured'}) + }, + function (resp) { + commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message}) + } + ) + } + $scope.getBankInfo = function (bsb_no) { + if (bsb_no != null && bsb_no !== '') { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/bank_account/bank_info/' + bsb_no).then(function (resp) { + $scope.bankInfo = resp.data + $scope.bankaccount.bank = $scope.bankInfo.bank + $scope.bankaccount.city = $scope.bankInfo.city + $scope.bankaccount.address = $scope.bankInfo.address + $scope.bankaccount.system = $scope.bankInfo.system + $scope.bankaccount.postcode = $scope.bankInfo.postcode + $scope.bankaccount.state = $scope.bankInfo.state + $scope.bankaccount.branch = $scope.bankInfo.branch + }) + } else { + commonDialog.alert({title: 'Error', content: '请先填写BSB No', type: 'error'}) + } + } + $scope.getRates() + $scope.saveBankAccount = function () { + if (isNaN($scope.bankaccount.account_no)) { + alert('Account No应输入数字!') + return + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/bank_account', $scope.bankaccount).then( + function () { + $scope.getBankAccount() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + $scope.newCardPaymentRates = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/partner_new_card_payment_rate.html', + controller: 'newCardPaymentRateDialogCtrl', + resolve: { + sys_common_rate: function () { + return $http.get('/sys/partners/sys_card_rates') + }, + clientMoniker: function () { + return $scope.partner.client_moniker + }, + cost_rate_channel: function () { + return $scope.cost_rate_channel + }, + }, + }) + .result.then(function () { + $scope.getRates() + }) + } + $scope.newRate = function () { + var name = $scope.bankCtrl.rate_name + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/partner_new_rate.html', + controller: 'newRateDialogCtrl', + resolve: { + rate: function () { + return {rate_name: name, clean_days: 3} + }, + sys_common_rate: function () { + return $http.get('/sys/partners/sys_rates') + }, + clientMoniker: function () { + return $scope.partner.client_moniker + }, + }, + }) + .result.then(function () { + $scope.getRates() + }) + } + $scope.editRate = function (rate) { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/rate_config_dialog.html', + controller: 'rateConfigDialogCtrl', + resolve: { + rate: function () { + return rate + }, + clientMoniker: function () { + return $scope.partner.client_moniker + }, + }, + }) + .result.then(function () { + $scope.getRates() + }) + } + + $scope.complianceCheck = function () { + if (!$rootScope.complianceCheck) { + $rootScope.complianceCheck = {} + } + $rootScope.complianceCheck.client_id = $scope.partner.client_id + $rootScope.complianceCheck.bankAccount = true + } + $scope.complianceChangeCheck = function () { + if ($rootScope.complianceCheck) { + if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { + delete $rootScope.complianceCheck + } + } + } + $scope.complianceChangeCheck() + + // 是否为alipayplus + $scope.isAlipayCN = true + // 修改渠道 + $scope.changeAlipayPlusRateState = function (flag) { + $scope.isAlipayCN = flag + } + // 过滤渠道 + $scope.isAlipayPlus = function (item) { + if ($scope.isAlipayCN) { + return item.rate_name === 'AlipayPlus' && (item.pay_type === 'alipay_cn_retail' || item.pay_type === 'alipay_cn_online') + } else { + return item.rate_name === 'AlipayPlus' && item.pay_type === 'alipay_other' + } + } + // 新增alipay+费率 + $scope.newAlipayPlusRate = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/partner_new_alipayplus_rate.html', + resolve: { + rate: function () { + return { + rate_name: 'AlipayPlus', + clean_days: '3', + } + }, + sys_common_rate: function () { + return $http.get('/sys/partners/sys_rates') + }, + clientMoniker: function () { + return $scope.partner.client_moniker + }, + }, + controller: [ + '$scope', + '$http', + 'rate', + 'sys_common_rate', + 'clientMoniker', + function ($scope, $http, rate, sys_common_rate, clientMoniker) { + $scope.rate = angular.copy(rate) + $scope.sysRateConfig = angular.copy(sys_common_rate.data) + $scope.ctrl = {sending: false} + $scope.saveRate = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + $scope.errmsg = null + $scope.ctrl.sending = true + $http.post('/sys/partners/' + clientMoniker + '/rates', $scope.rate).then( + function () { + $scope.ctrl.sending = false + $scope.$close() + }, + function (resp) { + $scope.ctrl.sending = false + $scope.errmsg = resp.data.message + } + ) + } + $scope.changeDays = function () { + // if ($scope.rate.clean_days) { + // switch ($scope.rate.clean_days) { + // case '1': { + // $scope.rate.alipayplus = parseFloat($scope.sysRateConfig.t1.AlipayPlus) + // break + // } + // case '2': { + // $scope.rate.alipayplus = parseFloat($scope.sysRateConfig.t2.AlipayPlus) + // break + // } + // case '3': { + // $scope.rate.alipayplus = parseFloat($scope.sysRateConfig.t3.AlipayPlus) + // break + // } + // } + // } + } + }, + ], + }) + .result.then(function () { + $scope.getRates() + }) + } + }, + ]) + app.controller('surchargeAccountDetailCtrl', [ + '$scope', + '$http', + 'balance', + 'partner', + 'transactions', + 'commonDialog', + function ($scope, $http, balance, partner, transactions, commonDialog) { + $scope.surcharge = angular.copy(balance) + $scope.surchargeDetailData = angular.copy(transactions.data) + $scope.partner = angular.copy(partner) + $scope.canAddDetail = false + $scope.params = {} + + $scope.getBalance = function () { + if ($scope.partner.surcharge_mode != undefined && $scope.partner.surcharge_mode == 'distributed') { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_account').then(function (resp) { + $scope.surcharge = resp.data + }) + } + } + + $scope.getTransactions = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/account/transactions').then(function (resp) { + $scope.surchargeDetailData = resp.data + }) + } + + $scope.addDetail = function () { + $scope.canAddDetail = true + } + + $scope.cancel = function () { + $scope.canAddDetail = false + $scope.params = {} + } + $scope.save = function () { + $http + .post('/sys/partners/' + $scope.partner.client_moniker + '/account/save', { + amount: $scope.params.amount, + remark: $scope.params.remark, + }) + .then( + function (resp) { + $scope.getTransactions() + $scope.getBalance() + $scope.canAddDetail = false + $scope.params = {} + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + }, + ]) + app.controller('newCardPaymentRateDialogCtrl', [ + '$scope', + '$http', + 'sys_common_rate', + 'clientMoniker', + function ($scope, $http, sys_common_rate, clientMoniker) { + $scope.rate = {} + $scope.card_payment_normal = true + $scope.card_payment_switch_title = 'Direct Debit' + $scope.card_payment = [ + { + type: 'rpaypmt_card', + title: 'Card Payment', + }, + { + type: 'rpaypmt_dd', + title: 'Direct Debit', + }, + ] + $scope.cardRateConfig = $scope.card_payment[0] + $scope.switchCardRateConfig = function () { + $scope.card_payment_normal = !$scope.card_payment_normal + $scope.rate = {} + if ($scope.card_payment_normal) { + $scope.cardRateConfig = $scope.card_payment[0] + $scope.card_payment_switch_title = 'Direct Debit' + } else { + $scope.cardRateConfig = $scope.card_payment[1] + $scope.card_payment_switch_title = 'Card Payment' + } + } + $scope.sysRateConfig = angular.copy(sys_common_rate.data) + $scope.ctrl = {sending: false} + $scope.saveRate = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + $scope.errmsg = null + $scope.ctrl.sending = true + $scope.rate.type = $scope.cardRateConfig.type + $http.post('/sys/partners/' + clientMoniker + '/rates', $scope.rate).then( + function () { + $scope.ctrl.sending = false + $scope.$close() + }, + function (resp) { + $scope.ctrl.sending = false + $scope.errmsg = resp.data.message + } + ) + } + $scope.changeDays = function () { + if ($scope.rate.clean_days && $scope.card_payment_normal) { + switch ($scope.rate.clean_days) { + case '1': { + $scope.rate.rate_value = parseFloat($scope.sysRateConfig.t1.domestic_rate) + $scope.rate.transaction_fee = parseFloat($scope.sysRateConfig.t1.transaction_fee) + break + } + case '2': { + $scope.rate.rate_value = parseFloat($scope.sysRateConfig.t2.domestic_rate) + $scope.rate.transaction_fee = parseFloat($scope.sysRateConfig.t2.transaction_fee) + break + } + case '3': { + $scope.rate.rate_value = parseFloat($scope.sysRateConfig.t3.domestic_rate) + $scope.rate.transaction_fee = parseFloat($scope.sysRateConfig.t3.transaction_fee) + break + } + } + } + } + }, + ]) + app.controller('newRateDialogCtrl', [ + '$scope', + '$http', + 'rate', + 'sys_common_rate', + 'clientMoniker', + function ($scope, $http, rate, sys_common_rate, clientMoniker) { + $scope.rate = angular.copy(rate) + $scope.sysRateConfig = angular.copy(sys_common_rate.data) + $scope.ctrl = {sending: false} + $scope.saveRate = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + $scope.errmsg = null + $scope.ctrl.sending = true + $http.post('/sys/partners/' + clientMoniker + '/rates', $scope.rate).then( + function () { + $scope.ctrl.sending = false + $scope.$close() + }, + function (resp) { + $scope.ctrl.sending = false + $scope.errmsg = resp.data.message + } + ) + } + $scope.changeDays = function () { + if ($scope.rate.clean_days) { + switch ($scope.rate.clean_days) { + case '1': { + $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t1.Wechat) + $scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t1.Alipay) + $scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t1.AlipayOnline) + $scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t1.Rpay) + $scope.rate.transaction_fee = 0 + break + } + case '2': { + $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t2.Wechat) + $scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t2.Alipay) + $scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t2.AlipayOnline) + $scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t2.Rpay) + $scope.rate.transaction_fee = 0 + break + } + case '3': { + $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t3.Wechat) + $scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t3.Alipay) + $scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t3.AlipayOnline) + $scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t3.Rpay) + $scope.rate.transaction_fee = 0 + break + } + } + } + } + }, + ]) + app.controller('partnerAccountsCtrl', [ + '$scope', + '$http', + '$uibModal', + 'commonDialog', + function ($scope, $http, $uibModal, commonDialog) { + $scope.partnerRoles = partnerRoles + $scope.loadPartnerAccounts = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/accounts').then(function (resp) { + $scope.accounts = resp.data + }) + } + $scope.loadPartnerAccounts() + $scope.addAccount = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/add_partner_account_dialog.html', + controller: 'partnerAddAccountDialogCtrl', + backdrop: false, + resolve: { + partner: function () { + return $scope.partner + }, + }, + }) + .result.then(function () { + $scope.loadPartnerAccounts() + }) + } + $scope.updateAccountRole = function (account) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/accounts/' + account.account_id + '/role', {role: account.role}).then( + function () { + }, + 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.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', + } + $scope.resetPwd = function (account) { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/partner_account_reset_pwd_dialog.html', + controller: 'partnerResetPwdDialogCtrl', + backdrop: false, + size: 'sm', + resolve: { + partner: function () { + return $scope.partner + }, + account: function () { + return account + }, + }, }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } + .result.then(function () { + commonDialog.alert({title: 'Success!', content: 'Password Changed Successfully', type: 'success'}) + }) + } + $scope.disableAccount = function (account) { + commonDialog + .confirm({ + title: 'Confirm Operation', + content: 'Are you sure to disable account ' + account.display_name + ' ?', + }) + .then(function () { + $http.delete('/sys/partners/' + $scope.partner.client_moniker + '/accounts/' + account.account_id).then( + function () { + $scope.loadPartnerAccounts() + }, + function (resp) { + commonDialog.alert({title: 'Fail!', content: resp.data.message, type: 'error'}) + } + ) + }) + } + }, + ]) + app.controller('partnerAddAccountDialogCtrl', [ + '$scope', + '$http', + 'partner', + function ($scope, $http, partner) { + $scope.account = {role: 1} + $scope.partnerRoles = partnerRoles + $scope.account.nation_code = 61 + $scope.saveAccount = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + if ($scope.account.pwd && $scope.account.pwd.length < 8) { + $scope.errmsg = 'Password length must more than 8 !' + return + } + var regex = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/ + if ($scope.account.pwd && !regex.test($scope.account.pwd)) { + $scope.errmsg = 'The password needs to consist of 8-16 digits and letters !' + return + } + $scope.errmsg = null + $http.post('/sys/partners/' + partner.client_moniker + '/accounts', $scope.account).then( + function () { + $scope.$close() + }, + function (resp) { + $scope.errmsg = resp.data.message + } ) - }, - 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({ - title: 'Success', - content: 'Notify BD Successed!.', - type: 'success', - }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - } - ) - } - - $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 () { - return '/sys/partners/' + $scope.partner.client_moniker + '/temp/export/pdf' - } - - $scope.refuse = function () { - commonDialog.inputText({ title: 'refuse cause' }).then(function (text) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/refuse', { refuse_remark: text }).then( - function () { - commonDialog.alert({ - title: 'Success', - content: 'Audit application has been refused.', - type: 'success', - }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - }) - } - - $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', - content: 'Are you sure to delete ' + $scope.partner.company_name + '?', - }) - .then(function () { - $http.delete('/sys/partners/' + $scope.partner.client_moniker).then( - function () { - $state.go('^') - commonDialog.alert({ title: 'Delete', content: 'Partner Already Disabled', type: 'error' }) - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - }) - } - $scope.revertClient = function () { - commonDialog - .confirm({ - title: 'Revert Partner', - content: 'Are you sure to Revert ' + $scope.partner.company_name + '?', - }) - .then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/revert').then( - function () { - $state.go('^') - commonDialog.alert({ title: 'Revert', content: 'Partner Already Revert', type: 'success' }) - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - }) - } - - $scope.commitToCompliance = 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_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.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!', - content: '已提交制作合同!', - type: 'success', - }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - - $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, - }) + } + }, + ]) + app.controller('partnerResetPwdDialogCtrl', [ + '$scope', + '$http', + 'partner', + 'account', + function ($scope, $http, partner, account) { + $scope.updatePwd = function () { + $scope.errmsg = null + if ($scope.reset.pwd && $scope.reset.pwd.length < 8) { + $scope.errmsg = 'Password length must more than 8 !' + return + } + var regex = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/ + if ($scope.reset.pwd && !regex.test($scope.reset.pwd)) { + $scope.errmsg = 'The password needs to consist of 8-16 digits and letters !' + return + } + $http.put('/sys/partners/' + partner.client_moniker + '/accounts/' + account.account_id + '/pwd', {pwd: $scope.reset.pwd}).then( + function () { + $scope.$close() + }, + function (resp) { + $scope.errmsg = resp.data.message + } + ) + } + }, + ]) + app.controller('partnerNewSubPartnerDialogCtrl', [ + '$rootScope', + '$scope', + '$http', + '$state', + 'Upload', + 'commonDialog', + 'timezone', + 'clientMoniker', + 'industryMap', + 'businessStructuresMap', + 'stateMap', + 'countryMap', + 'wechatGoodMcc', + '$filter', + function ($rootScope, $scope, $http, $state, Upload, commonDialog, timezone, clientMoniker, industryMap, businessStructuresMap, stateMap, countryMap, wechatGoodMcc, $filter) { + if ($scope.partner_application) { + $scope.partner = angular.copy($scope.partner_application) + delete $rootScope.partner_application } else { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - } - ) - } - - $scope.commit2GreenChannel = function () { - commonDialog - .confirm({ - title: 'Audit Partner', - content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' Green Channel?', - }) - .then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/compliance/green_channel').then( - function () { - commonDialog.alert({ - title: 'Success', - content: 'Commit to Green Channel successfully', - type: 'success', + $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 }) - $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 (type) { - 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?type=' + type).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('partnerPaymentInfoCtrl', [ - '$scope', - '$http', - '$state', - 'commonDialog', - '$uibModal', - '$sce', - function ($scope, $http, $state, commonDialog, $uibModal, $sce) { - $scope.convertExtParams = [] - $scope.copyHfLink = function () { - var e = document.getElementById('cpbt') - e.select() - var successful = document.execCommand('Copy') - if (successful) { - commonDialog.alert({ title: 'Success', content: '已复制到剪切板!', type: 'success' }) - } else { - commonDialog.alert({ title: 'Error', content: '您的浏览器不支持!', type: 'error' }) - } - } - $scope.copyYeepayLink = function () { - var e = document.getElementById('cpyeepay') - e.select() - var successful = document.execCommand('Copy') - if (successful) { - commonDialog.alert({ title: 'Success', content: '已复制到剪切板!', type: 'success' }) - } else { - commonDialog.alert({ title: 'Error', content: '您的浏览器不支持!', type: 'error' }) - } - } - $scope.copyCBBankPayLink = function () { - var e = document.getElementById('cpcbbankpay') - e.select() - var successful = document.execCommand('Copy') - if (successful) { - commonDialog.alert({ title: 'Success', content: '已复制到剪切板!', type: 'success' }) - } else { - commonDialog.alert({ title: 'Error', content: '您的浏览器不支持!', type: 'error' }) - } - } - $scope.loadPartnerPaymentInfo = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { - $scope.extParams = {} - $scope.paymentInfo = resp.data - $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 - $scope.ctrl.editMaxOrderAmount = false - $scope.ctrl.editOrderExpiryConfig = false - $scope.ctrl.editRefundPwd = false - $scope.ctrl.editRefundCreditLine = false - }) - } - $scope.extParamsEditFlags = function () { - var paramList = [] - if ($scope.extParams != null) { - for (var key in $scope.extParams) { - var obj = {} - if (typeof $scope.extParams[key] != 'boolean') { - obj.name = key - obj.value = $scope.extParams[key] - obj.type = 'string' - obj.flag = false - } else { - obj.name = key - obj.value = $scope.extParams[key] - obj.type = 'boolean' } - paramList.push(obj) - } - } - return paramList - } - $scope.qrConfig = { currency: 'AUD' } - $scope.reloadQRCode = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/qrcode', { params: $scope.qrConfig }).then(function (resp) { - $scope.qrcode = resp.data - }) - } - $scope.reloadQRCode() - $scope.loadPartnerPaymentInfo() - - $scope.showSubMerchantLogs = function () { - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/client_sub_merchant_id_log.html', - controller: 'clientSubMerchantIdLogCtrl', - size: 'lg', - resolve: { - logs: [ - '$http', - function ($http) { - return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_sub_merchant_id_logs') - }, - ], - }, - }) - .result.then(function () { - $scope.loadSubClients() - }) - } - - $scope.saveMaxOrderAmount = function (limit) { - if (limit != null && isNaN(limit)) { - commonDialog.alert({ title: 'Error', content: 'Your input is not a number!', type: 'error' }) - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/max_order_amount', { limit: limit }).then( - function (resp) { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - - $scope.saveCustomerSurchargeRate = function (cofig) { - if (cofig != null && isNaN(cofig)) { - commonDialog.alert({ title: 'Error', content: 'Your input is not a number!', type: 'error' }) - return - } - if (!$scope.paymentInfo.rate_value) { - commonDialog.alert({ - title: 'Error', - content: 'The merchant has not pass approval process', - type: 'error', - }) - return - } - if (cofig > 3 || cofig < parseFloat(Decimal.add($scope.paymentInfo.rate_value, 0.1).toFixed(2))) { - commonDialog.alert({ title: 'Error', content: 'Not in the valid range', type: 'error' }) - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/customer_surcharge_rate', { customer_surcharge_rate: cofig }).then( - function (resp) { - $scope.loadPartnerPaymentInfo() - $scope.ctrl.editCustomerSurchargeRate = false - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - - $scope.saveOrderExpiryConfig = function (config) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/order_expiry_config', { order_expiry_config: config }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - - $scope.resetRefundPwd = function (config) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/reset/refund_pwd', { new_refund_password: config }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - - $scope.setRefundCreditLine = function () { - if (!$scope.paymentInfo) { - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/refund_credit_line', { refund_credit_line: $scope.paymentInfo.refund_credit_line }).then( - function (resp) { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - - $scope.updateClientQRCodePaySurCharge = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.qrcode_surcharge) { - $scope.init.qrcode_surcharge = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/qrcode_surcharge', { qrcode_surcharge: $scope.paymentInfo.qrcode_surcharge }).then( - function (resp) { - $scope.loadPartnerPaymentInfo() - }, - function () { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - $scope.updateClientCBBankPaySurCharge = function () { - if (!$scope.paymentInfo) { - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/cbbank_surcharge', { cbbank_surcharge: $scope.paymentInfo.cbbank_surcharge }).then( - function () { - // $scope.loadPartnerPaymentInfo(); - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change Customer Pay for Surcharge for Retail', - content: resp.data.message, - type: 'error', - }) - } - ) - } - - $scope.updateClientApiSurCharge = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.api_surcharge) { - $scope.init.api_surcharge = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/api_surcharge', { api_surcharge: $scope.paymentInfo.api_surcharge }).then( - function (resp) { - $scope.loadPartnerPaymentInfo() - }, - function () { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - $scope.updateClientRetailPaySurCharge = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.retail_surcharge) { - $scope.init.retail_surcharge = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/retail_surcharge', { retail_surcharge: $scope.paymentInfo.retail_surcharge }).then( - function (resp) { - $scope.loadPartnerPaymentInfo() - }, - function () { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - $scope.ctrl = {} - $scope.saveSubMerchantId = function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', { sub_merchant_id: $scope.paymentInfo.sub_merchant_id }).then( - function (resp) { - $scope.refreshWechatInstitutionMerchantId() - $scope.ctrl.editSubMerchant = false - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - - $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) { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - $scope.saveAliSubMerchantId = function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/ali_sub_merchant_id', { ali_sub_merchant_id: $scope.paymentInfo.ali_sub_merchant_id }).then( - function (resp) { - commonDialog.alert({ - title: 'Success', - content: 'Modify Ali Sub Merchant ID successfully', - type: 'success', - }) - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - $scope.submitAlipaySubId = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms_json').then(function (resp) { - $scope.alipay_gms_json = resp.data - commonDialog - .confirm({ - title: 'Warning', - content: '是否使用该商户的现有信息进件?', - json: $scope.alipay_gms_json, - }) - .then(function () { - $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms').then( - function () { - commonDialog.alert({ title: 'Success', content: 'Alipay进件成功', type: 'success' }) - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: '进件失败:' + resp.data.message, type: 'error' }) + $scope.initMerchantCode() + $scope.partner.company_phone_c = 61 + $scope.partner.contact_phone_c = 61 + $scope.partner.client_pay_type = [] + $scope.partner.client_pay_desc = [] + $scope.merchantIsValid = false + $scope.merchantCodeChecked = false + $scope.wechatMccIndustries = wechatGoodMcc.configs() + $scope.checkExpriedate = function (value) { + if (value) { + $scope.partner.certificat_expire_date_premanent = false + $scope.partner.certificat_expire_date_NA = false } - ) - }) - }) - } - $scope.queryAlipayGms = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms').then( - function (resp) { - commonDialog.alert({ title: 'Success', content: resp.data.result_status, type: 'success' }) - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: '查询失败:' + resp.data.message, type: 'error' }) - } - ) - } - $scope.submitAlipayOnlineSubId = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms_json').then(function (resp) { - $scope.alipayOnline_gms_json = resp.data - commonDialog - .confirm({ - title: 'Warning', - content: '是否使用该商户的现有信息进件?', - json: $scope.alipayOnline_gms_json, - }) - .then(function () { - $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipayOnline_gms').then( - function () { - commonDialog.alert({ title: 'Success', content: '提示:AlipayOnline进件成功', type: 'success' }) - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: '进件失败:' + resp.data.message, type: 'error' }) + } + $scope.checkExpriedateOther = function (value) { + if (value == 'PERMANENT') { + if ($scope.partner.certificat_expire_date_premanent) { + $scope.partner.certificat_expire_date_NA = false + $scope.partner.certificat_expire_date_d = null + } + } else if (value == 'N/A') { + if ($scope.partner.certificat_expire_date_NA) { + $scope.partner.certificat_expire_date_premanent = false + $scope.partner.certificat_expire_date_d = null + } } - ) - }) - }) - } - $scope.queryAlipayOnlineGms = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms').then( - function (resp) { - commonDialog.alert({ title: 'Success', content: resp.data.result_status, type: 'success' }) - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: '查询失败:' + resp.data.message, type: 'error' }) - } - ) - } - $scope.refreshCredential = function () { - commonDialog - .confirm({ - title: 'Warning', - content: 'Refresh Credential will expire the current one, which will cause the current payment service disabled. Are you sure going on?', - }) - .then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/credential_code').then( - function () { - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - }) - } - $scope.init = { - jsapi: false, - gateway: false, - offline: false, - refund: false, - common_sub_merchant_id: false, - channel: {}, - gateway_alipay_online: false, - hf_Link: false, - enable_hf_email_notice: false, - enable_yeepay_link: false, - enable_yeepay_email_notice: false, - } - $scope.switchCommonSubMerchantId = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.common_sub_merchant_id) { - $scope.init.common_sub_merchant_id = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/common_sub_merchant_id', { allow: $scope.paymentInfo.common_sub_merchant_id }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'Failed to change common_sub_merchant_id permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } + } + 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.switchSubManage = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.sub_manage) { - $scope.init.sub_manage = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/sub_manage', { allow: $scope.paymentInfo.sub_manage }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'Failed to change Sub Partners Manage status', - content: resp.data.message, - type: 'error', - }) - } - ) - } - - var info = [] - $scope.decideCompliance = function (name) { - var keywords = ['education', 'financial', 'train', 'immigrant', 'invest', '律师咨询', '会计事务所', '移民', '留学', '娱乐', '金融', '地产', '投资'] - for (var i = 0; i < keywords.length; i++) { - if (name.indexOf(keywords[i]) != -1) { - return true - } - } - return false - } - $scope.getComplianceInfo = function () { - if ($scope.paymentInfo.company_name != null) { - if ($scope.decideCompliance($scope.paymentInfo.company_name)) { - info.push('Company Name') - } - } - if ($scope.paymentInfo.short_name != null) { - if ($scope.decideCompliance($scope.paymentInfo.short_name)) { - info.push('Short Name') - } - } - if ($scope.paymentInfo.business_structure != null) { - if ($scope.decideCompliance($scope.paymentInfo.business_structure)) { - info.push('Business Structure') - } - } - } - $scope.toggleChannel = function (channel) { - if (!channel) { - return - } - if (!$scope.paymentInfo) { - return - } - // if (!$scope.init.channel[channel]) { - // $scope.init.channel[channel] = true - // return - // } - $scope.getComplianceInfo() - if ($scope.paymentInfo['enable_wechat'] && channel == 'wechat' && $scope.paymentInfo.open_status == 5 && info.length > 0) { - commonDialog - .confirm({ - title: 'Warning', - contentHtml: $sce.trustAsHtml('本次提交的商户[' + $scope.partner.company_name + '],' + info.toString() + '存在微信渠道不合规信息'), - }) - .then(function () { - $scope.saveChannel(channel) - }) - } else { - $scope.saveChannel(channel) - } - info = [] - } - $scope.saveChannel = function (channel) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/channels/' + channel + '/permission', { allow: $scope.paymentInfo['enable_' + channel] }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'Failed to change ' + channel + ' channel permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } - $scope.toggleHfLink = function (channel) { - if (!channel) { - return - } - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.hf_Link) { - $scope.init.hf_Link = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/hf', { allow: $scope.paymentInfo.enable_link }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'Failed to change enable_link permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } + 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) { + 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) { + 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.business_structures = businessStructuresMap.configs() + $scope.industries = industryMap.configs() - $scope.toggleGatewayLink = function (channel) { - if (!channel) { - return - } - if (!$scope.paymentInfo) { - return - } - var channelLink = 'enable_' + channel + '_link' - if (!$scope.init[channelLink]) { - $scope.init[channelLink] = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/' + channel, { allow: $scope.paymentInfo[channelLink] }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'Failed to change ' + channelLink + ' permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } + $scope.listReferrers = function () { + $http.get('/sys/orgs/referrer').then(function (resp) { + $scope.referrers = resp.data + }) + } + $scope.listReferrers() - $scope.toggleCBBankPayLink = function () { - if (!$scope.paymentInfo) { - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/cb_bankpay', { allow: $scope.paymentInfo.enable_cb_bankpay_link }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'Failed to change cb_bankpay permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } - $scope.cb_bankpay = [] - $scope.cbChannelConfig = function () { - $http.get('/sysconfig/payment/config').then(function (resp) { - resp.data.forEach(function (channel) { - if (channel.type === 1) { - $scope.cb_bankpay.push(channel) - } - }) - }) - } - $scope.cbChannelConfig() - $scope.updateCBBankPayConfig = function (key, channel) { - var content = '' - if (channel == null) { - content = '你确定要将支付通道跟随系统' - } else { - content = '你确定要将支付通道更改为:' + channel - } - commonDialog - .confirm({ - title: 'Confirm', - content: content, - }) - .then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/cb_bankpay/' + key + '/channel_id', { channel_id: channel }).then( - function (resp) { - commonDialog.alert({ type: 'success', title: 'Success', content: '修改成功' }) - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ type: 'error', title: 'Error', content: resp.data.message }) - $scope.loadPartnerPaymentInfo() - } - ) - }) - } - $scope.toggleGatewayEmailNotice = function (channel) { - if (!$scope.paymentInfo) { - return - } - var channelNotice = 'enable_' + channel + '_email_notice' - if (!$scope.init[channelNotice]) { - $scope.init[channelNotice] = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/' + channel + '/email_notice', { allow: $scope.paymentInfo[channelNotice] }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'Failed to change ' + channelNotice + ' permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } + $scope.alipayMccCategory = {} + $scope.loadAlipayCategory = function () { + $http.get('/static/data/alipayMcc.json').then(function (resp) { + $scope.alipayMccCategory = resp.data + }) + } + $scope.loadAlipayCategory() - $scope.toggleHfEmailNotice = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.enable_hf_email_notice) { - $scope.init.enable_hf_email_notice = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/hf/email_notice', { allow: $scope.paymentInfo.enable_hf_email_notice }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'Failed to change enable_hf_email_notice permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } + $scope.loadJDindustry = function () { + $http.get('/static/data/jdindustry.json').then(function (resp) { + $scope.jdindustry = resp.data + }) + } + $scope.loadJDindustry() - $scope.toggleJsApi = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.jsapi) { - $scope.init.jsapi = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/jsapi_permission', { allow: $scope.paymentInfo.enable_jsapi }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'Failed to change JSApi permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } - $scope.toggleGateway = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.gateway) { - $scope.init.gateway = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/gateway_permission', { allow: $scope.paymentInfo.enable_gateway }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change Gateway permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } - $scope.toggleGatewayUpgrade = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.gateway_upgrade) { - $scope.init.gateway_upgrade = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/gateway_upgrade', { gateway_upgrade: $scope.paymentInfo.gateway_upgrade }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change Gateway Upgrade status', - content: resp.data.message, - type: 'error', - }) - } - ) - } - $scope.toggleGatewayAlipayOnline = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.gateway_alipay_online) { - $scope.init.gateway_alipay_online = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/gateway_alipay_online', { gateway_alipay_online: $scope.paymentInfo.gateway_alipay_online }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change Gateway Alipay Online status', - content: resp.data.message, - type: 'error', - }) - } - ) - } - $scope.toggleRefund = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.enable_refund) { - $scope.init.enable_refund = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/refund_permission', { allow: $scope.paymentInfo.enable_refund }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change Refund permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } - $scope.togglePreRefund = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.enable_pre_refund) { - $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 () { - $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 Offline permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } + $scope.loadLakalaPayindustry = function () { + $http.get('/static/data/lakalapayindustry.json').then(function (resp) { + $scope.lakalapayindustry = resp.data + }) + } + $scope.loadLakalaPayindustry() - $scope.switchInternationalCard = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.enable_International_card) { - $scope.init.enable_International_card = true - return - } - $http - .put('/sys/partners/' + $scope.partner.client_moniker + '/payment_card_permission', { - key: 'enable_international_card', - allow: $scope.paymentInfo.enable_international_card, - }) - .then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change international card permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } - - $scope.switchThreeDS = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.enable_threeds) { - $scope.init.enable_threeds = true - return - } - $http - .put('/sys/partners/' + $scope.partner.client_moniker + '/payment_card_permission', { - allow: $scope.paymentInfo.enable_threeds, - key: 'enable_threeds', - }) - .then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change international card permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } - - $scope.changePaymentPage = function () { - if (!$scope.paymentInfo) { - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_page_version', { paypad_version: $scope.paymentInfo.paypad_version }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change Payment Page Version', - content: resp.data.message, - type: 'error', - }) - } - ) - } + $scope.loadLakalaPaySettle = function () { + $http.get('/static/data/lakalapaysettle.json').then(function (resp) { + $scope.lakalapaysettle = resp.data + }) + } + $scope.loadLakalaPaySettle() - $scope.changeCBBankPaymentPage = function () { - if (!$scope.paymentInfo) { - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/cbbank_payment_page_version', { cbbank_paypad_version: $scope.paymentInfo.cbbank_paypad_version }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change CBBank Payment Page Version', - content: resp.data.message, - type: 'error', - }) - } - ) - } - - // 更改支付成功页 - $scope.changePaySuccessPage = function () { - if (!$scope.paymentInfo) { - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/paysuccess_version', { paysuccess_version: $scope.paymentInfo.paysuccess_version }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change Payment Success Page Version', - content: resp.data.message, - type: 'error', - }) - } - ) - } + $scope.loadLakalaPayGoods = function () { + $http.get('/static/data/lakalapaygoods.json').then(function (resp) { + $scope.lakalapaygoods = resp.data + }) + } + $scope.loadLakalaPayGoods() - $scope.toggleRequireCustInfo = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.require_custinfo) { - $scope.init.require_custinfo = true - return - } - $http.post('/sys/partners/' + $scope.partner.client_moniker + '/requireCustinfo', { allow: $scope.paymentInfo.require_custinfo }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change require customer Info permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } + $scope.loadRoyalpayindustry = function () { + $http.get('/static/data/royalpayindustry.json').then(function (resp) { + $scope.royalpayindustry = resp.data + }) + } + $scope.loadRoyalpayindustry() - $scope.toggleRequireRemark = function () { - if (!$scope.paymentInfo) { - return - } - if (!$scope.init.require_remark) { - $scope.init.require_remark = true - return - } - $http.post('/sys/partners/' + $scope.partner.client_moniker + '/requireRemark', { allow: $scope.paymentInfo.require_remark }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change require remark permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } + $scope.loadHfindustry = function () { + $http.get('/static/data/hfindustry.json').then(function (resp) { + $scope.hfindustry = resp.data + }) + } + $scope.loadHfindustry() - $scope.changeBillCodeVersion = function () { - if (!$scope.paymentInfo) { - return - } - $http.post('/sys/partners/' + $scope.partner.client_moniker + '/selectBillVersion', { version: $scope.paymentInfo.billcode_version }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'failed to change require bill version permission status', - content: resp.data.message, - type: 'error', - }) - } - ) - } - - $scope.extChangeParam = function (name, value) { - var flag = true - $scope.convertExtParams.forEach(function (params) { - if (params.name == name && value == '' && params.type == 'string') { - flag = false - } - }) - if (flag) { - $http - .put('/sys/partners/' + $scope.partner.client_moniker + '/ext_config', { - key: name, - value: value, - }) - .then(function () { - $scope.loadPartnerPaymentInfo() - }) - } - } - - $scope.queryWechatSubMerchantIdStatus = function () { - $scope.paymentInfo.sub_merchant_id - $http.get('/sys/partners/' + $scope.paymentInfo.client_moniker + '/get_merchant_ids/' + $scope.paymentInfo.sub_merchant_id + '/status').then(function (resp) { - commonDialog.alert({ - title: 'Wechat Apply Status(' + resp.data.apply_status + ')', - content: resp.data.response_str, - type: 'info', - }) - }) - } - // GatewayAlipay渠道 - $scope.setAlipayChannel = function () { - if (!$scope.paymentInfo) { - return - } - $http.put('/sys/partners/modifyAlipayPaymentChannels/' + $scope.partner.client_id + '/' + $scope.paymentInfo.alipay_payment_channels).then( - function (resp) { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'Error', - content: resp.data.message, - type: 'error', - }) - } - ) - } - }, - ]) - app.controller('clientSubMerchantIdLogCtrl', [ - '$scope', - '$http', - 'logs', - function ($scope, $http, logs) { - $scope.logs = logs.data - }, - ]) - app.controller('partnerSubCtrl', [ - '$scope', - '$http', - '$uibModal', - function ($scope, $http, $uibModal) { - $scope.toShow = false - $scope.init = { - child_each_refund: false, - sub_manage: false, - } - - $scope.newSubClient = function () { - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/add_sub_partner_dialog.html', - controller: 'partnerNewSubPartnerDialogCtrl', - size: 'lg', - resolve: { - clientMoniker: function () { - return $scope.partner.client_moniker - }, - }, - }) - .result.then(function () { - $scope.loadSubClients(1) - }) - } - - $scope.loadSubClients = function (page) { - var params = {} - params.page = page || $scope.pagination.page || 1 - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients/page', { params: params }).then(function (resp) { - $scope.subPartners = resp.data.data - $scope.pagination = resp.data.pagination - }) - } - - $scope.loadSubClients(1) - - $scope.loadPartnerPaymentInfo = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { - $scope.paymentInfo = resp.data - }) - } - $scope.loadPartnerPaymentInfo() - - $scope.switchSubManage = function () { - if (!$scope.paymentInfo) { - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/sub_manage', { allow: $scope.partner.sub_manage }).then( - function () { - //$scope.loadPartnerPaymentInfo(); - }, - function (resp) { - commonDialog.alert({ - title: 'Failed to change Sub Partners Manage status', - content: resp.data.message, - type: 'error', - }) - } - ) - } + $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.switchChildEachRefund = function () { - if (!$scope.partner) { - return - } - if (!$scope.init.child_each_refund) { - $scope.init.child_each_refund = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/child_each_refund', { allow: $scope.partner.child_each_refund }).then( - function () { - $scope.loadPartnerPaymentInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'Failed to change Sub Partners Manage status', - content: resp.data.message, - type: 'error', - }) - } - ) - } + $scope.onHfIndustrySelect = function (selectedItem) { + $scope.partner.hf_label = selectedItem.label + $scope.partner.hfindustry = selectedItem.mccCode + } - $scope.showClient = function (sub_client) { - if ($scope.sub_client_id == sub_client.client_id) { - return - } - $scope.client_monikers = sub_client.level3Clients - $scope.sub_client_id = sub_client.client_id - } - }, - ]) - 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', modify_min_settle: false } - $scope.init = { - skip_clearing: false, - tax_in_surcharge: false, - customer_tax_free: false, - allow_surcharge_credit: false, - } - $scope.getBankAccount = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/bank_account').then(function (resp) { - $scope.bankaccount = resp.data - $scope.bankCtrl.edit = false - }) - } - $scope.switchSurchargeMode = function () { - if ($scope.partner.surcharge_mode === 'balance') { - commonDialog - .confirm({ - title: 'Warning', - content: '启用收支分离模式清算将使消费者支付手续费模式失效,请确认是否切换?', - }) - .then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_mode', { surcharge_mode: 'distributed' }).then( - function () { - commonDialog.alert({ title: 'Success', content: '已切换为收支分离模式', type: 'success' }) - $scope.partner.surcharge_mode = 'distributed' - $scope.getBalance() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) + // $scope.t2city_map = angular.copy(t2city_map); + + $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 } - ) - }) - } else { - commonDialog - .confirm({ - title: 'Warning', - content: '请确认是否切换成净值清算模式?', - }) - .then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_mode', { surcharge_mode: 'balance' }).then( - function () { - commonDialog.alert({ title: 'Success', content: '已切换为净值清算模式', type: 'success' }) - $scope.partner.surcharge_mode = 'balance' - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) + } + + $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.modifyMinSettle = function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/min_settle', { min_settle: $scope.partner.min_settle }).then( - function () { - commonDialog.alert({ title: 'Success', content: '修改起结金额成功', type: 'success' }) - $scope.bankCtrl.modify_min_settle = false - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - $scope.getBalance = function () { - $scope.surcharge = {} - - if ($scope.partner.surcharge_mode != undefined && $scope.partner.surcharge_mode === 'distributed') { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_account').then(function (resp) { - $scope.surcharge = resp.data - }) - } - } - $scope.getBalance() - $scope.getBankAccount() - $scope.getRates = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/rates').then(function (resp) { - $scope.rates = resp.data - angular.forEach($scope.rates, function (rate) { - rate.active_time = new Date(rate.active_time.substr(0, 10).replace(/-/g, '/')) - rate.expiry_time = new Date(rate.expiry_time.substr(0, 10).replace(/-/g, '/')) - }) - }) - } - $scope.skipClearing = function (skipClearing) { - if (!$scope.init.skip_clearing) { - $scope.init.skip_clearing = true - return - } - if (skipClearing) { - commonDialog - .confirm({ - title: 'Warning', - content: 'This operation will switch skip clearing status. Are you sure?', - }) - .then(function () { - commonDialog.inputText({ title: '请输入跳过清算的原因' }).then(function (text) { - $http - .put('/sys/partners/' + $scope.partner.client_moniker + '/skip_clearing', { - skip_clearing: skipClearing, - remark: text, - }) - .then(function (resp) { - $scope.getBankAccount() - }) - }) - }) - } else { - commonDialog - .confirm({ - title: 'Warning', - content: 'This operation will switch skip clearing status. Are you sure?', - // contentHtml: $sce.trustAsHtml('This operation will switch skip clearing status. Are you sure?') - }) - .then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/skip_clearing', { skip_clearing: skipClearing }).then(function (resp) { - $scope.getBankAccount() - }) - }) - } - } - $scope.surchargeAccountDetail = function () { - $uibModal - .open({ - templateUrl: '/static/payment/surchargeaccount/templates/partner_surcharge_account_dialog.html', - controller: 'surchargeAccountDetailCtrl', - size: 'lg', - resolve: { - balance: function () { - return $scope.surcharge - }, - partner: function () { - return $scope.partner - }, - transactions: [ - '$http', - function ($http) { - return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/account/transactions') - }, - ], - }, - }) - .result.then( - function () { - $scope.getBalance() - }, - function () { - $scope.getBalance() - } - ) - } - $scope.allowSurchargeCredit = function (allowSurchargeCredit) { - if (!$scope.init.allow_surcharge_credit) { - $scope.init.allow_surcharge_credit = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/allow_surcharge_credit', { allow_surcharge_credit: allowSurchargeCredit }).then(function (resp) {}) - } - $scope.taxInSurcharge = function (taxInSurcharge) { - if (!$scope.init.tax_in_surcharge) { - $scope.init.tax_in_surcharge = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/tax_in_surcharge', { tax_in_surcharge: taxInSurcharge }).then(function (resp) { - $scope.getBankAccount() - }) - } - $scope.switchPreSettle = function (presettle) { - if (!$scope.init.enable_presettle) { - $scope.init.enable_presettle = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/presettle', { enable_presettle: presettle }).then(function (resp) { - $scope.getBankAccount() - }) - } - $scope.customerTaxFree = function (customerTaxFree) { - if (!$scope.init.customer_tax_free) { - $scope.init.customer_tax_free = true - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/customer_tax_free', { customer_tax_free: customerTaxFree }).then(function (resp) { - $scope.getBankAccount() - }) - } - $scope.settleHours = [{ value: undefined, label: 'Default(24:00, GMT+10)' }] - for (var h = 24; h > 0; h--) { - $scope.settleHours.push({ value: h, label: ('00' + h).substr(-2) + ':00, ' + $scope.partner.timezone }) - } - $scope.settleHourConfig = function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/settle_hour', { hour: $scope.partner.settle_hour || null }).then( - function () { - commonDialog.alert({ type: 'success', title: 'OK', content: 'Settle Hour configured' }) - }, - function (resp) { - commonDialog.alert({ type: 'error', title: 'Error', content: resp.data.message }) - } - ) - } - $scope.getBankInfo = function (bsb_no) { - if (bsb_no != null && bsb_no !== '') { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/bank_account/bank_info/' + bsb_no).then(function (resp) { - $scope.bankInfo = resp.data - $scope.bankaccount.bank = $scope.bankInfo.bank - $scope.bankaccount.city = $scope.bankInfo.city - $scope.bankaccount.address = $scope.bankInfo.address - $scope.bankaccount.system = $scope.bankInfo.system - $scope.bankaccount.postcode = $scope.bankInfo.postcode - $scope.bankaccount.state = $scope.bankInfo.state - $scope.bankaccount.branch = $scope.bankInfo.branch - }) - } else { - commonDialog.alert({ title: 'Error', content: '请先填写BSB No', type: 'error' }) - } - } - $scope.getRates() - $scope.saveBankAccount = function () { - if (isNaN($scope.bankaccount.account_no)) { - alert('Account No应输入数字!') - return - } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/bank_account', $scope.bankaccount).then( - function () { - $scope.getBankAccount() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - $scope.newCardPaymentRates = function () { - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/partner_new_card_payment_rate.html', - controller: 'newCardPaymentRateDialogCtrl', - resolve: { - sys_common_rate: function () { - return $http.get('/sys/partners/sys_card_rates') - }, - clientMoniker: function () { - return $scope.partner.client_moniker - }, - cost_rate_channel: function () { - return $scope.cost_rate_channel - }, - }, - }) - .result.then(function () { - $scope.getRates() - }) - } - $scope.newRate = function () { - var name = $scope.bankCtrl.rate_name - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/partner_new_rate.html', - controller: 'newRateDialogCtrl', - resolve: { - rate: function () { - return { rate_name: name, clean_days: 3 } - }, - sys_common_rate: function () { - return $http.get('/sys/partners/sys_rates') - }, - clientMoniker: function () { - return $scope.partner.client_moniker - }, - }, - }) - .result.then(function () { - $scope.getRates() - }) - } - $scope.editRate = function (rate) { - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/rate_config_dialog.html', - controller: 'rateConfigDialogCtrl', - resolve: { - rate: function () { - return rate - }, - clientMoniker: function () { - return $scope.partner.client_moniker - }, - }, - }) - .result.then(function () { - $scope.getRates() - }) - } + } - $scope.complianceCheck = function () { - if (!$rootScope.complianceCheck) { - $rootScope.complianceCheck = {} - } - $rootScope.complianceCheck.client_id = $scope.partner.client_id - $rootScope.complianceCheck.bankAccount = true - } - $scope.complianceChangeCheck = function () { - if ($rootScope.complianceCheck) { - if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { - delete $rootScope.complianceCheck - } - } - } - $scope.complianceChangeCheck() - - // 是否为alipayplus - $scope.isAlipayCN = true - // 修改渠道 - $scope.changeAlipayPlusRateState = function (flag) { - $scope.isAlipayCN = flag - } - // 过滤渠道 - $scope.isAlipayPlus = function (item) { - if ($scope.isAlipayCN) { - return item.rate_name === 'AlipayPlus' && (item.pay_type === 'alipay_cn_retail' || item.pay_type === 'alipay_cn_online') - } else { - return item.rate_name === 'AlipayPlus' && item.pay_type === 'alipay_other' - } - } - // 新增alipay+费率 - $scope.newAlipayPlusRate = function () { - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/partner_new_alipayplus_rate.html', - resolve: { - rate: function () { - return { - rate_name: 'AlipayPlus', - clean_days: '3', - } - }, - sys_common_rate: function () { - return $http.get('/sys/partners/sys_rates') - }, - clientMoniker: function () { - return $scope.partner.client_moniker - }, - }, - controller: [ - '$scope', - '$http', - 'rate', - 'sys_common_rate', - 'clientMoniker', - function ($scope, $http, rate, sys_common_rate, clientMoniker) { - $scope.rate = angular.copy(rate) - $scope.sysRateConfig = angular.copy(sys_common_rate.data) - $scope.ctrl = { sending: false } - $scope.saveRate = function (form) { - if (form.$invalid) { + $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.timezones = timezone.configs() + $scope.states = stateMap.configs() + $scope.countries = countryMap.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.saveSubPartner = function (form) { + if (form.$invalid) { angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } + if (key.indexOf('$') < 0) { + item.$dirty = true + } }) return - } - $scope.errmsg = null - $scope.ctrl.sending = true - $http.post('/sys/partners/' + clientMoniker + '/rates', $scope.rate).then( + } + $scope.errmsg = null + if (!$scope.partner.business_structure || $scope.partner.business_structure == '') { + alert('Please select the business structure') + return + } + if ($scope.partner.business_structure != 'Registered body(Sole Trader)') { + if ($scope.partner.certificat_expire_date_d) { + $scope.partner.certificat_expire_date = $filter('dateConversionStr')($scope.partner.certificat_expire_date_d) + } else if ($scope.partner.certificat_expire_date_premanent) { + $scope.partner.certificat_expire_date = 'PERMANENT' + } else if ($scope.partner.certificat_expire_date_NA) { + $scope.partner.certificat_expire_date = 'N/A' + } else { + alert('Certificate expiration time is required') + 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.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.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(!window.frames['merchant_detail'].merchant_location){ + // alert("Please Locate Merchant Location!"); + // return; + // } + 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.post('/sys/partners/' + clientMoniker + '/sub_clients', $scope.partner).then( function () { - $scope.ctrl.sending = false - $scope.$close() + $scope.updateMerchantLocation() + $scope.$close() }, function (resp) { - $scope.ctrl.sending = false - $scope.errmsg = resp.data.message - } - ) - } - $scope.changeDays = function () { - // if ($scope.rate.clean_days) { - // switch ($scope.rate.clean_days) { - // case '1': { - // $scope.rate.alipayplus = parseFloat($scope.sysRateConfig.t1.AlipayPlus) - // break - // } - // case '2': { - // $scope.rate.alipayplus = parseFloat($scope.sysRateConfig.t2.AlipayPlus) - // break - // } - // case '3': { - // $scope.rate.alipayplus = parseFloat($scope.sysRateConfig.t3.AlipayPlus) - // break - // } - // } - // } - } - }, - ], - }) - .result.then(function () { - $scope.getRates() - }) - } - }, - ]) - app.controller('surchargeAccountDetailCtrl', [ - '$scope', - '$http', - 'balance', - 'partner', - 'transactions', - 'commonDialog', - function ($scope, $http, balance, partner, transactions, commonDialog) { - $scope.surcharge = angular.copy(balance) - $scope.surchargeDetailData = angular.copy(transactions.data) - $scope.partner = angular.copy(partner) - $scope.canAddDetail = false - $scope.params = {} - - $scope.getBalance = function () { - if ($scope.partner.surcharge_mode != undefined && $scope.partner.surcharge_mode == 'distributed') { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/surcharge_account').then(function (resp) { - $scope.surcharge = resp.data - }) - } - } - - $scope.getTransactions = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/account/transactions').then(function (resp) { - $scope.surchargeDetailData = resp.data - }) - } - - $scope.addDetail = function () { - $scope.canAddDetail = true - } - - $scope.cancel = function () { - $scope.canAddDetail = false - $scope.params = {} - } - $scope.save = function () { - $http - .post('/sys/partners/' + $scope.partner.client_moniker + '/account/save', { - amount: $scope.params.amount, - remark: $scope.params.remark, - }) - .then( - function (resp) { - $scope.getTransactions() - $scope.getBalance() - $scope.canAddDetail = false - $scope.params = {} - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - }, - ]) - app.controller('newCardPaymentRateDialogCtrl', [ - '$scope', - '$http', - 'sys_common_rate', - 'clientMoniker', - function ($scope, $http, sys_common_rate, clientMoniker) { - $scope.rate = {} - $scope.card_payment_normal = true - $scope.card_payment_switch_title = 'Direct Debit' - $scope.card_payment = [ - { - type: 'rpaypmt_card', - title: 'Card Payment', - }, - { - type: 'rpaypmt_dd', - title: 'Direct Debit', + $scope.errmsg = resp.data.message + $scope.partner.client_pay_type = $scope.partner.client_pay_type.split(',') + $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.split(',') + } + ) + } + $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 () { + }) + } + } }, - ] - $scope.cardRateConfig = $scope.card_payment[0] - $scope.switchCardRateConfig = function () { - $scope.card_payment_normal = !$scope.card_payment_normal - $scope.rate = {} - if ($scope.card_payment_normal) { - $scope.cardRateConfig = $scope.card_payment[0] - $scope.card_payment_switch_title = 'Direct Debit' - } else { - $scope.cardRateConfig = $scope.card_payment[1] - $scope.card_payment_switch_title = 'Card Payment' - } - } - $scope.sysRateConfig = angular.copy(sys_common_rate.data) - $scope.ctrl = { sending: false } - $scope.saveRate = function (form) { - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } - }) - return - } - $scope.errmsg = null - $scope.ctrl.sending = true - $scope.rate.type = $scope.cardRateConfig.type - $http.post('/sys/partners/' + clientMoniker + '/rates', $scope.rate).then( - function () { - $scope.ctrl.sending = false - $scope.$close() - }, - function (resp) { - $scope.ctrl.sending = false - $scope.errmsg = resp.data.message - } - ) - } - $scope.changeDays = function () { - if ($scope.rate.clean_days && $scope.card_payment_normal) { - switch ($scope.rate.clean_days) { - case '1': { - $scope.rate.rate_value = parseFloat($scope.sysRateConfig.t1.domestic_rate) - $scope.rate.transaction_fee = parseFloat($scope.sysRateConfig.t1.transaction_fee) - break - } - case '2': { - $scope.rate.rate_value = parseFloat($scope.sysRateConfig.t2.domestic_rate) - $scope.rate.transaction_fee = parseFloat($scope.sysRateConfig.t2.transaction_fee) - break - } - case '3': { - $scope.rate.rate_value = parseFloat($scope.sysRateConfig.t3.domestic_rate) - $scope.rate.transaction_fee = parseFloat($scope.sysRateConfig.t3.transaction_fee) - break - } - } - } - } - }, - ]) - app.controller('newRateDialogCtrl', [ - '$scope', - '$http', - 'rate', - 'sys_common_rate', - 'clientMoniker', - function ($scope, $http, rate, sys_common_rate, clientMoniker) { - $scope.rate = angular.copy(rate) - $scope.sysRateConfig = angular.copy(sys_common_rate.data) - $scope.ctrl = { sending: false } - $scope.saveRate = function (form) { - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } - }) - return - } - $scope.errmsg = null - $scope.ctrl.sending = true - $http.post('/sys/partners/' + clientMoniker + '/rates', $scope.rate).then( - function () { - $scope.ctrl.sending = false - $scope.$close() - }, - function (resp) { - $scope.ctrl.sending = false - $scope.errmsg = resp.data.message - } - ) - } - $scope.changeDays = function () { - if ($scope.rate.clean_days) { - switch ($scope.rate.clean_days) { - case '1': { - $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t1.Wechat) - $scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t1.Alipay) - $scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t1.AlipayOnline) - $scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t1.Rpay) - $scope.rate.transaction_fee = 0 - break - } - case '2': { - $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t2.Wechat) - $scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t2.Alipay) - $scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t2.AlipayOnline) - $scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t2.Rpay) - $scope.rate.transaction_fee = 0 - break - } - case '3': { - $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t3.Wechat) - $scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t3.Alipay) - $scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t3.AlipayOnline) - $scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t3.Rpay) - $scope.rate.transaction_fee = 0 - break - } - } - } - } - }, - ]) - app.controller('partnerAccountsCtrl', [ - '$scope', - '$http', - '$uibModal', - 'commonDialog', - function ($scope, $http, $uibModal, commonDialog) { - $scope.partnerRoles = partnerRoles - $scope.loadPartnerAccounts = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/accounts').then(function (resp) { - $scope.accounts = resp.data - }) - } - $scope.loadPartnerAccounts() - $scope.addAccount = function () { - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/add_partner_account_dialog.html', - controller: 'partnerAddAccountDialogCtrl', - backdrop: false, - resolve: { - partner: function () { - return $scope.partner - }, - }, - }) - .result.then(function () { - $scope.loadPartnerAccounts() - }) - } - $scope.updateAccountRole = function (account) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/accounts/' + account.account_id + '/role', { role: account.role }).then( - function () {}, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - $scope.resetPwd = function (account) { - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/partner_account_reset_pwd_dialog.html', - controller: 'partnerResetPwdDialogCtrl', - backdrop: false, - size: 'sm', - resolve: { - partner: function () { - return $scope.partner - }, - account: function () { - return account - }, - }, - }) - .result.then(function () { - commonDialog.alert({ title: 'Success!', content: 'Password Changed Successfully', type: 'success' }) - }) - } - $scope.disableAccount = function (account) { - commonDialog - .confirm({ - title: 'Confirm Operation', - content: 'Are you sure to disable account ' + account.display_name + ' ?', - }) - .then(function () { - $http.delete('/sys/partners/' + $scope.partner.client_moniker + '/accounts/' + account.account_id).then( - function () { - $scope.loadPartnerAccounts() - }, - function (resp) { - commonDialog.alert({ title: 'Fail!', content: resp.data.message, type: 'error' }) - } - ) - }) - } - }, - ]) - app.controller('partnerAddAccountDialogCtrl', [ - '$scope', - '$http', - 'partner', - function ($scope, $http, partner) { - $scope.account = { role: 1 } - $scope.partnerRoles = partnerRoles - $scope.account.nation_code = 61 - $scope.saveAccount = function (form) { - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } - }) - return - } - if ($scope.account.pwd && $scope.account.pwd.length < 8) { - $scope.errmsg = 'Password length must more than 8 !' - return - } - var regex = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/ - if ($scope.account.pwd && !regex.test($scope.account.pwd)) { - $scope.errmsg = 'The password needs to consist of 8-16 digits and letters !' - return - } - $scope.errmsg = null - $http.post('/sys/partners/' + partner.client_moniker + '/accounts', $scope.account).then( - function () { - $scope.$close() - }, - function (resp) { - $scope.errmsg = resp.data.message - } - ) - } - }, - ]) - app.controller('partnerResetPwdDialogCtrl', [ - '$scope', - '$http', - 'partner', - 'account', - function ($scope, $http, partner, account) { - $scope.updatePwd = function () { - $scope.errmsg = null - if ($scope.reset.pwd && $scope.reset.pwd.length < 8) { - $scope.errmsg = 'Password length must more than 8 !' - return - } - var regex = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/ - if ($scope.reset.pwd && !regex.test($scope.reset.pwd)) { - $scope.errmsg = 'The password needs to consist of 8-16 digits and letters !' - return - } - $http.put('/sys/partners/' + partner.client_moniker + '/accounts/' + account.account_id + '/pwd', { pwd: $scope.reset.pwd }).then( - function () { - $scope.$close() - }, - function (resp) { - $scope.errmsg = resp.data.message - } - ) - } - }, - ]) - app.controller('partnerNewSubPartnerDialogCtrl', [ - '$rootScope', - '$scope', - '$http', - '$state', - 'Upload', - 'commonDialog', - 'timezone', - 'clientMoniker', - 'industryMap', - 'businessStructuresMap', - 'stateMap', - 'countryMap', - 'wechatGoodMcc', - '$filter', - function ($rootScope, $scope, $http, $state, Upload, commonDialog, timezone, clientMoniker, industryMap, businessStructuresMap, stateMap, countryMap, wechatGoodMcc, $filter) { - 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 = [] - $scope.merchantIsValid = false - $scope.merchantCodeChecked = false - $scope.wechatMccIndustries = wechatGoodMcc.configs() - $scope.checkExpriedate = function (value) { - if (value) { - $scope.partner.certificat_expire_date_premanent = false - $scope.partner.certificat_expire_date_NA = false - } - } - $scope.checkExpriedateOther = function (value) { - if (value == 'PERMANENT') { - if ($scope.partner.certificat_expire_date_premanent) { - $scope.partner.certificat_expire_date_NA = false - $scope.partner.certificat_expire_date_d = null - } - } else if (value == 'N/A') { - if ($scope.partner.certificat_expire_date_NA) { - $scope.partner.certificat_expire_date_premanent = false - $scope.partner.certificat_expire_date_d = null - } - } - } - 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) { - 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) { - 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.business_structures = businessStructuresMap.configs() - $scope.industries = industryMap.configs() - - $scope.listReferrers = function () { - $http.get('/sys/orgs/referrer').then(function (resp) { - $scope.referrers = resp.data - }) - } - $scope.listReferrers() - - $scope.alipayMccCategory = {} - $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.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 - } - } - - $scope.timezones = timezone.configs() - $scope.states = stateMap.configs() - $scope.countries = countryMap.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.saveSubPartner = function (form) { - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } - }) - return - } - $scope.errmsg = null - if (!$scope.partner.business_structure || $scope.partner.business_structure == '') { - alert('Please select the business structure') - return - } - if ($scope.partner.business_structure != 'Registered body(Sole Trader)') { - if ($scope.partner.certificat_expire_date_d) { - $scope.partner.certificat_expire_date = $filter('dateConversionStr')($scope.partner.certificat_expire_date_d) - } else if ($scope.partner.certificat_expire_date_premanent) { - $scope.partner.certificat_expire_date = 'PERMANENT' - } else if ($scope.partner.certificat_expire_date_NA) { - $scope.partner.certificat_expire_date = 'N/A' - } else { - alert('Certificate expiration time is required') - return - } - } - if ($scope.partner.company_name.indexOf('Migration') != -1) { - alert('Company Name包含敏感词汇,请检查后重新提交!') - return - } + ]) + app.controller('partnerPayLogCtrl', [ + '$scope', + '$http', + '$filter', + 'refunder', + 'orderService', + function ($scope, $http, $filter, refunder, orderService) { + $scope.params = {status: 'PAID', channel: 'ALL', textType: 'all', datefrom: new Date(), dateto: new Date()} + $scope.pagination = {} + $scope.isAll = true + $scope.isLevel3All = true + $scope.clients = [$scope.partner] + $scope.showLevel3Clients = false + $scope.subClientTable1 = [$scope.partner] + $scope.subClientTable2 = [] + $scope.choseSubClientNow = 'More' + $scope.more20ChoseSubClient = false + $scope.subSearchText = '' + + $scope.today = new Date() + $scope.chooseToday = function () { + $scope.params.datefrom = $scope.params.dateto = new Date() + $scope.loadTradeLogs(1) + } + $scope.chooseYesterday = function () { + var yesterday = new Date() + yesterday.setDate(yesterday.getDate() - 1) + $scope.params.datefrom = $scope.params.dateto = yesterday + $scope.loadTradeLogs(1) + } + $scope.chooseLast7Days = function () { + $scope.params.dateto = new Date() + var day = new Date() + day.setDate(day.getDate() - 7) + $scope.params.datefrom = day + $scope.loadTradeLogs(1) + } + $scope.thisMonth = function () { + $scope.params.dateto = new Date() + var monthBegin = new Date() + monthBegin.setDate(1) + $scope.params.datefrom = monthBegin + $scope.loadTradeLogs(1) + } + $scope.lastMonth = function () { + var monthFinish = new Date() + monthFinish.setDate(0) + $scope.params.dateto = monthFinish + var monthBegin = new Date() + monthBegin.setDate(0) + monthBegin.setDate(1) + $scope.params.datefrom = monthBegin + $scope.loadTradeLogs(1) + } + $scope.loadTradeLogs = function (page) { + var params = angular.copy($scope.params) + if (params.datefrom) { + params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd') + } + if (params.dateto) { + params.dateto = $filter('date')(params.dateto, 'yyyyMMdd') + } + params.page = page || $scope.pagination.page || 1 + if (params.gateway) { + if (params.gateway.sort().toString() != [0, 1].toString() && params.gateway.sort().toString() != [5, 6].toString()) { + delete params.gatewayChilds + delete params.gatewayChild + } + if (params.gatewayChilds) { + var exist = false + params.gatewayChilds.forEach(function (child) { + if (child == params.gatewayChild) { + exist = true + } + }) + if (!exist) { + params.gatewayChild = null + } + } else { + delete params.gatewayChild + } + } else { + delete params.gatewayChilds + delete params.gatewayChild + } + if ($scope.isAll) { + delete params.client_ids + } + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/trade_logs', {params: params}).then(function (resp) { + $scope.tradeLogs = resp.data.data + $scope.pagination = resp.data.pagination + $scope.analysis = resp.data.analysis + }) + } - 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.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.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(!window.frames['merchant_detail'].merchant_location){ - // alert("Please Locate Merchant Location!"); - // return; - // } - 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.post('/sys/partners/' + clientMoniker + '/sub_clients', $scope.partner).then( - function () { - $scope.updateMerchantLocation() - $scope.$close() - }, - function (resp) { - $scope.errmsg = resp.data.message - $scope.partner.client_pay_type = $scope.partner.client_pay_type.split(',') - $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.split(',') - } - ) - } - $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('partnerPayLogCtrl', [ - '$scope', - '$http', - '$filter', - 'refunder', - 'orderService', - function ($scope, $http, $filter, refunder, orderService) { - $scope.params = { status: 'PAID', channel: 'ALL', textType: 'all', datefrom: new Date(), dateto: new Date() } - $scope.pagination = {} - $scope.isAll = true - $scope.isLevel3All = true - $scope.clients = [$scope.partner] - $scope.showLevel3Clients = false - $scope.subClientTable1 = [$scope.partner] - $scope.subClientTable2 = [] - $scope.choseSubClientNow = 'More' - $scope.more20ChoseSubClient = false - $scope.subSearchText = '' - - $scope.today = new Date() - $scope.chooseToday = function () { - $scope.params.datefrom = $scope.params.dateto = new Date() - $scope.loadTradeLogs(1) - } - $scope.chooseYesterday = function () { - var yesterday = new Date() - yesterday.setDate(yesterday.getDate() - 1) - $scope.params.datefrom = $scope.params.dateto = yesterday - $scope.loadTradeLogs(1) - } - $scope.chooseLast7Days = function () { - $scope.params.dateto = new Date() - var day = new Date() - day.setDate(day.getDate() - 7) - $scope.params.datefrom = day - $scope.loadTradeLogs(1) - } - $scope.thisMonth = function () { - $scope.params.dateto = new Date() - var monthBegin = new Date() - monthBegin.setDate(1) - $scope.params.datefrom = monthBegin - $scope.loadTradeLogs(1) - } - $scope.lastMonth = function () { - var monthFinish = new Date() - monthFinish.setDate(0) - $scope.params.dateto = monthFinish - var monthBegin = new Date() - monthBegin.setDate(0) - monthBegin.setDate(1) - $scope.params.datefrom = monthBegin - $scope.loadTradeLogs(1) - } - $scope.loadTradeLogs = function (page) { - var params = angular.copy($scope.params) - if (params.datefrom) { - params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd') - } - if (params.dateto) { - params.dateto = $filter('date')(params.dateto, 'yyyyMMdd') - } - params.page = page || $scope.pagination.page || 1 - if (params.gateway) { - if (params.gateway.sort().toString() != [0, 1].toString() && params.gateway.sort().toString() != [5, 6].toString()) { - delete params.gatewayChilds - delete params.gatewayChild - } - if (params.gatewayChilds) { - var exist = false - params.gatewayChilds.forEach(function (child) { - if (child == params.gatewayChild) { - exist = true - } + $scope.initGatewayChild = function () { + $scope.params.gatewayChilds = $scope.params.gateway + $scope.params.gatewayChild = null + $scope.loadTradeLogs(1) + } + $scope.gatewaySelected = function (arr) { + return ( + $scope.params.gateway != null && + $scope.params.gateway.filter(function (gateway) { + return arr.indexOf(gateway) >= 0 + }).length > 0 + ) + } + + $scope.showRefundLog = function (orderId) { + refunder.refunded(orderId) + } + $scope.newRefund = function (orderId) { + refunder.refund(orderId).then(function () { + $scope.loadTradeLogs() + }) + } + $scope.showTradeDetail = function (order) { + orderService.managerOrderDetail(order) + } + $scope.$on('order_refunded', function () { + $scope.loadTradeLogs() }) - if (!exist) { - params.gatewayChild = null - } - } else { - delete params.gatewayChild - } - } else { - delete params.gatewayChilds - delete params.gatewayChild - } - if ($scope.isAll) { - delete params.client_ids - } - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/trade_logs', { params: params }).then(function (resp) { - $scope.tradeLogs = resp.data.data - $scope.pagination = resp.data.pagination - $scope.analysis = resp.data.analysis - }) - } - - $scope.initGatewayChild = function () { - $scope.params.gatewayChilds = $scope.params.gateway - $scope.params.gatewayChild = null - $scope.loadTradeLogs(1) - } - $scope.gatewaySelected = function (arr) { - return ( - $scope.params.gateway != null && - $scope.params.gateway.filter(function (gateway) { - return arr.indexOf(gateway) >= 0 - }).length > 0 - ) - } - - $scope.showRefundLog = function (orderId) { - refunder.refunded(orderId) - } - $scope.newRefund = function (orderId) { - refunder.refund(orderId).then(function () { - $scope.loadTradeLogs() - }) - } - $scope.showTradeDetail = function (order) { - orderService.managerOrderDetail(order) - } - $scope.$on('order_refunded', function () { - $scope.loadTradeLogs() - }) - $scope.chooseClient = function (client) { - if (client == 'all') { - $scope.choseSubClientNow = 'More' - $scope.params.client_ids = angular.copy($scope.clientIds) - $scope.isAll = true - $scope.chooseClientId = '' - $scope.showLevel3Clients = false - } else if (client.level3Clients) { - $scope.chooseClientId = client.client_id - $scope.showLevel3Clients = true - $scope.level3Clients = client.level3Clients - $scope.isAll = false - $scope.level3ClientIds = [] - $scope.level3ClientIds.push(client.client_id) - client.level3Clients.forEach(function (client) { - $scope.level3ClientIds.push(client.client_id) - }) - $scope.chooseLevel3Client('all') - return - } else { - $scope.chooseClientId = client.client_id - $scope.params.client_ids = [client.client_id] - $scope.isAll = false - $scope.showLevel3Clients = false - } - $scope.loadTradeLogs() - } - $scope.chooseLevel3Client = function (client) { - if (client == 'all') { - $scope.params.client_ids = angular.copy($scope.level3ClientIds) - $scope.isLevel3All = true - $scope.chooseLevel3ClientId = '' - } else { - $scope.chooseLevel3ClientId = client.client_id - $scope.params.client_ids = [client.client_id] - $scope.isLevel3All = false - } - $scope.loadTradeLogs() - } - $scope.searchSubClients = function (subSearchText, page) { - $scope.subClientTable1 = [$scope.partner] - $scope.subClientTable2 = [] - var params = {} - params.page = page || $scope.subClientPagination.page || 1 - if (subSearchText != '') { - $scope.subSearchText = subSearchText - params.searchText = subSearchText - } - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients/page', { params: params }).then(function (resp) { - var clientList = resp.data.data - $scope.subClientPagination = resp.data.pagination - clientList.forEach(function (client) { - if ($scope.subClientTable1.length < 11) { - $scope.subClientTable1.push(client) + $scope.chooseClient = function (client) { + if (client == 'all') { + $scope.choseSubClientNow = 'More' + $scope.params.client_ids = angular.copy($scope.clientIds) + $scope.isAll = true + $scope.chooseClientId = '' + $scope.showLevel3Clients = false + } else if (client.level3Clients) { + $scope.chooseClientId = client.client_id + $scope.showLevel3Clients = true + $scope.level3Clients = client.level3Clients + $scope.isAll = false + $scope.level3ClientIds = [] + $scope.level3ClientIds.push(client.client_id) + client.level3Clients.forEach(function (client) { + $scope.level3ClientIds.push(client.client_id) + }) + $scope.chooseLevel3Client('all') + return + } else { + $scope.chooseClientId = client.client_id + $scope.params.client_ids = [client.client_id] + $scope.isAll = false + $scope.showLevel3Clients = false + } + $scope.loadTradeLogs() + } + $scope.chooseLevel3Client = function (client) { + if (client == 'all') { + $scope.params.client_ids = angular.copy($scope.level3ClientIds) + $scope.isLevel3All = true + $scope.chooseLevel3ClientId = '' + } else { + $scope.chooseLevel3ClientId = client.client_id + $scope.params.client_ids = [client.client_id] + $scope.isLevel3All = false + } + $scope.loadTradeLogs() + } + $scope.searchSubClients = function (subSearchText, page) { + $scope.subClientTable1 = [$scope.partner] + $scope.subClientTable2 = [] + var params = {} + params.page = page || $scope.subClientPagination.page || 1 + if (subSearchText != '') { + $scope.subSearchText = subSearchText + params.searchText = subSearchText + } + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients/page', {params: params}).then(function (resp) { + var clientList = resp.data.data + $scope.subClientPagination = resp.data.pagination + clientList.forEach(function (client) { + if ($scope.subClientTable1.length < 11) { + $scope.subClientTable1.push(client) + } else { + $scope.subClientTable2.push(client) + } + $scope.clients.push(client) + }) + }) + } + + if ($scope.partner.has_children && !$scope.partner.hide_sub_mch) { + $scope.searchSubClients('', 1) + $scope.loadTradeLogs(1) } else { - $scope.subClientTable2.push(client) - } - $scope.clients.push(client) - }) - }) - } - - if ($scope.partner.has_children && !$scope.partner.hide_sub_mch) { - $scope.searchSubClients('', 1) - $scope.loadTradeLogs(1) - } else { - $scope.loadTradeLogs(1) - } - $scope.checkSubClientChoseShow = function (client) { - $scope.more20ChoseSubClient = !$scope.more20ChoseSubClient - if (client != '') { - $scope.choseSubClientNow = client.short_name - } - } - $scope.clickDisplayChoseDiv = function (event) { - $scope.more20ChoseSubClient = false - } - $scope.choseDivStopPropagation = function (event) { - event.stopPropagation() - } - }, - ]) - app.controller('partnerPluginsCtrl', [ - '$scope', - '$uibModal', - function ($scope, $uibModal) { - $scope.configRedpack = function () { - $uibModal.open({ - templateUrl: '/static/payment/partner/templates/redpack_config.html', - controller: 'partnerRedpackConfigDialogCtrl', - size: 'lg', - resolve: { - partner: function () { - return $scope.partner - }, - config: [ - '$http', - function ($http) { - return $http.get('/sys/redpack/partners/' + $scope.partner.client_moniker) - }, - ], - }, - }) - } - $scope.redpackLogs = function () { - $uibModal.open({ - templateUrl: '/static/payment/partner/templates/redpack_logs.html', - controller: 'partnerRedpackLogDialogCtrl', - size: 'lg', - resolve: { - partner: function () { - return $scope.partner - }, - }, - }) - } - }, - ]) - app.controller('partnerDeviceCtrl', [ - '$scope', - '$http', - 'orderService', - 'commonDialog', - 'refunder', - '$uibModal', - function ($scope, $http, orderService, commonDialog, refunder, $uibModal) { - $scope.pagination = {} - /** - * 查看设备 - * @param page - */ - $scope.listDevices = function (page) { - var params = angular.copy($scope.devsearch) || {} - params.page = page || $scope.pagination.page || 1 - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/devices', { params: params }).then(function (resp) { - $scope.pagination = resp.data.pagination - $scope.devices = resp.data.data - }) - } - $scope.listDevices(1) - - /** - * 添加设备 - */ - $scope.addDevice = function () { - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/add_device.html', - controller: 'newDeviceDialogCtrl', - resolve: { - clientMoniker: function () { - return $scope.partner.client_moniker - }, - }, - }) - .result.then(function () { + $scope.loadTradeLogs(1) + } + $scope.checkSubClientChoseShow = function (client) { + $scope.more20ChoseSubClient = !$scope.more20ChoseSubClient + if (client != '') { + $scope.choseSubClientNow = client.short_name + } + } + $scope.clickDisplayChoseDiv = function (event) { + $scope.more20ChoseSubClient = false + } + $scope.choseDivStopPropagation = function (event) { + event.stopPropagation() + } + }, + ]) + app.controller('partnerPluginsCtrl', [ + '$scope', + '$uibModal', + function ($scope, $uibModal) { + $scope.configRedpack = function () { + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/redpack_config.html', + controller: 'partnerRedpackConfigDialogCtrl', + size: 'lg', + resolve: { + partner: function () { + return $scope.partner + }, + config: [ + '$http', + function ($http) { + return $http.get('/sys/redpack/partners/' + $scope.partner.client_moniker) + }, + ], + }, + }) + } + $scope.redpackLogs = function () { + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/redpack_logs.html', + controller: 'partnerRedpackLogDialogCtrl', + size: 'lg', + resolve: { + partner: function () { + return $scope.partner + }, + }, + }) + } + }, + ]) + app.controller('partnerDeviceCtrl', [ + '$scope', + '$http', + 'orderService', + 'commonDialog', + 'refunder', + '$uibModal', + function ($scope, $http, orderService, commonDialog, refunder, $uibModal) { + $scope.pagination = {} + /** + * 查看设备 + * @param page + */ + $scope.listDevices = function (page) { + var params = angular.copy($scope.devsearch) || {} + params.page = page || $scope.pagination.page || 1 + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/devices', {params: params}).then(function (resp) { + $scope.pagination = resp.data.pagination + $scope.devices = resp.data.data + }) + } $scope.listDevices(1) - }) - } - - $scope.showDeviceOrders = function (dev) { - $scope.params.dev_id = dev.dev_id - $scope.listOrders(1) - } - $scope.modifyRemark = function (dev) { - commonDialog.inputText({ title: 'Input New Remark of device' }).then(function (text) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/devices/' + dev.dev_id, { remark: text }).then( - function () { - $scope.listDevices() - }, - function (resp) { - commonDialog.alert({ title: 'Update remark failed', content: resp.data.message, type: 'error' }) - } - ) - }) - } - $scope.disableDevice = function (dev) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/devices/' + dev.dev_id + '/enable', { enable: false }).then( - function () { - $scope.listDevices() - }, - function (resp) { - commonDialog.alert({ title: 'Failed to disable device', content: resp.data.message, type: 'error' }) - } - ) - } - $scope.enableDevice = function (dev) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/devices/' + dev.dev_id + '/enable', { enable: true }).then( - function () { - $scope.listDevices() - }, - function (resp) { - commonDialog.alert({ title: 'Failed to enable device', content: resp.data.message, type: 'error' }) - } - ) - } - $scope.orderPagination = {} - $scope.today = new Date() - $scope.chooseToday = function () { - $scope.params.datefrom = $scope.params.dateto = new Date() - $scope.loadTradeLogs(1) - } - $scope.chooseYesterday = function () { - var yesterday = new Date() - yesterday.setDate(yesterday.getDate() - 1) - $scope.params.datefrom = $scope.params.dateto = yesterday - $scope.loadTradeLogs(1) - } - $scope.chooseLast7Days = function () { - $scope.params.dateto = new Date() - var day = new Date() - day.setDate(day.getDate() - 7) - $scope.params.datefrom = day - $scope.loadTradeLogs(1) - } - $scope.thisMonth = function () { - $scope.params.dateto = new Date() - var monthBegin = new Date() - monthBegin.setDate(1) - $scope.params.datefrom = monthBegin - $scope.loadTradeLogs(1) - } - $scope.lastMonth = function () { - var monthFinish = new Date() - monthFinish.setDate(0) - $scope.params.dateto = monthFinish - var monthBegin = new Date() - monthBegin.setDate(0) - monthBegin.setDate(1) - $scope.params.datefrom = monthBegin - $scope.loadTradeLogs(1) - } - $scope.listOrders = function (page) { - var params = angular.copy($scope.params) || {} - if (params.datefrom) { - params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd') - } - if (params.dateto) { - params.dateto = $filter('date')(params.dateto, 'yyyyMMdd') - } - params.gateway = [0, 1] - params.page = page || $scope.orderPagination.page || 1 - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/trade_logs', { params: params }).then(function (resp) { - $scope.orders = resp.data.data - $scope.orderPagination = resp.data.pagination - $scope.analysis = resp.data.analysis - }) - } - $scope.listOrders(1) - $scope.orderDetail = function (order) { - orderService.managerOrderDetail(order) - } - $scope.refundOrder = function (order) { - refunder.refunded(order.order_id) - } - }, - ]) - app.controller('partnerRedpackConfigDialogCtrl', [ - '$scope', - '$http', - 'partner', - 'config', - function ($scope, $http, partner, config) { - $scope.config = config.data - if (!Object.keys($scope.config).length) { - $scope.config = { min_payment: 0, min_amount: 1, max_amount: 1, daily_limit: 1, enabled: false } - } - $scope.saveRedpackConfig = function (form) { - $scope.errmsg = null - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } - }) - return - } - var config = angular.copy($scope.config) - $http.put('/sys/redpack/partners/' + partner.client_moniker, config).then( - function () { - $scope.$close() - }, - function (resp) { - $scope.errmsg = resp.data.message - } - ) - } - }, - ]) - app.controller('rateConfigDialogCtrl', [ - '$scope', - '$http', - 'rate', - 'clientMoniker', - function ($scope, $http, rate, clientMoniker) { - $scope.rate = angular.copy(rate) - $scope.ctrl = { sending: false } - $scope.saveRate = function () { - $scope.errmsg = null - $scope.ctrl.sending = true - if ($scope.rate.client_rate_id) { - $http.put('/sys/partners/' + clientMoniker + '/rates/' + $scope.rate.client_rate_id, $scope.rate).then( - function () { - $scope.ctrl.sending = false - $scope.$close() - }, - 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 - $scope.$close() - }, - function (resp) { - $scope.ctrl.sending = false - $scope.errmsg = resp.data.message - } - ) - } - } - }, - ]) - app.controller('newDeviceDialogCtrl', [ - '$scope', - '$http', - 'clientMoniker', - function ($scope, $http, clientMoniker) { - $scope.save = function (form) { - $scope.errmsg = null - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } - }) - return - } - $http.post('/sys/partners/' + clientMoniker + '/add_device', $scope.device).then( - function () { - $scope.$close() - }, - function (resp) { - $scope.errmsg = resp.data.message - } - ) - } - }, - ]) - app.controller('partnerChooseBDUserDialogCtrl', [ - '$scope', - '$http', - '$filter', - 'partner', - 'bdUsers', - 'type', - function ($scope, $http, $filter, partner, bdUsers, type) { - $scope.bdUsers = bdUsers.data - $scope.data = {} - $scope.params = {} - - $scope.chooseOrg = {} - $scope.chooseOrg.org_name = null - if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) { - /* $scope.showOrg = 'Organization';*/ - $http.get('/sys/orgs', { params: {} }).then(function (resp) { - $scope.orgs = resp.data - }) - } - - $scope.loadOrgs = function () { - var params = angular.copy($scope.params) - $http.get('/sys/orgs/orgChild', { params: params }).then(function (resp) { - $scope.orgs_child = resp.data - }) - } - - /* $scope.chooseOrgFun = function (org) { + + /** + * 添加设备 + */ + $scope.addDevice = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/add_device.html', + controller: 'newDeviceDialogCtrl', + resolve: { + clientMoniker: function () { + return $scope.partner.client_moniker + }, + }, + }) + .result.then(function () { + $scope.listDevices(1) + }) + } + + $scope.showDeviceOrders = function (dev) { + $scope.params.dev_id = dev.dev_id + $scope.listOrders(1) + } + $scope.modifyRemark = function (dev) { + commonDialog.inputText({title: 'Input New Remark of device'}).then(function (text) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/devices/' + dev.dev_id, {remark: text}).then( + function () { + $scope.listDevices() + }, + function (resp) { + commonDialog.alert({ + title: 'Update remark failed', + content: resp.data.message, + type: 'error' + }) + } + ) + }) + } + $scope.disableDevice = function (dev) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/devices/' + dev.dev_id + '/enable', {enable: false}).then( + function () { + $scope.listDevices() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to disable device', + content: resp.data.message, + type: 'error' + }) + } + ) + } + $scope.enableDevice = function (dev) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/devices/' + dev.dev_id + '/enable', {enable: true}).then( + function () { + $scope.listDevices() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to enable device', + content: resp.data.message, + type: 'error' + }) + } + ) + } + $scope.orderPagination = {} + $scope.today = new Date() + $scope.chooseToday = function () { + $scope.params.datefrom = $scope.params.dateto = new Date() + $scope.loadTradeLogs(1) + } + $scope.chooseYesterday = function () { + var yesterday = new Date() + yesterday.setDate(yesterday.getDate() - 1) + $scope.params.datefrom = $scope.params.dateto = yesterday + $scope.loadTradeLogs(1) + } + $scope.chooseLast7Days = function () { + $scope.params.dateto = new Date() + var day = new Date() + day.setDate(day.getDate() - 7) + $scope.params.datefrom = day + $scope.loadTradeLogs(1) + } + $scope.thisMonth = function () { + $scope.params.dateto = new Date() + var monthBegin = new Date() + monthBegin.setDate(1) + $scope.params.datefrom = monthBegin + $scope.loadTradeLogs(1) + } + $scope.lastMonth = function () { + var monthFinish = new Date() + monthFinish.setDate(0) + $scope.params.dateto = monthFinish + var monthBegin = new Date() + monthBegin.setDate(0) + monthBegin.setDate(1) + $scope.params.datefrom = monthBegin + $scope.loadTradeLogs(1) + } + $scope.listOrders = function (page) { + var params = angular.copy($scope.params) || {} + if (params.datefrom) { + params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd') + } + if (params.dateto) { + params.dateto = $filter('date')(params.dateto, 'yyyyMMdd') + } + params.gateway = [0, 1] + params.page = page || $scope.orderPagination.page || 1 + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/trade_logs', {params: params}).then(function (resp) { + $scope.orders = resp.data.data + $scope.orderPagination = resp.data.pagination + $scope.analysis = resp.data.analysis + }) + } + $scope.listOrders(1) + $scope.orderDetail = function (order) { + orderService.managerOrderDetail(order) + } + $scope.refundOrder = function (order) { + refunder.refunded(order.order_id) + } + }, + ]) + app.controller('partnerRedpackConfigDialogCtrl', [ + '$scope', + '$http', + 'partner', + 'config', + function ($scope, $http, partner, config) { + $scope.config = config.data + if (!Object.keys($scope.config).length) { + $scope.config = {min_payment: 0, min_amount: 1, max_amount: 1, daily_limit: 1, enabled: false} + } + $scope.saveRedpackConfig = function (form) { + $scope.errmsg = null + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + var config = angular.copy($scope.config) + $http.put('/sys/redpack/partners/' + partner.client_moniker, config).then( + function () { + $scope.$close() + }, + function (resp) { + $scope.errmsg = resp.data.message + } + ) + } + }, + ]) + app.controller('rateConfigDialogCtrl', [ + '$scope', + '$http', + 'rate', + 'clientMoniker', + function ($scope, $http, rate, clientMoniker) { + $scope.rate = angular.copy(rate) + $scope.ctrl = {sending: false} + $scope.saveRate = function () { + $scope.errmsg = null + $scope.ctrl.sending = true + if ($scope.rate.client_rate_id) { + $http.put('/sys/partners/' + clientMoniker + '/rates/' + $scope.rate.client_rate_id, $scope.rate).then( + function () { + $scope.ctrl.sending = false + $scope.$close() + }, + 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 + $scope.$close() + }, + function (resp) { + $scope.ctrl.sending = false + $scope.errmsg = resp.data.message + } + ) + } + } + }, + ]) + app.controller('newDeviceDialogCtrl', [ + '$scope', + '$http', + 'clientMoniker', + function ($scope, $http, clientMoniker) { + $scope.save = function (form) { + $scope.errmsg = null + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + $http.post('/sys/partners/' + clientMoniker + '/add_device', $scope.device).then( + function () { + $scope.$close() + }, + function (resp) { + $scope.errmsg = resp.data.message + } + ) + } + }, + ]) + app.controller('partnerChooseBDUserDialogCtrl', [ + '$scope', + '$http', + '$filter', + 'partner', + 'bdUsers', + 'type', + function ($scope, $http, $filter, partner, bdUsers, type) { + $scope.bdUsers = bdUsers.data + $scope.data = {} + $scope.params = {} + + $scope.chooseOrg = {} + $scope.chooseOrg.org_name = null + if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) { + /* $scope.showOrg = 'Organization';*/ + $http.get('/sys/orgs', {params: {}}).then(function (resp) { + $scope.orgs = resp.data + }) + } + + $scope.loadOrgs = function () { + var params = angular.copy($scope.params) + $http.get('/sys/orgs/orgChild', {params: params}).then(function (resp) { + $scope.orgs_child = resp.data + }) + } + + /* $scope.chooseOrgFun = function (org) { if (org == 'all') { $scope.chooseOrg.org_name = null; $scope.showOrg = 'All' @@ -4796,743 +4866,744 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } };*/ - function initBD() { - $http.get('/sys/partners/' + partner.client_moniker + '/bd_user/current').then(function (resp) { - var choooseBD = resp.data - choooseBD.forEach(function (e) { - $scope.bdUsers.forEach(function (m) { - if (m.manager_id == e.bd_id) { - m.choose = true - m.proportion = e.proportion - /* $scope.chooseOrgFun({org_id: m.org_id, name: m.org_name});*/ - if (($scope.currentUser.role & parseInt('1000000000000', 2)) > 0) { - $scope.params.org_ids = m.org_id - $scope.params.org_id = m.org_id - $scope.loadOrgs() + function initBD() { + $http.get('/sys/partners/' + partner.client_moniker + '/bd_user/current').then(function (resp) { + var choooseBD = resp.data + choooseBD.forEach(function (e) { + $scope.bdUsers.forEach(function (m) { + if (m.manager_id == e.bd_id) { + m.choose = true + m.proportion = e.proportion + /* $scope.chooseOrgFun({org_id: m.org_id, name: m.org_name});*/ + if (($scope.currentUser.role & parseInt('1000000000000', 2)) > 0) { + $scope.params.org_ids = m.org_id + $scope.params.org_id = m.org_id + $scope.loadOrgs() + } else { + $scope.params.org_id = m.org_id + $scope.loadOrgs() + } + } + }) + }) + $scope.data.start_date = new Date(choooseBD[0].start_date) + }) + } + + if (type == 'edit') { + initBD() + } + + $scope.saveBD = function () { + $scope.data.users = [] + $scope.bdUsers.forEach(function (e) { + if (e.choose) { + $scope.data.users.push(e) + } + }) + + if ($scope.data.users.length == 0) { + $scope.errmsg = '请选择至少一位BD' + } else if ($scope.data.start_date == undefined) { + $scope.errmsg = '执行开始日期不能为空' } else { - $scope.params.org_id = m.org_id - $scope.loadOrgs() + var isValid = true + var total = 0 + $scope.data.users.forEach(function (e) { + if (e.proportion == undefined) { + $scope.errmsg = '绩效比例不能为空' + isValid = false + return + } else if (e.proportion < 0.01 || e.proportion > 1) { + $scope.errmsg = '绩效比例无效' + isValid = false + return + } + total += e.proportion + if (total > 1) { + $scope.errmsg = '总比例不能超过1' + isValid = false + return + } + }) + // if (total != 1) { + // $scope.errmsg = "Total proportion must be 1"; + // isValid = false; + // return; + // } + if (isValid) { + $scope.errmsg = null + $scope.data.type = type + var chooseUsers = angular.copy($scope.data) + chooseUsers.start_date = $scope.data.start_date + if (chooseUsers.start_date) { + chooseUsers.start_date = $filter('date')(chooseUsers.start_date, 'yyyyMMdd') + } + $http.put('/sys/partners/' + partner.client_moniker + '/bd_user', $scope.data).then( + function () { + $scope.$close() + }, + function (resp) { + $scope.errmsg = resp.data.message + } + ) + } } - } - }) - }) - $scope.data.start_date = new Date(choooseBD[0].start_date) - }) - } - - if (type == 'edit') { - initBD() - } - - $scope.saveBD = function () { - $scope.data.users = [] - $scope.bdUsers.forEach(function (e) { - if (e.choose) { - $scope.data.users.push(e) - } - }) - - if ($scope.data.users.length == 0) { - $scope.errmsg = '请选择至少一位BD' - } else if ($scope.data.start_date == undefined) { - $scope.errmsg = '执行开始日期不能为空' - } else { - var isValid = true - var total = 0 - $scope.data.users.forEach(function (e) { - if (e.proportion == undefined) { - $scope.errmsg = '绩效比例不能为空' - isValid = false - return - } else if (e.proportion < 0.01 || e.proportion > 1) { - $scope.errmsg = '绩效比例无效' - isValid = false - return - } - total += e.proportion - if (total > 1) { - $scope.errmsg = '总比例不能超过1' - isValid = false - return - } - }) - // if (total != 1) { - // $scope.errmsg = "Total proportion must be 1"; - // isValid = false; - // return; - // } - if (isValid) { - $scope.errmsg = null - $scope.data.type = type - var chooseUsers = angular.copy($scope.data) - chooseUsers.start_date = $scope.data.start_date - if (chooseUsers.start_date) { - chooseUsers.start_date = $filter('date')(chooseUsers.start_date, 'yyyyMMdd') - } - $http.put('/sys/partners/' + partner.client_moniker + '/bd_user', $scope.data).then( - function () { - $scope.$close() - }, - function (resp) { - $scope.errmsg = resp.data.message - } - ) - } - } - } - }, - ]) - app.controller('partnerRedpackLogDialogCtrl', [ - '$scope', - '$http', - 'partner', - function ($scope, $http, partner) { - $scope.pagination = {} - $scope.queryParams = {} - $scope.listRedpackLogs = function (page) { - var params = angular.copy($scope.queryParams) - params.page = page || $scope.pagination.page || 1 - $http.get('/sys/redpack/partners/' + partner.client_moniker + '/logs', { params: params }).then(function (resp) { - $scope.logs = resp.data.data - $scope.pagination = resp.data.pagination - }) - } - $scope.listRedpackLogs(1) - }, - ]) - app.controller('partnerAuthFileCtrl', [ - '$scope', - '$http', - '$rootScope', - 'commonDialog', - '$state', - function ($scope, $http, $rootScope, commonDialog, $state) { - if ($state.params.commitType == '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 - $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) { - delete $scope.bankFileProgress - $scope.file.file_bank_info = resp.data.url - $scope.updateFile() - if ($scope.file.file_bank_info.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' }) - }, - function (evt) { - $scope.bankFileProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - $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.file_bank_info && $scope.file.file_bank_info.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.billIsImage = true - if ($scope.file.file_company_info && $scope.file.file_company_info.endsWith('pdf')) { - $scope.billIsImage = false - } - - //上传账单流水 - $scope.uploadBillFile = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.billFileProgress = { value: 0 } - Upload.upload({ - url: '/attachment/files', - data: { file: file }, - }).then( - function (resp) { - delete $scope.billFileProgress - $scope.file.utility_bill_info = resp.data.url - $scope.updateFile() - if ($scope.file.utility_bill_info.endsWith('pdf')) { - $scope.billIsImage = false - } else { - $scope.billIsImage = true - } - }, - function (resp) { - delete $scope.billFileProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.billFileProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - - $scope.uploadCompanyFile = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.companyFileProgress = { value: 0 } - Upload.upload({ - url: '/attachment/files', - data: { file: file }, - }).then( - function (resp) { - delete $scope.companyFileProgress - $scope.file.file_company_info = resp.data.url - $scope.updateFile() - if ($scope.file.file_company_info.endsWith('pdf')) { - $scope.companyIsImage = false - } else { - $scope.companyIsImage = true - } - }, - function (resp) { - delete $scope.companyFileProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.companyFileProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - //上传ID信息 - $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 } - Upload.upload({ - url: '/attachment/files', - data: { file: file }, - }).then( - function (resp) { - delete $scope.idFileProgress - $scope.file.file_id_info = resp.data.url - $scope.updateFile() - if ($scope.file.file_id_info.endsWith('pdf')) { - $scope.idIsImage = false - } else { - $scope.idIsImage = true - } - }, - function (resp) { - delete $scope.idFileProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.idFileProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - - //上传协议文件 - $scope.uploadAgreementFile = function (file) { - if (file != null) { - if (file.size > 10 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过10MB,请压缩后重试', type: 'error' }) - } else { - $scope.agreementFileProgress = { value: 0 } - Upload.upload({ - url: '/attachment/files', - data: { file: file }, - }).then( - function (resp) { - delete $scope.agreementFileProgress - $scope.file.file_agreement_info = resp.data.url - $scope.updateFile() - if ($scope.file.file_agreement_info.endsWith('pdf')) { - $scope.agreeIsImage = false - } else { - $scope.agreeIsImage = true - } - }, - function (resp) { - delete $scope.agreementFileProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.agreementFileProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - - //上传申请表 - $scope.uploadApplyFile = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.applyFileProgress = { value: 0 } - Upload.upload({ - url: '/attachment/files', - data: { file: file }, - }).then( - function (resp) { - delete $scope.applyFileProgress - $scope.file.file_apply_info = resp.data.url - $scope.updateFile() - if ($scope.file.file_apply_info.endsWith('pdf')) { - $scope.applyIsImage = false - } else { - $scope.applyIsImage = true - } - }, - function (resp) { - delete $scope.applyFileProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.applyFileProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - $scope.toggleIdTitle = function (beneficiary_id_title) { - $scope.file.beneficiary_id_title = beneficiary_id_title - } - $scope.saveIdInfo = function () { - if (!$scope.file.id_type) { - commonDialog.alert({ title: 'Error', content: '请选择ID Type', type: 'error' }) - return - } - if ($scope.file.beneficiary_id_title != 'Ultimate beneficiary owner') { - if (!$scope.file.other_id_title_desc) { - commonDialog.alert({ title: 'Error', content: '请简要告知为何无法提供受益股东的资料', type: 'error' }) - return - } - } - var config = {} - config.id_type = $scope.file.id_type - config.beneficiary_id_title = $scope.file.beneficiary_id_title - config.other_id_title_desc = $scope.file.other_id_title_desc - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/id_info', config).then( - function (resp) { - commonDialog.alert({ title: 'Success', content: 'Id Info Updated', type: 'success' }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - $state.reload() - } - ) - } - - $scope.cancelIdInfo = function () { - $state.reload() - $scope.id_info_form.edit = false - } - - $scope.downloadAsZip = function () { - var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/complianceAsZIP' - 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', + } + }, + ]) + app.controller('partnerRedpackLogDialogCtrl', [ + '$scope', + '$http', + 'partner', + function ($scope, $http, partner) { + $scope.pagination = {} + $scope.queryParams = {} + $scope.listRedpackLogs = function (page) { + var params = angular.copy($scope.queryParams) + params.page = page || $scope.pagination.page || 1 + $http.get('/sys/redpack/partners/' + partner.client_moniker + '/logs', {params: params}).then(function (resp) { + $scope.logs = resp.data.data + $scope.pagination = resp.data.pagination }) + } + $scope.listRedpackLogs(1) + }, + ]) + app.controller('partnerAuthFileCtrl', [ + '$scope', + '$http', + '$rootScope', + 'commonDialog', + '$state', + function ($scope, $http, $rootScope, commonDialog, $state) { + if ($state.params.commitType == '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 + $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) { + delete $scope.bankFileProgress + $scope.file.file_bank_info = resp.data.url + $scope.updateFile() + if ($scope.file.file_bank_info.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'}) + }, + function (evt) { + $scope.bankFileProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + $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.file_bank_info && $scope.file.file_bank_info.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.billIsImage = true + if ($scope.file.file_company_info && $scope.file.file_company_info.endsWith('pdf')) { + $scope.billIsImage = false + } + + //上传账单流水 + $scope.uploadBillFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.billFileProgress = {value: 0} + Upload.upload({ + url: '/attachment/files', + data: {file: file}, + }).then( + function (resp) { + delete $scope.billFileProgress + $scope.file.utility_bill_info = resp.data.url + $scope.updateFile() + if ($scope.file.utility_bill_info.endsWith('pdf')) { + $scope.billIsImage = false + } else { + $scope.billIsImage = true + } + }, + function (resp) { + delete $scope.billFileProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.billFileProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + + $scope.uploadCompanyFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.companyFileProgress = {value: 0} + Upload.upload({ + url: '/attachment/files', + data: {file: file}, + }).then( + function (resp) { + delete $scope.companyFileProgress + $scope.file.file_company_info = resp.data.url + $scope.updateFile() + if ($scope.file.file_company_info.endsWith('pdf')) { + $scope.companyIsImage = false + } else { + $scope.companyIsImage = true + } + }, + function (resp) { + delete $scope.companyFileProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.companyFileProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + //上传ID信息 + $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} + Upload.upload({ + url: '/attachment/files', + data: {file: file}, + }).then( + function (resp) { + delete $scope.idFileProgress + $scope.file.file_id_info = resp.data.url + $scope.updateFile() + if ($scope.file.file_id_info.endsWith('pdf')) { + $scope.idIsImage = false + } else { + $scope.idIsImage = true + } + }, + function (resp) { + delete $scope.idFileProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.idFileProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + + //上传协议文件 + $scope.uploadAgreementFile = function (file) { + if (file != null) { + if (file.size > 10 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过10MB,请压缩后重试', type: 'error'}) + } else { + $scope.agreementFileProgress = {value: 0} + Upload.upload({ + url: '/attachment/files', + data: {file: file}, + }).then( + function (resp) { + delete $scope.agreementFileProgress + $scope.file.file_agreement_info = resp.data.url + $scope.updateFile() + if ($scope.file.file_agreement_info.endsWith('pdf')) { + $scope.agreeIsImage = false + } else { + $scope.agreeIsImage = true + } + }, + function (resp) { + delete $scope.agreementFileProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.agreementFileProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + + //上传申请表 + $scope.uploadApplyFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.applyFileProgress = {value: 0} + Upload.upload({ + url: '/attachment/files', + data: {file: file}, + }).then( + function (resp) { + delete $scope.applyFileProgress + $scope.file.file_apply_info = resp.data.url + $scope.updateFile() + if ($scope.file.file_apply_info.endsWith('pdf')) { + $scope.applyIsImage = false + } else { + $scope.applyIsImage = true + } + }, + function (resp) { + delete $scope.applyFileProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.applyFileProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + $scope.toggleIdTitle = function (beneficiary_id_title) { + $scope.file.beneficiary_id_title = beneficiary_id_title + } + $scope.saveIdInfo = function () { + if (!$scope.file.id_type) { + commonDialog.alert({title: 'Error', content: '请选择ID Type', type: 'error'}) + return + } + if ($scope.file.beneficiary_id_title != 'Ultimate beneficiary owner') { + if (!$scope.file.other_id_title_desc) { + commonDialog.alert({title: 'Error', content: '请简要告知为何无法提供受益股东的资料', type: 'error'}) + return + } + } + var config = {} + config.id_type = $scope.file.id_type + config.beneficiary_id_title = $scope.file.beneficiary_id_title + config.other_id_title_desc = $scope.file.other_id_title_desc + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/id_info', config).then( + function (resp) { + commonDialog.alert({title: 'Success', content: 'Id Info Updated', type: 'success'}) + $state.reload() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + $state.reload() + } + ) + } + + $scope.cancelIdInfo = function () { $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 + '/file', $scope.file).then( - function () { - commonDialog.alert({ - title: 'Success', - content: 'Upload Successful', - type: 'success', - }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - - function commitError() { - commonDialog.alert({ - title: 'Error', - content: 'Missing file', - type: 'error', - }) - } - $scope.complianceCheck = function () { - if (!$rootScope.complianceCheck) { - $rootScope.complianceCheck = {} - } - $rootScope.complianceCheck.client_id = $scope.partner.client_id - $rootScope.complianceCheck.authFile = true - } - $scope.complianceChangeCheck = function () { - if ($rootScope.complianceCheck) { - if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { - delete $rootScope.complianceCheck - } - } - } - $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.uploadApplicationFile = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.applicationFileProgress = { value: 0 } - Upload.upload({ - url: '/attachment/files', - data: { file: file }, - }).then( - function (resp) { - $scope.uploadFile = {} - delete $scope.applicationFileProgress - $scope.uploadFile.upay_application_form = resp.data.url - $scope.updateFile() - }, - 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.uploadFile.client_bank_file = resp.data.url - $scope.updateFile() - }, - function (resp) { - delete $scope.bankFileProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.bankFileProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - $scope.uploadASICFile = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.ASICProgress = { value: 0 } - Upload.upload({ - url: '/attachment/files', - data: { file: file }, - }).then( - function (resp) { - $scope.uploadFile = {} - delete $scope.ASICProgress - $scope.uploadFile.client_company_file = resp.data.url - $scope.updateFile() - }, - function (resp) { - delete $scope.ASICProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.ASICProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - $scope.uploadIdFile = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.idProgress = { value: 0 } - Upload.upload({ - url: '/attachment/files', - data: { file: file }, - }).then( - function (resp) { - $scope.uploadFile = {} - delete $scope.idProgress - $scope.uploadFile.upay_driver_license = resp.data.url - $scope.updateFile() - }, - function (resp) { - delete $scope.idProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.idProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - $scope.uploadResidenceFile = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.residenceFileProgress = { value: 0 } - Upload.upload({ - url: '/attachment/files', - data: { file: file }, - }).then( - function (resp) { - $scope.uploadFile = {} - delete $scope.residenceFileProgress - $scope.uploadFile.kyc_utility_bill_file = resp.data.url - $scope.updateFile() - }, - function (resp) { - delete $scope.residenceFileProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.residenceFileProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - $scope.uploadRefundPolicyFile = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.refundPolicyFileProgress = { value: 0 } - Upload.upload({ - url: '/attachment/files', - data: { file: file }, - }).then( - function (resp) { - $scope.uploadFile = {} - delete $scope.refundPolicyFileProgress - $scope.uploadFile.refund_exchange_policy = resp.data.url - $scope.updateFile() - }, - function (resp) { - delete $scope.refundPolicyFileProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $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.uploadFile.upay_privacy_policy = resp.data.url - $scope.updateFile() - }, - 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.uploadFile.card_security_policy = resp.data.url - $scope.updateFile() - }, - 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.uploadFile.upay_offer_letter = resp.data.url - $scope.updateFile() - }, - 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.uploadFile.upay_promotional_offer = resp.data.url - $scope.updateFile() - }, - 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) { + $scope.id_info_form.edit = false + } + + $scope.downloadAsZip = function () { + var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/complianceAsZIP' + 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 + '/file', $scope.file).then( + function () { + commonDialog.alert({ + title: 'Success', + content: 'Upload Successful', + type: 'success', + }) + $state.reload() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + + function commitError() { + commonDialog.alert({ + title: 'Error', + content: 'Missing file', + type: 'error', + }) + } + + $scope.complianceCheck = function () { + if (!$rootScope.complianceCheck) { + $rootScope.complianceCheck = {} + } + $rootScope.complianceCheck.client_id = $scope.partner.client_id + $rootScope.complianceCheck.authFile = true + } + $scope.complianceChangeCheck = function () { + if ($rootScope.complianceCheck) { + if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { + delete $rootScope.complianceCheck + } + } + } + $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.uploadApplicationFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.applicationFileProgress = {value: 0} + Upload.upload({ + url: '/attachment/files', + data: {file: file}, + }).then( + function (resp) { + $scope.uploadFile = {} + delete $scope.applicationFileProgress + $scope.uploadFile.upay_application_form = resp.data.url + $scope.updateFile() + }, + 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.uploadFile.client_bank_file = resp.data.url + $scope.updateFile() + }, + function (resp) { + delete $scope.bankFileProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.bankFileProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + $scope.uploadASICFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.ASICProgress = {value: 0} + Upload.upload({ + url: '/attachment/files', + data: {file: file}, + }).then( + function (resp) { + $scope.uploadFile = {} + delete $scope.ASICProgress + $scope.uploadFile.client_company_file = resp.data.url + $scope.updateFile() + }, + function (resp) { + delete $scope.ASICProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.ASICProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + $scope.uploadIdFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.idProgress = {value: 0} + Upload.upload({ + url: '/attachment/files', + data: {file: file}, + }).then( + function (resp) { + $scope.uploadFile = {} + delete $scope.idProgress + $scope.uploadFile.upay_driver_license = resp.data.url + $scope.updateFile() + }, + function (resp) { + delete $scope.idProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.idProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + $scope.uploadResidenceFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.residenceFileProgress = {value: 0} + Upload.upload({ + url: '/attachment/files', + data: {file: file}, + }).then( + function (resp) { + $scope.uploadFile = {} + delete $scope.residenceFileProgress + $scope.uploadFile.kyc_utility_bill_file = resp.data.url + $scope.updateFile() + }, + function (resp) { + delete $scope.residenceFileProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.residenceFileProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + $scope.uploadRefundPolicyFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.refundPolicyFileProgress = {value: 0} + Upload.upload({ + url: '/attachment/files', + data: {file: file}, + }).then( + function (resp) { + $scope.uploadFile = {} + delete $scope.refundPolicyFileProgress + $scope.uploadFile.refund_exchange_policy = resp.data.url + $scope.updateFile() + }, + function (resp) { + delete $scope.refundPolicyFileProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $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.uploadFile.upay_privacy_policy = resp.data.url + $scope.updateFile() + }, + 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.uploadFile.card_security_policy = resp.data.url + $scope.updateFile() + }, + 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.uploadFile.upay_offer_letter = resp.data.url + $scope.updateFile() + }, + 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.uploadFile.upay_promotional_offer = resp.data.url + $scope.updateFile() + }, + 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'}) @@ -5552,704 +5623,706 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }, 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.uploadFile.upay_desc_file = resp.data.url + $scope.updateFile() + }, + 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'}) + return + } + var config = {} + config.upay_risk_level = $scope.file.upay_risk_level + config.upay_risk_remark = $scope.file.upay_risk_remark + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/mw_risk_info', config).then( + function (resp) { + commonDialog.alert({title: 'Success', content: 'Risk Info Updated', type: 'success'}) + $state.reload() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + $state.reload() + } + ) + } + + $scope.cancelIdInfo = function () { + $state.reload() + $scope.id_info_form.edit = false + } + + $scope.downloadAsZip = function () { + var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/MWcomplianceAsZIP' + return url + } + + $scope.updateFile = 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.go( + 'partners.detail.files', + { + clientMoniker: $scope.partner.client_moniker, + commitType: 'card-payment', + }, + {reload: true} + ) + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + + function commitError() { + commonDialog.alert({ + title: 'Error', + content: 'Missing file', + type: 'error', + }) + } + + $scope.complianceCheck = function () { + if (!$rootScope.complianceCheck) { + $rootScope.complianceCheck = {} + } + $rootScope.complianceCheck.authFile = true + $rootScope.complianceCheck.client_id = $scope.partner.client_id + + if ($scope.file.upay_application_form == null || $scope.file.upay_application_form == '') { + commonDialog.alert({type: 'error', title: 'Error', content: '请补充商户申请表合规文件'}) + $rootScope.complianceCheck.authFile = false + } else if ($scope.file.client_bank_file == null || $scope.file.client_bank_file == '') { + commonDialog.alert({type: 'error', title: 'Error', content: '请补六个月银行对账单合规文件'}) + $rootScope.complianceCheck.authFile = false + } else if ($scope.file.client_company_file == null || $scope.file.client_company_file == '') { + commonDialog.alert({type: 'error', title: 'Error', content: '请补充当前公司信息摘录合规文件'}) + $rootScope.complianceCheck.authFile = false + } else if ($scope.file.upay_driver_license == null || $scope.file.upay_driver_license == '') { + commonDialog.alert({type: 'error', title: 'Error', content: '请补充法人身份证明合规文件'}) + $rootScope.complianceCheck.authFile = false + } else if ($scope.file.kyc_utility_bill_file == null || $scope.file.kyc_utility_bill_file == '') { + commonDialog.alert({type: 'error', title: 'Error', content: '请补充家庭住址证明 (一个水电煤网账单)合规文件'}) + $rootScope.complianceCheck.authFile = false + } + } + $scope.complianceChangeCheck = function () { + if ($rootScope.complianceCheck) { + if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { + delete $rootScope.complianceCheck + } + } + } + $scope.complianceChangeCheck() + + $scope.deleteMWComplianceFiles = 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 + '/mw_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'}) + } + ) + }) + } + }, + ]) + + app.controller('partnerKycFileCtrl', [ + '$scope', + '$http', + '$rootScope', + 'commonDialog', + '$state', + 'Upload', + 'file', + function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) { + $scope.file = file.data || {} + //kyc files + $scope.uploadCompanyFile = 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) { + delete $scope.bankFileProgress + $scope.file.file_company_info = resp.data.url + $scope.updateFile() + if ($scope.file.file_company_info.endsWith('pdf')) { + $scope.companyIsImage = false + } else { + $scope.companyIsImage = true + } + }, + function (resp) { + delete $scope.bankFileProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.bankFileProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + + $scope.companyIsImage = true + if ($scope.file.file_company_info && $scope.file.file_company_info.endsWith('pdf')) { + $scope.companyIsImage = false + } + + $scope.idIsImage = true + if ($scope.file.file_id_info && $scope.file.file_id_info.endsWith('pdf')) { + $scope.idIsImage = false + } + $scope.billIsImage = true + if ($scope.file.file_company_info && $scope.file.file_company_info.endsWith('pdf')) { + $scope.billIsImage = false + } + + //上传ID信息 + $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} + Upload.upload({ + url: '/attachment/files', + data: {file: file}, + }).then( + function (resp) { + delete $scope.idFileProgress + $scope.file.file_id_info = resp.data.url + $scope.updateFile() + if ($scope.file.file_id_info.endsWith('pdf')) { + $scope.idIsImage = false + } else { + $scope.idIsImage = true + } + }, + function (resp) { + delete $scope.idFileProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.idFileProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + + //上传账单流水 + $scope.uploadBillFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.billFileProgress = {value: 0} + Upload.upload({ + url: '/attachment/files', + data: {file: file}, + }).then( + function (resp) { + delete $scope.billFileProgress + $scope.file.utility_bill_info = resp.data.url + $scope.updateFile() + if ($scope.file.utility_bill_info.endsWith('pdf')) { + $scope.billIsImage = false + } else { + $scope.billIsImage = true + } + }, + function (resp) { + delete $scope.billFileProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.billFileProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + + /* $scope.downloadAsZip = function () { + var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/complianceAsZIP'; + 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.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.uploadFile.upay_desc_file = resp.data.url - $scope.updateFile() - }, - 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' }) - return - } - var config = {} - config.upay_risk_level = $scope.file.upay_risk_level - config.upay_risk_remark = $scope.file.upay_risk_remark - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/mw_risk_info', config).then( - function (resp) { - commonDialog.alert({ title: 'Success', content: 'Risk Info Updated', type: 'success' }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - $state.reload() - } - ) - } - - $scope.cancelIdInfo = function () { - $state.reload() - $scope.id_info_form.edit = false - } - - $scope.downloadAsZip = function () { - var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/MWcomplianceAsZIP' - return url - } - - $scope.updateFile = 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.go( - 'partners.detail.files', - { - clientMoniker: $scope.partner.client_moniker, - commitType: 'card-payment', - }, - { reload: true } - ) - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - - function commitError() { - commonDialog.alert({ - title: 'Error', - content: 'Missing file', - type: 'error', - }) - } - $scope.complianceCheck = function () { - if (!$rootScope.complianceCheck) { - $rootScope.complianceCheck = {} - } - $rootScope.complianceCheck.authFile = true - $rootScope.complianceCheck.client_id = $scope.partner.client_id - - if ($scope.file.upay_application_form == null || $scope.file.upay_application_form == '') { - commonDialog.alert({ type: 'error', title: 'Error', content: '请补充商户申请表合规文件' }) - $rootScope.complianceCheck.authFile = false - } else if ($scope.file.client_bank_file == null || $scope.file.client_bank_file == '') { - commonDialog.alert({ type: 'error', title: 'Error', content: '请补六个月银行对账单合规文件' }) - $rootScope.complianceCheck.authFile = false - } else if ($scope.file.client_company_file == null || $scope.file.client_company_file == '') { - commonDialog.alert({ type: 'error', title: 'Error', content: '请补充当前公司信息摘录合规文件' }) - $rootScope.complianceCheck.authFile = false - } else if ($scope.file.upay_driver_license == null || $scope.file.upay_driver_license == '') { - commonDialog.alert({ type: 'error', title: 'Error', content: '请补充法人身份证明合规文件' }) - $rootScope.complianceCheck.authFile = false - } else if ($scope.file.kyc_utility_bill_file == null || $scope.file.kyc_utility_bill_file == '') { - commonDialog.alert({ type: 'error', title: 'Error', content: '请补充家庭住址证明 (一个水电煤网账单)合规文件' }) - $rootScope.complianceCheck.authFile = false - } - } - $scope.complianceChangeCheck = function () { - if ($rootScope.complianceCheck) { - if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { - delete $rootScope.complianceCheck - } - } - } - $scope.complianceChangeCheck() - - $scope.deleteMWComplianceFiles = 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 + '/mw_delete').then( - function (resp) { + $scope.updateFile = function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/kycFile', $scope.file).then( + function () { + commonDialog.alert({ + title: 'Success', + content: 'Upload Successful', + type: 'success', + }) + $state.reload() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + + function commitError() { commonDialog.alert({ - title: 'Success', - content: 'Delete Successful', - type: 'success', + title: 'Error', + content: 'Missing file', + type: 'error', }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - }) - } - }, - ]) - - app.controller('partnerKycFileCtrl', [ - '$scope', - '$http', - '$rootScope', - 'commonDialog', - '$state', - 'Upload', - 'file', - function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) { - $scope.file = file.data || {} - //kyc files - $scope.uploadCompanyFile = 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) { - delete $scope.bankFileProgress - $scope.file.file_company_info = resp.data.url - $scope.updateFile() - if ($scope.file.file_company_info.endsWith('pdf')) { - $scope.companyIsImage = false - } else { - $scope.companyIsImage = true - } - }, - function (resp) { - delete $scope.bankFileProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.bankFileProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - - $scope.companyIsImage = true - if ($scope.file.file_company_info && $scope.file.file_company_info.endsWith('pdf')) { - $scope.companyIsImage = false - } - - $scope.idIsImage = true - if ($scope.file.file_id_info && $scope.file.file_id_info.endsWith('pdf')) { - $scope.idIsImage = false - } - $scope.billIsImage = true - if ($scope.file.file_company_info && $scope.file.file_company_info.endsWith('pdf')) { - $scope.billIsImage = false - } - - //上传ID信息 - $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 } - Upload.upload({ - url: '/attachment/files', - data: { file: file }, - }).then( - function (resp) { - delete $scope.idFileProgress - $scope.file.file_id_info = resp.data.url - $scope.updateFile() - if ($scope.file.file_id_info.endsWith('pdf')) { - $scope.idIsImage = false - } else { - $scope.idIsImage = true - } - }, - function (resp) { - delete $scope.idFileProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.idFileProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - - //上传账单流水 - $scope.uploadBillFile = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.billFileProgress = { value: 0 } - Upload.upload({ - url: '/attachment/files', - data: { file: file }, - }).then( - function (resp) { - delete $scope.billFileProgress - $scope.file.utility_bill_info = resp.data.url - $scope.updateFile() - if ($scope.file.utility_bill_info.endsWith('pdf')) { - $scope.billIsImage = false + } + + $scope.complianceCheck = function () { + if (!$rootScope.complianceCheck) { + $rootScope.complianceCheck = {} + } + $rootScope.complianceCheck.client_id = $scope.partner.client_id + $rootScope.complianceCheck.authFile = true + } + $scope.complianceChangeCheck = function () { + if ($rootScope.complianceCheck) { + if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { + delete $rootScope.complianceCheck + } + } + } + $scope.complianceChangeCheck() + }, + ]) + + app.controller('partnerSettlementCtrl', [ + '$scope', + '$uibModal', + '$http', + 'clientMoniker', + '$filter', + function ($scope, $uibModal, $http, clientMoniker, $filter) { + $scope.params = {} + $scope.pagination = {} + $scope.clients = [] + $scope.showLevel3Clients = false + $scope.isLevel3All = true + $scope.clinet = {} + $scope.isAll = true + $scope.more20ChoseSubClient = false + $scope.choseSubClientNow = 'More' + $scope.searchSubClients = function (subSearchText, page) { + $scope.subClientTable1 = [$scope.partner] + $scope.subClientTable2 = [] + var params = {} + params.page = page || $scope.subClientPagination.page || 1 + if (subSearchText != '') { + $scope.subSearchText = subSearchText + params.searchText = subSearchText + } + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients/page', {params: params}).then(function (resp) { + var clientList = resp.data.data + $scope.subClientPagination = resp.data.pagination + clientList.forEach(function (client) { + if ($scope.subClientTable1.length < 11) { + $scope.subClientTable1.push(client) + } else { + $scope.subClientTable2.push(client) + } + $scope.clients.push(client) + }) + }) + } + $scope.initClientInfo = function () { + $http.get('/sys/partners/' + clientMoniker).then(function (resp) { + $scope.client = resp.data + $scope.clients = [$scope.client] + if ($scope.client.has_children && !$scope.client.hide_sub_mch) { + $scope.searchSubClients('', 1) + $scope.params.dateto = new Date() + var day = new Date() + day.setDate(day.getDate() - 7) + $scope.params.datefrom = day + $scope.chooseClient('all') + } else { + $scope.params.dateto = new Date() + var day = new Date() + day.setDate(day.getDate() - 7) + $scope.params.datefrom = day + $scope.chooseClient('all') + } + }) + } + $scope.initClientInfo() + + $scope.exportSettlementLogs = function () { + var params = angular.copy($scope.params) + var url = '/sys/partners/' + clientMoniker + '/lists_settlements/excel' + var connectSymbol = '?' + if (params.datefrom) { + params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd') + url += connectSymbol + 'datefrom=' + params.datefrom + connectSymbol = '&' + } + if (params.dateto) { + params.dateto = $filter('date')(params.dateto, 'yyyyMMdd') + url += connectSymbol + 'dateto=' + params.dateto + } + if (params.client_ids && !$scope.isAll) { + params.client_ids.forEach(function (i) { + url += connectSymbol + 'client_ids=' + i + connectSymbol = '&' + }) + } + return url + } + + $scope.chooseClient = function (client) { + if (client == 'all') { + $scope.choseSubClientNow = 'More' + $scope.params.client_ids = angular.copy($scope.clientIds) + $scope.isAll = true + $scope.chooseClientId = '' + $scope.showLevel3Clients = false + } else if (client.level3Clients) { + $scope.chooseClientId = client.client_id + $scope.showLevel3Clients = true + $scope.level3Clients = client.level3Clients + $scope.isAll = false + $scope.level3ClientIds = [] + $scope.level3ClientIds.push(client.client_id) + client.level3Clients.forEach(function (client) { + $scope.level3ClientIds.push(client.client_id) + }) + $scope.chooseLevel3Client('all') + return } else { - $scope.billIsImage = true - } - }, - function (resp) { - delete $scope.billFileProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.billFileProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } + $scope.chooseClientId = client.client_id + $scope.params.client_ids = [client.client_id] + $scope.isAll = false + $scope.showLevel3Clients = false + } + $scope.loadSettlementLogs() + } - /* $scope.downloadAsZip = function () { - var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/complianceAsZIP'; - return url; - };*/ + $scope.today = new Date() + $scope.chooseToday = function () { + $scope.params.datefrom = $scope.params.dateto = new Date() + $scope.loadSettlementLogs(1) + } + $scope.chooseYesterday = function () { + var yesterday = new Date() + yesterday.setDate(yesterday.getDate() - 1) + $scope.params.datefrom = $scope.params.dateto = yesterday + $scope.loadSettlementLogs(1) + } + $scope.chooseLast7Days = function () { + $scope.params.dateto = new Date() + var day = new Date() + day.setDate(day.getDate() - 7) + $scope.params.datefrom = day + $scope.loadSettlementLogs(1) + } + $scope.thisMonth = function () { + $scope.params.dateto = new Date() + var monthBegin = new Date() + monthBegin.setDate(1) + $scope.params.datefrom = monthBegin + $scope.loadSettlementLogs(1) + } + $scope.lastMonth = function () { + var monthFinish = new Date() + monthFinish.setDate(0) + $scope.params.dateto = monthFinish + var monthBegin = new Date() + monthBegin.setDate(0) + monthBegin.setDate(1) + $scope.params.datefrom = monthBegin + $scope.loadSettlementLogs(1) + } + $scope.loadSettlementLogs = function (page) { + var params = angular.copy($scope.params) + if (params.datefrom) { + params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd') + } + if (params.dateto) { + params.dateto = $filter('date')(params.dateto, 'yyyyMMdd') + } + params.page = page || $scope.pagination.page || 1 + params.limit = 10 + if ($scope.isAll) { + delete params.client_ids + } + $http.get('/sys/partners/' + clientMoniker + '/lists_settlements', {params: params}).then(function (resp) { + $scope.settlementLogs = resp.data.data + $scope.padding = resp.data.padding + $scope.pagination = resp.data.pagination + }) + } + $scope.getClearingTransactions = function (client_id, detail_id) { + $uibModal.open({ + templateUrl: '/static/analysis/templates/settlement_transactions.html', + controller: 'managerSettlementDetailCtrl', + resolve: { + detail: [ + '$http', + '$stateParams', + function ($http) { + return $http.get('/analysis/partner_card/' + client_id + '/settlement_logs/' + detail_id) + }, + ], + detail_id: detail_id, + }, + size: 'lg', + }) + } - $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', + $scope.getClearingTransactionsOfMergeSettle = function (reportDate) { + $uibModal.open({ + templateUrl: '/static/analysis/templates/settlement_transactions.html', + controller: 'managerSettlementDetailOfMergeSettleCtrl', + resolve: { + detail: [ + '$http', + '$stateParams', + function ($http) { + return $http.get('/analysis/partner_card/' + $scope.client.client_id + '/settlement_logs/report_date/' + reportDate) + }, + ], + client_id: $scope.client.client_id, + }, + size: 'lg', }) - $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 + '/kycFile', $scope.file).then( - function () { - commonDialog.alert({ - title: 'Success', - content: 'Upload Successful', - type: 'success', + } + + $scope.checkSubClientChoseShow = function (client) { + $scope.more20ChoseSubClient = !$scope.more20ChoseSubClient + if (client != '') { + $scope.choseSubClientNow = client.short_name + } + } + $scope.clickDisplayChoseDiv = function (event) { + $scope.more20ChoseSubClient = false + } + $scope.choseDivStopPropagation = function (event) { + event.stopPropagation() + } + }, + ]) + app.controller('partnerSurchargeAccountCtrl', [ + '$scope', + '$uibModal', + '$http', + 'clientMoniker', + '$filter', + function ($scope, $uibModal, $http, clientMoniker, $filter) { + $scope.params = {} + $scope.pagination = {} + $scope.today = new Date() + + $scope.chooseToday = function () { + $scope.params.datefrom = $scope.params.dateto = new Date() + $scope.loadSettlementLogs(1) + } + $scope.chooseYesterday = function () { + var yesterday = new Date() + yesterday.setDate(yesterday.getDate() - 1) + $scope.params.datefrom = $scope.params.dateto = yesterday + $scope.loadSettlementLogs(1) + } + $scope.chooseLast7Days = function () { + $scope.params.dateto = new Date() + var day = new Date() + day.setDate(day.getDate() - 7) + $scope.params.datefrom = day + $scope.loadSettlementLogs(1) + } + $scope.thisMonth = function () { + $scope.params.dateto = new Date() + var monthBegin = new Date() + monthBegin.setDate(1) + $scope.params.datefrom = monthBegin + $scope.loadSettlementLogs(1) + } + $scope.lastMonth = function () { + var monthFinish = new Date() + monthFinish.setDate(0) + $scope.params.dateto = monthFinish + var monthBegin = new Date() + monthBegin.setDate(0) + monthBegin.setDate(1) + $scope.params.datefrom = monthBegin + $scope.loadSettlementLogs(1) + } + $scope.loadSettlementLogs = function (page) { + var params = angular.copy($scope.params) + if (params.datefrom) { + params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd') + } + if (params.dateto) { + params.dateto = $filter('date')(params.dateto, 'yyyyMMdd') + } + params.page = page || $scope.pagination.page || 1 + params.limit = 10 + $http.get('/sys/partners/' + clientMoniker + '/surcharge_account/month_detail').then(function (resp) { + $scope.details = resp.data + }) + } + $scope.getClearingTransactions = function (client_id, detail_id) { + $uibModal.open({ + templateUrl: '/static/analysis/templates/settlement_transactions.html', + controller: 'managerSettlementDetailCtrl', + resolve: { + detail: [ + '$http', + '$stateParams', + function ($http) { + return $http.get('/analysis/partner_card/' + client_id + '/settlement_logs/' + detail_id) + }, + ], + detail_id: detail_id, + }, + size: 'lg', + }) + } + $scope.chooseLast7Days() + }, + ]) + app.controller('managerSettlementDetailCtrl', [ + '$scope', + 'detail', + 'detail_id', + '$http', + function ($scope, detail, detail_id, $http) { + $scope.ctrl = {channel: null} + $scope.show = true + $scope.report = detail.data + $scope.report.total_charge = Decimal.add($scope.report.total_charge, $scope.report.tax_amount).toFixed(2) + angular.forEach($scope.report.channels, function (e) { + e.total_charge = Decimal.add(e.tax_amount, e.total_charge).toFixed(2) }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - - function commitError() { - commonDialog.alert({ - title: 'Error', - content: 'Missing file', - type: 'error', - }) - } - $scope.complianceCheck = function () { - if (!$rootScope.complianceCheck) { - $rootScope.complianceCheck = {} - } - $rootScope.complianceCheck.client_id = $scope.partner.client_id - $rootScope.complianceCheck.authFile = true - } - $scope.complianceChangeCheck = function () { - if ($rootScope.complianceCheck) { - if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { - delete $rootScope.complianceCheck - } - } - } - $scope.complianceChangeCheck() - }, - ]) - - app.controller('partnerSettlementCtrl', [ - '$scope', - '$uibModal', - '$http', - 'clientMoniker', - '$filter', - function ($scope, $uibModal, $http, clientMoniker, $filter) { - $scope.params = {} - $scope.pagination = {} - $scope.clients = [] - $scope.showLevel3Clients = false - $scope.isLevel3All = true - $scope.clinet = {} - $scope.isAll = true - $scope.more20ChoseSubClient = false - $scope.choseSubClientNow = 'More' - $scope.searchSubClients = function (subSearchText, page) { - $scope.subClientTable1 = [$scope.partner] - $scope.subClientTable2 = [] - var params = {} - params.page = page || $scope.subClientPagination.page || 1 - if (subSearchText != '') { - $scope.subSearchText = subSearchText - params.searchText = subSearchText - } - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients/page', { params: params }).then(function (resp) { - var clientList = resp.data.data - $scope.subClientPagination = resp.data.pagination - clientList.forEach(function (client) { - if ($scope.subClientTable1.length < 11) { - $scope.subClientTable1.push(client) - } else { - $scope.subClientTable2.push(client) - } - $scope.clients.push(client) - }) - }) - } - $scope.initClientInfo = function () { - $http.get('/sys/partners/' + clientMoniker).then(function (resp) { - $scope.client = resp.data - $scope.clients = [$scope.client] - if ($scope.client.has_children && !$scope.client.hide_sub_mch) { - $scope.searchSubClients('', 1) - $scope.params.dateto = new Date() - var day = new Date() - day.setDate(day.getDate() - 7) - $scope.params.datefrom = day - $scope.chooseClient('all') - } else { - $scope.params.dateto = new Date() - var day = new Date() - day.setDate(day.getDate() - 7) - $scope.params.datefrom = day - $scope.chooseClient('all') - } - }) - } - $scope.initClientInfo() - - $scope.exportSettlementLogs = function () { - var params = angular.copy($scope.params) - var url = '/sys/partners/' + clientMoniker + '/lists_settlements/excel' - var connectSymbol = '?' - if (params.datefrom) { - params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd') - url += connectSymbol + 'datefrom=' + params.datefrom - connectSymbol = '&' - } - if (params.dateto) { - params.dateto = $filter('date')(params.dateto, 'yyyyMMdd') - url += connectSymbol + 'dateto=' + params.dateto - } - if (params.client_ids && !$scope.isAll) { - params.client_ids.forEach(function (i) { - url += connectSymbol + 'client_ids=' + i - connectSymbol = '&' - }) - } - return url - } - - $scope.chooseClient = function (client) { - if (client == 'all') { - $scope.choseSubClientNow = 'More' - $scope.params.client_ids = angular.copy($scope.clientIds) - $scope.isAll = true - $scope.chooseClientId = '' - $scope.showLevel3Clients = false - } else if (client.level3Clients) { - $scope.chooseClientId = client.client_id - $scope.showLevel3Clients = true - $scope.level3Clients = client.level3Clients - $scope.isAll = false - $scope.level3ClientIds = [] - $scope.level3ClientIds.push(client.client_id) - client.level3Clients.forEach(function (client) { - $scope.level3ClientIds.push(client.client_id) - }) - $scope.chooseLevel3Client('all') - return - } else { - $scope.chooseClientId = client.client_id - $scope.params.client_ids = [client.client_id] - $scope.isAll = false - $scope.showLevel3Clients = false - } - $scope.loadSettlementLogs() - } - - $scope.today = new Date() - $scope.chooseToday = function () { - $scope.params.datefrom = $scope.params.dateto = new Date() - $scope.loadSettlementLogs(1) - } - $scope.chooseYesterday = function () { - var yesterday = new Date() - yesterday.setDate(yesterday.getDate() - 1) - $scope.params.datefrom = $scope.params.dateto = yesterday - $scope.loadSettlementLogs(1) - } - $scope.chooseLast7Days = function () { - $scope.params.dateto = new Date() - var day = new Date() - day.setDate(day.getDate() - 7) - $scope.params.datefrom = day - $scope.loadSettlementLogs(1) - } - $scope.thisMonth = function () { - $scope.params.dateto = new Date() - var monthBegin = new Date() - monthBegin.setDate(1) - $scope.params.datefrom = monthBegin - $scope.loadSettlementLogs(1) - } - $scope.lastMonth = function () { - var monthFinish = new Date() - monthFinish.setDate(0) - $scope.params.dateto = monthFinish - var monthBegin = new Date() - monthBegin.setDate(0) - monthBegin.setDate(1) - $scope.params.datefrom = monthBegin - $scope.loadSettlementLogs(1) - } - $scope.loadSettlementLogs = function (page) { - var params = angular.copy($scope.params) - if (params.datefrom) { - params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd') - } - if (params.dateto) { - params.dateto = $filter('date')(params.dateto, 'yyyyMMdd') - } - params.page = page || $scope.pagination.page || 1 - params.limit = 10 - if ($scope.isAll) { - delete params.client_ids - } - $http.get('/sys/partners/' + clientMoniker + '/lists_settlements', { params: params }).then(function (resp) { - $scope.settlementLogs = resp.data.data - $scope.padding = resp.data.padding - $scope.pagination = resp.data.pagination - }) - } - $scope.getClearingTransactions = function (client_id, detail_id) { - $uibModal.open({ - templateUrl: '/static/analysis/templates/settlement_transactions.html', - controller: 'managerSettlementDetailCtrl', - resolve: { - detail: [ - '$http', - '$stateParams', - function ($http) { - return $http.get('/analysis/partner_card/' + client_id + '/settlement_logs/' + detail_id) - }, - ], - detail_id: detail_id, - }, - size: 'lg', - }) - } - - $scope.getClearingTransactionsOfMergeSettle = function (reportDate) { - $uibModal.open({ - templateUrl: '/static/analysis/templates/settlement_transactions.html', - controller: 'managerSettlementDetailOfMergeSettleCtrl', - resolve: { - detail: [ - '$http', - '$stateParams', - function ($http) { - return $http.get('/analysis/partner_card/' + $scope.client.client_id + '/settlement_logs/report_date/' + reportDate) - }, - ], - client_id: $scope.client.client_id, - }, - size: 'lg', - }) - } - - $scope.checkSubClientChoseShow = function (client) { - $scope.more20ChoseSubClient = !$scope.more20ChoseSubClient - if (client != '') { - $scope.choseSubClientNow = client.short_name - } - } - $scope.clickDisplayChoseDiv = function (event) { - $scope.more20ChoseSubClient = false - } - $scope.choseDivStopPropagation = function (event) { - event.stopPropagation() - } - }, - ]) - app.controller('partnerSurchargeAccountCtrl', [ - '$scope', - '$uibModal', - '$http', - 'clientMoniker', - '$filter', - function ($scope, $uibModal, $http, clientMoniker, $filter) { - $scope.params = {} - $scope.pagination = {} - $scope.today = new Date() - - $scope.chooseToday = function () { - $scope.params.datefrom = $scope.params.dateto = new Date() - $scope.loadSettlementLogs(1) - } - $scope.chooseYesterday = function () { - var yesterday = new Date() - yesterday.setDate(yesterday.getDate() - 1) - $scope.params.datefrom = $scope.params.dateto = yesterday - $scope.loadSettlementLogs(1) - } - $scope.chooseLast7Days = function () { - $scope.params.dateto = new Date() - var day = new Date() - day.setDate(day.getDate() - 7) - $scope.params.datefrom = day - $scope.loadSettlementLogs(1) - } - $scope.thisMonth = function () { - $scope.params.dateto = new Date() - var monthBegin = new Date() - monthBegin.setDate(1) - $scope.params.datefrom = monthBegin - $scope.loadSettlementLogs(1) - } - $scope.lastMonth = function () { - var monthFinish = new Date() - monthFinish.setDate(0) - $scope.params.dateto = monthFinish - var monthBegin = new Date() - monthBegin.setDate(0) - monthBegin.setDate(1) - $scope.params.datefrom = monthBegin - $scope.loadSettlementLogs(1) - } - $scope.loadSettlementLogs = function (page) { - var params = angular.copy($scope.params) - if (params.datefrom) { - params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd') - } - if (params.dateto) { - params.dateto = $filter('date')(params.dateto, 'yyyyMMdd') - } - params.page = page || $scope.pagination.page || 1 - params.limit = 10 - $http.get('/sys/partners/' + clientMoniker + '/surcharge_account/month_detail').then(function (resp) { - $scope.details = resp.data - }) - } - $scope.getClearingTransactions = function (client_id, detail_id) { - $uibModal.open({ - templateUrl: '/static/analysis/templates/settlement_transactions.html', - controller: 'managerSettlementDetailCtrl', - resolve: { - detail: [ - '$http', - '$stateParams', - function ($http) { - return $http.get('/analysis/partner_card/' + client_id + '/settlement_logs/' + detail_id) - }, - ], - detail_id: detail_id, - }, - size: 'lg', - }) - } - $scope.chooseLast7Days() - }, - ]) - app.controller('managerSettlementDetailCtrl', [ - '$scope', - 'detail', - 'detail_id', - '$http', - function ($scope, detail, detail_id, $http) { - $scope.ctrl = { channel: null } - $scope.show = true - $scope.report = detail.data - $scope.report.total_charge = Decimal.add($scope.report.total_charge, $scope.report.tax_amount).toFixed(2) - angular.forEach($scope.report.channels, function (e) { - e.total_charge = Decimal.add(e.tax_amount, e.total_charge).toFixed(2) - }) - - $scope.channelAndDayOfAnalysis = function () { - $http.get('/analysis/partner_card/settlement_logs/' + detail_id + '/analysis/' + $scope.ctrl.channel).then(function (resp) { - $scope.channelAndDayMap = resp.data - $scope.index = 0 - }) - } - $scope.channelAndDayOfAnalysis(1) - }, - ]) - app.controller('managerSettlementDetailOfMergeSettleCtrl', [ - '$scope', - 'detail', - 'client_id', - '$http', - function ($scope, detail, client_id, $http) { - $scope.ctrl = { channel: null } - $scope.show = true - $scope.report = detail.data - $scope.report.total_charge = Decimal.add($scope.report.total_charge, $scope.report.tax_amount).toFixed(2) - angular.forEach($scope.report.channels, function (e) { - e.total_charge = Decimal.add(e.tax_amount, e.total_charge).toFixed(2) - }) - }, - ]) - app.controller('productCtrl', [ - '$scope', - '$http', - '$uibModal', - 'commonDialog', - '$state', - 'Upload', - 'wechatGoodMcc', - function ($scope, $http, $uibModal, commonDialog, $state, Upload, wechatGoodMcc) { - $scope.importShow = 0 - $scope.pagination = {} - $scope.params = { text_type: 'all', search_text: null } - $scope.wechatMccIndustries = wechatGoodMcc.configs() - $scope.loadProducts = function () { - $http.get('/sys/product/' + $scope.partner.client_moniker + '/list').then(function (resp) { - $scope.mcc_goods = resp.data - }) - } - $scope.updateMccInfo = function (mccInfo) { - mccInfo.client_moniker = $scope.partner.client_moniker - $http.put('/sys/product/update', mccInfo).then(function (resp) { - $state.reload() - }) - } - $scope.loadProducts() - /*$scope.importExcel = function (file) { + + $scope.channelAndDayOfAnalysis = function () { + $http.get('/analysis/partner_card/settlement_logs/' + detail_id + '/analysis/' + $scope.ctrl.channel).then(function (resp) { + $scope.channelAndDayMap = resp.data + $scope.index = 0 + }) + } + $scope.channelAndDayOfAnalysis(1) + }, + ]) + app.controller('managerSettlementDetailOfMergeSettleCtrl', [ + '$scope', + 'detail', + 'client_id', + '$http', + function ($scope, detail, client_id, $http) { + $scope.ctrl = {channel: null} + $scope.show = true + $scope.report = detail.data + $scope.report.total_charge = Decimal.add($scope.report.total_charge, $scope.report.tax_amount).toFixed(2) + angular.forEach($scope.report.channels, function (e) { + e.total_charge = Decimal.add(e.tax_amount, e.total_charge).toFixed(2) + }) + }, + ]) + app.controller('productCtrl', [ + '$scope', + '$http', + '$uibModal', + 'commonDialog', + '$state', + 'Upload', + 'wechatGoodMcc', + function ($scope, $http, $uibModal, commonDialog, $state, Upload, wechatGoodMcc) { + $scope.importShow = 0 + $scope.pagination = {} + $scope.params = {text_type: 'all', search_text: null} + $scope.wechatMccIndustries = wechatGoodMcc.configs() + $scope.loadProducts = function () { + $http.get('/sys/product/' + $scope.partner.client_moniker + '/list').then(function (resp) { + $scope.mcc_goods = resp.data + }) + } + $scope.updateMccInfo = function (mccInfo) { + mccInfo.client_moniker = $scope.partner.client_moniker + $http.put('/sys/product/update', mccInfo).then(function (resp) { + $state.reload() + }) + } + $scope.loadProducts() + /*$scope.importExcel = function (file) { if (file != null) { Upload.upload({ url: '/attachment/files', @@ -6271,2078 +6344,2116 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) } }*/ - }, - ]) - app.controller('AddProductDialogCtrl', [ - '$scope', - '$http', - '$uibModal', - 'product', - 'partner', - '$state', - 'industryMap', - function ($scope, $http, $uibModal, product, partner, $state, industryMap) { - $scope.product = angular.copy(product) - $scope.product.partner = true - $scope.partner = angular.copy(partner) - $scope.industries = industryMap.configs() - - if ($scope.product.commodity_id) { - $scope.edit_or_add = 'Edit' - } else { - $scope.edit_or_add = 'Add' - $scope.product.industry = $scope.partner.industry - } - $scope.save = function () { - if ($scope.product.commodity_id) { - $http.put('/client/product/', $scope.product).then(function (resp) { - alert('Success') - $scope.$close() - $state.reload() - }) - } else { - $http.post('/client/product/' + $scope.partner.client_moniker, $scope.product).then(function (resp) { - alert('Success') - $scope.$close() - $state.reload() - }) - } - } - }, - ]) - // MID Management - app.controller('subMerchantIdApplicaitonsCtrl', [ - '$scope', - '$http', - '$uibModal', - '$state', - 'commonDialog', - '$sce', - function ($scope, $http, $uibModal, $state, commonDialog, $sce) { - // 初始化子商户 - $scope.loadSubMerchantInfos = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_sub_applices', { params: {} }).then(function (resp) { - $scope.subMerchantInfos = resp.data - }) - // $http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_rpay_sub_applices', {params: {}}).then(function (resp) { - // $scope.subRpayMerchantInfos = resp.data; - // }); - // - // $http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_yeepay_sub_applices', {params: {}}).then(function (resp) { - // $scope.subYeepayMerchantInfos = resp.data; - // }); - // $http.get('/sys/partners/' + $scope.partner.client_moniker + '/queryMWMerchantIdStatus').then(function (resp) { - // $scope.partner.cardInfo = resp.data; - // }); - } - $scope.loadSubMerchantInfos() - // 加载卡支付信息 - $scope.loadCardInfos = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/queryMWMerchantIdStatus').then(function (resp) { - $scope.cardInfo = resp.data - }) - } - $scope.loadCardInfos() - // 初始化信息 - $scope.loadPartnerInfo = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { - $scope.partnerInfo = resp.data - $scope.doSwitchCommonSubMerchantId() - }) - } - $scope.loadPartnerInfo() - // 编辑Wechat Sub Merchant Id - $scope.saveSubMerchantId = function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', { sub_merchant_id: $scope.partnerInfo.sub_merchant_id }).then( - function (resp) { - $scope.loadPartnerInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - // Wechat-applay - $scope.applyWxSubMerchantId = function () { - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/new_apply_wx_sub_merchant_id.html', - controller: 'newApplyWxSubMerchantIdCtrl', - resolve: { - subMerchantInfo: function () { - return $scope.partner - }, - merchantIds: [ - '$http', - '$stateParams', - function ($http) { - return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids') - }, - ], - }, - }) - .result.then(function () { + }, + ]) + app.controller('AddProductDialogCtrl', [ + '$scope', + '$http', + '$uibModal', + 'product', + 'partner', + '$state', + 'industryMap', + function ($scope, $http, $uibModal, product, partner, $state, industryMap) { + $scope.product = angular.copy(product) + $scope.product.partner = true + $scope.partner = angular.copy(partner) + $scope.industries = industryMap.configs() + + if ($scope.product.commodity_id) { + $scope.edit_or_add = 'Edit' + } else { + $scope.edit_or_add = 'Add' + $scope.product.industry = $scope.partner.industry + } + $scope.save = function () { + if ($scope.product.commodity_id) { + $http.put('/client/product/', $scope.product).then(function (resp) { + alert('Success') + $scope.$close() + $state.reload() + }) + } else { + $http.post('/client/product/' + $scope.partner.client_moniker, $scope.product).then(function (resp) { + alert('Success') + $scope.$close() + $state.reload() + }) + } + } + }, + ]) + // MID Management + app.controller('subMerchantIdApplicaitonsCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + 'commonDialog', + '$sce', + function ($scope, $http, $uibModal, $state, commonDialog, $sce) { + // 初始化子商户 + $scope.loadSubMerchantInfos = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_sub_applices', {params: {}}).then(function (resp) { + $scope.subMerchantInfos = resp.data + }) + // $http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_rpay_sub_applices', {params: {}}).then(function (resp) { + // $scope.subRpayMerchantInfos = resp.data; + // }); + // + // $http.get('/sys/partners/' + $scope.partner.client_moniker + '/list_yeepay_sub_applices', {params: {}}).then(function (resp) { + // $scope.subYeepayMerchantInfos = resp.data; + // }); + // $http.get('/sys/partners/' + $scope.partner.client_moniker + '/queryMWMerchantIdStatus').then(function (resp) { + // $scope.partner.cardInfo = resp.data; + // }); + } $scope.loadSubMerchantInfos() - }) - } - // 刷新Wechat Sub Merchant Id - $scope.queryWechatSubMerchantIdStatus = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids/' + $scope.partnerInfo.sub_merchant_id + '/status').then( - function (resp) { - commonDialog.alert({ - title: 'Wechat Apply Status(' + resp.data.apply_status + ')', - content: resp.data.response_str, - type: 'info', - }) - $scope.loadPartnerInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - // history - $scope.showSubMerchantLogs = function () { - $uibModal.open({ - templateUrl: '/static/payment/partner/templates/client_sub_merchant_id_log.html', - controller: 'clientSubMerchantIdLogCtrl', - size: 'lg', - resolve: { - logs: [ - '$http', - function ($http) { - return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_sub_merchant_id_logs') - }, - ], - }, - }) - } - // 刷新Wechat Institution Merchant Id - $scope.refreshWechatInstitutionMerchantId = function () { - $http - .put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', { - wechat_institution_merchant_id: $scope.partnerInfo.wechat_institution_merchant_id, - }) - .then( - function (resp) { - $scope.loadPartnerInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - // switch开关 - $scope.doSwitchCommonSubMerchantId = function () { - $("input[name='switch']").bootstrapSwitch({ - onText: 'ON', - offText: 'OFF', - size: 'mini', - state: $scope.partnerInfo.common_sub_merchant_id, - onSwitchChange: function (event, state) { - //监听switch change事件,可以根据状态把相应的业务逻辑代码写在这里 - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/common_sub_merchant_id', { allow: state }).then( - function () { - $scope.loadPartnerInfo() - }, - function (resp) { - commonDialog.alert({ - title: 'Failed to change common_sub_merchant_id permission status', - content: resp.data.message, - type: 'error', + // 加载卡支付信息 + $scope.loadCardInfos = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/queryMWMerchantIdStatus').then(function (resp) { + $scope.cardInfo = resp.data }) - } - ) - }, - }) - } - // Alipay保存名称修改 - $scope.saveAliSubMerchantId = function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/ali_sub_merchant_id', { ali_sub_merchant_id: $scope.partnerInfo.ali_sub_merchant_id }).then( - function (resp) { - commonDialog.alert({ - title: 'Success', - content: 'Modify Ali Sub Merchant ID successfully', - type: 'success', - }) + } + $scope.loadCardInfos() + // 初始化信息 + $scope.loadPartnerInfo = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { + $scope.partnerInfo = resp.data + $scope.doSwitchCommonSubMerchantId() + }) + } $scope.loadPartnerInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - // 刷新Alipay - $scope.queryAlipayGms = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms').then( - function (resp) { - commonDialog.alert({ title: 'Success', content: resp.data.result_status, type: 'success' }) - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: '查询失败:' + resp.data.message, type: 'error' }) - } - ) - } - // 刷新AlipayOnline - $scope.queryAlipayOnlineGms = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms').then( - function (resp) { - commonDialog.alert({ title: 'Success', content: resp.data.result_status, type: 'success' }) - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: '查询失败:' + resp.data.message, type: 'error' }) - } - ) - } - // Alipay进件 - $scope.submitAlipaySubId = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms_json').then(function (resp) { - $scope.alipay_gms_json = resp.data - commonDialog - .confirm({ - title: 'Warning', - content: '是否使用该商户的现有信息进件?', - json: $scope.alipay_gms_json, - }) - .then(function () { - $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms').then( - function () { - commonDialog.alert({ title: 'Success', content: 'Alipay进件成功', type: 'success' }) - $scope.loadPartnerInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: '进件失败:' + resp.data.message, type: 'error' }) + // 编辑Wechat Sub Merchant Id + $scope.saveSubMerchantId = function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: $scope.partnerInfo.sub_merchant_id}).then( + function (resp) { + $scope.loadPartnerInfo() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + // Wechat-applay + $scope.applyWxSubMerchantId = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/new_apply_wx_sub_merchant_id.html', + controller: 'newApplyWxSubMerchantIdCtrl', + resolve: { + subMerchantInfo: function () { + return $scope.partner + }, + merchantIds: [ + '$http', + '$stateParams', + function ($http) { + return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids') + }, + ], + }, + }) + .result.then(function () { + $scope.loadSubMerchantInfos() + }) + } + // 刷新Wechat Sub Merchant Id + $scope.queryWechatSubMerchantIdStatus = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids/' + $scope.partnerInfo.sub_merchant_id + '/status').then( + function (resp) { + commonDialog.alert({ + title: 'Wechat Apply Status(' + resp.data.apply_status + ')', + content: resp.data.response_str, + type: 'info', + }) + $scope.loadPartnerInfo() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + // history + $scope.showSubMerchantLogs = function () { + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/client_sub_merchant_id_log.html', + controller: 'clientSubMerchantIdLogCtrl', + size: 'lg', + resolve: { + logs: [ + '$http', + function ($http) { + return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_sub_merchant_id_logs') + }, + ], + }, + }) + } + // 刷新Wechat Institution Merchant Id + $scope.refreshWechatInstitutionMerchantId = function () { + $http + .put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_institution_merchant_id', { + wechat_institution_merchant_id: $scope.partnerInfo.wechat_institution_merchant_id, + }) + .then( + function (resp) { + $scope.loadPartnerInfo() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + // switch开关 + $scope.doSwitchCommonSubMerchantId = function () { + $("input[name='switch']").bootstrapSwitch({ + onText: 'ON', + offText: 'OFF', + size: 'mini', + state: $scope.partnerInfo.common_sub_merchant_id, + onSwitchChange: function (event, state) { + //监听switch change事件,可以根据状态把相应的业务逻辑代码写在这里 + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/common_sub_merchant_id', {allow: state}).then( + function () { + $scope.loadPartnerInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Failed to change common_sub_merchant_id permission status', + content: resp.data.message, + type: 'error', + }) + } + ) + }, + }) + } + // Alipay保存名称修改 + $scope.saveAliSubMerchantId = function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/ali_sub_merchant_id', {ali_sub_merchant_id: $scope.partnerInfo.ali_sub_merchant_id}).then( + function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Modify Ali Sub Merchant ID successfully', + type: 'success', + }) + $scope.loadPartnerInfo() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + // 刷新Alipay + $scope.queryAlipayGms = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms').then( + function (resp) { + commonDialog.alert({title: 'Success', content: resp.data.result_status, type: 'success'}) + }, + function (resp) { + commonDialog.alert({title: 'Error', content: '查询失败:' + resp.data.message, type: 'error'}) + } + ) + } + // 刷新AlipayOnline + $scope.queryAlipayOnlineGms = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms').then( + function (resp) { + commonDialog.alert({title: 'Success', content: resp.data.result_status, type: 'success'}) + }, + function (resp) { + commonDialog.alert({title: 'Error', content: '查询失败:' + resp.data.message, type: 'error'}) + } + ) + } + // Alipay进件 + $scope.submitAlipaySubId = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_gms_json').then(function (resp) { + $scope.alipay_gms_json = resp.data + commonDialog + .confirm({ + title: 'Warning', + content: '是否使用该商户的现有信息进件?', + json: $scope.alipay_gms_json, + }) + .then(function () { + $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipay_gms').then( + function () { + commonDialog.alert({title: 'Success', content: 'Alipay进件成功', type: 'success'}) + $scope.loadPartnerInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Error', + content: '进件失败:' + resp.data.message, + type: 'error' + }) + } + ) + }) + }) + } + // AlipayOnline进件 + $scope.submitAlipayOnlineSubId = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms_json').then(function (resp) { + $scope.alipayOnline_gms_json = resp.data + commonDialog + .confirm({ + title: 'Warning', + content: '是否使用该商户的现有信息进件?', + json: $scope.alipayOnline_gms_json, + }) + .then(function () { + $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipayOnline_gms').then( + function () { + commonDialog.alert({ + title: 'Success', + content: '提示:AlipayOnline进件成功', + type: 'success' + }) + $scope.loadPartnerInfo() + }, + function (resp) { + commonDialog.alert({ + title: 'Error', + content: '进件失败:' + resp.data.message, + type: 'error' + }) + } + ) + }) + }) + } + // use sub_merchant_id + $scope.useSubMerchantId = function (sub_merchant_id) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: sub_merchant_id}).then( + function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Modify Wechat Sub Merchant ID successfully', + type: 'success', + }) + $scope.loadPartnerInfo() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + // 查看sub_merchant_id详情 + $scope.checkDetail = function (merchantInfo, channel) { + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/sub_merchant_detail.html', + controller: 'subMerchantDetailCtrl', + resolve: { + subMerchantInfo: function () { + return merchantInfo + }, + channel: function () { + return channel + }, + }, + }) + } + // 修改sub_merchant_id + $scope.modifySubMerchantId = function (subMerchantId, channel) { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/md_sub_merchant_id.html', + controller: 'ModifysubMerchantIdCtrl', + resolve: { + clientMoniker: function () { + return $scope.partner.client_moniker + }, + merchantId: function () { + return subMerchantId + }, + channel: function () { + return channel + }, + }, + }) + .result.then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Modify successfully', + type: 'success', + }) + $scope.loadPartnerInfo() + }) + } + // 卡支付apply + $scope.applyMWSubMerchantId = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/mw_info').then(function (resp) { + commonDialog + .confirm({ + title: 'Apply Merchant Warrior Sub Merchant Id', + contentHtml: $sce.trustAsHtml('Are you sure to apply merchant Warrior sub merchant id for [' + $scope.partner.company_name + ']?'), + json: resp.data, + }) + .then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/applyMWMerchantId').then( + function (res) { + commonDialog.alert({ + title: 'Success', + content: 'Apply Merchant Warrior Sub Merchant ID successfully', + type: 'success', + }) + $scope.cardInfo = res.data + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + }) + }) + } + + $scope.copyMWProfile = function () { + commonDialog.inputText({title: '请输入复制来源商户编码'}).then(function (text) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/copy_mw_config', {client_moniker: text}).then( + function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Modify successfully', + type: 'success', + }) + $scope.loadPartnerInfo() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + }) + } + + // $scope.showMoreMerchantInfo = false; + // $scope.hideMerchantInfo = function () { + // $scope.showMoreMerchantInfo = !$scope.showMoreMerchantInfo; + // }; + $scope.updateSubMerchantId = function (sub_merchant_id) { + angular.forEach($scope.subMerchantInfos, function (each) { + if (sub_merchant_id == each.sub_merchant_id) { + $scope.merchant_app_id = each.merchant_app_id + } + }) + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/update_apply_wx_sub_merchant_id.html', + controller: 'updateApplyWxSubMerchantIdCtrl', + resolve: { + merchantInfo: $scope.partner, + merchantIds: [ + '$http', + '$stateParams', + function ($http) { + return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids') + }, + ], + subMerchantInfo: [ + '$http', + '$stateParams', + function ($http) { + return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids/' + $scope.merchant_app_id) + }, + ], + }, + }) + .result.then(function () { + $scope.loadSubMerchantInfos() + }) + } + }, + ]) + app.controller('applyWxSubMerchantIdCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + 'subMerchantInfo', + '$filter', + 'merchantIds', + 'commonDialog', + function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, merchantIds, commonDialog) { + $scope.wxIndustries = angular.copy(wxMerchantIndustries) + $scope.subMerchantInfo = angular.copy(subMerchantInfo) + $scope.merchantIds = merchantIds.data + $scope.subMerchantInfo.industry = $filter('wxindustries')($scope.subMerchantInfo.industry) + $scope.saveAppliy = function (form) { + $scope.errmsg = null + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/sub_apply', $scope.subMerchantInfo).then( + function (resp) { + $scope.apply_sub_merchant_id = resp.data + $scope.$close() + if (subMerchantInfo.sub_merchant_id != null) { + commonDialog.confirm({title: 'Confirm', content: '已申请成功,是否确认使用'}).then(function () { + $http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', {sub_merchant_id: $scope.apply_sub_merchant_id}).then( + function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Modify Wechat Sub Merchant ID successfully', + type: 'success', + }) + $state.reload() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + }) + } else { + $http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', {sub_merchant_id: $scope.apply_sub_merchant_id}).then( + function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Apply Success And Modify Wechat Sub Merchant ID successfully', + type: 'success', + }) + $state.reload() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + }, + ]) + // 展示信息 + app.controller('subMerchantDetailCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + 'commonDialog', + 'subMerchantInfo', + 'channel', + function ($scope, $http, $uibModal, $state, commonDialog, subMerchantInfo, channel) { + $scope.channel = channel + $scope.subMerchantInfo = subMerchantInfo + }, + ]) + // 修改sub_merchant_id + app.controller('ModifysubMerchantIdCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + 'commonDialog', + 'clientMoniker', + 'merchantId', + 'channel', + function ($scope, $http, $uibModal, $state, commonDialog, clientMoniker, merchantId, channel) { + $scope.merchantId = merchantId + $scope.flag = false + $scope.confirm = function () { + $scope.flag = true + if (channel === 'Wechat') { + $http.put('/sys/partners/' + clientMoniker + '/payment_config', {sub_merchant_id: $scope.merchantId}).then( + function (resp) { + $scope.$close() + }, + function (resp) { + $scope.flag = false + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } else if (channel === 'Alipay' || channel === 'AlipayOnline') { + $http.put('/sys/partners/' + clientMoniker + '/ali_sub_merchant_id', {ali_sub_merchant_id: $scope.merchantId}).then( + function (resp) { + $scope.$close() + }, + function (resp) { + $scope.flag = false + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + } + }, + ]) + app.controller('newApplyWxSubMerchantIdCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + 'subMerchantInfo', + '$filter', + 'merchantIds', + 'commonDialog', + 'wechatGoodMcc', + 'businessTypesMap', + function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, merchantIds, commonDialog, wechatGoodMcc, businessTypesMap) { + $scope.wxIndustries = angular.copy(wxMerchantIndustries) + $scope.subMerchantInfo = angular.copy(subMerchantInfo) + $scope.subMerchantInfo.address = subMerchantInfo.address + "," + subMerchantInfo.suburb + + "," + subMerchantInfo.state + "," + subMerchantInfo.country; + $scope.subMerchantInfo.company_register_no = subMerchantInfo.abn ? subMerchantInfo.abn : subMerchantInfo.acn + $scope.wechatMccIndustries = wechatGoodMcc.configs() + $scope.merchantIds = merchantIds.data + $scope.businessTypesMap = businessTypesMap.configs() + if ($scope.subMerchantInfo.client_pay_type) { + if ($scope.subMerchantInfo.client_pay_type.indexOf('1') >= 0 && $scope.subMerchantInfo.client_pay_type.indexOf('2') >= 0) { + $scope.subMerchantInfo.business_type = 'BOTH' + } else if ($scope.subMerchantInfo.client_pay_type.indexOf('1') >= 0) { + $scope.subMerchantInfo.business_type = 'ONLINE' + } else if ($scope.subMerchantInfo.client_pay_type.indexOf('2') >= 0) { + $scope.subMerchantInfo.business_type = 'OFFLINE' + } + } else { + $scope.subMerchantInfo.business_type = 'BOTH' + } + + if ($scope.subMerchantInfo.industry) { + $scope.subMerchantInfo.industry = $filter('newWxMerchantsFilter')($scope.subMerchantInfo.industry) + } + if ($scope.subMerchantInfo.mc_code) { + $scope.subMerchantInfo.mcc_code = $scope.subMerchantInfo.mc_code + } + if (subMerchantInfo.certificat_expire_date) { + var datestr = subMerchantInfo.certificat_expire_date.replace(/-/g, '/') + $scope.subMerchantInfo.certificat_expire_date = new Date(datestr) + } + if ($scope.subMerchantInfo.business_structure) { + $scope.subMerchantInfo.merchant_type = $scope.subMerchantInfo.business_structure != 'Registered body(Sole Trader)' ? 'ENTERPRISE' : 'INDIVIDUAL' + } + if (subMerchantInfo.certificat_expire_date) { + if (subMerchantInfo.certificat_expire_date == 'PERMANENT') { + $scope.subMerchantInfo.certificat_expire_date_premanent = true + } else if (subMerchantInfo.certificat_expire_date == 'N/A') { + $scope.subMerchantInfo.certificat_expire_date_NA = true + } else { + var datestr = subMerchantInfo.certificat_expire_date.replace(/-/g, '/') + $scope.subMerchantInfo.certificat_expire_date_d = new Date(datestr) + } + } + + $scope.checkExpriedate = function (value) { + if (value) { + $scope.subMerchantInfo.certificat_expire_date_premanent = false + $scope.subMerchantInfo.certificat_expire_date_NA = false + } + } + $scope.checkExpriedateOther = function (value) { + if (value == 'PERMANENT') { + if ($scope.subMerchantInfo.certificat_expire_date_premanent) { + $scope.subMerchantInfo.certificat_expire_date_NA = false + $scope.subMerchantInfo.certificat_expire_date_d = null + } + } else if (value == 'N/A') { + if ($scope.subMerchantInfo.certificat_expire_date_NA) { + $scope.subMerchantInfo.certificat_expire_date_premanent = false + $scope.subMerchantInfo.certificat_expire_date_d = null + } + } + } + $scope.saveAppliy = function (form) { + $scope.errmsg = null + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + // var merchant_type = $scope.subMerchantInfo.business_structure == 'Company'? 1:2; + var params = { + company_name: $scope.subMerchantInfo.company_name, + merchant_id: $scope.subMerchantInfo.merchant_id, + short_name: $scope.subMerchantInfo.short_name, + office_phone: $scope.subMerchantInfo.office_phone, + contact_person: $scope.subMerchantInfo.contact_person, + contact_phone: $scope.subMerchantInfo.contact_phone, + company_phone: $scope.subMerchantInfo.company_phone, + contact_email: $scope.subMerchantInfo.contact_email, + industry: $scope.subMerchantInfo.industry, + company_website: $scope.subMerchantInfo.company_website, + merchant_type: $scope.subMerchantInfo.merchant_type, + mcc_code: $scope.subMerchantInfo.mcc_code, + address: $scope.subMerchantInfo.address, + business_type: $scope.subMerchantInfo.business_type, + } + if (params.business_type == 'ONLINE') { + params.address = null + } else if (params.business_type == 'OFFLINE') { + params.company_website = null + } + + if (params.merchant_type == 'ENTERPRISE') { + params.director_name = $scope.subMerchantInfo.director_name + params.director_id_number = $scope.subMerchantInfo.director_id_number + params.company_register_no = $scope.subMerchantInfo.company_register_no + params.certificat_expire_date = $scope.subMerchantInfo.certificat_expire_date + + if ($scope.subMerchantInfo.certificat_expire_date_d) { + params.certificat_expire_date = $filter('dateConversionStr')($scope.subMerchantInfo.certificat_expire_date_d) + } else if ($scope.subMerchantInfo.certificat_expire_date_premanent) { + params.certificat_expire_date = 'PERMANENT' + } else if ($scope.subMerchantInfo.certificat_expire_date_NA) { + params.certificat_expire_date = 'N/A' + } else { + alert('Certificate expiration time is required') + return + } + } else { + params.principal_name = $scope.subMerchantInfo.principal_name + params.principal_id_number = $scope.subMerchantInfo.principal_id_number } - ) - }) - }) - } - // AlipayOnline进件 - $scope.submitAlipayOnlineSubId = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipayOnline_gms_json').then(function (resp) { - $scope.alipayOnline_gms_json = resp.data - commonDialog - .confirm({ - title: 'Warning', - content: '是否使用该商户的现有信息进件?', - json: $scope.alipayOnline_gms_json, - }) - .then(function () { - $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipayOnline_gms').then( - function () { - commonDialog.alert({ title: 'Success', content: '提示:AlipayOnline进件成功', type: 'success' }) - $scope.loadPartnerInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: '进件失败:' + resp.data.message, type: 'error' }) + + $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/new_sub_apply', params).then( + function (resp) { + $scope.apply_sub_merchant_id = resp.data + $scope.$close() + if (subMerchantInfo.sub_merchant_id != null) { + commonDialog.confirm({title: 'Confirm', content: '已申请成功,是否确认使用'}).then(function () { + $http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', {sub_merchant_id: $scope.apply_sub_merchant_id}).then( + function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Modify Wechat Sub Merchant ID successfully', + type: 'success', + }) + $state.reload() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + }) + } else { + $http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', {sub_merchant_id: $scope.apply_sub_merchant_id}).then( + function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Apply Success And Modify Wechat Sub Merchant ID successfully', + type: 'success', + }) + $state.reload() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + }, + ]) + app.controller('updateApplyWxSubMerchantIdCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + 'subMerchantInfo', + '$filter', + 'merchantIds', + 'commonDialog', + 'wechatGoodMcc', + 'merchantInfo', + 'businessTypesMap', + function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, merchantIds, commonDialog, wechatGoodMcc, merchantInfo, businessTypesMap) { + $scope.wxIndustries = angular.copy(wxMerchantIndustries) + $scope.subMerchantInfo = angular.copy(subMerchantInfo.data) + $scope.merchantInfo = angular.copy(merchantInfo) + $scope.wechatMccIndustries = wechatGoodMcc.configs() + $scope.merchantIds = merchantIds.data + $scope.businessTypesMap = businessTypesMap.configs() + $scope.subMerchantInfo.short_name = $scope.merchantInfo.short_name + $scope.subMerchantInfo.industry = $scope.merchantInfo.industry + $scope.subMerchantInfo.company_website = $scope.merchantInfo.company_website + $scope.subMerchantInfo.address = $scope.merchantInfo.address + "," + $scope.merchantInfo.suburb + + "," + $scope.merchantInfo.state + "," + $scope.merchantInfo.country; + $scope.subMerchantInfo.company_phone = $scope.merchantInfo.company_phone + $scope.subMerchantInfo.contact_person = $scope.merchantInfo.contact_person + $scope.subMerchantInfo.contact_phone = $scope.merchantInfo.contact_phone + $scope.subMerchantInfo.contact_email = $scope.merchantInfo.contact_email + $scope.subMerchantInfo.company_register_no = $scope.merchantInfo.abn ? $scope.merchantInfo.abn : $scope.merchantInfo.acn + + if ($scope.merchantInfo.client_pay_type) { + if ($scope.merchantInfo.client_pay_type.indexOf('1') >= 0 && $scope.merchantInfo.client_pay_type.indexOf('2') >= 0) { + $scope.subMerchantInfo.business_type = 'BOTH' + } else if ($scope.merchantInfo.client_pay_type.indexOf('1') >= 0) { + $scope.subMerchantInfo.business_type = 'ONLINE' + } else if ($scope.merchantInfo.client_pay_type.indexOf('2') >= 0) { + $scope.subMerchantInfo.business_type = 'OFFLINE' } - ) - }) - }) - } - // use sub_merchant_id - $scope.useSubMerchantId = function (sub_merchant_id) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', { sub_merchant_id: sub_merchant_id }).then( - function (resp) { - commonDialog.alert({ - title: 'Success', - content: 'Modify Wechat Sub Merchant ID successfully', - type: 'success', - }) - $scope.loadPartnerInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - // 查看sub_merchant_id详情 - $scope.checkDetail = function (merchantInfo, channel) { - $uibModal.open({ - templateUrl: '/static/payment/partner/templates/sub_merchant_detail.html', - controller: 'subMerchantDetailCtrl', - resolve: { - subMerchantInfo: function () { - return merchantInfo - }, - channel: function () { - return channel - }, - }, - }) - } - // 修改sub_merchant_id - $scope.modifySubMerchantId = function (subMerchantId, channel) { - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/md_sub_merchant_id.html', - controller: 'ModifysubMerchantIdCtrl', - resolve: { - clientMoniker: function () { - return $scope.partner.client_moniker - }, - merchantId: function () { - return subMerchantId - }, - channel: function () { - return channel - }, - }, - }) - .result.then(function () { - commonDialog.alert({ - title: 'Success', - content: 'Modify successfully', - type: 'success', - }) - $scope.loadPartnerInfo() - }) - } - // 卡支付apply - $scope.applyMWSubMerchantId = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/mw_info').then(function (resp) { - commonDialog - .confirm({ - title: 'Apply Merchant Warrior Sub Merchant Id', - contentHtml: $sce.trustAsHtml('Are you sure to apply merchant Warrior sub merchant id for [' + $scope.partner.company_name + ']?'), - json: resp.data, - }) - .then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/applyMWMerchantId').then( - function (res) { - commonDialog.alert({ - title: 'Success', - content: 'Apply Merchant Warrior Sub Merchant ID successfully', - type: 'success', - }) - $scope.cardInfo = res.data - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) + } else { + $scope.subMerchantInfo.business_type = 'BOTH' + } + + if ($scope.merchantInfo.industry) { + $scope.subMerchantInfo.industry = $filter('newWxMerchantsFilter')($scope.merchantInfo.industry) + } + if ($scope.merchantInfo.mc_code) { + $scope.subMerchantInfo.mcc_code = $scope.merchantInfo.mc_code + } + + if ($scope.merchantInfo.business_structure) { + $scope.subMerchantInfo.merchant_type = $scope.merchantInfo.business_structure != 'Registered body(Sole Trader)' ? 'ENTERPRISE' : 'INDIVIDUAL' + } + if ($scope.merchantInfo.certificat_expire_date) { + if ($scope.merchantInfo.certificat_expire_date == 'PERMANENT') { + $scope.subMerchantInfo.certificat_expire_date_premanent = true + } else if ($scope.merchantInfo.certificat_expire_date == 'N/A') { + $scope.subMerchantInfo.certificat_expire_date_NA = true + } else { + var datestr = $scope.merchantInfo.certificat_expire_date.replace(/-/g, '/') + $scope.subMerchantInfo.certificat_expire_date_d = new Date(datestr) } - ) - }) - }) - } - - $scope.copyMWProfile = function () { - commonDialog.inputText({ title: '请输入复制来源商户编码' }).then(function (text) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/copy_mw_config', { client_moniker: text }).then( - function (resp) { - commonDialog.alert({ - title: 'Success', - content: 'Modify successfully', - type: 'success', - }) - $scope.loadPartnerInfo() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - }) - } - - // $scope.showMoreMerchantInfo = false; - // $scope.hideMerchantInfo = function () { - // $scope.showMoreMerchantInfo = !$scope.showMoreMerchantInfo; - // }; - $scope.updateSubMerchantId = function (sub_merchant_id) { - angular.forEach($scope.subMerchantInfos, function (each) { - if (sub_merchant_id == each.sub_merchant_id) { - $scope.merchant_app_id = each.merchant_app_id - } - }) - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/update_apply_wx_sub_merchant_id.html', - controller: 'updateApplyWxSubMerchantIdCtrl', - resolve: { - merchantInfo: $scope.partner, - merchantIds: [ - '$http', - '$stateParams', - function ($http) { - return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids') - }, - ], - subMerchantInfo: [ - '$http', - '$stateParams', - function ($http) { - return $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids/' + $scope.merchant_app_id) - }, - ], - }, - }) - .result.then(function () { - $scope.loadSubMerchantInfos() - }) - } - }, - ]) - app.controller('applyWxSubMerchantIdCtrl', [ - '$scope', - '$http', - '$uibModal', - '$state', - 'subMerchantInfo', - '$filter', - 'merchantIds', - 'commonDialog', - function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, merchantIds, commonDialog) { - $scope.wxIndustries = angular.copy(wxMerchantIndustries) - $scope.subMerchantInfo = angular.copy(subMerchantInfo) - $scope.merchantIds = merchantIds.data - $scope.subMerchantInfo.industry = $filter('wxindustries')($scope.subMerchantInfo.industry) - $scope.saveAppliy = function (form) { - $scope.errmsg = null - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } - }) - return - } - $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/sub_apply', $scope.subMerchantInfo).then( - function (resp) { - $scope.apply_sub_merchant_id = resp.data - $scope.$close() - if (subMerchantInfo.sub_merchant_id != null) { - commonDialog.confirm({ title: 'Confirm', content: '已申请成功,是否确认使用' }).then(function () { - $http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', { sub_merchant_id: $scope.apply_sub_merchant_id }).then( - function (resp) { - commonDialog.alert({ - title: 'Success', - content: 'Modify Wechat Sub Merchant ID successfully', - type: 'success', + } + + $scope.checkExpriedate = function (value) { + if (value) { + $scope.subMerchantInfo.certificat_expire_date_premanent = false + $scope.subMerchantInfo.certificat_expire_date_NA = false + } + } + $scope.checkExpriedateOther = function (value) { + if (value == 'PERMANENT') { + if ($scope.subMerchantInfo.certificat_expire_date_premanent) { + $scope.subMerchantInfo.certificat_expire_date_NA = false + $scope.subMerchantInfo.certificat_expire_date_d = null + } + } else if (value == 'N/A') { + if ($scope.subMerchantInfo.certificat_expire_date_NA) { + $scope.subMerchantInfo.certificat_expire_date_premanent = false + $scope.subMerchantInfo.certificat_expire_date_d = null + } + } + } + $scope.updateApply = function (form) { + $scope.errmsg = null + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } + return + } + var params = { + company_name: $scope.subMerchantInfo.company_name, + merchant_id: $scope.subMerchantInfo.merchant_id, + short_name: $scope.subMerchantInfo.short_name, + office_phone: $scope.subMerchantInfo.office_phone, + contact_person: $scope.subMerchantInfo.contact_person, + contact_phone: $scope.subMerchantInfo.contact_phone, + company_phone: $scope.subMerchantInfo.company_phone, + contact_email: $scope.subMerchantInfo.contact_email, + industry: $scope.subMerchantInfo.industry, + company_website: $scope.subMerchantInfo.company_website, + merchant_type: $scope.subMerchantInfo.merchant_type, + mcc_code: $scope.subMerchantInfo.mcc_code, + address: $scope.subMerchantInfo.address, + business_type: $scope.subMerchantInfo.business_type, + sub_mch_id: $scope.subMerchantInfo.sub_merchant_id, + merchant_remark: $scope.subMerchantInfo.merchant_remark, + } + if (params.business_type == 'ONLINE') { + params.address = null + } else if (params.business_type == 'OFFLINE') { + params.company_website = null + } + // if($scope.subMerchantInfo.merchant_type == 'ENTERPRISE'){ + // params.director_name = $scope.subMerchantInfo.director_name; + // params.director_id_number = $scope.subMerchantInfo.director_id_number; + // params.company_register_no = $scope.subMerchantInfo.company_register_no; + // params.certificat_expire_date = $scope.subMerchantInfo.certificat_expire_date; + // if($scope.subMerchantInfo.certificat_expire_date) { + // params.certificat_expire_date = $filter('dateConversionStr')($scope.subMerchantInfo.certificat_expire_date) + // } + // }else{ + // params.principal_name = $scope.subMerchantInfo.principal_name; + // params.principal_id_number = $scope.subMerchantInfo.principal_id_number; + // } + if (params.merchant_type == 'ENTERPRISE') { + params.company_register_no = $scope.subMerchantInfo.company_register_no + params.certificat_expire_date = $scope.subMerchantInfo.certificat_expire_date + if ($scope.subMerchantInfo.certificat_expire_date_d) { + params.certificat_expire_date = $filter('dateConversionStr')($scope.subMerchantInfo.certificat_expire_date_d) + } else if ($scope.subMerchantInfo.certificat_expire_date_premanent) { + params.certificat_expire_date = 'PERMANENT' + } else if ($scope.subMerchantInfo.certificat_expire_date_NA) { + params.certificat_expire_date = 'N/A' + } else { + alert('Certificate expiration time is required') + return + } + } + $http.put('/sys/partners/' + $scope.merchantInfo.client_moniker + '/get_merchant_ids/' + $scope.subMerchantInfo.merchant_app_id, params).then( + function (resp) { + $scope.apply_sub_merchant_id = resp.data + $scope.$close() + commonDialog.confirm({title: 'Confirm', content: 'Successfully modified!'}) + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } ) - }) - } else { - $http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', { sub_merchant_id: $scope.apply_sub_merchant_id }).then( - function (resp) { - commonDialog.alert({ - title: 'Success', - content: 'Apply Success And Modify Wechat Sub Merchant ID successfully', - type: 'success', - }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - }, - ]) - // 展示信息 - app.controller('subMerchantDetailCtrl', [ - '$scope', - '$http', - '$uibModal', - '$state', - 'commonDialog', - 'subMerchantInfo', - 'channel', - function ($scope, $http, $uibModal, $state, commonDialog, subMerchantInfo, channel) { - $scope.channel = channel - $scope.subMerchantInfo = subMerchantInfo - }, - ]) - // 修改sub_merchant_id - app.controller('ModifysubMerchantIdCtrl', [ - '$scope', - '$http', - '$uibModal', - '$state', - 'commonDialog', - 'clientMoniker', - 'merchantId', - 'channel', - function ($scope, $http, $uibModal, $state, commonDialog, clientMoniker, merchantId, channel) { - $scope.merchantId = merchantId - $scope.flag = false - $scope.confirm = function () { - $scope.flag = true - if (channel === 'Wechat') { - $http.put('/sys/partners/' + clientMoniker + '/payment_config', { sub_merchant_id: $scope.merchantId }).then( - function (resp) { - $scope.$close() - }, - function (resp) { - $scope.flag = false - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } else if (channel === 'Alipay' || channel === 'AlipayOnline') { - $http.put('/sys/partners/' + clientMoniker + '/ali_sub_merchant_id', { ali_sub_merchant_id: $scope.merchantId }).then( - function (resp) { - $scope.$close() - }, - function (resp) { - $scope.flag = false - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - } - }, - ]) - app.controller('newApplyWxSubMerchantIdCtrl', [ - '$scope', - '$http', - '$uibModal', - '$state', - 'subMerchantInfo', - '$filter', - 'merchantIds', - 'commonDialog', - 'wechatGoodMcc', - 'businessTypesMap', - function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, merchantIds, commonDialog, wechatGoodMcc, businessTypesMap) { - $scope.wxIndustries = angular.copy(wxMerchantIndustries) - $scope.subMerchantInfo = angular.copy(subMerchantInfo) - $scope.subMerchantInfo.address= subMerchantInfo.address+","+subMerchantInfo.suburb - +","+subMerchantInfo.state+","+subMerchantInfo.country; - $scope.subMerchantInfo.company_register_no = subMerchantInfo.abn ? subMerchantInfo.abn : subMerchantInfo.acn - $scope.wechatMccIndustries = wechatGoodMcc.configs() - $scope.merchantIds = merchantIds.data - $scope.businessTypesMap = businessTypesMap.configs() - if ($scope.subMerchantInfo.client_pay_type) { - if ($scope.subMerchantInfo.client_pay_type.indexOf('1') >= 0 && $scope.subMerchantInfo.client_pay_type.indexOf('2') >= 0) { - $scope.subMerchantInfo.business_type = 'BOTH' - } else if ($scope.subMerchantInfo.client_pay_type.indexOf('1') >= 0) { - $scope.subMerchantInfo.business_type = 'ONLINE' - } else if ($scope.subMerchantInfo.client_pay_type.indexOf('2') >= 0) { - $scope.subMerchantInfo.business_type = 'OFFLINE' - } - } else { - $scope.subMerchantInfo.business_type = 'BOTH' - } - - if ($scope.subMerchantInfo.industry) { - $scope.subMerchantInfo.industry = $filter('newWxMerchantsFilter')($scope.subMerchantInfo.industry) - } - if ($scope.subMerchantInfo.mc_code) { - $scope.subMerchantInfo.mcc_code = $scope.subMerchantInfo.mc_code - } - if (subMerchantInfo.certificat_expire_date) { - var datestr = subMerchantInfo.certificat_expire_date.replace(/-/g, '/') - $scope.subMerchantInfo.certificat_expire_date = new Date(datestr) - } - if ($scope.subMerchantInfo.business_structure) { - $scope.subMerchantInfo.merchant_type = $scope.subMerchantInfo.business_structure != 'Registered body(Sole Trader)' ? 'ENTERPRISE' : 'INDIVIDUAL' - } - if (subMerchantInfo.certificat_expire_date) { - if (subMerchantInfo.certificat_expire_date == 'PERMANENT') { - $scope.subMerchantInfo.certificat_expire_date_premanent = true - } else if (subMerchantInfo.certificat_expire_date == 'N/A') { - $scope.subMerchantInfo.certificat_expire_date_NA = true - } else { - var datestr = subMerchantInfo.certificat_expire_date.replace(/-/g, '/') - $scope.subMerchantInfo.certificat_expire_date_d = new Date(datestr) - } - } + } + }, + ]) + + app.controller('applyRpaySubMerchantIdCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + 'subMerchantInfo', + 'businessStructuresMap', + '$filter', + 'commonDialog', + 'timezone', + function ($scope, $http, $uibModal, $state, subMerchantInfo, businessStructuresMap, $filter, commonDialog, timezone) { + $scope.subMerchantInfo = angular.copy(subMerchantInfo) + $scope.business_structures = businessStructuresMap.configs() + $scope.timezone = timezone.configs() + + $scope.saveRpayAppliy = function (form) { + var merchantInfo = {} + $scope.errmsg = null + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + angular.forEach(form, function (item, key) { + if (item != null) { + if (item.$name != null) { + merchantInfo[key] = item.$modelValue + } + } + }) - $scope.checkExpriedate = function (value) { - if (value) { - $scope.subMerchantInfo.certificat_expire_date_premanent = false - $scope.subMerchantInfo.certificat_expire_date_NA = false - } - } - $scope.checkExpriedateOther = function (value) { - if (value == 'PERMANENT') { - if ($scope.subMerchantInfo.certificat_expire_date_premanent) { - $scope.subMerchantInfo.certificat_expire_date_NA = false - $scope.subMerchantInfo.certificat_expire_date_d = null - } - } else if (value == 'N/A') { - if ($scope.subMerchantInfo.certificat_expire_date_NA) { - $scope.subMerchantInfo.certificat_expire_date_premanent = false - $scope.subMerchantInfo.certificat_expire_date_d = null - } - } - } - $scope.saveAppliy = function (form) { - $scope.errmsg = null - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } - }) - return - } - // var merchant_type = $scope.subMerchantInfo.business_structure == 'Company'? 1:2; - var params = { - company_name: $scope.subMerchantInfo.company_name, - merchant_id: $scope.subMerchantInfo.merchant_id, - short_name: $scope.subMerchantInfo.short_name, - office_phone: $scope.subMerchantInfo.office_phone, - contact_person: $scope.subMerchantInfo.contact_person, - contact_phone: $scope.subMerchantInfo.contact_phone, - company_phone: $scope.subMerchantInfo.company_phone, - contact_email: $scope.subMerchantInfo.contact_email, - industry: $scope.subMerchantInfo.industry, - company_website: $scope.subMerchantInfo.company_website, - merchant_type: $scope.subMerchantInfo.merchant_type, - mcc_code: $scope.subMerchantInfo.mcc_code, - address: $scope.subMerchantInfo.address, - business_type: $scope.subMerchantInfo.business_type, - } - if (params.business_type == 'ONLINE') { - params.address = null - } else if (params.business_type == 'OFFLINE') { - params.company_website = null - } + $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/registRpaySubMerchantId', merchantInfo).then( + function (resp) { + $scope.apply_sub_merchant_id = resp.data + $scope.$close() + if (subMerchantInfo.sub_merchant_id != null) { + commonDialog.alert({ + title: 'Success', + content: 'Modify Rpay+ Sub Merchant ID successfully', + type: 'success', + }) + $state.reload() + } + }, + function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'error', + }) + } + ) + } + }, + ]) + app.controller('applyYeepaySubMerchantIdCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + 'subMerchantInfo', + 'yeepayIndustryMap', + 'yeepayBusinessContentMap', + '$filter', + 'commonDialog', + 'Upload', + function ($scope, $http, $uibModal, $state, subMerchantInfo, yeepayIndustryMap, yeepayBusinessContentMap, $filter, commonDialog, Upload) { + $scope.yeepay_industries = yeepayIndustryMap.configs() + $scope.yeepay_business_contents = yeepayBusinessContentMap.configs() + $scope.subMerchantInfo = angular.copy(subMerchantInfo) + if (!$scope.subMerchantInfo.abn) { + $scope.subMerchantInfo.abn = $scope.subMerchantInfo.acn + } + var vouchers = {} + + $scope.directors = {} + $scope.executives = {} + $scope.industry = '' + $scope.business_content = '' + var merchantInfo = {} + + var merchantId = '' + + // $scope.uploadLegalIDcardFront = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.legalIDcardFrontProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.legalIDcardFrontProgress; + // $scope.legalIDcardFront = resp.data.path; + // vouchers['legalIDcardFront'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.legalIDcardFrontProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.legalIDcardFrontProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + // + // $scope.uploadLegalIDcardBack = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.legalIDcardBackProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.legalIDcardBackProgress; + // $scope.legalIDcardBack = resp.data.path; + // vouchers['legalIDcardBack'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.legalIDcardBackProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.legalIDcardBackProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + + $scope.uploadBusinessLicence = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.businessLicenceProgress = {value: 0} + Upload.upload({ + url: '/attachment/yeepayFiles', + data: {file: file}, + }).then( + function (resp) { + delete $scope.businessLicenceProgress + $scope.businessLicence = resp.data.path + merchantInfo['business_licence'] = resp.data.path + merchantId = resp.data.merchantId + commonDialog.alert({ + title: 'Upload Success', + content: 'Upload Success', + type: 'success' + }) + }, + function (resp) { + delete $scope.businessLicenceProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.businessLicenceProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } - if (params.merchant_type == 'ENTERPRISE') { - params.director_name = $scope.subMerchantInfo.director_name - params.director_id_number = $scope.subMerchantInfo.director_id_number - params.company_register_no = $scope.subMerchantInfo.company_register_no - params.certificat_expire_date = $scope.subMerchantInfo.certificat_expire_date - - if ($scope.subMerchantInfo.certificat_expire_date_d) { - params.certificat_expire_date = $filter('dateConversionStr')($scope.subMerchantInfo.certificat_expire_date_d) - } else if ($scope.subMerchantInfo.certificat_expire_date_premanent) { - params.certificat_expire_date = 'PERMANENT' - } else if ($scope.subMerchantInfo.certificat_expire_date_NA) { - params.certificat_expire_date = 'N/A' - } else { - alert('Certificate expiration time is required') - return - } - } else { - params.principal_name = $scope.subMerchantInfo.principal_name - params.principal_id_number = $scope.subMerchantInfo.principal_id_number - } + // $scope.uploadTaxLevel = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.taxLevelProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.taxLevelProgress; + // $scope.taxLevel = resp.data.path; + // vouchers['taxLevel'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.taxLevelProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.taxLevelProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + + // $scope.uploadBankAccountOpen = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.bankAccountOpenProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.bankAccountOpenProgress; + // $scope.bankAccountOpen = resp.data.path; + // vouchers['bankAccountOpen'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.bankAccountOpenProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.bankAccountOpenProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + + // $scope.uploadOrgCode = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.orgCodeProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.orgCodeProgress; + // $scope.orgCode = resp.data.path; + // vouchers['orgCode'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.orgCodeProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.orgCodeProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + // + // $scope.uploadNonStanProtocol = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.nonStanProtocolProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.nonStanProtocolProgress; + // $scope.nonStanProtocol = resp.data.path; + // vouchers['nonStanProtocol'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.nonStanProtocolProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.nonStanProtocolProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + // + // $scope.uploadZipPath = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.zipPathProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.zipPathProgress; + // $scope.zipPath = resp.data.path; + // vouchers['zipPath'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.zipPathProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.zipPathProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + + $scope.uploadDirectorPassport = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.directorPassportProgress = {value: 0} + Upload.upload({ + url: '/attachment/yeepayFiles', + data: {file: file}, + }).then( + function (resp) { + delete $scope.directorPassportProgress + $scope.directorPassport = resp.data.path + $scope.directors.filePath = resp.data.path + merchantId = resp.data.merchantId + commonDialog.alert({ + title: 'Upload Success', + content: 'Upload Success', + type: 'success' + }) + }, + function (resp) { + delete $scope.directorPassportProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.directorPassportProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } - $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/new_sub_apply', params).then( - function (resp) { - $scope.apply_sub_merchant_id = resp.data - $scope.$close() - if (subMerchantInfo.sub_merchant_id != null) { - commonDialog.confirm({ title: 'Confirm', content: '已申请成功,是否确认使用' }).then(function () { - $http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', { sub_merchant_id: $scope.apply_sub_merchant_id }).then( - function (resp) { - commonDialog.alert({ - title: 'Success', - content: 'Modify Wechat Sub Merchant ID successfully', - type: 'success', + $scope.uploadExecutivePassport = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.executivePassportProgress = {value: 0} + Upload.upload({ + url: '/attachment/yeepayFiles', + data: {file: file}, + }).then( + function (resp) { + delete $scope.executivePassportProgress + $scope.executivePassport = resp.data.path + $scope.executives.filePath = resp.data.path + merchantId = resp.data.merchantId + commonDialog.alert({ + title: 'Upload Success', + content: 'Upload Success', + type: 'success' + }) + }, + function (resp) { + delete $scope.executivePassportProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.executivePassportProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } + + $scope.saveYeepayApply = function (form) { + $scope.errmsg = null + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } + return + } + // angular.forEach(form, function (item, key) { + // if(item !=null) { + // if(item.$name !=null) { + // merchantInfo[key] = item.$modelValue; + // } + // } + // }); + merchantInfo['company_name'] = $scope.subMerchantInfo.company_name + merchantInfo['contact_person'] = $scope.subMerchantInfo.contact_person + merchantInfo['contact_phone'] = $scope.subMerchantInfo.contact_phone + merchantInfo['contact_email'] = $scope.subMerchantInfo.contact_email + merchantInfo['company_website'] = $scope.subMerchantInfo.company_website + merchantInfo['abn'] = $scope.subMerchantInfo.abn + merchantInfo['executives'] = $scope.executives + merchantInfo['directors'] = $scope.directors + merchantInfo['business_content'] = $scope.business_content + merchantInfo['industry'] = $scope.industry + merchantInfo['merchantId'] = merchantId + $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/registYeepaySubMerchantId', merchantInfo).then( + function (resp) { + $scope.apply_sub_merchant_id = resp.data + $scope.$close() + if (subMerchantInfo.yeepay_sub_merchant_id != null) { + commonDialog.alert({ + title: 'Success', + content: 'Modify Yeepay Sub Merchant ID successfully', + type: 'success', + }) + $state.reload() + } + }, + function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'error', + }) + } ) - }) - } else { - $http.put('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/payment_config', { sub_merchant_id: $scope.apply_sub_merchant_id }).then( - function (resp) { - commonDialog.alert({ - title: 'Success', - content: 'Apply Success And Modify Wechat Sub Merchant ID successfully', - type: 'success', - }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - }, - ]) - app.controller('updateApplyWxSubMerchantIdCtrl', [ - '$scope', - '$http', - '$uibModal', - '$state', - 'subMerchantInfo', - '$filter', - 'merchantIds', - 'commonDialog', - 'wechatGoodMcc', - 'merchantInfo', - 'businessTypesMap', - function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, merchantIds, commonDialog, wechatGoodMcc, merchantInfo, businessTypesMap) { - $scope.wxIndustries = angular.copy(wxMerchantIndustries) - $scope.subMerchantInfo = angular.copy(subMerchantInfo.data) - $scope.merchantInfo = angular.copy(merchantInfo) - $scope.wechatMccIndustries = wechatGoodMcc.configs() - $scope.merchantIds = merchantIds.data - $scope.businessTypesMap = businessTypesMap.configs() - $scope.subMerchantInfo.short_name = $scope.merchantInfo.short_name - $scope.subMerchantInfo.industry = $scope.merchantInfo.industry - $scope.subMerchantInfo.company_website = $scope.merchantInfo.company_website - $scope.subMerchantInfo.address = $scope.merchantInfo.address+","+$scope.merchantInfo.suburb - +","+$scope.merchantInfo.state+","+$scope.merchantInfo.country; - $scope.subMerchantInfo.company_phone = $scope.merchantInfo.company_phone - $scope.subMerchantInfo.contact_person = $scope.merchantInfo.contact_person - $scope.subMerchantInfo.contact_phone = $scope.merchantInfo.contact_phone - $scope.subMerchantInfo.contact_email = $scope.merchantInfo.contact_email - $scope.subMerchantInfo.company_register_no = $scope.merchantInfo.abn ? $scope.merchantInfo.abn : $scope.merchantInfo.acn - - if ($scope.merchantInfo.client_pay_type) { - if ($scope.merchantInfo.client_pay_type.indexOf('1') >= 0 && $scope.merchantInfo.client_pay_type.indexOf('2') >= 0) { - $scope.subMerchantInfo.business_type = 'BOTH' - } else if ($scope.merchantInfo.client_pay_type.indexOf('1') >= 0) { - $scope.subMerchantInfo.business_type = 'ONLINE' - } else if ($scope.merchantInfo.client_pay_type.indexOf('2') >= 0) { - $scope.subMerchantInfo.business_type = 'OFFLINE' } - } else { - $scope.subMerchantInfo.business_type = 'BOTH' - } + }, + ]) + app.controller('addYeepaySubMerchantIdCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + 'subMerchantInfo', + 'yeepayIndustryMap', + 'yeepayBusinessContentMap', + '$filter', + 'commonDialog', + 'Upload', + function ($scope, $http, $uibModal, $state, subMerchantInfo, yeepayIndustryMap, yeepayBusinessContentMap, $filter, commonDialog, Upload) { + $scope.yeepay_industries = yeepayIndustryMap.configs() + $scope.yeepay_business_contents = yeepayBusinessContentMap.configs() + $scope.subMerchantInfo = angular.copy(subMerchantInfo) + + var merchantInfo = {} + + $scope.saveYeepayAdd = function (form) { + $scope.errmsg = null + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + // angular.forEach(form, function (item, key) { + // if(item !=null) { + // if(item.$name !=null) { + // merchantInfo[key] = item.$modelValue; + // } + // } + // }); + + merchantInfo['sub_merchant_id'] = $scope.sub_merchant_id + merchantInfo['business_content'] = $scope.business_content + merchantInfo['industry'] = $scope.industry + $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/addYeepaySubMerchantId', merchantInfo).then( + function (resp) { + $scope.$close() + commonDialog.alert({ + title: 'Success', + content: 'Add Yeepay Sub Merchant ID successfully', + type: 'success', + }) + $state.reload() + }, + function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'error', + }) + } + ) + } + }, + ]) + app.controller('updateYeepaySubMerchantIdCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + 'subMerchantInfo', + 'yeepayIndustryMap', + 'yeepayBusinessContentMap', + '$filter', + 'commonDialog', + 'Upload', + 'subMerchantId', + function ($scope, $http, $uibModal, $state, subMerchantInfo, yeepayIndustryMap, yeepayBusinessContentMap, $filter, commonDialog, Upload, subMerchantId) { + $scope.yeepay_industries = yeepayIndustryMap.configs() + $scope.yeepay_business_contents = yeepayBusinessContentMap.configs() + $scope.subMerchantInfo = angular.copy(subMerchantInfo) + if (!$scope.subMerchantInfo.abn) { + $scope.subMerchantInfo.abn = $scope.subMerchantInfo.acn + } + var vouchers = {} + + $scope.directors = {} + $scope.executives = {} + $scope.industry = '' + $scope.business_content = '' + var merchantInfo = {} + + var merchantId = '' + + // $scope.uploadLegalIDcardFront = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.legalIDcardFrontProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.legalIDcardFrontProgress; + // $scope.legalIDcardFront = resp.data.path; + // vouchers['legalIDcardFront'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.legalIDcardFrontProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.legalIDcardFrontProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + // + // $scope.uploadLegalIDcardBack = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.legalIDcardBackProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.legalIDcardBackProgress; + // $scope.legalIDcardBack = resp.data.path; + // vouchers['legalIDcardBack'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.legalIDcardBackProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.legalIDcardBackProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + + $scope.uploadBusinessLicence = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.businessLicenceProgress = {value: 0} + Upload.upload({ + url: '/attachment/yeepayFiles', + data: {file: file}, + }).then( + function (resp) { + delete $scope.businessLicenceProgress + $scope.businessLicence = resp.data.path + merchantInfo['business_licence'] = resp.data.path + merchantId = resp.data.merchantId + commonDialog.alert({ + title: 'Upload Success', + content: 'Upload Success', + type: 'success' + }) + }, + function (resp) { + delete $scope.businessLicenceProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.businessLicenceProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } - if ($scope.merchantInfo.industry) { - $scope.subMerchantInfo.industry = $filter('newWxMerchantsFilter')($scope.merchantInfo.industry) - } - if ($scope.merchantInfo.mc_code) { - $scope.subMerchantInfo.mcc_code = $scope.merchantInfo.mc_code - } + // $scope.uploadTaxLevel = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.taxLevelProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.taxLevelProgress; + // $scope.taxLevel = resp.data.path; + // vouchers['taxLevel'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.taxLevelProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.taxLevelProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + + // $scope.uploadBankAccountOpen = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.bankAccountOpenProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.bankAccountOpenProgress; + // $scope.bankAccountOpen = resp.data.path; + // vouchers['bankAccountOpen'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.bankAccountOpenProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.bankAccountOpenProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + + // $scope.uploadOrgCode = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.orgCodeProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.orgCodeProgress; + // $scope.orgCode = resp.data.path; + // vouchers['orgCode'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.orgCodeProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.orgCodeProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + // + // $scope.uploadNonStanProtocol = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.nonStanProtocolProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.nonStanProtocolProgress; + // $scope.nonStanProtocol = resp.data.path; + // vouchers['nonStanProtocol'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.nonStanProtocolProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.nonStanProtocolProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + // + // $scope.uploadZipPath = function (file) { + // if (file != null) { + // if (file.size > 3 * 1024 * 1024) { + // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + // } else { + // $scope.zipPathProgress = {value: 0}; + // Upload.upload({ + // url: '/attachment/yeepayFiles', + // data: {file: file} + // }).then(function (resp) { + // delete $scope.zipPathProgress; + // $scope.zipPath = resp.data.path; + // vouchers['zipPath'] = resp.data.path; + // merchantId = resp.data.merchantId; + // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) + // }, function (resp) { + // delete $scope.zipPathProgress; + // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + // }, function (evt) { + // $scope.zipPathProgress.value = parseInt(100 * evt.loaded / evt.total); + // }) + // } + // } + // }; + + $scope.uploadDirectorPassport = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.directorPassportProgress = {value: 0} + Upload.upload({ + url: '/attachment/yeepayFiles', + data: {file: file}, + }).then( + function (resp) { + delete $scope.directorPassportProgress + $scope.directorPassport = resp.data.path + $scope.directors.filePath = resp.data.path + merchantId = resp.data.merchantId + commonDialog.alert({ + title: 'Upload Success', + content: 'Upload Success', + type: 'success' + }) + }, + function (resp) { + delete $scope.directorPassportProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.directorPassportProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } + } - if ($scope.merchantInfo.business_structure) { - $scope.subMerchantInfo.merchant_type = $scope.merchantInfo.business_structure != 'Registered body(Sole Trader)' ? 'ENTERPRISE' : 'INDIVIDUAL' - } - if ($scope.merchantInfo.certificat_expire_date) { - if ($scope.merchantInfo.certificat_expire_date == 'PERMANENT') { - $scope.subMerchantInfo.certificat_expire_date_premanent = true - } else if ($scope.merchantInfo.certificat_expire_date == 'N/A') { - $scope.subMerchantInfo.certificat_expire_date_NA = true - } else { - var datestr = $scope.merchantInfo.certificat_expire_date.replace(/-/g, '/') - $scope.subMerchantInfo.certificat_expire_date_d = new Date(datestr) + $scope.uploadExecutivePassport = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.executivePassportProgress = {value: 0} + Upload.upload({ + url: '/attachment/yeepayFiles', + data: {file: file}, + }).then( + function (resp) { + delete $scope.executivePassportProgress + $scope.executivePassport = resp.data.path + $scope.executives.filePath = resp.data.path + merchantId = resp.data.merchantId + commonDialog.alert({ + title: 'Upload Success', + content: 'Upload Success', + type: 'success' + }) + }, + function (resp) { + delete $scope.executivePassportProgress + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, + function (evt) { + $scope.executivePassportProgress.value = parseInt((100 * evt.loaded) / evt.total) + } + ) + } + } } - } - $scope.checkExpriedate = function (value) { - if (value) { - $scope.subMerchantInfo.certificat_expire_date_premanent = false - $scope.subMerchantInfo.certificat_expire_date_NA = false - } - } - $scope.checkExpriedateOther = function (value) { - if (value == 'PERMANENT') { - if ($scope.subMerchantInfo.certificat_expire_date_premanent) { - $scope.subMerchantInfo.certificat_expire_date_NA = false - $scope.subMerchantInfo.certificat_expire_date_d = null - } - } else if (value == 'N/A') { - if ($scope.subMerchantInfo.certificat_expire_date_NA) { - $scope.subMerchantInfo.certificat_expire_date_premanent = false - $scope.subMerchantInfo.certificat_expire_date_d = null - } - } - } - $scope.updateApply = function (form) { - $scope.errmsg = null - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } - }) - return - } - var params = { - company_name: $scope.subMerchantInfo.company_name, - merchant_id: $scope.subMerchantInfo.merchant_id, - short_name: $scope.subMerchantInfo.short_name, - office_phone: $scope.subMerchantInfo.office_phone, - contact_person: $scope.subMerchantInfo.contact_person, - contact_phone: $scope.subMerchantInfo.contact_phone, - company_phone: $scope.subMerchantInfo.company_phone, - contact_email: $scope.subMerchantInfo.contact_email, - industry: $scope.subMerchantInfo.industry, - company_website: $scope.subMerchantInfo.company_website, - merchant_type: $scope.subMerchantInfo.merchant_type, - mcc_code: $scope.subMerchantInfo.mcc_code, - address: $scope.subMerchantInfo.address, - business_type: $scope.subMerchantInfo.business_type, - sub_mch_id: $scope.subMerchantInfo.sub_merchant_id, - merchant_remark: $scope.subMerchantInfo.merchant_remark, - } - if (params.business_type == 'ONLINE') { - params.address = null - } else if (params.business_type == 'OFFLINE') { - params.company_website = null - } - // if($scope.subMerchantInfo.merchant_type == 'ENTERPRISE'){ - // params.director_name = $scope.subMerchantInfo.director_name; - // params.director_id_number = $scope.subMerchantInfo.director_id_number; - // params.company_register_no = $scope.subMerchantInfo.company_register_no; - // params.certificat_expire_date = $scope.subMerchantInfo.certificat_expire_date; - // if($scope.subMerchantInfo.certificat_expire_date) { - // params.certificat_expire_date = $filter('dateConversionStr')($scope.subMerchantInfo.certificat_expire_date) - // } - // }else{ - // params.principal_name = $scope.subMerchantInfo.principal_name; - // params.principal_id_number = $scope.subMerchantInfo.principal_id_number; - // } - if (params.merchant_type == 'ENTERPRISE') { - params.company_register_no = $scope.subMerchantInfo.company_register_no - params.certificat_expire_date = $scope.subMerchantInfo.certificat_expire_date - if ($scope.subMerchantInfo.certificat_expire_date_d) { - params.certificat_expire_date = $filter('dateConversionStr')($scope.subMerchantInfo.certificat_expire_date_d) - } else if ($scope.subMerchantInfo.certificat_expire_date_premanent) { - params.certificat_expire_date = 'PERMANENT' - } else if ($scope.subMerchantInfo.certificat_expire_date_NA) { - params.certificat_expire_date = 'N/A' - } else { - alert('Certificate expiration time is required') - return - } - } - $http.put('/sys/partners/' + $scope.merchantInfo.client_moniker + '/get_merchant_ids/' + $scope.subMerchantInfo.merchant_app_id, params).then( - function (resp) { - $scope.apply_sub_merchant_id = resp.data - $scope.$close() - commonDialog.confirm({ title: 'Confirm', content: 'Successfully modified!' }) - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - }, - ]) - - app.controller('applyRpaySubMerchantIdCtrl', [ - '$scope', - '$http', - '$uibModal', - '$state', - 'subMerchantInfo', - 'businessStructuresMap', - '$filter', - 'commonDialog', - 'timezone', - function ($scope, $http, $uibModal, $state, subMerchantInfo, businessStructuresMap, $filter, commonDialog, timezone) { - $scope.subMerchantInfo = angular.copy(subMerchantInfo) - $scope.business_structures = businessStructuresMap.configs() - $scope.timezone = timezone.configs() - - $scope.saveRpayAppliy = function (form) { - var merchantInfo = {} - $scope.errmsg = null - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } - }) - return - } - angular.forEach(form, function (item, key) { - if (item != null) { - if (item.$name != null) { - merchantInfo[key] = item.$modelValue - } - } - }) - - $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/registRpaySubMerchantId', merchantInfo).then( - function (resp) { - $scope.apply_sub_merchant_id = resp.data - $scope.$close() - if (subMerchantInfo.sub_merchant_id != null) { - commonDialog.alert({ - title: 'Success', - content: 'Modify Rpay+ Sub Merchant ID successfully', - type: 'success', - }) - $state.reload() - } - }, - function (resp) { - commonDialog.alert({ - title: 'Error', - content: resp.data.message, - type: 'error', - }) - } - ) - } - }, - ]) - app.controller('applyYeepaySubMerchantIdCtrl', [ - '$scope', - '$http', - '$uibModal', - '$state', - 'subMerchantInfo', - 'yeepayIndustryMap', - 'yeepayBusinessContentMap', - '$filter', - 'commonDialog', - 'Upload', - function ($scope, $http, $uibModal, $state, subMerchantInfo, yeepayIndustryMap, yeepayBusinessContentMap, $filter, commonDialog, Upload) { - $scope.yeepay_industries = yeepayIndustryMap.configs() - $scope.yeepay_business_contents = yeepayBusinessContentMap.configs() - $scope.subMerchantInfo = angular.copy(subMerchantInfo) - if (!$scope.subMerchantInfo.abn) { - $scope.subMerchantInfo.abn = $scope.subMerchantInfo.acn - } - var vouchers = {} - - $scope.directors = {} - $scope.executives = {} - $scope.industry = '' - $scope.business_content = '' - var merchantInfo = {} - - var merchantId = '' - - // $scope.uploadLegalIDcardFront = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.legalIDcardFrontProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.legalIDcardFrontProgress; - // $scope.legalIDcardFront = resp.data.path; - // vouchers['legalIDcardFront'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.legalIDcardFrontProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.legalIDcardFrontProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - // - // $scope.uploadLegalIDcardBack = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.legalIDcardBackProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.legalIDcardBackProgress; - // $scope.legalIDcardBack = resp.data.path; - // vouchers['legalIDcardBack'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.legalIDcardBackProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.legalIDcardBackProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - - $scope.uploadBusinessLicence = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.businessLicenceProgress = { value: 0 } - Upload.upload({ - url: '/attachment/yeepayFiles', - data: { file: file }, - }).then( - function (resp) { - delete $scope.businessLicenceProgress - $scope.businessLicence = resp.data.path - merchantInfo['business_licence'] = resp.data.path - merchantId = resp.data.merchantId - commonDialog.alert({ title: 'Upload Success', content: 'Upload Success', type: 'success' }) - }, - function (resp) { - delete $scope.businessLicenceProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.businessLicenceProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - - // $scope.uploadTaxLevel = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.taxLevelProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.taxLevelProgress; - // $scope.taxLevel = resp.data.path; - // vouchers['taxLevel'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.taxLevelProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.taxLevelProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - - // $scope.uploadBankAccountOpen = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.bankAccountOpenProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.bankAccountOpenProgress; - // $scope.bankAccountOpen = resp.data.path; - // vouchers['bankAccountOpen'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.bankAccountOpenProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.bankAccountOpenProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - - // $scope.uploadOrgCode = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.orgCodeProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.orgCodeProgress; - // $scope.orgCode = resp.data.path; - // vouchers['orgCode'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.orgCodeProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.orgCodeProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - // - // $scope.uploadNonStanProtocol = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.nonStanProtocolProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.nonStanProtocolProgress; - // $scope.nonStanProtocol = resp.data.path; - // vouchers['nonStanProtocol'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.nonStanProtocolProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.nonStanProtocolProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - // - // $scope.uploadZipPath = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.zipPathProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.zipPathProgress; - // $scope.zipPath = resp.data.path; - // vouchers['zipPath'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.zipPathProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.zipPathProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - - $scope.uploadDirectorPassport = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.directorPassportProgress = { value: 0 } - Upload.upload({ - url: '/attachment/yeepayFiles', - data: { file: file }, - }).then( - function (resp) { - delete $scope.directorPassportProgress - $scope.directorPassport = resp.data.path - $scope.directors.filePath = resp.data.path - merchantId = resp.data.merchantId - commonDialog.alert({ title: 'Upload Success', content: 'Upload Success', type: 'success' }) - }, - function (resp) { - delete $scope.directorPassportProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.directorPassportProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } - - $scope.uploadExecutivePassport = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.executivePassportProgress = { value: 0 } - Upload.upload({ - url: '/attachment/yeepayFiles', - data: { file: file }, - }).then( - function (resp) { - delete $scope.executivePassportProgress - $scope.executivePassport = resp.data.path - $scope.executives.filePath = resp.data.path - merchantId = resp.data.merchantId - commonDialog.alert({ title: 'Upload Success', content: 'Upload Success', type: 'success' }) - }, - function (resp) { - delete $scope.executivePassportProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.executivePassportProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } - } - } + $scope.updateYeepayApply = function (form) { + $scope.errmsg = null + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + // angular.forEach(form, function (item, key) { + // if(item !=null) { + // if(item.$name !=null) { + // merchantInfo[key] = item.$modelValue; + // } + // } + // }); + merchantInfo['company_name'] = $scope.subMerchantInfo.company_name + merchantInfo['contact_person'] = $scope.subMerchantInfo.contact_person + merchantInfo['contact_phone'] = $scope.subMerchantInfo.contact_phone + merchantInfo['contact_email'] = $scope.subMerchantInfo.contact_email + merchantInfo['company_website'] = $scope.subMerchantInfo.company_website + merchantInfo['abn'] = $scope.subMerchantInfo.abn + merchantInfo['executives'] = $scope.executives + merchantInfo['subMerchantId'] = angular.copy(subMerchantId) + merchantInfo['directors'] = $scope.directors + merchantInfo['business_content'] = $scope.business_content + merchantInfo['industry'] = $scope.industry + merchantInfo['merchantId'] = merchantId + $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/updateYeepaySubMerchantId', merchantInfo).then( + function (resp) { + $scope.apply_sub_merchant_id = resp.data + $scope.$close() + if (subMerchantInfo.yeepay_sub_merchant_id != null) { + commonDialog.alert({ + title: 'Success', + content: 'Update Successfully,Please Wait For Review!', + type: 'success', + }) + $state.reload() + } + }, + function (resp) { + commonDialog.alert({ + title: 'Error', + content: resp.data.message, + type: 'error', + }) + } + ) + } + }, + ]) + app.controller('permissionClientCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + '$filter', + 'commonDialog', + function ($scope, $http, $uibModal, $state, $filter, commonDialog) { + $scope.clientPermission = {client_moniker: $scope.partner.client_moniker} + $scope.loadPermissionList = function () { + var params = angular.copy($scope.clientPermission) + $http.get('/sys/permission/list', {params: params}).then( + function (resp) { + $scope.permissionList = resp.data + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + $scope.loadPermissionList(1) + $scope.switchValid = function (permission) { + $scope.clientPermission.isValid = permission.is_valid + var params = angular.copy($scope.clientPermission) + $http.post('/sys/permission/' + permission.id, params).then( + function (resp) { + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } - $scope.saveYeepayApply = function (form) { - $scope.errmsg = null - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true + $scope.init = function () { + var params = {client_moniker: $scope.partner.client_moniker} + $http.post('/sys/permission/init', params).then( + function (resp) { + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) } - }) - return - } - // angular.forEach(form, function (item, key) { - // if(item !=null) { - // if(item.$name !=null) { - // merchantInfo[key] = item.$modelValue; - // } - // } - // }); - merchantInfo['company_name'] = $scope.subMerchantInfo.company_name - merchantInfo['contact_person'] = $scope.subMerchantInfo.contact_person - merchantInfo['contact_phone'] = $scope.subMerchantInfo.contact_phone - merchantInfo['contact_email'] = $scope.subMerchantInfo.contact_email - merchantInfo['company_website'] = $scope.subMerchantInfo.company_website - merchantInfo['abn'] = $scope.subMerchantInfo.abn - merchantInfo['executives'] = $scope.executives - merchantInfo['directors'] = $scope.directors - merchantInfo['business_content'] = $scope.business_content - merchantInfo['industry'] = $scope.industry - merchantInfo['merchantId'] = merchantId - $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/registYeepaySubMerchantId', merchantInfo).then( - function (resp) { - $scope.apply_sub_merchant_id = resp.data - $scope.$close() - if (subMerchantInfo.yeepay_sub_merchant_id != null) { - commonDialog.alert({ - title: 'Success', - content: 'Modify Yeepay Sub Merchant ID successfully', - type: 'success', - }) - $state.reload() - } - }, - function (resp) { - commonDialog.alert({ - title: 'Error', - content: resp.data.message, - type: 'error', + }, + ]) + app.controller('incrementalServiceCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + '$filter', + 'commonDialog', + function ($scope, $http, $uibModal, $state, $filter, commonDialog) { + $scope.serviceAll = {} + $scope.channelOptions = [] + $scope.initData = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/incremental_service').then(function (res) { + $scope.serviceAll = res.data.all_service + $scope.serviceAll.forEach(function (service) { + service.logo_url = '/static/images/' + service.channel + '.jpg' + service.logo_url = $scope.CheckImgExists(service.logo_url) ? service.logo_url : '/static/images/royalpay_sign.png' + }) + $scope.channelOptions = res.data.incremental_channel + }) + } + $scope.CheckImgExists = function (url) { + var xmlHttp + if (window.ActiveXObject) { + xmlHttp = new ActiveXObject('Microsoft.XMLHTTP') + } else if (window.XMLHttpRequest) { + xmlHttp = new XMLHttpRequest() + } + xmlHttp.open('Get', url, false) + xmlHttp.send() + if (xmlHttp.status == 404) return false + else return true + } + $scope.initData() + $scope.newServiceChannelDialog = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/incremental_service_dialog.html', + controller: 'incrementalServiceDialogCtrl', + resolve: { + params: function () { + return { + isCreate: true, + clientMoniker: $scope.partner.client_moniker, + channelOptions: $scope.channelOptions, + serviceChannel: null, + } + }, + }, + }) + .result.then(function () { + $scope.initData() + }) + } + $scope.editServiceChannelDialog = function (serviceChannel) { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/incremental_service_dialog.html', + controller: 'incrementalServiceDialogCtrl', + resolve: { + params: function () { + return { + isCreate: false, + clientMoniker: $scope.partner.client_moniker, + channelOptions: $scope.channelOptions, + serviceChannel: serviceChannel, + } + }, + }, + }) + .result.then(function () { + $scope.initData() + }) + } + $scope.updateStatus = function (service) { + commonDialog + .confirm({ + title: 'Update ' + service.channel + ' Incremental Service Status', + content: 'Are you sure update ' + service.channel + ' status?', + choises: [ + {label: 'Submit', className: 'btn-success', key: 1}, + {label: 'Cancel', className: 'btn-warning', key: 0, dismiss: true}, + ], + }) + .then(function (choice) { + if (choice == 1) { + service.is_valid = !service.is_valid + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/incremental_service/status', service).then( + function (res) { + commonDialog.alert({ + title: 'Success', + content: 'Update Service Successful!', + type: 'success', + }) + $scope.initData() + }, + function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + $scope.initData() + } + ) + } + }) + } + }, + ]) + app.controller('incrementalServiceDialogCtrl', [ + '$scope', + '$http', + 'params', + 'commonDialog', + function ($scope, $http, params, commonDialog) { + $scope.model = {} + $scope.ctrl = {sending: false} + $scope.isCreate = true + $scope.initData = function () { + $scope.isCreate = angular.copy(params.isCreate) + if ($scope.isCreate) { + $scope.model.channel = angular.copy(params.channelOptions[0]) + $scope.model.channelOptions = angular.copy(params.channelOptions) + } else { + $scope.model = angular.copy(params.serviceChannel) + } + } + $scope.initData() + $scope.save = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + $scope.ctrl.sending = true + $http.post('/sys/partners/' + params.clientMoniker + '/incremental_service', $scope.model).then( + function (res) { + commonDialog.alert({ + title: 'Success', + content: $scope.isCreate ? 'Create Service Successful!' : 'Update Service Successful!', + type: 'success', + }) + $scope.ctrl.sending = false + $scope.$close() + }, + function (resp) { + $scope.ctrl.sending = false + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + } + ) + } + }, + ]) + + app.filter('bdOrg', function () { + return function (bdUsers, org_id) { + if (org_id) { + var bdUserByOrg = {} + var count = 0 + angular.forEach(bdUsers, function (bdUser) { + if (bdUser.org_id == org_id) { + bdUserByOrg[count] = bdUser + count++ + } + }) + return bdUserByOrg + } + return bdUsers + } + }) + app.filter('wxMerchants', function () { + return function (values) { + var industry = '' + angular.forEach(wxMerchantIndustries, function (wxMerchant) { + if (wxMerchant.value == values) { + industry = wxMerchant.label + } }) - } - ) - } - }, - ]) - app.controller('addYeepaySubMerchantIdCtrl', [ - '$scope', - '$http', - '$uibModal', - '$state', - 'subMerchantInfo', - 'yeepayIndustryMap', - 'yeepayBusinessContentMap', - '$filter', - 'commonDialog', - 'Upload', - function ($scope, $http, $uibModal, $state, subMerchantInfo, yeepayIndustryMap, yeepayBusinessContentMap, $filter, commonDialog, Upload) { - $scope.yeepay_industries = yeepayIndustryMap.configs() - $scope.yeepay_business_contents = yeepayBusinessContentMap.configs() - $scope.subMerchantInfo = angular.copy(subMerchantInfo) - - var merchantInfo = {} - - $scope.saveYeepayAdd = function (form) { - $scope.errmsg = null - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } - }) - return - } - // angular.forEach(form, function (item, key) { - // if(item !=null) { - // if(item.$name !=null) { - // merchantInfo[key] = item.$modelValue; - // } - // } - // }); - - merchantInfo['sub_merchant_id'] = $scope.sub_merchant_id - merchantInfo['business_content'] = $scope.business_content - merchantInfo['industry'] = $scope.industry - $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/addYeepaySubMerchantId', merchantInfo).then( - function (resp) { - $scope.$close() - commonDialog.alert({ - title: 'Success', - content: 'Add Yeepay Sub Merchant ID successfully', - type: 'success', + return industry + } + }) + //将保存的industry 和最新的分类比较,若查不到,返回空 + app.filter('newWxMerchantsFilter', function () { + return function (values) { + var industry = null + angular.forEach(wxMerchantIndustries, function (wxMerchant) { + if (wxMerchant.value == values) { + industry = wxMerchant.value + } }) - $state.reload() - }, - function (resp) { - commonDialog.alert({ - title: 'Error', - content: resp.data.message, - type: 'error', + return industry + } + }) + app.filter('newWxMerchants', function () { + return function (values) { + var industry = '' + angular.forEach(wxMerchantIndustries, function (wxMerchant) { + if (wxMerchant.value == values) { + industry = wxMerchant.label + } }) - } - ) - } - }, - ]) - app.controller('updateYeepaySubMerchantIdCtrl', [ - '$scope', - '$http', - '$uibModal', - '$state', - 'subMerchantInfo', - 'yeepayIndustryMap', - 'yeepayBusinessContentMap', - '$filter', - 'commonDialog', - 'Upload', - 'subMerchantId', - function ($scope, $http, $uibModal, $state, subMerchantInfo, yeepayIndustryMap, yeepayBusinessContentMap, $filter, commonDialog, Upload, subMerchantId) { - $scope.yeepay_industries = yeepayIndustryMap.configs() - $scope.yeepay_business_contents = yeepayBusinessContentMap.configs() - $scope.subMerchantInfo = angular.copy(subMerchantInfo) - if (!$scope.subMerchantInfo.abn) { - $scope.subMerchantInfo.abn = $scope.subMerchantInfo.acn - } - var vouchers = {} - - $scope.directors = {} - $scope.executives = {} - $scope.industry = '' - $scope.business_content = '' - var merchantInfo = {} - - var merchantId = '' - - // $scope.uploadLegalIDcardFront = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.legalIDcardFrontProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.legalIDcardFrontProgress; - // $scope.legalIDcardFront = resp.data.path; - // vouchers['legalIDcardFront'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.legalIDcardFrontProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.legalIDcardFrontProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - // - // $scope.uploadLegalIDcardBack = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.legalIDcardBackProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.legalIDcardBackProgress; - // $scope.legalIDcardBack = resp.data.path; - // vouchers['legalIDcardBack'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.legalIDcardBackProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.legalIDcardBackProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - - $scope.uploadBusinessLicence = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.businessLicenceProgress = { value: 0 } - Upload.upload({ - url: '/attachment/yeepayFiles', - data: { file: file }, - }).then( - function (resp) { - delete $scope.businessLicenceProgress - $scope.businessLicence = resp.data.path - merchantInfo['business_licence'] = resp.data.path - merchantId = resp.data.merchantId - commonDialog.alert({ title: 'Upload Success', content: 'Upload Success', type: 'success' }) - }, - function (resp) { - delete $scope.businessLicenceProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.businessLicenceProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } + return industry + } + }) + app.filter('yeepayIndustry', function () { + return function (value) { + switch (value + '') { + case 'ehk100000': + return '货物贸易' + case 'ehk200000': + return '旅游' + case 'ehk300000': + return '文化教育' + case 'ehk400000': + return '服务贸易' + case 'ehk500000': + return '物流' + case 'ehk600000': + return '数字娱乐' + case 'ehk700000': + return '金融保险' + case 'ehk999999': + return '其他' + } } - } - - // $scope.uploadTaxLevel = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.taxLevelProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.taxLevelProgress; - // $scope.taxLevel = resp.data.path; - // vouchers['taxLevel'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.taxLevelProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.taxLevelProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - - // $scope.uploadBankAccountOpen = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.bankAccountOpenProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.bankAccountOpenProgress; - // $scope.bankAccountOpen = resp.data.path; - // vouchers['bankAccountOpen'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.bankAccountOpenProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.bankAccountOpenProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - - // $scope.uploadOrgCode = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.orgCodeProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.orgCodeProgress; - // $scope.orgCode = resp.data.path; - // vouchers['orgCode'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.orgCodeProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.orgCodeProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - // - // $scope.uploadNonStanProtocol = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.nonStanProtocolProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.nonStanProtocolProgress; - // $scope.nonStanProtocol = resp.data.path; - // vouchers['nonStanProtocol'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.nonStanProtocolProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.nonStanProtocolProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - // - // $scope.uploadZipPath = function (file) { - // if (file != null) { - // if (file.size > 3 * 1024 * 1024) { - // commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) - // } else { - // $scope.zipPathProgress = {value: 0}; - // Upload.upload({ - // url: '/attachment/yeepayFiles', - // data: {file: file} - // }).then(function (resp) { - // delete $scope.zipPathProgress; - // $scope.zipPath = resp.data.path; - // vouchers['zipPath'] = resp.data.path; - // merchantId = resp.data.merchantId; - // commonDialog.alert({title: 'Upload Success', content: 'Upload Success', type: 'success'}) - // }, function (resp) { - // delete $scope.zipPathProgress; - // commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - // }, function (evt) { - // $scope.zipPathProgress.value = parseInt(100 * evt.loaded / evt.total); - // }) - // } - // } - // }; - - $scope.uploadDirectorPassport = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.directorPassportProgress = { value: 0 } - Upload.upload({ - url: '/attachment/yeepayFiles', - data: { file: file }, - }).then( - function (resp) { - delete $scope.directorPassportProgress - $scope.directorPassport = resp.data.path - $scope.directors.filePath = resp.data.path - merchantId = resp.data.merchantId - commonDialog.alert({ title: 'Upload Success', content: 'Upload Success', type: 'success' }) - }, - function (resp) { - delete $scope.directorPassportProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.directorPassportProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } + }) + + app.filter('yeepayBusinessContent', function () { + return function (value) { + switch (value + '') { + case 'SERVICETRADE': + return '服务贸易' + case 'GOODSTRADE': + return '货物贸易' + case 'OVERSEASTUDY': + return '留学' + case 'HOTELTICKET': + return '酒店机票' + case 'INTTRANSPORT': + return '国际运输' + case 'TOURSERVICE': + return '旅游服务' + case 'INSURANCE': + return '保险' + } } - } - - $scope.uploadExecutivePassport = function (file) { - if (file != null) { - if (file.size > 3 * 1024 * 1024) { - commonDialog.alert({ title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error' }) - } else { - $scope.executivePassportProgress = { value: 0 } - Upload.upload({ - url: '/attachment/yeepayFiles', - data: { file: file }, - }).then( - function (resp) { - delete $scope.executivePassportProgress - $scope.executivePassport = resp.data.path - $scope.executives.filePath = resp.data.path - merchantId = resp.data.merchantId - commonDialog.alert({ title: 'Upload Success', content: 'Upload Success', type: 'success' }) - }, - function (resp) { - delete $scope.executivePassportProgress - commonDialog.alert({ title: 'Upload Failed', content: resp.data.message, type: 'error' }) - }, - function (evt) { - $scope.executivePassportProgress.value = parseInt((100 * evt.loaded) / evt.total) - } - ) - } + }) + + app.filter('bdOrgSelect', function () { + return function (bdUsers, params) { + var org_id + org_id = params.org_ids || params.org_id || currentUser.org_id + if (org_id) { + var bdUserByOrg = {} + var count = 0 + angular.forEach(bdUsers, function (bdUser) { + if (params.org_ids) { + if (bdUser.org_id == org_id) { + bdUserByOrg[count] = bdUser + count++ + } + } else { + if (bdUser.org_id == org_id || bdUser.parent_org_id == org_id) { + bdUserByOrg[count] = bdUser + count++ + } + } + }) + return bdUserByOrg + } + return bdUsers + } + }) + + app.filter('wxindustries', function () { + return function (value) { + switch (value + '') { + case '327': + return '343' + case '339': + return '493' + case '337': + return '492' + case '328': + return '491' + case '362': + case '361': + case '363': + case '329': + return '490' + case '330': + return '489' + case '332': + return '487' + case '334': + return '486' + case '335': + return '485' + case '336': + return '484' + case '338': + case '358': + return '494' + } } - } + }) - $scope.updateYeepayApply = function (form) { - $scope.errmsg = null - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true + app.filter('wechatMcc', [ + 'wechatGoodMcc', + function (wechatGoodMcc) { + return function (values) { + var industry = '' + angular.forEach(wechatGoodMcc.configs(), function (wxMerchant) { + if (wxMerchant.value == values) { + industry = wxMerchant.label + } + }) + return industry + } + }, + ]) + + app.filter('choose_merchant_id', function () { + return function (value) { + switch (value + '') { + case '1307485301': + return '1307485301(Tunnel Show1)' + case '1431999902': + return '1431999902(Tunnel Show2)' + case '1487387142': + return '1487387142(NAP)' + case '': + return '' } - }) - return - } - // angular.forEach(form, function (item, key) { - // if(item !=null) { - // if(item.$name !=null) { - // merchantInfo[key] = item.$modelValue; - // } - // } - // }); - merchantInfo['company_name'] = $scope.subMerchantInfo.company_name - merchantInfo['contact_person'] = $scope.subMerchantInfo.contact_person - merchantInfo['contact_phone'] = $scope.subMerchantInfo.contact_phone - merchantInfo['contact_email'] = $scope.subMerchantInfo.contact_email - merchantInfo['company_website'] = $scope.subMerchantInfo.company_website - merchantInfo['abn'] = $scope.subMerchantInfo.abn - merchantInfo['executives'] = $scope.executives - merchantInfo['subMerchantId'] = angular.copy(subMerchantId) - merchantInfo['directors'] = $scope.directors - merchantInfo['business_content'] = $scope.business_content - merchantInfo['industry'] = $scope.industry - merchantInfo['merchantId'] = merchantId - $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/updateYeepaySubMerchantId', merchantInfo).then( - function (resp) { - $scope.apply_sub_merchant_id = resp.data - $scope.$close() - if (subMerchantInfo.yeepay_sub_merchant_id != null) { - commonDialog.alert({ - title: 'Success', - content: 'Update Successfully,Please Wait For Review!', - type: 'success', - }) - $state.reload() - } - }, - function (resp) { - commonDialog.alert({ - title: 'Error', - content: resp.data.message, - type: 'error', - }) - } - ) - } - }, - ]) - app.controller('permissionClientCtrl', [ - '$scope', - '$http', - '$uibModal', - '$state', - '$filter', - 'commonDialog', - function ($scope, $http, $uibModal, $state, $filter, commonDialog) { - $scope.clientPermission = { client_moniker: $scope.partner.client_moniker } - $scope.loadPermissionList = function () { - var params = angular.copy($scope.clientPermission) - $http.get('/sys/permission/list', { params: params }).then( - function (resp) { - $scope.permissionList = resp.data - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - $scope.loadPermissionList(1) - $scope.switchValid = function (permission) { - $scope.clientPermission.isValid = permission.is_valid - var params = angular.copy($scope.clientPermission) - $http.post('/sys/permission/' + permission.id, params).then( - function (resp) {}, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - - $scope.init = function () { - var params = { client_moniker: $scope.partner.client_moniker } - $http.post('/sys/permission/init', params).then( - function (resp) {}, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - }, - ]) - app.controller('incrementalServiceCtrl', [ - '$scope', - '$http', - '$uibModal', - '$state', - '$filter', - 'commonDialog', - function ($scope, $http, $uibModal, $state, $filter, commonDialog) { - $scope.serviceAll = {} - $scope.channelOptions = [] - $scope.initData = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/incremental_service').then(function (res) { - $scope.serviceAll = res.data.all_service - $scope.serviceAll.forEach(function (service) { - service.logo_url = '/static/images/' + service.channel + '.jpg' - service.logo_url = $scope.CheckImgExists(service.logo_url) ? service.logo_url : '/static/images/royalpay_sign.png' - }) - $scope.channelOptions = res.data.incremental_channel - }) - } - $scope.CheckImgExists = function (url) { - var xmlHttp - if (window.ActiveXObject) { - xmlHttp = new ActiveXObject('Microsoft.XMLHTTP') - } else if (window.XMLHttpRequest) { - xmlHttp = new XMLHttpRequest() - } - xmlHttp.open('Get', url, false) - xmlHttp.send() - if (xmlHttp.status == 404) return false - else return true - } - $scope.initData() - $scope.newServiceChannelDialog = function () { - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/incremental_service_dialog.html', - controller: 'incrementalServiceDialogCtrl', - resolve: { - params: function () { - return { - isCreate: true, - clientMoniker: $scope.partner.client_moniker, - channelOptions: $scope.channelOptions, - serviceChannel: null, - } - }, - }, - }) - .result.then(function () { - $scope.initData() - }) - } - $scope.editServiceChannelDialog = function (serviceChannel) { - $uibModal - .open({ - templateUrl: '/static/payment/partner/templates/incremental_service_dialog.html', - controller: 'incrementalServiceDialogCtrl', - resolve: { - params: function () { - return { - isCreate: false, - clientMoniker: $scope.partner.client_moniker, - channelOptions: $scope.channelOptions, - serviceChannel: serviceChannel, - } - }, - }, - }) - .result.then(function () { - $scope.initData() - }) - } - $scope.updateStatus = function (service) { - commonDialog - .confirm({ - title: 'Update ' + service.channel + ' Incremental Service Status', - content: 'Are you sure update ' + service.channel + ' status?', - choises: [ - { label: 'Submit', className: 'btn-success', key: 1 }, - { label: 'Cancel', className: 'btn-warning', key: 0, dismiss: true }, - ], - }) - .then(function (choice) { - if (choice == 1) { - service.is_valid = !service.is_valid - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/incremental_service/status', service).then( - function (res) { - commonDialog.alert({ - title: 'Success', - content: 'Update Service Successful!', - type: 'success', - }) - $scope.initData() - }, - function (resp) { - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - $scope.initData() - } - ) - } - }) - } - }, - ]) - app.controller('incrementalServiceDialogCtrl', [ - '$scope', - '$http', - 'params', - 'commonDialog', - function ($scope, $http, params, commonDialog) { - $scope.model = {} - $scope.ctrl = { sending: false } - $scope.isCreate = true - $scope.initData = function () { - $scope.isCreate = angular.copy(params.isCreate) - if ($scope.isCreate) { - $scope.model.channel = angular.copy(params.channelOptions[0]) - $scope.model.channelOptions = angular.copy(params.channelOptions) - } else { - $scope.model = angular.copy(params.serviceChannel) - } - } - $scope.initData() - $scope.save = function (form) { - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true - } - }) - return - } - $scope.ctrl.sending = true - $http.post('/sys/partners/' + params.clientMoniker + '/incremental_service', $scope.model).then( - function (res) { - commonDialog.alert({ - title: 'Success', - content: $scope.isCreate ? 'Create Service Successful!' : 'Update Service Successful!', - type: 'success', - }) - $scope.ctrl.sending = false - $scope.$close() - }, - function (resp) { - $scope.ctrl.sending = false - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) - } - ) - } - }, - ]) - - app.filter('bdOrg', function () { - return function (bdUsers, org_id) { - if (org_id) { - var bdUserByOrg = {} - var count = 0 - angular.forEach(bdUsers, function (bdUser) { - if (bdUser.org_id == org_id) { - bdUserByOrg[count] = bdUser - count++ - } - }) - return bdUserByOrg - } - return bdUsers - } - }) - app.filter('wxMerchants', function () { - return function (values) { - var industry = '' - angular.forEach(wxMerchantIndustries, function (wxMerchant) { - if (wxMerchant.value == values) { - industry = wxMerchant.label - } - }) - return industry - } - }) - //将保存的industry 和最新的分类比较,若查不到,返回空 - app.filter('newWxMerchantsFilter', function () { - return function (values) { - var industry = null - angular.forEach(wxMerchantIndustries, function (wxMerchant) { - if (wxMerchant.value == values) { - industry = wxMerchant.value - } - }) - return industry - } - }) - app.filter('newWxMerchants', function () { - return function (values) { - var industry = '' - angular.forEach(wxMerchantIndustries, function (wxMerchant) { - if (wxMerchant.value == values) { - industry = wxMerchant.label } - }) - return industry - } - }) - app.filter('yeepayIndustry', function () { - return function (value) { - switch (value + '') { - case 'ehk100000': - return '货物贸易' - case 'ehk200000': - return '旅游' - case 'ehk300000': - return '文化教育' - case 'ehk400000': - return '服务贸易' - case 'ehk500000': - return '物流' - case 'ehk600000': - return '数字娱乐' - case 'ehk700000': - return '金融保险' - case 'ehk999999': - return '其他' - } - } - }) - - app.filter('yeepayBusinessContent', function () { - return function (value) { - switch (value + '') { - case 'SERVICETRADE': - return '服务贸易' - case 'GOODSTRADE': - return '货物贸易' - case 'OVERSEASTUDY': - return '留学' - case 'HOTELTICKET': - return '酒店机票' - case 'INTTRANSPORT': - return '国际运输' - case 'TOURSERVICE': - return '旅游服务' - case 'INSURANCE': - return '保险' - } - } - }) - - app.filter('bdOrgSelect', function () { - return function (bdUsers, params) { - var org_id - org_id = params.org_ids || params.org_id || currentUser.org_id - if (org_id) { - var bdUserByOrg = {} - var count = 0 - angular.forEach(bdUsers, function (bdUser) { - if (params.org_ids) { - if (bdUser.org_id == org_id) { - bdUserByOrg[count] = bdUser - count++ - } - } else { - if (bdUser.org_id == org_id || bdUser.parent_org_id == org_id) { - bdUserByOrg[count] = bdUser - count++ - } - } - }) - return bdUserByOrg - } - return bdUsers - } - }) - - app.filter('wxindustries', function () { - return function (value) { - switch (value + '') { - case '327': - return '343' - case '339': - return '493' - case '337': - return '492' - case '328': - return '491' - case '362': - case '361': - case '363': - case '329': - return '490' - case '330': - return '489' - case '332': - return '487' - case '334': - return '486' - case '335': - return '485' - case '336': - return '484' - case '338': - case '358': - return '494' - } - } - }) - - app.filter('wechatMcc', [ - 'wechatGoodMcc', - function (wechatGoodMcc) { - return function (values) { - var industry = '' - angular.forEach(wechatGoodMcc.configs(), function (wxMerchant) { - if (wxMerchant.value == values) { - industry = wxMerchant.label - } - }) - return industry - } - }, - ]) - - app.filter('choose_merchant_id', function () { - return function (value) { - switch (value + '') { - case '1307485301': - return '1307485301(Tunnel Show1)' - case '1431999902': - return '1431999902(Tunnel Show2)' - case '1487387142': - return '1487387142(NAP)' - case '': - return '' - } - } - }) + }) - app.filter('cut', function () { - return function (value, wordwise, max, tail) { - if (!value) return '' + app.filter('cut', function () { + return function (value, wordwise, max, tail) { + if (!value) return '' - max = parseInt(max, 10) - if (!max) return value - if (value.length <= max) return value + max = parseInt(max, 10) + if (!max) return value + if (value.length <= max) return value - value = value.substr(0, max) - if (wordwise) { - var lastspace = value.lastIndexOf(' ') - if (lastspace != -1) { - value = value.substr(0, lastspace) + value = value.substr(0, max) + if (wordwise) { + var lastspace = value.lastIndexOf(' ') + if (lastspace != -1) { + value = value.substr(0, lastspace) + } + } + return value + (tail || ' …') + } + }) + app.filter('dateConversionStr', function () { + return function (date) { + var year = date.getFullYear() //获取完整的年份(4位,1970-????) + var month = date.getMonth() + 1 //获取当前月份(0-11,0代表1月) + var day = date.getDate() //获取当前日(1-31) + if (month < 10) { + month = '0' + month + } + if (day < 10) { + day = '0' + day + } + var dateString = year + '-' + month + '-' + day + return dateString } - } - return value + (tail || ' …') - } - }) - app.filter('dateConversionStr', function () { - return function (date) { - var year = date.getFullYear() //获取完整的年份(4位,1970-????) - var month = date.getMonth() + 1 //获取当前月份(0-11,0代表1月) - var day = date.getDate() //获取当前日(1-31) - if (month < 10) { - month = '0' + month - } - if (day < 10) { - day = '0' + day - } - var dateString = year + '-' + month + '-' + day - return dateString - } - }) - return app + }) + return app }) 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 79245604a..13627efc0 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 @@ -108,28 +108,28 @@

- {{(paymentInfo.max_order_amount|currency:'AUD ')||'Not Configure'}} + {{(paymentInfo.max_order_amount | currency:'AUD ') || 'Not Configure'}}

AUD
+ title="Max Order Amount">
@@ -140,19 +140,19 @@

- {{paymentInfo.customer_surcharge_rate||'Not Configure'}} + {{paymentInfo.customer_surcharge_rate || 'Not Configure'}}

+ title="Customer Surcharge Rate" max="{{paymentInfo.max_customer_surcharge_rate}}" + min="{{paymentInfo.min_customer_surcharge_rate}}" name="customer_surcharge_rate">
%
@@ -163,7 +163,7 @@
@@ -178,16 +178,16 @@

- {{paymentInfo.order_expiry_config||'Not Configure'}} + {{paymentInfo.order_expiry_config || 'Not Configure'}}

+ title="Prevent not enough refund">
@@ -218,21 +218,21 @@
+ ng-change="toggleChannel('alipay')">
+ ng-change="toggleChannel('wechat')">
+ ng-change="toggleChannel('cb_bankpay')">
@@ -240,21 +240,28 @@
+ ng-change="toggleChannel('rpaypmt_card')">
+ ng-change="toggleChannel('rpaypmt_dd')">
+ ng-change="toggleChannel('alipayplus')"> +
+
+
+ +
+
@@ -274,7 +281,7 @@
+ switch-change="updateClientQRCodePaySurCharge()">
@@ -290,13 +297,13 @@ Pre Authorization + uib-tooltip="Pre Authorize means this bill will not be settled until completion">

@@ -327,7 +334,7 @@

Download Aggregate QR Board Image + download> Download Aggregate QR Board Image (聚合支付水晶立牌:支持支付宝、微信、翼支付)

@@ -344,28 +351,28 @@
+ switch-change="toggleGateway()">
+ switch-change="toggleGatewayUpgrade()">
+ switch-change="toggleGatewayAlipayOnline()">
+ switch-change="updateClientApiSurCharge()">

If client have already attached surcharge in their own system, ignore this choice.
@@ -380,8 +387,8 @@

+ data-on-text="Alipay+" data-off-text="Alipay" data-off-color="primary" + ng-change="setAlipayChannel()">
@@ -453,29 +460,29 @@
+ ng-change="toggleCBBankPayLink()">   {{paymentInfo.cb_bankpay_url}} + ng-if="paymentInfo.enable_cb_bankpay_link">{{paymentInfo.cb_bankpay_url}} + style="cursor: pointer" ng-click="copyCBBankPayLink()"> + value={{paymentInfo.cb_bankpay_url}} readonly>
+ ng-change="updateClientCBBankPaySurCharge()">
@@ -483,7 +490,7 @@
- +
  仅支持微信客户端扫描
@@ -498,7 +505,7 @@
@@ -507,9 +514,9 @@
+ src="/static/images/cbbank_payment_page_v1.jpg"> + src="/static/images/cbbank_payment_page_v2.jpg">
@@ -527,14 +534,31 @@
+ switch-change="switchInternationalCard()">
+ switch-change="switchThreeDS()"> +
+
+
+
+ + + +
+
AlipayCN channel replace
+
+
+
+ +
+
@@ -550,14 +574,14 @@
+ switch-change="toggleOffline()">
+ switch-change="updateClientRetailPaySurCharge()">
@@ -565,14 +589,14 @@
-
Refund
+
Refund
+ switch-change="toggleRefund()">
@@ -580,7 +604,7 @@
+ switch-change="togglePreRefund()">
@@ -589,13 +613,13 @@

- {{paymentInfo.refund_credit_line||'Not Configure'}} + {{paymentInfo.refund_credit_line || 'Not Configure'}}

+ ng-model="paymentInfo.refund_credit_line">
+ switch-change="toggleRequireRemark()">
@@ -668,7 +692,7 @@
+ ng-change="extChangeParam(param.name,param.value)">
@@ -679,7 +703,7 @@

+ title="Prevent not enough refund">
+ +
+
+

AlipayPlus Logs

+
+
+

No Data

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Date StartDate EndSettle DatePay FeeRefund FeeNet FeePoundageSettlement FeeUnsettledValidation
{{log.net_fee}} +   (System:{{log.sys_net_fee}}) +   (System:{{log.sys_net_fee}}) + {{log.surcharge}} +   (System:{{log.sys_surcharge}}) +   (System:{{log.sys_surcharge}}) + {{log.settlement_fee}} +   (System:{{log.sys_settlement_fee}}) +   (System:{{log.sys_settlement_fee}}) +
+ +
+
diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 4e63e0fb4..2f6369ab1 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -6385,6 +6385,67 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.loadSubMerchantInfos() }) } + + $scope.applyAlipayPlusRetailMerchantId = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/apply_alipayplus_sub_merchant_id.html', + controller: 'applyAlipayPlusSubMerchantIdCtrl', + resolve: { + subMerchantInfo: function () { + return $scope.partner + }, + online: false, + }, + }) + .result.then(function () { + $scope.loadSubMerchantInfos() + }) + } + $scope.applyAlipayPlusOnlineMerchantId = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/apply_alipayplus_sub_merchant_id.html', + controller: 'applyAlipayPlusSubMerchantIdCtrl', + resolve: { + subMerchantInfo: function () { + return $scope.partner + }, + online: true, + }, + }) + .result.then(function () { + $scope.loadSubMerchantInfos() + }) + } + $scope.queryAlipayPlusApsOnline = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_aps_online').then( + function (resp) { + commonDialog.alert({ + title: 'AlipayPlus Online Apply Status', + content: resp.data.response_str, + type: 'info', + }) + }, + function (resp) { + commonDialog.alert({ title: 'Error', content: '查询失败:' + resp.data.message, type: 'error' }) + } + ) + }; + $scope.queryAlipayPlusApsRetail = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_aps_retail').then( + function (resp) { + commonDialog.alert({ + title: 'AlipayPlus Retail Apply Status', + content: resp.data.response_str, + type: 'info', + }) + }, + function (resp) { + commonDialog.alert({ title: 'Error', content: '查询失败:' + resp.data.message, type: 'error' }) + } + ) + }; // 刷新Wechat Sub Merchant Id $scope.queryWechatSubMerchantIdStatus = function () { $http.get('/sys/partners/' + $scope.partner.client_moniker + '/get_merchant_ids/' + $scope.partnerInfo.sub_merchant_id + '/status').then( @@ -6973,7 +7034,134 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } }, ]) - app.controller('updateApplyWxSubMerchantIdCtrl', [ + /** + * 申请alipayplus + */ + app.controller('applyAlipayPlusSubMerchantIdCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + 'subMerchantInfo', + '$filter', + 'commonDialog', + 'online', + function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, commonDialog,online) { + $scope.subMerchantInfo = angular.copy(subMerchantInfo) + $scope.subMerchantInfo.online=online; + $scope.subMerchantInfo.merchantDisplayName = $scope.subMerchantInfo.short_name; + $scope.subMerchantInfo.registrationAddress= $scope.subMerchantInfo.address; + + // if ($scope.subMerchantInfo.client_pay_type) { + // if ($scope.subMerchantInfo.client_pay_type.indexOf('1') >= 0 && $scope.subMerchantInfo.client_pay_type.indexOf('2') >= 0) { + // $scope.subMerchantInfo.payment_type_online = true; + // $scope.subMerchantInfo.business_type_offline = true; + // } else if ($scope.subMerchantInfo.client_pay_type.indexOf('1') >= 0) { + // $scope.subMerchantInfo.business_type_offline = true + // } else if ($scope.subMerchantInfo.client_pay_type.indexOf('2') >= 0) { + // $scope.subMerchantInfo.business_type_agreement = true + // } + // } else { + // $scope.subMerchantInfo.payment_type_online = true; + // $scope.subMerchantInfo.business_type_offline = true; + // } + if($scope.subMerchantInfo.online) { + $scope.title = "AlipayPlus-aps(Online)Registration"; + }else{ + $scope.title = "AlipayPlus-aps(Retail)Registration"; + } + $scope.subMerchantInfo.websiteType = 'WEB'; + $scope.subMerchantInfo.website= $scope.subMerchantInfo.company_website; + $scope.subMerchantInfo.legalName = $scope.subMerchantInfo.company_name; + $scope.subMerchantInfo.registrationType='OTHER_IDENTIFICATION_NO' + if ($scope.subMerchantInfo.business_structure) { + $scope.subMerchantInfo.businessType = $scope.subMerchantInfo.business_structure != 'Registered body(Sole Trader)' ? 'ENTERPRISE' : 'INDIVIDUAL' + } + $scope.subMerchantInfo.shareholderName= $scope.subMerchantInfo.representativeInfo.representative_person; + $scope.subMerchantInfo.representativeName= $scope.subMerchantInfo.representativeInfo.representative_person; + $scope.subMerchantInfo.storeAddress= $scope.subMerchantInfo.address; + $scope.subMerchantInfo.registrationNo= $scope. subMerchantInfo.acn ? $scope.subMerchantInfo.acn : $scope.subMerchantInfo.abn; + $scope.subMerchantInfo.storeMCC=$scope.subMerchantInfo.alipayindustry; + $scope.subMerchantInfo.storeName=$scope.subMerchantInfo.store_name; + + $scope.alipayMccCategory = {} + $scope.loadAlipayCategory = function () { + $http.get('/static/data/alipayMcc.json').then(function (resp) { + $scope.alipayMccCategory = resp.data + }) + } + $scope.loadAlipayCategory() + + $scope.onAlipayMccSelect = function (selectedItem) { + $scope.subMerchantInfo.alipay_category = selectedItem.label + $scope.subMerchantInfo.alipayindustry = selectedItem.mccCode + } + $scope.onAlipayStoreMccSelect = function (selectedItem) { + $scope.subMerchantInfo.storeMCC_category = selectedItem.label + $scope.subMerchantInfo.storeMCC = selectedItem.mccCode + } + $scope.saveAlipayApply = function (form) { + $scope.errmsg = null + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return; + } + var params = { + websiteType: $scope.subMerchantInfo.websiteType, + merchantDisplayName: $scope.subMerchantInfo.merchantDisplayName, + merchantMCC: $scope.subMerchantInfo.alipayindustry, + legalName: $scope.subMerchantInfo.legalName, + registrationType: $scope.subMerchantInfo.registrationType, + registrationNo: $scope.subMerchantInfo.registrationNo, + businessType: $scope.subMerchantInfo.businessType, + shareholderName: $scope.subMerchantInfo.shareholderName, + shareholderId: $scope.subMerchantInfo.shareholderId, + representativeName: $scope.subMerchantInfo.representativeName, + representativeId: $scope.subMerchantInfo.representativeId, + storeName: $scope.subMerchantInfo.storeName, + storeMCC: $scope.subMerchantInfo.storeMCC, + storeAddress: $scope.subMerchantInfo.storeAddress, + registrationAddress: $scope.subMerchantInfo.registrationAddress, + } + params.productCodes=[]; + if($scope.subMerchantInfo.online){ + params.productCodes.push('CASHIER_PAYMENT'); + }else{ + params.productCodes.push('IN_STORE_PAYMENT'); + } + params.websites=[] + if($scope.subMerchantInfo.online){ + params.websites.push($scope.subMerchantInfo.website); + } + + $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/apply_alipayplus', params).then( + function (resp) { + if(resp.data.success) { + commonDialog.alert({ title: 'Success', content: "注册成功!", type: 'success' }) + }else{ + commonDialog.alert({title: 'Error', content: "注册失败!", type: 'error'}) + } + + $scope.$close() + }, + function (resp) { + $scope.flag = false + commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) + } + ) + + }; + + + }, + ]) + + + app.controller('updateApplyWxSubMerchantIdCtrl', [ '$scope', '$http', '$uibModal', diff --git a/src/main/ui/static/payment/partner/templates/apply_alipayplus_sub_merchant_id.html b/src/main/ui/static/payment/partner/templates/apply_alipayplus_sub_merchant_id.html new file mode 100644 index 000000000..41b8a3cfa --- /dev/null +++ b/src/main/ui/static/payment/partner/templates/apply_alipayplus_sub_merchant_id.html @@ -0,0 +1,284 @@ +
+
+
+
+
+
{{title}}
+
+
+ +
+ +
+ +
+

Required Field

+

Length is more than 50

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+

Required + Field

+
+
+ +
+ + +
+ +
+ +
+

Required Field

+

Length is more than 1000

+
+
+
+ +
+ +
+
+ + +
+
+ + +
+
+
+ +
+ +
+ +
+

Required Field

+

Length is more than 256

+
+
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+ +
+ +
+

Required Field

+

Length is more than 64

+
+
+
+
+ +
+ +
+

Required Field

+

Length is more than 64

+
+
+
+ +
+ +
+ +
+

Required Field

+
+
+
+ +
+ +
+ +
+

Required Field

+

Length is more than 128

+
+
+
+
+ +
+ +
+

Required Field

+

Length is more than 128

+
+
+
+
+ +
+ +
+

Required Field

+

Length is more than 128

+
+
+
+
+ +
+ +
+

Required Field

+

Length is more than 128

+
+
+
+ + + + +
+ +
+ +
+

Required Field

+

Length is more than 256

+
+
+
+ +
+ +
+ +
+

Required + Field

+
+
+ +
+ + +
+ +
+ +
+

Required Field

+

Length is more than 256

+
+
+
+ + +
+
+
+ +
+ +
+
+
+
+
\ No newline at end of file diff --git a/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html b/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html index 439260e97..02bc04812 100644 --- a/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html +++ b/src/main/ui/static/payment/partner/templates/sub_merchant_id_apply.html @@ -232,6 +232,89 @@
+ +
+
+
+
+
+
+ +
+
+ +
+ AlipayPlus(Retail) : + none +
+ +
+
+ + + +
+
+
+
+
+ No Data +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+ AlipayPlus(Online) : + none +
+ +
+
+ + + +
+
+
+
+
+ No Data +
+
+
+
+
+
+
From 4cb08e0cb6a98743ce887d72de89d8461c2e6789 Mon Sep 17 00:00:00 2001 From: dalong306 <304592994@qq.com> Date: Mon, 13 Sep 2021 15:22:47 +0800 Subject: [PATCH 04/50] =?UTF-8?q?alipayplus=20aps=20=E5=95=86=E6=88=B7?= =?UTF-8?q?=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/payment/partner/partner-manage.js | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index d3b0b07e2..65722c901 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -6435,6 +6435,67 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } ) } + //alipayplus aps 注册 + $scope.applyAlipayPlusRetailMerchantId = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/apply_alipayplus_sub_merchant_id.html', + controller: 'applyAlipayPlusSubMerchantIdCtrl', + resolve: { + subMerchantInfo: function () { + return $scope.partner + }, + online: false, + }, + }) + .result.then(function () { + $scope.loadSubMerchantInfos() + }) + } + $scope.applyAlipayPlusOnlineMerchantId = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/apply_alipayplus_sub_merchant_id.html', + controller: 'applyAlipayPlusSubMerchantIdCtrl', + resolve: { + subMerchantInfo: function () { + return $scope.partner + }, + online: true, + }, + }) + .result.then(function () { + $scope.loadSubMerchantInfos() + }) + } + $scope.queryAlipayPlusApsOnline = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_aps_online').then( + function (resp) { + commonDialog.alert({ + title: 'AlipayPlus Online Apply Status', + content: resp.data.response_str, + type: 'info', + }) + }, + function (resp) { + commonDialog.alert({ title: 'Error', content: '查询失败:' + resp.data.message, type: 'error' }) + } + ) + }; + $scope.queryAlipayPlusApsRetail = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/query/alipay_aps_retail').then( + function (resp) { + commonDialog.alert({ + title: 'AlipayPlus Retail Apply Status', + content: resp.data.response_str, + type: 'info', + }) + }, + function (resp) { + commonDialog.alert({ title: 'Error', content: '查询失败:' + resp.data.message, type: 'error' }) + } + ) + }; // Wechat-applay $scope.applyWxSubMerchantId = function () { $uibModal @@ -7212,6 +7273,131 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } }, ]) + /** + * 申请alipayplus + */ + app.controller('applyAlipayPlusSubMerchantIdCtrl', [ + '$scope', + '$http', + '$uibModal', + '$state', + 'subMerchantInfo', + '$filter', + 'commonDialog', + 'online', + function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, commonDialog,online) { + $scope.subMerchantInfo = angular.copy(subMerchantInfo) + $scope.subMerchantInfo.online=online; + $scope.subMerchantInfo.merchantDisplayName = $scope.subMerchantInfo.short_name; + $scope.subMerchantInfo.registrationAddress= $scope.subMerchantInfo.address; + + // if ($scope.subMerchantInfo.client_pay_type) { + // if ($scope.subMerchantInfo.client_pay_type.indexOf('1') >= 0 && $scope.subMerchantInfo.client_pay_type.indexOf('2') >= 0) { + // $scope.subMerchantInfo.payment_type_online = true; + // $scope.subMerchantInfo.business_type_offline = true; + // } else if ($scope.subMerchantInfo.client_pay_type.indexOf('1') >= 0) { + // $scope.subMerchantInfo.business_type_offline = true + // } else if ($scope.subMerchantInfo.client_pay_type.indexOf('2') >= 0) { + // $scope.subMerchantInfo.business_type_agreement = true + // } + // } else { + // $scope.subMerchantInfo.payment_type_online = true; + // $scope.subMerchantInfo.business_type_offline = true; + // } + if($scope.subMerchantInfo.online) { + $scope.title = "AlipayPlus-aps(Online)Registration"; + }else{ + $scope.title = "AlipayPlus-aps(Retail)Registration"; + } + $scope.subMerchantInfo.websiteType = 'WEB'; + $scope.subMerchantInfo.website= $scope.subMerchantInfo.company_website; + $scope.subMerchantInfo.legalName = $scope.subMerchantInfo.company_name; + $scope.subMerchantInfo.registrationType='OTHER_IDENTIFICATION_NO' + if ($scope.subMerchantInfo.business_structure) { + $scope.subMerchantInfo.businessType = $scope.subMerchantInfo.business_structure != 'Registered body(Sole Trader)' ? 'ENTERPRISE' : 'INDIVIDUAL' + } + $scope.subMerchantInfo.shareholderName= $scope.subMerchantInfo.representativeInfo.representative_person; + $scope.subMerchantInfo.representativeName= $scope.subMerchantInfo.representativeInfo.representative_person; + $scope.subMerchantInfo.storeAddress= $scope.subMerchantInfo.address; + $scope.subMerchantInfo.registrationNo= $scope. subMerchantInfo.acn ? $scope.subMerchantInfo.acn : $scope.subMerchantInfo.abn; + $scope.subMerchantInfo.storeMCC=$scope.subMerchantInfo.alipayindustry; + $scope.subMerchantInfo.storeName=$scope.subMerchantInfo.store_name; + + $scope.alipayMccCategory = {} + $scope.loadAlipayCategory = function () { + $http.get('/static/data/alipayMcc.json').then(function (resp) { + $scope.alipayMccCategory = resp.data + }) + } + $scope.loadAlipayCategory() + + $scope.onAlipayMccSelect = function (selectedItem) { + $scope.subMerchantInfo.alipay_category = selectedItem.label + $scope.subMerchantInfo.alipayindustry = selectedItem.mccCode + } + $scope.onAlipayStoreMccSelect = function (selectedItem) { + $scope.subMerchantInfo.storeMCC_category = selectedItem.label + $scope.subMerchantInfo.storeMCC = selectedItem.mccCode + } + $scope.saveAlipayApply = function (form) { + $scope.errmsg = null + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return; + } + var params = { + websiteType: $scope.subMerchantInfo.websiteType, + merchantDisplayName: $scope.subMerchantInfo.merchantDisplayName, + merchantMCC: $scope.subMerchantInfo.alipayindustry, + legalName: $scope.subMerchantInfo.legalName, + registrationType: $scope.subMerchantInfo.registrationType, + registrationNo: $scope.subMerchantInfo.registrationNo, + businessType: $scope.subMerchantInfo.businessType, + shareholderName: $scope.subMerchantInfo.shareholderName, + shareholderId: $scope.subMerchantInfo.shareholderId, + representativeName: $scope.subMerchantInfo.representativeName, + representativeId: $scope.subMerchantInfo.representativeId, + storeName: $scope.subMerchantInfo.storeName, + storeMCC: $scope.subMerchantInfo.storeMCC, + storeAddress: $scope.subMerchantInfo.storeAddress, + registrationAddress: $scope.subMerchantInfo.registrationAddress, + } + params.productCodes=[]; + if($scope.subMerchantInfo.online){ + params.productCodes.push('CASHIER_PAYMENT'); + }else{ + params.productCodes.push('IN_STORE_PAYMENT'); + } + params.websites=[] + if($scope.subMerchantInfo.online){ + params.websites.push($scope.subMerchantInfo.website); + } + + $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/apply_alipayplus', params).then( + function (resp) { + if(resp.data.success) { + commonDialog.alert({ title: 'Success', content: "注册成功!", type: 'success' }) + }else{ + commonDialog.alert({title: 'Error', content: "注册失败!", type: 'error'}) + } + + $scope.$close() + }, + function (resp) { + $scope.flag = false + commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) + } + ) + + }; + + + }, + ]) app.controller('applyRpaySubMerchantIdCtrl', [ '$scope', From a0d059ee9d7763b946d5d6a7d15cbe603f22bf35 Mon Sep 17 00:00:00 2001 From: Todking Date: Tue, 14 Sep 2021 11:00:46 +0800 Subject: [PATCH 05/50] =?UTF-8?q?add=20=E6=96=B0=E5=A2=9Eaps=E6=B8=A0?= =?UTF-8?q?=E9=81=93=E8=B4=B9=E7=8E=87=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/impls/ClientManagerImpl.java | 6 + .../static/payment/partner/partner-manage.js | 78 ++++++++++- .../templates/partner_bankaccounts.html | 28 +++- .../partner_new_alipay_aps_rate.html | 126 ++++++++++++++++++ .../partner/templates/rate_config_dialog.html | 16 ++- 5 files changed, 245 insertions(+), 9 deletions(-) create mode 100644 src/main/ui/static/payment/partner/templates/partner_new_alipay_aps_rate.html 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 959efeeb8..af0999d69 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 @@ -2021,12 +2021,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkAddRate(config, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate"); checkAddRate(config, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate"); checkAddRate(config, "CB_BankPay", "min_cb_bankpay_value", org, "min_cb_bankpay_rate"); + checkAddRate(config, "AlipayAps Interchange Fee", "interchange_fee_value", org, "min_interchange_fee_rate"); + checkAddRate(config, "AlipayAps Serivce Fee", "service_fee_value", org, "min_service_fee_rate"); configNewClientRate(config, clientId, "Wechat", "wechat_rate_value", org, "min_wechat_rate"); configNewClientRate(config, clientId, "Alipay", "alipay_rate_value", org, "min_alipay_rate"); configNewClientRate(config, clientId, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate"); configNewClientRate(config, clientId, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate"); configNewClientRate(config, clientId, "CB_BankPay", "cb_bankpay_rate_value", org, "min_cb_bankpay_rate"); + configNewClientRate(config, clientId, "AlipayAps", "interchange_fee_value", null, ""); addAlipayPlusRateConfig(config, clientId, PayChannel.ALIPAY_PLUS.getChannelCode()); } @@ -2082,6 +2085,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (newConfig.getBigDecimal("cb_bankpay_rate_value") != null) { clientRateMapper.saveRate(newConfig); } + } else if("AlipayAps".equalsIgnoreCase(channel)){ + newConfig.put("transaction_fee",newConfig.getFloatValue("service_fee_value")); + clientRateMapper.saveRate(newConfig); } else { clientRateMapper.saveRate(newConfig); } diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 65722c901..16dc34ae9 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -2487,7 +2487,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter // $scope.init.channel[channel] = true // return // } - if($scope.paymentInfo.alipay_cn_switch){ + if ($scope.paymentInfo.alipay_cn_switch) { commonDialog.alert({ title: 'ERROR', content: "Please switch AlipayCN to Alipay channel, and then close Alipay+(APS) channel", @@ -3383,6 +3383,27 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } ) } + $scope.newAlipayApsRate = function () { + $uibModal + .open({ + templateUrl: '/static/payment/partner/templates/partner_new_alipay_aps_rate.html', + controller: 'newAlipayApsRateDialogCtrl', + resolve: { + rate: function () { + return {rate_name: "AlipayAps", clean_days: 3} + }, + sys_common_rate: function () { + return $http.get('/sys/partners/sys_rates') + }, + clientMoniker: function () { + return $scope.partner.client_moniker + }, + }, + }) + .result.then(function () { + $scope.getRates() + }) + } $scope.newCardPaymentRates = function () { $uibModal .open({ @@ -3688,6 +3709,61 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } }, ]) + app.controller('newAlipayApsRateDialogCtrl', [ + '$scope', + '$http', + 'rate', + 'sys_common_rate', + 'clientMoniker', + function ($scope, $http, rate, sys_common_rate, clientMoniker) { + $scope.rate = angular.copy(rate) + $scope.sysRateConfig = angular.copy(sys_common_rate.data) + $scope.ctrl = {sending: false} + $scope.saveRate = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true + } + }) + return + } + $scope.errmsg = null + $scope.ctrl.sending = true + $http.post('/sys/partners/' + clientMoniker + '/rates', $scope.rate).then( + function () { + $scope.ctrl.sending = false + $scope.$close() + }, + function (resp) { + $scope.ctrl.sending = false + $scope.errmsg = resp.data.message + } + ) + // $scope.changeDays = function () { + // if ($scope.rate.clean_days) { + // switch ($scope.rate.clean_days) { + // case '1': { + // $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t1.Wechat) + // $scope.rate.transaction_fee = 0 + // break + // } + // case '2': { + // $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t2.Wechat) + // $scope.rate.transaction_fee = 0 + // break + // } + // case '3': { + // $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t3.Wechat) + // $scope.rate.transaction_fee = 0 + // break + // } + // } + // } + // } + } + } + ]) app.controller('newRateDialogCtrl', [ '$scope', '$http', diff --git a/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html b/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html index ab0ad5e8a..7ffca8d19 100644 --- a/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html +++ b/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html @@ -255,6 +255,9 @@
  • Alipay(Online)
  • +
  • A+(APS) +
  • -
    +
    -
    - +
    %
    -
    +
    No more than 5.0%
    @@ -61,10 +65,12 @@
    - + +
    -
    $
    From d68c51437646cf594983c99ada1ec955ecb694b3 Mon Sep 17 00:00:00 2001 From: Todking Date: Tue, 14 Sep 2021 16:57:27 +0800 Subject: [PATCH 06/50] =?UTF-8?q?add=20=E6=96=B0=E5=A2=9Eaps=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E7=9A=84=E8=B4=B9=E7=8E=87=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../merchants/core/ApsConfigService.java | 2 +- .../core/impls/ApsConfigServiceImpl.java | 2 +- .../core/impls/ClientManagerImpl.java | 66 +- .../ApsConfigDescriptor.java | 4 +- .../merchants/entity/ApsConfigData.java | 4 +- .../merchants/web/ApsConfigController.java | 10 +- .../manage/organizations/beans/OrgInfo.java | 32 + .../organizations/templates/org_detail.html | 1954 +++++++++-------- .../templates/org_detail_parent.html | 34 + .../templates/partner_bankaccounts.html | 261 +-- 10 files changed, 1276 insertions(+), 1093 deletions(-) rename src/main/java/au/com/royalpay/payment/manage/merchants/{core/descriptor => deacriptor}/ApsConfigDescriptor.java (71%) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ApsConfigService.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ApsConfigService.java index 6fa193b6d..3441146e0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ApsConfigService.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ApsConfigService.java @@ -1,6 +1,6 @@ package au.com.royalpay.payment.manage.merchants.core; -import au.com.royalpay.payment.manage.merchants.core.descriptor.ApsConfigDescriptor; +import au.com.royalpay.payment.manage.merchants.deacriptor.ApsConfigDescriptor; import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData; import com.alibaba.fastjson.JSONObject; diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ApsConfigServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ApsConfigServiceImpl.java index 6444876b4..d06b65bb6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ApsConfigServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ApsConfigServiceImpl.java @@ -2,7 +2,7 @@ package au.com.royalpay.payment.manage.merchants.core.impls; import au.com.royalpay.payment.manage.mappers.system.aps.ApsConfigMapper; import au.com.royalpay.payment.manage.merchants.core.ApsConfigService; -import au.com.royalpay.payment.manage.merchants.core.descriptor.ApsConfigDescriptor; +import au.com.royalpay.payment.manage.merchants.deacriptor.ApsConfigDescriptor; import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData; import com.alibaba.fastjson.JSONObject; import org.springframework.stereotype.Service; 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 af0999d69..7626d6460 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 @@ -62,7 +62,7 @@ import au.com.royalpay.payment.manage.merchants.core.*; import au.com.royalpay.payment.manage.merchants.core.bank.AustraliaBank; import au.com.royalpay.payment.manage.merchants.core.bank.AustraliaBankClientNullException; import au.com.royalpay.payment.manage.merchants.core.bank.AustraliaBankInfo; -import au.com.royalpay.payment.manage.merchants.core.descriptor.ApsConfigDescriptor; +import au.com.royalpay.payment.manage.merchants.deacriptor.ApsConfigDescriptor; import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData; import au.com.royalpay.payment.manage.merchants.entity.impls.*; import au.com.royalpay.payment.manage.merchants.enums.UPayAuthFileEnum; @@ -564,7 +564,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid apsConfig = apsConfigService.saveApsConfigClientId(manager.getString("manager_id"), client.getString("client_id"), new ApsConfigDescriptor()); } client.put("aps_config_id", apsConfig.getId()); - client.put("enable_alipayaps", apsConfig.getEnableAlipayAps()); client.put("alipay_cn_switch", apsConfig.getAlipayCnSwitch()); return client; } @@ -1594,17 +1593,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new NotFoundException("Client Not Exists"); } - if (channelApi.channel().equalsIgnoreCase("alipayaps")) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("enableAlipayAps", allow); - apsConfigService.updateApsConfigClientId(manager.getString("manager_id"), client.getString("client_id"), jsonObject); - } else { - merchantChannelPermissionManager.switchMerchantChannelPermission(channelApi.getMetadata().payChannel(), client.getIntValue("client_id"), allow); - try { - clientModifySupport.processModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow)); - } catch (Exception e) { - logger.error("Failed to change channel switch:{}", channel); - } + merchantChannelPermissionManager.switchMerchantChannelPermission(channelApi.getMetadata().payChannel(), client.getIntValue("client_id"), allow); + try { + clientModifySupport.processModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow)); + } catch (Exception e) { + logger.error("Failed to change channel switch:{}", channel); } logger.info("{}({}) switched client {} channel {} to {}", manager.getString("display_name"), manager.getString("manager_id"), clientMoniker, channel, allow); if (allow && (StringUtils.equalsAnyIgnoreCase("Wechat", channel) || StringUtils.equalsAnyIgnoreCase("Alipay", channel))) { @@ -2085,8 +2078,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (newConfig.getBigDecimal("cb_bankpay_rate_value") != null) { clientRateMapper.saveRate(newConfig); } - } else if("AlipayAps".equalsIgnoreCase(channel)){ - newConfig.put("transaction_fee",newConfig.getFloatValue("service_fee_value")); + } else if ("AlipayAps".equalsIgnoreCase(channel)) { + newConfig.put("transaction_fee", newConfig.getFloatValue("service_fee_value")); clientRateMapper.saveRate(newConfig); } else { clientRateMapper.saveRate(newConfig); @@ -7091,6 +7084,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid /** * alipayplus(aps) 注册商户 + * * @param clientMoniker * @param apsMerchantApplication * @param manager @@ -7098,40 +7092,40 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid */ @Override public MerchantApplicationResult alipayPlusRegisterMerchant(String clientMoniker, ApsMerchantApplication apsMerchantApplication, JSONObject manager) { - logger.info("====>getWebsiteType:"+apsMerchantApplication.getWebsiteType()); - logger.info("====>getProductCodes:"+apsMerchantApplication.getProductCodes().toString()); - boolean offline = apsMerchantApplication.getProductCodes().stream().allMatch(s->s.equalsIgnoreCase(ProductCodeType.IN_STORE_PAYMENT.toString())); - logger.info("====>offline:"+offline); - if(offline){ + logger.info("====>getWebsiteType:" + apsMerchantApplication.getWebsiteType()); + logger.info("====>getProductCodes:" + apsMerchantApplication.getProductCodes().toString()); + boolean offline = apsMerchantApplication.getProductCodes().stream().allMatch(s -> s.equalsIgnoreCase(ProductCodeType.IN_STORE_PAYMENT.toString())); + logger.info("====>offline:" + offline); + if (offline) { //todo 测试需要 先都改成线上,上线此处需要改成线下 - apsMerchantApplication.setPid( AlipayEnvironment.getEnv().getAlipayPlusApsRetailConfig().getPid()); - }else{ - apsMerchantApplication.setPid( AlipayEnvironment.getEnv().getAlipayPlusApsOnlineConfig().getPid()); - } + apsMerchantApplication.setPid(AlipayEnvironment.getEnv().getAlipayPlusApsRetailConfig().getPid()); + } else { + apsMerchantApplication.setPid(AlipayEnvironment.getEnv().getAlipayPlusApsOnlineConfig().getPid()); + } apsMerchantApplication.setRegion("AU"); - JSONObject client= sysClientMapper.findClientByMoniker(clientMoniker); + JSONObject client = sysClientMapper.findClientByMoniker(clientMoniker); AlipayApsMerchantRegister alipayApsMerchantRegister = Optional.ofNullable(merchantChannelApplicationManager.getRegister(AlipayApsMerchantRegister.class)).orElseThrow(() -> new ServerErrorException("No AlipayAps registry found")); - MerchantApplicationResult result=alipayApsMerchantRegister.apply(client,apsMerchantApplication,manager); + MerchantApplicationResult result = alipayApsMerchantRegister.apply(client, apsMerchantApplication, manager); return result; } @Override - public String queryAlipayPlusOnlineStatus(boolean isRetail,String clientMoniker, JSONObject manager) { - JSONObject client= sysClientMapper.findClientByMoniker(clientMoniker); - client.put("isRetail",isRetail); - String pid=""; - if(isRetail){ + public String queryAlipayPlusOnlineStatus(boolean isRetail, String clientMoniker, JSONObject manager) { + JSONObject client = sysClientMapper.findClientByMoniker(clientMoniker); + client.put("isRetail", isRetail); + String pid = ""; + if (isRetail) { //todo 测试需要 先都改成线上,上线此处需要改成线下 - pid= AlipayEnvironment.getEnv().getAlipayPlusApsRetailConfig().getPid(); - }else{ - pid= AlipayEnvironment.getEnv().getAlipayPlusApsOnlineConfig().getPid(); + pid = AlipayEnvironment.getEnv().getAlipayPlusApsRetailConfig().getPid(); + } else { + pid = AlipayEnvironment.getEnv().getAlipayPlusApsOnlineConfig().getPid(); } - client.put("pid",pid); + client.put("pid", pid); AlipayApsMerchantRegister alipayApsMerchantRegister = Optional.ofNullable(merchantChannelApplicationManager.getRegister(AlipayApsMerchantRegister.class)).orElseThrow(() -> new ServerErrorException("No AlipayAps registry found")); - AlipayPlusRegisterResult alipayPlusRegisterResult= alipayApsMerchantRegister.findMerchant(client); + AlipayPlusRegisterResult alipayPlusRegisterResult = alipayApsMerchantRegister.findMerchant(client); return alipayPlusRegisterResult.getRawResponse(); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/descriptor/ApsConfigDescriptor.java b/src/main/java/au/com/royalpay/payment/manage/merchants/deacriptor/ApsConfigDescriptor.java similarity index 71% rename from src/main/java/au/com/royalpay/payment/manage/merchants/core/descriptor/ApsConfigDescriptor.java rename to src/main/java/au/com/royalpay/payment/manage/merchants/deacriptor/ApsConfigDescriptor.java index 9274fc04c..cd63687e2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/descriptor/ApsConfigDescriptor.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/deacriptor/ApsConfigDescriptor.java @@ -1,4 +1,4 @@ -package au.com.royalpay.payment.manage.merchants.core.descriptor; +package au.com.royalpay.payment.manage.merchants.deacriptor; import lombok.AllArgsConstructor; import lombok.Data; @@ -11,7 +11,5 @@ import lombok.experimental.Accessors; @Accessors(chain = true) public class ApsConfigDescriptor { - private Boolean enableAlipayAps = false; - private Boolean alipayCnSwitch = false; } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ApsConfigData.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ApsConfigData.java index 5a945f842..aca1c3bf3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ApsConfigData.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ApsConfigData.java @@ -1,8 +1,7 @@ package au.com.royalpay.payment.manage.merchants.entity; -import au.com.royalpay.payment.manage.merchants.core.descriptor.ApsConfigDescriptor; -import com.alibaba.fastjson.JSONObject; +import au.com.royalpay.payment.manage.merchants.deacriptor.ApsConfigDescriptor; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -39,7 +38,6 @@ public class ApsConfigData implements Serializable { .setClientId(clientId) .setId(UUID.randomUUID().toString().replace("-", "")) .setAlipayCnSwitch(apsConfigDescriptor.getAlipayCnSwitch()) - .setEnableAlipayAps(apsConfigDescriptor.getEnableAlipayAps()) .setCreator(managerId) .setCreateTime(new Date()); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/ApsConfigController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/ApsConfigController.java index 5b64f54bc..a67e25f67 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/ApsConfigController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/ApsConfigController.java @@ -1,7 +1,7 @@ package au.com.royalpay.payment.manage.merchants.web; import au.com.royalpay.payment.manage.merchants.core.ApsConfigService; -import au.com.royalpay.payment.manage.merchants.core.descriptor.ApsConfigDescriptor; +import au.com.royalpay.payment.manage.merchants.deacriptor.ApsConfigDescriptor; import au.com.royalpay.payment.manage.merchants.entity.ApsConfigData; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.tools.CommonConsts; @@ -36,7 +36,7 @@ public class ApsConfigController { * @param apsConfigDescriptor * @return */ - @ManagerMapping(value = "/{clientId}", method = RequestMethod.POST, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER }) + @ManagerMapping(value = "/{clientId}", method = RequestMethod.POST, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.SITE_MANAGER}) public ApsConfigData saveApsConfigClientId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable("clientId") String clientId, @RequestBody ApsConfigDescriptor apsConfigDescriptor) { return apsConfigService.saveApsConfigClientId(manager.getString("managerId"), clientId, apsConfigDescriptor); } @@ -48,8 +48,8 @@ public class ApsConfigController { * @param apsConfig * @return */ - @ManagerMapping(value = "/{clientId}", method = RequestMethod.PUT, role = { ManagerRole.ADMIN,ManagerRole.OPERATOR,ManagerRole.SITE_MANAGER }) - public ApsConfigData updateApsConfigClientId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,@PathVariable("clientId") String clientId, @RequestBody JSONObject apsConfig) { - return apsConfigService.updateApsConfigClientId(manager.getString("managerId"),clientId, apsConfig); + @ManagerMapping(value = "/{clientId}", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.SITE_MANAGER}) + public ApsConfigData updateApsConfigClientId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable("clientId") String clientId, @RequestBody JSONObject apsConfig) { + return apsConfigService.updateApsConfigClientId(manager.getString("managerId"), clientId, apsConfig); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/organizations/beans/OrgInfo.java b/src/main/java/au/com/royalpay/payment/manage/organizations/beans/OrgInfo.java index 6664a2dda..17c02586c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/organizations/beans/OrgInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/organizations/beans/OrgInfo.java @@ -57,6 +57,11 @@ public class OrgInfo { private Double min_rpaypmt_dd_rate; private String state; private String senior_parent_org_id; + private Double interchange_fee_value; + private Double min_interchange_fee_value; + private Double service_fee_value; + private Double min_service_fee_value; + public JSONObject toJsonParam() { @@ -417,4 +422,31 @@ public class OrgInfo { this.min_rpaypmt_overseas_card_rate = min_rpaypmt_overseas_card_rate; } + public Double getInterchange_fee_value(){ return interchange_fee_value; } + + public void setInterchange_fee_value(Double interchange_fee_value){ this.interchange_fee_value = interchange_fee_value; } + + public Double getMin_interchange_fee_value() { + return min_interchange_fee_value; + } + + public void setMin_interchange_fee_value(Double min_interchange_fee_value) { + this.min_interchange_fee_value = min_interchange_fee_value; + } + + public Double getService_fee_value() { + return service_fee_value; + } + + public void setService_fee_value(Double service_fee_value) { + this.service_fee_value = service_fee_value; + } + + public Double getMin_service_fee_value() { + return min_service_fee_value; + } + + public void setMin_service_fee_value(Double min_service_fee_value) { + this.min_service_fee_value = min_service_fee_value; + } } diff --git a/src/main/ui/static/config/organizations/templates/org_detail.html b/src/main/ui/static/config/organizations/templates/org_detail.html index 269bd4953..ffffa5ad3 100644 --- a/src/main/ui/static/config/organizations/templates/org_detail.html +++ b/src/main/ui/static/config/organizations/templates/org_detail.html @@ -1,951 +1,1077 @@
    -

    - +

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

    - - - -

    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    - - % -
    -
    -
    -
    -
    -
    - -
    - - % -
    -
    -
    -
    -
    - -
    - - % -
    -
    +
    +
    + + + +
    +
    + +
    + +
    +
    +
    + +
    +

    + + + +

    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + + + + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + + % +
    +
    +
    +
    +
    +
    + +
    + + % +
    +
    +
    +
    +
    + +
    + + % +
    +
    -
    - -
    - - % -
    -
    +
    + +
    + + % +
    +
    -
    - -
    - - % -
    -
    + +
    + +
    +
    + +
    + + % +
    +
    +
    + +
    + + % +
    +
    +
    + +
    + + % +
    +
    -
    - -
    - - % -
    -
    +
    + +
    + + % +
    +
    + -
    - -
    - - % -
    -
    -
    - -
    - - % -
    -
    - - - -
    - -
    - - % -
    -
    - - -
    - -
    - - % -
    -
    +
    +
    + +
    + + % +
    +
    + -
    - -
    - - % -
    -
    -
    + +
    + +
    + + % +
    +
    -
    -
    - -
    - - % -
    -
    -
    - -
    - - % -
    -
    + +
    + +
    + + % +
    +
    -
    - -
    - - % -
    -
    +
    + +
    + + % +
    +
    +
    -
    - -
    - - % -
    -
    +
    +
    + +
    + + % +
    +
    +
    + +
    + + % +
    +
    -
    - -
    - - % -
    -
    -
    - -
    - - % -
    -
    - +
    + - -
    - -
    - - % -
    -
    + +
    + +
    + + % +
    +
    - -
    - -
    - - % -
    -
    + +
    + +
    + + % +
    +
    -
    - -
    - - % -
    -
    -
    -
    +
    + +
    + + % +
    +
    +
    +
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - - Back -
    - - -
    -
    -
    - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    UsernameDisplay NameWechatCreate TimeEmailRolesOperation
    - {{manager.nickname}} - - - - - - - - - - - - - Modify - | - Disable -
    -
    - -
    -
    -
    -
    - - -
    -
    - -
    -

    - {{org.gateway_short_id||'初始化'}} - -

    -
    -
    -
    - -
    - View -
    -
    -
    - - -
    -
    -
    - -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    -
    - 禁用 -   超期提醒   -   等待合规   -   绿色通道   -   通过   -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Partner CodePartner NameSub Mch IDRegister TimeCompliance StatusOrganizationBDOperation
    - - - - (已禁用) - - - - - 通过({{partner.approve_time}}) - 资料完善中 - (自助开通)资料完善中 - 自助开通试用中({{partner.approve_time}}~{{partner.expiry_time}}) - 不通过({{partner.approve_time}}) - 申请打回({{partner.refuse_remark|limitTo:15}}) - 等待合规 - 自助开通(等待合规) - 合同制作完成 - 等待BD上传材料审核 - 绿色通道申请中 - 等待合规 - - - Detail - -
    -
    - -
    -
    - -
    -
    -
    -
    商户新增趋势
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    交易额趋势
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    - -
    - ~ -
    - -
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + +
    + ~ +
    + +
    -
    - Today -
    -
    - Yesterday -
    - - - -
    - This Year -
    - +
    + Today +
    +
    + Yesterday +
    + + + +
    + This Year +
    + +
    +
    +
    +
    +
    +
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    交易分布
    -
    -
    -
    -

    组织总交易额

    -
    - - - - - - - - - - - - - -
    OrganizationAmount ($)
    - -
    +
    +
    +
    + +
    交易分布
    +
    +
    +
    +

    组织总交易额

    +
    + + + + + + + + + + + + + +
    OrganizationAmount ($)
    + +
    +
    +
    +

    {{chooseOrg}} 合伙人商户交易量排名

    +
    + + + + + + + + + + + + + + + + + + + + + +
    RankingPartnerAUD AmountRankingPartnerAmount
    + + {{sale[0].client_moniker}} + + + + {{sale[1].client_moniker}} + +
    + +
    +
    +
    +
    + +
    +
    -
    -

    {{chooseOrg}} 合伙人商户交易量排名

    -
    - - - - - - - - - - - - - - - - - - - - - -
    RankingPartnerAUD AmountRankingPartnerAmount
    - - {{sale[0].client_moniker}} - - - - {{sale[1].client_moniker}} - -
    - -
    + + +
    +
    合伙人提成
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    名称时间交易金额商户总手续费Royalpay手续费合伙人提成提成分润支付渠道
    {{clientExtracts.year | limitTo:10}} - {{clientExtracts.month | limitTo:10}} + + + + + {{clientExtracts.channel}} +
    +
    +
    -
    -
    - -
    -
    -
    - - -
    -
    合伙人提成
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    名称时间交易金额商户总手续费Royalpay手续费合伙人提成提成分润支付渠道
    {{clientExtracts.year|limitTo:10}} - {{clientExtracts.month|limitTo:10}} - - - - {{clientExtracts.channel}} -
    -
    - -
    -
    - -
    -
    - -
    - -

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

    +
    +
    +
    + + +
    + +
    -
    diff --git a/src/main/ui/static/config/organizations/templates/org_detail_parent.html b/src/main/ui/static/config/organizations/templates/org_detail_parent.html index 2da1eb371..f56b0ca33 100644 --- a/src/main/ui/static/config/organizations/templates/org_detail_parent.html +++ b/src/main/ui/static/config/organizations/templates/org_detail_parent.html @@ -121,6 +121,40 @@
    + +
    + +
    +
    + +
    + + % +
    +
    +
    + +
    + + % +
    +
    +
    + +
    + + % +
    +
    +
    + +
    + + % +
    +
    + +
    diff --git a/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html b/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html index 7ffca8d19..674177b2b 100644 --- a/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html +++ b/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html @@ -8,7 +8,7 @@

    Bank Account + ng-if="!bankCtrl.edit && (('11'|withRole)||((!partner.approve_result||partner.approve_result>4) && ('111'|withRole)))">

    @@ -17,16 +17,16 @@
    -

    {{surcharge.balance|currency:'AUD'}}

    +

    {{surcharge.balance | currency:'AUD'}}

    + switch-change="allowSurchargeCredit(partner.allow_surcharge_credit)">
    @@ -35,11 +35,11 @@

    balance + ng-click="switchSurchargeMode()"> distributed + ng-click="switchSurchargeMode()">

    启用到收支分离(distributed)模式,将使消费者支付手续费模式失效
    @@ -52,41 +52,41 @@

    + switch-change="taxInSurcharge(partner.tax_in_surcharge)">
    + switch-change="customerTaxFree(partner.customer_tax_free)">
    + switch-change="skipClearing(partner.skip_clearing)">
    + switch-change="switchPreSettle(partner.enable_presettle)">

    - AU${{partner.min_settle||'Not Configure'}} + AU${{partner.min_settle || 'Not Configure'}}

    AU$
    + min="0">
    + ng-if="$root.complianceCheck.bankAccount"> + required ng-readonly="!bankCtrl.edit">
    + ng-if="$root.complianceCheck.bankAccount"> + ng-readonly="!bankCtrl.edit">
    + ng-if="$root.complianceCheck.bankAccount"> + ng-readonly="!bankCtrl.edit">
    + ng-if="$root.complianceCheck.bankAccount"> + ng-readonly="!bankCtrl.edit">
    + ng-if="$root.complianceCheck.bankAccount"> + ng-readonly="!bankCtrl.edit">
    + ng-if="$root.complianceCheck.bankAccount"> + ng-readonly="!bankCtrl.edit">
    + ng-if="$root.complianceCheck.bankAccount"> + ng-readonly="!bankCtrl.edit">
    + ng-if="$root.complianceCheck.bankAccount"> + ng-readonly="!bankCtrl.edit">
    + ng-if="$root.complianceCheck.bankAccount"> + required ng-readonly="!bankCtrl.edit">
    + ng-if="$root.complianceCheck.bankAccount"> + id="account_name_input" required ng-readonly="!bankCtrl.edit">
    @@ -237,9 +237,9 @@

    Rates - + ng-if="partner.rate_editable && (('11'|withRole)||((!partner.approve_result||partner.approve_result>4) && ('111'|withRole)))" + ng-click="newRate()"> +

    @@ -247,16 +247,16 @@ @@ -364,58 +364,59 @@

    AlipayPlus Rates - + ng-if="partner.rate_editable && (('11'|withRole)||((!partner.approve_result||partner.approve_result>4||(partner.approve_result==4&&partner.open_status==3)) && ('111'|withRole)))" + ng-click="newAlipayPlusRate()"> +

    - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + - + +
    Rate NameRate ValueTransaction FeeActive TimeExpire TimeClean DaysUpdate TimeOperatorRemarkOperation
    Rate NameRate ValueTransaction FeeActive TimeExpire TimeClean DaysUpdate TimeOperatorRemarkOperation
    T+{{rate.clean_days}} - - + T+{{rate.clean_days}} + + (Promotional Offer) + ng-href="/sys/partners/{{partner.client_moniker}}/export/aggregate/card_promotion_agree_pdf?rateid={{rate.client_rate_id}}"> -
    From 5e4ce5d1ef390fe7dead1f35aac6fbd47fd3117d Mon Sep 17 00:00:00 2001 From: Todking Date: Tue, 14 Sep 2021 18:44:22 +0800 Subject: [PATCH 07/50] =?UTF-8?q?add=20=E6=96=B0=E5=A2=9Eaps=E5=95=86?= =?UTF-8?q?=E6=88=B7=E8=B4=B9=E7=8E=87=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/payment/partner/partner-manage.js | 90 +++++++++---------- .../partner_new_alipay_aps_rate.html | 23 ----- 2 files changed, 45 insertions(+), 68 deletions(-) diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 16dc34ae9..820f6b441 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -3740,27 +3740,27 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.errmsg = resp.data.message } ) - // $scope.changeDays = function () { - // if ($scope.rate.clean_days) { - // switch ($scope.rate.clean_days) { - // case '1': { - // $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t1.Wechat) - // $scope.rate.transaction_fee = 0 - // break - // } - // case '2': { - // $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t2.Wechat) - // $scope.rate.transaction_fee = 0 - // break - // } - // case '3': { - // $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t3.Wechat) - // $scope.rate.transaction_fee = 0 - // break - // } - // } - // } - // } + } + $scope.changeDays = function () { + if ($scope.rate.clean_days) { + switch ($scope.rate.clean_days) { + case '1': { + $scope.rate.interchange_fee_value = parseFloat($scope.sysRateConfig.t1.InterchangeFee) + $scope.rate.service_fee_value = parseFloat($scope.sysRateConfig.t1.ServiceFee) + break + } + case '2': { + $scope.rate.interchange_fee_value = parseFloat($scope.sysRateConfig.t2.InterchangeFee) + $scope.rate.service_fee_value = parseFloat($scope.sysRateConfig.t2.ServiceFee) + break + } + case '3': { + $scope.rate.interchange_fee_value = parseFloat($scope.sysRateConfig.t3.InterchangeFee) + $scope.rate.service_fee_value = parseFloat($scope.sysRateConfig.t3.ServiceFee) + break + } + } + } } } ]) @@ -6554,7 +6554,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }, function (resp) { - commonDialog.alert({ title: 'Error', content: '查询失败:' + resp.data.message, type: 'error' }) + commonDialog.alert({title: 'Error', content: '查询失败:' + resp.data.message, type: 'error'}) } ) }; @@ -6568,7 +6568,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }, function (resp) { - commonDialog.alert({ title: 'Error', content: '查询失败:' + resp.data.message, type: 'error' }) + commonDialog.alert({title: 'Error', content: '查询失败:' + resp.data.message, type: 'error'}) } ) }; @@ -7361,11 +7361,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter '$filter', 'commonDialog', 'online', - function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, commonDialog,online) { + function ($scope, $http, $uibModal, $state, subMerchantInfo, $filter, commonDialog, online) { $scope.subMerchantInfo = angular.copy(subMerchantInfo) - $scope.subMerchantInfo.online=online; + $scope.subMerchantInfo.online = online; $scope.subMerchantInfo.merchantDisplayName = $scope.subMerchantInfo.short_name; - $scope.subMerchantInfo.registrationAddress= $scope.subMerchantInfo.address; + $scope.subMerchantInfo.registrationAddress = $scope.subMerchantInfo.address; // if ($scope.subMerchantInfo.client_pay_type) { // if ($scope.subMerchantInfo.client_pay_type.indexOf('1') >= 0 && $scope.subMerchantInfo.client_pay_type.indexOf('2') >= 0) { @@ -7380,24 +7380,24 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter // $scope.subMerchantInfo.payment_type_online = true; // $scope.subMerchantInfo.business_type_offline = true; // } - if($scope.subMerchantInfo.online) { + if ($scope.subMerchantInfo.online) { $scope.title = "AlipayPlus-aps(Online)Registration"; - }else{ + } else { $scope.title = "AlipayPlus-aps(Retail)Registration"; } $scope.subMerchantInfo.websiteType = 'WEB'; - $scope.subMerchantInfo.website= $scope.subMerchantInfo.company_website; + $scope.subMerchantInfo.website = $scope.subMerchantInfo.company_website; $scope.subMerchantInfo.legalName = $scope.subMerchantInfo.company_name; - $scope.subMerchantInfo.registrationType='OTHER_IDENTIFICATION_NO' + $scope.subMerchantInfo.registrationType = 'OTHER_IDENTIFICATION_NO' if ($scope.subMerchantInfo.business_structure) { $scope.subMerchantInfo.businessType = $scope.subMerchantInfo.business_structure != 'Registered body(Sole Trader)' ? 'ENTERPRISE' : 'INDIVIDUAL' } - $scope.subMerchantInfo.shareholderName= $scope.subMerchantInfo.representativeInfo.representative_person; - $scope.subMerchantInfo.representativeName= $scope.subMerchantInfo.representativeInfo.representative_person; - $scope.subMerchantInfo.storeAddress= $scope.subMerchantInfo.address; - $scope.subMerchantInfo.registrationNo= $scope. subMerchantInfo.acn ? $scope.subMerchantInfo.acn : $scope.subMerchantInfo.abn; - $scope.subMerchantInfo.storeMCC=$scope.subMerchantInfo.alipayindustry; - $scope.subMerchantInfo.storeName=$scope.subMerchantInfo.store_name; + $scope.subMerchantInfo.shareholderName = $scope.subMerchantInfo.representativeInfo.representative_person; + $scope.subMerchantInfo.representativeName = $scope.subMerchantInfo.representativeInfo.representative_person; + $scope.subMerchantInfo.storeAddress = $scope.subMerchantInfo.address; + $scope.subMerchantInfo.registrationNo = $scope.subMerchantInfo.acn ? $scope.subMerchantInfo.acn : $scope.subMerchantInfo.abn; + $scope.subMerchantInfo.storeMCC = $scope.subMerchantInfo.alipayindustry; + $scope.subMerchantInfo.storeName = $scope.subMerchantInfo.store_name; $scope.alipayMccCategory = {} $scope.loadAlipayCategory = function () { @@ -7442,22 +7442,22 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter storeAddress: $scope.subMerchantInfo.storeAddress, registrationAddress: $scope.subMerchantInfo.registrationAddress, } - params.productCodes=[]; - if($scope.subMerchantInfo.online){ + params.productCodes = []; + if ($scope.subMerchantInfo.online) { params.productCodes.push('CASHIER_PAYMENT'); - }else{ + } else { params.productCodes.push('IN_STORE_PAYMENT'); } - params.websites=[] - if($scope.subMerchantInfo.online){ + params.websites = [] + if ($scope.subMerchantInfo.online) { params.websites.push($scope.subMerchantInfo.website); } $http.post('/sys/partners/' + $scope.subMerchantInfo.client_moniker + '/apply_alipayplus', params).then( function (resp) { - if(resp.data.success) { - commonDialog.alert({ title: 'Success', content: "注册成功!", type: 'success' }) - }else{ + if (resp.data.success) { + commonDialog.alert({title: 'Success', content: "注册成功!", type: 'success'}) + } else { commonDialog.alert({title: 'Error', content: "注册失败!", type: 'error'}) } @@ -7465,7 +7465,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }, function (resp) { $scope.flag = false - commonDialog.alert({ title: 'Error', content: resp.data.message, type: 'error' }) + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) } ) diff --git a/src/main/ui/static/payment/partner/templates/partner_new_alipay_aps_rate.html b/src/main/ui/static/payment/partner/templates/partner_new_alipay_aps_rate.html index f8526d2cf..7842aaecd 100644 --- a/src/main/ui/static/payment/partner/templates/partner_new_alipay_aps_rate.html +++ b/src/main/ui/static/payment/partner/templates/partner_new_alipay_aps_rate.html @@ -69,29 +69,6 @@
    - - - - - - - - - - - - - - - - - - - - - - -
    From e1ba3b4eaa3377304a4ce6833c8be0973519e634 Mon Sep 17 00:00:00 2001 From: Todking Date: Wed, 15 Sep 2021 16:54:25 +0800 Subject: [PATCH 08/50] =?UTF-8?q?add=20aps=E9=9D=99=E6=80=81=E7=A0=81css?= =?UTF-8?q?=EF=BC=8Cjs=EF=BC=8Cimage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/ui/static/images/APS.png | Bin 0 -> 55782 bytes .../static/templates/alipayaps/v1/payment.js | 444 ++++++++++++++++ .../static/templates/alipayaps/v4/payment.js | 488 ++++++++++++++++++ .../static/templates/alipayaps/v5/payment.js | 452 ++++++++++++++++ 4 files changed, 1384 insertions(+) create mode 100644 src/main/ui/static/images/APS.png create mode 100644 src/main/ui/static/templates/alipayaps/v1/payment.js create mode 100644 src/main/ui/static/templates/alipayaps/v4/payment.js create mode 100644 src/main/ui/static/templates/alipayaps/v5/payment.js diff --git a/src/main/ui/static/images/APS.png b/src/main/ui/static/images/APS.png new file mode 100644 index 0000000000000000000000000000000000000000..8317f251ea864bd042e9bd60c7f1e95fe179174a GIT binary patch literal 55782 zcmZ^~1$0}@k}YgzW@cvQ$P6+wGsH17+c7gU#~d?r%(l#qIp&y|nc?|<^WOY3bLZDu zt<#c@meh52Rqb8XCsJ8a8X18A0SpWb87L#63I+zD{W*_8gZX^E972o-14FX05*Jqn zii?veJ3D-}vb6vMlZi~#g4I?V#rdJ93j78RRUEROs0c<+-UK!qZA?iO7=mFYrd*#c z3BAZts6C^BKG*_bI$XmP)y0aVp5ms0OUU3L2J!2haYJx}_u-x2WnXx2a(5jvU;*}r zx^93qq%s|S618L)hxAu-4j^#=(xD?CBrAy#iv=we2!amsp=Z2<5KLvg_7`3IJO77~ zq!wAq4Y-Jucn)*I4I()J1*|)bH5D6NME$s$1_zkxNdxlcz#{`OrtoQnwlX@kAdsH7 z0)g8izW87qvBSxG5cyuH$C-n#`Xfb8_@=y(B23^SXd8ywPOf9V84|2fU{VJ6g5~5jlNC zw8lxJ3kY35V#{8XHZr=69*s~;$cPSANpsaUC00rGMeM}IoTx?DKaTd~q4M@lBr$JH z^QH$KzTNt}e4|845(+!E>4~Y6E)ggTtz+ya*=(L?Ku#j34V*BO0*K$k4FZY*&C8-l z87C7ZsmjmB5%wUTObI1T?Q;k&7%@sD%8!F{w{MXrKUyN4=RIS&lnHg=K_*v&LH3p0eL4g(&oCn=tL;F{jer(DvY_QJyI0n@8TeaoU)7Z->OML`G0Dogmln+BOZR zQ3+AQesmS26~*c4VDF=@`HydQloqrUwW%nNp~=Dxz7MBn#bvDrGmYu`8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cORtVSGC>19m;RVzFu2vJmHu2dnV$`myht216e&aIXl(Wr8`hAT#>kTy^fz zY7xkUKiwwpeOzx)V` zm)ow7;O)ROD>rI0dYdjvINGPv^9`dfPN+um?QC^F3B@=yvO6Je$b~9P9FKa;LJ|5U zukhMkC1_2kU-;Sn)Qm@0O^!d-W(OhNSZsY{kVFAE6ytW5X1DriqQ{IC1yZn#znimr z8p5X>^|-^6aG^wW=>WN$#~|EKiqA0y1!9sjz{15yPaetIZMaCqb1{LFwuybbL(;Ga zfMi{+H%CMLS2l5Y$u!Zs(HkHue+u;6JWxFnF|S^%@Sg-_0j5LjHsqP^?z$g5DqS-w zv=ctI08aVYiap@EZD7zV)k4bP(|pF>q?>CKt61F)W+VqzAbs~?^zma8sIGwbo0$h1 zueE&qeVchjME#q7%OTkfz+|Q|u>t=|i_bTgDz)r=vUXCI$LZ0Pl*fnHN$T1yj^p0p~;CHvf6U^0NjEBu=~B@Z#}(qeSRa+jnmfd=z)rH zt)$2or9JiQgZ-k$Y@PST-(VCb2@OUn&JADYrmY4j8+1Qx8s1!*3gC7V>7Y~k*uW|w zn|=egd4%N1ABF87a4WD07)ieFE@i{_75~b29dBC#lx65}-b3d-f^Wy~9!_2w_9-B3 zob2{0C9d~VC&tNCB2C5)j(>LG-#{daT3}Dpc+p9g6jeVf*o@)EDwgAJ!jYyq_^P@3 z6rJf+lFINUqfxqCp+F2hyYS0H7UHm_mbI8t@BzeiHnJzy5FfHfoGEONYgpJ*h{CqA zrv_dz_!=e5CM!)^`+jFT-8e6g1yppbTr7RPxRz1dZxWx}{AQkv;$b literal 0 HcmV?d00001 diff --git a/src/main/ui/static/templates/alipayaps/v1/payment.js b/src/main/ui/static/templates/alipayaps/v1/payment.js new file mode 100644 index 000000000..9f846d9df --- /dev/null +++ b/src/main/ui/static/templates/alipayaps/v1/payment.js @@ -0,0 +1,444 @@ +/** + * Created by yixian on 2017-05-08 + */ +$(function () { + 'use strict'; + // document.querySelector('body').addEventListener('touchmove', function (e) { + // if (!document.querySelector('.coupons').contains(e.target)) { + // e.preventDefault(); + // } + // }) + var dataCache = {price: '0', coupons: [], coupon_groups: {}}; + var exchangeRate = parseFloat(window.exchange_rate); + + if (window.AlipayJSBridge) { + AlipayJSBridge.call('hideOptionMenu'); + } else { + document.addEventListener('AlipayJSBridgeReady', function () { + AlipayJSBridge.call('hideOptionMenu'); + }, false); + } + dataCache.paying = false; + var ctrl = {}; + + $('.ff.key').bind('touchstart', function () { + if (dataCache.paying) { + return; + } + var char = $(this).attr('data-char'); + appendChar(char); + }); + + $('.coupons .use-check').click(function () { + if ($(this).hasClass('disabled')) { + return; + } + var couponId = $(this).attr('data-coupon-id'); + var couponGroup = $(this).attr('data-coupon-group'); + if (couponGroup) { + var prevCouponId = dataCache.coupon_groups[couponGroup]; + if (prevCouponId) { + var prevIdx = dataCache.coupons.indexOf(prevCouponId); + if (prevIdx >= 0) { + dataCache.coupons.splice(prevIdx, 1); + } + if (prevCouponId != couponId) { + $('.coupons .use-check[data-coupon-id="' + prevCouponId + '"]').removeClass('checked').addClass('unchecked'); + dataCache.coupon_groups[couponGroup] = couponId; + } else { + dataCache.coupon_groups[couponGroup] = null; + } + } else { + dataCache.coupon_groups[couponGroup] = couponId; + } + + } + + if ($(this).is('.checked')) { + $(this).removeClass('checked').addClass('unchecked'); + } else { + $(this).removeClass('unchecked').addClass('checked'); + } + var checked = $(this).is('.checked'); + if (checked) { + dataCache.coupons.push(couponId); + updatePrice(); + } else { + var idx = dataCache.coupons.indexOf(couponId); + dataCache.coupons.splice(idx, 1); + updatePrice(); + } + }); + + $('#key_B').bind('touchstart', function () { + backspace(); + }); + + function updatePoundage(price) { + if (window.extensions.indexOf('customerrate') >= 0 && window.rateValue != null) { + if (window.use_customised_rate) { + var rate = new Decimal(100).plus(window.rateValue).div(100); + var poundageValue = new Decimal(dataCache.price).mul(rate).sub(dataCache.price); + } else { + var rateRemain = new Decimal(100).sub(window.rateValue).div(100); + poundageValue = new Decimal(dataCache.price).div(rateRemain).sub(dataCache.price); + } + dataCache.poundageValue = poundageValue.toFixed(2, Decimal.ROUND_HALF_UP); + return poundageValue.plus(price).toFixed(2, Decimal.ROUND_HALF_UP); + } + return price; + } + + function updatePrice() { + $('#audVal').html(dataCache.price); + var realPrice = dataCache.price; + $('#audValReal').html(realPrice); + var surchargeData = calculateSurcharge(realPrice); + + var price = surchargeData.newPrice || realPrice; + var priceBeforeDiscount = price; + dataCache.discounts = []; + dataCache.tax = surchargeData.tax; + dataCache.surcharge = surchargeData.surcharge; + + $(window.coupons).each(function () { + price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons); + }); + dataCache.customSurcharge = new Decimal(price).sub(realPrice).toFixed(2, Decimal.ROUND_HALF_UP); + dataCache.finalPrice = new Decimal(price).toFixed(2, Decimal.ROUND_FLOOR); + var rate = 'CNY' == window.currency ? 1 : exchangeRate; + var cnyVal = Decimal.mul(price, rate).toFixed(2, Decimal.ROUND_HALF_UP); + $('#cnyVal').html(cnyVal); + dataCache.currencyPrice = 'CNY' == window.currency ? Decimal.div(priceBeforeDiscount, exchangeRate).toFixed(2, Decimal.ROUND_FLOOR) : priceBeforeDiscount; + } + + function updatePoundageStatus() { + $(window.coupons).each(function () { + var coupon = this; + var couponId = coupon.couponId(); + if (coupon.isEnable(dataCache.currencyPrice || 0)) { + $('.coupons .use-check[data-coupon-id=' + couponId + ']').removeClass('disabled'); + } else { + var dom = $('.coupons .use-check[data-coupon-id=' + couponId + ']').addClass('disabled'); + var couponGroup = dom.attr('data-coupon-group'); + if (couponGroup) { + if (dataCache.coupon_groups[couponGroup] == couponId) { + dataCache.coupon_groups[couponGroup] = null; + } + } + var idx = dataCache.coupons.indexOf(couponId); + if (idx >= 0) { + dataCache.coupons.splice(idx, 1); + } + dom.removeClass('checked').addClass('unchecked'); + } + }) + } + + updatePoundageStatus(); + + function backspace() { + dataCache.price = dataCache.price.substring(0, dataCache.price.length - 1); + if (dataCache.price.length == 0) { + dataCache.price = '0'; + } + updatePrice(); + updatePoundageStatus(); + } + + function appendChar(char) { + var pointLocation = dataCache.price.indexOf('.'); + if (pointLocation >= 0 || char == '.' || dataCache.price.length < 5) { + if (pointLocation >= 0 && char == '.') { + return; + } + if (pointLocation >= 0 && pointLocation <= dataCache.price.length - 3) { + return; + } + if (dataCache.price == '0' && char != '.') { + dataCache.price = ''; + } + dataCache.price += char; + updatePrice(); + updatePoundageStatus(); + } + } + + $('#coupon-box-toggle').click(function () { + $('.coupons-container').addClass('show'); + }); + $('.coupons-container>.coupons-mask,.coupons-container #close-coupon-box').click(function () { + $(this).parents('.coupons-container').removeClass('show'); + }); + + + $('.remark-btn').click(function () { + var cfg = { + title: '备注 Remark', + template: '', + initialize: function (dialog) { + $('').addClass('remark-input').attr('name', 'remark').val(dataCache.remark || '').appendTo($('.weui_dialog_bd', dialog)); + }, + confirm: function (dialog, chosen) { + if (chosen) { + var remark = $('textarea[name="remark"]', dialog).val(); + if (remark) { + $('#remark-box').text('备注:' + remark).show() + } else { + $('#remark-box').text('').hide(); + } + dataCache.remark = remark; + } + + } + }; + showWeuiDialog(cfg); + }); + + $('.paydetail').click(function () { + var config = { + title: 'Payment Detail', + template: '', + initialize: function (dialog) { + var bd = $('.weui_dialog_bd', dialog); + var currencySymbol = window.currency == 'AUD' ? '$' : '¥'; + $('

    ').html('Input Price 输入金额:' + currencySymbol + dataCache.price).appendTo(bd); + if (parseFloat(dataCache.customSurcharge) > 0) { + $('

    ').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.customSurcharge).appendTo(bd); + $('

    ').addClass('warning-sm').html('温馨提示:商户将向您收取本次消费手续费' + window.rateValue + '%').appendTo(bd); + } + $(dataCache.discounts).each(function () { + $('

    ').html(this.title + ':-' + currencySymbol + this.amount).appendTo(bd); + }); + $('

    ').addClass('final').html('Final 支付金额:' + currencySymbol + (dataCache.finalPrice || 0)).appendTo(bd); + } + }; + showWeuiDialog(config); + }); + + $('#key_P').click(function () { + if (window.requireRemark) { + if (!dataCache.remark) { + var config = { + title: '请先输入备注', + template: '' + }; + showWeuiDialog(config); + } + + } + }); + + $('#key_P').bind('touchstart', function () { + if (window.requireRemark) { + if (!dataCache.remark) { + return; + } + } + $('#key_P').addClass('hidden'); + $('#key_Loading').removeClass('hidden'); + if (dataCache.paying) { + return; + } + dataCache.paying = true; + var data = {price: dataCache.price + '', original_number: true, currency: window.currency}; + if (dataCache.remark) { + data.description = dataCache.remark; + } + if (window.extensions.indexOf('preauthorize') >= 0) { + data.preauthorize = true; + } + if (window.extensions.indexOf('qrcodemode') >= 0) { + data.qrmode = true; + } + if (window.extensions.indexOf('customerrate') >= 0) { + data.customerrate = true; + } + data.coupons = dataCache.coupons; + data.qrcodeVersion = window.qrcodeVersion; + + $.ajax({ + url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders', + method: 'POST', + data: JSON.stringify(data), + contentType: 'application/json', + dataType: 'json', + success: function (pay) { + if (pay.direct_paid) { + location.href = '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; + return; + } + if (pay.mweb_url){ + location.href = pay.mweb_url; + return; + } + if (window.AlipayJSBridge) { + callPayment(); + } else { + // 如果没有注入则监听注入的事件 + document.addEventListener('AlipayJSBridgeReady', callPayment, false); + } + + function callPayment() { + try { + AlipayJSBridge.call('tradePay', { + tradeNO: pay.trade_no + }, function (res) { + dataCache.paying = false; + if (res.resultCode == '9000') { + AlipayJSBridge.call('startApp', { + appId: '20000056', + param: { + actionType: 'showSuccPage', + payResult: res.result + }, + closeCurrentApp: false + }); + startCheckOrder(pay.order_id, '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); + } else if (res.resultCode == '6001') { + //do nothing + } else { + if (res.memo) { + weuiAlert(res.memo); + } + } + $('#key_P').removeClass('hidden'); + $('#key_Loading').addClass('hidden'); + }) + } catch (err) { + weuiAlert(err) + } + } + }, + error: function (jqXhr) { + weuiAlert(jqXhr.responseJSON.message); + $('#key_P').removeClass('hidden'); + $('#key_Loading').addClass('hidden'); + dataCache.paying = false; + } + }) + }); + + function startCheckOrder(orderId, url) { + function checkOrderStd() { + $.ajax({ + url: '/api/v1.0/payment/orders/' + orderId + '/status', + method: 'GET', + dataType: 'json', + success: function (res) { + if (res.paid) { + location.href = url; + } else { + setTimeout(checkOrderStd, 500); + } + } + }) + } + + checkOrderStd(); + } + + function weuiAlert(msg) { + var config = { + template: msg + }; + showWeuiDialog(config); + } + + function showWeuiDialog(config) { + if (config.templateUrl) { + $.ajax({ + url: config.templateUrl, + dataType: 'html', + success: function (template) { + buildDialog(template); + } + }); + } else { + buildDialog(config.template); + } + + + function buildDialog(template) { + var defaultConfig = {backdrop: true}; + config = $.extend({}, defaultConfig, config); + var dialog = $("
    ", {class: 'weui_dialog_confirm'}); + var mask = $('
    ', {class: 'weui_mask'}).appendTo(dialog); + if (config.backdrop) { + mask.click(function () { + dialog.remove(); + if ($.isFunction(config.dismiss)) { + config.dismiss(); + } + }) + } + var dialogBox = $("
    ", {class: 'weui_dialog'}).appendTo(dialog); + if (config.title) { + $('
    ', {class: 'weui_dialog_hd'}).append($('', {class: 'weui_dialog_title'}).html(config.title)).appendTo(dialogBox); + } + var dialogBody = $("
    ", {class: 'weui_dialog_bd'}).appendTo(dialogBox); + if (template) { + dialogBody.append(template); + } + if ($.isFunction(config.initialize)) { + config.initialize(dialog); + } + var ft = $('
    ').appendTo(dialogBox); + if(window.paypad_version !== 'v3'){ + if ($.isFunction(config.confirm)) { + var yes = $('
    ', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #108ee9;color: #fff;' + }).appendTo(ft); + yes.click(function () { + config.confirm(dialog, true); + dialog.remove(); + }); + var no = $('', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft); + no.click(function () { + config.confirm(dialog, false); + dialog.remove(); + }) + } else { + var ok = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #108ee9;color: #fff;' + }).appendTo(ft); + ok.click(function () { + dialog.remove(); + }) + } + }else{ + if ($.isFunction(config.confirm)) { + var yes = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #FF9705;color: #fff;' + }).appendTo(ft); + yes.click(function () { + config.confirm(dialog, true); + dialog.remove(); + }); + var no = $('', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft); + no.click(function () { + config.confirm(dialog, false); + dialog.remove(); + }) + } else { + var ok = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #FF9705;color: #fff;' + }).appendTo(ft); + ok.click(function () { + dialog.remove(); + }) + } + } + dialog.appendTo($('body')); + } + + } +}); diff --git a/src/main/ui/static/templates/alipayaps/v4/payment.js b/src/main/ui/static/templates/alipayaps/v4/payment.js new file mode 100644 index 000000000..43c4c0012 --- /dev/null +++ b/src/main/ui/static/templates/alipayaps/v4/payment.js @@ -0,0 +1,488 @@ +/** + * Created by yixian on 2017-05-08 + */ +var num = function(obj){ + obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符 + obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字 + obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个, 清除多余的 + obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$","."); + obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'); //只能输入两个小数 +}; + +$(function () { + 'use strict'; + // document.querySelector('body').addEventListener('touchmove', function(e) { + // if (!document.querySelector('.coupons').contains(e.target)) { + // e.preventDefault(); + // } + // }); + var dataCache = {price: '0', coupons: [], coupon_groups: {}}; + var exchangeRate = parseFloat(window.exchange_rate); + + if (window.AlipayJSBridge) { + AlipayJSBridge.call('hideOptionMenu'); + } else { + document.addEventListener('AlipayJSBridgeReady', function () { + AlipayJSBridge.call('hideOptionMenu'); + }, false); + } + dataCache.paying = false; + var ctrl = {}; + + $('.ff.key').bind('touchstart', function () { + if (dataCache.paying) { + return; + } + var char = $(this).attr('data-char'); + appendChar(char); + }); + + $('#audVal').bind('input porpertychange', function () { + if (dataCache.paying) { + return; + } + var char = $(this).val(); + if (parseFloat(char) >= 100000) { + char = char.slice(0, char.length - 1); + $(this).val(char); + return; + } + appendChar(char); + }); + + $('.coupons .use-check').click(function () { + if ($(this).hasClass('disabled')) { + return; + } + var couponId = $(this).attr('data-coupon-id'); + var couponGroup = $(this).attr('data-coupon-group'); + if (couponGroup) { + var prevCouponId = dataCache.coupon_groups[couponGroup]; + if (prevCouponId) { + var prevIdx = dataCache.coupons.indexOf(prevCouponId); + if (prevIdx >= 0) { + dataCache.coupons.splice(prevIdx, 1); + } + if (prevCouponId != couponId) { + $('.coupons .use-check[data-coupon-id="' + prevCouponId + '"]').removeClass('checked').addClass('unchecked'); + dataCache.coupon_groups[couponGroup] = couponId; + } else { + dataCache.coupon_groups[couponGroup] = null; + } + } else { + dataCache.coupon_groups[couponGroup] = couponId; + } + + } + + if ($(this).is('.checked')) { + $(this).removeClass('checked').addClass('unchecked'); + } else { + $(this).removeClass('unchecked').addClass('checked'); + } + var checked = $(this).is('.checked'); + if (checked) { + dataCache.coupons.push(couponId); + updatePrice(); + } else { + var idx = dataCache.coupons.indexOf(couponId); + dataCache.coupons.splice(idx, 1); + updatePrice(); + } + }); + $('.cb_bankpay').click(function () { + $.ajax({ + url: '/sys/partners/' + window.client_moniker + '/jump/link', + method: 'GET', + success: function (res) { + location.href = res; + }, + error: function (resp) { + var config = { + template: resp + }; + showWeuiDialog(config); + } + }) + }); + $('#key_B').bind('touchstart', function () { + backspace(); + }); + + function updatePoundage(price) { + if (window.extensions.indexOf('customerrate') >= 0 && window.rateValue != null) { + if (window.use_customised_rate) { + var rate = new Decimal(100).plus(window.rateValue).div(100); + var poundageValue = new Decimal(dataCache.price).mul(rate).sub(dataCache.price); + } else { + var rateRemain = new Decimal(100).sub(window.rateValue).div(100); + poundageValue = new Decimal(dataCache.price).div(rateRemain).sub(dataCache.price); + } + dataCache.poundageValue = poundageValue.toFixed(2, Decimal.ROUND_HALF_UP); + return poundageValue.plus(price).toFixed(2, Decimal.ROUND_HALF_UP); + } + return price; + } + + function updatePrice() { + $('#audVal').html(dataCache.price); + var realPrice = dataCache.price; + $('#audValReal').html(realPrice); + var surchargeData = calculateSurcharge(realPrice); + + var price = surchargeData.newPrice || realPrice; + var priceBeforeDiscount = price; + dataCache.discounts = []; + dataCache.tax = surchargeData.tax; + dataCache.surcharge = surchargeData.surcharge; + $(window.coupons).each(function () { + price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons); + }); + dataCache.finalPrice = new Decimal(price).toFixed(2, Decimal.ROUND_FLOOR); + var rate = 'CNY' == window.currency ? 1 : exchangeRate; + var cnyVal = Decimal.mul(price, rate).toFixed(2, Decimal.ROUND_FLOOR); + dataCache.currencyPrice = 'CNY' == window.currency ? Decimal.div(priceBeforeDiscount, exchangeRate).toFixed(2, Decimal.ROUND_FLOOR) : priceBeforeDiscount; + $('#cnyVal').html(cnyVal) + } + + function backspace() { + dataCache.price = dataCache.price.substring(0, dataCache.price.length - 1); + if (dataCache.price.length == 0) { + dataCache.price = '0'; + } + updatePrice(); + updatePoundageStatus(); + } + + function appendChar(char) { + if (char == "") { + char = '0'; + } + var check = /[^\d.]/g; + if (check.test(char)) { + return; + } + var tmpChar = (char.split('.')).length-1; + if (tmpChar > 1) { + return; + } + var pointLocation = dataCache.price.indexOf('.'); + if (char == '.' || char.length > 8) { + return; + } + if (pointLocation >= 0 && pointLocation <= char.length - 4) { + return; + } + if (dataCache.price == '0' && char != '.') { + dataCache.price = ''; + } + dataCache.price = char; + updatePrice(); + updatePoundageStatus(); + } + + function updatePoundageStatus() { + $(window.coupons).each(function () { + var coupon = this; + var couponId = coupon.couponId(); + if (coupon.isEnable(dataCache.currencyPrice || 0)) { + $('.coupons .use-check[data-coupon-id=' + couponId + ']').removeClass('disabled'); + } else { + var dom = $('.coupons .use-check[data-coupon-id=' + couponId + ']').addClass('disabled'); + var couponGroup = dom.attr('data-coupon-group'); + if (couponGroup) { + if (dataCache.coupon_groups[couponGroup] == couponId) { + dataCache.coupon_groups[couponGroup] = null; + } + } + var idx = dataCache.coupons.indexOf(couponId); + if (idx >= 0) { + dataCache.coupons.splice(idx, 1); + } + dom.removeClass('checked').addClass('unchecked'); + } + }) + } + + updatePoundageStatus(); + + $('#coupon-box-toggle').click(function () { + $('.coupons-container').addClass('show'); + }); + $('.coupons-container>.coupons-mask,.coupons-container #close-coupon-box').click(function () { + $(this).parents('.coupons-container').removeClass('show'); + }); + + + $('.remark-btn').click(function () { + var cfg = { + title: '备注 Remark', + template: '', + initialize: function (dialog) { + $('').addClass('remark-input').attr('name', 'remark').val(dataCache.remark || '').appendTo($('.weui_dialog_bd', dialog)); + }, + confirm: function (dialog, chosen) { + if (chosen) { + var remark = $('textarea[name="remark"]', dialog).val(); + if (remark) { + $('#remark-box').text('备注:' + remark).show() + } else { + $('#remark-box').text('').hide(); + } + dataCache.remark = remark; + } + + } + }; + showWeuiDialog(cfg); + }); + + $('.paydetail').click(function () { + var config = { + title: 'Payment Detail', + template: '', + initialize: function (dialog) { + var bd = $('.weui_dialog_bd', dialog); + var currencySymbol = window.currency == 'CNY' ? '¥' : '$'; + $('

    ').html('Input Price 输入金额:' + currencySymbol + dataCache.price).appendTo(bd); + if (parseFloat(dataCache.surcharge) > 0) { + $('

    ').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.surcharge).appendTo(bd); + } + if (parseFloat(dataCache.tax) > 0) { + $('

    ').html('GST(10%):' + currencySymbol + dataCache.tax).appendTo(bd); + } + $(dataCache.discounts).each(function () { + $('

    ').html(this.title + ':-' + currencySymbol + this.amount).appendTo(bd); + }); + $('

    ').addClass('final').html('Final 支付金额:' + currencySymbol + (dataCache.finalPrice || 0)).appendTo(bd); + } + }; + showWeuiDialog(config); + }); + + $('#key_P').click(function () { + dataCache.remark = $('.remark-textarea-new').val(); + if (window.requireRemark) { + if (!dataCache.remark) { + var config = { + title: '请先输入备注', + template: '' + }; + showWeuiDialog(config); + } + + } + }); + + $('#key_P').bind('touchstart', function () { + dataCache.remark = $('.remark-textarea-new').val(); + if (window.requireRemark) { + if (!dataCache.remark) { + return; + } + } + $('#key_P_div').addClass('hidden'); + $('#key_Loading_div').removeClass('hidden'); + if (dataCache.paying) { + return; + } + dataCache.paying = true; + var data = {price: dataCache.price + '', currency: window.currency}; + if (dataCache.remark) { + data.description = dataCache.remark; + } + if (window.extensions.indexOf('preauthorize') >= 0) { + data.preauthorize = true; + } + if (window.extensions.indexOf('qrcodemode') >= 0) { + data.qrmode = true; + } + if (window.extensions.indexOf('customerrate') >= 0) { + data.customerrate = true; + } + data.coupons = dataCache.coupons; + data.qrcodeVersion = window.qrcodeVersion; + $.ajax({ + url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders', + method: 'POST', + data: JSON.stringify(data), + contentType: 'application/json', + dataType: 'json', + success: function (pay) { + if (pay.direct_paid) { + location.href = '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; + return; + } + if (pay.mweb_url){ + location.href = pay.mweb_url; + return; + } + if (window.AlipayJSBridge) { + callPayment(); + } else { + // 如果没有注入则监听注入的事件 + document.addEventListener('AlipayJSBridgeReady', callPayment, false); + } + + function callPayment() { + try { + AlipayJSBridge.call('tradePay', { + tradeNO: pay.trade_no + }, function (res) { + dataCache.paying = false; + if (res.resultCode == '9000') { + AlipayJSBridge.call('startApp', { + appId: '20000056', + param: { + actionType: 'showSuccPage', + payResult: res.result + }, + closeCurrentApp: false + }); + startCheckOrder(pay.order_id, '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); + } else if (res.resultCode == '6001') { + //do nothing + } else { + if (res.memo) { + weuiAlert(res.memo); + } + } + $('#key_P_div').removeClass('hidden'); + $('#key_Loading_div').addClass('hidden'); + }) + } catch (err) { + weuiAlert(err) + } + } + }, + error: function (jqXhr) { + weuiAlert(jqXhr.responseJSON.message); + $('#key_P_div').removeClass('hidden'); + $('#key_Loading_div').addClass('hidden'); + dataCache.paying = false; + } + }) + }); + + function startCheckOrder(orderId, url) { + function checkOrderStd() { + $.ajax({ + url: '/api/v1.0/payment/orders/' + orderId + '/status', + method: 'GET', + dataType: 'json', + success: function (res) { + if (res.paid) { + location.href = url; + } else { + setTimeout(checkOrderStd, 500); + } + } + }) + } + + checkOrderStd(); + } + + function weuiAlert(msg) { + var config = { + template: msg + }; + showWeuiDialog(config); + } + + function showWeuiDialog(config) { + if (config.templateUrl) { + $.ajax({ + url: config.templateUrl, + dataType: 'html', + success: function (template) { + buildDialog(template); + } + }); + } else { + buildDialog(config.template); + } + + function buildDialog(template) { + var defaultConfig = {backdrop: true}; + config = $.extend({}, defaultConfig, config); + var dialog = $("
    ", {class: 'weui_dialog_confirm'}); + var mask = $('
    ', {class: 'weui_mask'}).appendTo(dialog); + if (config.backdrop) { + mask.click(function () { + dialog.remove(); + if ($.isFunction(config.dismiss)) { + config.dismiss(); + } + }) + } + var dialogBox = $("
    ", {class: 'weui_dialog'}).appendTo(dialog); + if (config.title) { + $('
    ', {class: 'weui_dialog_hd'}).append($('', {class: 'weui_dialog_title'}).html(config.title)).appendTo(dialogBox); + } + var dialogBody = $("
    ", {class: 'weui_dialog_bd'}).appendTo(dialogBox); + if (template) { + dialogBody.append(template); + } + if ($.isFunction(config.initialize)) { + config.initialize(dialog); + } + var ft = $('
    ').appendTo(dialogBox); + if(window.paypad_version !== 'v3'){ + if ($.isFunction(config.confirm)) { + var yes = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #0bb20c;color: #fff;' + }).appendTo(ft); + yes.click(function () { + config.confirm(dialog, true); + dialog.remove(); + }); + var no = $('', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft); + no.click(function () { + config.confirm(dialog, false); + dialog.remove(); + }) + } else { + var ok = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #0bb20c;color: #fff;' + }).appendTo(ft); + ok.click(function () { + dialog.remove(); + }) + } + } else { + if ($.isFunction(config.confirm)) { + var yes = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #FF9705;color: #fff;' + }).appendTo(ft); + yes.click(function () { + config.confirm(dialog, true); + dialog.remove(); + }); + var no = $('', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft); + no.click(function () { + config.confirm(dialog, false); + dialog.remove(); + }) + } else { + var ok = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #FF9705;color: #fff;' + }).appendTo(ft); + ok.click(function () { + dialog.remove(); + }) + } + } + dialog.appendTo($('body')); + } + + } +}); diff --git a/src/main/ui/static/templates/alipayaps/v5/payment.js b/src/main/ui/static/templates/alipayaps/v5/payment.js new file mode 100644 index 000000000..5c1498ad3 --- /dev/null +++ b/src/main/ui/static/templates/alipayaps/v5/payment.js @@ -0,0 +1,452 @@ +/** + * Created by yixian on 2017-05-08 + */ + +$(function () { + 'use strict'; + // document.querySelector('body').addEventListener('touchmove', function(e) { + // if (!document.querySelector('.coupons').contains(e.target)) { + // e.preventDefault(); + // } + // }); + var dataCache = {price: '0', coupons: [], coupon_groups: {}}; + var exchangeRate = 'CNY' == window.currency ? 1 : parseFloat(window.exchange_rate); + dataCache.paying = false; + var ctrl = {}; + + if (window.AlipayJSBridge) { + AlipayJSBridge.call('hideOptionMenu'); + } else { + document.addEventListener('AlipayJSBridgeReady', function () { + AlipayJSBridge.call('hideOptionMenu'); + }, false); + } + dataCache.paying = false; + var ctrl = {}; + + $('.ff.key').bind('touchstart', function () { + if (dataCache.paying) { + return; + } + var char = $(this).attr('data-char'); + appendChar(char); + }); + + $('.coupons .use-check').click(function () { + if ($(this).hasClass('disabled')) { + return; + } + var couponId = $(this).attr('data-coupon-id'); + var couponGroup = $(this).attr('data-coupon-group'); + if (couponGroup) { + var prevCouponId = dataCache.coupon_groups[couponGroup]; + if (prevCouponId) { + var prevIdx = dataCache.coupons.indexOf(prevCouponId); + if (prevIdx >= 0) { + dataCache.coupons.splice(prevIdx, 1); + } + if (prevCouponId != couponId) { + $('.coupons .use-check[data-coupon-id="' + prevCouponId + '"]').removeClass('checked').addClass('unchecked'); + dataCache.coupon_groups[couponGroup] = couponId; + } else { + dataCache.coupon_groups[couponGroup] = null; + } + } else { + dataCache.coupon_groups[couponGroup] = couponId; + } + + } + + if ($(this).is('.checked')) { + $(this).removeClass('checked').addClass('unchecked'); + } else { + $(this).removeClass('unchecked').addClass('checked'); + } + var checked = $(this).is('.checked'); + if (checked) { + dataCache.coupons.push(couponId); + updatePrice(); + } else { + var idx = dataCache.coupons.indexOf(couponId); + dataCache.coupons.splice(idx, 1); + updatePrice(); + } + }); + $('.cb_bankpay').click(function () { + $.ajax({ + url: '/sys/partners/' + window.client_moniker + '/jump/link', + method: 'GET', + success: function (res) { + location.href = res; + }, + error: function (resp) { + var config = { + template: resp + }; + showWeuiDialog(config); + } + }) + }); + $('#key_B').bind('touchstart', function () { + backspace(); + }); + + function updatePoundage(price) { + if (window.extensions.indexOf('customerrate') >= 0 && window.rateValue != null) { + if (window.use_customised_rate) { + var rate = new Decimal(100).plus(window.rateValue).div(100); + var poundageValue = new Decimal(dataCache.price).mul(rate).sub(dataCache.price); + } else { + var rateRemain = new Decimal(100).sub(window.rateValue).div(100); + poundageValue = new Decimal(dataCache.price).div(rateRemain).sub(dataCache.price); + } + dataCache.poundageValue = poundageValue.toFixed(2, Decimal.ROUND_HALF_UP); + return poundageValue.plus(price).toFixed(2, Decimal.ROUND_HALF_UP); + } + return price; + } + + function updatePrice() { + $('#audVal').html(dataCache.price); + var realPrice = dataCache.price; + $('#audValReal').html(realPrice); + var surchargeData = calculateSurcharge(realPrice); + + var price = surchargeData.newPrice || realPrice; + var priceBeforeDiscount = price; + dataCache.discounts = []; + dataCache.tax = surchargeData.tax; + dataCache.surcharge = surchargeData.surcharge; + $(window.coupons).each(function () { + price = this.handleDiscount(price, dataCache.price, dataCache.discounts, dataCache.coupons); + }); + dataCache.finalPrice = new Decimal(price).toFixed(2, Decimal.ROUND_FLOOR); + var rate = 'CNY' == window.currency ? 1 : exchangeRate; + var cnyVal = Decimal.mul(price, rate).toFixed(2, Decimal.ROUND_FLOOR); + dataCache.currencyPrice = 'CNY' == window.currency ? Decimal.div(priceBeforeDiscount, exchangeRate).toFixed(2, Decimal.ROUND_FLOOR) : priceBeforeDiscount; + $('#cnyVal').html(cnyVal) + } + + function backspace() { + dataCache.price = dataCache.price.substring(0, dataCache.price.length - 1); + if (dataCache.price.length == 0) { + dataCache.price = '0'; + } + updatePrice(); + updatePoundageStatus(); + } + + function appendChar(char) { + var pointLocation = dataCache.price.indexOf('.'); + if (pointLocation >= 0 || char == '.' || dataCache.price.length < 5) { + if (pointLocation >= 0 && char == '.') { + return; + } + if (pointLocation >= 0 && pointLocation <= dataCache.price.length - 3) { + return; + } + if (dataCache.price == '0' && char != '.') { + dataCache.price = ''; + } + dataCache.price += char; + updatePrice(); + updatePoundageStatus(); + } + } + + function updatePoundageStatus() { + $(window.coupons).each(function () { + var coupon = this; + var couponId = coupon.couponId(); + if (coupon.isEnable(dataCache.currencyPrice || 0)) { + $('.coupons .use-check[data-coupon-id=' + couponId + ']').removeClass('disabled'); + } else { + var dom = $('.coupons .use-check[data-coupon-id=' + couponId + ']').addClass('disabled'); + var couponGroup = dom.attr('data-coupon-group'); + if (couponGroup) { + if (dataCache.coupon_groups[couponGroup] == couponId) { + dataCache.coupon_groups[couponGroup] = null; + } + } + var idx = dataCache.coupons.indexOf(couponId); + if (idx >= 0) { + dataCache.coupons.splice(idx, 1); + } + dom.removeClass('checked').addClass('unchecked'); + } + }) + } + + updatePoundageStatus(); + + $('#coupon-box-toggle').click(function () { + $('.coupons-container').addClass('show'); + }); + $('.coupons-container>.coupons-mask,.coupons-container #close-coupon-box').click(function () { + $(this).parents('.coupons-container').removeClass('show'); + }); + + $('.paydetail').click(function () { + var config = { + title: 'Payment Detail', + template: '', + initialize: function (dialog) { + var bd = $('.weui_dialog_bd', dialog); + var currencySymbol = window.currency == 'CNY' ? '¥' : '$'; + $('

    ').html('Input Price 输入金额:' + currencySymbol + dataCache.price).appendTo(bd); + if (parseFloat(dataCache.surcharge) > 0) { + $('

    ').html('Surcharge 手续费(' + window.rateValue + '%):+' + currencySymbol + dataCache.surcharge).appendTo(bd); + } + if (parseFloat(dataCache.tax) > 0) { + $('

    ').html('GST(10%):' + currencySymbol + dataCache.tax).appendTo(bd); + } + $(dataCache.discounts).each(function () { + $('

    ').html(this.title + ':-' + currencySymbol + this.amount).appendTo(bd); + }); + $('

    ').addClass('final').html('Final 支付金额:' + currencySymbol + (dataCache.finalPrice || 0)).appendTo(bd); + } + }; + showWeuiDialog(config); + }); + + $('#key_P').click(function () { + if (window.requireRemark) { + if (!dataCache.remark) { + var config = { + title: '请先输入备注', + template: '' + }; + showWeuiDialog(config); + } + + } + }); + + function addBlurListen() { + $('.remark-input').on('blur', function (event) { + dataCache.remark = $('textarea[name="remark"]').val(); + }); + } + addBlurListen(); + + $('#audVal').bind('DOMNodeInserted', function(e) { + if(dataCache.price==0){ + $('.pay_button').css({"background-color":"#eee",}).attr('disabled',true); + $('.bank_button').css({"background-color":"#eee",}).attr('disabled',true); + }else{ + $('.pay_button').css({"background-color":"#108ee9",}).attr('disabled',false); + $('.bank_button').css({"background-color":"#FF6600",}).attr('disabled',false); + } + }); + $('#key_P').bind('touchstart', function () { + if (window.requireRemark) { + if ($('textarea[name="remark"]').val()=="") { + return; + } + } + $('#key_P').addClass('hidden'); + $('#key_Loading').removeClass('hidden'); + if (dataCache.paying) { + return; + } + dataCache.paying = true; + var data = {price: dataCache.price + '', currency: window.currency}; + if (dataCache.remark) { + data.description = dataCache.remark; + } + if (window.extensions.indexOf('preauthorize') >= 0) { + data.preauthorize = true; + } + if (window.extensions.indexOf('qrcodemode') >= 0) { + data.qrmode = true; + } + if (window.extensions.indexOf('customerrate') >= 0) { + data.customerrate = true; + } + data.coupons = dataCache.coupons; + data.qrcodeVersion = window.qrcodeVersion; + $.ajax({ + url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders', + method: 'POST', + data: JSON.stringify(data), + contentType: 'application/json', + dataType: 'json', + success: function (pay) { + if (pay.direct_paid) { + location.href = '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; + return; + } + if (pay.mweb_url){ + location.href = pay.mweb_url; + return; + } + if (window.AlipayJSBridge) { + callPayment(); + } else { + // 如果没有注入则监听注入的事件 + document.addEventListener('AlipayJSBridgeReady', callPayment, false); + } + + function callPayment() { + try { + AlipayJSBridge.call('tradePay', { + tradeNO: pay.trade_no + }, function (res) { + dataCache.paying = false; + if (res.resultCode == '9000') { + AlipayJSBridge.call('startApp', { + appId: '20000056', + param: { + actionType: 'showSuccPage', + payResult: res.result + }, + closeCurrentApp: false + }); + startCheckOrder(pay.order_id, '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); + } else if (res.resultCode == '6001') { + //do nothing + } else { + if (res.memo) { + weuiAlert(res.memo); + } + } + $('#key_P_div').removeClass('hidden'); + $('#key_Loading_div').addClass('hidden'); + }) + } catch (err) { + weuiAlert(err) + } + } + }, + error: function (jqXhr) { + weuiAlert(jqXhr.responseJSON.message); + $('#key_P_div').removeClass('hidden'); + $('#key_Loading_div').addClass('hidden'); + dataCache.paying = false; + } + }) + }); + + function startCheckOrder(orderId, url) { + function checkOrderStd() { + $.ajax({ + url: '/api/v1.0/payment/orders/' + orderId + '/status', + method: 'GET', + dataType: 'json', + success: function (res) { + if (res.paid) { + location.href = url; + } else { + setTimeout(checkOrderStd, 500); + } + } + }) + } + + checkOrderStd(); + } + + function weuiAlert(msg) { + var config = { + template: msg + }; + showWeuiDialog(config); + } + + function showWeuiDialog(config) { + if (config.templateUrl) { + $.ajax({ + url: config.templateUrl, + dataType: 'html', + success: function (template) { + buildDialog(template); + } + }); + } else { + buildDialog(config.template); + } + + function buildDialog(template) { + var defaultConfig = {backdrop: true}; + config = $.extend({}, defaultConfig, config); + var dialog = $("
    ", {class: 'weui_dialog_confirm'}); + var mask = $('
    ', {class: 'weui_mask'}).appendTo(dialog); + if (config.backdrop) { + mask.click(function () { + dialog.remove(); + if ($.isFunction(config.dismiss)) { + config.dismiss(); + } + }) + } + var dialogBox = $("
    ", {class: 'weui_dialog'}).appendTo(dialog); + if (config.title) { + $('
    ', {class: 'weui_dialog_hd'}).append($('', {class: 'weui_dialog_title'}).html(config.title)).appendTo(dialogBox); + } + var dialogBody = $("
    ", {class: 'weui_dialog_bd'}).appendTo(dialogBox); + if (template) { + dialogBody.append(template); + } + if ($.isFunction(config.initialize)) { + config.initialize(dialog); + } + var ft = $('
    ').appendTo(dialogBox); + if(window.paypad_version !== 'v3'){ + if ($.isFunction(config.confirm)) { + var yes = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #0bb20c;color: #fff;' + }).appendTo(ft); + yes.click(function () { + config.confirm(dialog, true); + dialog.remove(); + }); + var no = $('', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft); + no.click(function () { + config.confirm(dialog, false); + dialog.remove(); + }) + } else { + var ok = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #0bb20c;color: #fff;' + }).appendTo(ft); + ok.click(function () { + dialog.remove(); + }) + } + } else { + if ($.isFunction(config.confirm)) { + var yes = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #FF9705;color: #fff;' + }).appendTo(ft); + yes.click(function () { + config.confirm(dialog, true); + dialog.remove(); + }); + var no = $('', {class: 'weui_btn_dialog default', text: 'Cancel'}).appendTo(ft); + no.click(function () { + config.confirm(dialog, false); + dialog.remove(); + }) + } else { + var ok = $('', { + class: 'weui_btn_dialog primary', + text: 'OK', + style: 'background: #FF9705;color: #fff;' + }).appendTo(ft); + ok.click(function () { + dialog.remove(); + }) + } + } + dialog.appendTo($('body')); + addBlurListen(); + } + + } +}); From e0f564a19db1b545e291922f9126f128b56e3830 Mon Sep 17 00:00:00 2001 From: yixian Date: Wed, 15 Sep 2021 18:11:38 +0800 Subject: [PATCH 09/50] channel permission --- .../core/impls/ClientManagerImpl.java | 9 +---- .../impls/SwitchChannelPermissionModify.java | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchChannelPermissionModify.java 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 7626d6460..7f1e41efd 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 @@ -283,10 +283,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private MailGunService mailGunService; @Resource - private ClearingDetailMapper clearingDetailMapper; - @Resource - private ClearingLogMapper clearingLogMapper; - @Resource private ClientConfigMapper clientConfigMapper; @Resource private PermissionPartnerManagerImpl permissionPartnerManagerImpl; @@ -331,8 +327,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private PaymentApi paymentApi; @Resource - private MerchantChannelPermissionManager merchantChannelPermissionManager; - @Resource private ApsConfigService apsConfigService; DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMM yyyy"); @@ -1593,9 +1587,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new NotFoundException("Client Not Exists"); } - merchantChannelPermissionManager.switchMerchantChannelPermission(channelApi.getMetadata().payChannel(), client.getIntValue("client_id"), allow); try { - clientModifySupport.processModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow)); + clientModifySupport.processModify(new SwitchChannelPermissionModify(manager, clientMoniker, merchantInfoProvider, paymentApi.channelApi(channel).getChannelPermissionResolver(), allow)); } catch (Exception e) { logger.error("Failed to change channel switch:{}", channel); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchChannelPermissionModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchChannelPermissionModify.java new file mode 100644 index 000000000..5328c3074 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchChannelPermissionModify.java @@ -0,0 +1,37 @@ +package au.com.royalpay.payment.manage.merchants.entity.impls; + +import au.com.royalpay.payment.manage.merchants.entity.ClientModifyOperation; +import au.com.royalpay.payment.tools.merchants.core.MerchantChannelPermissionResolver; +import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; +import au.com.royalpay.payment.tools.utils.JsonUtils; +import com.alibaba.fastjson.JSONObject; + +import java.util.function.Consumer; + +public class SwitchChannelPermissionModify extends ClientModifyOperation { + private final MerchantInfoProvider mchInfoProvider; + private final MerchantChannelPermissionResolver channelResolver; + private final boolean enableFlag; + + public SwitchChannelPermissionModify(JSONObject account, String clientMoniker, MerchantInfoProvider mchInfoProvider, MerchantChannelPermissionResolver channelResolver, boolean enableFlag) { + super(account, clientMoniker); + this.mchInfoProvider = mchInfoProvider; + this.channelResolver = channelResolver; + this.enableFlag = enableFlag; + } + + @Override + protected String business() { + return (enableFlag ? "开启 " : "关闭 ") + "渠道[" + channelResolver.payChannel().getChannelCode() + "]"; + } + + @Override + protected JSONObject getModifyResult() { + return JsonUtils.newJson(json -> json.put("enable_" + channelResolver.payChannel().getChannelCode(), enableFlag + "")); + } + + @Override + protected Consumer getModifyProcess() { + return client -> channelResolver.switchPermission(mchInfoProvider, client.getIntValue("client_id"), enableFlag); + } +} From e2a3e4d213fce369791bf345309fd5a825d78845 Mon Sep 17 00:00:00 2001 From: Todking Date: Thu, 16 Sep 2021 14:10:29 +0800 Subject: [PATCH 10/50] fix alipay.yml --- src/main/resources/application-alipay.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/main/resources/application-alipay.yml b/src/main/resources/application-alipay.yml index 254bb4235..4c268e41f 100644 --- a/src/main/resources/application-alipay.yml +++ b/src/main/resources/application-alipay.yml @@ -26,21 +26,12 @@ app: public-key-string: |- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqME6KAPZcMlFuy19J+RAj34PaS6iuyjINzQvdjR808IeVQAcLdUULMEgCTSQLshC606GFoGkN5nOouoMCZQmPv9hbZSWcDHMrPNNVYuAqwk0N80FSnASNPtlucoqzVjAaqgXD88hqjODCIS/b9LWrprCA3q3aAfVQu3eQLoFM1nn9EdznCp0uVClHgLtwj1rMRkjN+4CSwOW66/RNzsgnDJMkrTlRDeJCrbdXAs0Q3MWQEQv2z1fd34U1yyY2StkHbfKAVp2cCzhSl26K3LcCooDv9VDSv3BDH58sBQ8TIprIW0EsDA4jbLXEDEKXIjqIOaC/+x8jXyRpci17ZvRowIDAQAB pid-host: https://open-sea.alipay.com - - pid: SANDBOX_5Y2Z6G2Y6CD006410 - bill-pid: '' - pid-type: APS - biz-type: RETAIL - api-prefix: /aps - private-key-string: |- - MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC7Q56Mi0ESd7lIImLl/qvoHry8M1pg6qMyzzsMsHe6kMMculI7B7G2/fGpSS2JC46jZrVRb/fYf1NLehhAh1MK51md/7dEgqjkowtXIjhEQTPXwTWWkxtnb/l+KoqWtBrkOfMIef+O6QbqvveneLlCq9wMnvKNsj0p9GtUKxYUyxY8Nwuc2tf2wG2zKuh0JoRMLMRMayr7WdhAy4jatJS5pDjJqoIxyhD6X7fPleoeJgzyYSZAPgnH01TSO5ePFQZ/7SxDRC8+D5rAnefsridaabmeBQG2QWf4Gz7qPuavnZfwKzkjptj390+D0PAR3f3JCvYXTrRRUGKdVpiuuFAbAgMBAAECggEBAJrmxUjWi9494Kq1nv9HGWYpvs8i33jZvmNyHhNSCcfupSanTQv9QljvWK5ClQMO509sz0FtECQqtnjxpwwBpISZeH0EoNFwD0sJP4E1EjwLf1nSPYSvbPS0I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KiXpRV9Y8Gbkw1jI8/tMYcSEJsOfEA== - public-key-string: |- - MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqME6KAPZcMlFuy19J+RAj34PaS6iuyjINzQvdjR808IeVQAcLdUULMEgCTSQLshC606GFoGkN5nOouoMCZQmPv9hbZSWcDHMrPNNVYuAqwk0N80FSnASNPtlucoqzVjAaqgXD88hqjODCIS/b9LWrprCA3q3aAfVQu3eQLoFM1nn9EdznCp0uVClHgLtwj1rMRkjN+4CSwOW66/RNzsgnDJMkrTlRDeJCrbdXAs0Q3MWQEQv2z1fd34U1yyY2StkHbfKAVp2cCzhSl26K3LcCooDv9VDSv3BDH58sBQ8TIprIW0EsDA4jbLXEDEKXIjqIOaC/+x8jXyRpci17ZvRowIDAQAB - pid-host: https://open-sea.alipay.com - enabled: true - pid: SANDBOX_5Y372Y2YBKQN02382 bill-pid: '' pid-type: APS - biz-type: ONLINE + biz-types: + - ONLINE + - RETAIL api-prefix: /aps private-key-string: |- MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDWXsXs+dZPb/cd From 185ecdecc3de98134b0dae86b2d37215bad4a058 Mon Sep 17 00:00:00 2001 From: Todking Date: Thu, 16 Sep 2021 14:25:41 +0800 Subject: [PATCH 11/50] =?UTF-8?q?fix=20alipay+(aps)=E6=94=AF=E4=BB=98js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/merchants/core/impls/ClientManagerImpl.java | 10 ++++++++-- src/main/ui/static/templates/alipayaps/v1/payment.js | 6 +++--- src/main/ui/static/templates/alipayaps/v4/payment.js | 6 +++--- src/main/ui/static/templates/alipayaps/v5/payment.js | 6 +++--- 4 files changed, 17 insertions(+), 11 deletions(-) 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 7f1e41efd..0c275a206 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 @@ -553,6 +553,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid resolver.newOrderEnabled(client, null, PlatformEnvironment.getEnv().getForeignCurrency())) { client.put("enable_alipayplus", true); } + client.put("enable_alipayaps", false); + MerchantChannelPermissionResolver resolverAps = this.paymentApi.channelApi(PayChannel.ALIPAY_APS.getChannelCode()).getChannelPermissionResolver(); + if (!Objects.isNull(resolver) && + resolverAps.newOrderEnabled(client, null, PlatformEnvironment.getEnv().getForeignCurrency())) { + client.put("enable_alipayaps", true); + } ApsConfigData apsConfig = apsConfigService.getApsConfigByClientId(client.getString("client_id")); if (apsConfig == null) { apsConfig = apsConfigService.saveApsConfigClientId(manager.getString("manager_id"), client.getString("client_id"), new ApsConfigDescriptor()); @@ -1588,9 +1594,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new NotFoundException("Client Not Exists"); } try { - clientModifySupport.processModify(new SwitchChannelPermissionModify(manager, clientMoniker, merchantInfoProvider, paymentApi.channelApi(channel).getChannelPermissionResolver(), allow)); + clientModifySupport.processModify(new SwitchChannelPermissionModify(manager, clientMoniker, merchantInfoProvider, channelApi.getChannelPermissionResolver(), allow)); } catch (Exception e) { - logger.error("Failed to change channel switch:{}", channel); + logger.error("Failed to change channel switch:{}", channel,e); } logger.info("{}({}) switched client {} channel {} to {}", manager.getString("display_name"), manager.getString("manager_id"), clientMoniker, channel, allow); if (allow && (StringUtils.equalsAnyIgnoreCase("Wechat", channel) || StringUtils.equalsAnyIgnoreCase("Alipay", channel))) { diff --git a/src/main/ui/static/templates/alipayaps/v1/payment.js b/src/main/ui/static/templates/alipayaps/v1/payment.js index 9f846d9df..0a49f9143 100644 --- a/src/main/ui/static/templates/alipayaps/v1/payment.js +++ b/src/main/ui/static/templates/alipayaps/v1/payment.js @@ -258,14 +258,14 @@ $(function () { data.qrcodeVersion = window.qrcodeVersion; $.ajax({ - url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders', + url: '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders', method: 'POST', data: JSON.stringify(data), contentType: 'application/json', dataType: 'json', success: function (pay) { if (pay.direct_paid) { - location.href = '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; + location.href = '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; return; } if (pay.mweb_url){ @@ -294,7 +294,7 @@ $(function () { }, closeCurrentApp: false }); - startCheckOrder(pay.order_id, '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); + startCheckOrder(pay.order_id, '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); } else if (res.resultCode == '6001') { //do nothing } else { diff --git a/src/main/ui/static/templates/alipayaps/v4/payment.js b/src/main/ui/static/templates/alipayaps/v4/payment.js index 43c4c0012..be2d64c9a 100644 --- a/src/main/ui/static/templates/alipayaps/v4/payment.js +++ b/src/main/ui/static/templates/alipayaps/v4/payment.js @@ -303,14 +303,14 @@ $(function () { data.coupons = dataCache.coupons; data.qrcodeVersion = window.qrcodeVersion; $.ajax({ - url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders', + url: '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders', method: 'POST', data: JSON.stringify(data), contentType: 'application/json', dataType: 'json', success: function (pay) { if (pay.direct_paid) { - location.href = '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; + location.href = '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; return; } if (pay.mweb_url){ @@ -339,7 +339,7 @@ $(function () { }, closeCurrentApp: false }); - startCheckOrder(pay.order_id, '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); + startCheckOrder(pay.order_id, '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); } else if (res.resultCode == '6001') { //do nothing } else { diff --git a/src/main/ui/static/templates/alipayaps/v5/payment.js b/src/main/ui/static/templates/alipayaps/v5/payment.js index 5c1498ad3..759356aff 100644 --- a/src/main/ui/static/templates/alipayaps/v5/payment.js +++ b/src/main/ui/static/templates/alipayaps/v5/payment.js @@ -266,14 +266,14 @@ $(function () { data.coupons = dataCache.coupons; data.qrcodeVersion = window.qrcodeVersion; $.ajax({ - url: '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders', + url: '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders', method: 'POST', data: JSON.stringify(data), contentType: 'application/json', dataType: 'json', success: function (pay) { if (pay.direct_paid) { - location.href = '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; + location.href = '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'; return; } if (pay.mweb_url){ @@ -302,7 +302,7 @@ $(function () { }, closeCurrentApp: false }); - startCheckOrder(pay.order_id, '/api/v1.0/alipay/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); + startCheckOrder(pay.order_id, '/api/v1.0/alipay_aps/partners/' + window.client_moniker + '/orders/' + pay.order_id + '/result'); } else if (res.resultCode == '6001') { //do nothing } else { From 756b4bbca3913f86685b87a82a5fcf982567cb70 Mon Sep 17 00:00:00 2001 From: dalong306 <304592994@qq.com> Date: Thu, 16 Sep 2021 17:27:40 +0800 Subject: [PATCH 12/50] =?UTF-8?q?=E8=BF=90=E8=90=A5=E7=AB=AF=E6=B8=A0?= =?UTF-8?q?=E9=81=93=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impls/ChannelsAnalysisServiceImpl.java | 13 +++++- .../web/PartnerManageController.java | 11 ++++- .../CustomerAndOrdersStatisticsMapper.xml | 3 ++ .../ui/static/analysis/channels_analysis.js | 45 ++++++++++++++++--- .../analysis/templates/channels_analysis.html | 10 +++-- .../templates/manage_customers_orders.html | 2 + .../templates/partner_customers_orders.html | 2 + .../templates/partner_trans_analysis.html | 2 + .../analysis/templates/trans_analysis.html | 13 ++++++ .../transaction_amount_Analysis.html | 2 + .../static/payment/partner/partner-manage.js | 6 +-- .../apply_alipayplus_sub_merchant_id.html | 2 +- .../partner/templates/partner_pay_logs.html | 4 +- .../templates/sub_merchant_id_apply.html | 16 +++---- .../tradelog/templates/balance_report.html | 4 ++ .../templates/incremental_trade_logs.html | 4 ++ .../partner_incremental_trade_logs.html | 2 + .../templates/partner_trade_logs.html | 4 +- .../tradelog/templates/trade_logs.html | 4 +- .../templates/payment/gateway_jsapi.css | 15 +++++++ 20 files changed, 130 insertions(+), 34 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ChannelsAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ChannelsAnalysisServiceImpl.java index 9878e525f..830e1aa01 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ChannelsAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ChannelsAnalysisServiceImpl.java @@ -1,5 +1,6 @@ package au.com.royalpay.payment.manage.analysis.core.impls; +import au.com.royalpay.payment.core.mappers.MchChannelContractMapper; import au.com.royalpay.payment.manage.analysis.core.ChannelsAnalysisService; import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper; import com.alibaba.fastjson.JSONObject; @@ -28,6 +29,9 @@ public class ChannelsAnalysisServiceImpl implements ChannelsAnalysisService { @Resource private CustomerAndOrdersStatisticsMapper customerAndOrdersStatisticsMapper; + @Resource + private MchChannelContractMapper mchChannelContractMapper; + @Override public List getChannelMount(JSONObject params) { /*if (!params.containsKey("client_ids") && !params.containsKey("org_id")){ @@ -37,6 +41,7 @@ public class ChannelsAnalysisServiceImpl implements ChannelsAnalysisService { listChannel.add(putParam(params,"Wechat")); listChannel.add(putParam(params,"Alipay")); listChannel.add(putParam(params,"AlipayOnline")); + listChannel.add(putParam(params,"AlipayAps")); listChannel.add(putParam(params,"Rpay")); listChannel.add(putParam(params,"rpaypmt_card")); listChannel.add(putParam(params,"rpaypmt_dd")); @@ -50,7 +55,7 @@ public class ChannelsAnalysisServiceImpl implements ChannelsAnalysisService { } List list = new ArrayList<>(); Map analysisMap = new TreeMap<>(); - String[] channels = {"Wechat","Alipay","AlipayOnline","Rpay","rpaypmt_card","rpaypmt_dd"}; + String[] channels = {"Wechat","Alipay","AlipayOnline","Rpay","rpaypmt_card","rpaypmt_dd","AlipayAps"}; for (String channel:channels){ analysisChannelCustomers(params, analysisMap, channel); } @@ -136,7 +141,11 @@ public class ChannelsAnalysisServiceImpl implements ChannelsAnalysisService { params.put("gateway_alipay_online", 1); enablePartners = customerAndOrdersStatisticsMapper.countEnableChannel(params); params.remove("gateway_alipay_online"); - } else { + } + else if("AlipayAps".equals(name)){ + enablePartners=mchChannelContractMapper.sumEnablePartners(name); + } + else { params.put("enable_" + name.toLowerCase(), 1); enablePartners = customerAndOrdersStatisticsMapper.countEnableChannel(params); params.remove("enable_" + name.toLowerCase()); 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 a299e427d..fffa36212 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 @@ -1066,8 +1066,15 @@ public class PartnerManageController { * @return */ @ManagerMapping(value = "/{clientMoniker}/apply_alipayplus", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public MerchantApplicationResult applyAlipayPlusMerchant(@PathVariable String clientMoniker, @RequestBody ApsMerchantApplication apsMerchantApplication, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - return clientManager.alipayPlusRegisterMerchant(clientMoniker,apsMerchantApplication,manager); + public JSONObject applyAlipayPlusMerchant(@PathVariable String clientMoniker, @RequestBody ApsMerchantApplication apsMerchantApplication, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + MerchantApplicationResult result= clientManager.alipayPlusRegisterMerchant(clientMoniker,apsMerchantApplication,manager); + JSONObject jsonObject=new JSONObject(); + if(result.isSuccess()){ + jsonObject.put("result",true); + }else{ + jsonObject.put("result",false); + } + return jsonObject; } @ManagerMapping(value = "/{clientMoniker}/query/alipay_aps_online", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml index 24eea92c2..c7c28353b 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml @@ -344,6 +344,9 @@ ifnull(sum(CASE WHEN s.channel = 'AlipayOnline' THEN s.total ELSE 0 END),0) alipayonlineamount, ifnull(sum(CASE WHEN s.channel = 'AlipayOnline' THEN s.orders ELSE 0 END),0) alipayonline_order_count, ifnull(COUNT(DISTINCT s.client_id,IF(s.channel = 'AlipayOnline',TRUE,NULL)),0) alipayonline_client_count, + ifnull(sum(CASE WHEN s.channel = 'AlipayAps' THEN s.total ELSE 0 END),0) alipayapsamount, + ifnull(sum(CASE WHEN s.channel = 'AlipayAps' THEN s.orders ELSE 0 END),0) alipayaps_order_count, + ifnull(COUNT(DISTINCT s.client_id,IF(s.channel = 'AlipayAps',TRUE,NULL)),0) alipayaps_client_count, ifnull(sum(CASE WHEN s.channel = 'hf' THEN s.total ELSE 0 END),0) hfamount, ifnull(sum(CASE WHEN s.channel = 'hf' THEN s.orders ELSE 0 END),0) hf_order_count, ifnull(COUNT(DISTINCT s.client_id,IF(s.channel = 'hf',TRUE,NULL)),0) hf_client_count, diff --git a/src/main/ui/static/analysis/channels_analysis.js b/src/main/ui/static/analysis/channels_analysis.js index 3a14cdab3..e2f138993 100644 --- a/src/main/ui/static/analysis/channels_analysis.js +++ b/src/main/ui/static/analysis/channels_analysis.js @@ -173,7 +173,7 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' trigger: 'axis' }, legend: { - data: ['Alipay交易金额','AlipayOnline交易金额', 'Bestpay交易金额','Wechat交易金额',"JD Pay交易金额","HF Pay交易金额","Yeepay交易金额","LakalaPay交易金额","Card Payment交易金额","Direct Debit交易金额"], + data: ['Alipay交易金额','AlipayOnline交易金额', 'Bestpay交易金额','Wechat交易金额',"JD Pay交易金额","HF Pay交易金额","Yeepay交易金额","LakalaPay交易金额","Card Payment交易金额","Direct Debit交易金额","Alipay+交易金额"], bottom: 0, height: '15%', width: '80%', @@ -185,7 +185,7 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' type: 'value' } ], - color: ['#00a0e9','#00a0e9','#FF2D96','#09bb07','#DC0808',"#FFFF33","#66ff00","#00b0ec"] + color: ['#00a0e9','#00a0e9','#FF2D96','#09bb07','#DC0808',"#FFFF33","#66ff00","#00b0ec","#8f4b2e","#87843b","#f8aba6"] }, xAxis: { basic: {type: 'category', boundaryGap: false}, @@ -301,6 +301,17 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' yAxisIndex: 0 }, column: {key: 'rpaypmt_dd.total'} + }, + { + basic: { + name: 'Alipay+交易金额', + type: 'line', + label: {normal: {show: true}}, + showAllSymbols: true, + showSymbol: true, + yAxisIndex: 0 + }, + column: {key: 'AlipayAps.total'} } ] }; @@ -311,7 +322,7 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' trigger: 'axis' }, legend: { - data: ['Alipay交易订单','AlipayOnline交易订单', 'Bestpay交易订单','Wechat交易订单',"JD Pay交易订单","HF Pay交易订单","Yeepay交易订单","LakalaPay交易订单","Card Payment交易订单","Direct Debit交易订单"], + data: ['Alipay交易订单','AlipayOnline交易订单', 'Bestpay交易订单','Wechat交易订单',"JD Pay交易订单","HF Pay交易订单","Yeepay交易订单","LakalaPay交易订单","Card Payment交易订单","Direct Debit交易订单","Alipay+交易订单"], bottom: 0, height: '15%', width: '80%', @@ -323,7 +334,7 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' type: 'value' } ], - color: ['#00a0e9','00a0e9','#FF2D96','#09bb07','#DC0808',"#FFFF33","#66ff00","#00b0ec"] + color: ['#00a0e9','00a0e9','#FF2D96','#09bb07','#DC0808',"#FFFF33","#66ff00","#00b0ec","#8f4b2e","#87843b","#f8aba6"] }, xAxis: { basic: {type: 'category', boundaryGap: false}, @@ -439,6 +450,17 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' yAxisIndex: 0 }, column: {key: 'rpaypmt_dd.orders'} + }, + { + basic: { + name: 'Alipay+交易订单', + type: 'line', + label: {normal: {show: true}}, + showAllSymbols: true, + showSymbol: true, + yAxisIndex: 0 + }, + column: {key: 'AlipayAps.orders'} } ] }; @@ -448,7 +470,7 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' trigger: 'axis' }, legend: { - data: ['Alipay交易客单价','AlipayOnline交易客单价', 'Bestpay交易客单价','Wechat交易客单价',"JD Pay交易客单价","HF Pay交易客单价","Yeepay交易客单价","LakalaPay交易客单价","Card Payment交易客单价","Direct Debit交易客单价"], + data: ['Alipay交易客单价','AlipayOnline交易客单价', 'Bestpay交易客单价','Wechat交易客单价',"JD Pay交易客单价","HF Pay交易客单价","Yeepay交易客单价","LakalaPay交易客单价","Card Payment交易客单价","Direct Debit交易客单价","Alipay+交易客单价"], bottom: 0, }, yAxis: [ @@ -457,7 +479,7 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' type: 'value' } ], - color: ['#00a0e9','#00a0e9','#FF2D96','#09bb07','#DC0808',"#FFFF33","#66ff00","#00b0ec"] + color: ['#00a0e9','#00a0e9','#FF2D96','#09bb07','#DC0808',"#FFFF33","#66ff00","#00b0ec","#8f4b2e","#87843b","#f8aba6"] }, xAxis: { basic: {type: 'category', boundaryGap: false}, @@ -573,6 +595,17 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' yAxisIndex: 0 }, column: {key: 'rpaypmt_dd.single_amount'} + }, + { + basic: { + name: 'Alipay+交易客单价', + type: 'line', + label: {normal: {show: true}}, + showAllSymbols: true, + showSymbol: true, + yAxisIndex: 0 + }, + column: {key: 'AlipayAps.single_amount'} } ] }; diff --git a/src/main/ui/static/analysis/templates/channels_analysis.html b/src/main/ui/static/analysis/templates/channels_analysis.html index d709513bc..3303d188d 100644 --- a/src/main/ui/static/analysis/templates/channels_analysis.html +++ b/src/main/ui/static/analysis/templates/channels_analysis.html @@ -140,8 +140,10 @@ - + Alipay+ @@ -159,21 +161,21 @@
    交易总金额变化趋势
    -
    订单数变化趋势
    -
    客单价变化趋势
    -
    diff --git a/src/main/ui/static/analysis/templates/manage_customers_orders.html b/src/main/ui/static/analysis/templates/manage_customers_orders.html index 3b58fe431..f7477b847 100644 --- a/src/main/ui/static/analysis/templates/manage_customers_orders.html +++ b/src/main/ui/static/analysis/templates/manage_customers_orders.html @@ -85,6 +85,8 @@ Ye