diff --git a/pom.xml b/pom.xml index 26d847ffd..63a3aaafe 100644 --- a/pom.xml +++ b/pom.xml @@ -5,11 +5,11 @@ au.com.royalpay.payment payment-parent - 2.1.44 + 2.1.47 4.0.0 manage - 2.3.1 + 2.3.2 UTF-8 2.2.0 diff --git a/src/document/openapi/cn/document.yml b/src/document/openapi/cn/document.yml index a82272519..b77863011 100644 --- a/src/document/openapi/cn/document.yml +++ b/src/document/openapi/cn/document.yml @@ -540,7 +540,17 @@ paths: domestic_only: type: boolean default: false - description: 是否只允许本国卡。由于境内境外卡支付手续费差异巨大,可在此限制。 + description: | + 是否只允许本国卡。由于境内境外卡支付手续费差异巨大,可在此限制。 + **当商户开启消费者支付手续费功能,而international_only提交了false时,当前参数自动置为true。** + international_only: + type: boolean + default: false + description: | + 是否只允许国际卡。当商户开启消费者支付手续费功能,需要提交当前参数为true才可允许国际卡支付,同时此订单将只允许国际卡支付。 + **因此商户需要在支付页面提供本地卡和国际卡两个支付入口!** + + 另:当domestic_only=true的时候当前参数无效。 disable_credit_card: type: boolean default: false diff --git a/src/document/openapi/en/document.yml b/src/document/openapi/en/document.yml index 3f39a4ed6..716a2b2cc 100644 --- a/src/document/openapi/en/document.yml +++ b/src/document/openapi/en/document.yml @@ -554,7 +554,18 @@ paths: domestic_only: type: boolean default: false - description: whether only domestic cards can pay. due to there is huge difference on surcharge rate between domestic cards and international cards. merchants can add a limit on the order. + description: | + Whether only domestic cards can pay. due to there is huge difference on surcharge rate between domestic cards and international cards. + Merchants can add a limit on the order. + **Note: If merchant enabled auto attach surcharge on orders, and international_only is false, this parameter will automatically set to true** + international_only: + type: boolean + default: false + description: | + If set this parameter to true, this order will refuse domestic cards. It is useful when merchant enabled auto attach surcharge to orders. + Then is required to set this value as true to enable international cards. This also means customers should choose use domestic cards or international cards first on merchants' page + + And if domestic_only param is true, this param will be ignored. disable_credit_card: type: boolean default: false @@ -610,14 +621,16 @@ paths: put: summary: Create Card Order description: | - 商户可在页面引入https://channel.rpayplus.com/channel/v1/view/card_input_frame.js - 并通过回调取得key_id和secret信息,并将其作为卡信息提交给royalpay直接完成下单支付。 + Input https://channel.rpayplus.com/channel/v1/view/card_input_frame.js in merchant's webpage. + After called commit, it will return `key_id` and `secret` parameter asyncronized by callback. + + Post these parameter to royalpay and finish payment directly. - js引用案例: + js Example ``` - let cardInputContainer = document.getElementById('card-input-area');//预先准备放置卡输入界面的container - let cardInput = new CardInputFrame(cardInputContainer);//创建frame对象 - //设置iframe的样式参数 + let cardInputContainer = document.getElementById('card-input-area');//a container prepared to put the card input frame in. + let cardInput = new CardInputFrame(cardInputContainer);//create frame object + //setting iframe style cardInput.frameStyle = { width: '100%', height: '400px', @@ -625,20 +638,22 @@ paths: borderRadius: '10px' }; cardInput.onError = function(msg){ - //卡输入界面返回错误信息时进行展示 + //if the input card message has mistake, will call this method and pass the error detail here }; cardInput.onReady = function(){ - //iframe加载完毕的触发事件 + //iframe loaded event }; cardInput.onSuccess = function(secretData){ - //成功取得加密卡信息回调 + //success get encrypted card informations //secretData: {'key_id':'','secret':''} }; - cardInput.show();//开始加载iframe + cardInput.show();//start loading iframe - //通过外部事件触发卡输入界面提交,注意卡输入界面没有按钮,必须通过外部触发提交事件。并回调到onSuccess回调函数。 + //call commit method when customer clicked pay button so that callbacks will be triggered cardInput.commit(); ``` + + **Note: This API do not allow customers pay for surcharge** tags: - CardPayment parameters: @@ -663,18 +678,20 @@ paths: properties: key_id: type: string - description: 卡输入界面回调得到的key_id + description: card input frame returned key_id card_info: type: string - description: 卡输入界面回调得到的secret + description: card input frame returned secret domestic_only: type: boolean default: false - description: 是否只允许本国卡。由于境内境外卡支付手续费差异巨大,可在此限制。 + description: | + Whether only domestic cards can pay. due to there is huge difference on surcharge rate between domestic cards and international cards. + Merchants can add a limit on the order. disable_credit_card: type: boolean default: false - description: 如果希望禁止消费者使用信用卡支付可传入true + description: Pass true if want to refuse credit cards. customer: $ref: 'components_order.yml#/cardCustomerParam' responses: @@ -686,10 +703,10 @@ paths: $ref: 'components_order.yml#/orderBasicResponse' /micropay/partners/{partner_code}/orders/{partner_order_id}: put: - summary: 付款码下单 + summary: Retail Passive Payment Order description: | - 线下支付订单接口用于带有扫码设备的收银终端进行对接,商户输入金额后要求客户出示支付码,用扫码枪扫码后将扫码内容和金额一并提交并完成支付操作。 - 线下支付订单接口现已兼容微信、支付宝通道。可根据付款码自动识别交易渠道。 + Retail Passive Payment is used for cashier terminals which can scan BarCode or QRCode. Shop staff input the payment amount and ask customers for their payment code, + then system send price and payment code to server and finish the payment. Retail Passive Payment now support both Alipay and WeChat tags: - RetailPay @@ -715,10 +732,10 @@ paths: properties: device_id: type: string - description: 扫码设备id + description: ID of the device which sends the request auth_code: type: string - description: 付款码 + description: The Payment QR Code scanned from customer's WeChat Wallet. responses: 200: description: Result @@ -728,9 +745,11 @@ paths: $ref: 'components_order.yml#/orderStatus' /retail_qrcode/partners/{partner_code}/orders/{partner_order_id}: put: - summary: 线下QRCode支付单 + summary: Retail Active Payment Order description: | - 线下QRCode支付用于对接无扫码设备的收银终端,下单后得到二维码地址,自行生成二维码图片后展示在收银终端屏幕上,并由用户使用对应支付客户端进行扫码支付。 线下QRCode现已同时兼容支付宝、微信客户端进行支付 + Retail Active Payment is used for cashier terminals which cannot scan Barcode or QRCode. Get the Code url after create the order, + convert this url to a QRCode and ask customers use their app to scan this QRCode then finish the payment. + Retail Active Payment now support Alipay, WeChat tags: - RetailPay @@ -755,7 +774,7 @@ paths: properties: device_id: type: string - description: 收银设备id + description: ID of the device which sends the request. responses: 200: description: Order @@ -768,13 +787,13 @@ paths: properties: code_url: type: string - description: 付款码字符串,商户可自行生成二维码 # todo + description: QR Code string. Partners can create the payment QR Code according to this value. /alipay/partners/{partner_code}/orders/{partner_order_id}: put: - summary: 支付宝WEB订单下单 + summary: Alipay WEB Order description: | - 创建订单后跳转到返回的pay_url(需附加签名参数和redirect参数),随后进入支付宝支付页面完成支付 - 该接口现仅支持支付宝。 + Use for Alipay Payment in PC Website. After create order, jump to the pay_url returned and attach sign params and redirect param. Then enter Alipay page to finish payment. + Alipay Channel Only. tags: - AlipayOnline parameters: @@ -803,10 +822,11 @@ paths: properties: pay_url: type: string - description: Payment page URL,加签后传递给前端并跳转至当前URL,让消费者完成支付 + description: Payment page URL. redirect to the url with signature parameters. /cb_bankpay/partners/{partner_code}/orders/{partner_order_id}: put: - summary: 网银快捷支付下单 + summary: CB BankPay Order + description: Use for CB BankPay in PC Website. After create order, jump to the pay_url returned and attach sign params and redirect param. tags: - CB Bank parameters: @@ -831,10 +851,10 @@ paths: properties: product_name: type: string - description: 商品名称 + description: production name gateway_type: type: integer - description: '网关类型,8: H5网关,9:PC网关' + description: 'Gateway Require 8: H5 gateway,9: PC gateway' enum: - 8 - 9 @@ -850,10 +870,13 @@ paths: properties: pay_url: type: string - description: Payment page URL,加签后传递给前端并跳转至当前URL,让消费者完成支付 + description: Payment page URL. redirect to the url with signature parameters. /gateway/partners/{partner_code}/app_orders/{partner_order_id}: put: - summary: SDK下单 + summary: SDK Order + description: | + Used for mobile Apps calling Wechat payment with Wechat SDK. Call this api to create order and get param string for SDK calling. + Call SDK api with the param to start payment and get payment result from Wechat app It is strongly advised to request RoyalPay order query Api to confirm that the order has been paid in order to cancelling order by system at the same time. tags: - SDK Payment parameters: @@ -877,23 +900,23 @@ paths: properties: channel: type: string - description: 支付渠道,大小写敏感 + description: Payment channel, required, case sensitive enum: - Wechat - Alipay system: type: string - description: 客户端操作类型,支付宝选填,微信不需要 + description: OS type of client app, optional for Alipay, not required for Wechat enum: - android - iphone - ipad version: type: string - description: 客户端版本号,支付宝选填,微信不需要 + description: client app version, optional for Alipay, not required for Wechat appid: type: string - description: 微信必填,开发者平台appid + description: wechat appid, required for Wechat, not required for Alipay responses: 200: description: Order @@ -906,11 +929,13 @@ paths: properties: sdk_params: type: string - description: json字符串,可直接传递给SDK端发起支付 + description: param string for calling SDK /gateway/partners/{partner_code}/channel_exchange_rate: get: - summary: 渠道汇率查询 - description: 获取当前各渠道AUD兑CNY汇率值(1AUD=?CNY),该汇率仅做参考,以实际成交汇率为准 + summary: Channel Exchange Rates + description: | + Get current exchange rate from AUD to CNY provided by WeChat and Alipay(AUD 1=CNY ?). + This exchange rate shown is for reference only, please refer to the real time exchange rate when processing the actual transaction. tags: - PublicApi parameters: @@ -928,28 +953,29 @@ paths: properties: return_code: type: string - description: 状态码 + description: Execution result example: SUCCESS wechat_rate: type: number - description: 微信当前汇率 + description: Wechat exchange rate example: 4.41111 alipay_retail_rate: type: number - description: 支付宝线下接口汇率 + description: Alipay retail exchange rate example: 4.411111 alipay_online_rate: type: number - description: 支付宝线上汇率 + description: Alipay online exchange rate example: 4.411111 /gateway/partners/{partner_code}/orders/{partner_order_id}/refunds/{partner_refund_id}: put: - summary: 发起退款 - description: 一笔支付订单可以分多次退款,退款总金额不得超过实际支付金额,退款币种与支付订单一致 + summary: Refund Order + description: | + One payment order can create more than one refund orders. Total amount of all refund orders must be less than or equal to the actual paid amount and the currency of refund order is the same as the payment order. tags: - QRCode - JSAPI @@ -967,11 +993,11 @@ paths: - name: partner_order_id in: path required: true - description: 需要退款订单的单号 + description: Payment order id in merchant's system - name: partner_refund_id in: path required: true - description: 退款单号 + description: Refund id in merchant's system requestBody: content: application/json: @@ -982,10 +1008,10 @@ paths: properties: fee: type: integer - description: 退款金额,单位是货币最小单位,单个订单退款单金额总和不能超过用户支付金额 + description: 退Refund amount. Use base unit of the currency. Total amount of all refund orders must be less than actual paid amount. device_id: type: string - description: 操作设备id + description: ID of the device which sends the request responses: 200: description: Refund @@ -994,7 +1020,7 @@ paths: schema: $ref: 'components_order.yml#/refundStatus' get: - summary: 查询退款 + summary: Check Refund Status tags: - QRCode - JSAPI @@ -1012,11 +1038,11 @@ paths: - name: partner_order_id in: path required: true - description: 订单的单号 + description: Payment order id in merchant's system - name: partner_refund_id in: path required: true - description: 退款单号 + description: Refund id in merchant's system responses: 200: description: Refund Status @@ -1026,10 +1052,13 @@ paths: $ref: 'components_order.yml#/refundStatus' /gateway/partners/{partner_code}/transactions: get: - summary: 查询流水 + summary: Check Transactions description: | - 本接口将列出商户当日所有流水,包括所有接口(含非网关接口)支付通道的付款、RoyalPay优惠补贴、退款、 退款失败补正、系统补正、营销账户转入转出等,不含清算信息 - 注意一笔付款订单或退款订单均可能对应多条流水记录 + This Api will list all transactions for current merchant in the day, containing all payment methods(include no gateway methods) and all payment channels such as payment, + RoyalPay discount cashback, refunds, credit for failure refunds, system pay back, + cashback account income/outcome, etc. Settlement transactions will not be contained. + + **Note: A payment order or refund order can contains several transaction records** tags: - PublicApi parameters: @@ -1043,7 +1072,7 @@ paths: type: string in: query required: true - description: 账单日期,'yyyyMMdd'格式,GMT+10,只能查今天以前的账单 + description: Transaction date. Format as 'yyyyMMdd', GMT+10. Only transaction before today can be query example: 20200315 responses: 200: @@ -1065,13 +1094,13 @@ paths: SUCCESS transaction_count: type: integer - description: 流水条数 + description: transactions number order_count: type: integer - description: 付款条数 + description: credit number refund_count: type: integer - description: 退款条数 + description: debit number transactions: type: array items: @@ -1086,10 +1115,13 @@ paths: description: target settlement date, maybe delay due to holidays and bank issues(yyyy-MM-dd) /gateway/partners/{partner_code}/settlements: get: - summary: 查看清算详情 + summary: Check Settlements description: | - 本接口将列出商户查询日期清算的所有流水,包括所有接口(含非网关接口)支付通道的付款、RoyalPay优惠补贴、退款、 退款失败补正、系统补正、营销账户转入转出等 - 注意一笔付款订单或退款订单均可能对应多条流水记录 + This Api will list all transactions with the settlement this day, containing all payment methods(include no gateway methods) + and all payment channels such as payment, RoyalPay discount cashback, refunds, credit for failure refunds, + system pay back, cashback account income/outcome, etc. + + **Note: A payment order or refund order can contains several transaction records** tags: - PublicApi parameters: @@ -1102,7 +1134,7 @@ paths: format: date pattern: yyyyMMdd type: string - description: 清算日期,'yyyyMMdd'格式,GMT+10,只能查今天以前 + description: Settle date. Format as 'yyyyMMdd' ,GMT+10. Only settlement before today can be query required: true responses: 200: @@ -1119,56 +1151,58 @@ paths: SUCCESS result_code: type: string - description: 业务Execute Result + description: Process Result example: SUCCESS settle_from: type: string format: date - description: 订单起始日期:yyyyMMdd + description: 'Transaction date from, yyyyMMdd' settle_to: type: string format: date - description: 订单截止日期:yyyyMMdd + description: Transaction date to, yyyyMMdd settle_days: type: string - description: 清算周期 + description: Settle delay example: T+2 transaction_count: type: integer - description: 流水条数 + description: transaction record count order_count: type: integer - description: 付款条数 + description: credit count refund_count: type: integer - description: 退款条数 + description: debit count total_credit: type: integer - description: 入账总金额(AUD分) + description: total credit fee(AUD cent) total_debits: type: integer - description: 支出总金额(AUD分) + description: total debit fee(AUD cent) total_surcharge: type: integer - description: 手续费总额(AUD分) + description: Total surcharge(AUD cent) total_transfer: type: integer - description: 打款总额(AUD分) + description: Total transfer amount(AUD cent) transactions: type: array items: $ref: 'components_order.yml#/transactionItem' /notify: post: - summary: 到账通知 + summary: Order Paid Notify description: | - 若订单创建时提供了notify_url,系统会在用户支付成功后向这个地址主动发送支付成功状态推送,请求方式为POST - 与服务器API不同,推送校验参数会包含在json内,商户系统应该验证校验参数,确定来源正确后再次进行订单接口查询确认订单支付状态再进行后续操作。 - 商户系统收到请求后应按要求返回参数,若RoyalPay未收到合法参数,视为商户未接收成功,推送动作首次触发会重试3次,随后24小时内每10分钟推送一次,直到返回200状态码。 - 商户系统应当能够处理收到的重复请求。 - 商户系统收到通知后以防万一应调用主动查询接口确认订单状态。 + If notify_url is provided when order is created. System will post request to this url when the payment succeeds. + Request method is POST. Different from Server APIs, sign parameters will be included in json entity. + Partner system shall valid them to prevent fake requests. Partner system shall response with correct parameters. + If RoyalPay did not receive valid response, system will regard as receiving failed and retry the notification. + System will retry up to3 times. Partner system shall be able to handle the repeated requests. + + **It is recommended to actively call the query API to confirm the payment status after receiving the push, so as to prevent other third parties from forging the push!** tags: - SDK Payment - CB Bank @@ -1188,53 +1222,53 @@ paths: time: type: integer format: int64 - description: UTC时间戳 + description: UTC timestamp in millis nonce_str: type: string - description: 随机字符串 + description: Random string sign: type: string - description: 签名 + description: Sign partner_order_id: type: string - description: 商户单号 + description: Partner order id channel_order_id: type: string - description: 渠道方交易单号 + description: PayChannel(Alipay、Wechat) Transaction Trade No order_id: type: string - description: RoyalPay订单号 + description: RoyalPay order id total_fee: type: integer - description: 订单金额,单位是最小货币单位 + description: Order amount real_fee: type: integer - description: 支付金额,单位是最小货币单位 + description: Actual paid amount rate: type: number - description: 交易时使用的汇率,1AUD=?CNY + description: Exchange Rate used while trading. 1AUD=?CNY currency: type: string - description: 币种,AUD + description: Currency, AUD channel: type: string - description: 交易渠道 + description: Payment Channel Alipay, AlipayOnline, Wechat create_time: type: string format: 'date-time' pattern: yyyy-MM-dd HH:mm:ss - description: 订单创建时间,格式为'yyyy-MM-dd HH:mm:ss',GMT+10 + description: Time when order is created, which is formatted in 'yyyy-MM-dd HH:mm:ss', GMT+10 pay_time: type: string format: 'date-time' pattern: yyyy-MM-dd HH:mm:ss - description: 订单支付时间,格式为'yyyy-MM-dd HH:mm:ss',GMT+10 + description: Time when order is paid, which is formatted in 'yyyy-MM-dd HH:mm:ss', GMT+10. responses: 200: description: OK /customs/partners/{partner_code}/declare/report/{client_report_id}: put: - summary: 创建报关单 + summary: Create Custom Declare tags: - Custom parameters: @@ -1252,37 +1286,37 @@ paths: properties: order_id: type: string - description: 商户支付订单号,要求同一商户唯一 + description: Partner order id custom: type: string - description: 海关编号 * [渠道海关编号](https://www.royalpay.com.au/downloads/CustomsNO.xlsx) + description: Customs No. * [Channel Custom No](https://www.royalpay.com.au/downloads/CustomsNO.xlsx) mch_custom_id: type: string - description: 商户在海关备案的编号 + description: Customs record id of merchant mch_custom_name: type: string - description: 商户海关备案名称 + description: Customs record name of merchant sub_order: type: array - description: 子订单(拆单) + description: Child orders(If split order required) items: type: object properties: sub_order_no: type: string - description: 商户子订单号 + description: Sub order no fee_type: type: string - description: 币种代码 + description: currency default: CNY enum: - CNY order_fee: type: number - description: 子订单金额,单位是元 + description: Sub order price. unit is Yuan transport_fee: type: number - description: 子订单物流金额,单位是元 + description: Sub order transport fee. unit is Yuan responses: 200: description: Custom @@ -1291,7 +1325,7 @@ paths: schema: $ref: 'components_order.yml#/customInfo' get: - summary: 查询报关单 + summary: Query Custom Report tags: - Custom parameters: @@ -1310,8 +1344,8 @@ paths: $ref: 'components_order.yml#/customInfo' /customs/partners/{partner_code}/redeclare/report/{client_report_id}: put: - summary: 重新提交报关单 - description: 用于重新提交未报关成功的报关单 + summary: Redeclare Custom Report + description: Used to resubmit the attachment information of the order required by the merchant. tags: - Custom parameters: @@ -1334,31 +1368,34 @@ components: type: apiKey in: query name: nonce_str - description: 随机字符串 + description: Random String time: type: apiKey in: query name: time - description: 带毫秒的Unix时间戳,务必检查服务器时间和时区配置。计算服务器上的UTC时间是否匹配真实UTC时间即可。允许误差±5分钟 + description: | + Unix Timestamp with millis. It is recommended to check your server time and timezone configuration. + You can calculate the UTC time according your server time & timezone and check if it was correct. sign: type: apiKey in: query name: sign description: | - 商户签约后会分配得到一个partner_code和credential_code用于签名,其中partner_code随请求传递,credential_code务必自行存储不得外泄,仅作为签名参数。 + After merchants signed contract. They will get a `partner_code` and `credential_code` to make signatures. + `partner_code` is passed with requests. `credential_code` must be store safe in merchant side. it only used to make signatures. - 每次请求都必须加入签名信息作为请求校验。校验参数全部以Query Param参数的方式附加在URL后面,顺序不分先后。 + Each requests must add sign parameters as authentication. Sign params will tailed after request url as query param. And no sort is required. - 签名过程: + Signature progress: - 1. 连接生成签名的原始字符串,需要4个参数,使用&连接,无需转码 + 1. Create origin string for validation. required 4 parameters and connect them with &. Translating is not required. > valid_string=partner_code&time&nonce_str&credential_code - 2. 使用SHA256对valid_string进行签名,并转换为小写字符串 + 2. Use SHA256 to sign valid_string and get lowercased hex string > sign=hex(sha256(valid_string)).toLowerCase() - 3. 在请求中将签名使用的time, nonce_str和生成的sign作为query参数发送 + 3. Pass used `time`, `nonce_str` and generated `sign` as query parameter in requests. - > 签名测试地址:https://mpay.royalpay.com.au/sign_test.html + > Signature test address: https://mpay.royalpay.com.au/sign_test.html diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java index f994fa5f5..c25558ab4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/CleanService.java @@ -46,7 +46,7 @@ public interface CleanService { void settlementXlsx(Date date, HttpServletResponse response) throws IOException; - List getXlsx(Date dt, String bank, List logs) throws IOException; + List getXlsx(Date dt, List logs) throws IOException; List getSettleLogs(Date dt, List clearIds); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java index ed54117d0..ac308ef7b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java @@ -435,28 +435,17 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } @Override - public List getXlsx(Date dt, String bank, List logs) throws IOException { + public List getXlsx(Date dt, List logs) throws IOException { List result = new ArrayList<>(); - int fileIndex = 1; - if (logs.size() > 1) { - for (JSONObject log : logs) { - String filename = "Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMMdd") + "_" + fileIndex + ".xlsx"; - JSONObject file = new JSONObject(); - file.put("name", filename); - List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); - details = mergeBatchSettleClients(details); - file.put("byteArr", generateSettleXlsxFile(dt, details, bank)); - result.add(file); - fileIndex++; - } - } else { - for (JSONObject log : logs) { - String filename = "Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMMdd") + ".xlsx"; + for (JSONObject log : logs) { + List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); + List banks = details.stream().map(detail -> detail.getString("settle_bank")).distinct().collect(Collectors.toList()); + for (String bank : banks) { + String filename = String.format("Merchant_Setlement_Info_%s_%s.xlsx", bank, DateFormatUtils.format(log.getDate("operate_time"), "yyyyMMddHHmmss")); JSONObject file = new JSONObject(); file.put("name", filename); - List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); - details = mergeBatchSettleClients(details); - file.put("byteArr", generateSettleXlsxFile(dt, details, bank)); + List mergedDetails = mergeBatchSettleClients(details.stream().filter(detail -> bank.equals(detail.getString("settle_bank"))).collect(Collectors.toList())); + file.put("byteArr", generateSettleXlsxFile(dt, mergedDetails, bank)); result.add(file); } } @@ -1373,7 +1362,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider List attachList = new ArrayList<>(); JSONObject attach1 = new JSONObject(); List clearLogs = getSettleLogs(date, clearIds); - List xlsxFileList = getXlsx(date, "CBA", clearLogs); + List xlsxFileList = getXlsx(date, clearLogs); if (xlsxFileList.size() > 1) { fileName1 += ".zip"; attach1.put("content", Base64.encodeBase64String(getZipByteArr(xlsxFileList))); @@ -1439,7 +1428,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider ExtParamsUtils.getExtParamsValue(log.getString("plan_detail"), detail -> StringUtils.defaultIfEmpty(detail.getString("remark"), detail.getString("plan_id"))))) .collect(Collectors.joining(",")); - sendTaskFinishMessages(ManagerRole.FINANCIAL_STAFF, "清算文件已发送清算方:"+detailDescription, "发送清算通知"); + sendTaskFinishMessages(ManagerRole.FINANCIAL_STAFF, "清算文件已发送清算方:" + detailDescription, "发送清算通知"); if (autoMarkSent) { if (!clearIds.isEmpty()) { clearingLogMapper.lockSettlementsById(clearLogs.stream().map(log -> log.getString("clearing_id")).collect(Collectors.toList())); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java index a6972d809..7b606adc5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java @@ -20,6 +20,9 @@ public interface ClientRateMapper { List listClientRates(@Param("client_id") int clientId, @Param("rate_name") String rateName); + @AutoSql(SqlType.SELECT) + JSONObject findRateByRateId(@Param("client_rate_id") String rateId); + @AutoSql(SqlType.INSERT) void saveRate(JSONObject rateConfig); @@ -39,23 +42,22 @@ public interface ClientRateMapper { @Param("clean_days") Integer cleanDays, @Param("rate_name") String rateName); - - List latestConfig(@Param("client_id")int client_id,@Param("rate_name") String rate_name); + List latestConfig(@Param("client_id") int client_id, @Param("rate_name") String rate_name); //Task - List maxChannelExpiryTime(@Param("client_id")int client_id,@Param("rate_name")String rate_name); + List maxChannelExpiryTime(@Param("client_id") int client_id, @Param("rate_name") String rate_name); - List getAllExpiry(@Param("expiry_date")Date expiry_date); + List getAllExpiry(@Param("expiry_date") Date expiry_date); List getAllClientRateExpiryMerchants(); void postponeMerchantRateByClientId(int clientId); - JSONObject latestChannelCleanDays(@Param("rate_name")String rate_name, @Param("client_id")int client_id); + JSONObject latestChannelCleanDays(@Param("rate_name") String rate_name, @Param("client_id") int client_id); - JSONObject latestCardChannelCleanDays(@Param("rate_name")String rate_name, @Param("client_id")int client_id); + JSONObject latestCardChannelCleanDays(@Param("rate_name") String rate_name, @Param("client_id") int client_id); - JSONObject latestExpiryConfig(@Param("client_id")int client_id,@Param("rate_name") String rate_name); + JSONObject latestExpiryConfig(@Param("client_id") int client_id, @Param("rate_name") String rate_name); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 291435655..b52df74a7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -86,19 +86,17 @@ public interface ClientManager { void checkAndSendInitEmail(JSONObject manager, String clientMoniker); - void sendOpenEmail(final JSONObject client, String username, String pwd); - -// void sendInitEmail(JSONObject account,JSONObject client, String username, String pwd); void markApproveEmailSendStatus(String clientMoniker, JSONObject manager); void checkEmailStatus(); - void newCheckEmailStatus(); - @Transactional void switchPermission(JSONObject manager, String clientMoniker, String permissionKey, boolean allow); + @Transactional + void modifyUPayProfile(JSONObject manager, String clientMoniker, String profileKey, boolean allow); + @Transactional void switchChannelPermission(JSONObject manager, String clientMoniker, String channel, boolean allow); @@ -176,7 +174,7 @@ public interface ClientManager { List listSubClients(JSONObject manager, String clientMoniker); - JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker,String searchText, int page); + JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker, String searchText, int page); List listSubClients(int clientId); @@ -210,6 +208,7 @@ public interface ClientManager { /** * 获取所有设备Id分类 + * * @param clientMoniker * @param client_type * @param client_ids @@ -253,9 +252,9 @@ public interface ClientManager { void revertClient(String clientMoniker, JSONObject manager); - void updateClientIdInfo(String clientMoniker,JSONObject params, JSONObject manager); + void updateClientIdInfo(String clientMoniker, JSONObject params, JSONObject manager); - void updateMWRiskInfoByClient(String clientMoniker,JSONObject params, JSONObject manager); + void updateMWRiskInfoByClient(String clientMoniker, JSONObject params, JSONObject manager); JSONObject getAuthFiles(JSONObject manager, String clientMoniker); @@ -287,7 +286,7 @@ public interface ClientManager { List uploadKycFilesForWaitCompliance(JSONObject manager, String clientMoniker, ClientKycFilesInfo filesInfo); - List uploadKycFilesForWaitComplianceForApp(JSONObject account, String clientMoniker, JSONObject filesInfo,String fileType); + List uploadKycFilesForWaitComplianceForApp(JSONObject account, String clientMoniker, JSONObject filesInfo, String fileType); List uploadAuthFilesForWaitCompliance(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo); @@ -307,6 +306,7 @@ public interface ClientManager { /** * 提交资料,申请卡支付 + * * @param clientMoniker * @param manager */ @@ -392,7 +392,7 @@ public interface ClientManager { void getAggregateCardAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; - void getAggregateCardPromotionaAgreeFile(String clientMoniker, JSONObject manager, boolean renewal,String promotionalEffectiveDate,int promotionalPeriod) throws Exception; + void getAggregateCardPromotionaAgreeFile(String clientMoniker, JSONObject manager, boolean renewal,String rateid,HttpServletResponse httpResponse); void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; @@ -587,7 +587,7 @@ public interface ClientManager { boolean getMergeSettleStatus(JSONObject client); - void changeExtParams(String clientMoniker,JSONObject manager, JSONObject params); + void changeExtParams(String clientMoniker, JSONObject manager, JSONObject params); RPayMerchantEntity applyMWMerchantId(String clientMoniker, JSONObject manager); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientModifySupport.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientModifySupport.java index 8d32edf4e..34b6a6fc1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientModifySupport.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientModifySupport.java @@ -1,19 +1,21 @@ package au.com.royalpay.payment.manage.merchants.core; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify; +import au.com.royalpay.payment.manage.merchants.entity.ClientModifyOperation; /** * Create by yixian at 2018-04-12 16:24 */ public interface ClientModifySupport { + void processModify(ClientModifyOperation modify); + void processClientModify(ClientModify clientModify); - void processClientConfigModify(ClientConfigModify clientConfigModify); + void processClientConfigModify(ClientModify clientConfigModify); - void processClientConfigModify(ClientConfigModify clientConfigModify, boolean onlyModifyConfig); + void processClientConfigModify(ClientModify clientConfigModify, boolean onlyModifyConfig); void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify); } 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 9172a14c7..5645d1efe 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 @@ -33,14 +33,20 @@ import au.com.royalpay.payment.manage.gateway.core.GatewayMerchantApply; import au.com.royalpay.payment.manage.kyc.enums.FilesAuthEnum; import au.com.royalpay.payment.manage.management.sysconfig.core.impls.PermissionPartnerManagerImpl; import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper; -import au.com.royalpay.payment.manage.mappers.log.*; +import au.com.royalpay.payment.manage.mappers.log.ClearingDetailMapper; +import au.com.royalpay.payment.manage.mappers.log.ClearingLogMapper; +import au.com.royalpay.payment.manage.mappers.log.ClientsOperationLogMapper; +import au.com.royalpay.payment.manage.mappers.log.LogClientSubMerchantIdMapper; import au.com.royalpay.payment.manage.mappers.payment.CommonSubMerchantIdMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper; 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.*; +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.entity.impls.*; import au.com.royalpay.payment.manage.merchants.enums.UPayAuthFileEnum; import au.com.royalpay.payment.manage.notice.core.MailService; @@ -102,6 +108,9 @@ import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Font; import org.dom4j.Element; +import org.joda.time.DateTime; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -109,13 +118,11 @@ import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisherAware; -import org.springframework.context.MessageSource; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.Model; -import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.multipart.MultipartFile; @@ -138,7 +145,6 @@ import java.security.InvalidParameterException; import java.security.KeyPair; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.List; import java.util.*; @@ -195,16 +201,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private OrgMapper orgMapper; @Resource - private LogSettleMailMapper logSettleMailMapper; - @Resource - private CommoditiesMapper commoditiesMapper; - @Resource private ActClientInvitationCodeMapper actClientInvitationCodeMapper; @Resource private MailService mailService; - // todo 作用 - @Resource - private ClientComplyValidator[] validators; @Resource private ClientModifySupport clientModifySupport; @@ -260,8 +259,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private ClientContractService clientContractService; @Resource - private MessageSource messageSource; - @Resource private ClientsOperationLogMapper clientsOperationLogMapper; @Resource private LogClientSubMerchantIdMapper logClientSubMerchantIdMapper; @@ -321,6 +318,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private RPayMerchantMapper rPayMerchantMapper; @Resource private SysClientUpayProfileMapper sysClientUpayProfileMapper; + DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMM yyyy"); @Resource @@ -1310,73 +1308,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } - - @Override - public void sendOpenEmail(final JSONObject client, String username, String pwd) { - JSONObject model = new JSONObject(); - model.put("username", username); - model.put("password", pwd); - model.put("client_moniker", client.getString("client_moniker")); - model.put("contact_person", client.getString("contact_person")); - model.put("credential_code", client.getString("credential_code")); - List bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); - // todo Velocity - Context ctx = new Context(); - ctx.setVariable("bds", bds); - ctx.setVariable("short_name", client.getString("short_name")); - ctx.setVariable("password", pwd); - ctx.setVariable("username", username); - ctx.setVariable("client_moniker", client.getString("client_moniker")); - ctx.setVariable("contact_person", client.getString("contact_person")); - ctx.setVariable("credential_code", client.getString("credential_code")); - - final String content = thymeleaf.process("mail/new_client_notice", ctx); - // final String content = VelocityEngineUtils.mergeTemplateIntoString(null, "mail/new_client_notice.vm", - // "utf-8", model); - ctx.setVariable("password", "*****"); - final String contentBd = thymeleaf.process("mail/new_client_notice", ctx); - final List mailTos = new ArrayList<>(); - String mailTo = client.getString("contact_email"); - if (StringUtils.isEmpty(mailTo)) { - throw new EmailException("Client Contact Email is invalid"); - } - mailTos.add(mailTo); - JSONObject clientLegal = sysClientLegalPersonMapper.findRepresentativeInfo(client.getIntValue("client_id")); - if (clientLegal != null && StringUtils.isNotBlank(clientLegal.getString("email"))) { - mailTos.add(clientLegal.getString("email")); - } - - final List emails = new ArrayList<>(); - for (JSONObject bd : bds) { - String email = bd.getString("email"); - if (StringUtils.isNotEmpty(email)) { - emails.add(email); - } - } - new Thread() { - @Override - public void run() { - try { - String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", StringUtils.join(mailTos, ","), "", content); - mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", emails.isEmpty() ? "" : StringUtils.join(emails, ","), - "", contentBd); - JSONObject clientUpdate = new JSONObject(); - clientUpdate.put("client_id", client.getIntValue("client_id")); - clientUpdate.put("approve_email_send", 3); - clientUpdate.put("approve_email_id", emailId); - clientMapper.update(clientUpdate); - } catch (Exception e) { - JSONObject clientUpdate = new JSONObject(); - clientUpdate.put("client_id", client.getIntValue("client_id")); - clientUpdate.put("approve_email_send", 0); - clientUpdate.put("approve_email_id", null); - clientMapper.update(clientUpdate); - throw new EmailException("Email Sending Failed", e); - } - } - }.start(); - } - public void sendInitEmail(final JSONObject client, String username, String pwd, boolean isUpayAuditPass) { logger.debug("sending email after comply"); JSONObject model = new JSONObject(); @@ -1386,7 +1317,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid model.put("contact_person", client.getString("contact_person")); model.put("credential_code", client.getString("credential_code")); List bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); - // todo Velocity Context ctx = new Context(); ctx.setVariable("bds", bds); ctx.setVariable("short_name", client.getString("short_name")); @@ -1395,10 +1325,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid ctx.setVariable("client_moniker", client.getString("client_moniker")); ctx.setVariable("contact_person", client.getString("contact_person")); ctx.setVariable("credential_code", client.getString("credential_code")); + ctx.setVariable("card_approving", isUpayAuditPass); final String content = thymeleaf.process("mail/new_client_notice", ctx); - // final String content = VelocityEngineUtils.mergeTemplateIntoString(null, "mail/new_client_notice.vm", - // "utf-8", model); ctx.setVariable("password", "*****"); final String contentBd = thymeleaf.process("mail/new_client_notice", ctx); final List mailTos = new ArrayList<>(); @@ -1457,32 +1386,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid }.start(); } - /** - * public void sendInitEmail(JSONObject account, final JSONObject client, String username, String pwd) { - * logger.debug("sending email after comply"); JSONObject model = new JSONObject(); model.put("username", username); - * model.put("password", pwd); model.put("client_moniker", client.getString("client_moniker")); - * model.put("contact_person", client.getString("contact_person")); model.put("credential_code", - * client.getString("credential_code")); List bds = - * clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); // todo Velocity Context - * ctx = new Context(); ctx.setVariable("bds", bds); ctx.setVariable("password", pwd); ctx.setVariable("username", - * username); ctx.setVariable("client_moniker", client.getString("client_moniker")); - * ctx.setVariable("contact_person", client.getString("contact_person")); ctx.setVariable("credential_code", - * client.getString("credential_code")); ctx.setVariable("short_name", client.getString("short_name")); final String - * content = thymeleaf.process("mail/new_client_notice", ctx); // final String content = - * VelocityEngineUtils.mergeTemplateIntoString(null, "mail/new_client_notice.vm", // "utf-8", model); final String - * mailTo = client.getString("contact_email"); if (StringUtils.isEmpty(mailTo)) { throw new EmailException("Client - * Contact Email is invalid"); } final Set emails = new HashSet<>(); for (JSONObject bd : bds) { String - * email = bd.getString("email"); if (StringUtils.isNotEmpty(email)) { emails.add(email); } } new Thread() { - * - * @Override public void run() { try { SendMail sendMail = new SendMail(); Set to = new HashSet<>(); - * to.add(mailTo); sendMail.setFrom("info@mail.royalpay.com.au"); sendMail.setMailTos(to); - * sendMail.setMailCcs(emails); sendMail.setTitle("Your RoyalPay Cross-border Payment has been set up"); - * sendMail.setContent(content); sendMail.setTags(tags); JSONObject mailResult = - * mailGunService.sendMail(sendMail); clientModifySupport.processClientModify(new EmailModify(account, - * client.getString("client_moniker"), 3, mailResult.getString("mail_id"))); } catch (Exception e) { - * clientModifySupport.processClientModify(new EmailModify(account, client.getString("client_moniker"), 0, - * null)); throw new EmailException("Email Sending Failed", e); } } }.start(); } - */ public void sendAuthInitEmail(JSONObject account, final JSONObject client) { logger.debug("sending email after comply about a new partner opening by quick access"); @@ -1588,48 +1491,27 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void newCheckEmailStatus() { - List clients = clientMapper.listClientsWithEmailNotVerify(); - for (JSONObject client : clients) { - try { - String emailId = client.getString("approve_email_id"); - JSONObject status = mailSendMapper.find(emailId, client.getString("contact_email")); - if (status != null) { - int statusNo = status.getIntValue("status"); - logger.debug("get mail status:" + emailId + "--" + statusNo); - int mailStatus = 3; - switch (statusNo) { - case 1: - mailStatus = 1; - break; - case 2: - mailStatus = 2; - break; - } - updateClientApproveEmailStatus(mailStatus, null, client.getString("client_moniker")); - } else { - logger.debug("get mail status:" + emailId + "-- none"); - // updateClientApproveEmailStatus(client.getIntValue("client_id"), 0); - } - - } catch (Exception e) { - logger.error("check email status failed", e); - } + public void switchPermission(JSONObject manager, String clientMoniker, String permissionKey, boolean allow) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); } + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, permissionKey, allow)); } @Override - public void switchPermission(JSONObject manager, String clientMoniker, String permissionKey, boolean allow) { + @Transactional + public void modifyUPayProfile(JSONObject manager, String clientMoniker, String profileKey, boolean allow) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } - clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, permissionKey, allow)); - JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id")); - if (upayProfileInfo != null) { - upayProfileInfo.put(permissionKey, allow); - sysClientUpayProfileMapper.update(upayProfileInfo); - } + clientModifySupport.processModify(new CustomSwitchModify(manager, clientMoniker, profileKey, allow, cli -> { + JSONObject profileUpdate = new JSONObject(); + profileUpdate.put(profileKey, allow); + profileUpdate.put("client_id", cli.getIntValue("client_id")); + sysClientUpayProfileMapper.update(profileUpdate); + })); } @Override @@ -1730,7 +1612,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject account = clientAccountMapper.findById(accountId); if (clientMoniker != null) { JSONObject client = getClientInfoByMoniker(clientMoniker); - Assert.notNull(client); //父商户全局管理子商户时候,跳过 if (account.getIntValue("client_id") != client.getIntValue("client_id")) { //登录用户所属商户 @@ -1853,7 +1734,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override public void togglePayNotice(JSONObject account, String clientMoniker, boolean enable) { JSONObject partner = getClientInfoByMoniker(clientMoniker); - Assert.notNull(partner); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "enable_pay_notice", enable)); clientInfoCacheSupport.clearClientCache(partner.getIntValue("client_id")); } @@ -2065,11 +1945,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid config.getDoubleValue("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { return; } - List existRate = clientRateMapper.listCurrentClientRates(clientId, config.getDate("active_time"), channel); - for (JSONObject rateLog : existRate) { - rateLog.put("expiry_time", DateUtils.addDays(config.getDate("active_time"), -1)); - clientRateMapper.updateConfig(rateLog); - } if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getString("type"))) { JSONObject extRateParams = new JSONObject() {{ put("domestic_rate_value", config.getBigDecimal("rate_value")); @@ -3102,12 +2977,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override @Transactional - public void getAggregateCardPromotionaAgreeFile(String clientMoniker, JSONObject manager, boolean renewal, String promotionalEffectiveDate, int promotionalPeriod) throws ParseException { + public void getAggregateCardPromotionaAgreeFile(String clientMoniker, JSONObject manager, boolean renewal, String rateid, HttpServletResponse httpResponse) { JSONObject client = clientMapper.findClientByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } - exportPromotionalOfferPDF(clientMoniker, manager, promotionalEffectiveDate, promotionalPeriod); + exportPromotionalOfferPDF(clientMoniker, manager, rateid, httpResponse); } @Override @@ -3142,7 +3017,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("clean_days", p.getString("clean_days")); } else if ("Alipay".equals(rate_name)) { client.put("alipay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - }else if ("AlipayOnline".equals(rate_name)) { + } else if ("AlipayOnline".equals(rate_name)) { client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); } }); @@ -7127,7 +7002,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject legalInfo = sysClientLegalPersonMapper.findRepresentativeInfo(clientId); //装在数据 JSONObject info = new JSONObject(); - info.put("down_date", convertDateEnglish(new Date()));//下载文件日期 + info.put("down_date", formatter.print(new DateTime()));//下载文件日期 info.put("bussiness_name", (client.containsKey("business_name") ? client.getString("business_name") : legalInfo.getString("representative_person")) + " " + client.getString("abn"));//商圈类型 info.put("partner_address", client.getString("address"));//商家店铺地址 info.put("partner_country", client.getString("country"));//国家 @@ -7139,7 +7014,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid info.put("annual_rate", cardAnnualRate);//年费率 info.put("cost_per_transaction", clientRate.getString("transaction_fee"));//每次交易成本 info.put("domestic_fee", cardRate.getString("domestic_rate_value"));//国内服务费 - info.put("international_fee", cardRate.getString("overseas_rate_value"));//国际服务费 + info.put("international_fee", upayProfileInfo.getBoolean("enable_international_card") ? cardRate.getString("overseas_rate_value") : "-");//国际服务费 BigDecimal reserve = (upayProfileInfo.getBigDecimal("expected_card_revenue").multiply(new BigDecimal(0.005)).setScale(0, RoundingMode.HALF_UP)); info.put("account_reserve", reserve.compareTo(new BigDecimal(200)) <= 0 ? new BigDecimal(200).toPlainString() : reserve.toPlainString());//账户储备金 //银行账号信息 @@ -7150,15 +7025,25 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return info; } - private void exportPromotionalOfferPDF(String clientMoniker, JSONObject manager, String promotionalEffectiveDate, int promotionalPeriod) throws ParseException { - Date date = DateUtils.parseDate(promotionalEffectiveDate, "yyyy-MM-dd"); - JSONObject info = convertPromotionalOfferInfo(clientMoniker, convertDateEnglish(date), promotionalPeriod); - String pdfPath = this.getClass().getClassLoader().getResource("").getPath() + "/templates/pdf/promotional_offer.pdf"; + private void exportPromotionalOfferPDF(String clientMoniker, JSONObject manager, String rateid, HttpServletResponse httpResponse) { + httpResponse.setContentType("application/pdf"); + httpResponse.setHeader("content-disposition", "attachment;filename=" + clientMoniker + "_PROMOTIONAL_OFFER_" + new Date() + ".pdf"); + JSONObject info = convertPromotionalOfferInfo(clientMoniker, rateid); + String pdfPath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("")).getPath() + "templates/pdf/promotional_offer.pdf"; String fileName = clientMoniker + "_Promotional_Offer.pdf"; - publishExcelCardPDFFile(clientMoniker, manager, fileName, pdfPath, info, PROMOTIONAL_OFFER_FILE); + try (ServletOutputStream sos = httpResponse.getOutputStream()) { + File file = new File(fileName); + PdfUtils pdu = new PdfUtils(); + pdu.setTemplatePdfPath(pdfPath); + pdu.setPdfTemplate(info); + ByteArrayOutputStream bos = pdu.templetPdfBos(file); + sos.write(bos.toByteArray()); + } catch (Exception e) { + throw new ServerErrorException(); + } } - private JSONObject convertPromotionalOfferInfo(String clientMoniker, String promotionalEffectiveDate, int promotionalPeriod) { + private JSONObject convertPromotionalOfferInfo(String clientMoniker, String rateid) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -7168,15 +7053,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new BadRequestException("The merchant failed the audit!"); } int clientId = client.getInteger("client_id"); - JSONObject clientRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "rpaypmt_card"); - if (clientRate == null) { + JSONObject currentRate = clientRateMapper.findRateByRateId(rateid); + if (currentRate == null) { throw new BadRequestException("rpaypmt_card rate Not configured"); } - JSONObject cardRate = clientRate.getJSONObject("ext_rates"); + JSONObject cardRate = currentRate.getJSONObject("ext_rates"); JSONObject legalInfo = sysClientLegalPersonMapper.findRepresentativeInfo(clientId); - + JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(clientId); JSONObject info = new JSONObject(); - info.put("down_date", convertDateEnglish(new Date()));//下载文件日期 + info.put("down_date", formatter.print(new DateTime()));//下载文件日期 info.put("bussiness_name", (client.containsKey("business_name") ? client.getString("business_name") : legalInfo.getString("representative_person")) + " " + client.getString("abn"));//商圈类型 info.put("partner_address", client.getString("address"));//商家店铺地址 info.put("partner_country", client.getString("country"));//国家 @@ -7184,9 +7069,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid info.put("partner_bussiness_name", client.getString("business_name"));//商户商用名称 info.put("legal_bussiness", legalInfo.getString("representative_person") + " AS " + (client.containsKey("business_name") ? client.getString("business_name") : legalInfo.getString("representative_person")) + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 info.put("domestic_fee", cardRate.getString("domestic_rate_value"));//国内服务费 - info.put("international_fee", cardRate.getString("overseas_rate_value"));//国际服务费 - info.put("promotional_effective_date", promotionalEffectiveDate); - info.put("promotional_period", promotionalPeriod); + info.put("international_fee", upayProfileInfo.getBoolean("enable_international_card") ? cardRate.getString("overseas_rate_value") : "-");//国际服务费 + info.put("promotional_effective_date", formatter.print(currentRate.getDate("active_time").getTime())); + info.put("promotional_period", formatter.print(currentRate.getDate("expiry_time").getTime())); return info; } @@ -7225,16 +7110,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } - private String convertDateEnglish(Date date) { - String[] months = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Spt", "Oct", "Nov", "Dec"}; - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - int year = calendar.get(Calendar.YEAR); - int month = calendar.get(Calendar.MONTH); - int day = calendar.get(Calendar.DAY_OF_MONTH); - return day + " " + months[month] + " " + year; - } - private void importCardAgreeFile(String clientMoniker, JSONObject manager, String sourceFile, String fileLabel) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientModifySupportImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientModifySupportImpl.java index f1a1b002b..cbfe34003 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientModifySupportImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientModifySupportImpl.java @@ -5,11 +5,10 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.MerchantSignInfoMapper; import au.com.royalpay.payment.manage.merchants.core.ClientInfoCacheSupport; import au.com.royalpay.payment.manage.merchants.core.ClientModifySupport; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientGatewaySignModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify; +import au.com.royalpay.payment.manage.merchants.entity.ClientModifyOperation; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; - import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.stereotype.Service; @@ -34,26 +33,36 @@ public class ClientModifySupportImpl implements ClientModifySupport { private MongoTemplate mongoTemplate; @Override - public void processClientModify(ClientModify modify) { - int clientId = modify.doModify(merchantInfoProvider, clientMapper,mongoTemplate); + public void processModify(ClientModifyOperation modify) { + int clientId = modify.processModify(merchantInfoProvider, mongoTemplate); clientInfoCacheSupport.clearClientCache(clientId); } @Override - public void processClientConfigModify(ClientConfigModify clientConfigModify) { - int clientId =clientConfigModify.doModify(merchantInfoProvider, clientConfigMapper,clientMapper,mongoTemplate); - clientInfoCacheSupport.clearClientCache(clientId); + public void processClientModify(ClientModify modify) { + processModify(modify.setModifyConsumer(modifyObj -> clientMapper.update(modifyObj))); } @Override - public void processClientConfigModify(ClientConfigModify clientConfigModify,boolean onlyModifyConfig) { - int clientId =clientConfigModify.doModify(merchantInfoProvider, clientConfigMapper,clientMapper,mongoTemplate,onlyModifyConfig); - clientInfoCacheSupport.clearClientConfigCache(clientId); + public void processClientConfigModify(ClientModify clientConfigModify) { + processModify(clientConfigModify.setModifyConsumer(modifyObj -> { + clientMapper.update(modifyObj); + clientConfigMapper.update(modifyObj); + })); + } + + @Override + public void processClientConfigModify(ClientModify clientConfigModify, boolean onlyModifyConfig) { + processModify(clientConfigModify.setModifyConsumer(modifyObj -> { + if (!onlyModifyConfig) { + clientMapper.update(modifyObj); + } + clientConfigMapper.update(modifyObj); + })); } @Override public void processClientGatewaySignModify(ClientGatewaySignModify clientGatewaySignModify) { - int clientId =clientGatewaySignModify.doModify(merchantInfoProvider, merchantSignInfoMapper,mongoTemplate); - clientInfoCacheSupport.clearClientCache(clientId); + processModify(clientGatewaySignModify.setMerchantSignInfoMapper(merchantSignInfoMapper)); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientGatewaySignModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientGatewaySignModify.java index 2c72380bf..e3dd601ca 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientGatewaySignModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientGatewaySignModify.java @@ -1,78 +1,39 @@ package au.com.royalpay.payment.manage.merchants.entity; import au.com.royalpay.payment.manage.mappers.system.MerchantSignInfoMapper; -import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog; -import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; -import au.com.royalpay.payment.tools.utils.id.IdUtil; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import org.apache.commons.lang3.StringUtils; -import org.springframework.data.mongodb.core.MongoTemplate; -import org.springframework.transaction.annotation.Transactional; import java.util.Date; -import java.util.Map; -import java.util.stream.Collectors; +import java.util.function.Consumer; /** * Create by yixian at 2018-04-12 16:19 */ -public abstract class ClientGatewaySignModify { +public abstract class ClientGatewaySignModify extends ClientModifyOperation { - private JSONObject account; - - private String clientMoniker; + private MerchantSignInfoMapper merchantSignInfoMapper; public ClientGatewaySignModify(JSONObject account, String clientMoniker) { - this.account = account; - this.clientMoniker = clientMoniker; + super(account, clientMoniker); } protected abstract String business(); protected abstract JSONObject getModifyResult(); - @Transactional - public int doModify(MerchantInfoProvider merchantInfoProvider, MerchantSignInfoMapper merchantSignInfoMapper, MongoTemplate mongoTemplate) { - JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker); - JSONObject clientGatewaySign = merchantSignInfoMapper.findClientSign(clientMoniker); - JSONObject modifyResult = getModifyResult(); - try { - saveModifyHistory(clientGatewaySign, modifyResult, mongoTemplate); - }catch (Exception e){ - - } - int clientId = client.getIntValue("client_id"); - modifyResult.put("client_moniker", clientMoniker); - modifyResult.put("last_update_by", account.getString("account_id")); - modifyResult.put("last_update_date", new Date()); - merchantSignInfoMapper.update(modifyResult); - return clientId; + @Override + protected Consumer getModifyProcess() { + return client -> { + JSONObject modifyResult = getModifyResult(); + modifyResult.put("client_moniker", getClientMoniker()); + modifyResult.put("last_update_by", getAccount().getString("account_id")); + modifyResult.put("last_update_date", new Date()); + merchantSignInfoMapper.update(modifyResult); + }; } - private void saveModifyHistory(JSONObject clientGatewaySign, JSONObject modifyResult, MongoTemplate mongoTemplate) { - if (account == null) { - return; - } - ClientConfigLog clientConfigLog = new ClientConfigLog(); - clientConfigLog.setId(IdUtil.getId()); - clientConfigLog.setBusiness(business()); - clientConfigLog.setClientId(clientGatewaySign.getIntValue("client_id")); - - boolean isPartner = true; - if (StringUtils.isNotEmpty(account.getString("account_id"))) { - isPartner = true; - } - if (StringUtils.isNotEmpty(account.getString("manager_id"))) { - isPartner = false; - } - clientConfigLog.setUserType(isPartner ? "Merchant" : "Manager"); - clientConfigLog.setCreateTime(new Date()); - clientConfigLog.setNewData(modifyResult.toJSONString()); - clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id")); - Map beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, clientGatewaySign::get)); - clientConfigLog.setOriginData(JSON.toJSONString(beforeModify)); - clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name")); - mongoTemplate.save(clientConfigLog); + public ClientGatewaySignModify setMerchantSignInfoMapper(MerchantSignInfoMapper merchantSignInfoMapper) { + this.merchantSignInfoMapper = merchantSignInfoMapper; + return this; } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientModify.java index cf33238d9..d0e036a35 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientModify.java @@ -1,77 +1,32 @@ package au.com.royalpay.payment.manage.merchants.entity; -import au.com.royalpay.payment.manage.mappers.system.ClientMapper; -import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog; -import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; -import au.com.royalpay.payment.tools.utils.id.IdUtil; - -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import org.apache.commons.lang3.StringUtils; -import org.springframework.data.mongodb.core.MongoTemplate; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Date; -import java.util.Map; -import java.util.stream.Collectors; +import java.util.function.Consumer; /** * Create by yixian at 2018-04-12 16:19 */ -public abstract class ClientModify { +public abstract class ClientModify extends ClientModifyOperation { - private JSONObject account; - - private String clientMoniker; + private Consumer modifyConsumer; public ClientModify(JSONObject account, String clientMoniker) { - this.account = account; - this.clientMoniker = clientMoniker; + super(account, clientMoniker); } - protected abstract String business(); - - protected abstract JSONObject getModifyResult(); - - @Transactional - public int doModify(MerchantInfoProvider merchantInfoProvider, ClientMapper clientMapper, MongoTemplate mongoTemplate) { - JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker); - JSONObject modifyResult = getModifyResult(); - try { - saveModifyHistory(client, modifyResult, mongoTemplate); - }catch (Exception e){ - - } - int clientId = client.getIntValue("client_id"); - modifyResult.put("client_id", clientId); - clientMapper.update(modifyResult); - return clientId; + @Override + protected Consumer getModifyProcess() { + return client -> { + JSONObject modifyResult = getModifyResult(); + int clientId = client.getIntValue("client_id"); + modifyResult.put("client_id", clientId); + modifyConsumer.accept(modifyResult); + }; } - private void saveModifyHistory(JSONObject client, JSONObject modifyResult, MongoTemplate mongoTemplate) { - if (account == null) { - return; - } - ClientConfigLog clientConfigLog = new ClientConfigLog(); - clientConfigLog.setId(IdUtil.getId()); - clientConfigLog.setBusiness(business()); - clientConfigLog.setClientId(client.getIntValue("client_id")); - - boolean isPartner = true; - if (StringUtils.isNotEmpty(account.getString("account_id"))) { - isPartner = true; - } - if (StringUtils.isNotEmpty(account.getString("manager_id"))) { - isPartner = false; - } - clientConfigLog.setUserType(isPartner ? "Merchant" : "Manager"); - clientConfigLog.setCreateTime(new Date()); - clientConfigLog.setNewData(modifyResult.toJSONString()); - clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id")); - Map beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get)); - clientConfigLog.setOriginData(JSON.toJSONString(beforeModify)); - clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name")); - mongoTemplate.save(clientConfigLog); + public ClientModify setModifyConsumer(Consumer modifyConsumer) { + this.modifyConsumer = modifyConsumer; + return this; } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientConfigModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientModifyOperation.java similarity index 53% rename from src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientConfigModify.java rename to src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientModifyOperation.java index 18c50176c..d84d8c4ca 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientConfigModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/ClientModifyOperation.java @@ -1,32 +1,26 @@ package au.com.royalpay.payment.manage.merchants.entity; -import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.merchants.beans.mongo.ClientConfigLog; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.utils.id.IdUtil; - import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; - import org.apache.commons.lang3.StringUtils; import org.springframework.data.mongodb.core.MongoTemplate; -import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.Map; +import java.util.function.Consumer; import java.util.stream.Collectors; /** - * Create by yixian at 2018-04-12 16:19 + * Create by davep at 2020-05-12 14:32 */ -public abstract class ClientConfigModify { - - private JSONObject account; - - private String clientMoniker; +public abstract class ClientModifyOperation { + private final JSONObject account; + private final String clientMoniker; - public ClientConfigModify(JSONObject account, String clientMoniker) { + protected ClientModifyOperation(JSONObject account, String clientMoniker) { this.account = account; this.clientMoniker = clientMoniker; } @@ -35,36 +29,21 @@ public abstract class ClientConfigModify { protected abstract JSONObject getModifyResult(); - public int doModify(MerchantInfoProvider merchantInfoProvider, ClientConfigMapper clientConfigMapper, ClientMapper clientMapper, MongoTemplate mongoTemplate) { - JSONObject client = merchantInfoProvider.getClientInfoByMoniker(clientMoniker); - JSONObject modifyResult = getModifyResult(); - try { - saveModifyHistory(client, modifyResult, mongoTemplate); - }catch (Exception e){ + protected abstract Consumer getModifyProcess(); - } - int clientId = client.getIntValue("client_id"); - modifyResult.put("client_id", clientId); - clientConfigMapper.update(modifyResult); - clientMapper.update(modifyResult); - return clientId; - } - - public int doModify(MerchantInfoProvider merchantInfoProvider, ClientConfigMapper clientConfigMapper, ClientMapper clientMapper, MongoTemplate mongoTemplate,boolean onlyModifyConfig) { - JSONObject clientConfig = merchantInfoProvider.getClientConfigInfoByMoniker(clientMoniker); + public int processModify(MerchantInfoProvider merchantInfoProvider, MongoTemplate mongoTemplate) { + JSONObject client = merchantInfoProvider.getClientInfoByMoniker(getClientMoniker()); JSONObject modifyResult = getModifyResult(); try { - saveModifyHistory(clientConfig, modifyResult, mongoTemplate); - }catch (Exception e){ + saveModifyHistory(client, modifyResult, mongoTemplate); + } catch (Exception e) { } - int clientId = clientConfig.getIntValue("client_id"); - modifyResult.put("client_id", clientId); - clientConfigMapper.update(modifyResult); - return clientId; + getModifyProcess().accept(client); + return client.getIntValue("client_id"); } - private void saveModifyHistory(JSONObject client, JSONObject modifyResult,MongoTemplate mongoTemplate) { + protected void saveModifyHistory(JSONObject client, JSONObject modifyResult, MongoTemplate mongoTemplate) { if (account == null) { return; } @@ -86,7 +65,15 @@ public abstract class ClientConfigModify { clientConfigLog.setUserId(isPartner ? account.getString("account_id") : account.getString("manager_id")); Map beforeModify = modifyResult.keySet().stream().collect(Collectors.toMap(key -> key, client::get)); clientConfigLog.setOriginData(JSON.toJSONString(beforeModify)); - clientConfigLog.setUserName(isPartner ? account.getString("display_name") : account.getString("display_name")); + clientConfigLog.setUserName(account.getString("display_name")); mongoTemplate.insert(clientConfigLog); } + + public JSONObject getAccount() { + return account; + } + + public String getClientMoniker() { + return clientMoniker; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CBBankPaypadVersionModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CBBankPaypadVersionModify.java index 4c4db3701..6d87f14ec 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CBBankPaypadVersionModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CBBankPaypadVersionModify.java @@ -1,17 +1,17 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class CBBankPaypadVersionModify extends ClientConfigModify { - private String cbbank_paypad_version; +public class CBBankPaypadVersionModify extends ClientModify { + private String cbbankPaypadVersion; public CBBankPaypadVersionModify(JSONObject account, String clientMoniker, String paypad_version) { super(account, clientMoniker); - this.cbbank_paypad_version = paypad_version; + this.cbbankPaypadVersion = paypad_version; } @Override @@ -23,7 +23,7 @@ public class CBBankPaypadVersionModify extends ClientConfigModify { @Override protected JSONObject getModifyResult() { JSONObject modify = new JSONObject(); - modify.put("cbbank_paypad_version", cbbank_paypad_version); + modify.put("cbbank_paypad_version", cbbankPaypadVersion); return modify; } } \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ClearDaysModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ClearDaysModify.java index b53b5289c..18d53654c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ClearDaysModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/ClearDaysModify.java @@ -1,30 +1,29 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; - +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class ClearDaysModify extends ClientConfigModify { - private int settle_hour; +public class ClearDaysModify extends ClientModify { + private int settleHour; - public ClearDaysModify(JSONObject account, String clientMoniker, int settle_hour) { + public ClearDaysModify(JSONObject account, String clientMoniker, int settleHour) { super(account, clientMoniker); - this.settle_hour = settle_hour; + this.settleHour = settleHour; } @Override protected String business() { - return "修改商户清算截止时间为:"+settle_hour; + return "修改商户清算截止时间为:" + settleHour; } @Override protected JSONObject getModifyResult() { JSONObject modify = new JSONObject(); - modify.put("settle_hour", settle_hour); + modify.put("settle_hour", settleHour); return modify; } } \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CredentialCodeModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CredentialCodeModify.java index b586c1761..83bf41b6e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CredentialCodeModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CredentialCodeModify.java @@ -1,19 +1,18 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; - +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class CredentialCodeModify extends ClientConfigModify { - private String credential_code; +public class CredentialCodeModify extends ClientModify { + private String credentialCode; - public CredentialCodeModify(JSONObject account, String clientMoniker, String credential_code) { + public CredentialCodeModify(JSONObject account, String clientMoniker, String credentialCode) { super(account, clientMoniker); - this.credential_code = credential_code; + this.credentialCode = credentialCode; } @Override @@ -24,7 +23,7 @@ public class CredentialCodeModify extends ClientConfigModify { @Override protected JSONObject getModifyResult() { JSONObject modify = new JSONObject(); - modify.put("credential_code", credential_code); + modify.put("credential_code", credentialCode); return modify; } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CustomSwitchModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CustomSwitchModify.java new file mode 100644 index 000000000..82b180a0d --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CustomSwitchModify.java @@ -0,0 +1,43 @@ +package au.com.royalpay.payment.manage.merchants.entity.impls; + +import au.com.royalpay.payment.manage.merchants.entity.ClientModifyOperation; +import com.alibaba.fastjson.JSONObject; + +import java.util.function.Consumer; + +/** + * Create by yixian at 2018-04-12 16:43 + */ +public class CustomSwitchModify extends ClientModifyOperation { + private final String key; + private final boolean value; + private final Consumer modifyProcess; + + + public CustomSwitchModify(JSONObject account, String clientMoniker, String key, boolean value, Consumer modifyProcess) { + super(account, clientMoniker); + this.key = key; + this.value = value; + this.modifyProcess = modifyProcess; + } + + @Override + protected String business() { + + return (value ? "开启 " : "关闭 ") + key; + } + + @Override + protected JSONObject getModifyResult() { + JSONObject modify = new JSONObject(); + modify.put(key, value); + return modify; + } + + @Override + protected Consumer getModifyProcess() { + return modifyProcess; + } + + +} \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CustomerSurchargeRateModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CustomerSurchargeRateModify.java index 23544c98e..1afc7b5f4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CustomerSurchargeRateModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/CustomerSurchargeRateModify.java @@ -1,7 +1,6 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; - +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; import java.math.BigDecimal; @@ -9,24 +8,24 @@ import java.math.BigDecimal; /** * Create by yixian at 2018-04-12 16:43 */ -public class CustomerSurchargeRateModify extends ClientConfigModify { - private BigDecimal customer_surcharge_rate; +public class CustomerSurchargeRateModify extends ClientModify { + private BigDecimal customerSurchargeRate; - public CustomerSurchargeRateModify(JSONObject account, String clientMoniker, BigDecimal customer_surcharge_rate) { + public CustomerSurchargeRateModify(JSONObject account, String clientMoniker, BigDecimal customerSurchargeRate) { super(account, clientMoniker); - this.customer_surcharge_rate = customer_surcharge_rate; + this.customerSurchargeRate = customerSurchargeRate; } @Override protected String business() { - return "修改商户客户手续费率为:"+customer_surcharge_rate; + return "修改商户客户手续费率为:" + customerSurchargeRate; } @Override protected JSONObject getModifyResult() { JSONObject modify = new JSONObject(); - modify.put("customer_surcharge_rate", customer_surcharge_rate); + modify.put("customer_surcharge_rate", customerSurchargeRate); return modify; } } \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/EmailSendStandByModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/EmailSendStandByModify.java index f8e4f9323..ad9db9163 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/EmailSendStandByModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/EmailSendStandByModify.java @@ -1,7 +1,6 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; - +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; import java.math.BigDecimal; @@ -9,24 +8,24 @@ import java.math.BigDecimal; /** * Create by yixian at 2018-04-12 16:43 */ -public class EmailSendStandByModify extends ClientConfigModify { - private BigDecimal max_order_amount; +public class EmailSendStandByModify extends ClientModify { + private BigDecimal maxOrderAmount; - public EmailSendStandByModify(JSONObject account, String clientMoniker, BigDecimal max_order_amount) { + public EmailSendStandByModify(JSONObject account, String clientMoniker, BigDecimal maxOrderAmount) { super(account, clientMoniker); - this.max_order_amount = max_order_amount; + this.maxOrderAmount = maxOrderAmount; } @Override protected String business() { - return "修改商户最大订单额为:"+max_order_amount; + return "修改商户最大订单额为:" + maxOrderAmount; } @Override protected JSONObject getModifyResult() { JSONObject modify = new JSONObject(); - modify.put("max_order_amount", max_order_amount); + modify.put("max_order_amount", maxOrderAmount); return modify; } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MaxOrderAmountModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MaxOrderAmountModify.java index 87e75bee6..d1c186876 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MaxOrderAmountModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/MaxOrderAmountModify.java @@ -1,7 +1,6 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; - +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; import java.math.BigDecimal; @@ -9,24 +8,24 @@ import java.math.BigDecimal; /** * Create by yixian at 2018-04-12 16:43 */ -public class MaxOrderAmountModify extends ClientConfigModify { - private BigDecimal max_order_amount; +public class MaxOrderAmountModify extends ClientModify { + private BigDecimal maxOrderAmount; - public MaxOrderAmountModify(JSONObject account, String clientMoniker, BigDecimal max_order_amount) { + public MaxOrderAmountModify(JSONObject account, String clientMoniker, BigDecimal maxOrderAmount) { super(account, clientMoniker); - this.max_order_amount = max_order_amount; + this.maxOrderAmount = maxOrderAmount; } @Override protected String business() { - return "修改商户最大订单额为:"+max_order_amount; + return "修改商户最大订单额为:" + maxOrderAmount; } @Override protected JSONObject getModifyResult() { JSONObject modify = new JSONObject(); - modify.put("max_order_amount", max_order_amount); + modify.put("max_order_amount", maxOrderAmount); return modify; } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/OrderExpiryModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/OrderExpiryModify.java index 6ca63adf8..163d874e7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/OrderExpiryModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/OrderExpiryModify.java @@ -1,19 +1,18 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; - +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class OrderExpiryModify extends ClientConfigModify { - private String order_expiry_config; +public class OrderExpiryModify extends ClientModify { + private String orderExpiryConfig; - public OrderExpiryModify(JSONObject account, String clientMoniker, String order_expiry_config) { + public OrderExpiryModify(JSONObject account, String clientMoniker, String orderExpiryConfig) { super(account, clientMoniker); - this.order_expiry_config = order_expiry_config; + this.orderExpiryConfig = orderExpiryConfig; } @Override @@ -24,7 +23,7 @@ public class OrderExpiryModify extends ClientConfigModify { @Override protected JSONObject getModifyResult() { JSONObject modify = new JSONObject(); - modify.put("order_expiry_config", order_expiry_config); + modify.put("order_expiry_config", orderExpiryConfig); return modify; } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/PaypadVersionModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/PaypadVersionModify.java index 6972662ec..ea81abe5d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/PaypadVersionModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/PaypadVersionModify.java @@ -1,18 +1,17 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; - +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class PaypadVersionModify extends ClientConfigModify { - private String paypad_version; +public class PaypadVersionModify extends ClientModify { + private String paypadVersion; - public PaypadVersionModify(JSONObject account, String clientMoniker, String paypad_version) { + public PaypadVersionModify(JSONObject account, String clientMoniker, String paypadVersion) { super(account, clientMoniker); - this.paypad_version = paypad_version; + this.paypadVersion = paypadVersion; } @Override @@ -24,7 +23,7 @@ public class PaypadVersionModify extends ClientConfigModify { @Override protected JSONObject getModifyResult() { JSONObject modify = new JSONObject(); - modify.put("paypad_version", paypad_version); + modify.put("paypad_version", paypadVersion); return modify; } } \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundAuditModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundAuditModify.java index 52de0d4be..c68e90989 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundAuditModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundAuditModify.java @@ -1,23 +1,22 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; - +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class RefundAuditModify extends ClientConfigModify { +public class RefundAuditModify extends ClientModify { private boolean enable; public RefundAuditModify(JSONObject account, String clientMoniker, boolean enable) { - super( account, clientMoniker); + super(account, clientMoniker); this.enable = enable; } @Override protected String business() { - return (enable?"打开":"关闭")+"refund_audit"; + return (enable ? "打开" : "关闭") + "refund_audit"; } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundPWDModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundPWDModify.java index 15e252685..2c3bea1aa 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundPWDModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundPWDModify.java @@ -1,13 +1,12 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; - +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class RefundPWDModify extends ClientConfigModify { +public class RefundPWDModify extends ClientModify { private String refund_pwd; private String refund_pwd_salt; diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SettleHourModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SettleHourModify.java index 8951f5294..cf963abc8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SettleHourModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SettleHourModify.java @@ -1,30 +1,29 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; - +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class SettleHourModify extends ClientConfigModify { - private Integer settle_hour; +public class SettleHourModify extends ClientModify { + private Integer settleHour; - public SettleHourModify(JSONObject account, String clientMoniker, Integer settle_hour) { + public SettleHourModify(JSONObject account, String clientMoniker, Integer settleHour) { super(account, clientMoniker); - this.settle_hour = settle_hour; + this.settleHour = settleHour; } @Override protected String business() { - return "修改商户清算截止时间为:"+settle_hour; + return "修改商户清算截止时间为:" + settleHour; } @Override protected JSONObject getModifyResult() { JSONObject modify = new JSONObject(); - modify.put("settle_hour", settle_hour); + modify.put("settle_hour", settleHour); return modify; } } \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SurchargeModeModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SurchargeModeModify.java index 28cd86c5c..4bd56b6c0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SurchargeModeModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SurchargeModeModify.java @@ -1,6 +1,5 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchAllowSurchargeCreditModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchAllowSurchargeCreditModify.java index 50176f562..a6b676057 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchAllowSurchargeCreditModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchAllowSurchargeCreditModify.java @@ -1,6 +1,5 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchPermissionModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchPermissionModify.java index 0118080b0..c351fe7df 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchPermissionModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/SwitchPermissionModify.java @@ -1,15 +1,14 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; - +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class SwitchPermissionModify extends ClientConfigModify { - private String key; - private boolean value; +public class SwitchPermissionModify extends ClientModify { + private final String key; + private final boolean value; public SwitchPermissionModify(JSONObject account, String clientMoniker, String key, boolean value) { super(account, clientMoniker); @@ -19,8 +18,7 @@ public class SwitchPermissionModify extends ClientConfigModify { @Override protected String business() { - - return (value?"开启 ":"关闭 ")+key; + return (value ? "开启 " : "关闭 ") + key; } @Override 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 59fae1acf..516966b08 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 @@ -56,7 +56,7 @@ public class PartnerManageController { } - @RequestMapping(value = "/init/merchant_code", method = RequestMethod.GET,produces = "application/json") + @RequestMapping(value = "/init/merchant_code", method = RequestMethod.GET, produces = "application/json") public JSONObject initMerchantCode() { JSONObject result = new JSONObject(); result.put("partner_code", clientManager.initMerchantCode()); @@ -311,7 +311,7 @@ public class PartnerManageController { @ManagerMapping(value = "/{clientMoniker}/selectBillVersion", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER}) public void selectBillVersion(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - clientManager.selectBillCodeVersion(manager, clientMoniker, pass.getString("version")); + clientManager.selectBillCodeVersion(manager, clientMoniker, pass.getString("version")); } /** @@ -527,10 +527,10 @@ public class PartnerManageController { } @ManagerMapping(value = "/{clientMoniker}/sub_clients/page", method = RequestMethod.GET) - public JSONObject listSubClientsByPage(@PathVariable String clientMoniker,@RequestParam(defaultValue = "1") int page, + public JSONObject listSubClientsByPage(@PathVariable String clientMoniker, @RequestParam(defaultValue = "1") int page, @RequestParam(required = false) String searchText, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - return clientManager.listSubClientsByPage(manager, clientMoniker,searchText,page); + return clientManager.listSubClientsByPage(manager, clientMoniker, searchText, page); } //创建子商户 @@ -596,8 +596,8 @@ public class PartnerManageController { */ @ManagerMapping(value = "/{clientMoniker}/file/source_card_agree_file", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER, ManagerRole.SERVANT}) public JSONObject getSourceCardAgreeAuthFiles(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, - @RequestParam("fileName") String fileName){ - return clientManager.getSourceCardAgreeFiles(clientMoniker,manager,fileName); + @RequestParam("fileName") String fileName) { + return clientManager.getSourceCardAgreeFiles(clientMoniker, manager, fileName); } @ManagerMapping(value = "/auth_file/{fileId}/delete", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER}) @@ -618,13 +618,13 @@ public class PartnerManageController { @ManagerMapping(value = "/{clientMoniker}/mw_file", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER}) public void uploadMWAuthFiles(@PathVariable String clientMoniker, @RequestBody ClientMWAuthFilesInfo filesInfo, - @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.uploadMWAuthFilesManager(manager, clientMoniker, filesInfo); } @ManagerMapping(value = "/{clientMoniker}/kycFile", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER}) public void uploadKycFiles(@PathVariable String clientMoniker, @RequestBody ClientKycFilesInfo filesInfo, - @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.uploadKycFiles(manager, clientMoniker, filesInfo); } @@ -646,6 +646,7 @@ public class PartnerManageController { /** * 提交资料,BD提交卡支付最终审核 + * * @param clientMoniker * @param manager */ @@ -661,6 +662,7 @@ public class PartnerManageController { /** * 提交资料,申请卡支付 + * * @param clientMoniker * @param manager */ @@ -686,6 +688,7 @@ public class PartnerManageController { /** * 制作卡支付合同 + * * @param clientMoniker * @param manager * @throws Exception @@ -697,14 +700,18 @@ public class PartnerManageController { /** * 制作促销合同 + * * @param clientMoniker * @param manager * @throws Exception */ - @ManagerMapping(value = "/{clientMoniker}/export/aggregate/card_promotiona_agree_pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR}) - public void exportAggregateCardPromotionaAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, - @RequestParam("date") String promotionalEffectiveDate,@RequestParam("period") int promotionalPeriod) throws Exception { - clientManager.getAggregateCardPromotionaAgreeFile(clientMoniker, manager, false,promotionalEffectiveDate,promotionalPeriod); + @GetMapping(value = "/{clientMoniker}/export/aggregate/card_promotion_agree_pdf") + public void exportAggregateCardPromotionaAgreeFile(@PathVariable String clientMoniker, + @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, + @RequestParam("rateid") String rateid, + HttpServletResponse httpResponse + ) { + clientManager.getAggregateCardPromotionaAgreeFile(clientMoniker, manager, false, rateid, httpResponse); } @ManagerMapping(value = "/{clientMoniker}/temp/export/pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.DIRECTOR, ManagerRole.OPERATOR}) @@ -724,6 +731,7 @@ public class PartnerManageController { /** * 信用卡合同生成完毕通知BD + * * @param clientMoniker * @param manager */ @@ -755,8 +763,8 @@ public class PartnerManageController { @GetMapping(value = "/{clientMoniker}/lists_settlements/excel") @ReadOnlyConnection - public void excelSettlements(@PathVariable String clientMoniker, TradeLogQuery query, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager,HttpServletResponse response){ - clientManager.excelSettlementLog(manager, clientMoniker, query,response); + public void excelSettlements(@PathVariable String clientMoniker, TradeLogQuery query, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse response) { + clientManager.excelSettlementLog(manager, clientMoniker, query, response); } @ManagerMapping(value = "/{clientMoniker}/requireCustinfo", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER}) @@ -805,6 +813,7 @@ public class PartnerManageController { public List listRpaySubMerchantIdApplys(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { return clientManager.listRpaySubMerchantIdApplys(manager, clientMoniker); } + @ManagerMapping(value = "/{clientMoniker}/sub_apply", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) public String subMerchantApplication(@PathVariable String clientMoniker, @RequestBody SubMerchantIdApply subMerchantIdApply, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { return clientManager.subMerchantApplication(clientMoniker, subMerchantIdApply, manager); @@ -932,51 +941,54 @@ public class PartnerManageController { /** * 获取商户所有增值服务 + * * @param clientMoniker * @return */ @ManagerMapping(value = "/{clientMoniker}/incremental_service", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) - public JSONObject getClientIncrementalService(@PathVariable String clientMoniker){ - return clientManager.partnerIncrementalService(clientMoniker); + public JSONObject getClientIncrementalService(@PathVariable String clientMoniker) { + return clientManager.partnerIncrementalService(clientMoniker); } /** * 保存/修改增值服务配置 + * * @param clientMoniker * @param incrementalService */ @ManagerMapping(value = "/{clientMoniker}/incremental_service", method = RequestMethod.POST, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) - public void updateClientIncrementalService(@PathVariable("clientMoniker") String clientMoniker,@RequestBody JSONObject incrementalService, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ - clientManager.changePartnerIncrementalService(clientMoniker,incrementalService,manager); + public void updateClientIncrementalService(@PathVariable("clientMoniker") String clientMoniker, @RequestBody JSONObject incrementalService, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.changePartnerIncrementalService(clientMoniker, incrementalService, manager); } /** * 禁用/启用增值服务 + * * @param clientMoniker * @param incrementalService */ @ManagerMapping(value = "/{clientMoniker}/incremental_service/status", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) - public void switchClientIncrementalService(@PathVariable("clientMoniker") String clientMoniker,@RequestBody JSONObject incrementalService, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ - clientManager.changeSwitchIncrementalService(clientMoniker,incrementalService,manager); + public void switchClientIncrementalService(@PathVariable("clientMoniker") String clientMoniker, @RequestBody JSONObject incrementalService, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.changeSwitchIncrementalService(clientMoniker, incrementalService, manager); } @ManagerMapping(value = "/{clientMoniker}/ext_config", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) - public void changeClientExtConfigs(@PathVariable("clientMoniker")String clientMoniker, + public void changeClientExtConfigs(@PathVariable("clientMoniker") String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, - @RequestBody JSONObject params){ - clientManager.changeExtParams(clientMoniker,manager,params); + @RequestBody JSONObject params) { + clientManager.changeExtParams(clientMoniker, manager, params); } - @ManagerMapping(value = "/{clientMoniker}/applyMWMerchantId",method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) - public RPayMerchantEntity applyMWMerchantId(@PathVariable("clientMoniker")String clientMoniker, - @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ - return clientManager.applyMWMerchantId(clientMoniker,manager); + @ManagerMapping(value = "/{clientMoniker}/applyMWMerchantId", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) + public RPayMerchantEntity applyMWMerchantId(@PathVariable("clientMoniker") String clientMoniker, + @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + return clientManager.applyMWMerchantId(clientMoniker, manager); } - @ManagerMapping(value = "/{clientMoniker}/queryMWMerchantIdStatus",method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) - public RPayMerchantEntity queryMWMerchantIdStatus(@PathVariable("clientMoniker")String clientMoniker, - @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ - return clientManager.queryMWMerchantIdStatus(clientMoniker,manager); + @ManagerMapping(value = "/{clientMoniker}/queryMWMerchantIdStatus", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) + public RPayMerchantEntity queryMWMerchantIdStatus(@PathVariable("clientMoniker") String clientMoniker, + @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + return clientManager.queryMWMerchantIdStatus(clientMoniker, manager); } @ManagerMapping(value = "/{clientMoniker}/query/mw_info", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) @@ -986,11 +998,12 @@ public class PartnerManageController { /** * 启用/禁用国际卡支付 + * * @param clientMoniker */ @ManagerMapping(value = "/{clientMoniker}/payment_card_permission", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) - public void switchInternationalCard(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager){ - clientManager.switchPermission(manager, clientMoniker, "enable_international_card", pass.getBooleanValue("allow")); + public void switchInternationalCard(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.modifyUPayProfile(manager, clientMoniker, "enable_international_card", pass.getBooleanValue("allow")); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index 6183230d5..6679d26c9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -12,7 +12,10 @@ import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import au.com.royalpay.payment.manage.mappers.client.ClientCustomersMapper; import au.com.royalpay.payment.manage.mappers.log.ClearingDetailMapper; import au.com.royalpay.payment.manage.mappers.log.ClearingLogMapper; -import au.com.royalpay.payment.manage.mappers.payment.*; +import au.com.royalpay.payment.manage.mappers.payment.AustracDataMapper; +import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; +import au.com.royalpay.payment.manage.mappers.payment.RefundMapper; +import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.system.*; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.organizations.core.OrgManager; @@ -56,7 +59,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import org.springframework.ui.Model; @@ -88,8 +90,6 @@ public class TradeLogServiceImpl implements TradeLogService { @Resource private RefundMapper refundMapper; @Resource - private RefundAuditionMapper refundAuditionMapper; - @Resource private ClientAccountMapper clientAccountMapper; @Resource private ClientManager clientManager; @@ -116,8 +116,6 @@ public class TradeLogServiceImpl implements TradeLogService { @Resource private ClearingLogMapper clearingLogMapper; @Resource - private StringRedisTemplate stringRedisTemplate; - @Resource private OrgManager orgManager; @Resource private ClientMapper clientMapper; diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 3beef053f..8950b3d8d 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -3,13 +3,13 @@ spring: master: host: 192.168.0.84:3306 jdbc-url: jdbc:mysql://${spring.datasource.master.host}/${spring.datasource.master.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false - password: rpayplus + password: rpayplus123 schema-name: royalpay username: root slave: host: 192.168.0.84:3306 jdbc-url: jdbc:mysql://${spring.datasource.slave.host}/${spring.datasource.slave.schema-name}?useUnicode=true&characterEncoding=utf8&useSSL=false - password: rpayplus + password: rpayplus123 schema-name: royalpay username: root type: com.zaxxer.hikari.HikariDataSource diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml index 38e1504a7..b7508e323 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml @@ -952,7 +952,7 @@ INNER JOIN sys_org so ON t.org_id = so.org_id AND so.is_valid = 1 AND so.type = 0 AND so.citypartner = 1 AND so.commission = 1 - AND year(t.transaction_time) = #{year} AND month(t.transaction_time) = #{month} + AND year(t.create_time) = #{year} AND month(t.create_time) = #{month} AND t.channel != 'Settlement' AND t.channel != 'System' AND t.system_generate = 0 ORDER BY t.client_id asc ]]> diff --git a/src/main/resources/jasper/austrac_report20171228.jasper b/src/main/resources/jasper/austrac_report20171228.jasper deleted file mode 100644 index bc48e6dab..000000000 Binary files a/src/main/resources/jasper/austrac_report20171228.jasper and /dev/null differ diff --git a/src/main/resources/jasper/partner_invoice_20171201.jasper b/src/main/resources/jasper/partner_invoice_20171201.jasper deleted file mode 100644 index 5e336bbee..000000000 Binary files a/src/main/resources/jasper/partner_invoice_20171201.jasper and /dev/null differ diff --git a/src/main/resources/jasper/partner_invoice_gst20180409.jasper b/src/main/resources/jasper/partner_invoice_gst20180409.jasper deleted file mode 100644 index 95cd7257e..000000000 Binary files a/src/main/resources/jasper/partner_invoice_gst20180409.jasper and /dev/null differ diff --git a/src/main/resources/jasper/partner_invoice_gst20180412.jasper b/src/main/resources/jasper/partner_invoice_gst20180412.jasper deleted file mode 100644 index 9c01d8c81..000000000 Binary files a/src/main/resources/jasper/partner_invoice_gst20180412.jasper and /dev/null differ diff --git a/src/main/resources/jasper/partner_invoice_gst20200410.jasper b/src/main/resources/jasper/partner_invoice_gst20200410.jasper deleted file mode 100644 index a5111a4fa..000000000 Binary files a/src/main/resources/jasper/partner_invoice_gst20200410.jasper and /dev/null differ diff --git a/src/main/resources/jasper/partner_invoice_gst_bak.jasper b/src/main/resources/jasper/partner_invoice_gst_bak.jasper deleted file mode 100644 index a5111a4fa..000000000 Binary files a/src/main/resources/jasper/partner_invoice_gst_bak.jasper and /dev/null differ diff --git a/src/main/resources/jasper/trans_excel20161008.jasper b/src/main/resources/jasper/trans_excel20161008.jasper deleted file mode 100644 index 4540bd758..000000000 Binary files a/src/main/resources/jasper/trans_excel20161008.jasper and /dev/null differ diff --git a/src/main/resources/jasper/trans_excel20161009.jasper b/src/main/resources/jasper/trans_excel20161009.jasper deleted file mode 100644 index 8f1c479c2..000000000 Binary files a/src/main/resources/jasper/trans_excel20161009.jasper and /dev/null differ diff --git a/src/main/resources/jasper/trans_excel20170516.jasper b/src/main/resources/jasper/trans_excel20170516.jasper deleted file mode 100644 index 92f6d53b8..000000000 Binary files a/src/main/resources/jasper/trans_excel20170516.jasper and /dev/null differ diff --git a/src/main/resources/jasper/trans_excel20170531.jasper b/src/main/resources/jasper/trans_excel20170531.jasper deleted file mode 100644 index 114f3e452..000000000 Binary files a/src/main/resources/jasper/trans_excel20170531.jasper and /dev/null differ diff --git a/src/main/resources/jasper/trans_excel20170704.jasper b/src/main/resources/jasper/trans_excel20170704.jasper deleted file mode 100644 index 6a3088df4..000000000 Binary files a/src/main/resources/jasper/trans_excel20170704.jasper and /dev/null differ diff --git a/src/main/resources/jasper/trans_excel20170822.jasper b/src/main/resources/jasper/trans_excel20170822.jasper deleted file mode 100644 index e15c25426..000000000 Binary files a/src/main/resources/jasper/trans_excel20170822.jasper and /dev/null differ diff --git a/src/main/resources/jasper/trans_excel20180412.jasper b/src/main/resources/jasper/trans_excel20180412.jasper deleted file mode 100644 index 70a836128..000000000 Binary files a/src/main/resources/jasper/trans_excel20180412.jasper and /dev/null differ diff --git a/src/main/resources/jasper/trans_flow20161008.jasper b/src/main/resources/jasper/trans_flow20161008.jasper deleted file mode 100644 index d9d27c387..000000000 Binary files a/src/main/resources/jasper/trans_flow20161008.jasper and /dev/null differ diff --git a/src/main/resources/jasper/trans_flow20161009.jasper b/src/main/resources/jasper/trans_flow20161009.jasper deleted file mode 100644 index 633fecc1f..000000000 Binary files a/src/main/resources/jasper/trans_flow20161009.jasper and /dev/null differ diff --git a/src/main/resources/jasper/trans_flow_new20161107.jasper b/src/main/resources/jasper/trans_flow_new20161107.jasper deleted file mode 100644 index 781826752..000000000 Binary files a/src/main/resources/jasper/trans_flow_new20161107.jasper and /dev/null differ diff --git a/src/main/resources/jasper/trans_flow_new20161202.jasper b/src/main/resources/jasper/trans_flow_new20161202.jasper deleted file mode 100644 index cbb4e4e8a..000000000 Binary files a/src/main/resources/jasper/trans_flow_new20161202.jasper and /dev/null differ diff --git a/src/main/resources/jasper/trans_flow_new20170302.jasper b/src/main/resources/jasper/trans_flow_new20170302.jasper deleted file mode 100644 index aeccc6c99..000000000 Binary files a/src/main/resources/jasper/trans_flow_new20170302.jasper and /dev/null differ diff --git a/src/main/resources/templates/mail/new_client_notice.html b/src/main/resources/templates/mail/new_client_notice.html index 750855542..f5003c77c 100644 --- a/src/main/resources/templates/mail/new_client_notice.html +++ b/src/main/resources/templates/mail/new_client_notice.html @@ -5,6 +5,14 @@

I'm happy to let you know that your RoyalPay Cross-border Payment account has been set up.
很高兴通知您,贵司RoyalPay跨境全支付已经开通

+

I'm + happy to let you know + Congratulations, you have passed the compliance review and be granted a RoyalPay account. + You can start to do IT integration. At the same time, please contact BD regarding the invoice of security + deposit. We will set up your account live in the production environment after receiving the security deposit + from your company. +
+ 恭喜您已通过 CardPayment 合规审核,您可开始做IT对接. 请联系BD沟通支付保证金事宜。我司会在收到贵司提交的保证金后,开启您的 CardPayment 权限。

Please kindly log on the website below to manage your accounts and transactions:
@@ -94,7 +102,7 @@ Store to download APP for IOS,which helps check your payment receiving records.

您可以在APP Store里搜索"RoyalPay"下载royalpay的app,来进行收款和接收到账提醒等。 + href="https://itunes.apple.com/app/royalpay/id1049566852?l=en&mt=8">RoyalPay"下载royalpay的app,来进行收款和接收到账提醒等。


@@ -154,7 +162,8 @@
- +
Tel:
1300 10 77 50
Level 14, 383 Kent Street, Sydney NSW 2000
Tunnel Show Pty Ltd trading as RoyalPay
@@ -173,10 +182,7 @@
- - -
- \ 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 3c0d71eb3..21ca834d7 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -147,7 +147,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter controller: 'partnerDeviceCtrl' }).state('partners.detail.files', { url: '/files', - params:{commitType:"cross-border"}, + params: {commitType: "cross-border"}, templateUrl: '/static/payment/partner/templates/partner_auth_files.html', controller: 'partnerAuthFileCtrl' }).state('partners.detail.files.CP_files', { @@ -211,8 +211,447 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter 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', + controller: 'partnerEditCtrl', + resolve: { + partner: ['$http', '$stateParams', function ($http, $stateParams) { + return $http.get('/sys/partners/' + $stateParams.clientMoniker); + }] + } }); }]); + app.controller('partnerEditCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'partner', 'upayIndustryMap', + function ($scope, $http, $state, Upload, commonDialog, timezone, partner, upayIndustryMap) { + $scope.upayIndustrys = upayIndustryMap.configs(); + $scope.timezones = timezone.configs(); + $scope.partner = partner.data; + if (!$scope.partner.client_type) { + $scope.partner.client_type = 'cross-border'; + } + if ($scope.partner.representativeInfo != null) { + $scope.partner.registered_address = $scope.partner.representativeInfo.address; + $scope.partner.registered_suburb = $scope.partner.representativeInfo.suburb; + $scope.partner.registered_postcode = $scope.partner.representativeInfo.postcode; + $scope.partner.registered_state = $scope.partner.representativeInfo.state; + $scope.partner.legal_representative_person = $scope.partner.representativeInfo.representative_person; + $scope.partner.legal_representative_phone = $scope.partner.representativeInfo.phone; + $scope.partner.legal_representative_email = $scope.partner.representativeInfo.email; + $scope.partner.legal_representative_job = $scope.partner.representativeInfo.job_title; + + $scope.partner.marketing_person = $scope.partner.representativeInfo.marketing_person; + $scope.partner.marketing_phone = $scope.partner.representativeInfo.marketing_phone; + $scope.partner.marketing_email = $scope.partner.representativeInfo.marketing_email; + $scope.partner.marketing_job = $scope.partner.representativeInfo.marketing_job_title; + + $scope.partner.legal_representative_wechatid = $scope.partner.representativeInfo.legal_representative_wechatid; + $scope.partner.marketing_wechatid = $scope.partner.representativeInfo.marketing_wechatid; + } + + $scope.enablePaymentType = function (type) { + $scope.partner[type] = !$scope.partner[type]; + }; + + if ($state.params.commitCardPayment) { + $scope.enablePaymentType('enable_card_payment'); + } + + if ($state.params.commitCrossBorderPayment) { + $scope.enablePaymentType('enable_cross_payment'); + } + + function hasRole() { + var rolenum; + switch (sessionStorage.getItem('role')) { + case "administrator": + rolenum = 1; + break; + case "bduser": + rolenum = 4; + break; + case "salesmanager": + rolenum = 8192; + break; + case "accountant": + rolenum = 8; + break; + case "sitemanager": + rolenum = 128; + break; + case "director": + rolenum = 64; + break; + case "developer": + rolenum = 256; + break; + case "compliance": + rolenum = 2; + break; + case "guest": + rolenum = 2048; + break; + case "orgmanager": + rolenum = 4096; + break; + case "riskmanager": + rolenum = 1024; + break; + default: + break; + } + if ((window.currentUser.role & rolenum) > 0) { + return true; + } else { + sessionStorage.removeItem('role'); + return false; + } + } + + if (hasRole()) { + $scope.role = sessionStorage.getItem('role'); + } + + var origin_referrer_id = angular.copy($scope.partner.referrer_id); + var resetClientPayDescByTpey = function (type) { + type = parseInt(type); + if (type == 1) { + removeClientPayDesc($scope.partner.client_pay_desc, '10'); + } + if (type == 2) { + removeClientPayDesc($scope.partner.client_pay_desc, '20'); + } + }; + var compare = function (x, y) { + x = parseInt(x); + y = parseInt(y); + if (x < y) { + return -1; + } else if (x > y) { + return 1; + } else { + return 0; + } + } + $scope.toggleClientPayType = function (type) { + if (!$scope.partner.client_pay_type) { + $scope.partner.client_pay_type = []; + } + var $idx = $scope.partner.client_pay_type.indexOf(type); + if ($idx >= 0) { + $scope.partner.client_pay_type.splice($idx, 1); + resetClientPayDescByTpey(type); + } else { + $scope.partner.client_pay_type.push(type); + $scope.partner.client_pay_type.sort(compare); + } + }; + $scope.toggleClientPayDesc = function (type) { + if (!$scope.partner.client_pay_desc) { + $scope.partner.client_pay_desc = []; + } + var $idx = $scope.partner.client_pay_desc.indexOf(type); + if ($idx >= 0) { + if (type == '203') { + removeClientPayDesc($scope.partner.client_pay_desc, '2030') + } + $scope.partner.client_pay_desc.splice($idx, 1); + } else { + $scope.partner.client_pay_desc.push(type); + $scope.partner.client_pay_desc.sort(compare); + } + }; + + $scope.partner.sameAsContactPerson = false; + $scope.checkboxOnclick = function () { + $scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson); + if ($scope.partner.sameAsContactPerson) { + $scope.partner.legal_representative_person = $scope.partner.contact_person; + $scope.partner.legal_representative_phone = $scope.partner.contact_phone; + $scope.partner.legal_representative_email = $scope.partner.contact_email; + $scope.partner.legal_representative_job = $scope.partner.contact_job; + $scope.partner.legal_representative_wechatid = $scope.partner.contact_wechatid; + } + } + + $scope.partner.marketingSameAsContact = false; + $scope.checkMarketingSameAsContact = function () { + $scope.partner.marketingSameAsContact = !($scope.partner.marketingSameAsContact); + if ($scope.partner.marketingSameAsContact) { + $scope.partner.marketing_person = $scope.partner.contact_person; + $scope.partner.marketing_phone = $scope.partner.contact_phone; + $scope.partner.marketing_email = $scope.partner.contact_email; + $scope.partner.marketing_job = $scope.partner.contact_job; + $scope.partner.marketing_wechatid = $scope.partner.contact_wechatid; + } + } + + $scope.partner.sameAsAddress = false; + $scope.sameAddress = function () { + $scope.partner.sameAsAddress = !($scope.partner.sameAsAddress); + if ($scope.partner.sameAsAddress) { + $scope.partner.registered_address = $scope.partner.address; + $scope.partner.registered_suburb = $scope.partner.suburb; + $scope.partner.registered_postcode = $scope.partner.postcode; + $scope.partner.registered_state = $scope.partner.state; + } + } + + $scope.listReferrers = function () { + $http.get('/sys/orgs/referrer').then(function (resp) { + $scope.referrers = resp.data; + }) + }; + $scope.listReferrers(); + + $scope.loadAlipayCategory = function () { + $http.get('/static/data/alipayMcc.json').then(function (resp) { + $scope.alipayMccCategory = resp.data; + }) + }; + $scope.loadAlipayCategory(); + $scope.loadJDindustry = function () { + $http.get('/static/data/jdindustry.json').then(function (resp) { + $scope.jdindustry = resp.data; + }) + }; + $scope.loadJDindustry(); + + $scope.loadLakalaPayindustry = function () { + $http.get('/static/data/lakalapayindustry.json').then(function (resp) { + $scope.lakalapayindustry = resp.data; + }) + }; + $scope.loadLakalaPayindustry(); + + $scope.loadLakalaPaySettle = function () { + $http.get('/static/data/lakalapaysettle.json').then(function (resp) { + $scope.lakalapaysettle = resp.data; + }) + }; + $scope.loadLakalaPaySettle(); + + $scope.loadLakalaPayGoods = function () { + $http.get('/static/data/lakalapaygoods.json').then(function (resp) { + $scope.lakalapaygoods = resp.data; + }) + }; + $scope.loadLakalaPayGoods(); + + $scope.loadRoyalpayindustry = function () { + $http.get('/static/data/royalpayindustry.json').then(function (resp) { + $scope.royalpayindustry = resp.data; + }) + }; + $scope.loadRoyalpayindustry(); + + $scope.loadHfindustry = function () { + $http.get('/static/data/hfindustry.json').then(function (resp) { + $scope.hfindustry = resp.data; + }) + }; + $scope.loadHfindustry(); + + $scope.onAlipayMccSelect = function (selectedItem) { + $scope.partner.alipay_category = selectedItem.label; + $scope.partner.alipayindustry = selectedItem.mccCode; + }; + $scope.onRoyalPayIndustrySelect = function (selectedItem) { + $scope.partner.royalpay_label = selectedItem.label; + $scope.partner.royalpayindustry = selectedItem.mccCode; + }; + $scope.onHfIndustrySelect = function (selectedItem) { + $scope.partner.hf_label = selectedItem.label; + $scope.partner.hfindustry = selectedItem.mccCode; + }; + + + $scope.updatePartner = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + + if ($scope.partner.company_name.indexOf("Migration") != -1) { + alert("Company Name包含敏感词汇,请检查后重新提交!"); + return; + } + if ($scope.partner.company_phone.indexOf(' ') != -1) { + alert('Company Phone can not contain space character'); + return; + } + if ($scope.partner.contact_email.indexOf(' ') != -1) { + alert('Contact email Phone can not contain space character'); + return; + } + if ($scope.partner.suburb.indexOf(' ') != -1) { + alert('suburb can not contain two and more continuous space characters'); + return; + } + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { + if (!$scope.partner.company_photo) { + alert('Shop Photo1 is necessary'); + return; + } + if (!$scope.partner.store_photo) { + alert('Shop Photo2 is necessary'); + return; + } + } + + if ($scope.partner.acn && $scope.partner.business_structure == 'Company') { + if ($scope.partner.acn.length != 9) { + alert('Acn is not valid'); + } + } + if ($scope.partner.referrer_id) { + $scope.referrers.forEach(function (e) { + if ($scope.partner.referrer_id == e.org_id) { + $scope.partner.referrer_name = e.name; + return; + } + }) + } + var content = ''; + if (!origin_referrer_id && $scope.partner.referrer_id) { + content = 'Update partner info successfully,But You Had add new Referrer,Please Change the BD Commission Proportion!'; + } + if ($scope.partner.client_pay_type.length == 0) { + alert('请选择商户支付场景') + return; + } + if ($scope.partner.client_pay_desc.length == 0) { + alert('请选择商户支付方式') + return; + } + if ($scope.partner.client_pay_type.indexOf('1') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) { + alert("请检查线上支付场景是否已选择支付方式"); + return; + } + } + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { + alert("请检查线下支付场景是否已选择支付方式"); + return; + } + } + if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0 && $scope.partner.client_pay_desc.join(',').indexOf('20399') < 0) { + alert("请检查线下支付是否已选择收银系统类型"); + return; + } + } + $scope.partner.client_pay_type = $scope.partner.client_pay_type.join(','); + $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(','); + $http.put('/sys/partners/' + $scope.partner.client_moniker, $scope.partner).then(function () { + if (content != '') { + commonDialog.alert({ + title: 'Warning', + content: content, + type: 'error' + }); + } else { + commonDialog.alert({ + title: 'Success', + content: 'Update partner information successfully', + type: 'success' + }); + } + $scope.updateMerchantLocation(); + $scope.loadPartners(); + $state.go('^.detail', {clientMoniker: $scope.partner.client_moniker}, {reload: true}); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + }); + }; + $scope.uploadLogo = function (file) { + if (file != null) { + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.uploadShopPhoto = function (file) { + if (file != null) { + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.uploadStorePhoto = function (file) { + if (file != null) { + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.getMerchantLocation = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/location').then(function (resp) { + $scope.merchant_location = resp.data; + }); + }; + $scope.getMerchantLocation(); + + $scope.updateMerchantLocation = function () { + var params = window.frames['merchant_detail'].merchant_location; + if (params) { + $http.put('/sys/partners/modify/' + $scope.partner.client_moniker + '/location', params).then(function () { + }); + } + } + }]); app.controller('partnerListCtrl', ['$scope', '$sce', '$http', '$filter', '$uibModal', 'businessStructuresMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap', function ($scope, $sce, $http, $filter, $uibModal, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) { @@ -239,7 +678,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter var selectAll = { "label": "All", "mccCode": "0", - "children":{} + "children": {} }; $scope.royalpayindustry.unshift(selectAll); }) @@ -271,7 +710,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } return key + '=' + encodeURIComponent(value) }).join('&'); - window.open('/sys/partners/exporting_excel?'+param_str) + window.open('/sys/partners/exporting_excel?' + param_str) }; /*$scope.loadLocations = function () { @@ -419,748 +858,701 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; }]); - app.controller('partnerDetailCtrl', ['$scope', '$http', '$state', '$uibModal', '$rootScope', 'Upload', 'commonDialog', 'partner', '$sce', function ($scope, $http, $state, $uibModal, $rootScope, Upload, commonDialog, partner, $sce) { - $scope.init = {wechat_compliance: false, local_merchant: false}; - $scope.partner = partner.data; - $scope.isComplianceOfCompanyName = false; - $scope.isComplianceOfShortName = false; - $scope.isComplianceOfBusinessStructure = false; - $scope.cardPromotionaparams={} - var website = partner.data.company_website; - if (website != null) { - if (website.indexOf('http') != 0) { - $scope.partner.company_website = 'http://' + angular.copy(website); + app.controller('partnerDetailCtrl', ['$scope', '$http', '$state', '$uibModal', '$rootScope', 'Upload', 'commonDialog', 'partner', '$sce', + function ($scope, $http, $state, $uibModal, $rootScope, Upload, commonDialog, partner, $sce) { + $scope.init = {wechat_compliance: false, local_merchant: false}; + $scope.partner = partner.data; + $scope.isComplianceOfCompanyName = false; + $scope.isComplianceOfShortName = false; + $scope.isComplianceOfBusinessStructure = false; + $scope.cardPromotionaparams = {}; + var website = partner.data.company_website; + if (website != null) { + if (website.indexOf('http') !== 0) { + $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; + $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); } - 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; - }); - }; + 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.showCardFile = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_card_agree_file?fileName=letter_of_offer_file').then(function (resp) { + $scope.letterOfOfferFileManager = resp.data; + }); + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_card_agree_file?fileName=promotional_offer_file').then(function (resp) { + $scope.promotionalOfferFileManager = resp.data; + }); + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_card_agree_file?fileName=terms_and_conditions_file').then(function (resp) { + $scope.termsAndConditionsFile = resp.data; + }); + }; - $scope.showFile(); - $scope.showCardFile(); - $scope.passClient = function () { - if ($scope.partner.enable_hf) { - if ($scope.partner.hfindustry == null) { - alert("已开启HF支付通道,HF行业不可为空!"); + $scope.showFile(); + $scope.showCardFile(); + $scope.passClient = function () { + if (!$rootScope.complianceCheck) { + alert("please check first"); return; } - } - 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 (!$rootScope.complianceCheck.authFile) { + alert("Compliance Files not checked"); + return; } - if ($scope.isComplianceOfShortName) { - info.push('Short Name'); + if (!$rootScope.complianceCheck.clientInfo) { + alert("Partner Detail not checked"); + return; } - if ($scope.isComplianceOfBusinessStructure) { - info.push('Business Structure'); + if (!$rootScope.complianceCheck.bankAccount) { + alert("Bank Account not checked"); + return; } - 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' - }); + 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'); } - 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 = ''; } - if ($scope.isComplianceOfShortName) { - info.push('Short Name'); + 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 ($scope.isComplianceOfBusinessStructure) { - info.push('Business Structure'); + if (!$rootScope.complianceCheck.authFile) { + alert("Compliance Files not checked"); + return; } - 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 { + 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' }); - } - delete $rootScope.complianceCheck; + $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.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 () { + }); + + }; + $scope.exportAgreegatePDF = function () { + $scope.showBg = true; + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/aggregate/agreepdf').then(function () { commonDialog.alert({ title: 'Success', - content: 'Comply Passed! Email will send to contact email address soon.', + 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.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.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.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.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.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.showBg = false; - $state.reload(); - }, function (resp) { - $scope.showBg = false; - $state.reload(); - commonDialog.alert({title: 'Error', 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.exportCardPromotionaAgreegatePDF = function(){ - var title = '确认生成Promotional Offer合同'; - var promotiona_date=''; - var promotiona_period =''; - var contentHtml = $sce.trustAsHtml( - '请输入优惠开始日期(eg:2020-02-01): '+ - '' + - '
' + - '请输入活动周数(unit:week): ' + - ''); - var choises = [{label: '取消', className: 'btn-danger', key: '2', dismiss: true}, - {label: '确认生成', className: 'btn-success', key: '1'}]; - var content = ''; + $scope.downTempPdf = function () { + return '/sys/partners/' + $scope.partner.client_moniker + '/temp/export/pdf'; + } - commonDialog.confirm({ - title: title, - content: content, - choises: choises, - contentHtml: contentHtml - }).then(function (res) { - $scope.showBg = true; - var date = document.getElementById("promotiona_date").value; - var period = document.getElementById("promotiona_period").value; - if(date=='' || period==''){ - commonDialog.alert({title: 'Error', content: '选项不得未空', type: 'error'}); - }else{ - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/aggregate/card_promotiona_agree_pdf?date='+date+'&period='+period).then(function () { + $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: 'Agreement File Generate Succeed! Please notify BD!', + content: 'Audit application has been refused.', type: 'success' }); - $scope.showBg = false; $state.reload(); }, function (resp) { - $scope.showBg = false; + 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.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 () { + $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: 'Succeed Imported! Please notify BD', + content: 'Commit to Compliance successfully', 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 () { + $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: 'Succeed Imported! Please notify BD', + content: 'Commit to Compliance successfully', 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 () { - var url = '/sys/partners/' + $scope.partner.client_moniker + '/temp/export/pdf'; - return url; - } - - $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 () { + $scope.apply2makeAgreeFile = function () { + if (!$scope.partner.enable_cross_payment) { commonDialog.alert({ - title: 'Success', - content: 'Audit application has been refused.', - type: 'success' + title: 'Error!', + content: '请完善商户跨境支付基本信息、签约费率、合规文件!', + type: 'error' }); - $state.reload(); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, 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.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 () { + $scope.apply2makeCardAgreeFile = function () { + if (!$scope.partner.enable_card_payment) { commonDialog.alert({ - title: 'Success', - content: 'Card Audit application has been refused.', - type: 'success' + title: 'Error!', + content: '请完善商户卡支付基本信息、签约费率、合规文件!', + type: 'error' }); - $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'}); - }) - }) - }; + $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.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 () { + $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 Compliance successfully', + content: 'Commit to Green Channel 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' - }); + }) + }; + + $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.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' - }); + }) + }; + $scope.resendApproveEmail = function () { + commonDialog.confirm({ + title: 'Warning', + content: 'This operation will reset the password of admin user. Are you sure this email is correct ? Or you may update this information first.' + }).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/send_email').then(function () { + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; + $scope.editBDUser = function () { + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/bd_user_choose_dialog.html', + controller: 'partnerChooseBDUserDialogCtrl', + resolve: { + bdUsers: ['$http', function ($http) { + return $http.get('/sys/manager_accounts/roles/bd_user'); + }], + partner: function () { + return $scope.partner; + }, + type: function () { + return 'edit'; + } + } + }).result.then(function () { $state.reload(); - }, 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' - }); + }) + }; + $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(); - }, 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.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.markAuditEmail = function () { - commonDialog.confirm({ - title: 'Warning', - content: 'Make sure you have send the email to client.' - }).then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/email_sending_status').then(function () { - $state.reload(); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - }) - }; - $scope.resendApproveEmail = function () { - commonDialog.confirm({ - title: 'Warning', - content: 'This operation will reset the password of admin user. Are you sure this email is correct ? Or you may update this information first.' - }).then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/send_email').then(function () { - $state.reload(); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - }) - }; - $scope.editBDUser = function () { - $uibModal.open({ - templateUrl: '/static/payment/partner/templates/bd_user_choose_dialog.html', - controller: 'partnerChooseBDUserDialogCtrl', - resolve: { - bdUsers: ['$http', function ($http) { - return $http.get('/sys/manager_accounts/roles/bd_user'); - }], - partner: function () { - return $scope.partner; - }, - type: function () { - return 'edit'; - } + $scope.complianceCheck = function () { + if (!$rootScope.complianceCheck) { + $rootScope.complianceCheck = {}; } - }).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'; + $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; } } - }).result.then(function () { - $state.reload(); - }) - }; + }; + $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 () { - $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', + title: 'failed to change wechat_compliance permission status', 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.changeLocalMerchant = function () { + if (!$scope.partner) { + return; } - } - }; - $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 () { + 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' + }, 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(); - }); - }; - }]); + $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 () { @@ -1197,7 +1589,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $http.get('/sys/partners/' + $scope.partner.client_moniker).then(function (resp) { $scope.extParams = {}; $scope.paymentInfo = resp.data; - $scope.extParams = $scope.paymentInfo.ext_params?JSON.parse($scope.paymentInfo.ext_params):null; + $scope.extParams = $scope.paymentInfo.ext_params ? JSON.parse($scope.paymentInfo.ext_params) : null; $scope.convertExtParams = $scope.extParamsEditFlags() $scope.ctrl.editSubMerchant = false; $scope.ctrl.editAliSubMerchant = false; @@ -1207,17 +1599,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.ctrl.editRefundCreditLine = false; }) }; - $scope.extParamsEditFlags = function(){ + $scope.extParamsEditFlags = function () { var paramList = [] - if($scope.extParams != null){ - for(var key in $scope.extParams){ + if ($scope.extParams != null) { + for (var key in $scope.extParams) { var obj = {} - if(typeof $scope.extParams[key] != 'boolean'){ + if (typeof $scope.extParams[key] != 'boolean') { obj.name = key; obj.value = $scope.extParams[key]; obj.type = 'string'; - obj.flag =false; - }else{ + obj.flag = false; + } else { obj.name = key; obj.value = $scope.extParams[key]; obj.type = 'boolean' @@ -1934,7 +2326,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }; - $scope.changeBillCodeVersion = function() { + $scope.changeBillCodeVersion = function () { if (!$scope.paymentInfo) { return; } @@ -1949,15 +2341,18 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }; - $scope.extChangeParam = function(name,value){ + $scope.extChangeParam = function (name, value) { var flag = true; $scope.convertExtParams.forEach(function (params) { - if(params.name == name && value=='' && params.type == 'string'){ - flag = false; + 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 () { + if (flag) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/ext_config', { + key: name, + value: value + }).then(function () { $scope.loadPartnerPaymentInfo(); }) } @@ -1993,7 +2388,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $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) { + $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; }); @@ -2053,7 +2448,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }]); - app.controller('partnerRatesCtrl', ['$scope', '$rootScope', '$http', '$uibModal', 'commonDialog', '$sce','$state', function ($scope, $rootScope, $http, $uibModal, commonDialog, $sce,$state) { + app.controller('partnerRatesCtrl', ['$scope', '$rootScope', '$http', '$uibModal', 'commonDialog', '$sce', '$state', function ($scope, $rootScope, $http, $uibModal, commonDialog, $sce, $state) { $scope.bankCtrl = {edit: true, rate_name: 'Wechat'}; $scope.init = { skip_clearing: false, @@ -2301,6 +2696,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.getRates(); }); }; + $scope.complianceCheck = function () { if (!$rootScope.complianceCheck) { $rootScope.complianceCheck = {}; @@ -2383,7 +2779,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter if ($scope.card_payment_normal) { $scope.cardRateConfig = $scope.card_payment[0]; $scope.card_payment_switch_title = "Direct Debit"; - }else { + } else { $scope.cardRateConfig = $scope.card_payment[1]; $scope.card_payment_switch_title = "Card Payment"; } @@ -2740,9 +3136,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter // $scope.t2city_map = angular.copy(t2city_map); $scope.partner.sameAsContactPerson = false; - $scope.checkboxOnclick = function (){ + $scope.checkboxOnclick = function () { $scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson); - if($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; @@ -2755,9 +3151,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.partner.marketingSameAsContact = false; - $scope.checkMarketingSameAsContact = function (){ + $scope.checkMarketingSameAsContact = function () { $scope.partner.marketingSameAsContact = !($scope.partner.marketingSameAsContact); - if($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; @@ -2768,10 +3164,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } } - $scope.partner.sameAsAddress=false; - $scope.sameAddress = function (){ - $scope.partner.sameAsAddress=!($scope.partner.sameAsAddress); - if($scope.partner.sameAsAddress) { + $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; @@ -2822,8 +3218,8 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } $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; + $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'); @@ -3033,25 +3429,25 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter 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())){ + 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){ + if (params.gatewayChilds) { var exist = false params.gatewayChilds.forEach(function (child) { - if(child==params.gatewayChild){ + if (child == params.gatewayChild) { exist = true } }) - if(!exist){ + if (!exist) { params.gatewayChild = null } - }else{ + } else { delete params.gatewayChild; } - }else{ + } else { delete params.gatewayChilds; delete params.gatewayChild; } @@ -3065,9 +3461,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }); }; - $scope.initGatewayChild = function(){ + $scope.initGatewayChild = function () { $scope.params.gatewayChilds = $scope.params.gateway; - $scope.params.gatewayChild=null; + $scope.params.gatewayChild = null; $scope.loadTradeLogs(1); } $scope.gatewaySelected = function (arr) { @@ -3129,7 +3525,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } $scope.loadTradeLogs(); }; - $scope.searchSubClients = function (subSearchText,page) { + $scope.searchSubClients = function (subSearchText, page) { $scope.subClientTable1 = [$scope.partner]; $scope.subClientTable2 = []; var params = {}; @@ -3138,13 +3534,13 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.subSearchText = subSearchText; params.searchText = subSearchText; } - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients/page',{params: params}).then(function (resp) { + $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 { + } else { $scope.subClientTable2.push(client); } $scope.clients.push(client); @@ -3153,7 +3549,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; if ($scope.partner.has_children && !$scope.partner.hide_sub_mch) { - $scope.searchSubClients('',1); + $scope.searchSubClients('', 1); $scope.loadTradeLogs(1); } else { $scope.loadTradeLogs(1); @@ -3518,9 +3914,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.listRedpackLogs(1); }]); app.controller('partnerAuthFileCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', function ($scope, $http, $rootScope, commonDialog, $state) { - if ($state.params.commitType=='card-payment'){ + if ($state.params.commitType == 'card-payment') { $state.go('partners.detail.files.MW_files'); - }else { + } else { $state.go('partners.detail.files.CP_files'); } }]); @@ -3731,7 +4127,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter commonDialog.alert({title: 'Error', content: '请选择ID Type', type: 'error'}); return; } - if ($scope.file.beneficiary_id_title!="Ultimate beneficiary owner") { + if ($scope.file.beneficiary_id_title != "Ultimate beneficiary owner") { if (!$scope.file.other_id_title_desc) { commonDialog.alert({title: 'Error', content: '请简要告知为何无法提供受益股东的资料', type: 'error'}); return; @@ -3752,7 +4148,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.cancelIdInfo = function () { $state.reload(); - $scope.id_info_form.edit=false + $scope.id_info_form.edit = false }; $scope.downloadAsZip = function () { @@ -4119,7 +4515,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.cancelIdInfo = function () { $state.reload(); - $scope.id_info_form.edit=false + $scope.id_info_form.edit = false }; $scope.downloadAsZip = function () { @@ -4134,8 +4530,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter content: 'Upload Successful', type: 'success' }); - $state.go('partners.detail.files',{clientMoniker:$scope.partner.client_moniker, - commitType: "card-payment"}, {reload: true}); + $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'}); }) @@ -4155,19 +4553,19 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $rootScope.complianceCheck.authFile = true; $rootScope.complianceCheck.client_id = $scope.partner.client_id; - if($scope.file.upay_application_form==null || $scope.file.upay_application_form ==''){ + 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 ==''){ + } 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 ==''){ + } 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 ==''){ + } 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 ==''){ + } 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; } @@ -4306,10 +4704,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } }; -/* $scope.downloadAsZip = function () { - var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/complianceAsZIP'; - return url; - };*/ + /* $scope.downloadAsZip = function () { + var url = '/sys/partners/' + $scope.partner.client_moniker + '/download/complianceAsZIP'; + return url; + };*/ $scope.deleteComplianceFiles = function (file_id) { commonDialog.confirm({ @@ -4377,7 +4775,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.isAll = true; $scope.more20ChoseSubClient = false; $scope.choseSubClientNow = 'More'; - $scope.searchSubClients = function (subSearchText,page) { + $scope.searchSubClients = function (subSearchText, page) { $scope.subClientTable1 = [$scope.partner]; $scope.subClientTable2 = []; @@ -4387,31 +4785,31 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.subSearchText = subSearchText; params.searchText = subSearchText; } - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/sub_clients/page',{params: params}).then(function (resp) { + $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 { + } else { $scope.subClientTable2.push(client); } $scope.clients.push(client); }); }); }; - $scope.initClientInfo = function(){ - $http.get('/sys/partners/'+clientMoniker).then(function (resp) { + $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.searchSubClients('', 1); $scope.params.dateto = new Date(); var day = new Date(); day.setDate(day.getDate() - 7); $scope.params.datefrom = day; $scope.chooseClient('all'); - }else { + } else { $scope.params.dateto = new Date(); var day = new Date(); day.setDate(day.getDate() - 7); @@ -4422,9 +4820,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } $scope.initClientInfo(); - $scope.exportSettlementLogs = function() { + $scope.exportSettlementLogs = function () { var params = angular.copy($scope.params); - var url = '/sys/partners/'+clientMoniker+'/lists_settlements/excel'; + var url = '/sys/partners/' + clientMoniker + '/lists_settlements/excel'; var connectSymbol = '?'; if (params.datefrom) { params.datefrom = $filter('date')(params.datefrom, 'yyyyMMdd'); @@ -4435,7 +4833,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter params.dateto = $filter('date')(params.dateto, 'yyyyMMdd'); url += connectSymbol + 'dateto=' + params.dateto; } - if (params.client_ids && !$scope.isAll){ + if (params.client_ids && !$scope.isAll) { params.client_ids.forEach(function (i) { url += connectSymbol + 'client_ids=' + i; connectSymbol = '&'; @@ -4652,7 +5050,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.channelAndDayOfAnalysis(1); }]); - app.controller('managerSettlementDetailOfMergeSettleCtrl', ['$scope', 'detail','client_id','$http', function ($scope, detail,client_id,$http) { + 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; @@ -4805,21 +5203,21 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $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.partner.cardInfo = res.data; - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + 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.partner.cardInfo = res.data; + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) }) - }) }); }; $scope.applyRpaySubMerchantId = function () { @@ -5680,48 +6078,45 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; }]); - app.controller('incrementalServiceCtrl',['$scope', '$http', '$uibModal', '$state', '$filter', 'commonDialog',function($scope, $http, $uibModal, $state, $filter, commonDialog){ + 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.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.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.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.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 (){ + $scope.newServiceChannelDialog = function () { $uibModal.open({ templateUrl: '/static/payment/partner/templates/incremental_service_dialog.html', controller: 'incrementalServiceDialogCtrl', resolve: { - params: function(){ + params: function () { return { - isCreate:true, - clientMoniker:$scope.partner.client_moniker, - channelOptions:$scope.channelOptions, - serviceChannel:null + isCreate: true, + clientMoniker: $scope.partner.client_moniker, + channelOptions: $scope.channelOptions, + serviceChannel: null } } } @@ -5729,17 +6124,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.initData(); }); } - $scope.editServiceChannelDialog = function (serviceChannel){ + $scope.editServiceChannelDialog = function (serviceChannel) { $uibModal.open({ templateUrl: '/static/payment/partner/templates/incremental_service_dialog.html', controller: 'incrementalServiceDialogCtrl', resolve: { - params: function(){ + params: function () { return { - isCreate:false, - clientMoniker:$scope.partner.client_moniker, - channelOptions:$scope.channelOptions, - serviceChannel:serviceChannel + isCreate: false, + clientMoniker: $scope.partner.client_moniker, + channelOptions: $scope.channelOptions, + serviceChannel: serviceChannel } } } @@ -5747,9 +6142,9 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.initData(); }); } - $scope.updateStatus = function(service){ + $scope.updateStatus = function (service) { commonDialog.confirm({ - title: 'Update '+service.channel+ ' Incremental Service Status', + title: 'Update ' + service.channel + ' Incremental Service Status', content: 'Are you sure update ' + service.channel + ' status?', choises: [ {label: 'Submit', className: 'btn-success', key: 1}, @@ -5758,14 +6153,14 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }).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){ + $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) { + }, function (resp) { commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); $scope.initData(); }) @@ -5774,21 +6169,21 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } }]); - app.controller('incrementalServiceDialogCtrl',['$scope','$http','params','commonDialog',function($scope ,$http,params,commonDialog){ - $scope.model ={}; + 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 = 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{ + 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){ + $scope.save = function (form) { if (form.$invalid) { angular.forEach(form, function (item, key) { if (key.indexOf('$') < 0) { @@ -5798,15 +6193,15 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter return; } $scope.ctrl.sending = true; - $http.post('/sys/partners/'+params.clientMoniker+'/incremental_service',$scope.model).then(function(res){ + $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!', + content: $scope.isCreate ? 'Create Service Successful!' : 'Update Service Successful!', type: 'success' }); $scope.ctrl.sending = false; $scope.$close(); - },function (resp) { + }, function (resp) { $scope.ctrl.sending = false; commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); }) diff --git a/src/main/ui/static/payment/partner/templates/add_partner.html b/src/main/ui/static/payment/partner/templates/add_partner.html index 952266506..c51dcc45f 100644 --- a/src/main/ui/static/payment/partner/templates/add_partner.html +++ b/src/main/ui/static/payment/partner/templates/add_partner.html @@ -1317,13 +1317,13 @@ 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 29eb38502..949c9ecad 100644 --- a/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html +++ b/src/main/ui/static/payment/partner/templates/partner_bankaccounts.html @@ -1,5 +1,5 @@