diff --git a/extra/apple_message_cert_product_20200506.p12 b/extra/apple_message_cert_product_20200506.p12 new file mode 100644 index 000000000..4bd03a9d7 Binary files /dev/null and b/extra/apple_message_cert_product_20200506.p12 differ diff --git a/pom.xml b/pom.xml index 8dabbb902..b23cc0bec 100644 --- a/pom.xml +++ b/pom.xml @@ -5,14 +5,14 @@ au.com.royalpay.payment payment-parent - 2.1.25 + 2.1.48 4.0.0 manage - 2.2.5 + 2.3.7 UTF-8 - 1.8.0 + 2.2.0 ${project.version} @@ -33,30 +33,14 @@ au.com.royalpay.payment alipay-core - - au.com.royalpay.payment - hf-core - au.com.royalpay.payment rppaymentsvc - - au.com.royalpay.payment - jd-core - au.com.royalpay.payment rpay-core - - au.com.royalpay.payment - yeepay-core - - - au.com.royalpay.payment - bestpay-core - com.github.stuxuhai jpinyin @@ -285,9 +269,11 @@ ${docker-image.version} - - extra/ - + + + extra/ + + true @@ -315,11 +301,14 @@ hkccr.ccs.tencentyun.com/rpay/serverjre:openj9 - hkccr.ccs.tencentyun.com/cross-payment-dev/manage-dev:${docker-image.version} + hkccr.ccs.tencentyun.com/cross-payment-dev/manage-dev:${docker-image.version} + - - extra/ - + + + extra/ + + true @@ -349,9 +338,11 @@ hkccr.ccs.tencentyun.com/rpay/manage:${docker-image.version} - - extra/ - + + + extra/ + + true diff --git a/src/document/Dockerfile b/src/document/Dockerfile new file mode 100644 index 000000000..e6a4de344 --- /dev/null +++ b/src/document/Dockerfile @@ -0,0 +1,6 @@ +FROM nginx:alpine + +COPY openapi/* /usr/share/nginx/html/ +COPY default.conf /etc/nginx/conf.d/ + +EXPOSE 80 \ No newline at end of file diff --git a/src/document/default.conf b/src/document/default.conf new file mode 100644 index 000000000..c8e646dea --- /dev/null +++ b/src/document/default.conf @@ -0,0 +1,13 @@ +server { + listen 80; + server_name _ default; + + location / { + root /usr/share/nginx/html/; + index index.html; + } + + location =/ { + rewrite / /cn/ redirect; + } +} \ No newline at end of file diff --git a/src/document/openapi/cn/components_order.yml b/src/document/openapi/cn/components_order.yml new file mode 100644 index 000000000..a3caa0703 --- /dev/null +++ b/src/document/openapi/cn/components_order.yml @@ -0,0 +1,430 @@ + +orderBasic: + required: + - description + - currency + - price + properties: + description: + type: string + maxLength: 128 + description: 订单标题(最大长度128字符,超出自动截取) + price: + type: integer + description: 订单金额,单位为货币最小单位,例如100表示AUD1.00 + currency: + type: string + enum: + - AUD + - CNY + notify_url: + type: string + description: 支付通知回调url,详见支付通知api,不填不会推送支付通知。收到通知回调后强烈建议先进行主动查询再进行确认。 + operator: + type: string + description: 操作人员标识 +orderWithChannel: + allOf: + - $ref: '#/orderBasic' + - properties: + channel: + type: string + description: 支付渠道,大小写敏感 + enum: + - Alipay + - Wechat + type: object + required: + - channel +cardCustomerParam: + type: object + properties: + name: + type: string + description: 消费者姓名,不填会取持卡人姓名 + postcode: + type: string + example: 2000 + description: 澳大利亚邮编 + address: + type: string + description: 地址,可使用收货地址 + city: + type: string + example: Sydney + state: + type: string + example: VIC + country: + type: string + description: 2位国家代码 + example: AU + +cardCustomerInfo: + title: 卡信息 + properties: + bank: + type: string + description: 发卡行,可能拿不到 + card_type: + type: string + description: 卡类型 + example: credit/debit + card_alias: + type: string + description: 截断卡号,包含前6位和后3位 + example: 424242...242 + card_scheme: + description: 发卡组织 + type: string + example: VISA/MASTER + card_country: + description: 发卡国家 + type: string + example: AU + customer_id: + type: string + description: 当下单时tokenize=true或customer_id不为空时存在 +orderBasicResponse: + type: object + properties: + return_code: + type: string + description: 执行结果 + result_code: + type: string + description: SUCCESS表示创建订单成功,EXISTS表示订单已存在 + channel: + type: string + description: 支付渠道 + partner_code: + type: string + description: 商户编码 + full_name: + type: string + description: 商户注册全名 + partner_name: + type: string + description: 商户名称 + order_id: + type: string + description: RoyalPay订单ID,同时也是支付渠道订单ID,最终支付成功的订单ID可能不同 + partner_order_id: + type: string + description: 商户订单ID +orderStatus: + type: object + properties: + return_code: + type: string + description: 执行结果 + example: + SUCCESS + result_code: + type: string + description: | + 订单状态 + - PAYING: 等待支付 + - CREATE_FAIL: 创建失败 + - CLOSED: 已关闭 + - PAY_FAIL: 支付失败 + - PAY_SUCCESS: 支付成功 + - PARTIAL_REFUND: 部分退款 + - FULL_REFUND: 全额退款 + 如果需要可以用相同订单号再次发起支付单,支付成功或支付中的无法重复发起订单 + enum: + - PAYING + - CREATE_FAIL + - CLOSED + - PAY_FAIL + - PAY_SUCCESS + - PARTIAL_REFUND + - FULL_REFUND + order_id: + type: string + description: RoyalPay订单ID,同时也是支付渠道订单ID,最终支付成功的订单ID可能不同 + partner_order_id: + type: string + description: 商户订单ID + channel_order_id: + type: string + description: 渠道方(支付宝、微信)交易流水号 + total_fee: + type: integer + description: 订单金额,单位是货币最小面值单位 + real_fee: + type: integer + description: 实际支付金额,单位是货币最小面值单位(目前等于订单金额,为卡券预留) + currency: + type: string + description: 币种,通常为AUD + rate: + type: number + description: 交易时使用的汇率,1AUD=?CNY + pay_time: + type: string + format: 'date-time' + pattern: yyyy-mm-dd HH:mm:ss + description: 支付时间(yyyy-MM-dd HH:mm:ss,GMT+10) + create_time: + type: string + format: 'date-time' + pattern: yyyy-mm-dd HH:mm:ss + description: 订单创建时间(最新订单为准)(yyyy-MM-dd HH:mm:ss,GMT+10) + settlement_date: + type: string + format: date + pattern: yyyy-mm-dd + description: 预期清算日期(可能受到账情况、节假日影响)(yyyy-MM-dd) + channel: + type: string + description: 支付渠道 + customer_info: + anyOf: + - title: 支付宝用户 + type: object + properties: + alipay_user_id: + type: string + description: 支付宝用户id + alipay_account: + type: string + description: 用户账号 + - $ref: 'components_order.yml#/cardCustomerInfo' +refundStatus: + type: object + properties: + return_code: + type: string + description: 执行结果 + example: + SUCCESS + result_code: + type: string + description: | + 退款状态 + - WAITING: 正在提交 + - CREATE_FAILED: 提交失败 + - SUCCESS: 提交成功,等待入账 + - FAILED: 退款失败 + - FINISHED: 退款成功,已入账 + enum: + - WATING + - CREATE_FAILED + - SUCCESS + - FAILED + - FINISHED + refund_id: + type: string + description: RoyalPay退款单号 + partner_refund_id: + type: string + description: 商户提交的退款单号 + amount: + type: integer + description: 退款金额,单位是货币最小单位 + currency: + type: string + description: 币种 + example: + AUD + settlement_date: + type: string + format: date + pattern: yyyy-mm-dd + description: 预期清算日期(可能受到账情况、节假日影响)(yyyy-MM-dd),仅退款成功存在(SUCCESS, FINISHED) +transactionItem: + type: object + properties: + transaction_time: + type: string + format: 'date-time' + pattern: yyyyMMddHHmmss + description: 交易时间,格式yyyyMMddHHmmss,GMT+10 + partner_code: + type: string + description: 订单关联商户 + order_id: + type: string + description: RoyalPay订单ID + partner_order_id: + type: string + description: 商户订单ID + channel_order_id: + type: string + description: 渠道方订单号 + refund_id: + type: string + description: RoyalPay退款单号(仅退款或退款失败补正存在) + partner_refund_id: + type: string + description: 商户系统提交退款ID(仅退款或退款失败补正) + gateway: + type: integer + description: | + 下单接口 + - 0: RoyalPay POS机付款码(扫描客户展示的付款码) + - 1: RoyalPay POS机聚合支付码(客户扫描POS展示的二维码) + - 2: RoyalPay 商户静态码 + - 3: QRCode 网关 + - 4: JSAPI 网关 + - 5: 第三方POS付款码网关 + - 6: 第三方POS聚合支付码网关 + - 7: RoyalPay 商户静态码(已停用) + - 8: H5网关 + - 9: WEB网关 + - 10: SDK订单 + - 11: RoyalPay账单码 + - 12: 小程序 + - 13: 原生二维码订单 + - 14: RoyalPay账单链接 + - 15: 原生JSAPI + - 16: 卡支付预订单 + - 17: 卡支付订单 + - 18: DirectDebit + channel: + type: string + description: 下单渠道 + type: + type: string + description: 流水类别 + enum: + - Credit + - Debit + currency: + type: string + description: 订单币种 + example: + AUD + total_amount: + type: integer + description: 订单总金额,单位是货币最小单位 + input_amount: + type: integer + description: 订单输入金额,单位是货币最小单位 + customer_payment_amount: + type: integer + description: 用户实际支付金额,单位是货币最小单位 + settle_amount: + type: integer + description: 结算金额,币种为AUD,单位是货币最小单位 + transfer_amount: + type: integer + description: 打款金额(结算金额-手续费-GST),币种为AUD,单位是货币最小单位 + surcharge: + type: integer + description: 手续费,币种为AUD,单位是货币最小单位 + gst: + type: integer + description: GST金额,币种为AUD,单位是货币最小单位 + exchange_rate: + type: number + description: 使用汇率 + remark: + type: string + description: 备注 +customInfo: + type: object + properties: + report_id: + type: string + description: RoyalPay海关单号 + client_report_id: + type: string + description: 商户申请报关单号 + report_status: + type: string + description: 报关单状态 + enum: + - PROCESSING + - SUBMITED + - FAILED + - SUCCESS + channel: + type: string + description: 支付渠道 + custom: + type: string + description: 海关编号 + mch_custom_no: + type: string + description: 商户在海关备案的编号 + mch_custom_name: + type: string + description: 商户海关备案名称 + order_id: + type: string + description: RoyalPay订单号 + transaction_id: + type: string + description: 支付渠道订单号 + order_currency: + type: string + description: 币种 + order_amount: + type: number + description: 订单金额 + report_time: + type: string + format: 'date-time' + description: 报关时间 + creation_date: + format: 'date-time' + type: string + description: 报关单创建时间 + last_update_date: + type: string + format: 'date-time' + description: 更新时间 + error_code: + type: string + description: 错误代码 + error_msg: + type: string + description: 错误返回的信息描述 + verify_department: + type: string + description: 验核机构 + verify_department_trade_id: + type: string + description: 验核机构交易流水号 + sub_orders: + type: array + items: + type: object + properties: + sub_order_no: + type: string + description: 商户子订单号 + fee_type: + type: string + description: 币种代码 + default: CNY + enum: + - CNY + order_fee: + type: number + description: 子订单金额 + transport_fee: + type: number + description: 子订单物流金额 + verify_department: + type: string + description: 验核机构 + verify_department_trade_id: + type: string + description: 验核机构交易流水号 + report_status: + type: string + description: 报关单状态 + enum: + - PROCESSING + - SUBMITED + - FAILED + - SUCCESS + error_code: + type: string + description: 错误代码 + error_msg: + type: string + description: 错误返回的信息描述 \ No newline at end of file diff --git a/src/document/openapi/cn/document.yml b/src/document/openapi/cn/document.yml new file mode 100644 index 000000000..b77863011 --- /dev/null +++ b/src/document/openapi/cn/document.yml @@ -0,0 +1,1355 @@ +openapi: 3.0.3 +info: + title: RoyalPay Developer Documents + version: 1.0.0 + x-logo: + url: img/rp_logo.svg + description: | + [English](/en/) + + # 请求方式和参数格式 + 支付单和退款单提交均为PUT方式,订单查询均为GET方式;包含Request Entity的请求参数格式为json + + 除跳转页面外,所有的Accept均为application/json;所有的PUT/POST请求Content-Type为application/json + + 系统使用UTF-8字符集 + + 参数分为三种:Path Variable/Query Param/JSON entity + + - PathVariable:包含在URI内的参数 + - Query Param:在URI末尾?后的key=value形式的参数 + - JSON entity:只在PUT/POST请求中使用 + 所有返回JSON的API,成功访问返回状态值均为200(不论执行结果)。JSON固定包含字段return_code,若值为SUCCESS则表示执行成功; 其他值表示执行失败,此时可查询错误码了解对应的错误类型,此时还会携带return_msg字段作为错误描述信息 + + # 多语言支持 + + 系统错误提示支持中文、英文两种语言,默认根据Request Header中的Accept-Language值自动选择,如需调整亦可以添加locale cookie进行指定。 + + # 选择接入API + + + # 支付宝渠道区分 + + 支付宝根据调用接口不同分为线上和线下两个渠道,两个渠道分别使用不同的汇率和手续费费率,为避免混淆在此区分: + + - 线上渠道:包含H5 Mobile、Web支付、APP SDK、JSAPI、QR Code 5种支付方式 + - 线下渠道:Retail Pay 支付方式 + + 相似接口区别 + + - JSAPI和H5 Mobile:JSAPI只能在支付宝客户端内访问的页面调起支付,H5可以在移动设备任意浏览器或App的WebView调起支付 + - Web支付和QR Code: Web支付会跳转到支付宝官方收银台,用户可以选择登陆账号或用客户端扫码完成支付;QR Code方式商户可以自行展示创建的二维码,也可以跳转到RoyalPay展示的收银台页面显示二维码,用户只能用支付宝客户端扫码完成支付。 + + # 币种代码 + + 由于渠道方限制原因,RoyalPay只接受人民币和澳元两个币种标价的支付订单。其中银行卡支付渠道仅支持AUD下单。无论标价是什么币种最终结算币种为AUD + + - AUD:澳元 + - CNY:人民币 + + 除报关相关API以外,接口中的金额都应该取*币种最小单位*,如人民币和澳元都应该用分作为标价。如AUD 1.00的订单提交的金额参数为100 + + # 业务规则 + + - QRCode支付是在网页上展示二维码,用户使用微信扫一扫扫码后直接进入微信支付页面,适用于商城类web网站; + - JSAPI支付是在微信浏览器内直接跳转到RoyalPay让用户选择支付订单,页面只能在微信客户端打开,适用于微店; + - 创建订单时需要提供订单号,同一个订单允许重复提交,系统会自动根据订单状态判断是否创建新订单并关闭旧订单。因此商户端应该同一个订单只用一个单号,避免重复付款; + - 由于存在自动创建新订单机制,创建订单后返回的RoyalPay单号不代表最终支付的单号; + - QRCode支付订单创建后会直接返回QRCode和pay_url,商户可以自行选择展示支付二维码或跳转至RoyalPay支付页; + - JSAPI支付订单创建后会返回pay_url,商户应该跳转到这个地址让用户完成支付; + - 跳转pay_url时必须加上签名信息; + - 每次请求都应该生成新的签名; + - 订单成功支付后会调用订单中提供的notify_url,详情可以查看API定义;若创建订单时未提供,商户需要在创建订单后轮询订单状态接口,直到订单被支付或过期; + - 订单支付有效期为5分钟,超时可以用相同的订单号重新发起请求,建议重新发起请求的时机为用户再次打开支付页的时候; + - 使用跳转支付页前应该先调用后台服务输入金额等参数创建订单后再跳转; + - 创建订单、创建退款接口都允许同订单号重复调用,但是具体参数以初次请求的参数为准; + - 所有和金额相关的数字均以货币最小面值为单位,以AUD为例,100表示AUD 1.00。 + + # 案例 + https://example.royalpay.com.au/api/payment/order + + + + # 示例代码 + - PHP: https://mpay.royalpay.com.au/static/phpdemo.zip + - Java: https://mpay.royalpay.com.au/static/javademo.zip + + # 错误码参考 + ## 通用错误码 + - SYSTEMERROR: 系统内部异常 + - INVALID_SHORT_ID: 商户编码不合法或没有对应商户 + - SIGN_TIMEOUT: 签名超时,time字段与服务器时间相差超过5分钟 + - SIGN_EXPIRED: 签名失效,签名被重复使用 + - INVALID_SIGN: 签名错误 + - PARAM_INVALID: 参数不符合要求,具体细节可参考return_msg字段 + + ## 下单错误码 + - NOT_PERMITTED: 未开通网关支付权限 + - INVALID_CHANNEL: 不合法的支付渠道名称,请检查大小写 + - ORDER_MISMATCH: 订单号与商户不匹配 + - AUTHCODEEXPIRE: 二维码已过期 + - NOTSUPORTCARD: 不支持卡类型 + - AUTH_CODE_ERROR: 二维码被重复提交 + - AUTH_CODE_INVALID: 非法二维码 + - NOTENOUGH: 账户余额不足 + - ORDER_PAID: 订单已支付 + +servers: + - url: https://mpay.royalpay.com.au/api/v1.0 + description: production + - url: https://sandbox.royalpay.com.au/api/v1.0 + description: sandbox +tags: + - name: PublicApi + description: 公共API + - name: QRCode + description: | + QRCode支付单适用于PC端网页/应用进行支付,用户使用微信/支付宝客户端扫描下单后生成的二维码完成支付。 + + 返回值包括二维码字符串,二维码图片,支付地址,商户可以自行决定直接展示二维码或跳转支付页,跳转支付页需要带上签名信息。 货币类型如果是CNY,注意通过汇率转换后不得低于0.01AUD,否则订单可以创建成功,但支付时会报金额不合法错误 + - name: JSAPI + description: | + JSAPI适用于在微信/支付宝内打开的网页进行支付,如果用户从微信公众号进入支付页要求公众号已完成认证。用户下单后跳转至RoyalPay订单页,并拉起微信或支付宝内置收银台完成支付 + + 返回值包括支付地址,商户应该引导用户跳转支付页,跳转支付页需要带上签名信息; 货币类型如果是CNY,注意通过汇率转换后不得低于0.01AUD,否则订单可以创建成功,但支付时会报金额不合法错误 + - name: MobileH5 + description: | + 创建H5支付单(仅支持支付宝) + H5支付适用场景为移动端App或者手机自带浏览器进行支付,用户下单后浏览器跳转至微信支付页面并自动拉起支付宝客户端完成支付。 + 返回值包括跳转支付地址,跳转支付页需要带上签名信息。 货币类型如果是CNY,注意通过汇率转换后不得低于0.01AUD,否则订单可以创建成功,但支付时会报金额不合法错误 + + - name: MiniProgram + description: | + 接入微信小程序需完成海外主体认证,并且认证主体需要与在RoyalPay开通的商户主体一致。具体如何认证请查看微信公众平台相关文档。 + 用于小程序中发起支付,创建订单后返回小程序支付所需参数,[微信接入参考文档](https://www.royalpay.com.au/downloads/MiniProgram_WechatPay.pdf) + + - name: CardPayment + description: | + 卡支付即消费者输入银行卡信息进行下单的接口,接入卡支付需要额外的合规流程。 + - name: RetailPay + description: | + 线下支付订单接口用于线下零售收银,有B扫C和C扫B两种模式 + - name: AlipayOnline + description: | + 用于PC端支付宝支付,创建订单后跳转到返回的pay_url(需附加签名参数和redirect参数),随后进入支付宝支付页面完成支付 + 该接口现仅支持支付宝。 + + - name: CB Bank + description: | + 用于PC端网银快捷支付,创建订单后跳转到返回的pay_url,随后进入网银快捷支付页面完成支付 + - name: SDK Payment + description: | + 用于移动端APP调用微信/支付宝SDK支付,调用API创建订单,得到微信SDK调用参数,将参数传递给SDK拉起微信/支付宝支付,并由客户端直接返回支付结果。 强烈建议获得支付结果后再调用RoyalPay订单查询API确认完成支付后再进行后续流程,避免因超时自动撤单导致资金损失 + + 关于客户端和支付宝整和的更多信息:[支付宝SDK文档](https://global.alipay.com/doc/app_cn/about) + 关于客户端和微信整合的更多信息:[微信SDK文档](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=11_1) + [Alipay SDK for Android](resources/api/alipaySdk-20160825.jar) + [Alipay SDK for iOS](resources/api/AlipaySDKForiOS.zip) + [Wechat SDK for Android](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319167&token=&lang=zh_CN) + [Wechat SDK for iOS](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319164&lang=zh_CN) + + - name: Custom + description: 用于商户提交海关需要的订单附件信息。仅支持微信和支付宝,微信只支持一个月内的支付订单进行报关申请。 +security: + - sign: [] + nonce_str: [] + time: [] +paths: + /gateway/partners/{partner_code}/orders/{partner_order_id}: + put: + tags: + - QRCode + summary: 创建QRCode支付单 + x-sort-order: 0 + parameters: + - name: partner_code + in: path + required: true + description: 商户编码,由4位大写字母或数字构成 + - name: partner_order_id + in: path + required: true + description: 商户支付订单号,要求同一商户唯一 + requestBody: + content: + application/json: + schema: + $ref: 'components_order.yml#/orderWithChannel' + responses: + 200: + description: 执行结果 + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + code_url: + type: string + description: 支付码字符串,商户可以据此自行生产二维码 + qrcode_img: + type: string + description: Base64封装的二维码图片,可直接作为img的src属性 + pay_url: + type: string + description: 收银台URL,如果商户选择跳转到royalpay的QR收银台可使用此url + get: + summary: 查询订单状态 + x-sort-order: 9 + tags: + - SDK Payment + - CB Bank + - RetailPay + - AlipayOnline + - CardPayment + - MiniProgram + - MobileH5 + - JSAPI + - QRCode + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + responses: + 200: + description: Order Status + content: + application/json: + schema: + $ref: 'components_order.yml#/orderStatus' + delete: + summary: 关闭订单 + x-sort-order: 10 + tags: + - SDK Payment + - CB Bank + - RetailPay + - AlipayOnline + - CardPayment + - MiniProgram + - MobileH5 + - JSAPI + - QRCode + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + responses: + 200: + description: Order Status + content: + application/json: + schema: + $ref: 'components_order.yml#/orderStatus' + /gateway/partners/{partner_code}/native_orders/{partner_order_id}: + put: + tags: + - QRCode + summary: 创建原生QRCode支付单 + description: | + 原生二维码支付单展示的是直接由微信、支付宝生成的收款码,扫码后直接在APP内加载,对于消费者网络环境不佳的场景具有一定帮助 + parameters: + - name: partner_code + in: path + required: true + description: 商户编码,由4位大写字母或数字构成 + - name: partner_order_id + in: path + required: true + description: 商户支付订单号,要求同一商户唯一 + requestBody: + content: + application/json: + schema: + $ref: 'components_order.yml#/orderWithChannel' + responses: + 200: + description: 执行结果 + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + code_url: + type: string + description: 支付码字符串,商户可以据此自行生产二维码 + qrcode_img: + type: string + description: Base64封装的二维码图片,可直接作为img的src属性 + pay_url: + type: string + description: 收银台URL,如果商户选择跳转到royalpay的QR收银台可使用此url + /gateway/partners/{partner_code}/orders/{partner_order_id}/pay: + get: + tags: + - QRCode + summary: QRCode支付页 + x-sort-order: 2 + description: 必须先调用创建QRCode订单接口再进行跳转。 建议在用户回调到对应页时通过后台查询订单状态接口确认订单的支付状态。 + parameters: + - name: partner_code + in: path + required: true + description: 商户编码,由4位大写字母或数字构成 + - name: partner_order_id + in: path + required: true + description: 商户支付订单号,要求同一商户唯一 + - name: redirect + required: true + in: query + description: 支付成功后跳转页面,回调时会带上签名参数用于校验 + responses: + 200: + description: 支付页面 + content: + text/html: + schema: + type: string + /jsapi_gateway/partners/{partner_code}/orders/{partner_order_id}: + put: + summary: 创建JSAPI订单 + description: 创建JSAPI订单 + x-sort-order: 0 + tags: + - JSAPI + parameters: + - name: partner_code + in: path + required: true + description: 商户编码,由4位大写字母或数字构成 + - name: partner_order_id + in: path + required: true + description: 商户支付订单号,要求同一商户唯一 + requestBody: + content: + application/json: + schema: + $ref: 'components_order.yml#/orderWithChannel' + responses: + 200: + description: 执行结果 + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + pay_url: + type: string + description: 收银台URL,加签后传递给前端并跳转至当前URL,让消费者完成支付 + /wechat_jsapi_gateway/partners/{partner_code}_order_{partner_order_id}: + get: + summary: 微信JSAPI支付跳转页 + description: 微信JSAPI支付跳转页,建议优先使用下单返回的pay_url字段 + x-sort-order: 2 + tags: + - JSAPI + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + - name: redirect + in: query + description: 支付完成回调,注意转义 + - name: directpay + in: query + description: 是否进入页面后直接发起支付 + schema: + type: boolean + responses: + 200: + description: 微信JSAPI支付跳转页 + content: + text/html: + schema: + type: string + /gateway/alipay/partners/{partner_code}/orders/{partner_order_id}/app_pay: + get: + summary: 支付宝JSAPI支付跳转页 + description: 支付宝JSAPI支付跳转页,建议优先使用下单返回的pay_url字段 + x-sort-order: 2 + tags: + - JSAPI + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + - name: redirect + in: query + description: 支付完成回调,注意转义 + - name: directpay + in: query + description: 是否进入页面后直接发起支付 + schema: + type: boolean + responses: + 200: + description: 支付宝JSAPI支付跳转页 + content: + text/html: + schema: + type: string + /h5_payment/partners/{partner_code}/orders/{partner_order_id}: + put: + summary: MobileH5下单 + description: 仅支持支付宝接口 + x-sort-order: 0 + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + tags: + - MobileH5 + requestBody: + content: + application/json: + schema: + type: object + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + properties: + channel: + type: string + description: 支付渠道,大小写敏感 + enum: + - Alipay + responses: + 200: + description: Order + content: + application/json: + schema: + type: object + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + pay_url: + type: string + description: 收银台URL,加签后传递给前端并跳转至当前URL,让消费者完成支付 + /h5_payment/partners/{partner_code}/orders/{partner_order_id}/pay: + get: + summary: H5支付跳转页 + description: H5支付跳转页,建议优先使用下单返回的pay_url字段 + x-sort-order: 2 + tags: + - MobileH5 + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + - name: redirect + in: query + description: 支付完成回调,注意转义 + responses: + 200: + description: H5支付跳转页 + content: + text/html: + schema: + type: string + /gateway/partners/{partner_code}/microapp_orders/{partner_order_id}: + put: + summary: 小程序下单 + x-sort-order: 0 + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + tags: + - MiniProgram + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderWithChannel' + - type: object + properties: + appid: + type: string + description: 小程序appid,接入微信小程序必填,支付宝小程序不需要 + customer_id: + type: string + description: 小程序获取的用户id(微信为openid, 支付宝为userid) + responses: + 200: + description: Order + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + sdk_params: + type: string + description: 序列化后的json字符串,直接提交给小程序端作为参数发起支付 + /gateway/partners/{partner_code}/pre_card_orders/{partner_order_id}: + put: + summary: 卡支付预定单 + x-sort-order: 1 + description: | + 预订单模式是先提交基础下单参数,然后跳转到royalpay网关页让消费者完成卡信息提交并完成支付。 + 卡支付预订单允许消费者多次尝试输入,因此除非主动关闭订单,订单会一直持续到有效期结束。 + tags: + - CardPayment + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + properties: + domestic_only: + type: boolean + default: false + description: | + 是否只允许本国卡。由于境内境外卡支付手续费差异巨大,可在此限制。 + **当商户开启消费者支付手续费功能,而international_only提交了false时,当前参数自动置为true。** + international_only: + type: boolean + default: false + description: | + 是否只允许国际卡。当商户开启消费者支付手续费功能,需要提交当前参数为true才可允许国际卡支付,同时此订单将只允许国际卡支付。 + **因此商户需要在支付页面提供本地卡和国际卡两个支付入口!** + + 另:当domestic_only=true的时候当前参数无效。 + disable_credit_card: + type: boolean + default: false + description: 如果希望禁止消费者使用信用卡支付可传入true + tokenize: + type: boolean + default: false + description: 支付成功后是否返回消费者ID,此后下单可以提供customer_id免去消费者输入卡号、有效期等步骤,仅需要输入CVV2/CVC码。 + customer_id: + type: string + description: 使用tokenize得到的customer_id下单,当customer_id不为空时,tokenize参数无效,可免去消费者输入卡号、有效期等步骤,仅需要输入CVV2/CVC码。 + customer: + $ref: 'components_order.yml#/cardCustomerParam' + responses: + 200: + description: Order + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + pay_url: + type: string + description: 收银台URL,加签后传递给前端并跳转至当前URL,让消费者完成支付 + /card_payment_view/partners/{partner_code}/orders/{partner_order_id}/view: + get: + summary: 卡支付收银台 + description: 建议以下单返回的pay_url为准 + x-sort-order: 2 + tags: + - CardPayment + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + - name: redirect + in: query + description: 支付完成同步回调,注意转义 + responses: + 200: + description: 支付跳转页 + content: + text/html: + schema: + type: string + /gateway/partners/{partner_code}/card_orders/{partner_order_id}: + put: + summary: 卡支付下单 + x-sort-order: 0 + description: | + 商户可在页面引入https://channel.rpayplus.com/channel/v1/view/card_input_frame.js + 并通过回调取得key_id和secret信息,并将其作为卡信息提交给royalpay直接完成下单支付。 + + js引用案例: + ``` + let cardInputContainer = document.getElementById('card-input-area');//预先准备放置卡输入界面的container + let cardInput = new CardInputFrame(cardInputContainer);//创建frame对象 + //设置iframe的样式参数 + cardInput.frameStyle = { + width: '100%', + height: '400px', + border: 'none', + borderRadius: '10px' + }; + cardInput.onError = function(msg){ + //卡输入界面返回错误信息时进行展示 + }; + cardInput.onReady = function(){ + //iframe加载完毕的触发事件 + }; + cardInput.onSuccess = function(secretData){ + //成功取得加密卡信息回调 + //secretData: {'key_id':'','secret':''} + }; + cardInput.show();//开始加载iframe + + //通过外部事件触发卡输入界面提交,注意卡输入界面没有按钮,必须通过外部触发提交事件。并回调到onSuccess回调函数。 + cardInput.commit(); + ``` + tags: + - CardPayment + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + required: + - key_id + - card_info + properties: + key_id: + type: string + description: 卡输入界面回调得到的key_id + card_info: + type: string + description: 卡输入界面回调得到的secret + domestic_only: + type: boolean + default: false + description: 是否只允许本国卡。由于境内境外卡支付手续费差异巨大,可在此限制。 + disable_credit_card: + type: boolean + default: false + description: 如果希望禁止消费者使用信用卡支付可传入true + customer: + $ref: 'components_order.yml#/cardCustomerParam' + responses: + 200: + description: Order + content: + application/json: + schema: + $ref: 'components_order.yml#/orderBasicResponse' + /micropay/partners/{partner_code}/orders/{partner_order_id}: + put: + summary: 付款码下单 + x-sort-order: 0 + description: | + 线下支付订单接口用于带有扫码设备的收银终端进行对接,商户输入金额后要求客户出示支付码,用扫码枪扫码后将扫码内容和金额一并提交并完成支付操作。 + 线下支付订单接口现已兼容微信、支付宝通道。可根据付款码自动识别交易渠道。 + + tags: + - RetailPay + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + required: + - auth_code + - device_id + properties: + device_id: + type: string + description: 扫码设备id + auth_code: + type: string + description: 付款码 + responses: + 200: + description: Result + content: + application/json: + schema: + $ref: 'components_order.yml#/orderStatus' + /retail_qrcode/partners/{partner_code}/orders/{partner_order_id}: + put: + summary: 线下QRCode支付单 + x-sort-order: 1 + description: | + 线下QRCode支付用于对接无扫码设备的收银终端,下单后得到二维码地址,自行生成二维码图片后展示在收银终端屏幕上,并由用户使用对应支付客户端进行扫码支付。 线下QRCode现已同时兼容支付宝、微信客户端进行支付 + + tags: + - RetailPay + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + required: + - device_id + properties: + device_id: + type: string + description: 收银设备id + responses: + 200: + description: Order + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + code_url: + type: string + description: 付款码字符串,商户可自行生成二维码 # todo + /alipay/partners/{partner_code}/orders/{partner_order_id}: + put: + summary: 支付宝WEB订单下单 + x-sort-order: 0 + description: | + 创建订单后跳转到返回的pay_url(需附加签名参数和redirect参数),随后进入支付宝支付页面完成支付 + 该接口现仅支持支付宝。 + tags: + - AlipayOnline + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + requestBody: + content: + application/json: + schema: + $ref: 'components_order.yml#/orderBasic' + responses: + 200: + description: Order + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + pay_url: + type: string + description: 收银台URL,加签后传递给前端并跳转至当前URL,让消费者完成支付 + /cb_bankpay/partners/{partner_code}/orders/{partner_order_id}: + put: + summary: 网银快捷支付下单 + x-sort-order: 0 + tags: + - CB Bank + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + required: + - product_name + - gateway_type + properties: + product_name: + type: string + description: 商品名称 + gateway_type: + type: integer + description: '网关类型,8: H5网关,9:PC网关' + enum: + - 8 + - 9 + responses: + 200: + description: Order + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + pay_url: + type: string + description: 收银台URL,加签后传递给前端并跳转至当前URL,让消费者完成支付 + /gateway/partners/{partner_code}/app_orders/{partner_order_id}: + put: + summary: SDK下单 + x-sort-order: 0 + tags: + - SDK Payment + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + required: + - channel + properties: + channel: + type: string + description: 支付渠道,大小写敏感 + enum: + - Wechat + - Alipay + system: + type: string + description: 客户端操作类型,支付宝选填,微信不需要 + enum: + - android + - iphone + - ipad + version: + type: string + description: 客户端版本号,支付宝选填,微信不需要 + appid: + type: string + description: 微信必填,开发者平台appid + responses: + 200: + description: Order + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + sdk_params: + type: string + description: json字符串,可直接传递给SDK端发起支付 + /gateway/partners/{partner_code}/channel_exchange_rate: + get: + summary: 渠道汇率查询 + description: 获取当前各渠道AUD兑CNY汇率值(1AUD=?CNY),该汇率仅做参考,以实际成交汇率为准 + tags: + - PublicApi + parameters: + - name: partner_code + in: path + required: true + responses: + 200: + description: exchange rate + content: + application/json: + schema: + type: object + description: OK + properties: + return_code: + type: string + description: 状态码 + example: + SUCCESS + wechat_rate: + type: number + description: 微信当前汇率 + example: + 4.41111 + alipay_retail_rate: + type: number + description: 支付宝线下接口汇率 + example: + 4.411111 + alipay_online_rate: + type: number + description: 支付宝线上汇率 + example: + 4.411111 + /gateway/partners/{partner_code}/orders/{partner_order_id}/refunds/{partner_refund_id}: + put: + summary: 发起退款 + x-sort-order: 11 + description: 一笔支付订单可以分多次退款,退款总金额不得超过实际支付金额,退款币种与支付订单一致 + tags: + - QRCode + - JSAPI + - MobileH5 + - MiniProgram + - CardPayment + - AlipayOnline + - RetailPay + - CB Bank + - SDK Payment + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + description: 需要退款订单的单号 + - name: partner_refund_id + in: path + required: true + description: 退款单号 + requestBody: + content: + application/json: + schema: + type: object + required: + - fee + properties: + fee: + type: integer + description: 退款金额,单位是货币最小单位,单个订单退款单金额总和不能超过用户支付金额 + device_id: + type: string + description: 操作设备id + responses: + 200: + description: Refund + content: + application/json: + schema: + $ref: 'components_order.yml#/refundStatus' + get: + summary: 查询退款 + x-sort-order: 12 + tags: + - QRCode + - JSAPI + - MobileH5 + - MiniProgram + - CardPayment + - AlipayOnline + - RetailPay + - CB Bank + - SDK Payment + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + description: 需要退款订单的单号 + - name: partner_refund_id + in: path + required: true + description: 退款单号 + responses: + 200: + description: Refund Status + content: + application/json: + schema: + $ref: 'components_order.yml#/refundStatus' + /gateway/partners/{partner_code}/transactions: + get: + summary: 查询流水 + description: | + 本接口将列出商户当日所有流水,包括所有接口(含非网关接口)支付通道的付款、RoyalPay优惠补贴、退款、 退款失败补正、系统补正、营销账户转入转出等,不含清算信息 + 注意一笔付款订单或退款订单均可能对应多条流水记录 + tags: + - PublicApi + parameters: + - name: partner_code + in: path + required: true + - name: date + schema: + format: date + pattern: yyyyMMdd + type: string + in: query + required: true + description: 账单日期,'yyyyMMdd'格式,GMT+10,只能查今天以前的账单 + example: 20200315 + responses: + 200: + description: Orders + content: + application/json: + schema: + type: object + properties: + return_code: + type: string + description: 执行结果 + example: + SUCCESS + result_code: + type: string + description: 业务执行结果 + example: + SUCCESS + transaction_count: + type: integer + description: 流水条数 + order_count: + type: integer + description: 付款条数 + refund_count: + type: integer + description: 退款条数 + transactions: + type: array + items: + allOf: + - $ref: 'components_order.yml#/transactionItem' + - type: object + properties: + settlement_date: + type: string + format: date + pattern: yyyy-mm-dd + description: 预期清算日期(可能受到账情况、节假日影响)(yyyy-MM-dd) + /gateway/partners/{partner_code}/settlements: + get: + summary: 查看清算详情 + description: | + 本接口将列出商户查询日期清算的所有流水,包括所有接口(含非网关接口)支付通道的付款、RoyalPay优惠补贴、退款、 退款失败补正、系统补正、营销账户转入转出等 + 注意一笔付款订单或退款订单均可能对应多条流水记录 + tags: + - PublicApi + parameters: + - name: partner_code + in: path + required: true + - name: date + in: query + schema: + format: date + pattern: yyyyMMdd + type: string + description: 清算日期,'yyyyMMdd'格式,GMT+10,只能查今天以前 + required: true + responses: + 200: + description: Settlements + content: + application/json: + schema: + type: object + properties: + return_code: + type: string + description: 执行结果 + example: + SUCCESS + result_code: + type: string + description: 业务执行结果 + example: + SUCCESS + settle_from: + type: string + format: date + description: 订单起始日期:yyyyMMdd + settle_to: + type: string + format: date + description: 订单截止日期:yyyyMMdd + settle_days: + type: string + description: 清算周期 + example: + T+2 + transaction_count: + type: integer + description: 流水条数 + order_count: + type: integer + description: 付款条数 + refund_count: + type: integer + description: 退款条数 + total_credit: + type: integer + description: 入账总金额(AUD分) + total_debits: + type: integer + description: 支出总金额(AUD分) + total_surcharge: + type: integer + description: 手续费总额(AUD分) + total_transfer: + type: integer + description: 打款总额(AUD分) + transactions: + type: array + items: + $ref: 'components_order.yml#/transactionItem' + /notify: + post: + summary: 到账通知 + description: | + 若订单创建时提供了notify_url,系统会在用户支付成功后向这个地址主动发送支付成功状态推送,请求方式为POST + 与服务器API不同,推送校验参数会包含在json内,商户系统应该验证校验参数,确定来源正确后再次进行订单接口查询确认订单支付状态再进行后续操作。 + 商户系统收到请求后应按要求返回参数,若RoyalPay未收到合法参数,视为商户未接收成功,推送动作首次触发会重试3次,随后24小时内每10分钟推送一次,直到返回200状态码。 + 商户系统应当能够处理收到的重复请求。 + 商户系统收到通知后以防万一应调用主动查询接口确认订单状态。 + tags: + - SDK Payment + - CB Bank + - RetailPay + - AlipayOnline + - CardPayment + - MiniProgram + - MobileH5 + - JSAPI + - QRCode + requestBody: + content: + application/json: + schema: + type: object + properties: + time: + type: integer + format: int64 + description: UTC时间戳 + nonce_str: + type: string + description: 随机字符串 + sign: + type: string + description: 签名 + partner_order_id: + type: string + description: 商户单号 + channel_order_id: + type: string + description: 渠道方交易单号 + order_id: + type: string + description: RoyalPay订单号 + total_fee: + type: integer + description: 订单金额,单位是最小货币单位 + real_fee: + type: integer + description: 支付金额,单位是最小货币单位 + rate: + type: number + description: 交易时使用的汇率,1AUD=?CNY + currency: + type: string + description: 币种,AUD + channel: + type: string + description: 交易渠道 + create_time: + type: string + format: 'date-time' + pattern: yyyy-MM-dd HH:mm:ss + description: 订单创建时间,格式为'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 + responses: + 200: + description: OK + /customs/partners/{partner_code}/declare/report/{client_report_id}: + put: + summary: 创建报关单 + tags: + - Custom + parameters: + - name: partner_code + in: path + required: true + - name: client_report_id + in: path + required: true + requestBody: + content: + application/json: + schema: + type: object + properties: + order_id: + type: string + description: 商户支付订单号,要求同一商户唯一 + custom: + type: string + description: 海关编号 * [渠道海关编号](https://www.royalpay.com.au/downloads/CustomsNO.xlsx) + mch_custom_id: + type: string + description: 商户在海关备案的编号 + mch_custom_name: + type: string + description: 商户海关备案名称 + sub_order: + type: array + description: 子订单(拆单) + items: + type: object + properties: + sub_order_no: + type: string + description: 商户子订单号 + fee_type: + type: string + description: 币种代码 + default: CNY + enum: + - CNY + order_fee: + type: number + description: 子订单金额,单位是元 + transport_fee: + type: number + description: 子订单物流金额,单位是元 + responses: + 200: + description: Custom + content: + application/json: + schema: + $ref: 'components_order.yml#/customInfo' + get: + summary: 查询报关单 + tags: + - Custom + parameters: + - name: partner_code + in: path + required: true + - name: client_report_id + in: path + required: true + responses: + 200: + description: Custom + content: + application/json: + schema: + $ref: 'components_order.yml#/customInfo' + /customs/partners/{partner_code}/redeclare/report/{client_report_id}: + put: + summary: 重新提交报关单 + description: 用于重新提交未报关成功的报关单 + tags: + - Custom + parameters: + - name: partner_code + in: path + required: true + - name: client_report_id + in: path + required: true + responses: + 200: + description: Custom + content: + application/json: + schema: + $ref: 'components_order.yml#/customInfo' +components: + securitySchemes: + nonce_str: + type: apiKey + in: query + name: nonce_str + description: 随机字符串 + time: + type: apiKey + in: query + name: time + description: 带毫秒的Unix时间戳,务必检查服务器时间和时区配置。计算服务器上的UTC时间是否匹配真实UTC时间即可。允许误差±5分钟 + sign: + type: apiKey + in: query + name: sign + description: | + 商户签约后会分配得到一个partner_code和credential_code用于签名,其中partner_code随请求传递,credential_code务必自行存储不得外泄,仅作为签名参数。 + + 每次请求都必须加入签名信息作为请求校验。校验参数全部以Query Param参数的方式附加在URL后面,顺序不分先后。 + + 签名过程: + + 1. 连接生成签名的原始字符串,需要4个参数,使用&连接,无需转码 + > valid_string=partner_code&time&nonce_str&credential_code + + 2. 使用SHA256对valid_string进行签名,并转换为小写字符串 + > sign=hex(sha256(valid_string)).toLowerCase() + + 3. 在请求中将签名使用的time, nonce_str和生成的sign作为query参数发送 + + > 签名测试地址:https://mpay.royalpay.com.au/sign_test.html + + diff --git a/src/document/tpl/img/JSAPI_process_cn.png b/src/document/openapi/cn/img/JSAPI_process_cn.png similarity index 100% rename from src/document/tpl/img/JSAPI_process_cn.png rename to src/document/openapi/cn/img/JSAPI_process_cn.png diff --git a/src/document/tpl/img/QRCODE_process_ch.png b/src/document/openapi/cn/img/QRCODE_process_ch.png similarity index 100% rename from src/document/tpl/img/QRCODE_process_ch.png rename to src/document/openapi/cn/img/QRCODE_process_ch.png diff --git a/src/document/tpl/img/RetailQR_cn.png b/src/document/openapi/cn/img/RetailQR_cn.png similarity index 100% rename from src/document/tpl/img/RetailQR_cn.png rename to src/document/openapi/cn/img/RetailQR_cn.png diff --git a/src/document/tpl/img/Retail_cn.png b/src/document/openapi/cn/img/Retail_cn.png similarity index 100% rename from src/document/tpl/img/Retail_cn.png rename to src/document/openapi/cn/img/Retail_cn.png diff --git a/src/document/tpl/img/RoyalPay_Gateway_choose_cn.jpg b/src/document/openapi/cn/img/RoyalPay_Gateway_choose_cn.jpg similarity index 100% rename from src/document/tpl/img/RoyalPay_Gateway_choose_cn.jpg rename to src/document/openapi/cn/img/RoyalPay_Gateway_choose_cn.jpg diff --git a/src/document/tpl/img/alipayOnline_cn.png b/src/document/openapi/cn/img/alipayOnline_cn.png similarity index 100% rename from src/document/tpl/img/alipayOnline_cn.png rename to src/document/openapi/cn/img/alipayOnline_cn.png diff --git a/src/document/tpl/img/glyphicons-halflings-white.png b/src/document/openapi/cn/img/glyphicons-halflings-white.png similarity index 100% rename from src/document/tpl/img/glyphicons-halflings-white.png rename to src/document/openapi/cn/img/glyphicons-halflings-white.png diff --git a/src/document/tpl/img/glyphicons-halflings.png b/src/document/openapi/cn/img/glyphicons-halflings.png similarity index 100% rename from src/document/tpl/img/glyphicons-halflings.png rename to src/document/openapi/cn/img/glyphicons-halflings.png diff --git a/src/document/tpl/img/h5_api_payment.jpg b/src/document/openapi/cn/img/h5_api_payment.jpg similarity index 100% rename from src/document/tpl/img/h5_api_payment.jpg rename to src/document/openapi/cn/img/h5_api_payment.jpg diff --git a/src/document/tpl/img/jd_cn.png b/src/document/openapi/cn/img/jd_cn.png similarity index 100% rename from src/document/tpl/img/jd_cn.png rename to src/document/openapi/cn/img/jd_cn.png diff --git a/src/document/tpl/img/logo.png b/src/document/openapi/cn/img/logo.png similarity index 100% rename from src/document/tpl/img/logo.png rename to src/document/openapi/cn/img/logo.png diff --git a/src/document/openapi/cn/img/logo_new.jpg b/src/document/openapi/cn/img/logo_new.jpg new file mode 100644 index 000000000..41c02602a Binary files /dev/null and b/src/document/openapi/cn/img/logo_new.jpg differ diff --git a/src/document/tpl/img/microapp_cn.png b/src/document/openapi/cn/img/microapp_cn.png similarity index 100% rename from src/document/tpl/img/microapp_cn.png rename to src/document/openapi/cn/img/microapp_cn.png diff --git a/src/document/openapi/cn/img/rp_logo.svg b/src/document/openapi/cn/img/rp_logo.svg new file mode 100644 index 000000000..d57a76e21 --- /dev/null +++ b/src/document/openapi/cn/img/rp_logo.svg @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/document/tpl/img/sdk_api_payment.jpg b/src/document/openapi/cn/img/sdk_api_payment.jpg similarity index 100% rename from src/document/tpl/img/sdk_api_payment.jpg rename to src/document/openapi/cn/img/sdk_api_payment.jpg diff --git a/src/document/tpl/img/sdk_wechat_api_payment_cn.png b/src/document/openapi/cn/img/sdk_wechat_api_payment_cn.png similarity index 100% rename from src/document/tpl/img/sdk_wechat_api_payment_cn.png rename to src/document/openapi/cn/img/sdk_wechat_api_payment_cn.png diff --git a/src/document/openapi/cn/index.html b/src/document/openapi/cn/index.html new file mode 100644 index 000000000..6b6d61ff8 --- /dev/null +++ b/src/document/openapi/cn/index.html @@ -0,0 +1,23 @@ + + + + + RoyalPay Document + + + + + + + + + + + \ No newline at end of file diff --git a/src/document/openapi/en/components_order.yml b/src/document/openapi/en/components_order.yml new file mode 100644 index 000000000..934286a67 --- /dev/null +++ b/src/document/openapi/en/components_order.yml @@ -0,0 +1,420 @@ + +orderBasic: + required: + - description + - currency + - price + properties: + description: + type: string + maxLength: 128 + description: Order title(Max 128 characters. Will cut automatically if too long.) + price: + type: integer + description: Order price. Minimal unit of currency. eg, 100 for AUD 1.00 + currency: + type: string + enum: + - AUD + - CNY + notify_url: + type: string + description: payment notification url. for details please visit notify api. will not post notifications if leave it null. Recommended to call order query api to confirm order status when received notification. + operator: + type: string + description: mark of operator +orderWithChannel: + allOf: + - $ref: '#/orderBasic' + - properties: + channel: + type: string + description: order channel. case sensitive + enum: + - Alipay + - Wechat + type: object + required: + - channel +cardCustomerParam: + properties: + name: + type: string + description: customer name. will use card holder name if leave it empty + postcode: + type: string + example: 2000 + address: + type: string + city: + type: string + example: Sydney + state: + type: string + example: VIC + country: + type: string + description: 2-character country code + example: AU + +cardCustomerInfo: + type: object + title: Card customer info + properties: + bank: + type: string + description: bank name who issued the card. may be empty + card_type: + type: string + description: card type + example: credit/debit + card_alias: + type: string + description: part of card number. for customers to recognize which card they used + example: 424242...242 + card_scheme: + description: card scheme who issued the card + type: string + example: VISA/MASTER + card_country: + description: nation code who issued the card + type: string + example: AU + customer_id: + type: string + description: customer id. if you provided customer_id param or passed tokenize=true param. it will appear +orderBasicResponse: + type: object + properties: + return_code: + type: string + description: execute result + result_code: + type: string + description: SUCCESS/EXISTS all means success. EXISTS means the order_id was not first time to commit + channel: + type: string + description: payment channel + partner_code: + type: string + description: merchant code + full_name: + type: string + description: merchant full name + partner_name: + type: string + description: merchant name + order_id: + type: string + description: RoyalPay order ID, Will be channel order ID same time. + partner_order_id: + type: string + description: order id applied by merchant +orderStatus: + type: object + properties: + return_code: + type: string + description: execute result + example: + SUCCESS + result_code: + type: string + description: | + order status code + - PAYING: waiting for payment + - CREATE_FAIL: creation failed(final status, can be actived again if submitted another create order with same order id) + - CLOSED: order closed(final status, can be actived again if submitted another create order with same order id) + - PAY_FAIL: payment failed(final status, can be actived again if submitted another create order with same order id) + - PAY_SUCCESS: payment success(final status) + - PARTIAL_REFUND: payment success and partial refunds happened(final status) + - FULL_REFUND: payment success and was full refunded(final status) + If necessary. you can use same order id to call create order api in same gateway. but when origin order is paid or paying status will be failure + enum: + - PAYING + - CREATE_FAIL + - CLOSED + - PAY_FAIL + - PAY_SUCCESS + - PARTIAL_REFUND + - FULL_REFUND + order_id: + type: string + description: RoyalPay order ID, Will be channel order ID same time. + partner_order_id: + type: string + description: order id applied by merchant + channel_order_id: + type: string + description: transaction id from payment channel + total_fee: + type: integer + description: order amount. minimal unit of the currency. + real_fee: + type: integer + description: customer actual paid amount. minimal unit of the currency.(equals to total_fee at this moment. in case there were some discounts in the future) + currency: + type: string + rate: + type: number + description: exchange rate of trading. 1AUD=?CNY + pay_time: + type: string + format: 'date-time' + pattern: yyyy-mm-dd HH:mm:ss + description: paid time(yyyy-MM-dd HH:mm:ss, GMT+10) + create_time: + type: string + format: 'date-time' + pattern: yyyy-mm-dd HH:mm:ss + description: order creation time(yyyy-MM-dd HH:mm:ss, GMT+10) + settlement_date: + type: string + format: date + pattern: yyyy-mm-dd + description: target settlement date, maybe delay due to holidays and bank issues(yyyy-MM-dd) + channel: + type: string + description: payment channel + customer_info: + anyOf: + - description: Alipay User Info + title: Alipay Users + type: object + properties: + alipay_user_id: + type: string + description: Alipay user id + alipay_account: + type: string + description: user account + - $ref: 'components_order.yml#/cardCustomerInfo' +refundStatus: + type: object + properties: + return_code: + type: string + description: Execute result + example: + SUCCESS + result_code: + type: string + description: | + Refund status + - WAITING: Submitting + - CREATE_FAILED: Submit failed + - SUCCESS: Submit success. waiting for bank processing(for Wechat, it's final status) + - FAILED: Refund failed + - FINISHED: Refund success (final status) + enum: + - WATING + - CREATE_FAILED + - SUCCESS + - FAILED + - FINISHED + refund_id: + type: string + description: RoyalPay Refund ID + partner_refund_id: + type: string + description: Refund id submitted by merchant + amount: + type: integer + description: refund amount. minimal unit of the currency. + currency: + type: string + example: + AUD + settlement_date: + type: string + format: date + pattern: yyyy-mm-dd + description: target settlement date, maybe delay due to holidays and bank issues(yyyy-MM-dd). only exists when status is SUCCESS or FINISHED +transactionItem: + type: object + properties: + transaction_time: + type: string + format: 'date-time' + pattern: yyyyMMddHHmmss + description: trading time, format is yyyyMMddHHmmss, GMT+10 + partner_code: + type: string + description: transaction related partner code + order_id: + type: string + description: RoyalPay order id + partner_order_id: + type: string + description: merchant order id + channel_order_id: + type: string + description: channel order id + refund_id: + type: string + description: RoyalPay refund id (only exists on refund or refund failure payback transactions) + partner_refund_id: + type: string + description: merchant submitted refund id (only exists on refund or refund failure payback transactions) + gateway: + type: integer + description: | + gateway + - 0: RoyalPay EftPOS with payment code (scanning payment code provided by customer) + - 1: RoyalPay EftPOS with collection code (customer scan qr code provided by EftPOS) + - 2: RoyalPay Merchant's static QR Code + - 3: QRCode Gateway + - 4: JSAPI Gateway + - 5: Third EftPOS payment code gateway + - 6: Third EftPOS collection code gateway + - 7: RoyalPay Merchant's static QR Code(deprecated) + - 8: H5 Gateway + - 9: WEB Gateway + - 10: SDK order Gateway + - 11: RoyalPay Bill QR Code + - 12: Mini Program Gateway + - 13: Native QR Code Gateway + - 14: RoyalPay Bill link + - 15: Native JSAPI Gateway + - 16: Card Order(Pre order mode) + - 17: Card Order + - 18: DirectDebit + channel: + type: string + description: Trading channel + type: + type: string + description: Transaction type + enum: + - Credit + - Debit + currency: + type: string + example: + AUD + total_amount: + type: integer + description: Total amount for order. minimal unit of the currency. + input_amount: + type: integer + description: Input amount for order. minimal unit of the currency. + customer_payment_amount: + type: integer + description: Customer actual paid amount. minimal unit of the currency. + settle_amount: + type: integer + description: Amount calculated to merchant. note that it did not sub surcharge and GST yet. AUD currency. minimal unit of the currency. + transfer_amount: + type: integer + description: Pay amount to merchant. settle_amount - surcharge - GST. AUD currency. minimal unit of the currency. + surcharge: + type: integer + description: surcharge for this transaction. AUD currency. minimal unit of the currency. + gst: + type: integer + description: GST. AUD currency. minimal unit of the currency. + exchange_rate: + type: number + description: used exchange rate. + remark: + type: string + description: transaction remark +customInfo: + type: object + properties: + report_id: + type: string + description: RoyalPay customs report id + client_report_id: + type: string + description: merchant submitted customs report id + report_status: + type: string + description: report status + enum: + - PROCESSING + - SUBMITED + - FAILED + - SUCCESS + channel: + type: string + description: payment channel + custom: + type: string + description: customs code + mch_custom_no: + type: string + description: merchant's customs no registered in customs system + mch_custom_name: + type: string + description: merchant's name registered in customs system + order_id: + type: string + description: RoyalPay order id + transaction_id: + type: string + description: channel transaction id + order_currency: + type: string + description: order currency + order_amount: + type: number + description: order amount + report_time: + type: string + format: 'date-time' + description: report customs time + creation_date: + format: 'date-time' + type: string + description: report create time + last_update_date: + type: string + format: 'date-time' + description: update time + error_code: + type: string + description: error code + error_msg: + type: string + description: error message + verify_department: + type: string + verify_department_trade_id: + type: string + sub_orders: + type: array + items: + type: object + properties: + sub_order_no: + type: string + description: merchant's sub order no + fee_type: + type: string + description: currency code + default: CNY + enum: + - CNY + order_fee: + type: number + description: sub order fee + transport_fee: + type: number + description: sub order transport fee + verify_department: + type: string + verify_department_trade_id: + type: string + report_status: + type: string + description: report status + enum: + - PROCESSING + - SUBMITED + - FAILED + - SUCCESS + error_code: + type: string + error_msg: + type: string \ No newline at end of file diff --git a/src/document/openapi/en/document.yml b/src/document/openapi/en/document.yml new file mode 100644 index 000000000..56b998930 --- /dev/null +++ b/src/document/openapi/en/document.yml @@ -0,0 +1,1399 @@ +openapi: 3.0.3 +info: + title: RoyalPay Developer Documents + version: 1.0.0 + x-logo: + url: img/rp_logo.svg + description: | + [中文](/cn/) + + # Request And Parameters + Request for payment or refund shall use PUT method. Request for querying order + shall use GET method. All requests including Request Entity are in JSON format. + + Accept in the request header shall be set to application/json for all requests except redirect pages. + Content-Type in the request header shall be set to application/json for all PUT/POST requests. + + System charset is UTF-8. + + There are 3 groups of parameters: Path Variable, Query Param, JSON Entity + + Path Variable: included in the path as patterns + + Query Param: parameters after the URI '?' symbol and formatted like key=value + + JSON Entity: only used in PUT/POST requests + + Our API server will return 200 in JSON if the request has successfully reached the server, which does not indicate the success or failure of the actual operation. All responses in JSON format will include a return_code field which contains the operation result. The value SUCCESS indicates that the operation was successful while other values shows the type of error that happened. Response will also contain a return_msg field for detailed error message. + + # Multi-Language + + System error message supports Simplified Chinese and English. The system by default will automatically choose the language according to the Accept-Language value in request header. Cookie "locale" value (zh-CN or en-US) will affect the result language. + + # Which Gateway Api is for me? + + + + # Alipay Channels + + According to different Api used, Alipay channel was distributed to Retail channel and Online channel. Two channels has different exchange rate and surcharge rate. + + Online Channel: Including H5 Mobile, Online Payment, APP SDK, JSAPI and QR Code Api + + Retail Channel: Including Retail Pay + + Difference + - JSAPI and H5 Mobile: JSAPI can only be called in the web page opened in Alipay Client. H5 Mobile can call the payment panel in any browser or webview in App in the mobile device. + - Online Payment and QR Code: Online payment will jump to Alipay Official payment page. Customers can scan QR Code displayed in the page or sign in their account directly to finish payment. QR Code can provide a QR Code. Merchants can display this QR Code in their web page or jump to RoyalPay to display the QR Code. Customers can only scan the QR Code with their Alipay Client to finish payment. + + # Currency Codes + + RoyalPay can only accept the following currencies at the moment. Please note that the settlement currency will always be Australian Dollar. + - AUD + - CNY + + Except customs api. All fee parameters should use *Minimal unit of the currency*. For example, CNY and AUD should use cent unit. so AUD 1.00 should submit the parameter as 100 + + # Business Roles + - QR Code Payment displays a QR code image in a web page. Customers will scan the code via their WeChat and complete the payment in the linked web page. It is suitable for online shopping websites. + - JSAPI Payment redirects customers to a web page in WeChat. This page can only be opened within WeChat app and it is suitable for payment from micro-shops on WeChat platform. + - Retail passive payment(Scan Payment Code in customers’ WeChat Wallet) and active payment(Generate Payment QR Code for customers to scan) are used in retail environment such as payment terminals and pos machines. + - Order ID is required when creating an order. The same order id can be sent again. The system will decide to renew an order or close the old order according to the order status. System will recognise the same order id to avoid duplicated payments from customers. + - As orders can be resubmitted, Order ID returned by our server might not represent the last Order ID paid. + - QR Code order creation will return QR Code and pay_url. Merchants may decide whether to display the QR code on their website or to redirect customer to the payment page available at pay_url. + - JSAPI order creation will return pay_url. Merchants shall redirect customer to the payment page available at pay_url, and complete the payment. + - When redirecting to pay_url, sign information is required. + - Each request shall use new timestamp, nonce_str and sign. + - Our system will notify the caller after an order is paid successfully if notify_url was provided when creating an order. Otherwise, Merchants shall call the order query method repeatedly until order is paid or closed. + - Each unpaid order will be valid for 5 minutes. Expired order can be renewed with same the order id. It is suggested to trigger the event when user open the payment page again. + - Always redirect to RoyalPay’s payment page after calling the order creation method. + - Same order id is allowed in both creating new payment order and creating refund order but order details shall refer back to the initial request details. + - Price is specified in the base unit of the given currency. Using currency AUD as an example, 105 means 105 cents or $1.05. + + # Examples + https://example.royalpay.com.au/api/payment/order + + + + # Sample Code + - PHP: https://mpay.royalpay.com.au/static/phpdemo.zip + - Java: https://mpay.royalpay.com.au/static/javademo.zip + + # Error Codes + ## Common Error Codes + - SYSTEMERROR: Internel server error + - INVALID_SHORT_ID: Invalid partner code or not found + - SIGN_TIMEOUT: Signatured timedout. submitted time param has more than 5min difference to our server. please check your server time and timezone configuration. + - SIGN_EXPIRED: Signature expired. same signature was used multiple times. + - INVALID_SIGN: Signature mismatch + - PARAM_INVALID: Parameter not valid. Please check thr return_msg param + + ## Order Creation Error Codes + - NOT_PERMITTED: Not enabled the target gateway permission. + - INVALID_CHANNEL: Invalid channel name. channel name parameter was case-sensitive. please check spelling + - ORDER_MISMATCH: Order id not belongs to your merchant + - AUTHCODEEXPIRE: QR Code provided was expired(For Payment code apis) + - NOTSUPORTCARD: Not supported card type(Wechat channel only) + - AUTH_CODE_ERROR: QR Code submitted multiple times(Wechat channel only) + - AUTH_CODE_INVALID: Invalid QR Code(Wechat channel only) + - NOTENOUGH: Not enough balance in customer's account(Wechat channel only) + - ORDER_PAID: Order already paid + +servers: + - url: https://mpay.royalpay.com.au/api/v1.0 + description: production + - url: https://sandbox.royalpay.com.au/api/v1.0 + description: sandbox +tags: + - name: PublicApi + description: Public API + - name: QRCode + description: | + QR Code Payment is used for webpage/application on PC. Customers use WeChat or Alipay app to scan QR Code generated when creating order and finish the payment. + + Return value contains QR Code string, QR Ccode image and payment page address. Partners can decide how to finish the payment. + If the currency is CNY, equivalent AUD amount shall never less than 0.01AUD, otherwise user will get Invalid Amount Error from WeChat when making the payment. + - name: JSAPI + description: | + JSAPI Payment is used to pay in webpage which was opened in WeChat or Alipay App. If customers enter this page from WeChat Official Account, this Official Account is required to be authorized. + Customers will jump to RoyalPay order page and call WeChat or Alipay Payment Board to finish payment. + + Return value contains a payment page. Partners shall guide users to redirect to the page. Sign params is required when redirect happens. + If the currency is CNY, equivalent AUD amount shall never less than 0.01AUD, + otherwise user will get Invalid Amount Error from WeChat when making the payment. + - name: MobileH5 + description: | + Create H5 order. Only Alipay supports. + H5 Payment is used for payment in Webpage or App on mobile outside WeChat or Alipay App. The browser would redirect to a webpage from WeChat or Alipay and call the App to finish the payment. + Return value contains a payment page. Partners shall guide users to redirect to this page. Sign params are required. + If the currency is CNY, equivalent AUD amount shall never less than 0.01AUD, otherwise user will get Invalid Amount Error from WeChat when making the payment. + + - name: MiniProgram + description: | + Enabling Wechat mini program have to finish oversea company authorization. And authorized merchant should be equal to the merchant information in RoyalPay. + For details please visit WeChat documents. + Used for call payment in miniprogram. Create order and pass the sdk_params to mini program. [Reference Document](https://www.royalpay.com.au/downloads/MiniProgram_WechatPay.pdf) + + - name: CardPayment + description: | + Card payment method is that customer provider their card information to finish payments. Enable card payment require addition compliance process. + - name: RetailPay + description: | + Retail payment API for merchants has their own machine. Has 2 modes: + - Merchant scanner scan customer provided payment code.(B scan C) + - Customer scan merchant provided collection code. (C scan B) + - name: AlipayOnline + description: | + 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 + + - name: CB Bank + description: | + Use for CB BankPay in PC Website. After create order, jump to the pay_url returned and attach sign params and redirect param. + - name: SDK Payment + description: | + Used for mobile Apps calling Wechat payment with Wechat/Alipay 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.* + + More information for integration with Alipay: [Alipay SDK Document](https://global.alipay.com/doc/app/intro) + More information for integration with Alipay: [Wechat SDK Document](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=11_1) + [Alipay SDK for Android](resources/api/alipaySdk-20160825.jar) + [Alipay SDK for iOS](resources/api/AlipaySDKForiOS.zip) + [Wechat SDK for Android](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319167&token=&lang=zh_CN) + [Wechat SDK for iOS](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319164&lang=zh_CN) + + - name: Custom + description: Used to submit the attachment information of the order required by the merchant. WeChat and Alipay are only supported. WeChat only supports payment orders within one month for customs declaration. +security: + - sign: [] + nonce_str: [] + time: [] +paths: + /gateway/partners/{partner_code}/orders/{partner_order_id}: + put: + tags: + - QRCode + summary: Create QRCode Order + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + requestBody: + content: + application/json: + schema: + $ref: 'components_order.yml#/orderWithChannel' + responses: + 200: + description: Execution result + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + code_url: + type: string + description: QR Code string. Merchants can generate a QR Code by self + qrcode_img: + type: string + description: Base64 encoded qr code img. can be used as src attribute of img tag + pay_url: + type: string + description: Payment page URL. If merchants choose jump to royalpay to finish payment can use this url. remember to add signature params + get: + summary: Check Order Status + tags: + - SDK Payment + - CB Bank + - RetailPay + - AlipayOnline + - CardPayment + - MiniProgram + - MobileH5 + - JSAPI + - QRCode + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + responses: + 200: + description: Order Status + content: + application/json: + schema: + $ref: 'components_order.yml#/orderStatus' + delete: + summary: Close Order + tags: + - SDK Payment + - CB Bank + - RetailPay + - AlipayOnline + - CardPayment + - MiniProgram + - MobileH5 + - JSAPI + - QRCode + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + responses: + 200: + description: Order Status + content: + application/json: + schema: + $ref: 'components_order.yml#/orderStatus' + /gateway/partners/{partner_code}/native_orders/{partner_order_id}: + put: + tags: + - QRCode + summary: Create native QRCode payment order + description: | + Native QR Code was generated directly by wechat/alipay. When scanned by their app. The payment page will directly generated by App instead of jumping to royalpay. + Will be helpful when customers are in a bad networking condition + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + requestBody: + content: + application/json: + schema: + $ref: 'components_order.yml#/orderWithChannel' + responses: + 200: + description: Execute result + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + code_url: + type: string + description: QR Code string. Merchants can generate a QR Code by self + qrcode_img: + type: string + description: Base64 encoded qr code img. can be used as src attribute of img tag + pay_url: + type: string + description: Payment page URL. If merchants choose jump to royalpay to finish payment can use this url. remember to add signature params + /gateway/partners/{partner_code}/orders/{partner_order_id}/pay: + get: + tags: + - QRCode + summary: QRCode payment Page + description: Must call order creation api and then redirect to this page. It's recommended to call order check api when sync jumping back to the given redirect param + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + - name: redirect + required: true + in: query + description: Redirecting target when payment succeeded + responses: + 200: + description: payment page + content: + text/html: + schema: + type: string + /jsapi_gateway/partners/{partner_code}/orders/{partner_order_id}: + put: + summary: Create JSAPI order + tags: + - JSAPI + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + requestBody: + content: + application/json: + schema: + $ref: 'components_order.yml#/orderWithChannel' + responses: + 200: + description: Execute Result + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + pay_url: + type: string + description: Payment page URL, redirect to the url with signature parameters. + /wechat_jsapi_gateway/partners/{partner_code}_order_{partner_order_id}: + get: + summary: Wechat JSAPI payment page + description: Wechat JSAPI payment page. it's recommended to use the returned pay_url param in create order response + tags: + - JSAPI + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + - name: redirect + in: query + description: sync callback url. pay attention on url encoding + - name: directpay + in: query + description: whether call payment immediately when customer entered the page. if false, customer have to click on Pay button to call payment. + schema: + type: boolean + responses: + 200: + description: Wechat JSAPI payment page + content: + text/html: + schema: + type: string + /gateway/alipay/partners/{partner_code}/orders/{partner_order_id}/app_pay: + get: + summary: Alipay JSAPI Payment page + description: Alipay JSAPI payment page. it's recommended to use the returned pay_url param in create order response + tags: + - JSAPI + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + - name: redirect + in: query + description: sync callback url. pay attention on url encoding + - name: directpay + in: query + description: whether call payment immediately when customer entered the page. if false, customer have to click on Pay button to call payment. + schema: + type: boolean + responses: + 200: + description: Alipay JSAPI payment page + content: + text/html: + schema: + type: string + /h5_payment/partners/{partner_code}/orders/{partner_order_id}: + put: + summary: Create MobileH5 order + description: only for Alipay channel + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + tags: + - MobileH5 + requestBody: + content: + application/json: + schema: + type: object + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + properties: + channel: + type: string + description: channel. case sensitive + enum: + - Alipay + responses: + 200: + description: Order + content: + application/json: + schema: + type: object + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + pay_url: + type: string + description: Payment page URL. redirect to the url with signature parameters. + /h5_payment/partners/{partner_code}/orders/{partner_order_id}/pay: + get: + summary: H5 Payment page + description: H5 payment page. it's recommended to use the returned pay_url param in create order response + tags: + - MobileH5 + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + - name: redirect + in: query + description: sync callback url. pay attention on url encoding + responses: + 200: + description: H5 Payment page + content: + text/html: + schema: + type: string + /gateway/partners/{partner_code}/microapp_orders/{partner_order_id}: + put: + summary: Create mini program order + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + tags: + - MiniProgram + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderWithChannel' + - type: object + properties: + appid: + type: string + description: mini program appid. required when channel is Wechat. ignore on Alipay + customer_id: + type: string + description: user id recognized in mini program (openid or wechat and userid for Alipay) + responses: + 200: + description: Order + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + sdk_params: + type: string + description: serialized json string. can pass to mini program to call payment method + /gateway/partners/{partner_code}/pre_card_orders/{partner_order_id}: + put: + summary: Create Card Payment Pre Order + description: | + Pre order mode is submit basic order parameters. and jump to royalpay gateway page to ask customers to input their card information and finish payment. + Pre order allows customers to try multiple times. unless merchants called order close api. order will exists enabled status until expired. + tags: + - CardPayment + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + properties: + 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. + **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 + description: pass true if merchant want to disable credit cards from paying to this order. + tokenize: + type: boolean + default: false + description: whether provide a customer id for this payment. Then merchants can pass this id in future orders for same customer and then they will only have to input cvv code then. + customer_id: + type: string + description: use customer_id provided by tokenized orders. When customer_id is not null, tokenize parameter will be ignored. Can skip steps for typing in card number/ card holder name/ expire time for customer. only required is CVV2/CVC code + customer: + $ref: 'components_order.yml#/cardCustomerParam' + responses: + 200: + description: Order + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + pay_url: + type: string + description: Payment page URL. redirect to the url with signature parameters. + /card_payment_view/partners/{partner_code}/orders/{partner_order_id}/view: + get: + summary: Card Payment Page + description: Card payment page. it's recommended to use the returned pay_url param in create order response + tags: + - CardPayment + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + - name: redirect + in: query + description: sync callback url. pay attention on url encoding + responses: + 200: + description: Card payment page + content: + text/html: + schema: + type: string + /gateway/partners/{partner_code}/card_orders/{partner_order_id}: + put: + summary: Create Card Order + description: | + 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 Example + ``` + 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', + border: 'none', + 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 loaded event + }; + cardInput.onSuccess = function(secretData){ + //success get encrypted card informations + //secretData: {'key_id':'','secret':''} + }; + cardInput.show();//start loading iframe + + //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: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + required: + - key_id + - card_info + properties: + key_id: + type: string + description: card input frame returned key_id + card_info: + type: string + description: card input frame returned secret + 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. + disable_credit_card: + type: boolean + default: false + description: Pass true if want to refuse credit cards. + customer: + $ref: 'components_order.yml#/cardCustomerParam' + responses: + 200: + description: Order + content: + application/json: + schema: + $ref: 'components_order.yml#/orderBasicResponse' + /micropay/partners/{partner_code}/orders/{partner_order_id}: + put: + 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 + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + required: + - auth_code + - device_id + properties: + device_id: + type: string + description: ID of the device which sends the request + auth_code: + type: string + description: The Payment QR Code scanned from customer's WeChat Wallet. + responses: + 200: + description: Result + content: + application/json: + schema: + $ref: 'components_order.yml#/orderStatus' + /retail_qrcode/partners/{partner_code}/orders/{partner_order_id}: + put: + summary: Retail Active Payment Order + description: | + 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 + parameters: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + required: + - device_id + properties: + device_id: + type: string + description: ID of the device which sends the request. + responses: + 200: + description: Order + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + code_url: + type: string + 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: Alipay WEB Order + description: | + 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: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + requestBody: + content: + application/json: + schema: + $ref: 'components_order.yml#/orderBasic' + responses: + 200: + description: Order + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + pay_url: + type: string + description: Payment page URL. redirect to the url with signature parameters. + /cb_bankpay/partners/{partner_code}/orders/{partner_order_id}: + put: + 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: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + required: + - product_name + - gateway_type + properties: + product_name: + type: string + description: production name + gateway_type: + type: integer + description: 'Gateway Require 8: H5 gateway,9: PC gateway' + enum: + - 8 + - 9 + responses: + 200: + description: Order + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + pay_url: + type: string + description: Payment page URL. redirect to the url with signature parameters. + /gateway/partners/{partner_code}/app_orders/{partner_order_id}: + put: + 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: + - name: partner_code + in: path + required: true + description: Given partner code + - name: partner_order_id + in: path + required: true + description: Order id in merchant side. must be unique in merchant side. + requestBody: + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasic' + - type: object + required: + - channel + properties: + channel: + type: string + description: Payment channel, required, case sensitive + enum: + - Wechat + - Alipay + system: + type: string + description: OS type of client app, optional for Alipay, not required for Wechat + enum: + - android + - iphone + - ipad + version: + type: string + description: client app version, optional for Alipay, not required for Wechat + appid: + type: string + description: wechat appid, required for Wechat, not required for Alipay + responses: + 200: + description: Order + content: + application/json: + schema: + allOf: + - $ref: 'components_order.yml#/orderBasicResponse' + - type: object + properties: + sdk_params: + type: string + description: param string for calling SDK + /gateway/partners/{partner_code}/channel_exchange_rate: + get: + 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: + - name: partner_code + in: path + required: true + responses: + 200: + description: exchange rate + content: + application/json: + schema: + type: object + description: OK + properties: + return_code: + type: string + description: Execution result + example: + SUCCESS + wechat_rate: + type: number + description: Wechat exchange rate + example: + 4.41111 + alipay_retail_rate: + type: number + description: Alipay retail exchange rate + example: + 4.411111 + alipay_online_rate: + type: number + description: Alipay online exchange rate + example: + 4.411111 + /gateway/partners/{partner_code}/orders/{partner_order_id}/refunds/{partner_refund_id}: + put: + 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 + - MobileH5 + - MiniProgram + - CardPayment + - AlipayOnline + - RetailPay + - CB Bank + - SDK Payment + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + description: Payment order id in merchant's system + - name: partner_refund_id + in: path + required: true + description: Refund id in merchant's system + requestBody: + content: + application/json: + schema: + type: object + required: + - fee + properties: + fee: + type: integer + 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 of the device which sends the request + responses: + 200: + description: Refund + content: + application/json: + schema: + $ref: 'components_order.yml#/refundStatus' + get: + summary: Check Refund Status + tags: + - QRCode + - JSAPI + - MobileH5 + - MiniProgram + - CardPayment + - AlipayOnline + - RetailPay + - CB Bank + - SDK Payment + parameters: + - name: partner_code + in: path + required: true + - name: partner_order_id + in: path + required: true + description: Payment order id in merchant's system + - name: partner_refund_id + in: path + required: true + description: Refund id in merchant's system + responses: + 200: + description: Refund Status + content: + application/json: + schema: + $ref: 'components_order.yml#/refundStatus' + /gateway/partners/{partner_code}/transactions: + get: + summary: Check Transactions + description: | + 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: + - name: partner_code + in: path + required: true + - name: date + schema: + format: date + pattern: yyyyMMdd + type: string + in: query + required: true + description: Transaction date. Format as 'yyyyMMdd', GMT+10. Only transaction before today can be query + example: 20200315 + responses: + 200: + description: Orders + content: + application/json: + schema: + type: object + properties: + return_code: + type: string + description: Execute Result + example: + SUCCESS + result_code: + type: string + description: 业务Execute Result + example: + SUCCESS + transaction_count: + type: integer + description: transactions number + order_count: + type: integer + description: credit number + refund_count: + type: integer + description: debit number + transactions: + type: array + items: + allOf: + - $ref: 'components_order.yml#/transactionItem' + - type: object + properties: + settlement_date: + type: string + format: date + pattern: yyyy-mm-dd + description: target settlement date, maybe delay due to holidays and bank issues(yyyy-MM-dd) + /gateway/partners/{partner_code}/settlements: + get: + summary: Check Settlements + description: | + 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: + - name: partner_code + in: path + required: true + - name: date + in: query + schema: + format: date + pattern: yyyyMMdd + type: string + description: Settle date. Format as 'yyyyMMdd' ,GMT+10. Only settlement before today can be query + required: true + responses: + 200: + description: Settlements + content: + application/json: + schema: + type: object + properties: + return_code: + type: string + description: Execute Result + example: + SUCCESS + result_code: + type: string + description: Process Result + example: + SUCCESS + settle_from: + type: string + format: date + description: 'Transaction date from, yyyyMMdd' + settle_to: + type: string + format: date + description: Transaction date to, yyyyMMdd + settle_days: + type: string + description: Settle delay + example: + T+2 + transaction_count: + type: integer + description: transaction record count + order_count: + type: integer + description: credit count + refund_count: + type: integer + description: debit count + total_credit: + type: integer + description: total credit fee(AUD cent) + total_debits: + type: integer + description: total debit fee(AUD cent) + total_surcharge: + type: integer + description: Total surcharge(AUD cent) + total_transfer: + type: integer + description: Total transfer amount(AUD cent) + transactions: + type: array + items: + $ref: 'components_order.yml#/transactionItem' + /notify: + post: + summary: Order Paid Notify + description: | + 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 + - RetailPay + - AlipayOnline + - CardPayment + - MiniProgram + - MobileH5 + - JSAPI + - QRCode + requestBody: + content: + application/json: + schema: + type: object + properties: + time: + type: integer + format: int64 + description: UTC timestamp in millis + nonce_str: + type: string + description: Random string + sign: + type: string + description: Sign + partner_order_id: + type: string + description: Partner order id + channel_order_id: + type: string + description: PayChannel(Alipay、Wechat) Transaction Trade No + order_id: + type: string + description: RoyalPay order id + total_fee: + type: integer + description: Order amount + real_fee: + type: integer + description: Actual paid amount + rate: + type: number + description: Exchange Rate used while trading. 1AUD=?CNY + currency: + type: string + description: Currency, AUD + channel: + type: string + description: Payment Channel Alipay, AlipayOnline, Wechat + create_time: + type: string + format: 'date-time' + pattern: yyyy-MM-dd HH:mm:ss + 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: 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: Create Custom Declare + tags: + - Custom + parameters: + - name: partner_code + in: path + required: true + - name: client_report_id + in: path + required: true + requestBody: + content: + application/json: + schema: + type: object + properties: + order_id: + type: string + description: Partner order id + custom: + type: string + description: Customs No. * [Channel Custom No](https://www.royalpay.com.au/downloads/CustomsNO.xlsx) + mch_custom_id: + type: string + description: Customs record id of merchant + mch_custom_name: + type: string + description: Customs record name of merchant + sub_order: + type: array + description: Child orders(If split order required) + items: + type: object + properties: + sub_order_no: + type: string + description: Sub order no + fee_type: + type: string + description: currency + default: CNY + enum: + - CNY + order_fee: + type: number + description: Sub order price. unit is Yuan + transport_fee: + type: number + description: Sub order transport fee. unit is Yuan + responses: + 200: + description: Custom + content: + application/json: + schema: + $ref: 'components_order.yml#/customInfo' + get: + summary: Query Custom Report + tags: + - Custom + parameters: + - name: partner_code + in: path + required: true + - name: client_report_id + in: path + required: true + responses: + 200: + description: Custom + content: + application/json: + schema: + $ref: 'components_order.yml#/customInfo' + /customs/partners/{partner_code}/redeclare/report/{client_report_id}: + put: + summary: Redeclare Custom Report + description: Used to resubmit the attachment information of the order required by the merchant. + tags: + - Custom + parameters: + - name: partner_code + in: path + required: true + - name: client_report_id + in: path + required: true + responses: + 200: + description: Custom + content: + application/json: + schema: + $ref: 'components_order.yml#/customInfo' +components: + securitySchemes: + nonce_str: + type: apiKey + in: query + name: nonce_str + description: Random String + time: + type: apiKey + in: query + name: time + 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: | + 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. + + 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. 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. Use SHA256 to sign valid_string and get lowercased hex string + > sign=hex(sha256(valid_string)).toLowerCase() + + 3. Pass used `time`, `nonce_str` and generated `sign` as query parameter in requests. + + > Signature test address: https://mpay.royalpay.com.au/sign_test.html + + diff --git a/src/document/tpl/img/JSAPI_process_en.png b/src/document/openapi/en/img/JSAPI_process_en.png similarity index 100% rename from src/document/tpl/img/JSAPI_process_en.png rename to src/document/openapi/en/img/JSAPI_process_en.png diff --git a/src/document/tpl/img/QRCODE_process_en.png b/src/document/openapi/en/img/QRCODE_process_en.png similarity index 100% rename from src/document/tpl/img/QRCODE_process_en.png rename to src/document/openapi/en/img/QRCODE_process_en.png diff --git a/src/document/tpl/img/RetailQR_en.png b/src/document/openapi/en/img/RetailQR_en.png similarity index 100% rename from src/document/tpl/img/RetailQR_en.png rename to src/document/openapi/en/img/RetailQR_en.png diff --git a/src/document/tpl/img/Retail_en.png b/src/document/openapi/en/img/Retail_en.png similarity index 100% rename from src/document/tpl/img/Retail_en.png rename to src/document/openapi/en/img/Retail_en.png diff --git a/src/document/tpl/img/RoyalPay_Gateway_choose_en.jpg b/src/document/openapi/en/img/RoyalPay_Gateway_choose_en.jpg similarity index 100% rename from src/document/tpl/img/RoyalPay_Gateway_choose_en.jpg rename to src/document/openapi/en/img/RoyalPay_Gateway_choose_en.jpg diff --git a/src/document/tpl/img/alipayOnline_en.png b/src/document/openapi/en/img/alipayOnline_en.png similarity index 100% rename from src/document/tpl/img/alipayOnline_en.png rename to src/document/openapi/en/img/alipayOnline_en.png diff --git a/src/document/tpl/img/jd_en.png b/src/document/openapi/en/img/jd_en.png similarity index 100% rename from src/document/tpl/img/jd_en.png rename to src/document/openapi/en/img/jd_en.png diff --git a/src/document/openapi/en/img/logo_new.jpg b/src/document/openapi/en/img/logo_new.jpg new file mode 100644 index 000000000..41c02602a Binary files /dev/null and b/src/document/openapi/en/img/logo_new.jpg differ diff --git a/src/document/tpl/img/microapp_en.png b/src/document/openapi/en/img/microapp_en.png similarity index 100% rename from src/document/tpl/img/microapp_en.png rename to src/document/openapi/en/img/microapp_en.png diff --git a/src/document/openapi/en/img/rp_logo.svg b/src/document/openapi/en/img/rp_logo.svg new file mode 100644 index 000000000..d57a76e21 --- /dev/null +++ b/src/document/openapi/en/img/rp_logo.svg @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/document/tpl/img/sdk_wechat_api_payment_en.png b/src/document/openapi/en/img/sdk_wechat_api_payment_en.png similarity index 100% rename from src/document/tpl/img/sdk_wechat_api_payment_en.png rename to src/document/openapi/en/img/sdk_wechat_api_payment_en.png diff --git a/src/document/openapi/en/index.html b/src/document/openapi/en/index.html new file mode 100644 index 000000000..6b6d61ff8 --- /dev/null +++ b/src/document/openapi/en/index.html @@ -0,0 +1,23 @@ + + + + + RoyalPay Document + + + + + + + + + + + \ No newline at end of file diff --git a/src/document/tpl/resources/api/AlipaySDKForiOS.zip b/src/document/openapi/resources/api/AlipaySDKForiOS.zip similarity index 100% rename from src/document/tpl/resources/api/AlipaySDKForiOS.zip rename to src/document/openapi/resources/api/AlipaySDKForiOS.zip diff --git a/src/document/tpl/resources/api/alipaySdk-20160825.jar b/src/document/openapi/resources/api/alipaySdk-20160825.jar similarity index 100% rename from src/document/tpl/resources/api/alipaySdk-20160825.jar rename to src/document/openapi/resources/api/alipaySdk-20160825.jar diff --git a/src/document/tpl/img/logo_new.jpg b/src/document/tpl/img/logo_new.jpg deleted file mode 100644 index 7b51acf46..000000000 Binary files a/src/document/tpl/img/logo_new.jpg and /dev/null differ diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/PlatformClearService.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/PlatformClearService.java index 21049cd1f..748c33efa 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/PlatformClearService.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/PlatformClearService.java @@ -16,5 +16,4 @@ public interface PlatformClearService { void generateAliPaySettleLogs(); - void doVerifyHFSettleLog(JSONObject param); } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ChannelsAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ChannelsAnalysisServiceImpl.java index 402707f30..9878e525f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ChannelsAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/ChannelsAnalysisServiceImpl.java @@ -35,14 +35,9 @@ public class ChannelsAnalysisServiceImpl implements ChannelsAnalysisService { }*/ List listChannel = new ArrayList<>(); listChannel.add(putParam(params,"Wechat")); - listChannel.add(putParam(params,"Bestpay")); listChannel.add(putParam(params,"Alipay")); listChannel.add(putParam(params,"AlipayOnline")); - listChannel.add(putParam(params,"jd")); - listChannel.add(putParam(params,"hf")); listChannel.add(putParam(params,"Rpay")); - listChannel.add(putParam(params,"Yeepay")); - listChannel.add(putParam(params,"LakalaPay")); listChannel.add(putParam(params,"rpaypmt_card")); listChannel.add(putParam(params,"rpaypmt_dd")); return listChannel; @@ -55,7 +50,7 @@ public class ChannelsAnalysisServiceImpl implements ChannelsAnalysisService { } List list = new ArrayList<>(); Map analysisMap = new TreeMap<>(); - String[] channels = {"Wechat","Bestpay","Alipay","jd","AlipayOnline","hf", "Rpay","Yeepay","LakalaPay","rpaypmt_card","rpaypmt_dd"}; + String[] channels = {"Wechat","Alipay","AlipayOnline","Rpay","rpaypmt_card","rpaypmt_dd"}; for (String channel:channels){ analysisChannelCustomers(params, analysisMap, channel); } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java index f17ae2af1..e34eee4b6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java @@ -92,12 +92,7 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService { JSONObject result = new JSONObject(); List channels = new ArrayList<>(); if (params.get("channel") == null) { - channels.add("Bestpay"); - channels.add("Yeepay"); channels.add("Rpay"); - channels.add("hf"); - channels.add("jd"); - channels.add("LakalaPay"); channels.add("rpaypmt_card"); channels.add("rpaypmt_dd"); params.put("channels", channels); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java index b248cb2e6..b250fbc5d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/DashboardServiceImpl.java @@ -16,6 +16,7 @@ import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DurationFormatUtils; import org.slf4j.Logger; @@ -558,36 +559,13 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT record.put("new_customers",newCustomers); record.put("old_customers",oldCustomers); record.put("client_id",client.getIntValue("client_id")); - customerAndOrdersStatisticsMapper.save(record); + if (StringUtils.equalsIgnoreCase("rpaypmt_card", record.getString("channel")) || StringUtils.equalsIgnoreCase("rpaypmt_dd", record.getString("channel"))) { + record.put("single_amount", record.getBigDecimal("total").divide(record.getBigDecimal("orders"), 2, RoundingMode.HALF_UP)); + } + customerAndOrdersStatisticsMapper.save(record); } } } - -/* @Override - public JSONObject getPlatformAmount(JSONObject params) { - JSONObject resp = new JSONObject(); - - params.put("channel","Bestpay"); - resp.put("bestPayAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount")); - resp.put("bestPay_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count")); - - params.put("channel","Wechat"); - resp.put("wechatAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount")); - resp.put("wechat_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count")); - - params.put("channel","Alipay"); - resp.put("alipayAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount")); - resp.put("alipay_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count")); - - params.put("channel","jd"); - resp.put("jdAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount")); - resp.put("jd_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count")); - - params.put("channel","AlipayOnline"); - resp.put("aliOnlineAmount",transactionAnalysisMapper.getPlatformAmount(params).getBigDecimal("amount")); - resp.put("aliOnline_order_count",transactionAnalysisMapper.getPlatformAmount(params).getIntValue("order_count")); - return resp; - }*/ @Override public JSONObject getPlatformAmount(JSONObject params) { String jsonStr = stringRedisTemplate.boundValueOps("org_ChannelAnalysis" + params.getString("org_id")+params.getString("begin")).get(); @@ -610,7 +588,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT } } private JSONObject getTodayChannelCount(JSONObject params){ - String[] channels = new String[]{"Bestpay", "Wechat", "Alipay", "jd", "AlipayOnline", "hf", "Rpay", "Yeepay", "LakalaPay", "rpaypmt_card", "rpaypmt_dd"}; + String[] channels = new String[]{"Wechat", "Alipay", "AlipayOnline", "Rpay", "rpaypmt_card", "rpaypmt_dd"}; JSONObject resp = new JSONObject(); for(String channel:channels) { params.put("channel", channel); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/EstimateAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/EstimateAnalysisServiceImpl.java index d2fce07ea..35cff711f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/EstimateAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/EstimateAnalysisServiceImpl.java @@ -293,16 +293,6 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService { } - List hfSettle = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "hf"); - if (hfSettle != null && hfSettle.size() > 0) { - for (JSONObject logs : hfSettle) { - dayInfo.put("hfSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee")); - dayInfo.put("platformGetSettleFee", dayInfo.getBigDecimal("hfSettleFee_" + logs.getString("merchants"))); - } - } else { - dayInfo.put("platformGetSettleFee", BigDecimal.ZERO); - } - List alipaySettleLogs = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "Alipay"); for (JSONObject logs : alipaySettleLogs) { dayInfo.put("aliSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee")); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java index fc60a39c4..f2e233884 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PartnerCardDashboardServiceImp.java @@ -11,10 +11,8 @@ import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.merchants.core.ClientConfigService; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; -import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.utils.PageListUtils; - import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; @@ -23,12 +21,11 @@ import org.apache.commons.lang3.time.DateFormatUtils; import org.springframework.stereotype.Service; import org.springframework.util.Assert; +import javax.annotation.Resource; import java.math.BigDecimal; import java.util.Date; import java.util.List; -import javax.annotation.Resource; - /** * Created by yishuqian on 20/02/2017. */ @@ -63,7 +60,6 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi client.put("transaction_time", DateFormatUtils.format(earlistOrder.getDate("transaction_time"), "yyyy-MM-dd")); } JSONObject res = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Wechat"); - JSONObject best_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Bestpay"); JSONObject ali_pay = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), data, "Alipay"); JSONObject rate_value = new JSONObject(); if (res != null) { @@ -72,9 +68,6 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi client.put("clean_days", res.getIntValue("clean_days")); } } - if (best_pay != null) { - rate_value.put("best_rate_value", best_pay.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN)); - } if (ali_pay != null) { rate_value.put("ali_rate_value", ali_pay.getBigDecimal("rate_value").setScale(1, BigDecimal.ROUND_DOWN)); } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformClearAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformClearAnalysisServiceImpl.java index 0401e4125..9cc9877a3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformClearAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformClearAnalysisServiceImpl.java @@ -12,40 +12,23 @@ import au.com.royalpay.payment.manage.mappers.log.PlatformSettlementMapper; import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient; import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils; - import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; - -import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; -import org.apache.poi.hssf.usermodel.HSSFCell; -import org.apache.poi.hssf.usermodel.HSSFSheet; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.Row; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.RequestMethod; +import javax.annotation.Resource; import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import cn.yixblog.platform.http.HttpRequestGenerator; +import java.util.*; @Service public class PlatformClearAnalysisServiceImpl implements PlatformClearService { @@ -104,7 +87,7 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService { doVerifyAlipayOnlineSettleLog(sdfClear.parse(end_date)); } catch (Exception e) { logger.error("PlatformClearAnalysisServiceImpl.verifySettleLogByDate ==> 校验" + end_date + "支付宝Online到账失败:", e); - throw new ChannelNetworkException("校验失败:",e); + throw new ChannelNetworkException("校验失败:", e); } } if (StringUtils.equals("Wechat", channel)) { @@ -276,9 +259,9 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService { JSONObject alipaySettleLog = new JSONObject(); JSONArray payments = aliSettleLog.getJSONArray("payments"); - BigDecimal credit = new BigDecimal(0.00); - BigDecimal creditFee = new BigDecimal(0.00); - BigDecimal creditSettle = new BigDecimal(0.00); + BigDecimal credit = BigDecimal.ZERO; + BigDecimal creditFee = BigDecimal.ZERO; + BigDecimal creditSettle = BigDecimal.ZERO; if (payments != null) { for (int i = 0; i < payments.size(); i++) { JSONObject json = payments.getJSONObject(i); @@ -297,21 +280,19 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService { JSONArray refunds = aliSettleLog.getJSONArray("refunds"); logger.info("alipay的refunds清算总信息" + refunds.toJSONString()); - BigDecimal debit = new BigDecimal(0.00); - BigDecimal debitFee = new BigDecimal(0.00); - BigDecimal debitSettle = new BigDecimal(0.00); - if (refunds != null) { - for (int i = 0; i < refunds.size(); i++) { - JSONObject json = refunds.getJSONObject(i); - BigDecimal transactionAmount = json.getBigDecimal("transaction_amount"); - BigDecimal chargeFee = json.getBigDecimal("charge_fee"); - debit = debit.add(transactionAmount); - debitFee = debitFee.add(chargeFee); - if (json.containsKey("settle_amount")) { - debitSettle = debitSettle.add(json.getBigDecimal("settle_amount")); - } else { - debitSettle = debitSettle.add(transactionAmount.subtract(chargeFee)); - } + BigDecimal debit = BigDecimal.ZERO; + BigDecimal debitFee = BigDecimal.ZERO; + BigDecimal debitSettle = BigDecimal.ZERO; + for (int i = 0; i < refunds.size(); i++) { + JSONObject json = refunds.getJSONObject(i); + BigDecimal transactionAmount = json.getBigDecimal("transaction_amount"); + BigDecimal chargeFee = json.getBigDecimal("charge_fee"); + debit = debit.add(transactionAmount); + debitFee = debitFee.add(chargeFee); + if (json.containsKey("settle_amount")) { + debitSettle = debitSettle.add(json.getBigDecimal("settle_amount")); + } else { + debitSettle = debitSettle.add(transactionAmount.subtract(chargeFee)); } } alipaySettleLog.put("debit", debit); @@ -370,7 +351,7 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService { sysLogs.put("sys_net_fee", creditLogs.getBigDecimal("aud_amount").subtract(debitLogs.getBigDecimal("aud_amount"))); if (StringUtils.equals("Alipay", channel)) { - sysLogs.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel, new BigDecimal(0.006))); + sysLogs.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel, BigDecimal.valueOf(0.006))); } else if (StringUtils.equals("AlipayOnline", channel)) { sysLogs.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel, alipay_online_rate)); } else { @@ -385,121 +366,4 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService { } return null; } - - @Override - public void doVerifyHFSettleLog(JSONObject param) { - - String end = param.getString("end"); - String start = param.getString("start"); - JSONObject hfSettle = handleHFSettleFile(param.getString("fileId")); - if (hfSettle == null) { - return; - } - JSONObject record = new JSONObject(); - record.put("settle_date", end); - record.put("start_date", start); - record.put("end_date", end); - record.put("channel", "hf"); - record.put("last_update_date", new Date()); - JSONObject syscleardata = getHFSystemClearingAmount(start, end); - if (syscleardata != null && syscleardata.size() > 0) { - record.put("sys_pay_fee", syscleardata.getBigDecimal("sys_pay_fee")); - record.put("sys_refund_fee", syscleardata.getBigDecimal("sys_refund_fee")); - record.put("sys_net_fee", syscleardata.getBigDecimal("sys_net_fee")); - record.put("sys_surcharge", syscleardata.getBigDecimal("sys_surcharge")); - record.put("sys_settlement_fee", syscleardata.getBigDecimal("sys_settle_fee")); - } - record.put("pay_fee", BigDecimal.ZERO); - record.put("refund_fee", BigDecimal.ZERO); - record.put("net_fee", hfSettle.getBigDecimal("orderAmount")); - record.put("settlement_fee", hfSettle.getBigDecimal("clearingAmount")); - record.put("surcharge", hfSettle.getBigDecimal("surcharge")); - record.put("unsettle_fee", BigDecimal.ZERO); - - List check = null; - try { - check = platformSettlementMapper.findBySettleDate(DateUtils.parseDate(end, "yyyy-MM-dd"), "hf"); - } catch (ParseException e) { - e.printStackTrace(); - } - if (CollectionUtils.isNotEmpty(check)) { - record.put("log_id", check.get(0).getString("log_id")); - platformSettlementMapper.update(record); - } else { - platformSettlementMapper.save(record); - } - logger.info("汇付清算记录查询完成"); - - } - - private JSONObject handleHFSettleFile(String fileId) { - try { - HttpRequestGenerator gen = new HttpRequestGenerator(attachmentClient.getFileUrl(fileId), RequestMethod.GET); - HSSFWorkbook workbook = new HSSFWorkbook(gen.execute().getResponseContentStream()); - HSSFSheet sheet = workbook.getSheetAt(0); - Iterator rowIterator = sheet.rowIterator(); - Row row = null; - Cell cell = null; - // 跳过第一行 - rowIterator.next(); - JSONObject result = new JSONObject(); - BigDecimal orderAmount = BigDecimal.ZERO; - BigDecimal surcharge = BigDecimal.ZERO; - BigDecimal clearingAmount = BigDecimal.ZERO; - while (rowIterator.hasNext()) { - row = rowIterator.next(); - - cell = row.getCell(0); - if (cell != null) { - continue; - } - cell = row.getCell(15); - cell.setCellType(HSSFCell.CELL_TYPE_STRING); - if (cell != null) { - String orderAmountStr = cell.getStringCellValue().trim(); - if (StringUtils.isNotEmpty(orderAmountStr)) { - result.put("orderAmount", new BigDecimal(orderAmountStr)); - } - } - cell = row.getCell(16); - cell.setCellType(HSSFCell.CELL_TYPE_STRING); - if (cell != null) { - String surchargeStr = cell.getStringCellValue().trim(); - if (StringUtils.isNotEmpty(surchargeStr)) { - result.put("surcharge", new BigDecimal(surchargeStr)); - } - } - cell = row.getCell(17); - cell.setCellType(HSSFCell.CELL_TYPE_STRING); - if (cell != null) { - String clearingAmounStr = cell.getStringCellValue().trim(); - if (StringUtils.isNotEmpty(clearingAmounStr)) { - result.put("clearingAmount", new BigDecimal(clearingAmounStr)); - } - } - } - return result; - } catch (Exception e) { - logger.debug("处理汇付清算文件出错", e); - } - return null; - } - - private JSONObject getHFSystemClearingAmount(String start, String end) { - JSONObject result = new JSONObject(); - try { - JSONObject creditLogs = platformSettlementMapper.calculateSysSettleLog(start, end, "hf", "Credit", new BigDecimal(0.008)); - result.put("sys_pay_fee", creditLogs.getBigDecimal("aud_amount")); - JSONObject debitLogs = platformSettlementMapper.calculateSysSettleLog(start, end, "hf", "Debit", new BigDecimal(0.008)); - result.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start, end, "hf", new BigDecimal(0.008))); - result.put("sys_refund_fee", debitLogs.getBigDecimal("aud_amount")); - result.put("sys_net_fee", creditLogs.getBigDecimal("aud_amount").subtract(debitLogs.getBigDecimal("aud_amount"))); - result.put("sys_settle_fee", result.getBigDecimal("sys_net_fee").subtract(result.getBigDecimal("sys_surcharge"))); - return result; - } catch (Exception ignore) { - ignore.printStackTrace(); - } - return null; - } - } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformRevenueImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformRevenueImpl.java index f23f900fd..4f15d1183 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformRevenueImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/PlatformRevenueImpl.java @@ -17,7 +17,7 @@ import java.util.List; @Service public class PlatformRevenueImpl implements PlatformRevenueService { private org.slf4j.Logger logger = LoggerFactory.getLogger(getClass()); - String[] channelArr = { "Wechat", "Alipay", "Bestpay" }; + String[] channelArr = { "Wechat", "Alipay" }; @Resource private ClearingLogMapper clearingLogMapper; diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PlatformClearAController.java b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PlatformClearAController.java index 7310285a3..32eada5e7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/web/PlatformClearAController.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/web/PlatformClearAController.java @@ -4,19 +4,11 @@ import au.com.royalpay.payment.manage.analysis.core.PlatformClearService; import au.com.royalpay.payment.manage.permission.manager.ManagerMapping; import au.com.royalpay.payment.manage.pos.datasource.ReadOnlyConnection; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; - import com.alibaba.fastjson.JSONObject; - -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.text.ParseException; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.text.ParseException; @RestController @RequestMapping(value = "/platform/analysis") @@ -49,8 +41,4 @@ public class PlatformClearAController { platformClearService.generateSettleLogs(); } - @ManagerMapping(value = "/generate/hf/settle", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.DEVELOPER}) - public void generatehfSettleLogs(@RequestBody JSONObject param) { - platformClearService.doVerifyHFSettleLog(param); - } } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppleLoginBean.java b/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppleLoginBean.java new file mode 100644 index 000000000..34f3474e7 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppleLoginBean.java @@ -0,0 +1,28 @@ +package au.com.royalpay.payment.manage.appclient.beans; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Getter; +import lombok.Setter; + +import javax.validation.constraints.NotEmpty; + +/** + * @author taylor.dang + * @date 2020-04-20 21:26 + */ +@Getter +@Setter +public class AppleLoginBean { + @JSONField(name = "identityToken") + @NotEmpty + private String identityToken; + @JSONField(name = "user") + @NotEmpty + private String user; + @JSONField(name = "devId") + @NotEmpty + private String devId; + @JSONField(name = "authorizationCode") + @NotEmpty + private String authorizationCode; +} diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java index 0f2e8bdf9..df98abc54 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java @@ -1,9 +1,6 @@ package au.com.royalpay.payment.manage.appclient.core; -import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; -import au.com.royalpay.payment.manage.appclient.beans.AppPaymentConfigBean; -import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean; -import au.com.royalpay.payment.manage.appclient.beans.RetailAppMessage; +import au.com.royalpay.payment.manage.appclient.beans.*; import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo; import au.com.royalpay.payment.manage.merchants.beans.ClientKycFilesInfo; import au.com.royalpay.payment.manage.merchants.beans.ClientUpdateInfo; @@ -201,6 +198,8 @@ public interface RetailAppService { void updateLoginClientAccountPhone(JSONObject account,String contactPhone, String nationCode); void updateLoginClientAccountOpenId(JSONObject client,JSONObject params); + + void updateLoginClientAccountAppleId(JSONObject client,JSONObject params); /** * 退款密码 */ @@ -251,6 +250,10 @@ public interface RetailAppService { JSONObject bindAccountWechat(JSONObject device, JSONObject params); + JSONObject unbindAccountApple(JSONObject device); + + JSONObject bindAccountApple(JSONObject device, AppleLoginBean appleLoginBean); + JSONObject getAccountBindInfos(JSONObject device); JSONObject postAppMessage(JSONObject device, RetailAppMessage message); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 67690a50f..1f5ac643d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -6,10 +6,7 @@ import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.manage.activities.app_index.core.AppActService; import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; -import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; -import au.com.royalpay.payment.manage.appclient.beans.AppPaymentConfigBean; -import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean; -import au.com.royalpay.payment.manage.appclient.beans.RetailAppMessage; +import au.com.royalpay.payment.manage.appclient.beans.*; import au.com.royalpay.payment.manage.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.appclient.extend.GatewayOAuthRegister; import au.com.royalpay.payment.manage.cashback.core.CashbackService; @@ -73,6 +70,8 @@ import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.threadpool.RoyalThreadPoolExecutor; import au.com.royalpay.payment.tools.utils.*; +import au.com.royalpay.payment.tools.utils.apple.AppleAuthUtils; +import au.com.royalpay.payment.tools.utils.apple.UserClaim; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -290,6 +289,12 @@ public class RetailAppServiceImp implements RetailAppService { res.put("rate", paymentApi.channelApi("Wechat").queryExchangeRateDecimal(clientId)); res.put("alipay_rate", paymentApi.channelApi("Alipay").queryExchangeRateDecimal(clientId)); } + params.put("channel", "system"); + res.put("sys_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)).setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); + params.put("channel", "rpaypmt_card"); + res.put("rpaypmt_card_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)).setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); + params.put("channel", "rpaypmt_dd"); + res.put("rpaypmt_dd_not_settled", new BigDecimal(transactionAnalysisMapper.analysisNotSettled(params)).setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); return res; } @@ -1660,7 +1665,6 @@ public class RetailAppServiceImp implements RetailAppService { channels[0] = getChannel(clientId, now, "Wechat"); channels[1] = getChannel(clientId, now, "Alipay"); - channels[2] = getChannel(clientId, now, "Bestpay"); res.put("channels", channels); return res; @@ -1777,12 +1781,11 @@ public class RetailAppServiceImp implements RetailAppService { List newActs = new ArrayList<>(); for (JSONObject act : JSON.parseArray(acts.toJSONString(), JSONObject.class)) { if (act.getString("page_desc") != null && !act.getString("page_desc").equals("0")) { - logger.info("app get banner{}-{}", device.getIntValue("client_id"), act.toJSONString()); if (StringUtils.equalsIgnoreCase(act.getString("page_keywords"), "RYCBSM")) { if (geekShowActVersion(device.getString("version"))) { newActs.add(act); } - }else { + } else { newActs.add(act); } } @@ -2322,6 +2325,14 @@ public class RetailAppServiceImp implements RetailAppService { clientAccountMapper.update(updateAccount); } + @Override + public void updateLoginClientAccountAppleId(JSONObject account, JSONObject params) { + JSONObject updateAccount = new JSONObject(); + updateAccount.put("account_id", account.getString("account_id")); + updateAccount.put("apple_userid", params.getString("apple_userid")); + clientAccountMapper.update(updateAccount); + } + @Override public JSONObject unbindAccountPhone(JSONObject device, JSONObject params) { String codeKeyValueRedis = stringRedisTemplate.boundValueOps(getUpdateAccountPhoneKey(device.getString("account_id"))).get(); @@ -2379,6 +2390,36 @@ public class RetailAppServiceImp implements RetailAppService { return result; } + @Override + public JSONObject unbindAccountApple(JSONObject device) { + JSONObject account = new JSONObject(); + account.put("account_id", device.getString("account_id")); + account.put("apple_userid", null); + clientAccountMapper.update(account); + JSONObject result = new JSONObject(); + result.put("status", "success"); + return result; + } + + @Override + public JSONObject bindAccountApple(JSONObject device, AppleLoginBean appleLoginBean) { + UserClaim userClaim = AppleAuthUtils.verifyIdentifyToken(appleLoginBean.getIdentityToken()); + if (!StringUtils.equalsIgnoreCase(userClaim.getSub(), appleLoginBean.getUser())) { + throw new ForbiddenException("apple userinfo is error"); + } + JSONObject account = clientAccountMapper.findByAppleUserId(userClaim.getSub()); + if (account != null) { + throw new BadRequestException("Apple UserID has been bound to other accounts, please unbind it before binding"); + } + JSONObject updateAccount = new JSONObject(); + updateAccount.put("account_id", device.getString("account_id")); + updateAccount.put("apple_userid", userClaim.getSub()); + clientAccountMapper.update(updateAccount); + JSONObject result = new JSONObject(); + result.put("status", "success"); + return result; + } + @Override public JSONObject getAccountBindInfos(JSONObject device) { JSONObject account = clientAccountMapper.findById(device.getString("account_id")); @@ -2391,6 +2432,7 @@ public class RetailAppServiceImp implements RetailAppService { result.put("nation_code", account.getString("nation_code")); } result.put("wechat_bind_status", account.containsKey("wx_unionid")); + result.put("apple_bind_status", account.containsKey("apple_userid")); if (account.containsKey("wx_unionid")) { result.put("wechat_name", account.getString("wechat_name")); } @@ -2536,7 +2578,7 @@ public class RetailAppServiceImp implements RetailAppService { } JSONObject compliance = clientComplianceCompanyMapper.findFileByClientId(account.getIntValue("client_id")); if (compliance != null) { - if (compliance.getIntValue("status")==0 || compliance.getIntValue("status")==1) { + if (compliance.getIntValue("status") == 0 || compliance.getIntValue("status") == 1) { authFileStatus.put("client_less_file", false); } } @@ -2555,14 +2597,14 @@ public class RetailAppServiceImp implements RetailAppService { authFileStatus.put("content", messageSource.getMessage("client.auth.file.title", null, RequestEnvironment.getLocale())); List supplement_array = new ArrayList<>(); - JSONObject complianceFilesNotice = complianceFilesNotice(client,account); - JSONObject kycFilesNotice = kycFilesNotice(client,account); - - if(complianceFilesNotice != null && kycFilesNotice != null){ - if( !kycFilesNotice.getBoolean("client_less_file") && !complianceFilesNotice.getBoolean("client_less_file")){ - authFileStatus.put("isNeedShowKycAlert",false); - }else{ - authFileStatus.put("isNeedShowKycAlert",true); + JSONObject complianceFilesNotice = complianceFilesNotice(client, account); + JSONObject kycFilesNotice = kycFilesNotice(client, account); + + if (complianceFilesNotice != null && kycFilesNotice != null) { + if (!kycFilesNotice.getBoolean("client_less_file") && !complianceFilesNotice.getBoolean("client_less_file")) { + authFileStatus.put("isNeedShowKycAlert", false); + } else { + authFileStatus.put("isNeedShowKycAlert", true); } } if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { @@ -2652,20 +2694,20 @@ public class RetailAppServiceImp implements RetailAppService { complianceFilesNotice.put("auth_type", FilesAuthTypeEnum.COMPLIANCE.getAuthType()); complianceFilesNotice.put("type", messageSource.getMessage("client.auth.file.compliance.type", null, RequestEnvironment.getLocale())); - complianceFilesNotice.put("client_less_file",complianceFileStatus.getBoolean("client_less_file")); - if(compliance != null){ - if (compliance.getIntValue("status")==0 || compliance.getIntValue("status")==1) { + complianceFilesNotice.put("client_less_file", complianceFileStatus.getBoolean("client_less_file")); + if (compliance != null) { + if (compliance.getIntValue("status") == 0 || compliance.getIntValue("status") == 1) { complianceFilesNotice.put("client_less_file", false); } - if(complianceFileStatus.getBoolean("client_less_file")){ - complianceFilesNotice.put("client_refuse_reason",compliance.getString("description")); + if (complianceFileStatus.getBoolean("client_less_file")) { + complianceFilesNotice.put("client_refuse_reason", compliance.getString("description")); } - complianceFilesNotice.put("status",compliance.getString("status")); - complianceFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(compliance.getIntValue("status")) ); - }else if( !complianceFileStatus.getBoolean("client_less_file")){ - complianceFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(1) ); - }else{ - complianceFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(-1) ); + complianceFilesNotice.put("status", compliance.getString("status")); + complianceFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(compliance.getIntValue("status"))); + } else if (!complianceFileStatus.getBoolean("client_less_file")) { + complianceFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(1)); + } else { + complianceFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(-1)); } complianceFilesNotice.put("status_type_description", messageSource.getMessage("client.auth.file.status." + complianceFilesNotice.getString("status_type").toLowerCase(), null, RequestEnvironment.getLocale())); return complianceFilesNotice; @@ -2683,15 +2725,15 @@ public class RetailAppServiceImp implements RetailAppService { kycFilesNotice.put("auth_type", FilesAuthTypeEnum.KYC.getAuthType()); kycFilesNotice.put("type", messageSource.getMessage("client.auth.file.kyc.type", null, RequestEnvironment.getLocale())); - kycFilesNotice.put("client_less_file",kycFileStatus.getBoolean("client_less_file")); - if(compliance != null){ - if(kycFilesNotice.getBoolean("client_less_file")){ - kycFilesNotice.put("client_refuse_reason",compliance.getString("description")); + kycFilesNotice.put("client_less_file", kycFileStatus.getBoolean("client_less_file")); + if (compliance != null) { + if (kycFilesNotice.getBoolean("client_less_file")) { + kycFilesNotice.put("client_refuse_reason", compliance.getString("description")); } - kycFilesNotice.put("status",compliance.getString("status")); - kycFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(compliance.getIntValue("status")) ); - }else{ - kycFilesNotice.put( "status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(-1) ); + kycFilesNotice.put("status", compliance.getString("status")); + kycFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(compliance.getIntValue("status"))); + } else { + kycFilesNotice.put("status_type", FilesAuthStatusEnum.STATUS.getAuthStatus(-1)); } kycFilesNotice.put("status_type_description", messageSource.getMessage("client.auth.file.status." + kycFilesNotice.getString("status_type").toLowerCase(), null, RequestEnvironment.getLocale())); return kycFilesNotice; @@ -2745,22 +2787,6 @@ public class RetailAppServiceImp implements RetailAppService { throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service"); } - try { - JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay"); - if (bestPayRate != null) { - client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN)); - } - - JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd"); - if (jdRate != null) { - client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, RoundingMode.DOWN)); - } - } catch (Exception ignored) { - JSONObject rate = sysConfigRate.getJSONObject("t" + weChatRate.getString("clean_days")); - client.put("bestpay_rate", rate.getBigDecimal("Bestpay").setScale(2, RoundingMode.DOWN)); - client.put("jd_rate", rate.getBigDecimal("JDpay").setScale(2, RoundingMode.DOWN)); - } - JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id")); if (bankAccount == null || bankAccount.size() <= 0) { throw new BadRequestException("The Partner's Account is not config!"); @@ -3055,14 +3081,6 @@ public class RetailAppServiceImp implements RetailAppService { if (alipay.containsKey("channel")) { channels.add(alipay); } - JSONObject bestpay = getChannel(clientId, now, "Bestpay"); - if (bestpay.containsKey("channel")) { - channels.add(bestpay); - } - JSONObject jd = getChannel(clientId, now, "jd"); - if (jd.containsKey("channel")) { - channels.add(jd); - } JSONObject alipayOnline = getChannel(clientId, now, "AlipayOnline"); if (alipayOnline.containsKey("channel")) { channels.add(alipayOnline); @@ -3071,7 +3089,15 @@ public class RetailAppServiceImp implements RetailAppService { if (cbBankPay.containsKey("channel")) { channels.add(cbBankPay); } + JSONObject cardPaymentPay = getChannel(clientId, now, "rpaypmt_card"); + if (cardPaymentPay.containsKey("channel")) { + channels.add(cardPaymentPay); + } res.put("channels", channels); + if (res.containsKey("rate_value")) { + BigDecimal minRate = res.getBigDecimal("rate_value").add(BigDecimal.valueOf(0.01)).setScale(2, RoundingMode.DOWN); + res.put("customer_rage_title", (minRate.toPlainString() + "~" + res.getString("max_customer_surcharge_rate"))); + } return res; } @@ -3103,7 +3129,7 @@ public class RetailAppServiceImp implements RetailAppService { int clientId = account.getIntValue("client_id"); JSONObject displayInfo = actPartnerReadMapper.displayInfo(actId, clientId, accountId); if (displayInfo == null) { - displayInfo = new JSONObject(){{ + displayInfo = new JSONObject() {{ put("display_client_id", UUID.randomUUID().toString()); put("act_id", actId); put("client_id", clientId); @@ -3117,7 +3143,7 @@ public class RetailAppServiceImp implements RetailAppService { int accountDisplayCount = displayInfo.getIntValue("display_count"); if (accountDisplayCount < displayCount) { displayInfo.put("last_read_time", new Date()); - displayInfo.put("display_count", (accountDisplayCount+1)); + displayInfo.put("display_count", (accountDisplayCount + 1)); actPartnerReadMapper.update(displayInfo); return false; } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java index 9bff7968f..bbc612edf 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailRSvcServiceImpl.java @@ -18,11 +18,11 @@ import au.com.royalpay.payment.tools.encryptalgorithm.SignUtils; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.mappers.CommonIncrementalChannelMapper; +import org.apache.commons.codec.binary.Base64; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.parser.Feature; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.net.util.Base64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java index 24810e092..d92cf4dd7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java @@ -3,10 +3,7 @@ package au.com.royalpay.payment.manage.appclient.web; import au.com.royalpay.payment.core.exceptions.ParamInvalidException; import au.com.royalpay.payment.manage.activities.app_index.core.AppActService; import au.com.royalpay.payment.manage.activities.monsettledelay.core.ActMonDelaySettleService; -import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; -import au.com.royalpay.payment.manage.appclient.beans.AppPaymentConfigBean; -import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean; -import au.com.royalpay.payment.manage.appclient.beans.RetailAppMessage; +import au.com.royalpay.payment.manage.appclient.beans.*; import au.com.royalpay.payment.manage.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.bill.bean.NewBillBean; import au.com.royalpay.payment.manage.bill.bean.QueryBillBean; @@ -206,7 +203,7 @@ public class RetailAppController { @GetMapping("/notice/unread") public List latestNotice(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { - return retailAppService.getLatestNotice(device,device.getIntValue("client_id")); + return retailAppService.getLatestNotice(device, device.getIntValue("client_id")); } /* 消息模块end */ @@ -774,32 +771,53 @@ public class RetailAppController { * @throws Exception */ @PutMapping("/account/phone/unbind") - public JSONObject unbindAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) throws Exception { + public JSONObject unbindAccountPhone(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) throws Exception { return retailAppService.unbindAccountPhone(device, params); } /** * 微信绑定 - * @param device + * + * @param device * @param params */ @PutMapping("/account/wechat/bind") - public JSONObject bindAccountWechat(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params){ - return retailAppService.bindAccountWechat(device,params); + public JSONObject bindAccountWechat(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) { + return retailAppService.bindAccountWechat(device, params); } /** * 微信解绑 + * * @param device */ @PutMapping("/account/wechat/unbind") - public JSONObject unbindAccountWechat(@ModelAttribute(RETAIL_DEVICE) JSONObject device){ + public JSONObject unbindAccountWechat(@ModelAttribute(RETAIL_DEVICE) JSONObject device) { return retailAppService.unbindAccountWechat(device); } + /** + * Apple绑定 + * + * @param device + */ + @PutMapping("/account/apple/bind") + public JSONObject bindAccountApple(@ModelAttribute(RETAIL_DEVICE) JSONObject device, @Valid @RequestBody AppleLoginBean appleLoginBean) { + return retailAppService.bindAccountApple(device, appleLoginBean); + } + /** + * Apple解绑 + * + * @param device + */ + @PutMapping("/account/apple/unbind") + public JSONObject unbindAccountApple(@ModelAttribute(RETAIL_DEVICE) JSONObject device) { + return retailAppService.unbindAccountApple(device); + } + /** * 验证退款密码 @@ -918,9 +936,9 @@ public class RetailAppController { * @param device */ @PostMapping("/client/kyc_auth_file") - public JSONObject uploadKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam MultipartFile file, @RequestParam("fileType") String fileType)throws Exception{ + public JSONObject uploadKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestParam MultipartFile file, @RequestParam("fileType") String fileType) throws Exception { JSONObject fileInfo = attachmentClient.uploadFile(file, false); - retailAppService.uploadKycAuthFilesForApp(device, fileInfo,fileType); + retailAppService.uploadKycAuthFilesForApp(device, fileInfo, fileType); return fileInfo; } @@ -930,7 +948,7 @@ public class RetailAppController { * @param device */ @PostMapping("/client/auth_file/commit_to_kyc") - public void commitToKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device,@RequestBody JSONObject params) { + public void commitToKycAuthFiles(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject params) { retailAppService.commitAuthFilesToKyc(device, params); } @@ -960,12 +978,13 @@ public class RetailAppController { /** * 登录用户绑定信息(手机、第三方) + * * @param device * @return */ @GetMapping("/client/account/bind/infos") - public JSONObject findClientAccountBindStatusInfos(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){ - return retailAppService.getAccountBindInfos(device); + public JSONObject findClientAccountBindStatusInfos(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { + return retailAppService.getAccountBindInfos(device); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java index 909e0ab93..54fb00fff 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java @@ -1,5 +1,6 @@ package au.com.royalpay.payment.manage.appclient.web; +import au.com.royalpay.payment.manage.appclient.beans.AppleLoginBean; import au.com.royalpay.payment.manage.appclient.beans.RetailLoginInfo; import au.com.royalpay.payment.manage.appclient.core.ManageAppService; import au.com.royalpay.payment.manage.appclient.core.RetailAppService; @@ -138,6 +139,35 @@ public class RetailValidationController implements ApplicationEventPublisherAwar return res; } + @PostMapping("/apple_signin") + public JSONObject mchAppleSignIn(@Valid @RequestBody AppleLoginBean appleLoginBean) { + return signInStatusManager.mchAppleSignIn(appleLoginBean); + } + + /** + * 微信绑定登录账号 + * + * @param params + * @return + */ + @PostMapping("/login/apple_bind") + public JSONObject appleLoginBind(@RequestBody JSONObject params) { + LoginInfo loginInfo = new LoginInfo(); + loginInfo.setLoginId(params.getString("loginId")); + loginInfo.setPassword(params.getString("password")); + String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo, "apple"); + JSONObject account = signInStatusManager.getCurrentClient(signKey); + retailAppService.updateLoginClientAccountAppleId(account, params); + account = JSON.parseObject(account.toJSONString()); + JSONObject result = new JSONObject(); + account.put("sign_key", signKey); + result.put("account", account); + result.put("bind_status", true); + result.put("status", "success"); + this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat")); + return result; + } + @GetMapping("/captcha") public JSONObject getCaptchaForDevice(@RequestParam(defaultValue = "false") boolean imgurl) throws IOException { String capText = RandomStringUtils.random(4, false, true); @@ -186,9 +216,9 @@ public class RetailValidationController implements ApplicationEventPublisherAwar @PostMapping("/send/{phone_number}/verify_code") @ResponseBody public JSONObject sendLoginMobileVerifyCode(@PathVariable("phone_number") String phoneNumber, - @RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode, - HttpServletRequest request) { - simpleClientApplyService.getAndSendLoginSmsCode(phoneNumber, nationCode, request); + @RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode, + HttpServletRequest request) { + simpleClientApplyService.getAndSendLoginSmsCode(phoneNumber, nationCode, request); return new JSONObject(); } @@ -201,58 +231,59 @@ public class RetailValidationController implements ApplicationEventPublisherAwar */ @PostMapping("/login/verify/{contact_phone}/verify_code") public JSONObject verifyLoginMobileCode(@PathVariable("contact_phone") String contactPhone, - @RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode, - @RequestBody JSONObject params, - @ModelAttribute(CommonConsts.MANAGER_DEVICE) JSONObject device, + @RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode, + @RequestBody JSONObject params, + @ModelAttribute(CommonConsts.MANAGER_DEVICE) JSONObject device, Errors errors) { HttpUtils.handleValidErrors(errors); JSONObject result = new JSONObject(); simpleClientApplyService.verifyLoginSMSCode(params.getString("verify_code"), contactPhone); String signKey = signInStatusManager.getClientInfoByPhoneStatusKey(contactPhone, nationCode); - if(signKey!=null){ + if (signKey != null) { JSONObject account = signInStatusManager.getCurrentClient(signKey); account = JSON.parseObject(account.toJSONString()); if (params.getString("devId") != null) { deviceSupport.validDeviceWithClient(account, params.getString("devId")); } account.put("sign_key", signKey); - result.put("account",account); - result.put("status","success"); + result.put("account", account); + result.put("status", "success"); result.put("bind_status", true); this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "MOBILE")); - }else{ - result.put("status","success"); + } else { + result.put("status", "success"); result.put("bind_status", false); - result.put("contact_phone",contactPhone); - result.put("nation_code",nationCode); + result.put("contact_phone", contactPhone); + result.put("nation_code", nationCode); } return result; } /** * 手机登录-绑定账号 + * * @param contactPhone * @param nationCode * @param params */ @PostMapping("/login/mobile/{contact_phone}/bind") - public JSONObject mobileLoginBind(@PathVariable("contact_phone")String contactPhone, - @RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode, - @RequestBody JSONObject params, - Errors errors){ + public JSONObject mobileLoginBind(@PathVariable("contact_phone") String contactPhone, + @RequestParam("nation_code") @NotEmpty(message = "nation code can't be null") String nationCode, + @RequestBody JSONObject params, + Errors errors) { HttpUtils.handleValidErrors(errors); LoginInfo loginInfo = new LoginInfo(); loginInfo.setLoginId(params.getString("loginId")); loginInfo.setPassword(params.getString("password")); - String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo,"phone"); - signInStatusManager.verifyClientLoginPhoneBindCode(contactPhone,nationCode); + String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo, "phone"); + signInStatusManager.verifyClientLoginPhoneBindCode(contactPhone, nationCode); JSONObject account = signInStatusManager.getCurrentClient(signKey); - retailAppService.updateLoginClientAccountPhone(account, contactPhone,nationCode); + retailAppService.updateLoginClientAccountPhone(account, contactPhone, nationCode); account.put("sign_key", signKey); account = JSON.parseObject(account.toJSONString()); JSONObject result = new JSONObject(); - result.put("account",account); + result.put("account", account); result.put("bind_status", true); this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "MOBILE")); return result; @@ -260,6 +291,7 @@ public class RetailValidationController implements ApplicationEventPublisherAwar /** * 商戶端App微信授权登录 + * * @param params * @return */ @@ -268,7 +300,7 @@ public class RetailValidationController implements ApplicationEventPublisherAwar Errors errors) { HttpUtils.handleValidErrors(errors); JSONObject account = signInStatusManager.clientAppWechatSignIn(params.getString("code")); - if(!account.getBoolean("bind_status")){ + if (!account.getBoolean("bind_status")) { deviceSupport.validDeviceWithClient(account, params.getString("app_openid")); return account; } @@ -278,26 +310,27 @@ public class RetailValidationController implements ApplicationEventPublisherAwar /** * 微信绑定登录账号 + * * @param params * @return */ @PostMapping("/login/wechat_bind") - public JSONObject wechatLoginBind(@RequestBody JSONObject params){ + public JSONObject wechatLoginBind(@RequestBody JSONObject params) { LoginInfo loginInfo = new LoginInfo(); loginInfo.setLoginId(params.getString("loginId")); loginInfo.setPassword(params.getString("password")); - String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo,"wechat"); + String signKey = signInStatusManager.verifyClientAccountLogin(loginInfo, "wechat"); JSONObject wechatInfo = signInStatusManager.verifyClientLoginWechatBindCode(params.getString("wechat_openid")); JSONObject account = signInStatusManager.getCurrentClient(signKey); - params.put("nick_name",wechatInfo.getString("nick_name")); - params.put("union_id",wechatInfo.getString("union_id")); - retailAppService.updateLoginClientAccountOpenId(account,params); + params.put("nick_name", wechatInfo.getString("nick_name")); + params.put("union_id", wechatInfo.getString("union_id")); + retailAppService.updateLoginClientAccountOpenId(account, params); account = JSON.parseObject(account.toJSONString()); JSONObject result = new JSONObject(); account.put("sign_key", signKey); - result.put("account",account); + result.put("account", account); result.put("bind_status", true); - result.put("status","success"); + result.put("status", "success"); this.publisher.publishEvent(new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat")); return result; } diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java index 5696a9815..9d5ac067f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java @@ -338,8 +338,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { apply.put("alipay_rate",rate.getString("Alipay")); apply.put("alipay_online_rate",rate.getString("AlipayOnline")); apply.put("cbbank_rate",rate.getString("CB_Bankpay")); - apply.put("bestpay_rate",rate.getString("Bestpay")); - apply.put("jd_rate",rate.getString("JDpay")); JSONObject bankInfo = getBankInfo(apply.getString("bsb_no")); apply.put("bank", bankInfo.getString("bank")); @@ -506,8 +504,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { apply.put("alipay_rate",rate.getString("Alipay")); apply.put("alipay_online_rate",rate.getString("AlipayOnline")); apply.put("cbbank_rate",rate.getString("CB_Bankpay")); - apply.put("bestpay_rate",rate.getString("Bestpay")); - apply.put("jd_rate",rate.getString("JDpay")); JSONObject bankInfo = getBankInfo(apply.getString("bsb_no")); apply.put("bank", bankInfo.getString("bank")); @@ -759,8 +755,6 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { configNewClientRate(sysRate, clientId, "Wechat", "Wechat"); configNewClientRate(sysRate, clientId, "Alipay", "Alipay"); configNewClientRate(sysRate, clientId, "AlipayOnline", "AlipayOnline"); - configNewClientRate(sysRate, clientId, "Bestpay", "Bestpay"); - configNewClientRate(sysRate, clientId, "jd", "JDpay"); configNewClientRate(sysRate, clientId, "CB_BankPay", "CB_Bankpay"); Runnable task2 = () -> { try { diff --git a/src/main/java/au/com/royalpay/payment/manage/application/web/ContentController.java b/src/main/java/au/com/royalpay/payment/manage/application/web/ContentController.java index e665acdd6..abf996ad2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/web/ContentController.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/web/ContentController.java @@ -42,9 +42,7 @@ public class ContentController { model.addAttribute("wechat_rate", contractInfo.getString("wechat_rate")); model.addAttribute("cbbank_rate", contractInfo.getString("cbbank_rate")); model.addAttribute("alipay_online_rate", contractInfo.getString("alipay_online_rate")); - model.addAttribute("bestpay_rate", contractInfo.getString("bestpay_rate")); model.addAttribute("alipay_rate", contractInfo.getString("alipay_rate")); - model.addAttribute("jd_rate", contractInfo.getString("jd_rate")); return "contract_for_compliance"; } diff --git a/src/main/java/au/com/royalpay/payment/manage/apps/events/listeners/AfterPaymentFinishListener.java b/src/main/java/au/com/royalpay/payment/manage/apps/events/listeners/AfterPaymentFinishListener.java deleted file mode 100644 index 512641468..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/apps/events/listeners/AfterPaymentFinishListener.java +++ /dev/null @@ -1,61 +0,0 @@ -package au.com.royalpay.payment.manage.apps.events.listeners; - -import au.com.royalpay.payment.core.events.AfterPaymentFinishEvent; -import au.com.royalpay.payment.manage.customers.core.CustomerPaymentInfoService; -import au.com.royalpay.payment.manage.mappers.system.SysCustomerPaymentInfoMapper; -import au.com.royalpay.payment.manage.merchants.core.ClientManager; -import com.alibaba.fastjson.JSONObject; -import org.apache.commons.lang3.StringUtils; -import org.springframework.context.ApplicationListener; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; - -/** - * Created by wangning on 17/01/2018. - */ -@Service -public class AfterPaymentFinishListener implements ApplicationListener { - @Resource - private SysCustomerPaymentInfoMapper sysCustomerPaymentInfoMapper; - @Resource - private CustomerPaymentInfoService customerPaymentInfoService; - @Resource - private ClientManager clientManager; - - @Override - public void onApplicationEvent(AfterPaymentFinishEvent event) { - JSONObject order = event.getFinishedEvent().getOrder(); - if(!"hf".equals(order.getString("channel"))&&!"Yeepay".equals(order.getString("channel"))){ - return; - } - switch (order.getString("channel")){ - case "hf": - if(StringUtils.isEmpty(order.getString("ext_params"))){ - return; - } - JSONObject extParam = JSONObject.parseObject(order.getString("ext_params")); - JSONObject orderInfo = sysCustomerPaymentInfoMapper.selectPaymentInfo(order.getString("customer_id")); - if (orderInfo != null) { - orderInfo.put("idcard_name", extParam.getString("payer_name")); - orderInfo.put("idcard_no", extParam.getString("payer_identity_card")); - orderInfo.put("bankcard", extParam.getString("card_number")); - orderInfo.put("bank", extParam.getString("bankId")); - sysCustomerPaymentInfoMapper.update(orderInfo); - }else { - JSONObject lastOrderInfo = new JSONObject(); - lastOrderInfo.put("wechat_openid", order.getString("customer_id")); - lastOrderInfo.put("idcard_name", extParam.getString("payer_name")); - lastOrderInfo.put("idcard_no", extParam.getString("payer_identity_card")); - lastOrderInfo.put("bankcard", extParam.getString("card_number")); - lastOrderInfo.put("bank", extParam.getString("bankId")); - customerPaymentInfoService.save(lastOrderInfo); - } - clientManager.sendHfEmailNotice(order); - return; - case "Yeepay": - clientManager.sendGatewayEmailNotice(order); - return; - } - } -} diff --git a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java index 786156343..f7e073ea1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/bdprize/core/impls/BDPrizeServiceImpl.java @@ -81,7 +81,7 @@ public class BDPrizeServiceImpl implements BDPrizeService { private static BigDecimal percent = new BigDecimal(100); - private static String[] channels = new String[]{"Wechat", "Alipay", "Bestpay", "jd", "AlipayOnline","hf", "Rpay","Yeepay","LakalaPay", "rpaypmt_card", "rpaypmt_dd"}; + private static String[] channels = new String[]{"Wechat", "Alipay","AlipayOnline", "Rpay","rpaypmt_card", "rpaypmt_dd"}; private static Logger logger = LoggerFactory.getLogger(BDPrizeServiceImpl.class); @Override @@ -463,17 +463,17 @@ public class BDPrizeServiceImpl implements BDPrizeService { } if (config.getString("bc_config_id") != null && !"".equals(config.getString("bc_config_id"))) { - config.put("LAST_UPDATE_DATE", new Date()); - config.put("LAST_UPDATE_BY", manager.getString("display_name")); + config.put("last_update_date", new Date()); + config.put("last_update_by", manager.getString("display_name")); financialBDCommissionConfigMapper.updateCommissionConfig(config); } else { String[] firLasDay = getMonthFisrtLastDay(month); - config.put("START_DATE", firLasDay[0]); - config.put("END_DATE", firLasDay[1]); - config.put("CREATION_DATE", new Date()); - config.put("CREATION_BY", manager.getString("display_name")); - config.put("LAST_UPDATE_DATE", new Date()); - config.put("LAST_UPDATE_BY", manager.getString("display_name")); + config.put("start_date", firLasDay[0]); + config.put("end_date", firLasDay[1]); + config.put("creation_date", new Date()); + config.put("creation_by", manager.getString("display_name")); + config.put("last_update_date", new Date()); + config.put("last_update_by", manager.getString("display_name")); financialBDCommissionConfigMapper.insertCommissionConfig(config); } } @@ -501,8 +501,8 @@ public class BDPrizeServiceImpl implements BDPrizeService { @Override public void updateBdKpiConfig(List configs, JSONObject manager) throws ParseException { for (JSONObject config : configs){ - config.put("LAST_UPDATE_DATE", new Date()); - config.put("LAST_UPDATE_BY", manager.getString("display_name")); + config.put("last_update_date", new Date()); + config.put("last_update_by", manager.getString("display_name")); financialBDConfigMapper.updateBDConfig(config); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/AgentCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/AgentCommissionAnalysis.java index 353c549cf..67bd2d78b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/AgentCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/AgentCommissionAnalysis.java @@ -62,10 +62,6 @@ public class AgentCommissionAnalysis { orgCharge = grossAmount.multiply(org.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("wechat_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP))); break; - case "jd": - orgCharge = grossAmount.multiply(org.getBigDecimal("jd_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); - orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("jd_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP))); - break; case "alipayonline": orgCharge = grossAmount.multiply(org.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP)); orgNetCharge = orgCharge.subtract(grossAmount.multiply(parentOrg.getBigDecimal("alipayonline_rate_value").divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP))); @@ -143,4 +139,4 @@ public class AgentCommissionAnalysis { } return list; } -} \ No newline at end of file +} diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java index ff589afc3..4660e1331 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerCommissionAnalysis.java @@ -222,9 +222,6 @@ public class CityPartnerCommissionAnalysis { case "wechat": thirdPartyPaymentCharge = total.multiply(wechatChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); break; - case "jd": - thirdPartyPaymentCharge = total.multiply(jdChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); - break; case "alipayonline": thirdPartyPaymentCharge = total.multiply(alipayonlineChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); break; diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerSeniorCommissionAnalysis.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerSeniorCommissionAnalysis.java index fbf574f9d..113a74bd7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerSeniorCommissionAnalysis.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/beans/CityPartnerSeniorCommissionAnalysis.java @@ -226,9 +226,6 @@ public class CityPartnerSeniorCommissionAnalysis { case "wechat": thirdPartyPaymentCharge = total.multiply(wechatChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); break; - case "jd": - thirdPartyPaymentCharge = total.multiply(jdChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); - break; case "alipayonline": thirdPartyPaymentCharge = total.multiply(alipayonlineChargeRate).divide(CommonConsts.HUNDRED, 2, RoundingMode.HALF_UP); break; diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java index 349aa4013..9a0c1f9f2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java @@ -1,88 +1,39 @@ package au.com.royalpay.payment.manage.citypartner.core.impls; -import java.io.IOException; -import java.io.OutputStream; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import javax.swing.plaf.basic.BasicScrollPaneUI; - -import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper; -import au.com.royalpay.payment.tools.CommonConsts; -import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.time.DateFormatUtils; -import org.apache.commons.lang3.time.DateUtils; -import org.apache.poi.hssf.usermodel.HSSFCellStyle; -import org.apache.poi.hssf.usermodel.HSSFFont; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.hssf.util.HSSFColor; -import org.apache.poi.ss.usermodel.*; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.alibaba.fastjson.JSONObject; - import au.com.royalpay.payment.manage.citypartner.beans.AgentCommissionAnalysis; import au.com.royalpay.payment.manage.citypartner.beans.CityPartnerCommissionAnalysis; import au.com.royalpay.payment.manage.citypartner.beans.ReferrerCommissionAnalysis; import au.com.royalpay.payment.manage.citypartner.core.CityPartnerPrizeService; -import au.com.royalpay.payment.manage.mappers.financial.FinancialAgentCommissionDetailMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialAgentCommissionMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialPartnerCommissionDetailMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialPartnerCommissionMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialReferrerCommissionDetailMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialReferrerCommissionMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialSeniorPartnerCommissionDetailMapper; -import au.com.royalpay.payment.manage.mappers.financial.FinancialSeniorPartnerCommissionMapper; +import au.com.royalpay.payment.manage.mappers.financial.*; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.system.OrgMapper; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException; - +import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import com.alibaba.fastjson.JSONObject; - import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFFont; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.*; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.OutputStream; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; /** * Created by yixian on 2017-03-08. @@ -333,8 +284,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { HashMap channelMap = new HashMap<>(); channelMap.put("Alipay", "Alipay"); channelMap.put("Wechat", "Wechat"); - channelMap.put("Bestpay", "Bestpay"); - channelMap.put("jd", "jd"); channelMap.put("AlipayOnline", "AlipayOnline"); Set orgIds = new HashSet<>(); List transactionAnalysis = transactionMapper.listTransactionsForCityPartnerCommission(year, month); @@ -476,22 +425,22 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { BigDecimal total_surage = BigDecimal.ZERO; BigDecimal net_surage = BigDecimal.ZERO; BigDecimal royalpay_surage = BigDecimal.ZERO; + BigDecimal transaction_fee = BigDecimal.ZERO; JSONObject json = new JSONObject(); String channel = oneChannel.getKey(); - if ("hf".equals(oneChannel.getKey().toLowerCase()) || "yeepay".equals(oneChannel.getKey().toLowerCase()) || "lakalapay".equals(oneChannel.getKey().toLowerCase())) { - channel = "cb_bankpay"; - if (orgInfo.get("cb_bankpay_rate_value") == null) { - throw new ServerErrorException(orgInfo.getString("name") + "组织下" + "cbbankpay" + "成本手续费未设置"); - } - } else { - if (orgInfo.get(channel.toLowerCase() + "_rate_value") == null) { - throw new ServerErrorException(orgInfo.getString("name") + "组织下" + oneChannel.getKey() + "成本手续费未设置"); - } + if (orgInfo.get(channel.toLowerCase() + "_rate_value") == null) { + throw new ServerErrorException(orgInfo.getString("name") + "组织下" + oneChannel.getKey() + "成本手续费未设置"); } for (JSONObject params : oneChannel.getValue()) { BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount"); BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); - BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); + //增加transaction_fee为null异常 + if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { + params.put("transaction_fee", BigDecimal.ZERO); + } + BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge") + .subtract(params.getBigDecimal("surcharge_cashback")) + .subtract(params.getBigDecimal("transaction_fee")); //增加货币判断 int i = currencyScale(params.getString("clearing_currency")); total = total.add(tmpClearingAmount); @@ -499,11 +448,13 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { royalpay_surage = royalpay_surage.add(tmpClearingAmount.multiply(channelRate).setScale(i, RoundingMode.HALF_UP)); // net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge)); net_surage = net_surage.add(params.getBigDecimal("channel_surcharge")); + transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee")); } BigDecimal org_charge = total_surage.subtract(royalpay_surage); json.put("channel", oneChannel.getKey()); json.put("gross_amount", total); json.put("total_charge", total_surage); + json.put("transaction_fee", transaction_fee); json.put("net_charge", net_surage); json.put("org_rate", orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value")); json.put("royalpay_charge", royalpay_surage); @@ -525,16 +476,19 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { BigDecimal net_surage = BigDecimal.ZERO; BigDecimal royalpay_surage = BigDecimal.ZERO; BigDecimal share_surage = BigDecimal.ZERO; + BigDecimal transaction_fee = BigDecimal.ZERO; JSONObject json = new JSONObject(); String channel = oneChannel.getKey(); - - if ("hf".equals(oneChannel.getKey().toLowerCase()) || "yeepay".equals(oneChannel.getKey().toLowerCase()) || "lakalapay".equals(oneChannel.getKey().toLowerCase())) { - channel = "cb_bankpay"; - } for (JSONObject params : oneChannel.getValue()) { BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount"); BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); - BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); + //增加transaction_fee为null异常 + if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { + params.put("transaction_fee", BigDecimal.ZERO); + } + BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge") + .subtract(params.getBigDecimal("surcharge_cashback")) + .subtract(params.getBigDecimal("transaction_fee")); //增加货币判断 int i = currencyScale(params.getString("clearing_currency")); BigDecimal parent_surage = tmpClearingAmount.multiply(parentOrgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP); @@ -545,6 +499,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { //net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge)); net_surage = net_surage.add(params.getBigDecimal("channel_surcharge")); share_surage = share_surage.add(roy_surage.subtract(parent_surage)).setScale(i, RoundingMode.HALF_UP); + transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee")); } BigDecimal org_charge = total_surage.subtract(royalpay_surage); @@ -556,6 +511,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { json.put("partner_charge", royalpay_surage); json.put("share_charge", share_surage); json.put("org_charge", org_charge); + json.put("transaction_fee", transaction_fee); json.put("commission_type", "1"); json.put("create_time", new Date()); amountByChannel.add(json); @@ -579,15 +535,12 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { BigDecimal total_surage = BigDecimal.ZERO; BigDecimal net_surage = BigDecimal.ZERO; BigDecimal royalpay_surage = BigDecimal.ZERO; + BigDecimal transaction_fee = BigDecimal.ZERO; Date datefrom = new Date(); Date dateto = new Date(); JSONObject json = new JSONObject(); String channel = oneChannel.getKey(); String rateChannel = oneChannel.getKey(); - if ("hf".equals(oneChannel.getKey().toLowerCase()) || "yeepay".equals(oneChannel.getKey().toLowerCase()) || "lakalapay".equals(oneChannel.getKey().toLowerCase())) { - channel = "cb_bankpay"; - rateChannel = "CB_BankPay"; - } JSONObject clientRate = null; try { clientRate = merchantInfoProvider.clientCurrentRate(clientId, oneChannel.getValue().get(0).getDate("transaction_time"), @@ -599,6 +552,10 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); //增加货币判断 + //增加transaction_fee为null异常 + if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { + params.put("transaction_fee", BigDecimal.ZERO); + } int i = currencyScale(params.getString("clearing_currency")); if (total.compareTo(BigDecimal.ZERO) == 0) { datefrom = params.getDate("transaction_time"); @@ -617,6 +574,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { royalpay_surage = royalpay_surage.add(tmpClearingAmount.multiply(channelRate).setScale(i, RoundingMode.HALF_UP)); //net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge)); net_surage = net_surage.add(params.getBigDecimal("channel_surcharge")); + transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee")); } BigDecimal org_charge = total_surage.subtract(royalpay_surage); if (channel.toLowerCase().equals("alipay_direct")) { @@ -628,7 +586,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { json.put("client_id", clientId); if (clientRate != null) { json.put("client_rate", clientRate.getBigDecimal("rate_value")); - }else { + } else { json.put("client_rate", oneChannel.getValue().get(0).getBigDecimal("surcharge_rate").multiply(CommonConsts.HUNDRED)); } json.put("gross_amount", total); @@ -642,6 +600,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { json.put("org_net_charge", net_surage); } json.put("org_charge", org_charge); + json.put("transaction_fee", transaction_fee); json.put("commission_type", "1"); json.put("create_time", new Date()); json.put("date_from", DateFormatUtils.format(datefrom, "yyyy-MM-dd")); @@ -676,9 +635,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { case "Wechat": thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("wechatChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP); break; - case "jd": - thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("jdChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP); - break; case "AlipayOnline": thirdPartyPaymentCharge = total.multiply(chargeRate.getBigDecimal("alipayonlineChargeRate").divide(CommonConsts.HUNDRED, 4, BigDecimal.ROUND_DOWN)).setScale(2, RoundingMode.HALF_UP); break; @@ -747,8 +703,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { HashMap channelMap = new HashMap<>(); channelMap.put("Alipay", "Alipay"); channelMap.put("Wechat", "Wechat"); - channelMap.put("Bestpay", "Bestpay"); - channelMap.put("jd", "jd"); channelMap.put("AlipayOnline", "AlipayOnline"); List transactionAnalysis = transactionMapper.listTransactionsForAgentCommission(year, month, org.getIntValue("parent_org_id")); Map results = new HashMap<>(); @@ -825,6 +779,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { temp.put("total_charge", 0); temp.put("royalpay_charge", 0); temp.put("org_charge", 0); + temp.put("transaction_fee", 0); temp.put("share_charge", 0); temp.put("channel", channel.getString("channel")); temp.put("net_charge", 0); @@ -839,28 +794,8 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { mineCommission.put("share_charge", mineCommission.getBigDecimal("share_charge").subtract(channel.getBigDecimal("share_charge"))); financialPartnerCommissionMapper.update(mineCommission); } - channel.put("month", month); - channel.put("year", year); - channel.put("org_id", orgId); - //撤销agent表 -// financialAgentCommissionMapper.save(channel); } } - //撤销agent表 -// Map> groupByClientMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("client_id"))); -// for (Map.Entry> oneClient : groupByClientMap.entrySet()) { -// -// JSONObject org = orgMapper.findOne(oneClient.getValue().get(0).getInteger("org_id")); -// Map> groupByChannel = oneClient.getValue().stream().collect(Collectors.groupingBy(e -> e.getString("channel"))); -// -// List clientChannelAmount = clientChannelAmount(oneClient.getKey(),org, groupByChannel, channelCharge,year,month,2); -// for (JSONObject channel : clientChannelAmount) { -// financialAgentCommissionDetailMapper.save(channel); -// } -// -// } - - } @Override @@ -1288,7 +1223,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("net_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("net_charge").toPlainString()); if (log.getBigDecimal("org_charge").compareTo(BigDecimal.ZERO) == 1) { row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("org_charge").toPlainString()); - }else { + } else { row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(BigDecimal.ZERO.toPlainString()); } row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("share_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("share_charge").toPlainString()); diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/HfClearAmountService.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/HfClearAmountService.java deleted file mode 100644 index 9b6721aca..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/HfClearAmountService.java +++ /dev/null @@ -1,9 +0,0 @@ -package au.com.royalpay.payment.manage.dev.core; - -import com.alibaba.fastjson.JSONObject; - -public interface HfClearAmountService { - - JSONObject hfjsonobject(String dateto,String datefrom); - -} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/HfUpdateService.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/HfUpdateService.java deleted file mode 100644 index fb7611487..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/HfUpdateService.java +++ /dev/null @@ -1,11 +0,0 @@ -package au.com.royalpay.payment.manage.dev.core; - -import com.alibaba.fastjson.JSONObject; - -public interface HfUpdateService { - - String updateStatus(); - - String rpayUpdate(); - -} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java index e44bfe975..709a61302 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/AliforexcelServiceImpl.java @@ -14,8 +14,8 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.SysWxMerchantApplyMapper; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import com.alibaba.fastjson.JSONObject; -import com.yeepay.shade.org.apache.commons.lang3.StringUtils; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfClearAmountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfClearAmountServiceImpl.java deleted file mode 100644 index 62b05768d..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfClearAmountServiceImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -package au.com.royalpay.payment.manage.dev.core.impl; - -import au.com.royalpay.payment.manage.dev.core.HfClearAmountService; -import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; -import au.com.royalpay.payment.tools.env.PlatformEnvironment; -import au.com.royalpay.payment.tools.exceptions.ServerErrorException; -import com.alibaba.fastjson.JSONObject; -import org.apache.commons.lang3.time.DateUtils; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.text.ParseException; -import java.util.List; - -@Service -public class HfClearAmountServiceImpl implements HfClearAmountService { - @Resource - private TransactionMapper transactionMapper; - - @Override - public JSONObject hfjsonobject(String dateto, String datefrom) { - JSONObject params = new JSONObject(); - try { - params.put("datefrom", DateUtils.addMinutes(DateUtils.parseDate(datefrom, "yyyy-MM-dd"), PlatformEnvironment.getEnv().getTimeZoneOffsetMinutes())); - params.put("dateto", DateUtils.addMinutes(DateUtils.parseDate(dateto, "yyyy-MM-dd"), PlatformEnvironment.getEnv().getTimeZoneOffsetMinutes())); - } catch (ParseException e) { - throw new ServerErrorException("时间转换异常"); - } - List hfClearAmountResult = transactionMapper.getHfClearAmount(params); - JSONObject result = new JSONObject(); - result.put("payment_amount", BigDecimal.ZERO); - result.put("refund_amount", BigDecimal.ZERO); - result.put("gross_amount", BigDecimal.ZERO); - result.put("charge_amount", BigDecimal.ZERO); - result.put("clear_amount", BigDecimal.ZERO); - result.put("payment_surcharge", BigDecimal.ZERO); - result.put("refund_surcharge", BigDecimal.ZERO); - if (hfClearAmountResult.isEmpty()) { - return result; - } - hfClearAmountResult.forEach(dbResult -> { - if ("Credit".equals(dbResult.getString("transaction_type"))) { - result.put("payment_amount", dbResult.getBigDecimal("clear_amount")); - result.put("payment_surcharge", dbResult.getBigDecimal("charge_amount")); - } - if ("Debit".equals(dbResult.getString("transaction_type"))) { - result.put("refund_amount", dbResult.getBigDecimal("clear_amount")); - result.put("refund_surcharge", dbResult.getBigDecimal("charge_amount")); - } - }); - result.put("gross_amount", result.getBigDecimal("payment_amount").subtract(result.getBigDecimal("refund_amount"))); - result.put("charge_amount", result.getBigDecimal("payment_surcharge").subtract(result.getBigDecimal("refund_surcharge"))); - result.put("clear_amount", result.getBigDecimal("gross_amount").subtract(result.getBigDecimal("charge_amount"))); - return result; - } -} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfUpdateImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfUpdateImpl.java deleted file mode 100644 index 89f113f31..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfUpdateImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -package au.com.royalpay.payment.manage.dev.core.impl; - -import au.com.royalpay.payment.channels.rpay.runtime.RpayApi; -import au.com.royalpay.payment.manage.dev.core.HfUpdateService; -import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper; -import au.com.royalpay.payment.manage.mappers.system.ClientMapper; -import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; -import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; -import au.com.royalpay.payment.tools.env.PlatformEnvironment; - -import com.alibaba.fastjson.JSONObject; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import java.util.List; - -import javax.annotation.Resource; - -@Service -public class HfUpdateImpl implements HfUpdateService { - @Resource - private ClientMapper clientMapper; - @Resource - private MpWechatApiProvider mpWechatApiProvider; - @Resource - private ClientConfigMapper clientConfigMapper; - @Resource - private RpayApi rpayApi; - - private Logger logger = LoggerFactory.getLogger(getClass()); - - @Override - public String updateStatus() { - List clientIds = clientMapper.findByhfPayUrlNotNull(); - clientIds.forEach(dbResult -> { - String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + dbResult.getString("client_moniker") + "/jump/pc"); - MpWechatApi api = mpWechatApiProvider.getNewPaymentApi(); - String url = api.registerShortUrl(longUrl); - dbResult.put("hf_pay_url", url); - JSONObject config = new JSONObject(); - config.put("client_id",dbResult.getString("client_id")); - config.put("hf_pay_url", url); - clientConfigMapper.update(config); - clientMapper.update(dbResult); - - }); - return "ok"; - } - - @Override - public String rpayUpdate() { - List clientIds = clientMapper.findByrpayNotNull(); - StringBuffer sb = new StringBuffer(); - clientIds.forEach(dbResult -> { - try { -// rpayApi.modifySurchargeConfig(dbResult); - } catch (Exception e) { - sb.append("【" + dbResult.getString("client_moniker") + "】、"); - } - }); - logger.info("test for update rpay clearing date,fail + " + sb.toString()); - return "ok"; - } -} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestAPPController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestAPPController.java deleted file mode 100644 index 81af6af53..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestAPPController.java +++ /dev/null @@ -1,70 +0,0 @@ -package au.com.royalpay.payment.manage.dev.web; - - -import au.com.royalpay.payment.manage.analysis.core.DashboardService; - -import com.alibaba.fastjson.JSONObject; - -import org.joda.time.DateTime; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; - -@RestController -@RequestMapping(value = "/dev/pine") -public class TestAPPController { - @Resource - private DashboardService dashboardService; - - @GetMapping("/trade_log") - public List getTradeLogs(HttpServletResponse response) { - response.addHeader("Access-Control-Allow-Origin", "*"); - response.addHeader("Access-Control-Allow-Credentials", "true"); - response.addHeader("Access-Control-Allow-Headers", "Authorization,Origin, X-Requested-With, Content-Type, Accept"); - response.addHeader("Access-Control-Allow-Methods", "*"); - List logs = new ArrayList<>(); - for (int i = 0; i < 5; i++) { - JSONObject json = new JSONObject(); - json.put("channel", "Alipay"); - json.put("order_id", "PINE-r67783ej392u38ry982"); - json.put("status", "1"); - json.put("amount","9.99"); - logs.add(json); - } - for (int i = 0; i < 5; i++) { - JSONObject json = new JSONObject(); - json.put("channel", "Wechat"); - json.put("order_id", "PINE-r67783ej392u38ry982"); - json.put("status", "2"); - json.put("amount","9.99"); - logs.add(json); - } - for (int i = 0; i < 5; i++) { - JSONObject json = new JSONObject(); - json.put("channel", "Bestpay"); - json.put("order_id", "PINE-r67783ej392u38ry982"); - json.put("status", "3"); - json.put("amount","9.99"); - logs.add(json); - } - return logs; - } - - - @RequestMapping(value = "/customer",method = RequestMethod.GET) - public void generateCustomersAndOrdersStatistics(){ - DateTime dt17 = new DateTime(2018,5,17,11,11); - DateTime dt18 = new DateTime(2018,5,18,11,11); - DateTime dt19 = new DateTime(2018,5,19,11,11); - dashboardService.generateCustomersAndOrdersStatistics(dt17.toDate()); - dashboardService.generateCustomersAndOrdersStatistics(dt18.toDate()); - dashboardService.generateCustomersAndOrdersStatistics(dt19.toDate()); - } -} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java index 973d2b870..e8f61f5c1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java @@ -2,11 +2,8 @@ package au.com.royalpay.payment.manage.dev.web; import au.com.royalpay.payment.channels.alipay.config.AlipayEnvironment; import au.com.royalpay.payment.channels.alipay.runtime.AlipayClient; -import au.com.royalpay.payment.channels.bestpay.runtime.BestPayClient; -import au.com.royalpay.payment.channels.jd.runtime.JDClient; import au.com.royalpay.payment.channels.rpay.runtime.RpayClient; import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient; -import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient; import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.exceptions.OrderNotExistsException; @@ -19,8 +16,6 @@ import au.com.royalpay.payment.manage.dev.bean.AliExcel; import au.com.royalpay.payment.manage.dev.bean.Message; import au.com.royalpay.payment.manage.dev.bean.SendWechatMessage; import au.com.royalpay.payment.manage.dev.core.AliforexcelService; -import au.com.royalpay.payment.manage.dev.core.HfClearAmountService; -import au.com.royalpay.payment.manage.dev.core.HfUpdateService; import au.com.royalpay.payment.manage.dev.core.WechatMessageService; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.payment.RefundMapper; @@ -37,7 +32,6 @@ import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; import au.com.royalpay.payment.tools.defines.TradeType; import au.com.royalpay.payment.tools.env.PlatformEnvironment; -import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.http.HttpUtils; @@ -112,14 +106,8 @@ public class TestController { @Resource private AlipayClient alipayClient; @Resource - private BestPayClient bestPayClient; - @Resource - private JDClient jdClient; - @Resource private RpayClient rpayClient; @Resource - private YeePayClient yeepayClient; - @Resource private TradeLogService tradeLogService; @Resource private RetailAppService retailAppService; @@ -128,14 +116,8 @@ public class TestController { @Resource private AliforexcelService aliforexcelService; @Resource - private HfClearAmountService hfClearAmountService; - @Resource - private HfUpdateService hfUpdateService; - @Resource private ClientManager clientManager; @Resource - private SysConfigManager sysConfigManager; - @Resource private MpWechatApiProvider mpWechatApiProvider; @Resource private SysClientLegalPersonMapper sysClientLegalPersonMapper; @@ -234,17 +216,6 @@ public class TestController { if (alipayRate != null) { client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); } - - JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay"); - if (bestPayRate != null) { - client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - - JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd"); - if (jdRate != null) { - client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline"); if (alipayOnlineRate != null) { client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); @@ -334,16 +305,6 @@ public class TestController { xmlStr = XmlFormatUtils.formatXml(elem); res.put("xml", xmlStr); break; - case "Bestpay": - JSONObject status = bestPayClient.queryOrderStatus(order.getString("order_id"), order.getDate("create_time")); - String json = JSON.toJSONString(status, SerializerFeature.PrettyFormat); - res.put("xml", json); - break; - case "jd": - elem = jdClient.queryTransaction(orderId, orderId, JDClient.TRADE_TYPE_PAY); - xmlStr = XmlFormatUtils.formatXml(elem); - res.put("xml", xmlStr); - break; case "AlipayOnline": elem = alipayClient.checkOnlineOrderStatusByOrderId(orderId, AlipayEnvironment.getEnv().getAlipayOnlineMerchant().getPid()); xmlStr = XmlFormatUtils.formatXml(elem); @@ -354,9 +315,6 @@ public class TestController { String rpayjson = JSON.toJSONString(orderInfo, SerializerFeature.PrettyFormat); res.put("xml", rpayjson); break; - case "Yeepay": - res.put("xml", yeepayClient.queryOrderStd(orderId).toString()); - break; default: throw new BadRequestException("Not Support channel:" + channel); } @@ -386,24 +344,11 @@ public class TestController { String xmlStr = XmlFormatUtils.formatXml(elem); res.put("xml", xmlStr); break; - case "Bestpay": - JSONObject status = bestPayClient.queryRefundStatus(order.getString("order_id"), refundId, refundOrder.getDate("create_time")); - String json = JSON.toJSONString(status, SerializerFeature.PrettyFormat); - res.put("xml", json); - break; - case "jd": - elem = jdClient.queryTransaction(refundId, order.getString("order_id"), JDClient.TRADE_TYPE_REFUND); - xmlStr = XmlFormatUtils.formatXml(elem); - res.put("xml", xmlStr); - break; case "AlipayOnline": elem = alipayClient.onlineRefund(refundOrder, AlipayEnvironment.getEnv().getAlipayOnlineMerchant().getPid(), type == TradeType.GATEWAY_H5); xmlStr = XmlFormatUtils.formatXml(elem); res.put("xml", xmlStr); break; - case "Yeepay": - res.put("xml", yeepayClient.queryRefundStd(refundOrder.getString("out_refund_id")).toString()); - break; default: throw new BadRequestException("Not Support channel:" + channel); } @@ -444,33 +389,11 @@ public class TestController { wechatMessageService.sendMessageByOpenId(sendWechatMessage); } -/* @ManagerMapping(value = "/orgusertest", method = RequestMethod.POST, role = {ManagerRole.ADMIN,ManagerRole.DEVELOPER}) - public JSONObject orgusertest(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody @Valid ClientTestRegisterInfo registery, - Errors errors) { - HttpUtils.handleValidErrors(errors); - return newpartnerService.registerClient(null, registery, manager); - }*/ @ManagerMapping(value = "/aliforexcel", method = RequestMethod.GET, role = ManagerRole.DEVELOPER) public void aliforexcel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse, AliExcel query) throws Exception { aliforexcelService.listClients(httpResponse, manager, query); } - - @ManagerMapping(value = "/hfClearAmount", method = RequestMethod.GET, role = ManagerRole.DEVELOPER) - public JSONObject hfUpdate(@RequestParam String datefrom, @RequestParam String dateto) { - return hfClearAmountService.hfjsonobject(dateto, datefrom); - } - - @ManagerMapping(value = "/hfUpdate", method = RequestMethod.GET, role = ManagerRole.DEVELOPER) - public String hfClearAmount() { - return hfUpdateService.updateStatus(); - } - - @ManagerMapping(value = "/rpayUpdate", method = RequestMethod.PUT, role = ManagerRole.DEVELOPER) - public String rpayUpdateClearing() { - return hfUpdateService.rpayUpdate(); - } - @ManagerMapping(value = "/partner/reset_password", method = RequestMethod.GET, role = ManagerRole.DEVELOPER) public void resetPartnerPassword() { clientManager.updateAllPartnerPassword("PINE"); diff --git a/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientRegisterInfo.java b/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientRegisterInfo.java index 12c48ee1c..6919c7ecc 100644 --- a/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientRegisterInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientRegisterInfo.java @@ -128,8 +128,6 @@ public class ClientRegisterInfo { rate.put("wechat_rate_value", settleConfig.getWechatRate()); rate.put("alipay_rate_value", settleConfig.getAlipayRate()); rate.put("alipayonline_rate_value", settleConfig.getAlipayOnlineRate()); - rate.put("bestpay_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"Bestpay")); - rate.put("jd_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"JDpay")); rate.put("Rpay_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"Rpay")); rate.put("cb_bankpay_rate_value", getDefaultRate(defaultRateConfig, String.valueOf(settleConfig.getCleanDays()),"CB_Bankpay")); rate.put("transaction_fee", settleConfig.getTransactionFee()); diff --git a/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientSettleConfig.java b/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientSettleConfig.java index 74663013d..33f96db30 100644 --- a/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientSettleConfig.java +++ b/src/main/java/au/com/royalpay/payment/manage/gateway/beans/ClientSettleConfig.java @@ -42,7 +42,7 @@ public class ClientSettleConfig { @JSONField(name = "alipay_online_rate") private String alipayOnlineRate; @JSONField(name = "transaction_fee") - private String transactionFee; + private String transactionFee ="0.00"; @JSONField(name = "active_time") private String activeTime; @JSONField(name = "expire_time") 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 073af0d8f..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,11 +46,11 @@ 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); - List getAba(Date dt, String bank, List logs) throws IOException; + List getAba(Date dt, List logs) throws IOException; void settlementAba(Date date, HttpServletResponse response) throws IOException; @@ -105,4 +105,6 @@ public interface CleanService { void undoSettle(Date date, int clearingId); ByteArrayResource downloadBatchSettleReportXlsx(int batchId); + + JSONObject findSettleLog(int clearingId); } 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 df8299a7b..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 @@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.management.clearing.core.impl; import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.tasksupport.SettlementSupport; +import au.com.royalpay.payment.core.utils.ExtParamsUtils; import au.com.royalpay.payment.manage.management.clearing.core.CleanService; import au.com.royalpay.payment.manage.mappers.log.*; import au.com.royalpay.payment.manage.mappers.payment.TaskManualSettleMapper; @@ -32,6 +33,7 @@ import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.locale.LocaleSupport; import au.com.royalpay.payment.tools.lock.Locker; +import au.com.royalpay.payment.tools.merchants.beans.BalanceGroup; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.tasksupport.TaskFinishNotifyEvent; import au.com.royalpay.payment.tools.utils.DateVaildUtil; @@ -321,7 +323,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider JSONObject client = clientManager.getClientInfo(clientId); Assert.notNull(client, "Client ID invalid"); checkOrgPermission(manager, client); - List transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate,clientId, + List transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate, clientId, new PageBounds(Order.formString("order_id.asc"))); clearClient.put("report", transactions); List channels = clearingDetailAnalysisMapper.listReportChannelsOfMergeSettle(reportDate, clientId); @@ -433,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); } } @@ -536,15 +527,16 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } @Override - public List getAba(Date dt, String bank, List logs) { + public List getAba(Date dt, List logs) { List files = new ArrayList<>(); for (JSONObject log : logs) { List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); details = mergeBatchSettleClients(details); String remark = extractSettleRemark(log); - files.addAll(generateSettleAbaFiles(dt, details, log.getDate("operate_time"), remark)); + BalanceGroup group = BalanceGroup.valueOf(log.getString("balance_group")); + files.addAll(generateSettleAbaFiles(dt, group, details, log.getDate("operate_time"), remark)); } - return files.stream().filter(file -> bank.equals(file.bank())).collect(Collectors.toList()); + return files; } public String extractSettleRemark(JSONObject log) { @@ -589,7 +581,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider for (JSONObject log : logs) { List details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); details = mergeBatchSettleClients(details); - files.addAll(generateSettleAbaFiles(dt, details, log.getDate("operate_time"), extractSettleRemark(log))); + BalanceGroup group = BalanceGroup.valueOf(log.getString("balance_group")); + files.addAll(generateSettleAbaFiles(dt, group, details, log.getDate("operate_time"), extractSettleRemark(log))); } OutputStream ous = resp.getOutputStream(); if (files.size() == 1) { @@ -633,7 +626,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider resp.addHeader("Content-Disposition", "attachment; filename=" + zipName); OutputStream ous = resp.getOutputStream(); - List abaFiles = generateSettleAbaFiles(settleDate, details, opTime, extractSettleRemark(clearing)); + BalanceGroup group = BalanceGroup.valueOf(clearing.getString("balance_group")); + List abaFiles = generateSettleAbaFiles(settleDate, group, details, opTime, extractSettleRemark(clearing)); try (ZipOutputStream zos = new ZipOutputStream(ous)) { for (ABAFile aba : abaFiles) { zos.putNextEntry(new ZipEntry(aba.filename())); @@ -644,16 +638,16 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } } - private List generateSettleAbaFiles(Date dt, List settlements, Date operateTime, String remark) { + private List generateSettleAbaFiles(Date dt, BalanceGroup group, List settlements, Date operateTime, String remark) { List banks = settlements.stream().map(detail -> detail.getString("settle_bank")).distinct().collect(Collectors.toList()); - return banks.stream().map(bank -> generateSettleAbaFile(bank, dt, settlements)) + return banks.stream().map(bank -> generateSettleAbaFile(bank, group, dt, settlements)) .peek(file -> file.setOperateTime(operateTime)) .peek(file -> file.setRemark(remark)) .collect(Collectors.toList()); } - private ABAFile generateSettleAbaFile(String bank, Date dt, List settlements) { - ABAFile aba = ABATemplate.getConfig().initFile(bank, dt); + private ABAFile generateSettleAbaFile(String bank, BalanceGroup group, Date dt, List settlements) { + ABAFile aba = ABATemplate.getConfig().initFile(group, bank, dt); for (JSONObject settle : settlements) { if (!bank.equals(settle.getString("settle_bank"))) { continue; @@ -890,7 +884,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider if (clearClient == null) { throw new NotFoundException(); } - List transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate,client_id, + List transactions = transactionMapper.listTransactionsOfMergeSettleClearingOrder(reportDate, client_id, new PageBounds(Order.formString("order_id.asc"))); String timezone_client = client.getString("timezone"); @@ -1026,10 +1020,10 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } @Override - public void exportListClearingTransactions(int client_id, String clearingDetailId, JSONObject partner, HttpServletResponse resp) { + public void exportListClearingTransactions(int clientId, String clearingDetailId, JSONObject partner, HttpServletResponse resp) { OutputStream ous = null; try { - JSONObject clearTransation = listClearingTransactions(client_id, clearingDetailId, partner); + JSONObject clearTransation = listClearingTransactions(clientId, clearingDetailId, partner); resp.setContentType("application/octet-stream;"); Date reportDate = clearTransation.getDate("report_date"); resp.addHeader("Content-Disposition", @@ -1114,7 +1108,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString() : "-" + settle.getBigDecimal("settle_amount").setScale(2, BigDecimal.ROUND_DOWN).toPlainString()); cell.setCellStyle(!"Credit".equals(settle.getString("transaction_type")) ? analysisStyle2 : null); - row.createCell(15, Cell.CELL_TYPE_STRING).setCellValue(settle.containsKey("order_detail")?settle.getString("order_detail"):settle.getString("remark")); + row.createCell(15, Cell.CELL_TYPE_STRING).setCellValue(settle.containsKey("order_detail") ? settle.getString("order_detail") : settle.getString("remark")); String clientDevId = StringUtils.defaultString(settle.getString("dev_id"), "-"); JSONObject device = clientDeviceMapper.find(settle.getString("dev_id")); String clientDevRemark = "-"; @@ -1174,7 +1168,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider Sheet sheet = wb.createSheet("Merchant_Settlement_Info_" + reportDate); int rowNum = 0; Row row = sheet.createRow(rowNum); - String[] title = {"Client Moniker","Short Name","order Id", "Client Order Id", "Transaction Time", "Channel", "Gateway", "Exchange Rate", "Transaction Type", "Currency", + String[] title = {"Client Moniker", "Short Name", "order Id", "Client Order Id", "Transaction Time", "Channel", "Gateway", "Exchange Rate", "Transaction Type", "Currency", "Input Amount", "Total Amount", "Clearing Amount(AUD)", "Sruchange Rate", "Surcharge(AUD)", "GST(AUD)", "Settle Amount(AUD)", "Remark", "Dev No", "Dev Remark"}; String[] analysis = {"Total Credit(AUD)", "Total Debit(AUD)", "Gross Amount(AUD)", "Total GST(AUD)", "Total Charge(AUD)", "Net Amount(AUD)"}; for (int i = 0; i < title.length; i++) { @@ -1368,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))); @@ -1380,7 +1374,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider attachList.add(attach1); JSONObject attach2 = new JSONObject(); - List abaFileList = getAba(date, "CBA", clearLogs); + List abaFileList = getAba(date, clearLogs); String fileName2 = "Merchant_Settlement_Info_aba_" + DateFormatUtils.format(date, "yyyyMMdd"); if (abaFileList.size() > 1) { fileName2 += ".zip"; @@ -1429,7 +1423,12 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider settleMailRecord.put("notice_status", 0); logSettleMailMapper.save(settleMailRecord); } - sendTaskFinishMessages(ManagerRole.FINANCIAL_STAFF, "清算文件已发送清算方", "发送清算通知"); + String detailDescription = clearLogs.stream() + .map(log -> String.format("[%s]%s", log.getString("clearing_id"), + ExtParamsUtils.getExtParamsValue(log.getString("plan_detail"), + detail -> StringUtils.defaultIfEmpty(detail.getString("remark"), detail.getString("plan_id"))))) + .collect(Collectors.joining(",")); + sendTaskFinishMessages(ManagerRole.FINANCIAL_STAFF, "清算文件已发送清算方:" + detailDescription, "发送清算通知"); if (autoMarkSent) { if (!clearIds.isEmpty()) { clearingLogMapper.lockSettlementsById(clearLogs.stream().map(log -> log.getString("clearing_id")).collect(Collectors.toList())); @@ -1523,7 +1522,8 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider throw new ForbiddenException("Settlement log has been sent and unable to edit"); } ABAConfig config = ABATemplate.getConfig(); - String defaultBank = config.getRemainsTo(); + BalanceGroup group = BalanceGroup.valueOf(log.getString("balance_group")); + String defaultBank = config.getRemainsTo(group); clearingDetailMapper.updateAllBanks(defaultBank, clearingId); List details = clearingDetailMapper.listReportsOfSettlement(clearingId); details = mergeBatchSettleClients(details); @@ -1547,6 +1547,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider if (base == null) { throw new BadRequestException("Invalid bank code:" + bank); } + if (base.acceptBalanceGroup(group)) { + throw new BadRequestException("Balance group not match:" + group + ":" + bank); + } BigDecimal bankAmount = bankDistribution.getBigDecimal(bank); for (JSONObject detail : details) { String detailBank = detail.getString("settle_bank"); @@ -1639,6 +1642,15 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider } } + @Override + public JSONObject findSettleLog(int clearingId) { + JSONObject clearing = clearingLogMapper.findById(clearingId); + if (clearing == null) { + throw new NotFoundException("Settle record not found:" + clearingId); + } + return clearing; + } + private void releaseDistributedSurcharge(JSONObject clearingDetail) { int clientId = clearingDetail.getIntValue("client_id"); BigDecimal distributedSurcharge = clearingDetail.getBigDecimal("distributed_surcharge"); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java index 99bfb4489..6286ac685 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/ArrivalNoticeController.java @@ -31,7 +31,7 @@ public class ArrivalNoticeController { @RequestParam("date") String date) throws ParseException { JSONArray reports = new JSONArray(); - Date dt = DateUtils.parseDate(date, new String[]{"yyyyMMdd"}); + Date dt = DateUtils.parseDate(date, "yyyyMMdd"); JSONObject reportItem = validationLogMapper.findByDate(dt); if (reportItem != null) { JSONObject result = JSON.parseObject(reportItem.getString("result")); @@ -50,11 +50,6 @@ public class ArrivalNoticeController { } channelItem.put("analysis", analysis); } - if (channel.equals("Bestpay") && result.containsKey("bestpay_valid_analysis")) { - List analysis = new ArrayList<>(); - analysis.add(result.getJSONObject("bestpay_valid_analysis")); - reports.getJSONObject(i).put("analysis", analysis); - } } } map.put("reports", reports); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java index b3212360b..288da4cf8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/web/SettlementDevController.java @@ -6,6 +6,7 @@ import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.support.abafile.ABATemplate; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.exceptions.BadRequestException; +import au.com.royalpay.payment.tools.merchants.beans.BalanceGroup; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import com.alibaba.fastjson.JSONObject; import org.springframework.core.io.ByteArrayResource; @@ -56,11 +57,13 @@ public class SettlementDevController { } } - @GetMapping("/available_banks") - public JSONObject getAvailableBanks() { - List banks = ABATemplate.getConfig().availableBanks(); + @GetMapping("/clearings/{clearingId}/available_banks") + public JSONObject getAvailableBanks(@PathVariable int clearingId) { + JSONObject clearing = cleanService.findSettleLog(clearingId); + BalanceGroup group = BalanceGroup.valueOf(clearing.getString("balance_group")); + List banks = ABATemplate.getConfig().availableBanks(group); JSONObject res = new JSONObject(); - res.put("remains_to", ABATemplate.getConfig().getRemainsTo()); + res.put("remains_to", ABATemplate.getConfig().getRemainsTo(group)); res.put("banks", banks); return res; } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAccountMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAccountMapper.java index 854e38c19..fc868bd32 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAccountMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAccountMapper.java @@ -28,7 +28,7 @@ public interface ClientAccountMapper { @AutoSql(SqlType.SELECT) @AdvanceSelect(addonWhereClause = "is_valid=1") - List findByPhone(@Param("contact_phone") String contact_phone,@Param("nation_code")String nation_code); + List findByPhone(@Param("contact_phone") String contact_phone, @Param("nation_code") String nation_code); @AutoSql(SqlType.SELECT) JSONObject findDetail(@Param("account_id") String accountId); @@ -51,6 +51,10 @@ public interface ClientAccountMapper { @AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"}) JSONObject findByAppOpenId(@Param("wxapp_openid") String openId); + @AutoSql(SqlType.SELECT) + @AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"}) + JSONObject findByAppleUserId(@Param("apple_userid") String appleUserId); + @AutoSql(SqlType.SELECT) @AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"}) JSONObject findByWxUnioinId(@Param("wx_unionid") String wx_unionid); @@ -85,22 +89,23 @@ public interface ClientAccountMapper { /** * 获取绑定微信的最新账号 + * * @param unionId * @return */ - JSONObject findOneByUnionIdAndCreateTimeDesc(@Param("wx_unionid")String unionId); + JSONObject findOneByUnionIdAndCreateTimeDesc(@Param("wx_unionid") String unionId); - JSONObject findOneByPhoneAndCreateTimeDesc(@Param("contact_phone")String contactPhone,@Param("nation_code")String nationCode); + JSONObject findOneByPhoneAndCreateTimeDesc(@Param("contact_phone") String contactPhone, @Param("nation_code") String nationCode); @AutoSql(SqlType.SELECT) @AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"}) - List findByWechatOpenId(@Param("wechat_openid")String openid); + List findByWechatOpenId(@Param("wechat_openid") String openid); @AutoSql(SqlType.SELECT) @AdvanceSelect(addonWhereClause = "is_valid=1", excludeColumns = {"salt", "password_hash"}) - List findByWechatUnionId(@Param("wx_unionid")String unionId); + List findByWechatUnionId(@Param("wx_unionid") String unionId); @AutoSql(SqlType.SELECT) - JSONObject findRSvcClientInfo(@Param("account_id")String accountId); + JSONObject findRSvcClientInfo(@Param("account_id") String accountId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAuditProcessMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAuditProcessMapper.java index 9ebfae667..c277cfa4b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAuditProcessMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientAuditProcessMapper.java @@ -20,5 +20,5 @@ public interface ClientAuditProcessMapper { int update(JSONObject partner); @AutoSql(SqlType.SELECT) - PageList getAuditLog(@Param("client_id") int client_id, PageBounds pagination); + PageList getAuditLog(@Param("client_id") int client_id, @Param("type") int type, PageBounds pagination); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java index 1d036096e..d7169064e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientFilesMapper.java @@ -52,6 +52,8 @@ public interface ClientFilesMapper { JSONObject getSourceAgreeFilesByClientId(@Param("client_id") int clientId); + JSONObject getSourceCardAgreeFilesByClientId(@Param("client_id") int clientId,@Param("file_name")String file_name); + void deleteByClientAndFileId(@Param("file_id") String file_id); void deleteAggreeByClientId(@Param("client_id") int file_id); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMWFilesMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMWFilesMapper.java index 88efbe614..24d7e73d7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMWFilesMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMWFilesMapper.java @@ -1,6 +1,7 @@ package au.com.royalpay.payment.manage.mappers.system; import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.yixsoft.support.mybatis.autosql.annotations.AdvanceSelect; import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; @@ -22,5 +23,10 @@ public interface ClientMWFilesMapper { @AutoSql(SqlType.SELECT) @AdvanceSelect(addonWhereClause = "is_valid = 1") - List findClientFile(@Param("client_id") int clientId); + List findClientFile(@Param("client_id") int clientId, PageBounds pageBounds); + + @AutoSql(SqlType.SELECT) + JSONObject findFileById(@Param("file_id") String file_id); + + void deleteByClientAndFileId(@Param("file_id") String file_id); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java index e6ed55306..3f640b5c1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java @@ -44,6 +44,8 @@ public interface ClientMapper { @AutoSql(SqlType.SELECT) JSONObject findClientIgnoreInvalid(int clientId); + JSONObject findClientAprrovingStatus(@Param("client_id") int clientId); + @AutoSql(SqlType.SELECT) @AdvanceSelect(addonWhereClause = "is_valid=1") JSONObject findClientByMoniker(@Param("client_moniker") String clientMoniker); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java index 98ecbd655..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,21 +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 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/mappers/system/SysClientUpayProfileMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysClientUpayProfileMapper.java new file mode 100644 index 000000000..2e9842a40 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/SysClientUpayProfileMapper.java @@ -0,0 +1,19 @@ +package au.com.royalpay.payment.manage.mappers.system; + +import com.alibaba.fastjson.JSONObject; +import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper; +import com.yixsoft.support.mybatis.autosql.annotations.AutoSql; +import com.yixsoft.support.mybatis.autosql.annotations.SqlType; +import org.apache.ibatis.annotations.Param; + +@AutoMapper(tablename = "sys_client_upay_profile", pkName = "client_id") +public interface SysClientUpayProfileMapper { + @AutoSql(SqlType.INSERT) + void save(JSONObject info); + + @AutoSql(SqlType.UPDATE) + void update(JSONObject info); + + @AutoSql(SqlType.SELECT) + JSONObject findInfo(@Param("client_id") int clientId); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientMWAuthFilesInfo.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientMWAuthFilesInfo.java index 51d263c92..fde67b19e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientMWAuthFilesInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientMWAuthFilesInfo.java @@ -7,13 +7,20 @@ import org.apache.commons.lang3.StringUtils; * Created by yishuqian on 07/03/2017. */ public class ClientMWAuthFilesInfo { - private String upay_application_form; - private String upay_agreement_file; + private String client_bank_file; + private String client_company_file; + private String refund_exchange_policy; + private String upay_privacy_policy; + private String card_security_policy; + private String upay_promotional_offer; + private String upay_terms_conditions; private String upay_offer_letter; private String upay_driver_license; - private String upay_residence_certificate; + private String kyc_utility_bill_file; private String upay_risk_level; private String upay_risk_remark; + private String upay_application_form; + private String upay_desc_file; public JSONObject toJson(){ return (JSONObject)JSONObject.toJSON(this); @@ -30,14 +37,6 @@ public class ClientMWAuthFilesInfo { return params; } - public String getUpay_agreement_file() { - return upay_agreement_file; - } - - public String getUpay_application_form() { - return upay_application_form; - } - public String getUpay_driver_license() { return upay_driver_license; } @@ -46,18 +45,6 @@ public class ClientMWAuthFilesInfo { return upay_offer_letter; } - public void setUpay_agreement_file(String upay_agreement_file) { - this.upay_agreement_file = upay_agreement_file; - } - - public void setUpay_application_form(String upay_application_form) { - this.upay_application_form = upay_application_form; - } - - public String getUpay_residence_certificate() { - return upay_residence_certificate; - } - public String getUpay_risk_level() { return upay_risk_level; } @@ -70,10 +57,6 @@ public class ClientMWAuthFilesInfo { this.upay_offer_letter = upay_offer_letter; } - public void setUpay_residence_certificate(String upay_residence_certificate) { - this.upay_residence_certificate = upay_residence_certificate; - } - public String getUpay_risk_remark() { return upay_risk_remark; } @@ -85,4 +68,84 @@ public class ClientMWAuthFilesInfo { public void setUpay_risk_remark(String upay_risk_remark) { this.upay_risk_remark = upay_risk_remark; } + + public String getCard_security_policy() { + return card_security_policy; + } + + public String getClient_bank_file() { + return client_bank_file; + } + + public String getClient_company_file() { + return client_company_file; + } + + public String getUpay_privacy_policy() { + return upay_privacy_policy; + } + + public String getUpay_promotional_offer() { + return upay_promotional_offer; + } + + public void setCard_security_policy(String card_security_policy) { + this.card_security_policy = card_security_policy; + } + + public String getUpay_terms_conditions() { + return upay_terms_conditions; + } + + public void setClient_bank_file(String client_bank_file) { + this.client_bank_file = client_bank_file; + } + + public void setClient_company_file(String client_company_file) { + this.client_company_file = client_company_file; + } + + public void setUpay_privacy_policy(String upay_privacy_policy) { + this.upay_privacy_policy = upay_privacy_policy; + } + + public void setUpay_promotional_offer(String upay_promotional_offer) { + this.upay_promotional_offer = upay_promotional_offer; + } + + public void setUpay_terms_conditions(String upay_terms_conditions) { + this.upay_terms_conditions = upay_terms_conditions; + } + + public String getRefund_exchange_policy() { + return refund_exchange_policy; + } + + public void setRefund_exchange_policy(String refund_exchange_policy) { + this.refund_exchange_policy = refund_exchange_policy; + } + + public String getKyc_utility_bill_file() { + return kyc_utility_bill_file; + } + + public void setKyc_utility_bill_file(String kyc_utility_bill_file) { + this.kyc_utility_bill_file = kyc_utility_bill_file; + } + + public void setUpay_application_form(String upay_application_form) { + this.upay_application_form = upay_application_form; + } + + public String getUpay_application_form() { + return upay_application_form; + } + + public String getUpay_desc_file() { + return upay_desc_file; + } + + public void setUpay_desc_file(String upay_desc_file) { + this.upay_desc_file = upay_desc_file; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRateConfig.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRateConfig.java index 00226b22c..994dd765f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRateConfig.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRateConfig.java @@ -25,7 +25,7 @@ public class ClientRateConfig { @JSONField(name = "transaction_fee") @NotNull(message = "error.payment.valid.param_missing") - private Double transactionFee; + private Double transactionFee = 0.00; @JSONField(name = "active_time") @NotNull(message = "error.payment.valid.param_missing") diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRegisterInfo.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRegisterInfo.java index 5a961a42b..1ef0b6c83 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRegisterInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/ClientRegisterInfo.java @@ -25,13 +25,13 @@ public class ClientRegisterInfo { private String businessName; @JSONField(name = "business_structure") private String businessStructure; -// @NotEmpty(message = "error.payment.valid.param_missing") + // @NotEmpty(message = "error.payment.valid.param_missing") private String abn; private String acn; -// @NotEmpty(message = "error.payment.valid.param_missing") + // @NotEmpty(message = "error.payment.valid.param_missing") private String industry; @JSONField(name = "alipayindustry") - /* @NotEmpty(message = "error.payment.valid.param_missing")*/ + /* @NotEmpty(message = "error.payment.valid.param_missing")*/ private String alipayIndustry; @JSONField(name = "company_photo") private String companyPhoto; @@ -60,7 +60,7 @@ public class ClientRegisterInfo { private String postcode; private String state; @JSONField(name = "legal_representative_person") - private String representativePerson ; + private String representativePerson; @JSONField(name = "legal_representative_phone") private String representativePhone; @JSONField(name = "legal_representative_email") @@ -68,7 +68,7 @@ public class ClientRegisterInfo { @JSONField(name = "legal_representative_job") private String representativeJobTitle; @JSONField(name = "marketing_person") - private String marketingPerson ; + private String marketingPerson; @JSONField(name = "marketing_phone") private String marketingPhone; @JSONField(name = "marketing_email") @@ -112,10 +112,29 @@ public class ClientRegisterInfo { private String client_pay_type; @NotEmpty(message = "error.payment.valid.param_missing") private String client_pay_desc; + @JSONField(name = "it_contact_person_email") + private String itContactPersonEmail; + @JSONField(name = "acceptor_name") + private String acceptorName; + @JSONField(name = "expected_card_revenue") + private String expectCardRevenue; + @JSONField(name = "average_card_transaction") + private String averageCardTransaction; + @JSONField(name = "mw_industry") + private String mwIndustry; + @JSONField(name = "enable_international_card") + private boolean enableInternaltionCard; + @JSONField(name = "enable_cross_payment") + private boolean enableCrossPayment = true; + @JSONField(name = "enable_card_payment") + private boolean enableCardPayment = false; public JSONObject insertObject() { + if (industry == null) { + setIndustry("331"); + } JSONObject res = (JSONObject) JSON.toJSON(this); - if (client_apply_id==null){ + if (client_apply_id == null) { res.remove("client_apply_id"); } return res; @@ -550,4 +569,68 @@ public class ClientRegisterInfo { public void setMarketingWechatId(String marketingWechatId) { this.marketingWechatId = marketingWechatId; } + + public String getItContactPersonEmail() { + return itContactPersonEmail; + } + + public void setItContactPersonEmail(String itContactPersonEmail) { + this.itContactPersonEmail = itContactPersonEmail; + } + + public void setAcceptorName(String acceptorName) { + this.acceptorName = acceptorName; + } + + public String getAcceptorName() { + return acceptorName; + } + + public boolean isEnableInternaltionCard() { + return enableInternaltionCard; + } + + public String getAverageCardTransaction() { + return averageCardTransaction; + } + + public String getExpectCardRevenue() { + return expectCardRevenue; + } + + public String getMwIndustry() { + return mwIndustry; + } + + public void setAverageCardTransaction(String averageCardTransaction) { + this.averageCardTransaction = averageCardTransaction; + } + + public void setEnableInternaltionCard(boolean enableInternaltionCard) { + this.enableInternaltionCard = enableInternaltionCard; + } + + public void setExpectCardRevenue(String expectCardRevenue) { + this.expectCardRevenue = expectCardRevenue; + } + + public void setMwIndustry(String mwIndustry) { + this.mwIndustry = mwIndustry; + } + + public boolean isEnableCardPayment() { + return enableCardPayment; + } + + public boolean isEnableCrossPayment() { + return enableCrossPayment; + } + + public void setEnableCardPayment(boolean enableCardPayment) { + this.enableCardPayment = enableCardPayment; + } + + public void setEnableCrossPayment(boolean enableCrossPayment) { + this.enableCrossPayment = enableCrossPayment; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/PartnerQuery.java b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/PartnerQuery.java index 56e39c370..4f2503bbd 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/beans/PartnerQuery.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/beans/PartnerQuery.java @@ -51,6 +51,7 @@ public class PartnerQuery { private boolean bd_upload_material = false; private boolean is_valid = false; private String merchant_id; + private boolean card_approving = false; public String getClient_moniker() { return StringUtils.isEmpty(client_moniker) ? null : client_moniker; @@ -120,6 +121,9 @@ public class PartnerQuery { if (approving) { param.put("approving", true); } + if(card_approving){ + param.put("card_approving",true); + } if (org_id != null) { param.put("org_id", org_id); } @@ -472,4 +476,12 @@ public class PartnerQuery { public void setSuburb(String suburb) { this.suburb = suburb; } + + public boolean isCard_approving() { + return card_approving; + } + + public void setCard_approving(boolean card_approving) { + this.card_approving = card_approving; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index e78be6bb6..eb4585ffb 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 @@ -69,9 +69,6 @@ public interface ClientManager { @Transactional void updateClientRpayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject rpaySubMerchantInfo); - @Transactional - void updateClientYeepayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject yeepaySubMerchantInfo); - @Transactional void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo); @@ -82,23 +79,24 @@ public interface ClientManager { void auditClient(JSONObject manager, String clientMoniker, int pass); @Transactional(noRollbackFor = EmailException.class) - void auditClientGreenChannel(JSONObject manager, String clientMoniker); + void auditCardClient(JSONObject manager, String clientMoniker, int pass); - void checkAndSendInitEmail(JSONObject manager, String clientMoniker); + @Transactional(noRollbackFor = EmailException.class) + void auditClientGreenChannel(JSONObject manager, String clientMoniker); - void sendOpenEmail(final JSONObject client, String username, String pwd); + void checkAndSendInitEmail(JSONObject manager, String clientMoniker,String type); -// 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); @@ -269,10 +268,14 @@ public interface ClientManager { JSONObject getSourceAgreeFiles(JSONObject manage, String clientMoniker); + JSONObject getSourceCardAgreeFiles(String clientMoniker, JSONObject manager, String fileName); + void deleteAuthFiles(String fileId); void deleteAuthFilesByAdmin(String fileId); + void deleteMWAuthFilesByAdmin(String fileId); + void uploadAuthFiles(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo); void uploadAuthFilesManager(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo); @@ -283,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); @@ -297,8 +300,18 @@ public interface ClientManager { void commitToCompliance(String clientMoniker, JSONObject manager); + void commitToCardCompliance(String clientMoniker, JSONObject manager); + void commitToDoAgreeFile(String clientMoniker, JSONObject manager); + /** + * 提交资料,申请卡支付 + * + * @param clientMoniker + * @param manager + */ + void commitToDoCardAgreeFile(String clientMoniker, JSONObject manager); + void commitToGreenChannel(String clientMoniker, JSONObject manager); void changePaymentPage(JSONObject manager, String clientMoniker, String paypad_version); @@ -335,6 +348,8 @@ public interface ClientManager { void refusePartner(String clientMoniker, JSONObject manager, String refuse_remark); + void cardRefusePartner(String clientMoniker, JSONObject manager, String refuse_remark); + JSONArray getAllClientIds(int clientId); void updateAppClient(JSONObject account, int client_id, AppClientBean appClientBean); @@ -375,6 +390,10 @@ public interface ClientManager { void getAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; + void getAggregateCardAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; + + void getAggregateCardPromotionaAgreeFile(String clientMoniker, JSONObject manager, boolean renewal,String rateid,HttpServletResponse httpResponse); + void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception; void temporaryExportPdf(String clientMoniker, JSONObject manager, HttpServletResponse httpResponse) throws Exception; @@ -383,6 +402,8 @@ public interface ClientManager { void completeAgree(String clientMoniker, JSONObject manager); + void cardCompleteAgree(String clientMoniker, JSONObject manager); + void downloadComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception; void downloadMWComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception; @@ -410,8 +431,6 @@ public interface ClientManager { List listRpaySubMerchantIdApplys(JSONObject manager, String clientMoniker); - List listYeepaySubMerchantIdApplys(JSONObject manager, String clientMoniker); - String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager); void registerAlipayGms(String clientMoniker, JSONObject manager); @@ -468,12 +487,6 @@ public interface ClientManager { void subRpayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager); - void subYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager); - - void subYeepayMerchantAdd(String clientMoniker, JSONObject merchantInfo, JSONObject manager); - - void reSubYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager); - void updateAllPartnerPassword(String clientMoniker); void postponeClientRate(Date now, Date yearTomorrow, String expireDate, JSONObject client); @@ -574,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 9e3f7fac3..b3e5ad078 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 @@ -13,9 +13,6 @@ import au.com.royalpay.payment.channels.wechat.config.WechatPayEnvironment; import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi; import au.com.royalpay.payment.channels.wechat.runtime.WxPayClient; import au.com.royalpay.payment.channels.wechat.runtime.beans.SubMerchantInfo; -import au.com.royalpay.payment.channels.yeepay.config.YeePayConfig; -import au.com.royalpay.payment.channels.yeepay.mappers.YeePayClientConfigMapper; -import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient; import au.com.royalpay.payment.core.PaymentChannelApi; import au.com.royalpay.payment.core.beans.EmptyMerchantApplication; import au.com.royalpay.payment.core.beans.MerchantApplicationResult; @@ -36,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; @@ -93,7 +96,6 @@ import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; -import com.yeepay.yop.sdk.service.kj.model.SubmerchantRegisterResult; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ArrayUtils; @@ -106,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; @@ -113,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; @@ -183,6 +186,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private ClientIncrementalMapper clientIncrementalMapper; + @Value("${client_card.account_reserve}") + private String cardAccountReserve; + @Value("${client_card.annual_rate}") + private String cardAnnualRate; + @Value("${app.redis.prefix}") private String redisPrefix; private ApplicationEventPublisher publisher; @@ -193,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; @@ -222,15 +223,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Resource private RpayApi rpayApi; - @Resource - private YeePayClient yeePayClient; - - @Resource - private YeePayConfig yeePayConfig; - - @Resource - private YeePayClientConfigMapper yeePayClientConfigMapper; - @Resource private ManagerMapper managerMapper; @Resource @@ -267,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; @@ -326,6 +316,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private RPayPaymentCardSvcApi rPayPaymentCardSvcApi; @Resource private RPayMerchantMapper rPayMerchantMapper; + @Resource + private SysClientUpayProfileMapper sysClientUpayProfileMapper; + DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMM yyyy"); @Resource @@ -336,6 +329,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private static final String CLIENT_AGREE_FILE = "client_agree_file"; private static final String CLIENT_COMPANY_FILE = "client_company_file"; private static final String CLIENT_APPLY_FILE = "client_apply_file"; + + //卡支付合同文件 + private static final String LETTER_OF_OFFER_FILE = "letter_of_offer_file"; + private static final String PROMOTIONAL_OFFER_FILE = "promotional_offer_file"; + private static final String TERMS_AND_CONDITIONS_FILE = "terms_and_conditions_file"; + + private static final List tags = new ArrayList<>(); private static final String KYC_UTILITY_BILL_FILE = "kyc_utility_bill_file"; @@ -426,21 +426,25 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } JSONObject clientConfig = clientConfigService.find(client.getIntValue("client_id")); - if(client.containsKey("enable_presettle")){ - clientConfig.put("enable_presettle",client.getBoolean("enable_presettle")); + if (client.containsKey("enable_presettle")) { + clientConfig.put("enable_presettle", client.getBoolean("enable_presettle")); } - if(client.containsKey("ext_params")){ - clientConfig.put("ext_params",client.getString("ext_params")); + if (client.containsKey("ext_params")) { + clientConfig.put("ext_params", client.getString("ext_params")); } client.putAll(clientConfig); - client.put("unsubscribe", mailUnsubMapper.findOneByClientMoniker(clientMoniker) == null ? false : true); + JSONObject upayInfo = sysClientUpayProfileMapper.findInfo(client.getIntValue("client_id")); + if (upayInfo != null) { + client.putAll(upayInfo); + } + client.put("unsubscribe", mailUnsubMapper.findOneByClientMoniker(clientMoniker) != null); client.put("show_all_permission", true); int role = manager != null ? manager.getIntValue("role") : 0; if (manager != null) { if (ManagerRole.OPERATOR.hasRole(role)) { List log = logClientSubMerchantIdMapper.listLogsByClientId(client.getInteger("client_id"), new PageBounds(Order.formString("create_time.desc"))); - client.put("sub_merchant_id_log", log.size() > 0 ? true : false); + client.put("sub_merchant_id_log", log.size() > 0); } if (ManagerRole.BD_USER.hasRole(role)) { int checkBDPermission = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id")); @@ -449,6 +453,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject org = orgMapper.findOne(manager.getIntValue("org_id")); boolean bdRateEditable = client.getIntValue("approve_result") != 1 || org.getBooleanValue("rate_editable"); client.put("rate_editable", bdRateEditable); + boolean bdCardRateEditable = (clientConfig.getBoolean("enable_card_payment") && !client.containsKey("upay_approve_result")); + client.put("card_rate_editable", bdCardRateEditable); } else { client.put("company_phone", "******"); client.put("contact_person", "******"); @@ -486,22 +492,19 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("min_customer_surcharge_rate", client.getBigDecimal("rate_value").add(new BigDecimal("0.1"))); } - // 商户审核过程日志 - PageList audit_logs = clientAuditProcessMapper.getAuditLog(client.getIntValue("client_id"), + // 商户跨境支付审核过程日志 + PageList audit_logs = clientAuditProcessMapper.getAuditLog(client.getIntValue("client_id"), 1, new PageBounds(Order.formString("create_time"))); if (audit_logs != null && !audit_logs.isEmpty()) { client.put("audit_logs", audit_logs); } - - //HF支付链接二维码 - if (client.getString("hf_pay_url") != null) { - String hfQrcodeUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + client.getString("client_moniker") + "/jump/app"); - client.put("hfQrcodeUrl", QRCodeUtils.qrcodeImageCode(hfQrcodeUrl, 250, true)); - } - if (client.getString("yeepay_pay_url") != null) { - String yeepayQrcodeUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/yeepay/partners/" + client.getString("client_moniker") + "/jump/app"); - client.put("yeepayQrcodeUrl", QRCodeUtils.qrcodeImageCode(yeepayQrcodeUrl, 250, true)); + //商户卡支付审核过程日志 + PageList audit_card_logs = clientAuditProcessMapper.getAuditLog(client.getIntValue("client_id"), 2, + new PageBounds(Order.formString("create_time"))); + if (audit_card_logs != null && !audit_card_logs.isEmpty()) { + client.put("audit_card_logs", audit_card_logs); } + if (client.getString("cb_bankpay_url") != null) { String cbBankPayQrcodeUrl = PlatformEnvironment.getEnv().concatUrl("/sys/partners/" + client.getString("client_moniker") + "/cb_bankpay/link"); client.put("cbBankPayQrcodeUrl", QRCodeUtils.qrcodeImageCode(cbBankPayQrcodeUrl, 250, true)); @@ -547,6 +550,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid List children = clientMapper.listChildClients(client.getIntValue("client_id")); client.put("has_children", !children.isEmpty()); } + assert client != null; client.putAll(clientConfigService.find(clientId)); return client; } @@ -782,10 +786,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid partner.put("ali_sub_merchant_id", registery.getClientMoniker()); partner.put("credential_code", RandomStringUtils.random(32, true, true)); partner.put("creator", manager.getString("manager_id")); - // if (manager.getIntValue("org_id") == 0) { - // throw new ForbiddenException("You were not belong to any organizations so that you cannot create new - // client"); - // } partner.put("org_id", manager.getIntValue("org_id")); if (StringUtils.isNotEmpty(registery.getLogoId())) { partner.put("logo_url", attachmentClient.getFileUrl(registery.getLogoId())); @@ -803,45 +803,28 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (clientMapper.findClientByMoniker(registery.getClientMoniker()) != null) { throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); } - //2018-09-10,新建商户不检查是否在系统黑名单 - //isRiskyMerchant(partner, null); + clientMapper.save(partner); try { - - clientMapper.save(partner); JSONObject clientConfig = new JSONObject(); clientConfig.put("client_id", partner.getIntValue("client_id")); clientConfig.put("client_moniker", partner.getString("client_moniker")); clientConfig.put("client_pay_type", partner.getString("client_pay_type")); clientConfig.put("client_pay_desc", partner.get("client_pay_desc")); - + clientConfig.put("enable_cross_payment", partner.get("enable_cross_payment")); + clientConfig.put("enable_card_payment", partner.get("enable_card_payment")); clientConfigService.save(clientConfig); permissionPartnerManagerImpl.permissionClientModuleSave(partner.getIntValue("client_id"), partner.getString("client_moniker")); } catch (Exception e) { - throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); + throw new ServerErrorException("商户配置信息初始化失败"); } - try { - JSONObject representativeInfo = new JSONObject(); - representativeInfo.put("client_id", partner.getIntValue("client_id")); - representativeInfo.put("representative_person", partner.getString("legal_representative_person")); - representativeInfo.put("phone", partner.getString("legal_representative_phone")); - representativeInfo.put("email", partner.getString("legal_representative_email")); - representativeInfo.put("job_title", partner.getString("legal_representative_job")); - representativeInfo.put("address", partner.getString("registered_address")); - representativeInfo.put("suburb", partner.getString("registered_suburb")); - representativeInfo.put("postcode", partner.getString("registered_postcode")); - representativeInfo.put("state", partner.getString("registered_state")); - representativeInfo.put("legal_representative_wechatid", partner.getString("legal_representative_wechatid")); -// marking联系人 - representativeInfo.put("marketing_person", partner.getString("marketing_person")); - representativeInfo.put("marketing_phone", partner.getString("marketing_phone")); - representativeInfo.put("marketing_email", partner.getString("marketing_email")); - representativeInfo.put("marketing_job_title", partner.getString("marketing_job")); - representativeInfo.put("marketing_wechatid", partner.getString("marketing_wechatid")); - sysClientLegalPersonMapper.save(representativeInfo); + saveLegalAndMarketingInfo(partner); + if (registery.isEnableCardPayment()) { + sysClientUpayProfileMapper.save(partner); + } } catch (Exception e) { - throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); + throw new ServerErrorException("商户初始化法人信息失败"); } if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { @@ -892,7 +875,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } updateInfo.put("client_id", clientId); - JSONObject representativeInfo = new JSONObject(); representativeInfo.put("client_id", clientId); representativeInfo.put("representative_person", info.getRepresentativePerson()); @@ -917,6 +899,17 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid sysClientLegalPersonMapper.save(representativeInfo); } + if (info.isEnableCardPayment()) { + JSONObject upay = sysClientUpayProfileMapper.findInfo(clientId); + if (upay == null) { + updateInfo.put("client_moniker", clientMoniker); + sysClientUpayProfileMapper.save(updateInfo); + } else { + upay.putAll(updateInfo); + sysClientUpayProfileMapper.update(upay); + } + } + int originReferrerId = client.getIntValue("referrer_id"); int updateReferrerId = Integer.parseInt(info.getReferrer_id() == null ? "0" : info.getReferrer_id()); if (originReferrerId == 0 && updateReferrerId != 0) { @@ -932,6 +925,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject clientConfig = new JSONObject(); clientConfig.put("client_id", clientId); clientConfig.put("client_moniker", client.getString("client_moniker")); + clientConfig.put("enable_cross_payment", updateInfo.getBooleanValue("enable_cross_payment")); + clientConfig.put("enable_card_payment", updateInfo.getBooleanValue("enable_card_payment")); if (StringUtils.isNotBlank(updateInfo.getString("client_pay_type")) && StringUtils.isNotBlank(updateInfo.getString("client_pay_desc"))) { clientConfig.put("client_pay_type", updateInfo.getString("client_pay_type")); clientConfig.put("client_pay_desc", updateInfo.getString("client_pay_desc")); @@ -974,7 +969,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientMapper.update(info); if (StringUtils.isNotBlank(info.getString("representative_person"))) { JSONObject legalInfo = sysClientLegalPersonMapper.findRepresentativeInfo(clientId); - if(legalInfo != null){ + if (legalInfo != null) { legalInfo.put("client_id", client.getIntValue("client_id")); legalInfo.put("representative_person", info.getString("representative_person")); legalInfo.put("job_title", info.getString("representative_job_title")); @@ -985,7 +980,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid legalInfo.put("state", info.getString("registered_state")); legalInfo.put("postcode", info.getString("registered_postcode")); sysClientLegalPersonMapper.update(legalInfo); - }else{ + } else { JSONObject legal = new JSONObject(); legal.put("client_id", client.getIntValue("client_id")); legal.put("representative_person", info.getString("representative_person")); @@ -1062,7 +1057,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); JSONObject update = new JSONObject(); int clientId = client.getIntValue("client_id"); - String originSubMerchantId = client.getString("rpay_enterprise_id"); update.put("client_id", clientId); String subMerchantId = rpaySubMerchantInfo.getString("rpay_enterprise_id"); update.put("rpay_enterprise_id", subMerchantId); @@ -1075,25 +1069,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientInfoCacheSupport.clearClientCache(clientId); } - @Transactional - @Override - public void updateClientYeepayPaymentConfig(JSONObject manager, String clientMoniker, JSONObject yeepaySubMerchantInfo) { - JSONObject client = getClientInfoByMoniker(clientMoniker); - if (client == null) { - throw new InvalidShortIdException(); - } - checkOrgPermission(manager, client); - if (client.getString("yeepay_sub_merchant_id").equals(yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id"))) { - throw new BadRequestException("The sub merchant Id is in use"); - } - JSONObject yeepayConfigValid = yeePayClientConfigMapper.findMerchantConfig(client.getIntValue("client_id")); - yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfigValid.getString("yeepay_config_id"), 0); - JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"), yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id")); - yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayConfig.getString("yeepay_config_id"), 1); - client.put("yeepay_sub_merchant_id", yeepaySubMerchantInfo.getString("yeepay_sub_merchant_id")); - clientMapper.update(client); - } - @Override public void updateAliSubMerchantId(JSONObject manager, String clientMoniker, JSONObject aliSubMerchantInfo) { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -1174,30 +1149,61 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientModifySupport.processClientModify(auditModify); sendCommissionWechatMessage(client);// wxMessage if (pass == 1) { - createKycAuthStatus(manager,client); + createKycAuthStatus(manager, client); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false)); if (client.getIntValue("source") == 4 || client.getIntValue("source") == 5) { List accounts = clientAccountMapper.listAdminAccounts(client.getIntValue("client_id")); JSONObject account = accounts.get(0); - sendInitEmail(client, account.getString("username"), "*****"); + sendInitEmail(client, account.getString("username"), "*****", false); // sendInitEmail(manager, client, account.getString("username"), "*****"); - saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager, 1); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false)); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "common_sub_merchant_id", false)); gatewayMerchantApply.notifyOrgMerchantStatus(client); } else if (checkGreenChannel && client.getIntValue("open_status") == 5) { // 绿色通道通过后不发邮件 logger.info("PASS 绿色通道:" + clientMoniker); - saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager, 1); + } else { + initAdminUserAndSendEmail(manager, clientMoniker, client, false); + saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager, 1); + } + } + clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id")); + } + + @Override + public void auditCardClient(JSONObject manager, String clientMoniker, int pass) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + //检查商户是否进入平台黑名单 + int clientId = client.getIntValue("client_id"); + isRiskyMerchant(client, clientBankAccountMapper.clientBankAccounts(clientId).get(0)); + + JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(clientId); + client.putAll(clientConfigService.find(client.getIntValue("client_id"))); + Integer open_status_to = cardFlowInfo != null ? cardFlowInfo.getIntValue("upay_open_status") : null; + cardFlowInfo.put("upay_open_status", 5); + cardFlowInfo.put("upay_approve_result", 1); + sysClientUpayProfileMapper.update(cardFlowInfo); + sendCardCommissionWechatMessage(client);// wxMessage + if (pass == 1) { + createKycAuthStatus(manager, client); + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "skip_clearing", false)); + List accounts = clientAccountMapper.listAdminAccounts(clientId); + if (accounts != null && accounts.size() > 0) { + sendInitEmail(client, accounts.get(0).getString("username"), "*******", true); } else { - initAdminUserAndSendEmail(manager, clientMoniker, client); - saveClientAuditProcess(client.getIntValue("client_id"), open_status, 5, "合规通过", manager); + initAdminUserAndSendEmail(manager, clientMoniker, client, true); } + saveClientAuditProcess(client.getIntValue("client_id"), open_status_to, 5, "合规通过", manager, 2); } clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id")); } - private void createKycAuthStatus(JSONObject manager,JSONObject client){ + private void createKycAuthStatus(JSONObject manager, JSONObject client) { JSONObject compliance = clientComplianceCompanyMapper.findKycFileByClientId(client.getIntValue("client_id")); if (compliance != null) { compliance.put("client_id", client.getIntValue("client_id")); @@ -1240,15 +1246,12 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new BadRequestException("该商户未设置微信 Sub Merchant ID!"); } clientModifySupport.processClientModify(new GreenChannelModify(manager, clientMoniker, manager.getString("manager_id"))); - saveClientAuditProcess(client.getIntValue("client_id"), 10, 1, "绿色通道申请通过", manager); + saveClientAuditProcess(client.getIntValue("client_id"), 10, 1, "绿色通道申请通过", manager, 1); sendCommissionWechatMessage(client); - initAdminUserAndSendEmail(manager, clientMoniker, client); + initAdminUserAndSendEmail(manager, clientMoniker, client, false); } - private void initAdminUserAndSendEmail(JSONObject manager, String clientMoniker, JSONObject client) { - if (StringUtils.isEmpty(client.getString("sub_merchant_id"))) { - throw new BadRequestException("Sub Merchant ID Can't be null "); - } + private void initAdminUserAndSendEmail(JSONObject manager, String clientMoniker, JSONObject client, boolean isUpayEmail) { String username = clientMoniker; boolean duplicated = true; String pwd = RandomStringUtils.random(8, true, true); @@ -1265,20 +1268,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid username += "0"; } } - sendInitEmail(client, username.toLowerCase(), pwd); - // sendInitEmail(manager, client, username, pwd); + sendInitEmail(client, username.toLowerCase(), pwd, isUpayEmail); } @Override - public void checkAndSendInitEmail(JSONObject manager, String clientMoniker) { + public void checkAndSendInitEmail(JSONObject manager, String clientMoniker, String type) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } - int sendStatus = client.getIntValue("approve_email_send"); - if (sendStatus >= 3) { - throw new BadRequestException("Email validating... Wait for a moment"); - } int clientId = client.getIntValue("client_id"); clientModifySupport.processClientModify(new EmailModify(manager, clientMoniker, 4, null)); if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { @@ -1288,26 +1286,27 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } List accounts = clientAccountMapper.listAdminAccounts(clientId); + JSONObject cardProfile = clientMapper.findClientAprrovingStatus(clientId); + boolean cardApproving = cardProfile != null && StringUtils.equals("cardpayment", type); if (client.getIntValue("source") == 4) { JSONObject account = accounts.get(0); // sendInitEmail(manager, client, account.getString("username"), "*****"); - sendInitEmail(client, account.getString("username"), "*****"); + sendInitEmail(client, account.getString("username"), "*****", cardApproving); } else { if (accounts.size() == 0) { - initAdminUserAndSendEmail(manager, clientMoniker, client); + initAdminUserAndSendEmail(manager, clientMoniker, client, cardApproving); } else { JSONObject account = accounts.get(0); String pwd = RandomStringUtils.random(8, true, true); resetAccountPwd(manager, clientMoniker, account.getString("account_id"), pwd); // sendInitEmail(manager, client, account.getString("username"), pwd); - sendInitEmail(client, account.getString("username"), pwd); + sendInitEmail(client, account.getString("username"), pwd, cardApproving); } } } - - @Override - public void sendOpenEmail(final JSONObject client, String username, String pwd) { + public void sendInitEmail(final JSONObject client, String username, String pwd, boolean isUpayAuditPass) { + logger.debug("sending email after comply"); JSONObject model = new JSONObject(); model.put("username", username); model.put("password", pwd); @@ -1315,7 +1314,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")); @@ -1324,10 +1322,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<>(); @@ -1348,122 +1345,41 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid 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(); + new Thread(() -> { + 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(); + if (isUpayAuditPass) { + clientUpdate.put("client_id", client.getIntValue("client_id")); + clientUpdate.put("upay_approve_email_send", 3); + clientUpdate.put("upay_approve_email_id", emailId); + sysClientUpayProfileMapper.update(clientUpdate); + } else { clientUpdate.put("client_id", client.getIntValue("client_id")); clientUpdate.put("approve_email_send", 3); clientUpdate.put("approve_email_id", emailId); clientMapper.update(clientUpdate); - } catch (Exception e) { - JSONObject clientUpdate = new JSONObject(); - clientUpdate.put("client_id", client.getIntValue("client_id")); - clientUpdate.put("approve_email_send", 0); - clientUpdate.put("approve_email_id", null); - clientMapper.update(clientUpdate); - throw new EmailException("Email Sending Failed", e); } - } - }.start(); - } - - public void sendInitEmail(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("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(); + } catch (Exception e) { + JSONObject clientUpdate = new JSONObject(); + if (isUpayAuditPass) { 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("upay_approve_email_send", 0); + clientUpdate.put("upay_approve_email_id", null); + sysClientUpayProfileMapper.update(clientUpdate); + } else { clientUpdate.put("client_id", client.getIntValue("client_id")); clientUpdate.put("approve_email_send", 0); clientUpdate.put("approve_email_id", null); clientMapper.update(clientUpdate); - throw new EmailException("Email Sending Failed", e); } + throw new EmailException("Email Sending Failed", e); } - }.start(); + }).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"); @@ -1569,43 +1485,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)); + 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 @@ -1616,12 +1516,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new NotFoundException("Client Not Exists"); } - if (channel.equals("hf") && !allow && client.getBoolean("enable_hf_email_notice")) { - clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_hf_email_notice", allow)); - } - if (channel.equals("yeepay") && !allow && client.getBoolean("enable_yeepay_email_notice")) { - clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_yeepay_email_notice", allow)); - } clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_" + channel.toLowerCase(), allow)); logger.info(manager.getString("display_name") + "(" + manager.getString("manager_id") + ") switched client " + clientMoniker + " channel " @@ -1712,7 +1606,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")) { //登录用户所属商户 @@ -1835,7 +1728,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")); } @@ -2027,25 +1919,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkAddRate(config, "Wechat", "wechat_rate_value", org, "min_wechat_rate"); checkAddRate(config, "Alipay", "alipay_rate_value", org, "min_alipay_rate"); checkAddRate(config, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate"); - checkAddRate(config, "Bestpay", "bestpay_rate_value", org, "min_bestpay_rate"); - checkAddRate(config, "jd", "jd_rate_value", org, "min_jd_rate"); -// checkAddRate(config, "hf", "hf_rate_value", org, "min_hf_rate"); checkAddRate(config, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate"); -// checkAddRate(config, "Yeepay", "yeepay_rate_value", org, "min_yeepay_rate"); checkAddRate(config, "CB_BankPay", "min_cb_bankpay_value", org, "min_cb_bankpay_rate"); configNewClientRate(config, clientId, "Wechat", "wechat_rate_value", org, "min_wechat_rate"); configNewClientRate(config, clientId, "Alipay", "alipay_rate_value", org, "min_alipay_rate"); configNewClientRate(config, clientId, "AlipayOnline", "alipayonline_rate_value", org, "min_alipayonline_rate"); - configNewClientRate(config, clientId, "Bestpay", "bestpay_rate_value", org, "min_bestpay_rate"); - configNewClientRate(config, clientId, "jd", "jd_rate_value", org, "min_jd_rate"); -// configNewClientRate(config, clientId, "hf", "hf_rate_value", org, "min_hf_rate"); configNewClientRate(config, clientId, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate"); -// configNewClientRate(config, clientId, "Yeepay", "yeepay_rate_value", org, "min_yeepay_rate"); configNewClientRate(config, clientId, "CB_BankPay", "cb_bankpay_rate_value", org, "min_cb_bankpay_rate"); - //todo 暂不更新Rpay+ 费率信息 - //rpayApi.modifySurchargeConfig(client); - } private void configNewClientRate(JSONObject config, int clientId, String channel, String rateKey, JSONObject org, String rateValueKey) { @@ -2054,27 +1935,36 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid newConfig.putAll(config); newConfig.put("rate_value", config.getBigDecimal(rateKey)); newConfig.put("rate_name", channel); - if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), - config.getDoubleValue("rate_value"), config.getInteger("clean_days"), channel).isEmpty()) { + if (!clientRateMapper.listClientRatesForSaving(clientId, config.getDate("active_time"), config.getDate("expiry_time"), 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(){{ + JSONObject extRateParams = new JSONObject() {{ put("domestic_rate_value", config.getBigDecimal("rate_value")); put("overseas_rate_value", config.getJSONObject("ext_rates").getBigDecimal("international_rate_value")); }}; newConfig.put("ext_rates", extRateParams.toJSONString()); } + pastRate(clientId,channel); clientRateMapper.saveRate(newConfig); logger.info(clientId + "的" + channel + "费率设置成功"); } } + private void pastRate(int clientId,String rateName){ + List rates = clientRateMapper.listClientRates(clientId, rateName); + if (!rates.isEmpty()) { + Date today = DateUtils.truncate(new Date(), Calendar.DATE); + for (JSONObject rateItem : rates) { + if (rateItem.getDate("expiry_time").before(today) || rateItem.getDate("active_time").after(today)) { + continue; + } + rateItem.put("expiry_time",new Date()); + clientRateMapper.updateConfig(rateItem); + } + } + } + @Override @Transactional public void modifyRateConfig(JSONObject manager, String clientMoniker, int rateId, ClientRateConfig config) { @@ -2088,23 +1978,25 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkModifyRate(org, configJson, "Wechat", "min_wechat_rate"); checkModifyRate(org, configJson, "Alipay", "min_alipay_rate"); checkModifyRate(org, configJson, "AlipayOnline", "min_alipayonline_rate"); - checkModifyRate(org, configJson, "jd", "min_jd_rate"); - checkModifyRate(org, configJson, "Bestpay", "min_bestpay_rate"); configJson.put("client_rate_id", rateId); configJson.put("manager_id", manager.getString("manager_id")); configJson.put("manager_name", manager.getString("username")); configJson.put("update_time", new Date()); + if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getRateName())) { + JSONObject extParams = configJson.getJSONObject("ext_rates"); + extParams.put("domestic_rate_value", config.getRateValue()); + configJson.put("ext_rates", extParams.toJSONString()); + } clientRateMapper.updateConfig(configJson); -// if ("Rpay".equals(configJson.getString("rate_name"))) { -// rpayApi.modifySurchargeConfig(client); -// } + if (StringUtils.equalsIgnoreCase("rpaypmt_card", config.getRateName())) { + return; + } int clientId = client.getIntValue("client_id"); JSONObject changeRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "Wechat"); int cleanDays = changeRate.getIntValue("clean_days"); - if (cleanDays != client.getIntValue("clean_days") && StringUtils.equalsIgnoreCase("Wechat",config.getRateName())) { + if (cleanDays != client.getIntValue("clean_days") && StringUtils.equalsIgnoreCase("Wechat", config.getRateName())) { clientModifySupport.processClientConfigModify(new ClearDaysModify(manager, clientMoniker, cleanDays)); } - // clientMapper.updateCleanDays(clientId, config.getCleanDays()); } private void checkModifyRate(JSONObject org, JSONObject configJson, String rateName, String rateValueKey) { @@ -2140,7 +2032,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); List listChildClients = clientMapper.listChildClients(client.getIntValue("client_id")); JSONObject mchConfig = merchantInfoProvider.getMchExtParams(client.getIntValue("client_id")); - if(mchConfig.getBooleanValue("hide_sub_mch")){ + if (mchConfig.getBooleanValue("hide_sub_mch")) { return new ArrayList<>(); } if (mchConfig.getBooleanValue("level3_mch_config")) { @@ -2158,7 +2050,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker,String searchText, int page) { + public JSONObject listSubClientsByPage(JSONObject manager, String clientMoniker, String searchText, int page) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -2166,7 +2058,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid checkOrgPermission(manager, client); PageBounds pageBounds; - pageBounds= new PageBounds(page, 20, Order.formString("create_time.desc")); + pageBounds = new PageBounds(page, 20, Order.formString("create_time.desc")); JSONObject params = new JSONObject() {{ put("parent_client_id", client.getIntValue("client_id")); }}; @@ -2381,23 +2273,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } catch (Exception ignored) { throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service"); } - - try { - JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay"); - if (bestPayRate != null) { - client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - - JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd"); - if (jdRate != null) { - client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - } catch (Exception ignored) { - JSONObject rate = sysConfigRate.getJSONObject("t" + weChatRate.getString("clean_days")); - client.put("bestpay_rate", rate.getBigDecimal("Bestpay").setScale(2, BigDecimal.ROUND_DOWN)); - client.put("jd_rate", rate.getBigDecimal("JDpay").setScale(2, BigDecimal.ROUND_DOWN)); - } - JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id")); if (bankAccount == null || bankAccount.size() <= 0) { throw new BadRequestException("The Partner's Account is not config!"); @@ -2741,7 +2616,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client_ids != null) { params.put("client_ids", Arrays.asList(client_ids)); params.remove("client_id"); - }else { + } else { queryModifyClientIds(client.getIntValue("client_id"), params); } PageList devices = clientDeviceMapper.listClientDevices(params, new PageBounds(page, limit, Order.formString("create_time.desc"))); @@ -2766,7 +2641,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client_ids != null) { params.put("client_ids", Arrays.asList(client_ids)); params.remove("client_id"); - }else { + } else { queryModifyClientIds(client.getIntValue("client_id"), params); } List deviceIds = clientDeviceMapper.listClientDeviceIds(params); @@ -3033,27 +2908,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("company_name_acn", client.getString("company_name") + " (ABN " + client.getString("abn") + ")"); } - // List clientRate = clientRateMapper.latestConfig(client.getIntValue("client_id"), null); - // if (CollectionUtils.isEmpty(clientRate)) { - // throw new BadRequestException("The Partner's Rate is not config!"); - // } - // clientRate.forEach((p) -> { - // String rate_name = p.getString("rate_name"); - // if ("Wechat".equals(rate_name)) { - // client.put("wechat_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - // client.put("clean", "T+" + p.getString("clean_days")); - // 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 ("Bestpay".equals(rate_name)) { - // client.put("bestpay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - // } else if ("jd".equals(rate_name)) { - // client.put("jd_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - // } else if ("AlipayOnline".equals(rate_name)) { - // client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - // } - // }); - JSONObject weChatRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat"); if (weChatRate == null) { throw new BadRequestException("The Partner's Rate is not config!"); @@ -3067,17 +2921,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (alipayRate != null) { client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); } - - JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay"); - if (bestPayRate != null) { - client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - - JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd"); - if (jdRate != null) { - client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline"); if (alipayOnlineRate != null) { client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); @@ -3120,6 +2963,36 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } + @Override + @Transactional + public void getAggregateCardAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) { + JSONObject client = clientMapper.findClientByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + exportLetterOfferPDF(clientMoniker, manager); + exportTermsConditionsPDF(clientMoniker, manager); + + if (!renewal) { + JSONObject cardFlow = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id")); + cardFlow.put("upay_open_status", 2); + sysClientUpayProfileMapper.update(cardFlow); + } + if (manager != null) { + saveClientAuditProcess(client.getIntValue("client_id"), 1, 2, "Compliance合同制作中", manager, 2); + } + } + + @Override + @Transactional + public void getAggregateCardPromotionaAgreeFile(String clientMoniker, JSONObject manager, boolean renewal, String rateid, HttpServletResponse httpResponse) { + JSONObject client = clientMapper.findClientByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + exportPromotionalOfferPDF(clientMoniker, manager, rateid, httpResponse); + } + @Override public void getNewAggregateAgreeFile(String clientMoniker, JSONObject manager, boolean renewal) throws Exception { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -3152,10 +3025,6 @@ 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 ("Bestpay".equals(rate_name)) { - client.put("bestpay_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } else if ("jd".equals(rate_name)) { - client.put("jd_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); } else if ("AlipayOnline".equals(rate_name)) { client.put("alipay_online_rate", p.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); } @@ -3232,16 +3101,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("alipay_rate", alipayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); } - JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay"); - if (bestPayRate != null) { - client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - - JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd"); - if (jdRate != null) { - client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - JSONObject alipayOnlineRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "AlipayOnline"); if (alipayOnlineRate != null) { client.put("alipay_online_rate", alipayOnlineRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); @@ -3317,7 +3176,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } if (manager != null) { - saveClientAuditProcess(client.getIntValue("client_id"), 1, 2, "Compliance合同制作中", manager); + saveClientAuditProcess(client.getIntValue("client_id"), 1, 2, "Compliance合同制作中", manager, 1); } } } @@ -3334,11 +3193,29 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } client.put("open_status", 3); clientModifySupport.processClientModify(new OpenStatusModify(manager, clientMoniker, 3)); - saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成,等待BD处理", manager); + saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成,等待BD处理", manager, 1); // sendAgreeFileMsgToBD(client,null); sendCommissionWechatMessage(client); } + @Override + public void cardCompleteAgree(String clientMoniker, JSONObject manager) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + List existLeffterFiles = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), LETTER_OF_OFFER_FILE); + List existConditionsFiles = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), TERMS_AND_CONDITIONS_FILE); + if (CollectionUtils.isEmpty(existLeffterFiles) && CollectionUtils.isEmpty(existConditionsFiles)) { + throw new BadRequestException("The Agree File is not Complete!"); + } + JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id")); + cardFlowInfo.put("upay_open_status", 3); + sysClientUpayProfileMapper.update(cardFlowInfo); + saveClientAuditProcess(client.getIntValue("client_id"), 2, 3, "合同制作完成,等待BD处理", manager, 2); + sendCardCommissionWechatMessage(client); + } + @Override public void downloadComplianceZip(String clientMoniker, HttpServletResponse response) throws Exception { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -3385,7 +3262,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - List files = clientMWAuthFilesInfo.findClientFile(client.getIntValue("client_id")); + List files = clientMWAuthFilesInfo.findClientFile(client.getIntValue("client_id"), new PageBounds(1, 999999, Order.formString("last_update_date.asc"))); if (files != null && files.size() > 0) { List filePaths = new ArrayList<>(); for (JSONObject file : files) { @@ -3527,7 +3404,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - clientModifySupport.processClientModify( new SwitchAllowSurchargeCreditModify(manager, clientMoniker, "enable_presettle", presettle)); + clientModifySupport.processClientModify(new SwitchAllowSurchargeCreditModify(manager, clientMoniker, "enable_presettle", presettle)); } @Override @@ -3580,7 +3457,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } params.put("display_name", manager.getString("display_name")); - clientApproveIdInfo(params,client); + clientApproveIdInfo(params, client); } @Override @@ -3591,7 +3468,13 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } int clientId = client.getIntValue("client_id"); params.put("client_id", client.getIntValue("client_id")); - clientConfigMapper.update(params); + params.put("client_moniker", client.getString("client_moniker")); + JSONObject upayInfo = sysClientUpayProfileMapper.findInfo(clientId); + if (upayInfo == null) { + sysClientUpayProfileMapper.save(params); + } else { + sysClientUpayProfileMapper.update(params); + } } @Override @@ -3669,10 +3552,23 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return sourceFile; } + @Override + public JSONObject getSourceCardAgreeFiles(String clientMoniker, JSONObject manager, String fileName) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + JSONObject sourceFile = clientFilesMapper.getSourceCardAgreeFilesByClientId(client.getIntValue("client_id"), fileName); + if (sourceFile != null) { + sourceFile.put(sourceFile.getString("file_name"), sourceFile.getString("file_value")); + } + return sourceFile; + } + @Override public JSONObject getAllAuthFiles(JSONObject manager, String clientMoniker) { JSONObject client = getClientInfoByMoniker(clientMoniker); - String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file", "client_apply_file","kyc_utility_bill_file"}; + String[] fileKeys = {"client_bank_file", "client_company_file", "client_id_file", "client_agree_file", "client_apply_file", "kyc_utility_bill_file"}; if (client == null) { throw new InvalidShortIdException(); } @@ -3709,17 +3605,32 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (client == null) { throw new InvalidShortIdException(); } - List clientFiles = clientMWAuthFilesInfo.findClientFile(client.getIntValue("client_id")); + String[] fileKeys = UPayAuthFileEnum.ALL.getFileNameArrays(); + List clientFiles = clientMWAuthFilesInfo.findClientFile(client.getIntValue("client_id"), new PageBounds(1, 999999, Order.formString("last_update_date.asc"))); JSONObject fileJson = new JSONObject(); - for (JSONObject file : clientFiles) { - fileJson.put(file.getString("file_name"), file.getString("file_value")); - } - return fileJson; - } - - @Override - public JSONObject getAllKycFiles(JSONObject manager, String clientMoniker) { - JSONObject client = getClientInfoByMoniker(clientMoniker); + if (clientFiles != null && clientFiles.size() > 0) { + for (String fileKey : fileKeys) { + List clientFileUrl = clientFiles.stream() + .filter(json -> (fileKey.equals(json.getString("file_name")))) + .sorted((log1, log2) -> log2.getDate("last_update_date").compareTo(log1.getDate("last_update_date"))) + .map(json -> { + JSONObject params = new JSONObject(); + params.put("file_id", json.getString("file_id")); + params.put("file_value", json.getString("file_value")); + return params; + }) + .collect(Collectors.toList()); + if (clientFileUrl != null && clientFileUrl.size() > 0) { + fileJson.put(fileKey, clientFileUrl); + } + } + } + return fileJson; + } + + @Override + public JSONObject getAllKycFiles(JSONObject manager, String clientMoniker) { + JSONObject client = getClientInfoByMoniker(clientMoniker); String[] fileKeys = {"client_company_file", "kyc_utility_bill_file", "client_id_file"}; if (client == null) { throw new InvalidShortIdException(); @@ -3727,7 +3638,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid List clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id")); JSONObject fileJson = new JSONObject(); JSONObject companyFile = clientComplianceCompanyMapper.findKycFileByClientId(client.getIntValue("client_id")); - fileJson.put("companyFile",companyFile); + fileJson.put("companyFile", companyFile); if (clientFiles != null && clientFiles.size() > 0) { for (String fileKey : fileKeys) { List clientFileUrl = clientFiles.stream() @@ -3798,6 +3709,15 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientFilesMapper.deleteByClientAndFileId(fileId); } + @Override + public void deleteMWAuthFilesByAdmin(String fileId) { + JSONObject file = clientMWAuthFilesInfo.findFileById(fileId); + if (file == null) { + throw new BadRequestException("The file has deleted"); + } + clientMWAuthFilesInfo.deleteByClientAndFileId(fileId); + } + @Override @Transactional public void uploadAuthFiles(JSONObject manager, String clientMoniker, ClientAuthFilesInfo filesInfo) { @@ -3867,11 +3787,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } int clientId = client.getIntValue("client_id"); try { - updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_APPLICATION_FORM.getFileName(), filesInfo.getUpay_application_form()); - updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_AGREEMENT_FILE.getFileName(), filesInfo.getUpay_agreement_file()); - updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_OFFER_LETTER.getFileName(), filesInfo.getUpay_offer_letter()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.CLIENT_BANK_FILE.getFileName(), filesInfo.getClient_bank_file()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.CLIENT_COMPANY_FILE.getFileName(), filesInfo.getClient_company_file()); updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_DRIVER_LICENSE.getFileName(), filesInfo.getUpay_driver_license()); - updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_RESIDENCE_CERTIFICATE.getFileName(), filesInfo.getUpay_residence_certificate()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.REFUND_EXCHANGE_POLICY.getFileName(), filesInfo.getRefund_exchange_policy()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_PRIVACY_POLICY.getFileName(), filesInfo.getUpay_privacy_policy()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.CARD_SECURITY_POLICY.getFileName(), filesInfo.getCard_security_policy()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_OFFER_LETTER.getFileName(), filesInfo.getUpay_offer_letter()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_PROMOTIONAL_OFFER.getFileName(), filesInfo.getUpay_promotional_offer()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_TERMS_CONDITIONS.getFileName(), filesInfo.getUpay_terms_conditions()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.KYC_UTILITY_BILL_FILE.getFileName(), filesInfo.getKyc_utility_bill_file()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_APPLICATION_FORM.getFileName(), filesInfo.getUpay_application_form()); + updateSysMWClientFiles(manager, clientId, UPayAuthFileEnum.UPAY_DESC_FILE.getFileName(), filesInfo.getUpay_desc_file()); } catch (Exception e) { logger.error("上传合规文件失败", e); } @@ -3926,9 +3853,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } int clientId = client.getIntValue("client_id"); try { - updateFilesForWaitAuditWithoutRepeat(manager, clientId, CLIENT_COMPANY_FILE, filesInfo.getFile_company_info(),fileResult); - updateFilesForWaitAuditWithoutRepeat(manager, clientId, CLIENT_ID_FILE, filesInfo.getFile_id_info(),fileResult); - updateSysClientFilesForWaitCompliance(manager, clientId, KYC_UTILITY_BILL_FILE, filesInfo.getUtility_bill_info(),fileResult); + updateFilesForWaitAuditWithoutRepeat(manager, clientId, CLIENT_COMPANY_FILE, filesInfo.getFile_company_info(), fileResult); + updateFilesForWaitAuditWithoutRepeat(manager, clientId, CLIENT_ID_FILE, filesInfo.getFile_id_info(), fileResult); + updateSysClientFilesForWaitCompliance(manager, clientId, KYC_UTILITY_BILL_FILE, filesInfo.getUtility_bill_info(), fileResult); } catch (Exception e) { logger.error("上传KYC文件失败", e); throw new BadRequestException("上传KYC文件失败" + e.getMessage()); @@ -3938,7 +3865,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override @Transactional - public List uploadKycFilesForWaitComplianceForApp(JSONObject account, String clientMoniker, JSONObject filesInfo,String fileType) { + public List uploadKycFilesForWaitComplianceForApp(JSONObject account, String clientMoniker, JSONObject filesInfo, String fileType) { JSONObject client = getClientInfoByMoniker(clientMoniker); List fileResult = new ArrayList<>(); if (client == null) { @@ -3946,7 +3873,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } int clientId = client.getIntValue("client_id"); try { - updateFilesForWaitAuditWithoutRepeatForApp(account,clientId, fileType, filesInfo.getString("url"),fileResult); + updateFilesForWaitAuditWithoutRepeatForApp(account, clientId, fileType, filesInfo.getString("url"), fileResult); } catch (Exception e) { logger.error("上传KYC文件失败", e); throw new BadRequestException("上传KYC文件失败" + e.getMessage()); @@ -3955,7 +3882,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } - @Override @Transactional public void commitAuthFilesToCompliance(String clientMoniker, JSONObject account, String source) { @@ -4073,22 +3999,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new BadRequestException("Merchant Rate Not Configure,Please Contact Customer Service"); } - try { - JSONObject bestPayRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Bestpay"); - if (bestPayRate != null) { - client.put("bestpay_rate", bestPayRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - - JSONObject jdRate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "jd"); - if (jdRate != null) { - client.put("jd_rate", jdRate.getBigDecimal("rate_value").setScale(2, BigDecimal.ROUND_DOWN)); - } - } catch (Exception ignored) { - JSONObject rate = sysConfigRate.getJSONObject("t" + weChatRate.getString("clean_days")); - client.put("bestpay_rate", rate.getBigDecimal("Bestpay").setScale(2, BigDecimal.ROUND_DOWN)); - client.put("jd_rate", rate.getBigDecimal("JDpay").setScale(2, BigDecimal.ROUND_DOWN)); - } - JSONObject bankAccount = getBankAccountByClientId(client.getIntValue("client_id")); if (bankAccount == null || bankAccount.size() <= 0) { throw new BadRequestException("The Partner's Account is not config!"); @@ -4298,7 +4208,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject dataItem = logs.get(i); HSSFRichTextString text0 = new HSSFRichTextString(client.getString("short_name")); HSSFRichTextString text1 = new HSSFRichTextString(client.getString("client_moniker")); - HSSFRichTextString text2 = new HSSFRichTextString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format( dataItem.getDate("report_date"))); + HSSFRichTextString text2 = new HSSFRichTextString(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dataItem.getDate("report_date"))); HSSFRichTextString text3 = new HSSFRichTextString(dataItem.getBigDecimal("total").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()); HSSFRichTextString text4 = new HSSFRichTextString(dataItem.getBigDecimal("income").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()); HSSFRichTextString text5 = new HSSFRichTextString(dataItem.getBigDecimal("fee").setScale(2, BigDecimal.ROUND_HALF_DOWN).toString()); @@ -4341,7 +4251,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } public void updateSysClientFilesWithoutRepeat(JSONObject manager, int clientId, String fileType, String fileValue) { - List repetitiveFiles = clientFilesMapper.findRepetitiveFilesForDelete(clientId,fileType); + List repetitiveFiles = clientFilesMapper.findRepetitiveFilesForDelete(clientId, fileType); if (fileValue != null) { JSONObject fileJson = new JSONObject(); fileJson.put("client_id", clientId); @@ -4353,8 +4263,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid fileJson.put("is_valid", 1); clientFilesMapper.save(fileJson); logger.info(clientId + "的fileType文件上传成功"); - if(repetitiveFiles != null){ - for(JSONObject repetitiveFile : repetitiveFiles){ + if (repetitiveFiles != null) { + for (JSONObject repetitiveFile : repetitiveFiles) { clientFilesMapper.deleteByClientAndFileId(repetitiveFile.getString("file_id")); } } @@ -4388,7 +4298,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid public void updateFilesForWaitAuditWithoutRepeat(JSONObject manager, int clientId, String fileType, String fileValue, List fileResult) { if (fileValue != null) { String[] values = fileValue.split(","); - List repetitiveFiles = clientFilesMapper.findRepetitiveFiles(clientId,fileType); + List repetitiveFiles = clientFilesMapper.findRepetitiveFiles(clientId, fileType); for (String value : values) { JSONObject fileJson = new JSONObject(); fileJson.put("client_id", clientId); @@ -4405,8 +4315,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid file.put("file_value", fileJson.getString("file_value")); fileResult.add(file); } - if(repetitiveFiles != null){ - for(JSONObject repetitiveFile : repetitiveFiles){ + if (repetitiveFiles != null) { + for (JSONObject repetitiveFile : repetitiveFiles) { clientFilesMapper.deleteByClientAndFileId(repetitiveFile.getString("file_id")); } } @@ -4417,7 +4327,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid public void updateFilesForWaitAuditWithoutRepeatForApp(JSONObject account, int clientId, String fileType, String fileValue, List fileResult) { if (fileValue != null) { String[] values = fileValue.split(","); - List repetitiveFiles = clientFilesMapper.findRepetitiveFiles(clientId,fileType); + List repetitiveFiles = clientFilesMapper.findRepetitiveFiles(clientId, fileType); for (String value : values) { JSONObject fileJson = new JSONObject(); fileJson.put("client_id", clientId); @@ -4434,8 +4344,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid file.put("file_value", fileJson.getString("file_value")); fileResult.add(file); } - if(repetitiveFiles != null){ - for(JSONObject repetitiveFile : repetitiveFiles){ + if (repetitiveFiles != null) { + for (JSONObject repetitiveFile : repetitiveFiles) { clientFilesMapper.deleteByClientAndFileId(repetitiveFile.getString("file_id")); } } @@ -4443,7 +4353,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } - public void updateAggregateFilesForWaitCompliance(JSONObject manager, int clientId, String fileType, String fileValue, List fileResult) { if (fileValue != null) { List passAggregateFiles = clientFilesMapper.findClientPassAggreeFile(clientId); @@ -4534,14 +4443,53 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } client.put("open_status", 4); clientModifySupport.processClientModify(openStatusModify); - saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "BD完成签字提交compliance审核", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "BD完成签字提交compliance审核", manager, 1); if (manager != null) { // sendMessagetoCompliance(client, manager.getString("display_name")); sendCommissionWechatMessage(client); } } - private void saveClientAuditProcess(int client_id, Integer open_status_form, Integer open_status_to, String remark, JSONObject manager) { + @Override + @Transactional + public void commitToCardCompliance(String clientMoniker, JSONObject manager) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + client.putAll(clientConfigService.find(client.getIntValue("client_id"))); + if (manager != null && ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { + int bdOperatClientRole = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id")); + if (bdOperatClientRole <= 0) { + throw new ForbiddenException(); + } + } + // 提交合规启用银行、费率验证 add by Tayl0r 2017/06/13 + JSONObject rate = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "rpaypmt_card"); + if (rate == null) { + throw new BadRequestException("The Partner's Rate is not config!"); + } + List clientFiles = clientFilesMapper.findClientFile(client.getIntValue("client_id")); + if (clientFiles == null || clientFiles.equals("")) { + throw new BadRequestException("The Compliance File Must Be Uploaded!"); + } + JSONObject account = getBankAccountByClientId(client.getIntValue("client_id")); + if (account == null) { + throw new BadRequestException("The Partner's Bank Account is not config!"); + } + JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id")); + int open_status_from = cardFlowInfo.getIntValue("upay_open_status"); + cardFlowInfo.put("upay_approve_time", new Date()); + cardFlowInfo.put("upay_approve_result", 4); + cardFlowInfo.put("upay_open_status", 4); + sysClientUpayProfileMapper.update(cardFlowInfo); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "BD完成签字提交compliance审核", manager, 2); + if (manager != null) { + sendCardCommissionWechatMessage(client); + } + } + + private void saveClientAuditProcess(int client_id, Integer open_status_form, Integer open_status_to, String remark, JSONObject manager, int type) { JSONObject log = new JSONObject(); try { log.put("client_id", client_id); @@ -4552,6 +4500,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid log.put("operator_id", StringUtils.isNotEmpty(manager.getString("manager_id")) ? manager.getString("manager_id") : manager.getString("account_id")); log.put("operator", manager.getString("display_name")); log.put("create_time", new Date()); + log.put("type", type); log.put("remark", remark); clientAuditProcessMapper.save(log); } catch (Exception e) { @@ -4567,6 +4516,48 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } client.putAll(clientConfigService.find(client.getIntValue("client_id"))); + + beforeCommitToDoAgreeValid(client, manager, "Wechat"); + + OpenStatusModify openStatusModify = new OpenStatusModify(manager, clientMoniker, 1); + openStatusModify.setApprove_result(4); + openStatusModify.setApprove_time(new Date()); + clientModifySupport.processClientModify(openStatusModify); + saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Compliance制作合同", manager, 1); + if (manager != null) { +// sendAgreeFileMsgtoCompliance(client, manager.getString("display_name")); + sendCommissionWechatMessage(client); + } + } + + @Override + @Transactional + public void commitToDoCardAgreeFile(String clientMoniker, JSONObject manager) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + int clientId = client.getIntValue("client_id"); + client.putAll(clientConfigService.find(clientId)); + beforeCommitToDoAgreeValid(client, manager, "rpaypmt_card"); + + JSONObject surCharge = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "rpaypmt_card"); + if (surCharge == null || surCharge.size() <= 0) { + throw new BadRequestException("The Partner's Rpaypmt Card Rate is not config!"); + } + + JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(clientId); + JSONObject cardFlow = new JSONObject() {{ + put("client_id", clientId); + put("upay_approve_result", 4); + put("upay_open_status", 1); + put("upay_approve_time", new Date()); + }}; + sysClientUpayProfileMapper.update(cardFlow); + saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Card Payment Compliance制作合同", manager, 2); + } + + private void beforeCommitToDoAgreeValid(JSONObject client, JSONObject manager, String channel) { if (manager != null && ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { int bdOperatClientRole = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id")); if (bdOperatClientRole <= 0) { @@ -4574,7 +4565,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } - JSONObject surCharge = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), "Wechat"); + JSONObject surCharge = merchantInfoProvider.clientCurrentRate(client.getIntValue("client_id"), new Date(), channel); if (surCharge == null || surCharge.size() <= 0) { throw new BadRequestException("The Partner's Rate is not config!"); } @@ -4583,15 +4574,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (account == null || account.size() <= 0) { throw new BadRequestException("The Partner's Bank Account is not config!"); } - OpenStatusModify openStatusModify = new OpenStatusModify(manager, clientMoniker, 1); - openStatusModify.setApprove_result(4); - openStatusModify.setApprove_time(new Date()); - clientModifySupport.processClientModify(openStatusModify); - saveClientAuditProcess(client.getIntValue("client_id"), null, 1, "提交Compliance制作合同", manager); - if (manager != null) { - // sendAgreeFileMsgtoCompliance(client, manager.getString("display_name")); - sendCommissionWechatMessage(client); - } } @Override @@ -4623,7 +4605,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid openStatusModify.setApprove_result(4); openStatusModify.setApprove_time(new Date()); clientModifySupport.processClientModify(openStatusModify); - saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 10, "提交绿色通道申请Compliance审核", manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 10, "提交绿色通道申请Compliance审核", manager, 1); if (manager != null) { // sendGreenChannelMessagetoCompliance(client, manager.getString("display_name")); sendCommissionWechatMessage(client); @@ -4913,7 +4895,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (refuse_remark != null && !refuse_remark.isEmpty()) { auditModify.setRefuse_remark(refuse_remark); } - saveClientAuditProcess(client.getIntValue("client_id"), open_status, client.getInteger("open_status"), "打回," + refuse_remark, manager); + saveClientAuditProcess(client.getIntValue("client_id"), open_status, client.getInteger("open_status"), "打回," + refuse_remark, manager, 1); clientModifySupport.processClientModify(auditModify); try { @@ -4938,6 +4920,55 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } + @Override + public void cardRefusePartner(String clientMoniker, JSONObject manager, String refuse_remark) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + Integer clientId = client.getInteger("client_id"); + JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(clientId); + Integer open_status = null; + if (null != cardFlowInfo) { + open_status = cardFlowInfo.getIntValue("upay_open_status"); + if (open_status == 1) { + cardFlowInfo.put("upay_open_status", null); + } else { + cardFlowInfo.put("upay_open_status", open_status - 1); + } + if (cardFlowInfo.getIntValue("upay_approve_result") == 4 || client.getIntValue("source") == 4) { + cardFlowInfo.put("upay_approve_result", 5); + } + if (refuse_remark != null && !refuse_remark.isEmpty()) { + cardFlowInfo.put("upay_refuse_remark", refuse_remark); + } + } else { + cardFlowInfo.put("upay_open_status", null); + } + saveClientAuditProcess(client.getIntValue("client_id"), open_status, cardFlowInfo.getIntValue("open_status"), "打回," + refuse_remark, manager, 2); + sysClientUpayProfileMapper.update(cardFlowInfo); + + try { + if (client.getIntValue("source") == 4) { + String contact_phone = client.getString("contact_phone"); + if (contact_phone.startsWith("+61")) { + ArrayList param = new ArrayList<>(); + param.add(refuse_remark); + try { + smsSender.getSender().sendWithParam("61", contact_phone.replace("+61", ""), REFUSE_CLIENT_TEMPLID, param, "RoyalPay", "", ""); + } catch (Exception ignore) { + throw new ServerErrorException("Phone number is wrong :" + contact_phone); + } + } + } + if (client.getIntValue("source") == 5) { + gatewayMerchantApply.notifyOrgMerchantStatus(client); + } + } catch (Exception e) { + logger.error("RefusePartnerError=======:" + clientMoniker + "," + e.getMessage()); + } + } + @Override @Cacheable(value = ":all_clients:", key = "''+#clientId") public JSONArray getAllClientIds(int clientId) { @@ -5455,6 +5486,94 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } + private void sendCardCommissionWechatMessage(JSONObject client) { + String bd_user_name = client.getString("bd_user_name"); + String client_moniker = "[" + client.getString("client_moniker") + "]"; + String short_name = client.getString("short_name"); + JSONObject cardFlowInfo = sysClientUpayProfileMapper.findInfo(client.getInteger("client_id")); + if (null == cardFlowInfo) { + return; + } + if (cardFlowInfo.getIntValue("upay_open_status") == 1) { + List complianceList = managerMapper.getOnlyCompliance(); + if (complianceList != null && complianceList.size() > 0) { + for (JSONObject compliance : complianceList) { + String wxopenid = compliance.getString("wx_openid"); + try { + MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), "BD申请制作信用卡支付合同" + client_moniker, + bd_user_name, "制作卡支付合同申请", "BD申请制作" + short_name + "的卡支付合同"); + paymentApi.sendTemplateMessage(msg); + } catch (WechatException e) { + logger.error("Wechat Message Error,open_status=1" + e.getMessage()); + publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid)); + } + } + } + return; + } + if (cardFlowInfo.getIntValue("upay_open_status") == 3) { + List bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); + for (JSONObject bd : bds) { + String wxopenid = bd.getString("wx_openid"); + if (wxopenid != null) { + try { + MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "信用卡支付合同制作完成", + "Compliance", "合规材料", "上传完整合规材料,商户:" + short_name); + paymentApi.sendTemplateMessage(msg); + } catch (WechatException e) { + logger.error("Wechat Message Error,open_status=3" + e.getMessage()); + publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=3,openid=" + wxopenid)); + + } + } + + } + return; + } + if (cardFlowInfo.getIntValue("upay_open_status") == 4) { + if (client.getIntValue("source") == 4 && !StringUtils.isNotEmpty(bd_user_name)) { + bd_user_name = "自助开通商户"; + } + List complianceList = managerMapper.getOnlyCompliance(); + if (complianceList != null && complianceList.size() > 0) { + for (JSONObject compliance : complianceList) { + String wxopenid = compliance.getString("wx_openid"); + try { + MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "信用卡卡支付合规材料已提交", + bd_user_name, "审核材料", "已提交合规材料,等待审核"); + paymentApi.sendTemplateMessage(msg); + } catch (WechatException e) { + logger.error("Wechat Message Error,open_status=1" + e.getMessage()); + publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=1,openid=" + wxopenid)); + } catch (Exception e) { + logger.error("Wechat Message Error,open_status=1" + e.getMessage()); + } + } + } + return; + } + if (cardFlowInfo.getIntValue("upay_open_status") == 5) { + List bds = clientBDMapper.listClientBDInfoAvailable(client.getIntValue("client_id"), new Date()); + for (JSONObject bd : bds) { + String wxopenid = bd.getString("wx_openid"); + if (wxopenid != null) { + try { + TemplateMessage msg = initTaskFinishTemplate(wxopenid, client_moniker + "已正式开通", "Card Payment Compliance审核通过", ""); + MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); + paymentApi.sendTemplateMessage(msg); + } catch (WechatException e) { + logger.error("Wechat Message Error,open_status=5" + e.getMessage()); + publisher.publishEvent(new WechatExceptionEvent(this, e, "Audit,open_status=5,openid=" + wxopenid)); + } + } + } + return; + } + } + @Override @Cacheable(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") public List listSubMerchantIdApplys(JSONObject manager, String clientMoniker) { @@ -5509,20 +5628,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid return null; } - @Override - public List listYeepaySubMerchantIdApplys(JSONObject manager, String clientMoniker) { - JSONObject client = getClientInfoByMoniker(clientMoniker); - if (client == null) { - throw new InvalidShortIdException(); - } - checkOrgPermission(manager, client); - List applices = yeePayClientConfigMapper.findAllMerchantConfig(client.getInteger("client_id")); - if (!applices.isEmpty()) { - return applices; - } - return null; - } - @Override @CacheEvict(value = ":all_sub_merchant_id_applices:", key = "#clientMoniker") public String subMerchantApplication(String clientMoniker, SubMerchantIdApply subMerchantApply, JSONObject manager) { @@ -5783,116 +5888,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } } - - @Override - @Transactional - public void subYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager) { - JSONObject client = getClientInfoByMoniker(clientMoniker); - if (client == null) { - throw new InvalidShortIdException(); - } - checkOrgPermission(manager, client); - List yeepayClientConfigs = yeePayClientConfigMapper.findAllMerchantConfig(client.getIntValue("client_id")); - if (yeepayClientConfigs != null) { - for (JSONObject yeepayClientConfig : yeepayClientConfigs) { - if (yeepayClientConfig.getIntValue("is_valid") == 1) { - yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayClientConfig.getString("yeepay_config_id"), 0); - } - } - } - merchantInfo.put("create_time", new Date()); - merchantInfo.put("operator", manager.getString("display_name")); - merchantInfo.put("client_id", client.getIntValue("client_id")); - merchantInfo.put("client_id", merchantInfo.getString("client_id")); -// merchantInfo.put("vouchers",merchantInfo.getJSONObject("vouchers").toJSONString()); - List directorsAll = new ArrayList<>(); - List executivesAll = new ArrayList<>(); - directorsAll.add(merchantInfo.getJSONObject("directors")); - executivesAll.add(merchantInfo.getJSONObject("executives")); - JSONObject extInfo = new JSONObject(); - extInfo.put("directors", directorsAll); - extInfo.put("executives", executivesAll); - merchantInfo.put("extinfo", extInfo.toJSONString()); - yeePayClientConfigMapper.saveMerchantConfig(merchantInfo); - JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfig(client.getIntValue("client_id")); - yeepayConfig.put("company_website", merchantInfo.getString("company_website")); - yeepayConfig.put("abn", merchantInfo.getString("abn")); - yeepayConfig.put("company_name", merchantInfo.getString("company_name")); - yeepayConfig.put("contact_phone", merchantInfo.getString("contact_phone")); - yeepayConfig.put("contact_email", merchantInfo.getString("contact_email")); - yeepayConfig.put("contact_person", merchantInfo.getString("contact_person")); - SubmerchantRegisterResult result = yeePayClient.registerMerchant(client, yeepayConfig); - if (result.getStatus().equals("FAILED")) { - throw new BadRequestException(result.getErrorMsg()); - } - yeepayConfig.put("sub_merchant_id", result.getSubMerchantId()); - yeePayClientConfigMapper.updateSubMerchantId(yeepayConfig.getString("yeepay_config_id"), result.getMerchantId(), result.getSubMerchantId()); - client.put("yeepay_sub_merchant_id", result.getSubMerchantId()); - clientMapper.update(client); - } - - @Override - public void subYeepayMerchantAdd(String clientMoniker, JSONObject merchantInfo, JSONObject manager) { - JSONObject client = getClientInfoByMoniker(clientMoniker); - if (client == null) { - throw new InvalidShortIdException(); - } - checkOrgPermission(manager, client); - JSONObject config = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"), merchantInfo.getString("sub_merchant_id")); - if (config != null) { - throw new BadRequestException("You had add the sub merchant id"); - } - List yeepayClientConfigs = yeePayClientConfigMapper.findAllMerchantConfig(client.getIntValue("client_id")); - if (yeepayClientConfigs != null) { - for (JSONObject yeepayClientConfig : yeepayClientConfigs) { - if (yeepayClientConfig.getIntValue("is_valid") == 1) { - yeePayClientConfigMapper.updateSubMerchantIdValid(yeepayClientConfig.getString("yeepay_config_id"), 0); - } - } - } - merchantInfo.put("client_id", client.getIntValue("client_id")); - merchantInfo.put("merchant_id", yeePayConfig.getAppKey().split("_")[1]); - merchantInfo.put("create_time", new Date()); - merchantInfo.put("is_valid", 1); - merchantInfo.put("operator", manager.getString("display_name")); - yeePayClientConfigMapper.saveMerchantConfig(merchantInfo); - client.put("yeepay_sub_merchant_id", merchantInfo.getString("sub_merchant_id")); - clientMapper.update(client); - } - - @Override - public void reSubYeepayMerchantApplication(String clientMoniker, JSONObject merchantInfo, JSONObject manager) { - JSONObject client = getClientInfoByMoniker(clientMoniker); - if (client == null) { - throw new InvalidShortIdException(); - } - checkOrgPermission(manager, client); - JSONObject yeepayConfig = yeePayClientConfigMapper.findMerchantConfigBySub(client.getIntValue("client_id"), merchantInfo.getString("subMerchantId")); - List directorsAll = new ArrayList<>(); - List executivesAll = new ArrayList<>(); - directorsAll.add(merchantInfo.getJSONObject("directors")); - executivesAll.add(merchantInfo.getJSONObject("executives")); - JSONObject extInfo = new JSONObject(); - extInfo.put("directors", directorsAll); - extInfo.put("executives", executivesAll); - yeepayConfig.put("extinfo", extInfo.toJSONString()); - yeepayConfig.put("industry", merchantInfo.getString("industry")); - yeepayConfig.put("business_content", merchantInfo.getString("business_content")); - yeepayConfig.put("business_licence", merchantInfo.getString("business_licence")); - yeePayClientConfigMapper.update(yeepayConfig); - yeepayConfig.put("company_website", merchantInfo.getString("company_website")); - yeepayConfig.put("abn", merchantInfo.getString("abn")); - yeepayConfig.put("company_name", merchantInfo.getString("company_name")); - yeepayConfig.put("contact_phone", merchantInfo.getString("contact_phone")); - yeepayConfig.put("contact_email", merchantInfo.getString("contact_email")); - yeepayConfig.put("contact_person", merchantInfo.getString("contact_person")); - yeepayConfig.put("mode", "UPDATE"); - SubmerchantRegisterResult result = yeePayClient.registerMerchant(client, yeepayConfig); - if (result.getStatus().equals("FAILED")) { - throw new BadRequestException(result.getErrorMsg()); - } - } - @Override public List listMerchantIds(String clientMoniker, JSONObject manager) { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -6061,7 +6056,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } client.put("open_status", 4); clientModifySupport.processClientModify(openStatusModify); - saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "自助开通商户提交compliance审核", client_account); + saveClientAuditProcess(client.getIntValue("client_id"), open_status_from, 4, "自助开通商户提交compliance审核", client_account, 1); if (params != null) { params.put("display_name", client_account.getString("display_name")); @@ -6233,7 +6228,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid ctx.setVariable("order_id", order.getString("order_id")); ctx.setVariable("amount", order.getString("total_amount")); ctx.setVariable("currency", order.getString("currency")); - ctx.setVariable("channel", getOrderChannel(order.getString("channel"))); + ctx.setVariable("channel", order.getString("channel")); String create_time = ""; if (client.getString("timezone") != null) { create_time = DateFormatUtils.format(order.getDate("create_time"), @@ -6256,16 +6251,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid }).start(); } - private String getOrderChannel(String channel) { - switch (channel) { - case "hf": - return "汇付"; - case "Yeepay": - return "易宝支付"; - } - return ""; - } - @Override public void updateAllPartnerPassword(String clientMoniker) { JSONObject client = getClientInfoByMoniker(clientMoniker); @@ -6661,7 +6646,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject isLessFiles(JSONObject partner){ + public JSONObject isLessFiles(JSONObject partner) { JSONObject client = clientMapper.findClientByMoniker(partner.getString("client_moniker")); if (client == null) { throw new InvalidShortIdException(); @@ -6669,7 +6654,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if ((client.getIntValue("approve_result") == 2 || client.getIntValue("open_status") == 10 || client.getIntValue("approve_result") == 1 || client.getIntValue("open_status") == 5)) { boolean lessKycFiles = isPartnerKycfilesComplete(partner.getString("client_moniker")); partner.put("lessKycFiles", lessKycFiles); - partner.put("lessComplianceFiles",signInAccountService.checkAuthFileStatus(partner.getJSONObject("client")).getBoolean("client_less_file")); + partner.put("lessComplianceFiles", signInAccountService.checkAuthFileStatus(partner.getJSONObject("client")).getBoolean("client_less_file")); } partner.put("lessKycFiles", false); partner.put("lessComplianceFiles", false); @@ -6692,14 +6677,14 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid throw new InvalidShortIdException(); } JSONObject KycFilesAuth = clientComplianceCompanyMapper.findKycFileComplete(client.getIntValue("client_id")); - if(KycFilesAuth != null){ + if (KycFilesAuth != null) { lessKycFiles = false; } return lessKycFiles; } @Override - public JSONObject partnerIncrementalServiceInfo(String clientMoniker,String channel){ + public JSONObject partnerIncrementalServiceInfo(String clientMoniker, String channel) { JSONObject client = clientMapper.findClientByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -6713,16 +6698,16 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public JSONObject getClientIncrementalServiceLoginToken(JSONObject account,String sourceCode){ + public JSONObject getClientIncrementalServiceLoginToken(JSONObject account, String sourceCode) { JSONObject client = clientMapper.findClient(account.getIntValue("client_id")); if (client == null) { throw new InvalidShortIdException(); } JSONObject clientConfig = clientConfigMapper.find(account.getIntValue("client_id")); - if(!clientConfig.getBooleanValue("geek_shop_status")){ + if (!clientConfig.getBooleanValue("geek_shop_status")) { throw new BadRequestException("Merchant service not opened"); } - return retailRSvcService.getGeekSsoTokenInfo(sourceCode,client.getString("client_moniker")); + return retailRSvcService.getGeekSsoTokenInfo(sourceCode, client.getString("client_moniker")); } @Override @@ -6926,18 +6911,18 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void changeExtParams(String clientMoniker,JSONObject manager, JSONObject params){ + public void changeExtParams(String clientMoniker, JSONObject manager, JSONObject params) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); } JSONObject extParmas = JSONObject.parseObject(client.getString("ext_params")); - if("true".equals(params.getString("value"))||"false".equals(params.getString("value"))){ - extParmas.put(params.getString("key"),params.getBoolean("value")); - }else{ - extParmas.put(params.getString("key"),params.getString("value")); + if ("true".equals(params.getString("value")) || "false".equals(params.getString("value"))) { + extParmas.put(params.getString("key"), params.getBoolean("value")); + } else { + extParmas.put(params.getString("key"), params.getString("value")); } - client.put("ext_params",extParmas.toString()); + client.put("ext_params", extParmas.toString()); clientMapper.update(client); } @@ -6983,7 +6968,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override - public void selectBillCodeVersion(JSONObject manager, String clientMoniker, String version){ + public void selectBillCodeVersion(JSONObject manager, String clientMoniker, String version) { JSONObject client = getClientInfoByMoniker(clientMoniker); if (client == null) { throw new InvalidShortIdException(); @@ -6993,4 +6978,199 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid clientInfoCacheSupport.clearClientCache(client.getIntValue("client_id")); } + private void exportLetterOfferPDF(String clientMoniker, JSONObject manage) { + JSONObject info = convertClientLetterOfferInfo(clientMoniker); + String pdfPath = this.getClass().getClassLoader().getResource("").getPath() + "/templates/pdf/letter_of_offer.pdf"; + String fileName = clientMoniker + "_Letter_of_Offer.pdf"; + publishExcelCardPDFFile(clientMoniker, manage, fileName, pdfPath, info, LETTER_OF_OFFER_FILE); + } + + private JSONObject convertClientLetterOfferInfo(String clientMoniker) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + //合规状态 + if (client.getIntValue("approve_result") != 1 && client.getIntValue("approve_result") == 3) { + throw new BadRequestException("The merchant failed the audit!"); + } + //获取数据源 + int clientId = client.getInteger("client_id"); + JSONObject clientRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "rpaypmt_card"); + if (clientRate == null) { + throw new BadRequestException("rpaypmt_card rate Not configured"); + } + JSONObject cardRate = clientRate.getJSONObject("ext_rates"); + //增加transaction_fee为null异常 + if (!cardRate.containsKey("transaction_fee") || StringUtils.isEmpty(cardRate.getString("transaction_fee"))) { + cardRate.put("transaction_fee", BigDecimal.ZERO); + } + JSONObject bankAccountInfo = clientBankAccountMapper.clientBankAccounts(clientId).get(0); + JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(clientId); + JSONObject legalInfo = sysClientLegalPersonMapper.findRepresentativeInfo(clientId); + //装在数据 + JSONObject info = new JSONObject(); + info.put("down_date", 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"));//国家 + info.put("partner_state", client.getString("state"));//洲 + info.put("partner_bussiness_name", client.getString("business_name"));//商户商用名称 + info.put("clean_days", clientRate.getInteger("clean_days"));//T+规则清算天数 + info.put("partner_industry_mcc", upayProfileInfo.getString("mw_industry"));//信用卡注册商户行业编码 + info.put("legal_bussiness", legalInfo.getString("representative_person") + " AS " + (client.containsKey("business_name") ? client.getString("business_name") : legalInfo.getString("representative_person")) + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 + info.put("annual_rate", cardAnnualRate);//年费率 + info.put("cost_per_transaction", clientRate.getString("transaction_fee"));//每次交易成本 + info.put("domestic_fee", cardRate.getString("domestic_rate_value"));//国内服务费 + info.put("international_fee", 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());//账户储备金 + //银行账号信息 + info.put("account_name", bankAccountInfo.getString("account_name"));// + info.put("bsb", bankAccountInfo.getString("bsb_no")); + info.put("account_no", bankAccountInfo.getString("account_no")); + info.put("card_acceptor_name", upayProfileInfo.getString("acceptor_name")); + return info; + } + + private void exportPromotionalOfferPDF(String clientMoniker, JSONObject manager, String 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"; + 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 rateid) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + //合规状态 + if (client.getIntValue("approve_result") != 1 && client.getIntValue("approve_result") == 3) { + throw new BadRequestException("The merchant failed the audit!"); + } + int clientId = client.getInteger("client_id"); + JSONObject currentRate = clientRateMapper.findRateByRateId(rateid); + if (currentRate == null) { + throw new BadRequestException("rpaypmt_card rate Not configured"); + } + JSONObject cardRate = currentRate.getJSONObject("ext_rates"); + JSONObject legalInfo = sysClientLegalPersonMapper.findRepresentativeInfo(clientId); + JSONObject upayProfileInfo = sysClientUpayProfileMapper.findInfo(clientId); + JSONObject info = new JSONObject(); + 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"));//国家 + info.put("partner_state", client.getString("state"));//洲 + info.put("partner_bussiness_name", client.getString("business_name"));//商户商用名称 + info.put("legal_bussiness", legalInfo.getString("representative_person") + " AS " + (client.containsKey("business_name") ? client.getString("business_name") : legalInfo.getString("representative_person")) + " ABN " + client.getString("abn"));//拼接规则:法人名 AS 商用名称 ABD 编码 + info.put("domestic_fee", cardRate.getString("domestic_rate_value"));//国内服务费 + info.put("international_fee", 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; + } + + private void exportTermsConditionsPDF(String clientMoniker, JSONObject manage) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + if (client.getIntValue("approve_result") != 1 && client.getIntValue("approve_result") == 3) { + throw new BadRequestException("The merchant failed the audit!"); + } + String pdfPath = this.getClass().getClassLoader().getResource("").getPath() + "/templates/pdf/terms_and_conditions.pdf"; + String fileName = clientMoniker + "_Terms_And_Conditions.pdf"; + publishExcelCardPDFFile(clientMoniker, manage, fileName, pdfPath, new JSONObject(), TERMS_AND_CONDITIONS_FILE); + } + + private void publishExcelCardPDFFile(String clientMoniker, JSONObject manager, String fileName, String pdfPath, JSONObject info, String fileLabel) { + try { + PdfUtils pdu = new PdfUtils(); + pdu.setTemplatePdfPath(pdfPath); + pdu.setPdfTemplate(info); + try { + File file = new File(fileName); + ByteArrayOutputStream bos = pdu.templetPdfBos(file); + InputStream stream = new ByteArrayInputStream(bos.toByteArray()); + JSONObject fileRes = attachmentClient.uploadFile(stream, fileName, false); + if (fileRes != null) { + importCardAgreeFile(clientMoniker, manager, fileRes.getString("url"), fileLabel); + } + stream.close(); + } catch (Exception e) { + logger.error("合同制作出现问题:", e); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void importCardAgreeFile(String clientMoniker, JSONObject manager, String sourceFile, String fileLabel) { + JSONObject client = getClientInfoByMoniker(clientMoniker); + if (client == null) { + throw new InvalidShortIdException(); + } + if (sourceFile != null) { + List existFiles = clientFilesMapper.findFileByClientAndType(client.getIntValue("client_id"), fileLabel); + JSONObject existFile = null; + if (!CollectionUtils.isEmpty(existFiles)) { + existFile = existFiles.get(0); + } + Date now = new Date(); + JSONObject file = new JSONObject(); + file.put("file_name", fileLabel); + file.put("file_value", sourceFile); + file.put("client_id", client.getIntValue("client_id")); + file.put("last_update_date", now); + file.put("status", 1); + file.put("is_valid", 1); + if (manager == null) { + file.put("last_update_by", "System Import"); + } else { + file.put("last_update_by", manager.getString("display_name")); + } + JSONObject contract = clientsContractMapper.findByClientId(client.getIntValue("client_id")); + if (contract == null || now.compareTo(contract.getDate("expiry_date")) > 0 || !contract.getBoolean("has_sign") || existFile == null + || existFile.isEmpty()) { + clientFilesMapper.save(file); + } else { + file.put("file_id", existFile.getString("file_id")); + clientFilesMapper.update(file); + } + } + } + + public void saveLegalAndMarketingInfo(JSONObject partner) { + JSONObject representativeInfo = new JSONObject(); + representativeInfo.put("client_id", partner.getIntValue("client_id")); + representativeInfo.put("representative_person", partner.getString("legal_representative_person")); + representativeInfo.put("phone", partner.getString("legal_representative_phone")); + representativeInfo.put("email", partner.getString("legal_representative_email")); + representativeInfo.put("job_title", partner.getString("legal_representative_job")); + representativeInfo.put("address", partner.getString("registered_address")); + representativeInfo.put("suburb", partner.getString("registered_suburb")); + representativeInfo.put("postcode", partner.getString("registered_postcode")); + representativeInfo.put("state", partner.getString("registered_state")); + representativeInfo.put("legal_representative_wechatid", partner.getString("legal_representative_wechatid")); + representativeInfo.put("marketing_person", partner.getString("marketing_person")); + representativeInfo.put("marketing_phone", partner.getString("marketing_phone")); + representativeInfo.put("marketing_email", partner.getString("marketing_email")); + representativeInfo.put("marketing_job_title", partner.getString("marketing_job")); + representativeInfo.put("marketing_wechatid", partner.getString("marketing_wechatid")); + sysClientLegalPersonMapper.save(representativeInfo); + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/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/enums/UPayAuthFileEnum.java b/src/main/java/au/com/royalpay/payment/manage/merchants/enums/UPayAuthFileEnum.java index 4118df321..c81cfb906 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/enums/UPayAuthFileEnum.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/enums/UPayAuthFileEnum.java @@ -2,11 +2,18 @@ package au.com.royalpay.payment.manage.merchants.enums; public enum UPayAuthFileEnum { ALL(""), - UPAY_APPLICATION_FORM("upay_application_form"), - UPAY_AGREEMENT_FILE("upay_agreement_file"), - UPAY_OFFER_LETTER("upay_offer_letter"), + CLIENT_BANK_FILE("client_bank_file"), + CLIENT_COMPANY_FILE("client_company_file"), UPAY_DRIVER_LICENSE("upay_driver_license"), - UPAY_RESIDENCE_CERTIFICATE("upay_residence_certificate"); + REFUND_EXCHANGE_POLICY("refund_exchange_policy"), + UPAY_PRIVACY_POLICY("upay_privacy_policy"), + CARD_SECURITY_POLICY("card_security_policy"), + UPAY_OFFER_LETTER("upay_offer_letter"), + UPAY_PROMOTIONAL_OFFER("upay_promotional_offer"), + UPAY_TERMS_CONDITIONS("upay_terms_conditions"), + KYC_UTILITY_BILL_FILE("kyc_utility_bill_file"), + UPAY_APPLICATION_FORM("upay_application_form"), + UPAY_DESC_FILE("upay_desc_file"); private final String fileName; @@ -19,10 +26,17 @@ public enum UPayAuthFileEnum { } public String[] getFileNameArrays() { - return new String[]{UPAY_APPLICATION_FORM.getFileName(), - UPAY_AGREEMENT_FILE.getFileName(), - UPAY_OFFER_LETTER.getFileName(), + return new String[]{CLIENT_BANK_FILE.getFileName(), + CLIENT_COMPANY_FILE.getFileName(), UPAY_DRIVER_LICENSE.getFileName(), - UPAY_RESIDENCE_CERTIFICATE.getFileName()}; + REFUND_EXCHANGE_POLICY.getFileName(), + UPAY_PRIVACY_POLICY.getFileName(), + CARD_SECURITY_POLICY.getFileName(), + UPAY_OFFER_LETTER.getFileName(), + UPAY_PROMOTIONAL_OFFER.getFileName(), + UPAY_TERMS_CONDITIONS.getFileName(), + KYC_UTILITY_BILL_FILE.getFileName(), + UPAY_APPLICATION_FORM.getFileName(), + UPAY_DESC_FILE.getFileName()}; } } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index 8a0fa3db1..a0172d106 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()); @@ -209,11 +209,6 @@ public class PartnerManageController { clientManager.updateClientRpayPaymentConfig(manager, clientMoniker, rpaySubMerchantInfo); } - @ManagerMapping(value = "/{clientMoniker}/yeepay_payment_config", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER}) - public void updatePartnerYeepayPaymentConfig(@PathVariable String clientMoniker, @RequestBody JSONObject yeepaySubMerchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - clientManager.updateClientYeepayPaymentConfig(manager, clientMoniker, yeepaySubMerchantInfo); - } - @ManagerMapping(value = "/{clientMoniker}/ali_sub_merchant_id", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR}) public void updateAliSubMerchantId(@PathVariable String clientMoniker, @RequestBody JSONObject aliSubMerchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.updateAliSubMerchantId(manager, clientMoniker, aliSubMerchantInfo); @@ -279,14 +274,19 @@ public class PartnerManageController { clientManager.auditClient(manager, clientMoniker, pass.getIntValue("pass")); } + @ManagerMapping(value = "/{clientMoniker}/card_audit", method = RequestMethod.PUT, role = ManagerRole.OPERATOR) + public void auditCardPartner(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker, @RequestBody JSONObject pass) { + clientManager.auditCardClient(manager, clientMoniker, pass.getIntValue("pass")); + } + @ManagerMapping(value = "/{clientMoniker}/aduit/green_channel", method = RequestMethod.PUT, role = ManagerRole.OPERATOR) public void auditPartnerGreenChannel(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker) { clientManager.auditClientGreenChannel(manager, clientMoniker); } @ManagerMapping(value = "/{clientMoniker}/audit/send_email", method = RequestMethod.PUT, role = {ManagerRole.BD_USER, ManagerRole.OPERATOR}) - public void resendEmail(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker) { - clientManager.checkAndSendInitEmail(manager, clientMoniker); + public void resendEmail(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @PathVariable String clientMoniker,@RequestParam String type) { + clientManager.checkAndSendInitEmail(manager, clientMoniker,type); } @ManagerMapping(value = "/{clientMoniker}/audit/email_sending_status", method = RequestMethod.PUT, role = ManagerRole.OPERATOR) @@ -299,6 +299,11 @@ public class PartnerManageController { clientManager.refusePartner(clientMoniker, manager, refuse.getString("refuse_remark")); } + @ManagerMapping(value = "/{clientMoniker}/card_audit/refuse", method = RequestMethod.PUT, role = ManagerRole.OPERATOR) + public void cardRefusePartner(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody JSONObject refuse) { + clientManager.cardRefusePartner(clientMoniker, manager, refuse.getString("refuse_remark")); + } + @ManagerMapping(value = "/{clientMoniker}/common_sub_merchant_id", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR}) public void switchCommonSubMerchantId(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.switchPermission(manager, clientMoniker, "common_sub_merchant_id", pass.getBooleanValue("allow")); @@ -306,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")); } /** @@ -522,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); } //创建子商户 @@ -584,11 +589,27 @@ public class PartnerManageController { return clientManager.getSourceAgreeFiles(manager, clientMoniker); } + /** + * 下载商户卡支付合规文件 + * + * @param clientMoniker + */ + @ManagerMapping(value = "/{clientMoniker}/file/source_card_agree_file", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER, ManagerRole.SERVANT}) + public JSONObject getSourceCardAgreeAuthFiles(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, + @RequestParam("fileName") String fileName) { + return clientManager.getSourceCardAgreeFiles(clientMoniker, manager, fileName); + } + @ManagerMapping(value = "/auth_file/{fileId}/delete", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER}) public void deleteAuthFiles(@PathVariable String fileId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.deleteAuthFilesByAdmin(fileId); } + @ManagerMapping(value = "/auth_file/{fileId}/mw_delete", method = RequestMethod.PUT, role = {ManagerRole.OPERATOR, ManagerRole.BD_USER}) + public void deleteMWAuthFiles(@PathVariable String fileId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.deleteMWAuthFilesByAdmin(fileId); + } + @ManagerMapping(value = "/{clientMoniker}/file", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR, ManagerRole.BD_USER}) public void uploadAuthFiles(@PathVariable String clientMoniker, @RequestBody ClientAuthFilesInfo filesInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { @@ -597,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); } @@ -623,11 +644,33 @@ public class PartnerManageController { clientManager.commitToCompliance(clientMoniker, manager); } + /** + * 提交资料,BD提交卡支付最终审核 + * + * @param clientMoniker + * @param manager + */ + @ManagerMapping(value = "/{clientMoniker}/to_card_compliance", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.BD_USER}) + public void commitToCardCompliance(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.commitToCardCompliance(clientMoniker, manager); + } + @ManagerMapping(value = "/{clientMoniker}/make_agree_file", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER}) public void commitToDoAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.commitToDoAgreeFile(clientMoniker, manager); } + /** + * 提交资料,申请卡支付 + * + * @param clientMoniker + * @param manager + */ + @ManagerMapping(value = "/{clientMoniker}/make_card_agree_file", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.BD_USER}) + public void commitToDoCardAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.commitToDoCardAgreeFile(clientMoniker, manager); + } + @ManagerMapping(value = "/{clientMoniker}/compliance/green_channel", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.BD_USER}) public void commitToGreenChannel(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { clientManager.commitToGreenChannel(clientMoniker, manager); @@ -643,6 +686,34 @@ public class PartnerManageController { clientManager.getAggregateAgreeFile(clientMoniker, manager, false); } + /** + * 制作卡支付合同 + * + * @param clientMoniker + * @param manager + * @throws Exception + */ + @ManagerMapping(value = "/{clientMoniker}/export/aggregate/card_agree_pdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR}) + public void exportAggregateCardAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) throws Exception { + clientManager.getAggregateCardAgreeFile(clientMoniker, manager, false); + } + + /** + * 制作促销合同 + * + * @param clientMoniker + * @param manager + * @throws Exception + */ + @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}) public void temporaryExportPDF(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) throws Exception { clientManager.temporaryExportPdf(clientMoniker, manager, httpResponse); @@ -658,6 +729,17 @@ public class PartnerManageController { clientManager.completeAgree(clientMoniker, manager); } + /** + * 信用卡合同生成完毕通知BD + * + * @param clientMoniker + * @param manager + */ + @ManagerMapping(value = "/{clientMoniker}/notify/cardCompleteAgree", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) + public void cardCompleteAgree(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.cardCompleteAgree(clientMoniker, manager); + } + @ManagerMapping(value = "/{clientMoniker}/download/complianceAsZIP", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) public void downloadComplianceZip(@PathVariable String clientMoniker, HttpServletResponse response) throws Exception { clientManager.downloadComplianceZip(clientMoniker, response); @@ -681,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}) @@ -732,11 +814,6 @@ public class PartnerManageController { return clientManager.listRpaySubMerchantIdApplys(manager, clientMoniker); } - @ManagerMapping(value = "/{clientMoniker}/list_yeepay_sub_applices", method = RequestMethod.GET, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public List listYeepaySubMerchantIdApplys(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - return clientManager.listYeepaySubMerchantIdApplys(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); @@ -821,16 +898,6 @@ public class PartnerManageController { clientManager.subRpayMerchantApplication(clientMoniker, merchantInfo, manager); } - @ManagerMapping(value = "/{clientMoniker}/registYeepaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public void subYeepayMerchantApplication(@PathVariable String clientMoniker, @RequestBody JSONObject merchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - clientManager.subYeepayMerchantApplication(clientMoniker, merchantInfo, manager); - } - - @ManagerMapping(value = "/{clientMoniker}/updateYeepaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public void reSubYeepayMerchantApplication(@PathVariable String clientMoniker, @RequestBody JSONObject merchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - clientManager.reSubYeepayMerchantApplication(clientMoniker, merchantInfo, manager); - } - @GetMapping("/compliance") @RequireManager(role = {ManagerRole.OPERATOR}) public JSONObject lisPartnersByCompliance(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, PartnerQuery query) { @@ -853,10 +920,6 @@ public class PartnerManageController { return clientManager.cbBankPayLink(clientMoniker); } - @ManagerMapping(value = "/{clientMoniker}/addYeepaySubMerchantId", method = RequestMethod.POST, role = {ManagerRole.OPERATOR, ManagerRole.ADMIN}) - public void subYeepayMerchantAdd(@PathVariable String clientMoniker, @RequestBody JSONObject merchantInfo, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - clientManager.subYeepayMerchantAdd(clientMoniker, merchantInfo, manager); - } @GetMapping("/{clientMoniker}/cb_bankpay/link/pc") public void switchPaymentWayPC(@PathVariable String clientMoniker, HttpServletResponse response) throws IOException { @@ -878,55 +941,69 @@ 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}) public RPayMerchantEntity queryMWMerchantInfo(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { return clientManager.queryMWMerchantInfo(clientMoniker, manager); } + + /** + * 启用/禁用国际卡支付 + * + * @param clientMoniker + */ + @ManagerMapping(value = "/{clientMoniker}/payment_card_permission", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.OPERATOR}) + public void switchInternationalCard(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + clientManager.modifyUPayProfile(manager, clientMoniker, "enable_international_card", pass.getBooleanValue("allow")); + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java index 2f273da61..50c1ababd 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java @@ -18,10 +18,10 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.net.util.Base64; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; diff --git a/src/main/java/au/com/royalpay/payment/manage/organizations/beans/OrgInfo.java b/src/main/java/au/com/royalpay/payment/manage/organizations/beans/OrgInfo.java index 1377d2723..2b315e57f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/organizations/beans/OrgInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/organizations/beans/OrgInfo.java @@ -26,7 +26,6 @@ public class OrgInfo { private String remark; private Double alipay_rate_value; private Double wechat_rate_value; - private Double bestpay_rate_value; private Double alipayonline_rate_value; private Double cb_bankpay_rate_value; private Double rpaypmt_card_rate_value; @@ -182,14 +181,6 @@ public class OrgInfo { this.wechat_rate_value = wechat_rate_value; } - public Double getBestpay_rate_value() { - return bestpay_rate_value; - } - - public void setBestpay_rate_value(Double bestpay_rate_value) { - this.bestpay_rate_value = bestpay_rate_value; - } - public Double getAlipayonline_rate_value() { return alipayonline_rate_value; } diff --git a/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java index 6cd187b79..42a2cf925 100644 --- a/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java @@ -339,7 +339,7 @@ public class OrgManagerImpl implements OrgManager { JSONArray rate1 = new JSONArray(); JSONArray rate2 = new JSONArray(); if(orgObject.getString("commission_type").equals(json.getString("commission_type"))){ - String[] rates = new String[]{"alipay_rate_value","wechat_rate_value","bestpay_rate_value","alipayonline_rate_value","jd_rate_value","cb_bankpay_rate_value"}; + String[] rates = new String[]{"alipay_rate_value","wechat_rate_value","alipayonline_rate_value","cb_bankpay_rate_value"}; for (String rateName: rates ){ if(StringUtils.isEmpty(orgObject.getString(rateName))){ rate1.add(rateName); diff --git a/src/main/java/au/com/royalpay/payment/manage/permission/manager/scanner/PartnerPermissionScanner.java b/src/main/java/au/com/royalpay/payment/manage/permission/manager/scanner/PartnerPermissionScanner.java index 263d0ba74..adfb62384 100644 --- a/src/main/java/au/com/royalpay/payment/manage/permission/manager/scanner/PartnerPermissionScanner.java +++ b/src/main/java/au/com/royalpay/payment/manage/permission/manager/scanner/PartnerPermissionScanner.java @@ -23,8 +23,6 @@ import java.util.Map; */ @Component public class PartnerPermissionScanner implements BeanPostProcessor, PermissionPartnerReader { - private Logger logger = LoggerFactory.getLogger(getClass()); - private Map permissionNodes = new HashMap<>(); @Override @@ -55,7 +53,6 @@ public class PartnerPermissionScanner implements BeanPostProcessor, PermissionPa PermissionNode node = new PermissionNode(controller.getSimpleName(), method.getName()); getRequestInfo(node, clazzRequestMapping, methodMapping); node.setPartnerPermissions(clazzPermission, methodPermission); - logger.debug("register permission:" + node.getFuncName() + ":" + node.getRequestId()); if (permissionNodes.containsKey(node.getFuncId())) { throw new RuntimeException("Duplicated permission function ID:" + controller.getName() + "." + method.getName()); } diff --git a/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadOnlyConnectionInterceptor.java b/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadOnlyConnectionInterceptor.java index f67f48b4c..eaa04b71a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadOnlyConnectionInterceptor.java +++ b/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadOnlyConnectionInterceptor.java @@ -3,8 +3,6 @@ package au.com.royalpay.payment.manage.pos.datasource; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.core.Ordered; import org.springframework.stereotype.Component; @@ -17,18 +15,14 @@ import org.springframework.stereotype.Component; @Component public class ReadOnlyConnectionInterceptor implements Ordered { - public static final Logger logger = LoggerFactory.getLogger(ReadOnlyConnectionInterceptor.class); - @Around("@annotation(readOnlyConnection)") - public Object proceed(ProceedingJoinPoint proceedingJoinPoint,ReadOnlyConnection readOnlyConnection) throws Throwable { + public Object proceed(ProceedingJoinPoint proceedingJoinPoint, ReadOnlyConnection readOnlyConnection) throws Throwable { try { - logger.info("set database connection to read only"); DbContextHolder.setDbType(DbContextHolder.DbType.SLAVE); Object result = proceedingJoinPoint.proceed(); return result; - }finally { + } finally { DbContextHolder.clearDbType(); - logger.info("restore database connection"); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/promotion/web/PromotionRootController.java b/src/main/java/au/com/royalpay/payment/manage/promotion/web/PromotionRootController.java index 1c3ad966f..f271b174c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/promotion/web/PromotionRootController.java +++ b/src/main/java/au/com/royalpay/payment/manage/promotion/web/PromotionRootController.java @@ -53,13 +53,6 @@ public class PromotionRootController { @GetMapping("/clients/{clientMoniker}/aggregate") public void clientPromotionRoot(@PathVariable String clientMoniker, @RequestHeader("User-Agent") String userAgent, HttpServletResponse response) { String url = null; - /*if (userAgent.toLowerCase().contains("micromessenger") ) { - url ="/promotions/clients/"+clientMoniker+"/alipay"; - } - if (userAgent.toLowerCase().contains("bestpay") ) { - url ="/promotions/clients/"+clientMoniker+"/alipay"; - - }*/ if (userAgent.toLowerCase().contains("alipayclient") ) { url ="/promotions/clients/"+clientMoniker+"/alipay"; diff --git a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java index f7655bfd9..3fda9e882 100644 --- a/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/risk/core/impl/RiskMerchantServiceImpl.java @@ -254,9 +254,6 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { attention.put("is_valid", 1); attention.put("enjoin_wechat", params.getBoolean("enjoin_wechat")== null ? true : params.getBoolean("enjoin_wechat")); attention.put("enjoin_alipay", params.getBoolean("enjoin_alipay")== null ? true : params.getBoolean("enjoin_alipay")); - attention.put("enjoin_bestpay", params.getBoolean("enjoin_bestpay")== null ? true : params.getBoolean("enjoin_bestpay")); - attention.put("enjoin_jd", params.getBoolean("enjoin_jd")== null ? true : params.getBoolean("enjoin_jd")); - attention.put("enjoin_hf", params.getBoolean("enjoin_hf")== null ? true : params.getBoolean("enjoin_hf")); attention.put("creation_date", params.getDate("creation_date")==null ? new Date() : params.getDate("creation_date")); attention.put("creation_by", manager.getString("manager_id")); attention.put("remark", params.getString("remark")); @@ -346,9 +343,6 @@ public class RiskMerchantServiceImpl implements RiskMerchantService { } attentionMerchant.put("enjoin_wechat", attention.getBoolean("enjoin_wechat")); attentionMerchant.put("enjoin_alipay", attention.getBoolean("enjoin_alipay")); - attentionMerchant.put("enjoin_bestpay", attention.getBoolean("enjoin_bestpay")); - attentionMerchant.put("enjoin_jd", attention.getBoolean("enjoin_jd")); - attentionMerchant.put("enjoin_hf", attention.getBoolean("enjoin_hf")); attentionMerchant.put("last_update_date", new Date()); attentionMerchant.put("last_update_by", manager.getString("manager_id")); riskAttentionMerchantsAMapper.update(attentionMerchant); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java index 7e44371cd..5cc63f8a7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java @@ -48,6 +48,8 @@ public interface SignInAccountService { JSONObject clientWechatAppSignIn(String openId); + JSONObject clientAppleSignIn(String appleUserId); + JSONObject clientWechatAppSignInByUnionId(String unionId); String ForgetPassword(String partner_code) throws Exception; diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInStatusManager.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInStatusManager.java index 94ada22e5..b6ef0c88e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInStatusManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInStatusManager.java @@ -1,5 +1,6 @@ package au.com.royalpay.payment.manage.signin.core; +import au.com.royalpay.payment.manage.appclient.beans.AppleLoginBean; import au.com.royalpay.payment.manage.signin.beans.LoginInfo; import com.alibaba.fastjson.JSONObject; import org.springframework.web.servlet.ModelAndView; @@ -50,6 +51,8 @@ public interface SignInStatusManager { JSONObject partnerWechatAppSignIn(String code); + JSONObject mchAppleSignIn(AppleLoginBean appleLoginBean); + String clientWechatSignIn(String openid); JSONObject newClientWechatSignInQRCode(); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java index 47176c010..d8d6fd340 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java @@ -394,6 +394,17 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati return account; } + @Override + public JSONObject clientAppleSignIn(String appleUserId) { + JSONObject account = clientAccountMapper.findByAppleUserId(appleUserId); + if (account == null) { + return null; + } + publisher.publishEvent( + new ClientLoginEvent(this, account.getIntValue("client_id"), account.getString("account_id"), RequestEnvironment.getClientIp(), "wechat")); + return account; + } + @Override public JSONObject clientWechatAppSignInByUnionId(String unionId) { if (StringUtils.isBlank(unionId) || unionId == "" || unionId == null) { @@ -498,7 +509,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati "company_phone", "suburb", "postcode", "state", "contact_person", "contact_phone", "contact_email", "short_name", "logo_url", "enable_refund", "enable_refund_auth", "retail_surcharge", "require_custinfo", "require_remark", "logo_thumbnail", "creator", "create_time", "approver", "approve_result", "approve_time", "open_status", "timezone", "has_children", "source", "customer_surcharge_rate", "enable_alipay", "enable_wechat", - "enable_bestpay", "manual_settle", "skip_clearing", "mail_confirm", "surcharge_mode", "company_photo", "store_photo", "company_website", "contact_job", "sub_manage","enable_rpaypmt_card","enable_rpaypmt_dd"}; + "enable_bestpay", "manual_settle", "skip_clearing", "mail_confirm", "surcharge_mode", "company_photo", "store_photo", "company_website", "contact_job", "sub_manage", "enable_rpaypmt_card", "enable_rpaypmt_dd"}; for (String col : columns) { simpleClient.put(col, client.get(col)); } diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInStatusManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInStatusManagerImpl.java index 2acc88797..0f9952ecc 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInStatusManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInStatusManagerImpl.java @@ -1,5 +1,6 @@ package au.com.royalpay.payment.manage.signin.core.impls; +import au.com.royalpay.payment.manage.appclient.beans.AppleLoginBean; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; import au.com.royalpay.payment.manage.signin.beans.LoginInfo; import au.com.royalpay.payment.manage.signin.core.SignInAccountService; @@ -10,6 +11,8 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.utils.QRCodeUtils; +import au.com.royalpay.payment.tools.utils.apple.AppleAuthUtils; +import au.com.royalpay.payment.tools.utils.apple.UserClaim; import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; @@ -38,7 +41,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager { @Resource private ClientAccountMapper clientAccountMapper; private final String CLIENT_LOGIN_WECHAT_BIND_PREFIX = "CLIENT_LOGIN_WECHAT_BIND_PREFIX"; - private final String CLIENT_LOGIN_PHONE_BIND_PREFIX = "CLIENT_LOGIN_PHONE_BIND_PREFIX"; + private final String CLIENT_LOGIN_PHONE_BIND_PREFIX = "CLIENT_LOGIN_PHONE_BIND_PREFIX"; @Override public JSONObject getCurrentManager(String statusKey) { @@ -63,9 +66,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager { return null; } op.expire(30, TimeUnit.MINUTES); - - JSONObject account = signInAccountService.getClient(accountId); - return account; + return signInAccountService.getClient(accountId); } private String partnerLoginRedisKey(String statusKey) { @@ -86,7 +87,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager { JSONObject account = clientAccountMapper.findOneByPhoneAndCreateTimeDesc(phone, "+" + nationCode); if (account == null) { String expireMin = "5"; - stringRedisTemplate.boundValueOps(getClientLoginPhoneBindRedisKey(phone,nationCode)).set(phone, Long.parseLong(expireMin), TimeUnit.MINUTES); + stringRedisTemplate.boundValueOps(getClientLoginPhoneBindRedisKey(phone, nationCode)).set(phone, Long.parseLong(expireMin), TimeUnit.MINUTES); return null; } stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES); @@ -99,11 +100,14 @@ public class SignInStatusManagerImpl implements SignInStatusManager { @Override public String verifyClientAccountLogin(LoginInfo loginInfo, String verfiyType) { - JSONObject account = signInAccountService.clientAccountCheck(loginInfo);; + JSONObject account = signInAccountService.clientAccountCheck(loginInfo); if ("phone".equals(verfiyType)) { if (account.containsKey("contact_phone")) { throw new BadRequestException("The account has been linked to the phone number!"); } + } else if (StringUtils.equalsIgnoreCase("apple", verfiyType) + && StringUtils.isNotEmpty(account.getString("apple_userid"))) { + throw new BadRequestException("The account has been binded and exist appleId!"); } else { if (account.containsKey("wechat_openid")) { throw new BadRequestException("The account has been linked to the wechat!"); @@ -286,6 +290,31 @@ public class SignInStatusManagerImpl implements SignInStatusManager { return account; } + @Override + public JSONObject mchAppleSignIn(AppleLoginBean appleLoginBean) { + UserClaim userClaim = AppleAuthUtils.verifyIdentifyToken(appleLoginBean.getIdentityToken()); + if (!StringUtils.equalsIgnoreCase(userClaim.getSub(), appleLoginBean.getUser())) { + throw new ForbiddenException("apple userinfo is error"); + } + JSONObject account = signInAccountService.clientAppleSignIn(userClaim.getSub()); + if (account == null || account.isEmpty()) { + return new JSONObject() {{ + put("apple_userid", userClaim.getSub()); + put("bind_status", false); + }}; + } + String statusKey = newStatusKey(); + JSONObject result = new JSONObject(); + stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES); + account = getCurrentClient(statusKey); + account.put("sign_key", statusKey); + result.put("account", account); + account.put("apple_userid", userClaim.getSub()); + result.put("bind_status", true); + result.put("status", "success"); + return result; + } + @Override public String clientWechatSignIn(String openid) { JSONObject account = signInAccountService.clientWechatSignIn(openid); @@ -391,21 +420,21 @@ public class SignInStatusManagerImpl implements SignInStatusManager { @Override public JSONObject clientAppWechatSignIn(String code) { JSONObject user = mpClientAppWechatApiProvider.getApi("merchant-app").appLoginUser(code); - if(user==null){ + if (user == null) { throw new BadRequestException("WeChat users do not exist"); } String unionId = user.getString("unionid"); String openId = user.getString("openid"); JSONObject account = signInAccountService.clientWechatOneSignIn(unionId); if (account == null) { - JSONObject wechatUserInfo = mpClientAppWechatApiProvider.getApi("merchant-app").appUserInfo(openId,user.getString("access_token")); + JSONObject wechatUserInfo = mpClientAppWechatApiProvider.getApi("merchant-app").appUserInfo(openId, user.getString("access_token")); JSONObject res = new JSONObject(); String nickName = wechatUserInfo.getString("nickname"); res.put("bind_status", false); res.put("app_openid", openId); res.put("status", "success"); String expireMin = "5"; - stringRedisTemplate.boundValueOps(getClientLoginWechatBindRedisKey(openId)).set(openId+"&"+nickName+"&"+unionId, Long.parseLong(expireMin), TimeUnit.MINUTES); + stringRedisTemplate.boundValueOps(getClientLoginWechatBindRedisKey(openId)).set(openId + "&" + nickName + "&" + unionId, Long.parseLong(expireMin), TimeUnit.MINUTES); return res; } String statusKey = newStatusKey(); @@ -413,20 +442,20 @@ public class SignInStatusManagerImpl implements SignInStatusManager { stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES); account = getCurrentClient(statusKey); account.put("sign_key", statusKey); - result.put("account",account); + result.put("account", account); result.put("app_openid", unionId); result.put("bind_status", true); result.put("status", "success"); return result; } - private String getClientLoginWechatBindRedisKey(String openId){ - return "login:"+":"+CLIENT_LOGIN_WECHAT_BIND_PREFIX + "&"+openId; + private String getClientLoginWechatBindRedisKey(String openId) { + return "login:" + ":" + CLIENT_LOGIN_WECHAT_BIND_PREFIX + "&" + openId; } @Override - public JSONObject verifyClientLoginWechatBindCode(String openId){ + public JSONObject verifyClientLoginWechatBindCode(String openId) { String rediskey = getClientLoginWechatBindRedisKey(openId); String codeValue = stringRedisTemplate.boundValueOps(rediskey).get(); if (codeValue == null || !codeValue.split("&")[0].equals(openId)) { @@ -435,18 +464,18 @@ public class SignInStatusManagerImpl implements SignInStatusManager { String nickName = codeValue.split("&")[1]; String unionId = codeValue.split("&")[2]; stringRedisTemplate.delete(rediskey); - return new JSONObject(){{ - put("nick_name",nickName); - put("union_id",unionId); + return new JSONObject() {{ + put("nick_name", nickName); + put("union_id", unionId); }}; } - private String getClientLoginPhoneBindRedisKey(String phone,String nationCode){ - return "login:"+CLIENT_LOGIN_PHONE_BIND_PREFIX + "&"+nationCode+"&"+phone; + private String getClientLoginPhoneBindRedisKey(String phone, String nationCode) { + return "login:" + CLIENT_LOGIN_PHONE_BIND_PREFIX + "&" + nationCode + "&" + phone; } - public void verifyClientLoginPhoneBindCode(String phone,String nationCode){ - String rediskey = getClientLoginPhoneBindRedisKey(phone,nationCode); + public void verifyClientLoginPhoneBindCode(String phone, String nationCode) { + String rediskey = getClientLoginPhoneBindRedisKey(phone, nationCode); String codeValue = stringRedisTemplate.boundValueOps(rediskey).get(); if (codeValue == null || !codeValue.equals(phone)) { throw new BadRequestException("The phone number is for application binding"); @@ -455,7 +484,6 @@ public class SignInStatusManagerImpl implements SignInStatusManager { } - private void lockRandomCodeId(String codeId) { stringRedisTemplate.boundValueOps(redisPrefix + "partner_signin" + codeId).set(codeId, 30, TimeUnit.SECONDS); } diff --git a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java index a7b70591f..dd7f85f77 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAConfig.java @@ -1,9 +1,12 @@ package au.com.royalpay.payment.manage.support.abafile; import au.com.royalpay.payment.tools.exceptions.BadRequestException; +import au.com.royalpay.payment.tools.merchants.beans.BalanceGroup; +import org.apache.commons.lang3.ArrayUtils; import org.springframework.boot.context.properties.ConfigurationProperties; import java.util.*; +import java.util.stream.Collectors; /** * Create by yixian at 2018-06-25 17:39 @@ -12,24 +15,24 @@ import java.util.*; public class ABAConfig { private Map bank = new HashMap<>(); - private String defaultBank; - private String remainsTo; - public ABAFile initFile(String bank, Date settleDate) { + public ABAFile initFile(BalanceGroup group, String bank, Date settleDate) { ABABase base = this.bank.get(bank); if (base == null) { throw new BadRequestException("Invalid bank:" + bank); } + if (!base.acceptBalanceGroup(group)) { + throw new BadRequestException("Balance group not match:" + group + "," + bank); + } return base.initFile(settleDate); } - public String getDefaultBank() { - return defaultBank; - } - - public ABAConfig setDefaultBank(String defaultBank) { - this.defaultBank = defaultBank; - return this; + public String getRemainsTo(BalanceGroup group) { + return bank.entrySet().stream() + .filter(entry -> entry.getValue().acceptBalanceGroup(group)) + .filter(entry -> !entry.getValue().isManualSending()) + .map(Map.Entry::getKey) + .findFirst().orElse(null); } public Map getBank() { @@ -45,17 +48,11 @@ public class ABAConfig { return this; } - public String getRemainsTo() { - return remainsTo; - } - - public ABAConfig setRemainsTo(String remainsTo) { - this.remainsTo = remainsTo; - return this; - } - - public List availableBanks() { - return new ArrayList<>(bank.keySet()); + public List availableBanks(BalanceGroup group) { + return bank.entrySet().stream() + .filter(entry -> entry.getValue().acceptBalanceGroup(group)) + .map(Map.Entry::getKey) + .collect(Collectors.toList()); } public static class ABABase { @@ -65,6 +62,7 @@ public class ABAConfig { private String bsb; private String accountNo; private String accountName; + private BalanceGroup[] balanceGroup; public ABAFile initFile(Date settleDate) { return new ABAFile(this, settleDate); @@ -123,5 +121,18 @@ public class ABAConfig { this.accountName = accountName; return this; } + + public BalanceGroup[] getBalanceGroup() { + return balanceGroup; + } + + public ABABase setBalanceGroup(BalanceGroup[] balanceGroup) { + this.balanceGroup = balanceGroup; + return this; + } + + public boolean acceptBalanceGroup(BalanceGroup group) { + return ArrayUtils.contains(balanceGroup, group); + } } } diff --git a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABATemplate.java b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABATemplate.java index 0a82a12bf..9f9d9a41e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABATemplate.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABATemplate.java @@ -13,7 +13,6 @@ import javax.annotation.PostConstruct; @EnableConfigurationProperties(ABAConfig.class) public class ABATemplate { private static ABATemplate tpl; - @Autowired private ABAConfig config; @PostConstruct @@ -24,4 +23,10 @@ public class ABATemplate { public static ABAConfig getConfig() { return tpl.config; } + + @Autowired + public ABATemplate setConfig(ABAConfig config) { + this.config = config; + return this; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java b/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java index 3e3694e77..cf6447bbe 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/attachment/web/AttachmentController.java @@ -1,11 +1,9 @@ package au.com.royalpay.payment.manage.support.attachment.web; -import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient; import au.com.royalpay.payment.manage.permission.manager.RequireManager; import au.com.royalpay.payment.manage.permission.manager.RequirePartner; import au.com.royalpay.payment.tools.connections.attachment.core.AttachmentClient; import com.alibaba.fastjson.JSONObject; -import com.yeepay.yop.sdk.service.kj.model.FileUploadResult; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -22,8 +20,6 @@ import java.io.IOException; public class AttachmentController { @Resource private AttachmentClient attachmentClient; - @Resource - private YeePayClient yeePayClient; @PostMapping("/files") @RequirePartner @@ -32,13 +28,6 @@ public class AttachmentController { return attachmentClient.uploadFile(file,false); } - @PostMapping("/yeepayFiles") - @RequirePartner - @RequireManager - public FileUploadResult uploadYeepayImage(@RequestParam MultipartFile file) throws IOException { - return yeePayClient.uploadFile(file.getOriginalFilename(),"VOUCHER",file.getInputStream()); - } - @PostMapping("/riskFiles") public JSONObject uploadRiskImage(@RequestParam MultipartFile file) throws IOException { return attachmentClient.uploadFile(file,false); diff --git a/src/main/java/au/com/royalpay/payment/manage/task/OrgCommissionTask.java b/src/main/java/au/com/royalpay/payment/manage/task/OrgCommissionTask.java index 614ef9212..1a7a42647 100644 --- a/src/main/java/au/com/royalpay/payment/manage/task/OrgCommissionTask.java +++ b/src/main/java/au/com/royalpay/payment/manage/task/OrgCommissionTask.java @@ -5,10 +5,12 @@ import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.util.Calendar; import java.util.Date; +import java.util.List; @Component @ConditionalOnProperty(value = "app.run-tasks", havingValue = "true") @@ -21,16 +23,18 @@ public class OrgCommissionTask { @Scheduled(cron = "0 15 0 1 * ?") public void generateOrgCommission() { - Calendar monthCal = Calendar.getInstance(); - monthCal.setTime(new Date()); - int year = monthCal.get(Calendar.YEAR); - int month = monthCal.get(Calendar.MONTH); - if (month == 0) { - year = year - 1; - month = 12; - } - String monthStr = year + "-" + month; - cityPartnerPrizeService.generate(monthStr); + synchronizedScheduler.executeProcess("manage_task:cityPartnerPrize", 120_000, () -> { + Calendar monthCal = Calendar.getInstance(); + monthCal.setTime(new Date()); + int year = monthCal.get(Calendar.YEAR); + int month = monthCal.get(Calendar.MONTH); + if (month == 0) { + year = year - 1; + month = 12; + } + String monthStr = year + "-" + month; + cityPartnerPrizeService.generate(monthStr); + }); } } diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java index b7627151d..a9e3a978a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/TradeLogService.java @@ -36,6 +36,8 @@ public interface TradeLogService { void exportTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception; + void exportUpayTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception; + void exportTransFlowApi(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception; void exportExcel(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception; diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index 07e2124c1..f6790a08b 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; @@ -26,7 +29,6 @@ import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.lock.Locker; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; -import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils; import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils; @@ -57,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; import org.thymeleaf.context.Context; @@ -93,8 +94,6 @@ public class TradeLogServiceImpl implements TradeLogService { @Resource private RefundMapper refundMapper; @Resource - private RefundAuditionMapper refundAuditionMapper; - @Resource private ClientAccountMapper clientAccountMapper; @Resource private ClientManager clientManager; @@ -121,8 +120,6 @@ public class TradeLogServiceImpl implements TradeLogService { @Resource private ClearingLogMapper clearingLogMapper; @Resource - private StringRedisTemplate stringRedisTemplate; - @Resource private OrgManager orgManager; @Resource private ClientMapper clientMapper; @@ -143,6 +140,10 @@ public class TradeLogServiceImpl implements TradeLogService { private org.springframework.core.io.Resource trans_flow; @Value("classpath:/jasper/incremental_partner_invoice_gst.jasper") private org.springframework.core.io.Resource incremental_trans_flow; + @Value("classpath:/jasper/partner_upay_invoice_gst.jasper") + private org.springframework.core.io.Resource upay_trans_flow; + @Value("classpath:/jasper/incremental_partner_upay_invoice_gst.jasper") + private org.springframework.core.io.Resource incremental_upay_trans_flow; @Value("classpath:/jasper/royalpay_logo.png") private org.springframework.core.io.Resource logo; @Value("classpath:/jasper/trans_excel.jasper") @@ -178,14 +179,6 @@ public class TradeLogServiceImpl implements TradeLogService { if (timezone != null) { TimeZoneUtils.switchTimeZone(logs, timezone, "create_time", "confirm_time", "transaction_time"); } - if (account != null) { - PartnerRole role = PartnerRole.getRole(account.getIntValue("role")); - if (role == PartnerRole.MANAGER || role == PartnerRole.ADMIN) { - for (JSONObject log : logs) { - log.put("audition", !refundAuditionMapper.listAuditingRefundsOfOrder(log.getString("order_id")).isEmpty()); - } - } - } JSONObject result = PageListUtils.buildPageListResult(logs); JSONObject analysis = orderMapper.analysisOrders(params); result.put("analysis", analysis); @@ -215,14 +208,6 @@ public class TradeLogServiceImpl implements TradeLogService { if (timezone != null) { TimeZoneUtils.switchTimeZone(logs, timezone, "create_time", "confirm_time", "transaction_time"); } - if (account != null) { - PartnerRole role = PartnerRole.getRole(account.getIntValue("role")); - if (role == PartnerRole.MANAGER || role == PartnerRole.ADMIN) { - for (JSONObject log : logs) { - log.put("audition", !refundAuditionMapper.listAuditingRefundsOfOrder(log.getString("order_id")).isEmpty()); - } - } - } JSONObject result = PageListUtils.buildPageListResult(logs); JSONObject analysis = orderMapper.analysisOrders(params); result.put("analysis", analysis); @@ -580,6 +565,30 @@ public class TradeLogServiceImpl implements TradeLogService { return result; } + private JSONObject listPartnerTransFlowByExportPdf(TradeLogQuery query, JSONObject partner, String[] channels) throws Exception { + int clientId = partner.getIntValue("client_id"); + String timezone = partner.getJSONObject("client").getString("timezone"); + JSONObject params = query.toParams(timezone); + params.put("channel", channels); + clientManager.validateClients(clientId, params); + params.put("client_id", clientId); + clientManager.queryModifyClientIds(clientId, params); + List logs = transactionMapper.listTransFlow(params); + TimeZoneUtils.switchTimeZoneToString(logs, timezone, "dd/MM/yyyy HH:mm:ss", Collections.singletonList("transaction_time")); + TimeZoneUtils.switchTimeZoneToString(logs, timezone, "dd/MM/yyyy", Collections.singletonList("clearing_time")); + + final JSONObject analysis = analysisTransLogs(logs); + + JSONObject result = new JSONObject(); + result.put("data", logs); + analysis.put("balance", transactionMapper.analysisBalance(params)); + if (analysis.containsKey("paid_fee") && analysis.containsKey("refund_fee")) { + analysis.put("actual_fee", analysis.getBigDecimal("paid_fee").add(analysis.getBigDecimal("refund_fee"))); + } + result.put("analysis", analysis); + return result; + } + private JSONObject analysisTransLogs(List logs) { final JSONObject analysis = new JSONObject(); analysis.put("order_count", logs.size()); @@ -640,10 +649,18 @@ public class TradeLogServiceImpl implements TradeLogService { .filter(log -> log.getBigDecimal("settle_amount") != null) .map(log -> getSymbol(log).multiply(log.getBigDecimal("incremental_surcharge"))) .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); + analysis.put("total_transaction_fee", logs.parallelStream() + .filter(log -> log.getBigDecimal("settle_amount") != null) + .map(log -> getSymbol(log).multiply(log.getBigDecimal("transaction_fee"))) + .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); analysis.put("total_incremental_tax", logs.parallelStream() .filter(log -> log.getBigDecimal("settle_amount") != null) .map(log -> getSymbol(log).multiply(log.getBigDecimal("incremental_surcharge").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP))) .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); + analysis.put("total_transaction_fee_tax", logs.parallelStream() + .filter(log -> log.getBigDecimal("settle_amount") != null) + .map(log -> getSymbol(log).multiply(log.getBigDecimal("transaction_fee").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP))) + .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); analysis.put("total_surcharge", logs.parallelStream() .filter(log -> log.getBigDecimal("settle_amount") != null) .map(log -> getSymbol(log).multiply(log.getBigDecimal("total_surcharge").add(log.getBigDecimal("tax_amount")))) @@ -662,16 +679,6 @@ public class TradeLogServiceImpl implements TradeLogService { .filter(log -> "Alipay".equals(log.getString("channel"))) .map(log -> getSymbol(log).multiply(log.getBigDecimal("channel_surcharge"))) .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); - analysis.put("jd_fee", logs.parallelStream() - .filter(log -> log.getBigDecimal("settle_amount") != null) - .filter(log -> "jd".equals(log.getString("channel"))) - .map(log -> getSymbol(log).multiply(log.getBigDecimal("channel_surcharge"))) - .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); - analysis.put("bestpay_fee", logs.parallelStream() - .filter(log -> log.getBigDecimal("settle_amount") != null) - .filter(log -> "Bestpay".equals(log.getString("channel"))) - .map(log -> getSymbol(log).multiply(log.getBigDecimal("channel_surcharge"))) - .reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); analysis.put("alipay_online_fee", logs.parallelStream() .filter(log -> log.getBigDecimal("settle_amount") != null) .filter(log -> "AlipayOnline".equals(log.getString("channel"))) @@ -681,6 +688,9 @@ public class TradeLogServiceImpl implements TradeLogService { } private BigDecimal getSymbol(JSONObject log) { + if (!log.containsKey("transaction_fee") || StringUtils.isEmpty(log.getString("transaction_fee"))) { + log.put("transaction_fee", BigDecimal.ZERO); + } return "Credit".equals(log.getString("transaction_type")) || "Settlement".equals(log.getString("channel")) ? BigDecimal.ONE : BigDecimal.valueOf(-1); } @@ -760,7 +770,7 @@ public class TradeLogServiceImpl implements TradeLogService { // } @Override public void exportTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { - JSONObject transFlow = listPartnerTransFlow(query, partner); + JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner,new String[]{"Wechat","Alipay","AlipayOnline"}); JSONObject analysis = transFlow.getJSONObject("analysis"); JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id")); Context ctx = new Context(); @@ -790,8 +800,6 @@ public class TradeLogServiceImpl implements TradeLogService { parmerters.put("total_fee", takeDecimalOrDefault(analysis, "total_surcharge", BigDecimal.ZERO)); parmerters.put("alipay_fee", takeDecimalOrDefault(analysis, "alipay_fee", BigDecimal.ZERO)); parmerters.put("wechat_fee", takeDecimalOrDefault(analysis, "wechat_fee", BigDecimal.ZERO)); - parmerters.put("bestpay_fee", takeDecimalOrDefault(analysis, "bestpay_fee", BigDecimal.ZERO)); - parmerters.put("jd_fee", takeDecimalOrDefault(analysis, "jd_fee", BigDecimal.ZERO)); parmerters.put("alipay_online_fee", takeDecimalOrDefault(analysis, "alipay_online_fee", BigDecimal.ZERO)); parmerters.put("gst", takeDecimalOrDefault(analysis, "tax_amount", BigDecimal.ZERO)); parmerters.put("royalpay_fee", takeDecimalOrDefault(analysis, "total_royalpay_fee", BigDecimal.ZERO)); @@ -833,7 +841,7 @@ public class TradeLogServiceImpl implements TradeLogService { JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList); response.setContentType("application/pdf"); - String fileName = client.getString("client_moniker") + "_" + parmerters.getString("dateRange").replaceAll("/", ""); + String fileName = client.getString("client_moniker") + "_Cross_Border_" + parmerters.getString("dateRange").replaceAll("/", ""); response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf"); OutputStream outs = response.getOutputStream(); JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城"); @@ -893,6 +901,88 @@ public class TradeLogServiceImpl implements TradeLogService { } } + @Override + public void exportUpayTransFlow(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { + JSONObject transFlow = listPartnerTransFlowByExportPdf(query, partner,new String[]{"rpaypmt_card","rpaypmt_dd"}); + JSONObject analysis = transFlow.getJSONObject("analysis"); + JSONObject client = clientManager.getClientInfo(partner.getIntValue("client_id")); + if (!transFlow.getJSONArray("data").isEmpty()) { + try { + List dataList = transFlow.getJSONArray("data").toJavaList(JSONObject.class); + JSONObject parmerters = new JSONObject(); + parmerters.put("dateFrom", StringUtils.isNotBlank(query.getDatefrom()) + ? DateFormatUtils.format(DateUtils.parseDate(query.getDatefrom(), "yyyyMMdd"), "dd/MM/yyyy") : ""); + parmerters.put("dateTo", + StringUtils.isNotBlank(query.getDateto()) + ? DateFormatUtils.format(DateUtils.parseDate(query.getDateto(), "yyyyMMdd"), "dd/MM/yyyy") + : DateFormatUtils.format(new Date(), "dd/MM/yyyy")); + parmerters.put("dateRange", (StringUtils.isNotBlank(parmerters.getString("dateFrom")) ? parmerters.getString("dateFrom") : "") + "~" + + parmerters.getString("dateTo")); + parmerters.put("partnerCode", client.getString("client_moniker")); + parmerters.put("clientName", client.getString("company_name")); + parmerters.put("clientAddress", client.getString("address")); + parmerters.put("balance", analysis.getDoubleValue("balance")); + parmerters.put("logo", logo.getInputStream()); + parmerters.put("actual_fee", takeDecimalOrDefault(analysis, "actual_fee", BigDecimal.ZERO)); + parmerters.put("totalSettledAmount", takeDecimalOrDefault(analysis, "total_settle_amount", BigDecimal.ZERO)); + parmerters.put("royalpay_charge", takeDecimalOrDefault(analysis, "total_royal_surcharge", BigDecimal.ZERO)); + parmerters.put("total_fee", takeDecimalOrDefault(analysis, "total_surcharge", BigDecimal.ZERO)); + parmerters.put("alipay_fee", takeDecimalOrDefault(analysis, "alipay_fee", BigDecimal.ZERO)); + parmerters.put("wechat_fee", takeDecimalOrDefault(analysis, "wechat_fee", BigDecimal.ZERO)); + parmerters.put("alipay_online_fee", takeDecimalOrDefault(analysis, "alipay_online_fee", BigDecimal.ZERO)); + parmerters.put("gst", takeDecimalOrDefault(analysis, "tax_amount", BigDecimal.ZERO)); + parmerters.put("royalpay_fee", takeDecimalOrDefault(analysis, "total_royalpay_fee", BigDecimal.ZERO)); + parmerters.put("incremental_fee", takeDecimalOrDefault(analysis, "total_incremental_surcharge", BigDecimal.ZERO)); + parmerters.put("incremental_gst", takeDecimalOrDefault(analysis, "total_incremental_tax", BigDecimal.ZERO)); + parmerters.put("royalpay_gst", analysis.getBigDecimal("tax_amount").subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2,RoundingMode.HALF_UP)); + BigDecimal totalTransactionFee = analysis.getBigDecimal("total_transaction_fee").add(analysis.getBigDecimal("total_transaction_fee_tax")).setScale(2, RoundingMode.HALF_UP); + BigDecimal totalRoyalpayFee = analysis.getBigDecimal("total_surcharge") + .subtract(analysis.getBigDecimal("total_transaction_fee")) + .subtract(analysis.getBigDecimal("total_transaction_fee_tax")) + .subtract(analysis.getBigDecimal("total_incremental_surcharge")) + .subtract(analysis.getBigDecimal("total_incremental_tax")).setScale(2, RoundingMode.HALF_UP); + parmerters.put("total_transaction_fee", totalTransactionFee); + parmerters.put("total_royalpay_fee", totalRoyalpayFee); + parmerters.put("total_card_fee", totalRoyalpayFee.add(totalTransactionFee)); + parmerters.put("total_incremental_fee", parmerters.getBigDecimal("incremental_fee").add(parmerters.getBigDecimal("incremental_gst"))); + dataList.parallelStream().forEach(item -> { + BigDecimal incrementalSurcharge = item.containsKey("incremental_surcharge") ? item.getBigDecimal("incremental_surcharge") : BigDecimal.ZERO; + BigDecimal taxAmount = item.containsKey("tax_amount") ? item.getBigDecimal("tax_amount") : BigDecimal.ZERO; + BigDecimal incrementalTax = incrementalSurcharge.divide(new BigDecimal(10), 2, RoundingMode.HALF_UP); + //增加transaction_fee为null异常 + if (!item.containsKey("transaction_fee") || StringUtils.isEmpty(item.getString("transaction_fee"))) { + item.put("transaction_fee", BigDecimal.ZERO); + } + BigDecimal transactionFee = item.getBigDecimal("transaction_fee"); + BigDecimal transactionFeeTax = item.getBigDecimal("transaction_fee").divide(new BigDecimal(10), 2, RoundingMode.HALF_UP); + BigDecimal realRoyalpayCharge = item.getBigDecimal("total_surcharge").add(taxAmount).subtract(transactionFee).subtract(transactionFeeTax).subtract(incrementalSurcharge).subtract(incrementalTax); + item.put("incremental_surcharge", incrementalSurcharge.add(incrementalTax).setScale(2, RoundingMode.HALF_UP)); + item.put("total_surcharge_intax", realRoyalpayCharge.setScale(2, RoundingMode.HALF_UP)); + item.put("transaction_fee_intax", transactionFee.add(transactionFeeTax).setScale(2,RoundingMode.HALF_UP)); + scaleDecimalVal(item, "display_amount", item.getString("currency")); + String platformCurrency = PlatformEnvironment.getEnv().getForeignCurrency(); + scaleDecimalVal(item, "clearing_amount", platformCurrency); + scaleDecimalVal(item, "settle_amount", platformCurrency); + scaleDecimalVal(item, "total_surcharge", platformCurrency); + }); + JRDataSource jrDataSource = new JRBeanCollectionDataSource(dataList); + response.setContentType("application/pdf"); + String fileName = client.getString("client_moniker") + "_Card_Payment_" + parmerters.getString("dateRange").replaceAll("/", ""); + response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf"); + OutputStream outs = response.getOutputStream(); + JSONObject clientIncrement = clientIncrementalMapper.findByClinetIdAndChannel(client.getIntValue("client_id"), "RP跨境商城"); + InputStream jasper = clientIncrement == null ? upay_trans_flow.getInputStream() : incremental_upay_trans_flow.getInputStream(); + byte[] bytes = JasperRunManager.runReportToPdf(jasper, parmerters, jrDataSource); + outs.write(bytes, 0, bytes.length); + outs.flush(); + outs.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + } + @Override public void exportTransFlowApi(TradeLogQuery query, JSONObject partner, HttpServletResponse response) throws Exception { query.setClearing_status(-1); @@ -1392,52 +1482,6 @@ public class TradeLogServiceImpl implements TradeLogService { return res; } - public static JSONObject bestpayInfo() { - JSONObject res = new JSONObject(); - res.put("bw", "China Telecom BestPay Co.,Ltd"); - res.put("bx", "BestPay"); - res.put("by", ""); - res.put("bz", "BestPay"); - res.put("ca", "Tianhe District/Guangzhou"); - res.put("cb", "GUANGDONG PROVINCE"); - res.put("cc", "510000"); - res.put("cd", "CHINA"); - res.put("ce", "10F, Central Tower, No. 5 Xiancun Road, Zhu Jiang New Town"); - res.put("cf", "Tianhe District/Guangzhou"); - res.put("cg", "GUANGDONG PROVINCE"); - res.put("ch", "51000"); - res.put("ci", "CHINA"); - res.put("cj", "8617701910171"); - res.put("ck", "cenjianhu@bestpay.com.cn"); - res.put("cl", "Payment Services"); - res.put("cm", ""); - res.put("cn", "Company"); - return res; - } - - public static JSONObject jdpayInfo() { - JSONObject res = new JSONObject(); - res.put("bw", "Chinabank Payment Technology Co. Ltd."); - res.put("bx", "Jing Dong Pay"); - res.put("by", ""); - res.put("bz", "JDPay"); - res.put("ca", "Da Xing District, Beijing"); - res.put("cb", "Beijing"); - res.put("cc", "100111"); - res.put("cd", "CHINA"); - res.put("ce", "Block A, No.18 Kechang 11 Street, BDA, China."); - res.put("cf", "Da Xing District, Beijing"); - res.put("cg", "Beijing"); - res.put("ch", "100111"); - res.put("ci", "CHINA"); - res.put("cj", "861089186958"); - res.put("ck", "luoqi1@jd.com"); - res.put("cl", "Payment Services"); - res.put("cm", ""); - res.put("cn", "Company"); - return res; - } - @Override public void exportTransLog(TradeLogQuery query, JSONObject manager, HttpServletResponse httpResponse) { // List ausTracData = austracDataMapper.getAustracData(query.toParams(null)); @@ -1448,7 +1492,7 @@ public class TradeLogServiceImpl implements TradeLogService { // }else { // ausTracData = austracDataMapper.getAustracDataNew(query.toParams(null)); // } - if (!ausTracData.isEmpty() && ausTracData.size() > 0) { + if (!ausTracData.isEmpty()) { for (JSONObject data : ausTracData) { if (data.getIntValue("client_id") == 0) { data.putAll(tunnel()); @@ -1459,12 +1503,6 @@ public class TradeLogServiceImpl implements TradeLogService { if (StringUtils.isNotBlank(data.getString("channel")) && "AlipayOnline".equals(data.getString("channel"))) { data.putAll(alipayInfo()); } - if (StringUtils.isNotBlank(data.getString("channel")) && "Bestpay".equals(data.getString("channel"))) { - data.putAll(bestpayInfo()); - } - if (StringUtils.isNotBlank(data.getString("channel")) && "jd".equals(data.getString("channel"))) { - data.putAll(jdpayInfo()); - } } } diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/web/TradeFlowController.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/web/TradeFlowController.java index 42c2660fa..ea744807d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/web/TradeFlowController.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/web/TradeFlowController.java @@ -39,6 +39,12 @@ public class TradeFlowController { tradeLogService.exportTransFlow(query, partner, httpResponse); } + @PartnerMapping(value = "/report/upay_pdf", method = RequestMethod.GET) + @ReadOnlyConnection + public void exportUpayPDF(TradeLogQuery query, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, HttpServletResponse httpResponse) throws Exception { + tradeLogService.exportUpayTransFlow(query, partner, httpResponse); + } + @PartnerMapping(value = "/report/excel", method = RequestMethod.GET) @ReadOnlyConnection public void exportExcel(TradeLogQuery query, @ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, HttpServletResponse httpResponse) throws Exception { diff --git a/src/main/resources/application-common.yml b/src/main/resources/application-common.yml index b997ca4d9..6932e382e 100644 --- a/src/main/resources/application-common.yml +++ b/src/main/resources/application-common.yml @@ -20,7 +20,6 @@ app: aes-key: NRvwd9dgbT2Cdz6zJz9AWA== control: aes-key: Aa+MtthC4Ztq4Kfa9aL+UA== - run-tasks: false server: ip: 127.0.0.1 settle: @@ -74,3 +73,6 @@ spring: preferred-json-mapper: fastjson stockholder: mails: leo.huang@royalpay.com.au +client_card: + account_reserve: 1000 + annual_rate: 0 diff --git a/src/main/resources/application-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/application-rppaysvc.yml b/src/main/resources/application-rppaysvc.yml index 484d8a4f6..5acb434de 100644 --- a/src/main/resources/application-rppaysvc.yml +++ b/src/main/resources/application-rppaysvc.yml @@ -4,4 +4,7 @@ app: priv-key: MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDE55tREo6t6m1hekGlaMmDivorV3a+MkA/Wna0k917u/CGYIf7FtmWk1um7VcBRdljluLjqThePZgbgtwqTdHWXJP2gPwoJjLUluVEyKh19blSgrq7K1FEryAzQ5XFLzMX//EMc1BNrqcREHC6XVlJeNzpOd8+C83cxGxL+ayLoQ/ePEyp/8yXBbA6t2yXyi7H1ry8WiFFg9RFf+zAeESFXlKIS72fw9I9GxG6PLUhbD8S+IIJ2A0ZudKUQIUw4M0wSilo40lfqp/xRyfUBZevKcPrO5/ZCJX6V2d154s1m5p0Z/eLtQ1ido0quVi/LzBb1KXDYNHV6hPJjNQmNbMnAgMBAAECggEAY/rqLW9LzVk0cwN947xiXg2qW2mM3KRtZP3NOoG+O37BcaoAQelnUILATfFDdVz/Ngc+a7TX71o9KvL2UfCztLHLW6ZA4y4KL1HzVkrA5yx/DjtdD36+RC7cHcuad8YwnmYSAm1nABrHr+12H9sYZCsfmLkO9tVNkWSXTLiY+UhJ1hTua2LYgaTsHR9lYLt/K+PNIBAToKuMcKFTEMWbrnekrFhXkPdeS3alFL/0X7csaPhLvZTDaAtpAytvnmN4nuZmnONnDqPJ3IEFjc7xwZ15D9Qgv/+g74q1VzU/0+2421S6BSijUK3kUdeHXASU3YvIczfnbr5t+NYL7nd68QKBgQDlLFNMz9rVFLd5b351tnld9rni8KzHi+V+eXeJpQ+zriTODOvvkFJrTSZKm+JQoBrpTI+EA1fovxLnDBhNnrR4HmHhudMTGqU6JOZLj+fk8UQKXDpVEGWO6QT68ds+Ii1ex1UEkbBkLWGrrHlFAdY0q+Af7L7Fe0osZX9382b+aQKBgQDb9EmDD79IFOxSjMJVnlN0g2P48hQ9M40cEzXRD/iyyBr9l8rE400Q6GT35ZgHKSrG2nXZehWCaQQqniHu+y6UHnJfhbC0LEYdcYRoyamlGwEFp8xSRJ88R2IoL+2g+XJ1Tc6eACjsEJWZooga6bqdrYjaAe0uSGid0Buh6JMTDwKBgGIfJFtS84MgJ55a2m5T/or4xIYiPhgCEfSg1Umd3qcz/JYseihMRr2ifq6bJ78VjfAt05TWSaFhjhpW12EEfoifmZEoGvOnCO9oNSJNLyCbHGLDMkaRiqoxouw++XwU7hASkJgwOLHrrFHwusuNCcXrgT6qAtRTAWMY4gbdtE9hAoGAWnZsTZUKbND+KS1vN9t4I3FuipK1tD4hiSx1c9iHxq/6OdZWNQfvSEbsT/CDyF4sE8EBu0I02n/qkMSc3Dc+fvjOvW60sEWNSMrJVHesaBVlJDhRFnzWqOoK+tBLgWtWodwwYFdcfUqM3LU2GSuL7xHSOSeVrvVk4ZMX6k1HQA0CgYAypY0eecX8Gc7SCt7wpYoNuL2MuZZIDXNZVMpWYMokA1Z74oX1uzecyTNLHgCFHpjiJPyc6KW1/pnDpcA9FuTmLUuNyuqsX85IEMZPkIqPFebAl4IvOuwzvXDPxxgh8B+XBQBydgFADeqgqXG8rxomC4PUrX47pKb1G89bTGp8Dw== pub-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmifNnVZG6HZBYdvLnCGyNm7rQTZKyl3w+7xdBGgjsQeaskdy/IgmrWRG4Ii1o82KV/ZA+bw86vE37axpoxbqOU3LYVb69nVYvmJOL018iBs74HhbZ8CtWtQmEIKqmX/rNUdp15OgwzDckvrK/EEzjdOoQfAkFB68wLOsTcsRwBB3JUL/uiHGK6b5Ofmh4PxYeAVNpWYHyCaQIuN6JH85VHBVS4etP25GbgWxl+ktuZucaPsQ2G25mwhlpNiC28J4la0wD33JKMfCNCjORlWkw2HcDvrRLqza4lJOXu0rFy3JuUkZ0hn834ZWd3MboqNNE6a2xe4ppZUJ9ccM9312JQIDAQAB server-root: https://channel.rpayplus.com/channel/v1/ + upload-file-keys: + - upay_application_form + - upay_desc_file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 91c8f2a2f..904c4779b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -17,7 +17,7 @@ app: cms: host: http://127.0.0.1:9533 customer: - host: https://customer.royalpay.com.au/ + host: http://192.168.0.33:9008/ foreign-currency: AUD hanyin-secure: pid: ROYALPAY @@ -26,10 +26,10 @@ app: sftp-pwd: royalpay sftp-username: royalpay host: - main: http://192.168.0.8:9009/ + main: http://192.168.0.33:9009/ regions: - au: http://192.168.0.8:9009/ - cn: http://192.168.0.8:9009/ + au: http://192.168.0.33:9009/ + cn: http://192.168.0.33:9009/ mail: appid: 1 host: https://mailsupport.royalpay.com.au @@ -121,30 +121,43 @@ settle: bank: ANZ: account-name: Tunnel Show Pty Ltd - account-no: 837022519 - apca: 514624 + account-no: '837022519' + apca: '514624' bank: ANZ - bsb: 13006 + bsb: '013006' manual-sending: true + balance-group: + - NORMAL_CROSS_BORDER CBA: account-name: Tunnel Show Pty Ltd - account-no: 11655861 - apca: 301500 + account-no: '11655861' + apca: '301500' bank: CBA - bsb: 63109 + bsb: '063109' + balance-group: + - NORMAL_CROSS_BORDER NAB: account-name: Tunnel Show Pty Ltd - account-no: 837022519 - apca: 514624 + account-no: '837022519' + apca: '514624' bank: NAB - bsb: 13006 + bsb: '013006' manual-sending: true - default-bank: CBA - remains-to: ANZ + balance-group: + - NORMAL_CROSS_BORDER + CARD: + account-name: UPay Pty Ltd + account-no: '13677888' + apca: '301500' + bank: CBA + bsb: '063010' + balance-group: + - RPAY_SVC_CARD + - RPAY_SVC_DIRECTDEBIT spring: mail: - host: smtp.office365.com - port: 587 + host: '' + port: '' profiles: active: dev,alipay,bestpay,jd,wechat,rpay,yeepay,rppaysvc,common redis: @@ -153,6 +166,12 @@ spring: port: 6379 thymeleaf: mode: HTML +logging: + level: + au: + com: + royalpay: + payment: debug diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml index 0cd8a813d..24eea92c2 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/CustomerAndOrdersStatisticsMapper.xml @@ -145,7 +145,7 @@ 0 AND r.t < o.customer_payment_amount - THEN 6 - WHEN r.t >= o.customer_payment_amount - THEN 7 - END - WHERE o.order_id = #{order_id} + + UPDATE pmt_orders o + LEFT JOIN ( + SELECT + order_id, + IFNULL(SUM(amount), 0) t + FROM pmt_refunds + WHERE status IN (2, 4, 5) AND order_id = #{order_id} + GROUP BY order_id) r ON r.order_id = o.order_id + SET o.refund_amount = ifnull(r.t, 0), + o.status = CASE + WHEN IFNULL(r.t, 0) = 0 + THEN o.status + WHEN r.t > 0 AND r.t < o.customer_payment_amount + THEN 6 + WHEN r.t >= o.customer_payment_amount + THEN 7 + END + WHERE o.order_id = #{order_id} + ]]> @@ -136,9 +138,11 @@ @@ -205,7 +209,7 @@ AND - oo.source = #{source} + oo.source = #{source} ) o @@ -487,6 +491,8 @@ and o.customer_id = #{customer_id} LEFT JOIN pmt_transactions t on t.order_id=o.order_id and t.refund_id is null and t.transaction_type='Credit' + and t.create_time >= #{from} + and t.create_time < #{to} @@ -513,7 +519,7 @@ and o.client_order_id = #{search_text} - and binary dev_id=#{dev_id} + and binary dev_id=#{dev_id} and o.gateway in #{gateway} @@ -523,7 +529,6 @@ and o.create_time >= #{from} and o.create_time < #{to} - and date(o.create_time)=date(#{date}) and o.status=#{std} @@ -592,9 +597,11 @@ count(DISTINCT l.client_id) clients, ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency!='CNY',l.display_amount,0)),0) display_amount, - ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and l.currency!='CNY',l.incremental_surcharge,0)),0) + ifnull(sum(if(l.transaction_type='Credit' and l.refund_id is null and + l.currency!='CNY',l.incremental_surcharge,0)),0) incremental_surcharge, - ifnull(sum(if(l.transaction_type='Debit' and l.refund_id is not null and l.currency!='CNY',l.incremental_surcharge,0)),0) + ifnull(sum(if(l.transaction_type='Debit' and l.refund_id is not null and + l.currency!='CNY',l.incremental_surcharge,0)),0) refund_incremental_surcharge, ifnull(sum(if(l.currency!='CNY',l.incremental_surcharge,0)),0) all_incremental_surcharge, @@ -625,6 +632,8 @@ INNER JOIN pmt_transactions t on t.order_id=o.order_id and (t.transaction_type='Credit' or t.refund_id is not null) + and t.create_time >= #{from} + and t.create_time < #{to} @@ -669,7 +678,6 @@ and p.org_id=#{org_id} and o.create_time >= #{from} and o.create_time < #{to} - and date(o.create_time)=date(#{date}) and binary o.dev_id=#{dev_id} AND t.incremental_surcharge >0 @@ -752,14 +760,16 @@ = 5 AND o.customer_payment_amount > 0 + + SELECT + o.order_id, + o.channel + FROM pmt_orders o + WHERE o.order_id NOT IN ( + SELECT DISTINCT order_id + FROM pmt_transactions + WHERE transaction_type = 'Credit') AND o.status >= 5 AND o.customer_payment_amount > 0 + ]]> @@ -929,7 +939,7 @@ t.exchange_rate, t.clearing_status, t.settle_amount, - t.clearing_status = 2 pre_auth, + t.clearing_status = 2 pre_auth, IF( t.remark like '%RYCBSM%',TRUE,FALSE) as geek_apply_deduction from pmt_orders o left join pmt_transactions t on t.order_id=o.order_id and t.channel!='Settlement' @@ -1053,23 +1063,25 @@ + + + + update sys_merchant_warrior_files set is_valid = 0 + where file_id = #{file_id} + + diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml index 79ccd5e88..c62c04184 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml @@ -38,11 +38,19 @@ order by display_name + + + - \ No newline at end of file + 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/incremental_partner_upay_invoice_gst.jasper b/src/main/resources/jasper/incremental_partner_upay_invoice_gst.jasper new file mode 100644 index 000000000..cf6b40d3d Binary files /dev/null and b/src/main/resources/jasper/incremental_partner_upay_invoice_gst.jasper 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/partner_upay_invoice_gst.jasper b/src/main/resources/jasper/partner_upay_invoice_gst.jasper new file mode 100644 index 000000000..e017ea279 Binary files /dev/null and b/src/main/resources/jasper/partner_upay_invoice_gst.jasper differ diff --git a/src/main/resources/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/letter_of_offer.pdf b/src/main/resources/templates/letter_of_offer.pdf new file mode 100644 index 000000000..b9fa8f7e0 Binary files /dev/null and b/src/main/resources/templates/letter_of_offer.pdf differ diff --git a/src/main/resources/templates/mail/new_client_notice.html b/src/main/resources/templates/mail/new_client_notice.html index 750855542..3c6c555fd 100644 --- a/src/main/resources/templates/mail/new_client_notice.html +++ b/src/main/resources/templates/mail/new_client_notice.html @@ -2,9 +2,17 @@

Dear :

-

I'm happy to let you know +

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,来进行收款和接收到账提醒等。


@@ -114,14 +122,14 @@
https://mpay.royalpay.com.au/docs/cn/ + href="https://developer.royalpay.com.au/cn/">https://developer.royalpay.com.au/cn/
English version:
https://mpay.royalpay.com.au/docs/en/ + href="https://developer.royalpay.com.au/en/">https://developer.royalpay.com.au/en/
@@ -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/resources/templates/pdf/letter_of_offer.pdf b/src/main/resources/templates/pdf/letter_of_offer.pdf new file mode 100644 index 000000000..a6a8a6ade Binary files /dev/null and b/src/main/resources/templates/pdf/letter_of_offer.pdf differ diff --git a/src/main/resources/templates/pdf/promotional_offer.pdf b/src/main/resources/templates/pdf/promotional_offer.pdf new file mode 100644 index 000000000..0977927a4 Binary files /dev/null and b/src/main/resources/templates/pdf/promotional_offer.pdf differ diff --git a/src/main/resources/templates/pdf/terms_and_conditions.pdf b/src/main/resources/templates/pdf/terms_and_conditions.pdf new file mode 100644 index 000000000..c741f21e1 Binary files /dev/null and b/src/main/resources/templates/pdf/terms_and_conditions.pdf differ diff --git a/src/main/ui/merchant_application.html b/src/main/ui/merchant_application.html index 35a3462fe..6a35011b2 100644 --- a/src/main/ui/merchant_application.html +++ b/src/main/ui/merchant_application.html @@ -205,8 +205,8 @@
-
-
-
- -
-
-
Total Transaction:
-
Total Charge:
-
RoyalPay Charge:
-
Org Net Charge:
-
City Partner Charge:
-
-
-
-
@@ -183,4 +162,4 @@
- \ No newline at end of file + diff --git a/src/main/ui/static/analysis/channels_analysis.js b/src/main/ui/static/analysis/channels_analysis.js index af0a55266..3a14cdab3 100644 --- a/src/main/ui/static/analysis/channels_analysis.js +++ b/src/main/ui/static/analysis/channels_analysis.js @@ -173,7 +173,7 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' trigger: 'axis' }, legend: { - data: ['Alipay交易金额','AlipayOnline交易金额', 'Bestpay交易金额','Wechat交易金额',"JD Pay交易金额","HF Pay交易金额","Yeepay交易金额","LakalaPay交易金额"], + data: ['Alipay交易金额','AlipayOnline交易金额', 'Bestpay交易金额','Wechat交易金额',"JD Pay交易金额","HF Pay交易金额","Yeepay交易金额","LakalaPay交易金额","Card Payment交易金额","Direct Debit交易金额"], bottom: 0, height: '15%', width: '80%', @@ -279,6 +279,28 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' yAxisIndex: 0 }, column: {key: 'LakalaPay.total'} + }, + { + basic: { + name: 'Card Payment交易金额', + type: 'line', + label: {normal: {show: true}}, + showAllSymbols: true, + showSymbol: true, + yAxisIndex: 0 + }, + column: {key: 'rpaypmt_card.total'} + }, + { + basic: { + name: 'Direct Debit交易金额', + type: 'line', + label: {normal: {show: true}}, + showAllSymbols: true, + showSymbol: true, + yAxisIndex: 0 + }, + column: {key: 'rpaypmt_dd.total'} } ] }; @@ -289,7 +311,7 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' trigger: 'axis' }, legend: { - data: ['Alipay交易订单','AlipayOnline交易订单', 'Bestpay交易订单','Wechat交易订单',"JD Pay交易订单","HF Pay交易订单","Yeepay交易订单","LakalaPay交易订单"], + data: ['Alipay交易订单','AlipayOnline交易订单', 'Bestpay交易订单','Wechat交易订单',"JD Pay交易订单","HF Pay交易订单","Yeepay交易订单","LakalaPay交易订单","Card Payment交易订单","Direct Debit交易订单"], bottom: 0, height: '15%', width: '80%', @@ -395,6 +417,28 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' yAxisIndex: 0 }, column: {key: 'LakalaPay.orders'} + }, + { + basic: { + name: 'Card Payment交易订单', + type: 'line', + label: {normal: {show: true}}, + showAllSymbols: true, + showSymbol: true, + yAxisIndex: 0 + }, + column: {key: 'rpaypmt_card.orders'} + }, + { + basic: { + name: 'Direct Debit交易订单', + type: 'line', + label: {normal: {show: true}}, + showAllSymbols: true, + showSymbol: true, + yAxisIndex: 0 + }, + column: {key: 'rpaypmt_dd.orders'} } ] }; @@ -404,7 +448,7 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' trigger: 'axis' }, legend: { - data: ['Alipay交易客单价','AlipayOnline交易客单价', 'Bestpay交易客单价','Wechat交易客单价',"JD Pay交易客单价","HF Pay交易客单价","Yeepay交易客单价","LakalaPay交易客单价"], + data: ['Alipay交易客单价','AlipayOnline交易客单价', 'Bestpay交易客单价','Wechat交易客单价',"JD Pay交易客单价","HF Pay交易客单价","Yeepay交易客单价","LakalaPay交易客单价","Card Payment交易客单价","Direct Debit交易客单价"], bottom: 0, }, yAxis: [ @@ -507,15 +551,32 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', ' yAxisIndex: 0 }, column: {key: 'LakalaPay.single_amount'} + }, + { + basic: { + name: 'Card Payment交易客单价', + type: 'line', + label: {normal: {show: true}}, + showAllSymbols: true, + showSymbol: true, + yAxisIndex: 0 + }, + column: {key: 'rpaypmt_card.single_amount'} + }, + { + basic: { + name: 'Direct Debit交易客单价', + type: 'line', + label: {normal: {show: true}}, + showAllSymbols: true, + showSymbol: true, + yAxisIndex: 0 + }, + column: {key: 'rpaypmt_dd.single_amount'} } ] }; - - - - - $scope.chooseLast7Days(); }]); diff --git a/src/main/ui/static/analysis/clearing-log.js b/src/main/ui/static/analysis/clearing-log.js index ab825af23..5375001b6 100644 --- a/src/main/ui/static/analysis/clearing-log.js +++ b/src/main/ui/static/analysis/clearing-log.js @@ -387,7 +387,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func }; $scope.distributeBankDialog = function () { - var log = $scope.getCurrentLog(); + let log = $scope.getCurrentLog(); $uibModal.open({ templateUrl: '/static/analysis/templates/settlement_bank_distribution_dialog.html', controller: 'bankDistributionDialogCtrl', @@ -396,7 +396,7 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func return log; }, banksConfig: ['$http', function ($http) { - return $http.get('/sys/settlement/available_banks') + return $http.get('/sys/settlement/clearings/' + log.clearing_id + '/available_banks') }], settleDate: function () { return $stateParams.date; @@ -496,24 +496,24 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func $scope.settleLogs = settleLogs.map(log => { let info = { 'id': log.clearing_id, - 'time':log.operate_time, - 'amount':log.net_amount, + 'time': log.operate_time, + 'amount': log.net_amount, 'remark': log.plan_detail.remark || log.plan_detail.plan_id, 'send': false }; return info }); - $scope.sumSelectedAmount = function(){ - let sendingLogs = $scope.settleLogs.filter(log=>log.send); - if(sendingLogs.length){ - return sendingLogs.map(log=>log.amount).reduce((m1,m2)=>m1+m2); - }else{ - return $scope.settleLogs.map(log=>log.amount).reduce((m1,m2)=>m1+m2); + $scope.sumSelectedAmount = function () { + let sendingLogs = $scope.settleLogs.filter(log => log.send); + if (sendingLogs.length) { + return sendingLogs.map(log => log.amount).reduce((m1, m2) => m1 + m2); + } else { + return $scope.settleLogs.map(log => log.amount).reduce((m1, m2) => m1 + m2); } }; $scope.config = {mark_sent: true}; - $scope.switchSendFlag=function(info){ - info.send=!info.send + $scope.switchSendFlag = function (info) { + info.send = !info.send }; $scope.sendCheckCodeButton = false; $scope.sendMailButton = false; @@ -522,7 +522,10 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func $scope.error_msg = '正在发送,请稍后。'; $scope.sendMailButton = true; $http.post('/sys/settlement/reports/' + $stateParams.date + '/send_settlement_xlsx', - {clearing_ids:$scope.settleLogs.filter(log=>log.send).map(log=>log.id),mark_sent:$scope.config.mark_sent}).then(function (resp) { + { + clearing_ids: $scope.settleLogs.filter(log => log.send).map(log => log.id), + mark_sent: $scope.config.mark_sent + }).then(function (resp) { $scope.error_msg = resp.data.msg; $scope.sendMailButton = false; if (resp.data.result == 0) { @@ -556,6 +559,10 @@ define(['angular', 'decimal', 'uiBootstrap', 'uiRouter', 'angularEcharts'], func return '/static/images/yeepay_sign_lg.png'; case 'LakalaPay': return '/static/images/lakalapay_sign_lg.png'; + case 'rpaypmt_card': + return '/static/images/card_payment_sign_lg.png'; + case 'rpaypmt_dd': + return '/static/images/direct_debit_sign_lg.png'; } } }); diff --git a/src/main/ui/static/analysis/templates/settlement_transactions.html b/src/main/ui/static/analysis/templates/settlement_transactions.html index 4b118af1c..4126077bc 100644 --- a/src/main/ui/static/analysis/templates/settlement_transactions.html +++ b/src/main/ui/static/analysis/templates/settlement_transactions.html @@ -53,6 +53,16 @@ +
  • + + + +
  • +
  • + + + +
  • diff --git a/src/main/ui/static/cms/templates/cms_root.html b/src/main/ui/static/cms/templates/cms_root.html index d595c79fc..7b315d2f7 100644 --- a/src/main/ui/static/cms/templates/cms_root.html +++ b/src/main/ui/static/cms/templates/cms_root.html @@ -20,9 +20,6 @@ - @@ -41,4 +38,4 @@ - \ No newline at end of file + diff --git a/src/main/ui/static/commons/commons.js b/src/main/ui/static/commons/commons.js index 1f764d66c..51e7b3204 100644 --- a/src/main/ui/static/commons/commons.js +++ b/src/main/ui/static/commons/commons.js @@ -13,6 +13,7 @@ define(['./app', './services/yeepayIndustryMap', './services/stateMap', './services/industryMap', + './services/upayIndustryMap', './services/wechatGoodMcc', './services/sectorMap', './services/countryMap', diff --git a/src/main/ui/static/commons/services/clearingDetailService.js b/src/main/ui/static/commons/services/clearingDetailService.js index 7d347e1cf..1acf1105a 100644 --- a/src/main/ui/static/commons/services/clearingDetailService.js +++ b/src/main/ui/static/commons/services/clearingDetailService.js @@ -19,6 +19,21 @@ define(['../app','decimal'], function (app,Decimal) { size: 'lg' }) } + function openDetailOfUpaySettle(url, is_partner, client_id, detailId) { + $uibModal.open({ + templateUrl: '/static/payment/tradelog/templates/partner_settlement_upay_settle_dialog.html', + controller: 'clearingDetailOfUpaySettleCtrl', + resolve: { + detail: ['$http', function ($http) { + return $http.get(url); + }], + is_partner: is_partner, + client_id: client_id, + detailId: detailId + }, + size: 'lg' + }) + } function openDetailOfMergeSettle(url,client_id) { $uibModal.open({ templateUrl: '/static/payment/tradelog/templates/partner_settlement_merge_settle_dialog.html', @@ -37,6 +52,9 @@ define(['../app','decimal'], function (app,Decimal) { clientClearingDetail: function (client_id, detailId, is_partner) { openDetail('/client/clean_logs/' + client_id + '/settlement_logs/' + detailId, is_partner,client_id,detailId); }, + clientClearingDetailOfUpaySettle: function (client_id, detailId, is_partner) { + openDetailOfUpaySettle('/client/clean_logs/' + client_id + '/settlement_logs/' + detailId, is_partner,client_id,detailId); + }, clientClearingDetailOfMergeSettle: function (client_id, reportDate) { openDetailOfMergeSettle('/client/clean_logs/' + client_id + '/settlement_logs/report_date/' + reportDate, client_id); } @@ -55,6 +73,18 @@ define(['../app','decimal'], function (app,Decimal) { } $scope.channelAndDayOfAnalysis(); }]); + app.controller('clearingDetailOfUpaySettleCtrl', ['$scope', 'detail', 'is_partner','client_id','detailId','$http', function ($scope, detail, is_partner,client_id,detailId,$http) { + $scope.ctrl = {channel: null,day:null}; + $scope.report = detail.data; + $scope.is_partner = is_partner; + $scope.channelAndDayOfAnalysis = function () { + $http.get('/client/clean_logs/' + client_id + '/settlement_logs/' + detailId+'/analysis/'+$scope.ctrl.channel).then(function (resp) { + $scope.channelAndDayMap = resp.data; + $scope.index = 0; + }) + } + $scope.channelAndDayOfAnalysis(); + }]); app.controller('clearingDetailOfMergeSettleCtrl', ['$scope', 'detail','client_id','$http', function ($scope, detail,client_id,$http) { $scope.ctrl = {channel: null,day:null}; $scope.report = detail.data; @@ -87,6 +117,10 @@ define(['../app','decimal'], function (app,Decimal) { return '/static/images/hf_sign_lg.png'; case 'Rpay': return '/static/images/rpayplus_sign_lg.png'; + case 'rpaypmt_card': + return '/static/images/card_payment_sign_lg.png'; + case 'rpaypmt_dd': + return '/static/images/direct_debit_sign_lg.png'; } } }); diff --git a/src/main/ui/static/commons/services/upayIndustryMap.js b/src/main/ui/static/commons/services/upayIndustryMap.js new file mode 100644 index 000000000..ebc3c6cfb --- /dev/null +++ b/src/main/ui/static/commons/services/upayIndustryMap.js @@ -0,0 +1,81 @@ +define(['../app'], function (app) { + 'use strict'; + + var upayIndustry = [ + { + "label": "Professional Services", + "value": "Professional Services" + }, + { + "label": "Mail/Telephone Order", + "value": "Mail/Telephone Order" + }, + { + "label": "Business Services", + "value": "Business Services" + }, + { + "label": "Retail Store", + "value": "Retail Store" + }, + { + "label": "Airline Services", + "value": "Airline Services" + }, + { + "label": "Entertainment", + "value": "Entertainment" + }, + { + "label": "Automobiles", + "value": "Automobiles" + }, + { + "label": "Clothing", + "value": "Clothing" + }, + { + "label": "Contracted Services", + "value": "Contracted Services" + }, + { + "label": "Government", + "value": "Government" + }, + { + "label": "Hotel", + "value": "Hotel" + }, + { + "label": "Personal Services", + "value": "Personal Services" + }, + { + "label": "Repair Services", + "value": "Repair Services" + }, + { + "label": "Transportation", + "value": "Transportation" + }, + { + "label": "Utilities", + "value": "Utilities" + }, + { + "label": "Wholesale", + "value": "Wholesale" + }, + { + "label": "Other", + "value": "Other" + } + ]; + app.factory('upayIndustryMap', function () { + return { + configs: function () { + return upayIndustry; + } + } + }); +}); diff --git a/src/main/ui/static/commons/templates/promotiona_commit.html b/src/main/ui/static/commons/templates/promotiona_commit.html new file mode 100644 index 000000000..1ee5f2610 --- /dev/null +++ b/src/main/ui/static/commons/templates/promotiona_commit.html @@ -0,0 +1,19 @@ + + + \ No newline at end of file diff --git a/src/main/ui/static/config/bdprize/bdprize.js b/src/main/ui/static/config/bdprize/bdprize.js index 46acd352f..eaac60668 100644 --- a/src/main/ui/static/config/bdprize/bdprize.js +++ b/src/main/ui/static/config/bdprize/bdprize.js @@ -415,6 +415,10 @@ define(['angular', '../../analysis/bd/analysis-bd'], function (angular) { return '/static/images/yeepay_sign_lg.png'; case 'LakalaPay': return '/static/images/lakalapay_sign_lg.png'; + case 'rpaypmt_card': + return '/static/images/card_payment_sign_lg.png'; + case 'rpaypmt_dd': + return '/static/images/direct_debit_sign_lg.png'; } } }); diff --git a/src/main/ui/static/config/notice/templates/notice_add.html b/src/main/ui/static/config/notice/templates/notice_add.html index 7512564d8..7137930a5 100644 --- a/src/main/ui/static/config/notice/templates/notice_add.html +++ b/src/main/ui/static/config/notice/templates/notice_add.html @@ -49,11 +49,11 @@
    + id="title-input" maxlength="200" name="title" required>

    Required Field

    -

    Less Than 100 +

    Less Than 200 Characters(including symbols and spaces)

    diff --git a/src/main/ui/static/config/organizations/organizations.js b/src/main/ui/static/config/organizations/organizations.js index b144fb176..82e390eb4 100644 --- a/src/main/ui/static/config/organizations/organizations.js +++ b/src/main/ui/static/config/organizations/organizations.js @@ -653,6 +653,19 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { $scope.gateway_sign.platform_public_key = $scope.org.platform_public_key; $scope.gateway_sign.org_id = $scope.org.org_id; $scope.gateway_sign.mch_public_key = $scope.org.mch_public_key; + $scope.paginationc = {}; + $scope.loadCommission = function () { + var params = {}; + params.page = $scope.paginationc.page || 1; + params.org_id = $scope.org.org_id; + $http.get('/sys/orgs/'+$scope.org.org_id + '/extract/search', {params: params}).then(function (resp) { + $scope.client_extarct = resp.data.data; + $scope.paginationc = resp.data.pagination; + + }); + + }; + $scope.loadCommission(); $scope.refreshPlatformPubliKey = function () { $uibModal.open({ diff --git a/src/main/ui/static/config/organizations/templates/org_detail_parent.html b/src/main/ui/static/config/organizations/templates/org_detail_parent.html index 138178412..2da1eb371 100644 --- a/src/main/ui/static/config/organizations/templates/org_detail_parent.html +++ b/src/main/ui/static/config/organizations/templates/org_detail_parent.html @@ -22,143 +22,6 @@
    - -
    @@ -462,88 +325,65 @@
    -
    -
    -
    - + diff --git a/src/main/ui/static/config/platformrevenue/templates/platform_settle_logs.html b/src/main/ui/static/config/platformrevenue/templates/platform_settle_logs.html index ffc5df6cb..b13f607be 100644 --- a/src/main/ui/static/config/platformrevenue/templates/platform_settle_logs.html +++ b/src/main/ui/static/config/platformrevenue/templates/platform_settle_logs.html @@ -85,40 +85,6 @@ - -
    - -
    -
    -

    Bestpay Logs

    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    Date StartDate EndPay FeeRefund FeeSurchargeSettlement Fee
    {{bestpayLogs.start_date}}{{bestpayLogs.end_date}}{{bestpayLogs.sys_pay_fee}}{{bestpayLogs.sys_refund_fee}}{{bestpayLogs.surcharge}}{{bestpayLogs.sys_settle_amount}}
    -
    -
    - -

    Alipay Logs

    @@ -196,7 +162,6 @@
    -

    AlipayOnline Logs

    @@ -300,12 +265,11 @@ -

    No Data

    @@ -374,4 +338,4 @@ - \ No newline at end of file + diff --git a/src/main/ui/static/dashboard/dashboard.js b/src/main/ui/static/dashboard/dashboard.js index add62a4e6..5eb574c10 100644 --- a/src/main/ui/static/dashboard/dashboard.js +++ b/src/main/ui/static/dashboard/dashboard.js @@ -712,7 +712,7 @@ define(['angular', 'uiRouter', 'jstz', 'uiBootstrap', 'angularEcharts'], functio } }, legend: { - data: ['Wechat', 'Alipay'/*,'Bestpay'*/], + data: ['Wechat', 'Alipay'], bottom: 0, height: '15%', width: '80%', @@ -795,4 +795,4 @@ define(['angular', 'uiRouter', 'jstz', 'uiBootstrap', 'angularEcharts'], functio } }]); return app; -}); \ No newline at end of file +}); diff --git a/src/main/ui/static/dashboard/templates/dashboard.html b/src/main/ui/static/dashboard/templates/dashboard.html index 83647b3b9..a548a0776 100644 --- a/src/main/ui/static/dashboard/templates/dashboard.html +++ b/src/main/ui/static/dashboard/templates/dashboard.html @@ -1,310 +1,257 @@
    -
    -

    - Dashboard -

    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - - -
    - 交易额 - -
    -
    -
    -
    -
    - -
    - 开通商户数 - +
    +

    + Dashboard +

    + +
    +
    +
    +
    +
    +
    -
    -
    - -
    - 总商户数 - -
    -
    -
    -
    - -
    - -
    - 产生交易商户数 - -
    -
    -
    -
    -
    - -
    +
    diff --git a/src/main/ui/static/images/bank/CARD.png b/src/main/ui/static/images/bank/CARD.png new file mode 100644 index 000000000..733de6180 Binary files /dev/null and b/src/main/ui/static/images/bank/CARD.png differ diff --git a/src/main/ui/static/payment/custom/templates/custom.html b/src/main/ui/static/payment/custom/templates/custom.html index 4c7654e9c..2e61963d2 100644 --- a/src/main/ui/static/payment/custom/templates/custom.html +++ b/src/main/ui/static/payment/custom/templates/custom.html @@ -130,7 +130,7 @@

    报关订单列表 - 商户报关API + 商户报关API

    diff --git a/src/main/ui/static/payment/partner/add-partner.js b/src/main/ui/static/payment/partner/add-partner.js new file mode 100644 index 000000000..ac6ad6580 --- /dev/null +++ b/src/main/ui/static/payment/partner/add-partner.js @@ -0,0 +1,908 @@ +/** + * Created by yixian on 2016-06-29. + */ +define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiSelect'], function (angular, Decimal) { + 'use strict'; + var removeClientPayDesc = function (items, key) { + for (var i = 0; i < items.length; i++) { + var item = items[i]; + if (item.indexOf(key) >= 0) { + items.splice(items.indexOf(item), 1); + i = i - 1; + } + } + }; + + + var app = angular.module('addPartnerApp', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ui.select', 'ngFileUpload']); + app.config(['$stateProvider', function ($stateProvider) { + $stateProvider.state('newPartners', { + url: '/partners/new', + templateUrl: '/static/payment/partner/templates/add_partner.html', + controller: 'addPartnerCtrl' + }).state('partners.edit', { + url: '/{clientMoniker}/edit', + params: {"commitCardPayment": false, commitCrossBorderPayment: false}, + templateUrl: '/static/payment/partner/templates/partner_edit.html', + controller: 'partnerEditCtrl', + resolve: { + partner: ['$http', '$stateParams', function ($http, $stateParams) { + return $http.get('/sys/partners/' + $stateParams.clientMoniker); + }] + } + }) + }]); + app.controller('addPartnerCtrl', ['$rootScope', '$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'businessStructuresMap', 'upayIndustryMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap', function ($rootScope, $scope, $http, $state, Upload, commonDialog, timezone, businessStructuresMap, upayIndustryMap, industryMap, stateMap, sectorMap, countryMap) { + if ($scope.partner_application) { + $scope.partner = angular.copy($scope.partner_application); + delete $rootScope.partner_application; + } else { + $scope.partner = {timezone: 'Australia/Melbourne'}; + } + $scope.partner.enable_cross_payment = false; + $scope.partner.enable_cross_payment = false; + $scope.initMerchantCode = function () { + $http.get('/sys/partners/init/merchant_code').then(function (response) { + $scope.partner.client_moniker = response.data.partner_code; + $scope.merchantCodeChecked = true; + $scope.merchantIsValid = true; + }); + }; + $scope.enablePaymentType = function (type) { + $scope.partner[type] = !$scope.partner[type]; + }; + $scope.enablePaymentType('enable_cross_payment'); + $scope.initMerchantCode(); + $scope.partner.company_phone_c = 61; + $scope.partner.contact_phone_c = 61; + $scope.partner.client_pay_type = []; + $scope.partner.client_pay_desc = []; + + var resetClientPayDescByTpey = function (type) { + type = parseInt(type); + if (type == 1) { + removeClientPayDesc($scope.partner.client_pay_desc, '10'); + } + if (type == 2) { + removeClientPayDesc($scope.partner.client_pay_desc, '20'); + } + }; + $scope.partner.sameAsContactPerson = false; + + $scope.checkboxOnclick = function (){ + $scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson); + if($scope.partner.sameAsContactPerson) { + $scope.partner.legal_representative_person = $scope.partner.contact_person; + $scope.partner.legal_representative_phone_a = $scope.partner.contact_phone_a; + $scope.partner.legal_representative_phone_c = $scope.partner.contact_phone_c; + $scope.partner.legal_representative_phone_p = $scope.partner.contact_phone_p; + $scope.partner.legal_representative_email = $scope.partner.contact_email; + $scope.partner.legal_representative_job = $scope.partner.contact_job; + $scope.partner.legal_representative_wechatid = $scope.partner.contact_wechatid; + } + } + + $scope.partner.marketingSameAsContact = false; + $scope.checkMarketingSameAsContact = function (){ + $scope.partner.marketingSameAsContact = !($scope.partner.marketingSameAsContact); + if($scope.partner.marketingSameAsContact) { + $scope.partner.marketing_person = $scope.partner.contact_person; + $scope.partner.marketing_phone_a = $scope.partner.contact_phone_a; + $scope.partner.marketing_phone_c = $scope.partner.contact_phone_c; + $scope.partner.marketing_phone_p = $scope.partner.contact_phone_p; + $scope.partner.marketing_email = $scope.partner.contact_email; + $scope.partner.marketing_job = $scope.partner.contact_job; + $scope.partner.marketing_wechatid = $scope.partner.contact_wechatid; + } + } + + $scope.partner.sameAsAddress=false; + $scope.sameAddress = function (){ + $scope.partner.sameAsAddress = !($scope.partner.sameAsAddress); + if($scope.partner.sameAsAddress) { + $scope.partner.registered_address = $scope.partner.address; + $scope.partner.registered_suburb = $scope.partner.suburb; + $scope.partner.registered_postcode = $scope.partner.postcode; + $scope.partner.registered_state = $scope.partner.state; + } + } + + var compare = function (x, y) { + x = parseInt(x); + y = parseInt(y); + if (x < y) { + return -1; + } else if (x > y) { + return 1; + } else { + return 0; + } + } + $scope.toggleClientPayType = function (type) { + if ($scope.partner.client_pay_type == null || $scope.partner.client_pay_type == undefined) { + $scope.partner.client_pay_type = []; + } + var $idx = $scope.partner.client_pay_type.indexOf(type); + if ($idx >= 0) { + $scope.partner.client_pay_type.splice($idx, 1); + resetClientPayDescByTpey(type); + } else { + $scope.partner.client_pay_type.push(type); + $scope.partner.client_pay_type.sort(compare); + } + }; + $scope.toggleClientPayDesc = function (type) { + if ($scope.partner.client_pay_desc == null || $scope.partner.client_pay_desc == undefined) { + $scope.partner.client_pay_desc = []; + } + var $idx = $scope.partner.client_pay_desc.indexOf(type); + if ($idx >= 0) { + if (type == '203') { + removeClientPayDesc($scope.partner.client_pay_desc, '2030') + } + $scope.partner.client_pay_desc.splice($idx, 1); + } else { + $scope.partner.client_pay_desc.push(type); + $scope.partner.client_pay_desc.sort(compare); + } + }; + $scope.pagination = {}; + $scope.industries = industryMap.configs(); + $scope.upayIndustrys = upayIndustryMap.configs(); + $scope.states = stateMap.configs(); + $scope.countries = countryMap.configs(); + $scope.sectors = sectorMap.configs(); + $scope.business_structures = businessStructuresMap.configs(); + $scope.params = {textType: 'all', org_name: 'ALL'}; + $scope.merchantIsValid = false; + $scope.merchantCodeChecked = false; + + function remove(arr, val) { + if (angular.isArray(arr)) { + for (var i = arr.length; i--;) { + if (arr[i].value == val) { + arr.splice(i, 1); + break; + } + } + } + return arr; + } + + var industries = angular.copy($scope.industries); + $scope.industries = remove(industries, 331); + + $scope.listReferrers = function () { + $http.get('/sys/orgs/referrer').then(function (resp) { + $scope.referrers = resp.data; + }) + }; + $scope.listReferrers(); + + $scope.loadAlipayCategory = function () { + $http.get('/static/data/alipayMcc.json').then(function (resp) { + $scope.alipayMccCategory = resp.data; + }) + }; + $scope.loadAlipayCategory(); + $scope.loadJDindustry = function () { + $http.get('/static/data/jdindustry.json').then(function (resp) { + $scope.jdindustry = resp.data; + }) + }; + $scope.loadJDindustry(); + + $scope.loadLakalaPayindustry = function () { + $http.get('/static/data/lakalapayindustry.json').then(function (resp) { + $scope.lakalapayindustry = resp.data; + }) + }; + $scope.loadLakalaPayindustry(); + + $scope.loadLakalaPaySettle = function () { + $http.get('/static/data/lakalapaysettle.json').then(function (resp) { + $scope.lakalapaysettle = resp.data; + }) + }; + $scope.loadLakalaPaySettle(); + + $scope.loadLakalaPayGoods = function () { + $http.get('/static/data/lakalapaygoods.json').then(function (resp) { + $scope.lakalapaygoods = resp.data; + }) + }; + $scope.loadLakalaPayGoods(); + + $scope.loadRoyalpayindustry = function () { + $http.get('/static/data/royalpayindustry.json').then(function (resp) { + $scope.royalpayindustry = resp.data; + }) + }; + $scope.loadRoyalpayindustry(); + + $scope.loadHfindustry = function () { + $http.get('/static/data/hfindustry.json').then(function (resp) { + $scope.hfindustry = resp.data; + }) + }; + $scope.loadHfindustry(); + + $scope.onAlipayMccSelect = function (selectedItem) { + $scope.partner.alipay_category = selectedItem.label; + $scope.partner.alipayindustry = selectedItem.mccCode; + }; + + $scope.onRoyalPayIndustrySelect = function (selectedItem) { + $scope.partner.royalpay_label = selectedItem.label; + $scope.partner.royalpayindustry = selectedItem.mccCode; + }; + + $scope.onHfIndustrySelect = function (selectedItem) { + $scope.partner.hf_label = selectedItem.label; + $scope.partner.hfindustry = selectedItem.mccCode; + }; + + // $scope.t2city_map = angular.copy(t2city_map); + + $scope.timezones = timezone.configs(); + $scope.checkMerchantCodeIsValid = function (code) { + if (code.length != 4) { + $scope.merchantCodeChecked = false; + $scope.merchantIsValid = false; + return; + } + $http.get('/sys/partners/init/check_code_isvalid', {params: {clientMoniker: code}}).then(function (response) { + $scope.merchantIsValid = response.data; + $scope.merchantCodeChecked = true; + }); + }; + $scope.save = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + if (!$scope.partner.enable_cross_payment && !$scope.partner.enable_card_payment) { + alert("商户至少开通一种支付方式,请检查是否选择了跨境支付或卡支付!"); + return; + } + + if ($scope.partner.company_name.indexOf("Migration") != -1) { + alert("Company Name包含敏感词汇,请检查后重新提交!"); + return; + } + if ($scope.partner.company_phone_a && ('' + $scope.partner.company_phone_a != '')) { + if ($scope.partner.company_phone_a.indexOf('0') == 0) { + alert("Please remove the first character '0' of area code"); + return; + } + } + if ($scope.partner.contact_phone && ('' + $scope.partner.contact_phone != '')) { + if ($scope.partner.contact_phone.indexOf('0') == 0) { + alert("Please remove the first character '0' of area code"); + return; + } + } + $scope.partner.company_phone = '+' + $scope.partner.company_phone_c + ($scope.partner.company_phone_a || '') + $scope.partner.company_phone_p; + $scope.partner.contact_phone = '+' + $scope.partner.contact_phone_c + ($scope.partner.contact_phone_a || '') + $scope.partner.contact_phone_p; + $scope.partner.legal_representative_phone = '+' + $scope.partner.legal_representative_phone_c + ( $scope.partner.legal_representative_phone_a || '') + $scope.partner.legal_representative_phone_p; + $scope.partner.marketing_phone = '+' + $scope.partner.marketing_phone_c + ( $scope.partner.marketing_phone_a || '') + $scope.partner.marketing_phone_p; + if ($scope.partner.company_phone.indexOf(' ') != -1) { + alert('Company Phone can not contain space character'); + return; + } + if ($scope.partner.contact_phone.indexOf(' ') != -1) { + alert('Contact Phone can not contain space character'); + return; + } + if ($scope.partner.legal_representative_phone.indexOf(' ') != -1) { + alert('Representative phone can not contain space character'); + return; + } + if ($scope.partner.marketing_phone.indexOf(' ') != -1) { + alert('Marketing phone can not contain space character'); + return; + } + if ($scope.partner.contact_email.indexOf(' ') != -1) { + alert('Contact email Phone can not contain space character'); + return; + } + if ($scope.partner.legal_representative_email.indexOf(' ') != -1) { + alert('Representative email Phone can not contain space character'); + return; + } + + if ($scope.partner.marketing_email && $scope.partner.marketing_email.indexOf(' ') != -1) { + alert('Marketing email Phone can not contain space character'); + return; + } + if ($scope.partner.suburb.indexOf(' ') != -1) { + alert('suburb can not contain two and more continuous space characters'); + return; + } + if ($scope.partner.registered_suburb.indexOf(' ') != -1) { + alert('Registered suburb can not contain two and more continuous space characters'); + return; + } + if ($scope.partner.acn && $scope.partner.business_structure == 'Company') { + if ($scope.partner.acn.length != 9) { + alert('Acn is not valid'); + return; + } + } + if (!$scope.partner.logo_url) { + alert("Logo is necessary!"); + return; + } + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { + if (!$scope.partner.company_photo) { + alert('Shop Photo1 is necessary'); + return; + } + if (!$scope.partner.store_photo) { + alert('Shop Photo2 is necessary'); + return; + } + } + + if ($scope.partner.referrer_id) { + $scope.referrers.forEach(function (e) { + if ($scope.partner.referrer_id == e.org_id) { + $scope.partner.referrer_name = e.name; + return; + } + }) + } + + if ($scope.partner.client_pay_type.length == 0) { + alert('请选择商户支付场景') + return; + } + if ($scope.partner.client_pay_desc.length == 0) { + alert('请选择商户支付方式') + return; + } + if (typeof ($scope.partner.client_pay_type) == 'string' || typeof ($scope.partner.client_pay_desc) == 'string') { + $scope.partner.client_pay_type = $scope.partner.client_pay_type.split(","); + $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.split(","); + + } + if ($scope.partner.client_pay_type.indexOf('1') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) { + alert("请检查线上支付场景是否已选择支付方式"); + return; + } + } + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { + alert("请检查线下支付场景是否已选择支付方式"); + return; + } + } + if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0 && $scope.partner.client_pay_desc.join(',').indexOf('20399') < 0) { + alert("请检查线下支付是否已选择收银系统类型"); + return; + } + } + $scope.partner.client_pay_type = $scope.partner.client_pay_type.join(','); + $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(','); + $http.post('/sys/partners', $scope.partner).then(function (resp) { + commonDialog.alert({title: 'Success', content: 'Register new partner successfully', type: 'success'}); + $scope.updateMerchantLocation(); + // $scope.loadPartners(); + $state.go('partners.detail', {clientMoniker: resp.data.client_moniker}) + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }); + }; + $scope.uploadLogo = function (file) { + if (file != null) { + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.uploadShopPhoto = function (file) { + if (file != null) { + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.uploadStorePhoto = function (file) { + if (file != null) { + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.updateMerchantLocation = function () { + var params = window.frames['merchant_detail'].merchant_location; + if (params) { + $http.put('/sys/partners/modify/' + $scope.partner.client_moniker + '/location', params).then(function () { + }); + } + } + }]); + app.controller('partnerEditCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'partner','upayIndustryMap', + function ($scope, $http, $state, Upload, commonDialog, timezone, partner,upayIndustryMap) { + $scope.upayIndustrys = upayIndustryMap.configs(); + $scope.timezones = timezone.configs(); + $scope.partner = partner.data; + if (!$scope.partner.client_type) { + $scope.partner.client_type = 'cross-border'; + } + if($scope.partner.representativeInfo != null) + { + $scope.partner.registered_address = $scope.partner.representativeInfo.address; + $scope.partner.registered_suburb = $scope.partner.representativeInfo.suburb; + $scope.partner.registered_postcode = $scope.partner.representativeInfo.postcode; + $scope.partner.registered_state = $scope.partner.representativeInfo.state; + $scope.partner.legal_representative_person = $scope.partner.representativeInfo.representative_person; + $scope.partner.legal_representative_phone = $scope.partner.representativeInfo.phone; + $scope.partner.legal_representative_email = $scope.partner.representativeInfo.email; + $scope.partner.legal_representative_job = $scope.partner.representativeInfo.job_title; + + $scope.partner.marketing_person = $scope.partner.representativeInfo.marketing_person; + $scope.partner.marketing_phone = $scope.partner.representativeInfo.marketing_phone; + $scope.partner.marketing_email = $scope.partner.representativeInfo.marketing_email; + $scope.partner.marketing_job = $scope.partner.representativeInfo.marketing_job_title; + + $scope.partner.legal_representative_wechatid = $scope.partner.representativeInfo.legal_representative_wechatid; + $scope.partner.marketing_wechatid = $scope.partner.representativeInfo.marketing_wechatid; + } + + $scope.enablePaymentType = function (type) { + $scope.partner[type] = !$scope.partner[type]; + }; + + if ($state.params.commitCardPayment) { + $scope.enablePaymentType('enable_card_payment'); + } + + if ($state.params.commitCrossBorderPayment) { + $scope.enablePaymentType('enable_cross_payment'); + } + + function hasRole() { + var rolenum; + switch (sessionStorage.getItem('role')) { + case "administrator": + rolenum = 1; + break; + case "bduser": + rolenum = 4; + break; + case "salesmanager": + rolenum = 8192; + break; + case "accountant": + rolenum = 8; + break; + case "sitemanager": + rolenum = 128; + break; + case "director": + rolenum = 64; + break; + case "developer": + rolenum = 256; + break; + case "compliance": + rolenum = 2; + break; + case "guest": + rolenum = 2048; + break; + case "orgmanager": + rolenum = 4096; + break; + case "riskmanager": + rolenum = 1024; + break; + default: + break; + } + if ((window.currentUser.role & rolenum) >0) { + return true; + }else { + sessionStorage.removeItem('role'); + return false; + } + } + + if (hasRole()) { + $scope.role = sessionStorage.getItem('role'); + } + + var origin_referrer_id = angular.copy($scope.partner.referrer_id); + var resetClientPayDescByTpey = function (type) { + type = parseInt(type); + if (type == 1) { + removeClientPayDesc($scope.partner.client_pay_desc, '10'); + } + if (type == 2) { + removeClientPayDesc($scope.partner.client_pay_desc, '20'); + } + }; + var compare = function (x, y) { + x = parseInt(x); + y = parseInt(y); + if (x < y) { + return -1; + } else if (x > y) { + return 1; + } else { + return 0; + } + } + $scope.toggleClientPayType = function (type) { + if (!$scope.partner.client_pay_type) { + $scope.partner.client_pay_type = []; + } + var $idx = $scope.partner.client_pay_type.indexOf(type); + if ($idx >= 0) { + $scope.partner.client_pay_type.splice($idx, 1); + resetClientPayDescByTpey(type); + } else { + $scope.partner.client_pay_type.push(type); + $scope.partner.client_pay_type.sort(compare); + } + }; + $scope.toggleClientPayDesc = function (type) { + if (!$scope.partner.client_pay_desc) { + $scope.partner.client_pay_desc = []; + } + var $idx = $scope.partner.client_pay_desc.indexOf(type); + if ($idx >= 0) { + if (type == '203') { + removeClientPayDesc($scope.partner.client_pay_desc, '2030') + } + $scope.partner.client_pay_desc.splice($idx, 1); + } else { + $scope.partner.client_pay_desc.push(type); + $scope.partner.client_pay_desc.sort(compare); + } + }; + + $scope.partner.sameAsContactPerson = false; + $scope.checkboxOnclick = function (){ + $scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson); + if($scope.partner.sameAsContactPerson) { + $scope.partner.legal_representative_person = $scope.partner.contact_person; + $scope.partner.legal_representative_phone = $scope.partner.contact_phone; + $scope.partner.legal_representative_email = $scope.partner.contact_email; + $scope.partner.legal_representative_job = $scope.partner.contact_job; + $scope.partner.legal_representative_wechatid = $scope.partner.contact_wechatid; + } + } + + $scope.partner.marketingSameAsContact = false; + $scope.checkMarketingSameAsContact = function (){ + $scope.partner.marketingSameAsContact = !($scope.partner.marketingSameAsContact); + if($scope.partner.marketingSameAsContact) { + $scope.partner.marketing_person = $scope.partner.contact_person; + $scope.partner.marketing_phone = $scope.partner.contact_phone; + $scope.partner.marketing_email = $scope.partner.contact_email; + $scope.partner.marketing_job = $scope.partner.contact_job; + $scope.partner.marketing_wechatid = $scope.partner.contact_wechatid; + } + } + + $scope.partner.sameAsAddress=false; + $scope.sameAddress = function (){ + $scope.partner.sameAsAddress=!($scope.partner.sameAsAddress); + if($scope.partner.sameAsAddress) { + $scope.partner.registered_address = $scope.partner.address; + $scope.partner.registered_suburb = $scope.partner.suburb; + $scope.partner.registered_postcode = $scope.partner.postcode; + $scope.partner.registered_state = $scope.partner.state; + } + } + + $scope.listReferrers = function () { + $http.get('/sys/orgs/referrer').then(function (resp) { + $scope.referrers = resp.data; + }) + }; + $scope.listReferrers(); + + $scope.loadAlipayCategory = function () { + $http.get('/static/data/alipayMcc.json').then(function (resp) { + $scope.alipayMccCategory = resp.data; + }) + }; + $scope.loadAlipayCategory(); + $scope.loadJDindustry = function () { + $http.get('/static/data/jdindustry.json').then(function (resp) { + $scope.jdindustry = resp.data; + }) + }; + $scope.loadJDindustry(); + + $scope.loadLakalaPayindustry = function () { + $http.get('/static/data/lakalapayindustry.json').then(function (resp) { + $scope.lakalapayindustry = resp.data; + }) + }; + $scope.loadLakalaPayindustry(); + + $scope.loadLakalaPaySettle = function () { + $http.get('/static/data/lakalapaysettle.json').then(function (resp) { + $scope.lakalapaysettle = resp.data; + }) + }; + $scope.loadLakalaPaySettle(); + + $scope.loadLakalaPayGoods = function () { + $http.get('/static/data/lakalapaygoods.json').then(function (resp) { + $scope.lakalapaygoods = resp.data; + }) + }; + $scope.loadLakalaPayGoods(); + + $scope.loadRoyalpayindustry = function () { + $http.get('/static/data/royalpayindustry.json').then(function (resp) { + $scope.royalpayindustry = resp.data; + }) + }; + $scope.loadRoyalpayindustry(); + + $scope.loadHfindustry = function () { + $http.get('/static/data/hfindustry.json').then(function (resp) { + $scope.hfindustry = resp.data; + }) + }; + $scope.loadHfindustry(); + + $scope.onAlipayMccSelect = function (selectedItem) { + $scope.partner.alipay_category = selectedItem.label; + $scope.partner.alipayindustry = selectedItem.mccCode; + }; + $scope.onRoyalPayIndustrySelect = function (selectedItem) { + $scope.partner.royalpay_label = selectedItem.label; + $scope.partner.royalpayindustry = selectedItem.mccCode; + }; + $scope.onHfIndustrySelect = function (selectedItem) { + $scope.partner.hf_label = selectedItem.label; + $scope.partner.hfindustry = selectedItem.mccCode; + }; + + + $scope.updatePartner = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); + return; + } + + if ($scope.partner.company_name.indexOf("Migration") != -1) { + alert("Company Name包含敏感词汇,请检查后重新提交!"); + return; + } + if ($scope.partner.company_phone.indexOf(' ') != -1) { + alert('Company Phone can not contain space character'); + return; + } + if ($scope.partner.contact_email.indexOf(' ') != -1) { + alert('Contact email Phone can not contain space character'); + return; + } + if ($scope.partner.suburb.indexOf(' ') != -1) { + alert('suburb can not contain two and more continuous space characters'); + return; + } + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { + if (!$scope.partner.company_photo) { + alert('Shop Photo1 is necessary'); + return; + } + if (!$scope.partner.store_photo) { + alert('Shop Photo2 is necessary'); + return; + } + } + + if ($scope.partner.acn && $scope.partner.business_structure == 'Company') { + if ($scope.partner.acn.length != 9) { + alert('Acn is not valid'); + } + } + if ($scope.partner.referrer_id) { + $scope.referrers.forEach(function (e) { + if ($scope.partner.referrer_id == e.org_id) { + $scope.partner.referrer_name = e.name; + return; + } + }) + } + var content = ''; + if (!origin_referrer_id && $scope.partner.referrer_id) { + content = 'Update partner info successfully,But You Had add new Referrer,Please Change the BD Commission Proportion!'; + } + if ($scope.partner.client_pay_type.length == 0) { + alert('请选择商户支付场景') + return; + } + if ($scope.partner.client_pay_desc.length == 0) { + alert('请选择商户支付方式') + return; + } + if ($scope.partner.client_pay_type.indexOf('1') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) { + alert("请检查线上支付场景是否已选择支付方式"); + return; + } + } + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { + alert("请检查线下支付场景是否已选择支付方式"); + return; + } + } + if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0 && $scope.partner.client_pay_desc.join(',').indexOf('20399') < 0) { + alert("请检查线下支付是否已选择收银系统类型"); + return; + } + } + $scope.partner.client_pay_type = $scope.partner.client_pay_type.join(','); + $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(','); + $http.put('/sys/partners/' + $scope.partner.client_moniker, $scope.partner).then(function () { + if (content != '') { + commonDialog.alert({ + title: 'Warning', + content: content, + type: 'error' + }); + } else { + commonDialog.alert({ + title: 'Success', + content: 'Update partner information successfully', + type: 'success' + }); + } + $scope.updateMerchantLocation(); + $scope.loadPartners(); + $state.go('^.detail', {clientMoniker: $scope.partner.client_moniker}, {reload: true}); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + }); + }; + $scope.uploadLogo = function (file) { + if (file != null) { + if (file.size > 1 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) + } else { + $scope.logoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.logoProgress; + $scope.partner.logo_id = resp.data.fileid; + $scope.partner.logo_url = resp.data.url; + }, function (resp) { + delete $scope.logoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.uploadShopPhoto = function (file) { + if (file != null) { + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.shopPhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.shopPhotoProgress; + $scope.partner.company_photo = resp.data.url; + }, function (resp) { + delete $scope.shopPhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.uploadStorePhoto = function (file) { + if (file != null) { + if (file.size > 2 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) + } else { + $scope.storePhotoProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + delete $scope.storePhotoProgress; + $scope.partner.store_photo = resp.data.url; + }, function (resp) { + delete $scope.storePhotoProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.storePhotoProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + + $scope.getMerchantLocation = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/location').then(function (resp) { + $scope.merchant_location = resp.data; + }); + }; + $scope.getMerchantLocation(); + + $scope.updateMerchantLocation = function () { + var params = window.frames['merchant_detail'].merchant_location; + if (params) { + $http.put('/sys/partners/modify/' + $scope.partner.client_moniker + '/location', params).then(function () { + }); + } + } + }]); + return app; +}); diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index d0394b4a5..af21458ea 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -96,10 +96,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter templateUrl: '/static/payment/partner/templates/partners.html', controller: 'partnerListCtrl', data: {label: '商户列表'} - }).state('newPartners', { - url: '/partners/new', - templateUrl: '/static/payment/partner/templates/add_partner.html', - controller: 'addPartnerCtrl' }).state('businessCompliance', { url: '/partners/compliance', templateUrl: '/static/payment/partner/templates/partner_compliance.html', @@ -117,15 +113,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter return $http.get('/sys/partners/' + $stateParams.clientMoniker); }] } - }).state('partners.edit', { - url: '/{clientMoniker}/edit', - templateUrl: '/static/payment/partner/templates/partner_edit.html', - controller: 'partnerEditCtrl', - resolve: { - partner: ['$http', '$stateParams', function ($http, $stateParams) { - return $http.get('/sys/partners/' + $stateParams.clientMoniker); - }] - } }).state('partners.detail.payment_info', { url: '/payment', templateUrl: '/static/payment/partner/templates/partner_payment_info.html', @@ -160,14 +147,19 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter controller: 'partnerDeviceCtrl' }).state('partners.detail.files', { url: '/files', + params: {commitType: "cross-border"}, templateUrl: '/static/payment/partner/templates/partner_auth_files.html', - controller: 'partnerAuthFileCtrl', + controller: 'partnerAuthFileCtrl' + }).state('partners.detail.files.CP_files', { + url: '/cp_files', + templateUrl: '/static/payment/partner/templates/partner_cp_auth_files.html', + controller: 'partnerCPAuthFileCtrl', resolve: { file: ['$http', '$stateParams', function ($http, $stateParams) { return $http.get('/sys/partners/' + $stateParams.clientMoniker + '/file'); }] } - }).state('partners.detail.MW_files', { + }).state('partners.detail.files.MW_files', { url: '/mw_files', templateUrl: '/static/payment/partner/templates/partner_mw_auth_files.html', controller: 'partnerMWAuthFileCtrl', @@ -219,1513 +211,1268 @@ 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('partnerListCtrl', ['$scope', '$sce', '$http', '$filter', '$uibModal', 'businessStructuresMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap', - function ($scope, $sce, $http, $filter, $uibModal, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) { + 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.analysisClients = function () { - $http.get('/sys/partners/analysis').then(function (resp) { - $scope.analysis = resp.data; - }) - }; - if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) { - $scope.analysisClients(); + $scope.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.pagination = {}; - $scope.industries = industryMap.configs(); - $scope.states = stateMap.configs(); - $scope.countries = countryMap.configs(); - $scope.sectors = sectorMap.configs(); - $scope.business_structures = businessStructuresMap.configs(); - $scope.clean_days = angular.copy(clean_days_map); - $scope.bd_citys = angular.copy(bd_city_map); - $scope.params = {textType: 'all', org_name: 'ALL', industry: "0"}; - $scope.loadRoyalpayindustry = function () { - $http.get('/static/data/royalpayindustry.json').then(function (resp) { - $scope.royalpayindustry = resp.data; - var selectAll = { - "label": "All", - "mccCode": "0", - "children":{} - }; - $scope.royalpayindustry.unshift(selectAll); - }) + + $scope.enablePaymentType = function (type) { + $scope.partner[type] = !$scope.partner[type]; }; - $scope.loadRoyalpayindustry(); + if ($state.params.commitCardPayment) { + $scope.enablePaymentType('enable_card_payment'); + } - $scope.onRoyalPayIndustrySelect = function (selectedItem) { - $scope.params.royalpay_label = selectedItem.label; - $scope.params.industry = selectedItem.mccCode; - $scope.loadPartners(1); - }; + if ($state.params.commitCrossBorderPayment) { + $scope.enablePaymentType('enable_cross_payment'); + } - $scope.loadPartners = function (page) { - var params = angular.copy($scope.params); - params.page = page || $scope.pagination.page || 1; - $http.get('/sys/partners', {params: params}).then(function (resp) { - $scope.partners = resp.data.data; - $scope.pagination = resp.data.pagination; - }); - }; + 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; + } + } - $scope.exportPartnersExcel = function () { - var params = angular.copy($scope.params); - var param_str = Object.keys(params).map(function (key) { - var value = params[key]; - if (angular.isDate(value)) { - value = $filter('date')(value, 'yyyy-MM-ddTHH:mm:ssZ') + 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') } - return key + '=' + encodeURIComponent(value) - }).join('&'); - window.open('/sys/partners/exporting_excel?'+param_str) + $scope.partner.client_pay_desc.splice($idx, 1); + } else { + $scope.partner.client_pay_desc.push(type); + $scope.partner.client_pay_desc.sort(compare); + } }; - /*$scope.loadLocations = function () { - var params = angular.copy($scope.params); - $http.get('/sys/partners/merchant/list_locations', {params: params}).then(function (resp) { - $scope.locations = resp.data; - window.merchant_maps.initMap($scope.locations); - }); - };*/ - $scope.today = new Date(); + $scope.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.listBDUsers = function () { - $http.get('/sys/manager_accounts/roles/bd_user').then(function (resp) { - $scope.bdUserSource = resp.data; - }) - }; - $scope.listBDUsers(); + $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; + } + } - if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) { - $scope.showOrg = 'Organization'; - $http.get('/sys/orgs/list_all_Org', {params: {}}).then(function (resp) { - $scope.orgs = resp.data; - }); + $scope.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.loadOrgs = function () { - var params = angular.copy($scope.params); - $http.get('/sys/orgs/orgChild', {params: params}).then(function (resp) { - $scope.orgs_child = resp.data; + $scope.listReferrers = function () { + $http.get('/sys/orgs/referrer').then(function (resp) { + $scope.referrers = resp.data; }) }; - $scope.loadOrgs(); + $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.onOrgsSelect = function (selectedItem) { - $scope.params.org_id = selectedItem.org_id; - $scope.params.org_name = selectedItem.label; - $scope.loadPartners(); - }; - */ - /* $scope.chooseOrg = function (org) { - if (org == 'all') { - delete $scope.params.org_id; - $scope.showOrg = 'All' - } else { - $scope.params.org_id = org.org_id; - $scope.showOrg = org.name; - } - $scope.loadPartners(1); - };*/ - - $scope.loadPartners(1); - - - $scope.openClientBoard = function (client) { - $uibModal.open({ - templateUrl: '/static/analysis/templates/partner_card.html', - controller: 'partnerCardCtrl', - resolve: { - clientMoniker: function () { - return client.client_moniker - } - }, - size: 'lg' + $scope.loadLakalaPayindustry = function () { + $http.get('/static/data/lakalapayindustry.json').then(function (resp) { + $scope.lakalapayindustry = resp.data; }) - }; - /*$scope.toogleMapSelect = function () { - $scope.mapFrame = 'all_locations.html'; - $scope.loadLocations(); - } - $scope.toogleMerchantSelect = function () { - $scope.mapFrame = null; - } - $scope.toogleMerchantSelect();*/ - }]); - app.controller('compliancePartnerCtrl', ['$scope', '$sce', '$http', '$filter', '$uibModal', 'businessStructuresMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap', - function ($scope, $sce, $http, $filter, $uibModal, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) { + $scope.loadLakalaPayindustry(); - $scope.analysisClients = function () { - $http.get('/sys/partners/analysis').then(function (resp) { - $scope.analysis = resp.data; + $scope.loadLakalaPaySettle = function () { + $http.get('/static/data/lakalapaysettle.json').then(function (resp) { + $scope.lakalapaysettle = resp.data; }) }; - if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) { - $scope.analysisClients(); - } - $scope.pagination = {}; - $scope.industries = industryMap.configs(); - $scope.states = stateMap.configs(); - $scope.countries = countryMap.configs(); - $scope.sectors = sectorMap.configs(); - $scope.business_structures = businessStructuresMap.configs(); - $scope.clean_days = angular.copy(clean_days_map); - $scope.bd_citys = angular.copy(bd_city_map); - $scope.params = {textType: 'all', org_name: 'ALL'}; - - $scope.loadPartners = function (page) { - var params = angular.copy($scope.params); - params.page = page || $scope.pagination.page || 1; - $http.get('/sys/partners/compliance', {params: params}).then(function (resp) { - $scope.partners = resp.data.data; - $scope.pagination = resp.data.pagination; - }); - }; - - $scope.today = new Date(); + $scope.loadLakalaPaySettle(); - $scope.listBDUsers = function () { - $http.get('/sys/manager_accounts/roles/bd_user').then(function (resp) { - $scope.bdUserSource = resp.data; + $scope.loadLakalaPayGoods = function () { + $http.get('/static/data/lakalapaygoods.json').then(function (resp) { + $scope.lakalapaygoods = resp.data; }) }; - $scope.listBDUsers(); - - if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) { - $scope.showOrg = 'Organization'; - $http.get('/sys/orgs/list_all_Org', {params: {}}).then(function (resp) { - $scope.orgs = resp.data; - }); - } + $scope.loadLakalaPayGoods(); - $scope.loadOrgs = function () { - var params = angular.copy($scope.params); - $http.get('/sys/orgs/orgChild', {params: params}).then(function (resp) { - $scope.orgs_child = resp.data; + $scope.loadRoyalpayindustry = function () { + $http.get('/static/data/royalpayindustry.json').then(function (resp) { + $scope.royalpayindustry = resp.data; }) }; - $scope.loadOrgs(); - - $scope.loadPartners(1); - + $scope.loadRoyalpayindustry(); - $scope.openClientBoard = function (client) { - $uibModal.open({ - templateUrl: '/static/analysis/templates/partner_card.html', - controller: 'partnerCardCtrl', - resolve: { - clientMoniker: function () { - return client.client_moniker - } - }, - size: 'lg' + $scope.loadHfindustry = function () { + $http.get('/static/data/hfindustry.json').then(function (resp) { + $scope.hfindustry = resp.data; }) - }; - }]); - app.controller('addPartnerCtrl', ['$rootScope', '$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'businessStructuresMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap', function ($rootScope, $scope, $http, $state, Upload, commonDialog, timezone, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) { - if ($scope.partner_application) { - $scope.partner = angular.copy($scope.partner_application); - delete $rootScope.partner_application; - } else { - $scope.partner = {timezone: 'Australia/Melbourne'}; - } - $scope.initMerchantCode = function () { - $http.get('/sys/partners/init/merchant_code').then(function (response) { - $scope.partner.client_moniker = response.data.partner_code; - $scope.merchantCodeChecked = true; - $scope.merchantIsValid = true; - }); - }; - $scope.initMerchantCode(); - $scope.partner.company_phone_c = 61; - $scope.partner.contact_phone_c = 61; - $scope.partner.client_pay_type = []; - $scope.partner.client_pay_desc = []; - var resetClientPayDescByTpey = function (type) { - type = parseInt(type); - if (type == 1) { - removeClientPayDesc($scope.partner.client_pay_desc, '10'); - } - if (type == 2) { - removeClientPayDesc($scope.partner.client_pay_desc, '20'); - } - }; - $scope.partner.sameAsContactPerson = false; - $scope.checkboxOnclick = function (){ - $scope.partner.sameAsContactPerson = !($scope.partner.sameAsContactPerson); - if($scope.partner.sameAsContactPerson) { - $scope.partner.legal_representative_person = $scope.partner.contact_person; - $scope.partner.legal_representative_phone_a = $scope.partner.contact_phone_a; - $scope.partner.legal_representative_phone_c = $scope.partner.contact_phone_c; - $scope.partner.legal_representative_phone_p = $scope.partner.contact_phone_p; - $scope.partner.legal_representative_email = $scope.partner.contact_email; - $scope.partner.legal_representative_job = $scope.partner.contact_job; - $scope.partner.legal_representative_wechatid = $scope.partner.contact_wechatid; - } - } - - $scope.partner.marketingSameAsContact = false; - $scope.checkMarketingSameAsContact = function (){ - $scope.partner.marketingSameAsContact = !($scope.partner.marketingSameAsContact); - if($scope.partner.marketingSameAsContact) { - $scope.partner.marketing_person = $scope.partner.contact_person; - $scope.partner.marketing_phone_a = $scope.partner.contact_phone_a; - $scope.partner.marketing_phone_c = $scope.partner.contact_phone_c; - $scope.partner.marketing_phone_p = $scope.partner.contact_phone_p; - $scope.partner.marketing_email = $scope.partner.contact_email; - $scope.partner.marketing_job = $scope.partner.contact_job; - $scope.partner.marketing_wechatid = $scope.partner.contact_wechatid; - } - } - - $scope.partner.sameAsAddress=false; - $scope.sameAddress = function (){ - $scope.partner.sameAsAddress = !($scope.partner.sameAsAddress); - if($scope.partner.sameAsAddress) { - $scope.partner.registered_address = $scope.partner.address; - $scope.partner.registered_suburb = $scope.partner.suburb; - $scope.partner.registered_postcode = $scope.partner.postcode; - $scope.partner.registered_state = $scope.partner.state; - } - } - - var compare = function (x, y) { - x = parseInt(x); - y = parseInt(y); - if (x < y) { - return -1; - } else if (x > y) { - return 1; - } else { - return 0; - } - } - $scope.toggleClientPayType = function (type) { - if ($scope.partner.client_pay_type == null || $scope.partner.client_pay_type == undefined) { - $scope.partner.client_pay_type = []; - } - var $idx = $scope.partner.client_pay_type.indexOf(type); - if ($idx >= 0) { - $scope.partner.client_pay_type.splice($idx, 1); - resetClientPayDescByTpey(type); - } else { - $scope.partner.client_pay_type.push(type); - $scope.partner.client_pay_type.sort(compare); - } - }; - $scope.toggleClientPayDesc = function (type) { - if ($scope.partner.client_pay_desc == null || $scope.partner.client_pay_desc == undefined) { - $scope.partner.client_pay_desc = []; - } - var $idx = $scope.partner.client_pay_desc.indexOf(type); - if ($idx >= 0) { - if (type == '203') { - removeClientPayDesc($scope.partner.client_pay_desc, '2030') - } - $scope.partner.client_pay_desc.splice($idx, 1); - } else { - $scope.partner.client_pay_desc.push(type); - $scope.partner.client_pay_desc.sort(compare); - } - }; - $scope.pagination = {}; - $scope.industries = industryMap.configs(); - $scope.states = stateMap.configs(); - $scope.countries = countryMap.configs(); - $scope.sectors = sectorMap.configs(); - $scope.business_structures = businessStructuresMap.configs(); - $scope.clean_days = angular.copy(clean_days_map); - $scope.bd_citys = angular.copy(bd_city_map); - $scope.params = {textType: 'all', org_name: 'ALL'}; - $scope.merchantIsValid = false; - $scope.merchantCodeChecked = false; - - function remove(arr, val) { - if (angular.isArray(arr)) { - for (var i = arr.length; i--;) { - if (arr[i].value == val) { - arr.splice(i, 1); - break; - } - } - } - return arr; - } - - var industries = angular.copy($scope.industries); - $scope.industries = remove(industries, 331); - - $scope.listReferrers = function () { - $http.get('/sys/orgs/referrer').then(function (resp) { - $scope.referrers = resp.data; - }) - }; - $scope.listReferrers(); - - $scope.loadAlipayCategory = function () { - $http.get('/static/data/alipayMcc.json').then(function (resp) { - $scope.alipayMccCategory = resp.data; - }) - }; - $scope.loadAlipayCategory(); - $scope.loadJDindustry = function () { - $http.get('/static/data/jdindustry.json').then(function (resp) { - $scope.jdindustry = resp.data; - }) - }; - $scope.loadJDindustry(); - - $scope.loadLakalaPayindustry = function () { - $http.get('/static/data/lakalapayindustry.json').then(function (resp) { - $scope.lakalapayindustry = resp.data; - }) - }; - $scope.loadLakalaPayindustry(); - - $scope.loadLakalaPaySettle = function () { - $http.get('/static/data/lakalapaysettle.json').then(function (resp) { - $scope.lakalapaysettle = resp.data; - }) - }; - $scope.loadLakalaPaySettle(); - - $scope.loadLakalaPayGoods = function () { - $http.get('/static/data/lakalapaygoods.json').then(function (resp) { - $scope.lakalapaygoods = resp.data; - }) - }; - $scope.loadLakalaPayGoods(); - - $scope.loadRoyalpayindustry = function () { - $http.get('/static/data/royalpayindustry.json').then(function (resp) { - $scope.royalpayindustry = resp.data; - }) - }; - $scope.loadRoyalpayindustry(); - - $scope.loadHfindustry = function () { - $http.get('/static/data/hfindustry.json').then(function (resp) { - $scope.hfindustry = resp.data; - }) - }; - $scope.loadHfindustry(); - - $scope.onAlipayMccSelect = function (selectedItem) { - $scope.partner.alipay_category = selectedItem.label; - $scope.partner.alipayindustry = selectedItem.mccCode; - }; - - $scope.onRoyalPayIndustrySelect = function (selectedItem) { - $scope.partner.royalpay_label = selectedItem.label; - $scope.partner.royalpayindustry = selectedItem.mccCode; - }; - - $scope.onHfIndustrySelect = function (selectedItem) { - $scope.partner.hf_label = selectedItem.label; - $scope.partner.hfindustry = selectedItem.mccCode; - }; + $scope.loadHfindustry(); - // $scope.t2city_map = angular.copy(t2city_map); + $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.timezones = timezone.configs(); - $scope.checkMerchantCodeIsValid = function (code) { - if (code.length != 4) { - $scope.merchantCodeChecked = false; - $scope.merchantIsValid = false; - return; - } - $http.get('/sys/partners/init/check_code_isvalid', {params: {clientMoniker: code}}).then(function (response) { - $scope.merchantIsValid = response.data; - $scope.merchantCodeChecked = true; - }); - }; - $scope.save = function (form) { - if (form.$invalid) { - angular.forEach(form, function (item, key) { - if (key.indexOf('$') < 0) { - item.$dirty = true; - } - }); - return; - } - if ($scope.partner.company_name.indexOf("Migration") != -1) { - alert("Company Name包含敏感词汇,请检查后重新提交!"); - return; - } - if ($scope.partner.company_phone_a && ('' + $scope.partner.company_phone_a != '')) { - if ($scope.partner.company_phone_a.indexOf('0') == 0) { - alert("Please remove the first character '0' of area code"); + $scope.updatePartner = function (form) { + if (form.$invalid) { + angular.forEach(form, function (item, key) { + if (key.indexOf('$') < 0) { + item.$dirty = true; + } + }); return; } - } - if ($scope.partner.contact_phone && ('' + $scope.partner.contact_phone != '')) { - if ($scope.partner.contact_phone.indexOf('0') == 0) { - alert("Please remove the first character '0' of area code"); + + if ($scope.partner.company_name.indexOf("Migration") != -1) { + alert("Company Name包含敏感词汇,请检查后重新提交!"); return; } - } - $scope.partner.company_phone = '+' + $scope.partner.company_phone_c + ($scope.partner.company_phone_a || '') + $scope.partner.company_phone_p; - $scope.partner.contact_phone = '+' + $scope.partner.contact_phone_c + ($scope.partner.contact_phone_a || '') + $scope.partner.contact_phone_p; - $scope.partner.legal_representative_phone = '+' + $scope.partner.legal_representative_phone_c + ( $scope.partner.legal_representative_phone_a || '') + $scope.partner.legal_representative_phone_p; - $scope.partner.marketing_phone = '+' + $scope.partner.marketing_phone_c + ( $scope.partner.marketing_phone_a || '') + $scope.partner.marketing_phone_p; - if ($scope.partner.company_phone.indexOf(' ') != -1) { - alert('Company Phone can not contain space character'); - return; - } - if ($scope.partner.contact_phone.indexOf(' ') != -1) { - alert('Contact Phone can not contain space character'); - return; - } - if ($scope.partner.legal_representative_phone.indexOf(' ') != -1) { - alert('Representative phone can not contain space character'); - return; - } - if ($scope.partner.marketing_phone.indexOf(' ') != -1) { - alert('Marketing phone can not contain space character'); - return; - } - if ($scope.partner.contact_email.indexOf(' ') != -1) { - alert('Contact email Phone can not contain space character'); - return; - } - if ($scope.partner.legal_representative_email.indexOf(' ') != -1) { - alert('Representative email Phone can not contain space character'); - return; - } - if ($scope.partner.marketing_email.indexOf(' ') != -1) { - alert('Marketing email Phone can not contain space character'); - return; - } - if ($scope.partner.suburb.indexOf(' ') != -1) { - alert('suburb can not contain two and more continuous space characters'); - return; - } - if ($scope.partner.registered_suburb.indexOf(' ') != -1) { - alert('Registered suburb can not contain two and more continuous space characters'); - return; - } - if ($scope.partner.acn && $scope.partner.business_structure == 'Company') { - if ($scope.partner.acn.length != 9) { - alert('Acn is not valid'); + if ($scope.partner.company_phone.indexOf(' ') != -1) { + alert('Company Phone can not contain space character'); return; } - } - if (!$scope.partner.logo_url) { - alert("Logo is necessary!"); - return; - } - if ($scope.partner.client_pay_type.indexOf('2') >= 0) { - if (!$scope.partner.company_photo) { - alert('Shop Photo1 is necessary'); + if ($scope.partner.contact_email.indexOf(' ') != -1) { + alert('Contact email Phone can not contain space character'); return; } - if (!$scope.partner.store_photo) { - alert('Shop Photo2 is necessary'); + if ($scope.partner.suburb.indexOf(' ') != -1) { + alert('suburb can not contain two and more continuous space characters'); return; } - } - - if ($scope.partner.referrer_id) { - $scope.referrers.forEach(function (e) { - if ($scope.partner.referrer_id == e.org_id) { - $scope.partner.referrer_name = e.name; + 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.client_pay_type.length == 0) { - alert('请选择商户支付场景') - return; - } - if ($scope.partner.client_pay_desc.length == 0) { - alert('请选择商户支付方式') - return; - } - if (typeof ($scope.partner.client_pay_type) == 'string' || typeof ($scope.partner.client_pay_desc) == 'string') { - $scope.partner.client_pay_type = $scope.partner.client_pay_type.split(","); - $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.split(","); - - } - if ($scope.partner.client_pay_type.indexOf('1') >= 0) { - if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) { - alert("请检查线上支付场景是否已选择支付方式"); - return; } - } - if ($scope.partner.client_pay_type.indexOf('2') >= 0) { - if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { - alert("请检查线下支付场景是否已选择支付方式"); - return; - } - } - if ($scope.partner.client_pay_desc.join(',').indexOf('203') >= 0) { - if ($scope.partner.client_pay_desc.join(',').indexOf('2030') < 0 && $scope.partner.client_pay_desc.join(',').indexOf('20399') < 0) { - alert("请检查线下支付是否已选择收银系统类型"); - return; - } - } - $scope.partner.client_pay_type = $scope.partner.client_pay_type.join(','); - $scope.partner.client_pay_desc = $scope.partner.client_pay_desc.join(','); - $http.post('/sys/partners', $scope.partner).then(function (resp) { - commonDialog.alert({title: 'Success', content: 'Register new partner successfully', type: 'success'}); - $scope.updateMerchantLocation(); - // $scope.loadPartners(); - $state.go('partners.detail', {clientMoniker: resp.data.client_moniker}) - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }); - }; - $scope.uploadLogo = function (file) { - if (file != null) { - if (file.size > 1 * 1024 * 1024) { - commonDialog.alert({title: 'Error', content: '文件大小不能超过1MB,请压缩后重试', type: 'error'}) - } else { - $scope.logoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.logoProgress; - $scope.partner.logo_id = resp.data.fileid; - $scope.partner.logo_url = resp.data.url; - }, function (resp) { - delete $scope.logoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.logoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) - } - } - }; - $scope.uploadShopPhoto = function (file) { - if (file != null) { - if (file.size > 2 * 1024 * 1024) { - commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) - } else { - $scope.shopPhotoProgress = {value: 0}; - Upload.upload({ - url: '/attachment/files', - data: {file: file} - }).then(function (resp) { - delete $scope.shopPhotoProgress; - $scope.partner.company_photo = resp.data.url; - }, function (resp) { - delete $scope.shopPhotoProgress; - commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) - }, function (evt) { - $scope.shopPhotoProgress.value = parseInt(100 * evt.loaded / evt.total); - }) + if ($scope.partner.acn && $scope.partner.business_structure == 'Company') { + if ($scope.partner.acn.length != 9) { + alert('Acn is not valid'); + } } - } - }; - - $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); + 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; + } }) } - } - }; - - $scope.updateMerchantLocation = function () { - var params = window.frames['merchant_detail'].merchant_location; - if (params) { - $http.put('/sys/partners/modify/' + $scope.partner.client_moniker + '/location', params).then(function () { - }); - } - } - }]); - app.controller('partnerDetailCtrl', ['$scope', '$http', '$state', '$uibModal', '$rootScope', 'Upload', 'commonDialog', 'partner', '$sce', function ($scope, $http, $state, $uibModal, $rootScope, Upload, commonDialog, partner, $sce) { - $scope.init = {wechat_compliance: false, local_merchant: false}; - $scope.partner = partner.data; - $scope.isComplianceOfCompanyName = false; - $scope.isComplianceOfShortName = false; - $scope.isComplianceOfBusinessStructure = false; - 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; + 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!'; } - } - return false; - }; - if (partner.data.company_name != null) { - $scope.isComplianceOfCompanyName = $scope.decideCompliance(partner.data.company_name); - } - if (partner.data.short_name != null) { - $scope.isComplianceOfShortName = $scope.decideCompliance(partner.data.short_name); - } - if (partner.data.business_structure != null) { - $scope.isComplianceOfBusinessStructure = $scope.decideCompliance(partner.data.business_structure); - } - $scope.showDBUsers = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/bd_user').then(function (resp) { - $scope.partner.client_bds = resp.data; - }) - }; - $scope.showDBUsers(); - $scope.showFile = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_agree_file').then(function (resp) { - $scope.fileManager = resp.data; - }); - }; - $scope.showFile(); - $scope.passClient = function () { - if ($scope.partner.enable_hf) { - if ($scope.partner.hfindustry == null) { - alert("已开启HF支付通道,HF行业不可为空!"); + if ($scope.partner.client_pay_type.length == 0) { + alert('请选择商户支付场景') 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 ($scope.partner.client_pay_desc.length == 0) { + alert('请选择商户支付方式') + return; } - if ($scope.isComplianceOfShortName) { - info.push('Short Name'); + if ($scope.partner.client_pay_type.indexOf('1') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) { + alert("请检查线上支付场景是否已选择支付方式"); + return; + } } - if ($scope.isComplianceOfBusinessStructure) { - info.push('Business Structure'); + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { + if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { + alert("请检查线下支付场景是否已选择支付方式"); + 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)) { + 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: 'Success', - content: 'Comply Passed!', - type: 'success' + title: 'Warning', + content: content, + type: 'error' }); } else { commonDialog.alert({ title: 'Success', - content: 'Comply Passed! Email will send to contact email address soon.', + content: 'Update partner information successfully', type: 'success' }); } - delete $rootScope.complianceCheck; - $state.reload(); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - }); - }; - $scope.pass2GreenChannel = function () { - commonDialog.confirm({ - title: 'Green Channel Audit Partner', - content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' green channel audited ?' - }).then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/aduit/green_channel').then(function () { - commonDialog.alert({ - title: 'Success', - content: 'Comply Passed! Email will send to contact email address soon.', - type: 'success' - }); - $state.reload(); + $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.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' + 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(); + }; + $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) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + 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); }) - }, 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.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 () { - commonDialog.alert({ - title: 'Success', - content: 'Audit application has been refused.', - type: 'success' - }); - $state.reload(); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - }) - }; + $scope.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.deleteClient = function () { - commonDialog.confirm({ - title: 'Delete Partner', - content: 'Are you sure to delete ' + $scope.partner.company_name + '?' - }).then(function () { - $http.delete('/sys/partners/' + $scope.partner.client_moniker).then(function () { - $state.go('^'); - commonDialog.alert({title: 'Delete', content: 'Partner Already Disabled', type: 'error'}); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - }) - }; - $scope.revertClient = function () { - commonDialog.confirm({ - title: 'Revert Partner', - content: 'Are you sure to Revert ' + $scope.partner.company_name + '?' - }).then(function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/revert').then(function () { - $state.go('^'); - commonDialog.alert({title: 'Revert', content: 'Partner Already Revert', type: 'success'}); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - }) - }; - - $scope.commitToCompliance = function () { - commonDialog.confirm({ - title: 'Commit to Compliance', - content: 'Are you sure to commit ' + $scope.partner.company_name + ' to compliance?', - choises: [ - {label: 'Submit', className: 'btn-success', key: 1}, - {label: 'Cancel', className: 'btn-warning', key: 0, dismiss: true} - ] - }).then(function (choice) { - if (choice == 1) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/to_compliance', {}).then(function () { - commonDialog.alert({ - title: 'Success', - content: 'Commit to Compliance successfully', - type: 'success' - }); - $state.reload(); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - } - }) - }; - $scope.apply2makeAgreeFile = function () { - $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.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.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.getMerchantLocation = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/location').then(function (resp) { + $scope.merchant_location = resp.data; + }); + }; + $scope.getMerchantLocation(); - }) - }; + $scope.updateMerchantLocation = function () { + var params = window.frames['merchant_detail'].merchant_location; + if (params) { + $http.put('/sys/partners/modify/' + $scope.partner.client_moniker + '/location', params).then(function () { + }); + } + } + }]); + app.controller('partnerListCtrl', ['$scope', '$sce', '$http', '$filter', '$uibModal', 'businessStructuresMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap', + function ($scope, $sce, $http, $filter, $uibModal, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) { - $scope.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.analysisClients = function () { + $http.get('/sys/partners/analysis').then(function (resp) { + $scope.analysis = resp.data; }) - }) - }; - $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'}); + }; + if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) { + $scope.analysisClients(); + } + $scope.pagination = {}; + $scope.industries = industryMap.configs(); + $scope.states = stateMap.configs(); + $scope.countries = countryMap.configs(); + $scope.sectors = sectorMap.configs(); + $scope.business_structures = businessStructuresMap.configs(); + $scope.clean_days = angular.copy(clean_days_map); + $scope.bd_citys = angular.copy(bd_city_map); + $scope.params = {textType: 'all', org_name: 'ALL', industry: "0"}; + $scope.loadRoyalpayindustry = function () { + $http.get('/static/data/royalpayindustry.json').then(function (resp) { + $scope.royalpayindustry = resp.data; + var selectAll = { + "label": "All", + "mccCode": "0", + "children": {} + }; + $scope.royalpayindustry.unshift(selectAll); }) - }) - }; - $scope.editBDUser = function () { - $uibModal.open({ - templateUrl: '/static/payment/partner/templates/bd_user_choose_dialog.html', - controller: 'partnerChooseBDUserDialogCtrl', - resolve: { - bdUsers: ['$http', function ($http) { - return $http.get('/sys/manager_accounts/roles/bd_user'); - }], - partner: function () { - return $scope.partner; - }, - type: function () { - return 'edit'; - } - } - }).result.then(function () { - $state.reload(); - }) - }; - $scope.bindBDUser = function () { - $uibModal.open({ - templateUrl: '/static/payment/partner/templates/bd_user_choose_dialog.html', - controller: 'partnerChooseBDUserDialogCtrl', - resolve: { - bdUsers: ['$http', function ($http) { - return $http.get('/sys/manager_accounts/roles/bd_user'); - }], - partner: function () { - return $scope.partner; - }, - type: function () { - return 'add'; - } - } - }).result.then(function () { - $state.reload(); - }) - }; + }; - $scope.configMasterMerchant = function () { - commonDialog.inputText({title: 'Input Master Merchant Code'}).then(function (text) { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/master_configuration', {master_merchant: text}).then(function () { - commonDialog.alert({title: 'Success', content: "Master Merchant Code:" + text, type: 'success'}); - }, function (resp) { - commonDialog.alert({ - title: 'Config Master Merchant Failed', - content: resp.data.message, - type: 'error' - }); - }) - }) - }; + $scope.loadRoyalpayindustry(); - $scope.getMerchantLocation = function () { - $http.get('/sys/partners/' + $scope.partner.client_moniker + '/location').then(function (resp) { - $scope.merchant_location = resp.data; - }); - }; - $scope.getMerchantLocation(); + $scope.onRoyalPayIndustrySelect = function (selectedItem) { + $scope.params.royalpay_label = selectedItem.label; + $scope.params.industry = selectedItem.mccCode; + $scope.loadPartners(1); + }; + $scope.loadPartners = function (page) { + var params = angular.copy($scope.params); + params.page = page || $scope.pagination.page || 1; + $http.get('/sys/partners', {params: params}).then(function (resp) { + $scope.partners = resp.data.data; + $scope.pagination = resp.data.pagination; + }); + }; - $scope.complianceCheck = function () { - if (!$rootScope.complianceCheck) { - $rootScope.complianceCheck = {}; - } - $rootScope.complianceCheck.client_id = $scope.partner.client_id; - $rootScope.complianceCheck.clientInfo = true; - }; - $scope.complianceChangeCheck = function () { - if ($rootScope.complianceCheck) { - if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { - delete $rootScope.complianceCheck; - } - } - }; - $scope.complianceChangeCheck(); + $scope.exportPartnersExcel = function () { + var params = angular.copy($scope.params); + var param_str = Object.keys(params).map(function (key) { + var value = params[key]; + if (angular.isDate(value)) { + value = $filter('date')(value, 'yyyy-MM-ddTHH:mm:ssZ') + } + return key + '=' + encodeURIComponent(value) + }).join('&'); + window.open('/sys/partners/exporting_excel?' + param_str) + }; - $scope.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.loadLocations = function () { + var params = angular.copy($scope.params); + $http.get('/sys/partners/merchant/list_locations', {params: params}).then(function (resp) { + $scope.locations = resp.data; + window.merchant_maps.initMap($scope.locations); + }); + };*/ + $scope.today = new Date(); - }, function (resp) { - commonDialog.alert({ - title: 'failed to change wechat_compliance permission status', - content: resp.data.message, - type: 'error' + $scope.listBDUsers = function () { + $http.get('/sys/manager_accounts/roles/bd_user').then(function (resp) { + $scope.bdUserSource = resp.data; }) - }) - }; - $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; + }; + $scope.listBDUsers(); + + if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) { + $scope.showOrg = 'Organization'; + $http.get('/sys/orgs/list_all_Org', {params: {}}).then(function (resp) { + $scope.orgs = resp.data; + }); } - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/local_merchant_permission', {allow: $scope.partner.local_merchant}).then(function () { - }, function (resp) { - commonDialog.alert({ - title: 'failed to change local_merchant permission status', - content: resp.data.message, - type: 'error' + $scope.loadOrgs = function () { + var params = angular.copy($scope.params); + $http.get('/sys/orgs/orgChild', {params: params}).then(function (resp) { + $scope.orgs_child = resp.data; }) - }) - }; + }; + $scope.loadOrgs(); - $scope.removeSub = function () { - $http.delete('/sys/partners/unsub/' + $scope.partner.client_moniker).then(function (resp) { - $state.reload(); - }); - }; - $scope.addSub = function () { - $http.put('/sys/partners/unsub/' + $scope.partner.client_moniker).then(function (resp) { - $state.reload(); - }); - }; - }]); - app.controller('partnerEditCtrl', ['$scope', '$http', '$state', 'Upload', 'commonDialog', 'timezone', 'partner', - function ($scope, $http, $state, Upload, commonDialog, timezone, partner) { - $scope.timezones = timezone.configs(); - $scope.partner = partner.data; - if($scope.partner.representativeInfo != null) - { - $scope.partner.registered_address = $scope.partner.representativeInfo.address; - $scope.partner.registered_suburb = $scope.partner.representativeInfo.suburb; - $scope.partner.registered_postcode = $scope.partner.representativeInfo.postcode; - $scope.partner.registered_state = $scope.partner.representativeInfo.state; - $scope.partner.legal_representative_person = $scope.partner.representativeInfo.representative_person; - $scope.partner.legal_representative_phone = $scope.partner.representativeInfo.phone; - $scope.partner.legal_representative_email = $scope.partner.representativeInfo.email; - $scope.partner.legal_representative_job = $scope.partner.representativeInfo.job_title; - $scope.partner.marketing_person = $scope.partner.representativeInfo.marketing_person; - $scope.partner.marketing_phone = $scope.partner.representativeInfo.marketing_phone; - $scope.partner.marketing_email = $scope.partner.representativeInfo.marketing_email; - $scope.partner.marketing_job = $scope.partner.representativeInfo.marketing_job_title; + /* $scope.onOrgsSelect = function (selectedItem) { + $scope.params.org_id = selectedItem.org_id; + $scope.params.org_name = selectedItem.label; + $scope.loadPartners(); + }; + */ + /* $scope.chooseOrg = function (org) { + if (org == 'all') { + delete $scope.params.org_id; + $scope.showOrg = 'All' + } else { + $scope.params.org_id = org.org_id; + $scope.showOrg = org.name; + } + $scope.loadPartners(1); + };*/ - $scope.partner.legal_representative_wechatid = $scope.partner.representativeInfo.legal_representative_wechatid; - $scope.partner.marketing_wechatid = $scope.partner.representativeInfo.marketing_wechatid; - } + $scope.loadPartners(1); - 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'); - } + $scope.openClientBoard = function (client) { + $uibModal.open({ + templateUrl: '/static/analysis/templates/partner_card.html', + controller: 'partnerCardCtrl', + resolve: { + clientMoniker: function () { + return client.client_moniker + } + }, + size: 'lg' + }) - 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.toogleMapSelect = function () { + $scope.mapFrame = 'all_locations.html'; + $scope.loadLocations(); } - - $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.toogleMerchantSelect = function () { + $scope.mapFrame = null; } + $scope.toogleMerchantSelect();*/ + }]); + app.controller('compliancePartnerCtrl', ['$scope', '$sce', '$http', '$filter', '$uibModal', 'businessStructuresMap', 'industryMap', 'stateMap', 'sectorMap', 'countryMap', + function ($scope, $sce, $http, $filter, $uibModal, businessStructuresMap, industryMap, stateMap, sectorMap, countryMap) { - $scope.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.analysisClients = function () { + $http.get('/sys/partners/analysis').then(function (resp) { + $scope.analysis = resp.data; + }) + }; + if ($scope.currentUser.org_id == 1 || $scope.currentUser.org_id == null) { + $scope.analysisClients(); } + $scope.pagination = {}; + $scope.industries = industryMap.configs(); + $scope.states = stateMap.configs(); + $scope.countries = countryMap.configs(); + $scope.sectors = sectorMap.configs(); + $scope.business_structures = businessStructuresMap.configs(); + $scope.clean_days = angular.copy(clean_days_map); + $scope.bd_citys = angular.copy(bd_city_map); + $scope.params = {textType: 'all', org_name: 'ALL'}; - $scope.listReferrers = function () { - $http.get('/sys/orgs/referrer').then(function (resp) { - $scope.referrers = resp.data; - }) + $scope.loadPartners = function (page) { + var params = angular.copy($scope.params); + params.page = page || $scope.pagination.page || 1; + $http.get('/sys/partners/compliance', {params: params}).then(function (resp) { + $scope.partners = resp.data.data; + $scope.pagination = resp.data.pagination; + }); }; - $scope.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.today = new Date(); - $scope.loadLakalaPayindustry = function () { - $http.get('/static/data/lakalapayindustry.json').then(function (resp) { - $scope.lakalapayindustry = resp.data; + $scope.listBDUsers = function () { + $http.get('/sys/manager_accounts/roles/bd_user').then(function (resp) { + $scope.bdUserSource = resp.data; }) }; - $scope.loadLakalaPayindustry(); + $scope.listBDUsers(); - $scope.loadLakalaPaySettle = function () { - $http.get('/static/data/lakalapaysettle.json').then(function (resp) { - $scope.lakalapaysettle = resp.data; - }) - }; - $scope.loadLakalaPaySettle(); + if (($scope.currentUser.role & parseInt('1000011', 2)) > 0 && !$scope.currentUser.org_id) { + $scope.showOrg = 'Organization'; + $http.get('/sys/orgs/list_all_Org', {params: {}}).then(function (resp) { + $scope.orgs = resp.data; + }); + } - $scope.loadLakalaPayGoods = function () { - $http.get('/static/data/lakalapaygoods.json').then(function (resp) { - $scope.lakalapaygoods = resp.data; + $scope.loadOrgs = function () { + var params = angular.copy($scope.params); + $http.get('/sys/orgs/orgChild', {params: params}).then(function (resp) { + $scope.orgs_child = resp.data; }) }; - $scope.loadLakalaPayGoods(); + $scope.loadOrgs(); - $scope.loadRoyalpayindustry = function () { - $http.get('/static/data/royalpayindustry.json').then(function (resp) { - $scope.royalpayindustry = resp.data; - }) - }; - $scope.loadRoyalpayindustry(); + $scope.loadPartners(1); - $scope.loadHfindustry = function () { - $http.get('/static/data/hfindustry.json').then(function (resp) { - $scope.hfindustry = resp.data; + + $scope.openClientBoard = function (client) { + $uibModal.open({ + templateUrl: '/static/analysis/templates/partner_card.html', + controller: 'partnerCardCtrl', + resolve: { + clientMoniker: function () { + return client.client_moniker + } + }, + size: 'lg' }) - }; - $scope.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; + }]); + 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; + } + } + return false; }; - $scope.onHfIndustrySelect = function (selectedItem) { - $scope.partner.hf_label = selectedItem.label; - $scope.partner.hfindustry = selectedItem.mccCode; + if (partner.data.company_name != null) { + $scope.isComplianceOfCompanyName = $scope.decideCompliance(partner.data.company_name); + } + if (partner.data.short_name != null) { + $scope.isComplianceOfShortName = $scope.decideCompliance(partner.data.short_name); + } + if (partner.data.business_structure != null) { + $scope.isComplianceOfBusinessStructure = $scope.decideCompliance(partner.data.business_structure); + } + $scope.showDBUsers = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/bd_user').then(function (resp) { + $scope.partner.client_bds = resp.data; + }) + }; + $scope.showDBUsers(); + $scope.showFile = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_agree_file').then(function (resp) { + $scope.fileManager = resp.data; + }); }; + $scope.showCardFile = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_card_agree_file?fileName=letter_of_offer_file').then(function (resp) { + $scope.letterOfOfferFileManager = resp.data; + }); + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_card_agree_file?fileName=promotional_offer_file').then(function (resp) { + $scope.promotionalOfferFileManager = resp.data; + }); + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/file/source_card_agree_file?fileName=terms_and_conditions_file').then(function (resp) { + $scope.termsAndConditionsFile = resp.data; + }); + }; - $scope.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包含敏感词汇,请检查后重新提交!"); + $scope.showFile(); + $scope.showCardFile(); + $scope.passClient = function () { + if (!$rootScope.complianceCheck) { + alert("please check first"); return; } - if ($scope.partner.company_phone.indexOf(' ') != -1) { - alert('Company Phone can not contain space character'); + if (!$rootScope.complianceCheck.authFile) { + alert("Compliance Files not checked"); return; } - if ($scope.partner.contact_email.indexOf(' ') != -1) { - alert('Contact email Phone can not contain space character'); + if (!$rootScope.complianceCheck.clientInfo) { + alert("Partner Detail not checked"); return; } - if ($scope.partner.suburb.indexOf(' ') != -1) { - alert('suburb can not contain two and more continuous space characters'); + if (!$rootScope.complianceCheck.bankAccount) { + alert("Bank Account not checked"); return; } - if ($scope.partner.client_pay_type.indexOf('2') >= 0) { - if (!$scope.partner.company_photo) { - alert('Shop Photo1 is necessary'); - return; + var title = 'Audit Partner'; + var content = 'Are you sure to mark partner ' + $scope.partner.company_name + ' audited?'; + var choises = ''; + var contentHtml = ''; + if ($scope.isComplianceOfCompanyName || $scope.isComplianceOfShortName + || $scope.isComplianceOfBusinessStructure) { + var info = []; + if ($scope.isComplianceOfCompanyName) { + info.push('Company Name'); } - if (!$scope.partner.store_photo) { - alert('Shop Photo2 is necessary'); - return; + if ($scope.isComplianceOfShortName) { + info.push('Short Name'); } - } - - if ($scope.partner.acn && $scope.partner.business_structure == 'Company') { - if ($scope.partner.acn.length != 9) { - alert('Acn is not valid'); + 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.partner.referrer_id) { - $scope.referrers.forEach(function (e) { - if ($scope.partner.referrer_id == e.org_id) { - $scope.partner.referrer_name = e.name; - return; + 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; } - 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 (!$rootScope.complianceCheck.authFile) { + alert("Compliance Files not checked"); + return; } - if ($scope.partner.client_pay_type.length == 0) { - alert('请选择商户支付场景') + if (!$rootScope.complianceCheck.clientInfo) { + alert("Partner Detail not checked"); return; } - if ($scope.partner.client_pay_desc.length == 0) { - alert('请选择商户支付方式') + if (!$rootScope.complianceCheck.bankAccount) { + alert("Bank Account not checked"); return; } - if ($scope.partner.client_pay_type.indexOf('1') >= 0) { - if ($scope.partner.client_pay_desc.join(',').indexOf('10') < 0) { - alert("请检查线上支付场景是否已选择支付方式"); - 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.partner.client_pay_type.indexOf('2') >= 0) { - if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { - alert("请检查线下支付场景是否已选择支付方式"); - return; + if ($scope.isComplianceOfShortName) { + info.push('Short Name'); } - } - 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; + 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 = ''; } - $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.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: 'Update partner information successfully', + content: 'Comply Passed! Email will send to contact email address soon.', type: 'success' }); - } - $scope.updateMerchantLocation(); - $scope.loadPartners(); - $state.go('^.detail', {clientMoniker: $scope.partner.client_moniker}, {reload: true}); + $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) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + $scope.showBg = false; + $state.reload(); + 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.exportAgreegatePDF = function () { + $scope.showBg = true; + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/aggregate/agreepdf').then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Agreement File Generate Succeed! Please notify BD!', + type: 'success' + }); + $scope.showBg = false; + $state.reload(); + }, function (resp) { + $scope.showBg = false; + $state.reload(); + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }); }; - $scope.uploadShopPhoto = function (file) { + //制作卡支付合同 + $scope.exportCardAgreegatePDF = function () { + $scope.showBg = true; + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/export/aggregate/card_agree_pdf').then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Agreement File Generate Succeed! Please notify BD!', + type: 'success' + }); + $scope.showBg = false; + $state.reload(); + }, function (resp) { + $scope.showBg = false; + $state.reload(); + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }); + } + $scope.Export = function () { + var url = '/dev/' + $scope.partner.client_moniker + '/export/aggregate/agreepdf'; + return url; + } + $scope.uploadAgreeFile = function (file) { if (file != null) { if (file.size > 2 * 1024 * 1024) { commonDialog.alert({title: 'Error', content: '文件大小不能超过2MB,请压缩后重试', type: 'error'}) } else { - $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; + $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) { - 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) { + $scope.uploadCardAgreeFile = 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; + $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) { - 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.notifyBD = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/notify/completeAgree').then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Notify BD Successed!.', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}); + }); + }; + + $scope.cardNotifyBD = function () { + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/notify/cardCompleteAgree').then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Notify BD Successed!.', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}); + }); + }; + + $scope.downTempPdf = function () { + return '/sys/partners/' + $scope.partner.client_moniker + '/temp/export/pdf'; + } + + $scope.refuse = function () { + commonDialog.inputText({title: 'refuse cause'}).then(function (text) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/refuse', {refuse_remark: text}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Audit application has been refused.', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; + + $scope.cardRefuse = function () { + commonDialog.inputText({title: 'refuse cause'}).then(function (text) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/card_audit/refuse', {refuse_remark: text}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Card Audit application has been refused.', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + } + + $scope.deleteClient = function () { + commonDialog.confirm({ + title: 'Delete Partner', + content: 'Are you sure to delete ' + $scope.partner.company_name + '?' + }).then(function () { + $http.delete('/sys/partners/' + $scope.partner.client_moniker).then(function () { + $state.go('^'); + commonDialog.alert({title: 'Delete', content: 'Partner Already Disabled', type: 'error'}); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; + $scope.revertClient = function () { + commonDialog.confirm({ + title: 'Revert Partner', + content: 'Are you sure to Revert ' + $scope.partner.company_name + '?' + }).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/revert').then(function () { + $state.go('^'); + commonDialog.alert({title: 'Revert', content: 'Partner Already Revert', type: 'success'}); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; + + $scope.commitToCompliance = function () { + commonDialog.confirm({ + title: 'Commit to Compliance', + content: 'Are you sure to commit ' + $scope.partner.company_name + ' to compliance?', + choises: [ + {label: 'Submit', className: 'btn-success', key: 1}, + {label: 'Cancel', className: 'btn-warning', key: 0, dismiss: true} + ] + }).then(function (choice) { + if (choice == 1) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/to_compliance', {}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Commit to Compliance successfully', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + } + }) + }; + + $scope.commitToCardCompliance = function () { + commonDialog.confirm({ + title: 'Commit to Compliance', + content: 'Are you sure to commit ' + $scope.partner.company_name + ' to compliance?', + choises: [ + {label: 'Submit', className: 'btn-success', key: 1}, + {label: 'Cancel', className: 'btn-warning', key: 0, dismiss: true} + ] + }).then(function (choice) { + if (choice == 1) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/to_card_compliance', {}).then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Commit to Compliance successfully', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + } + }) + } + $scope.apply2makeAgreeFile = function () { + if (!$scope.partner.enable_cross_payment) { + commonDialog.alert({ + title: 'Error!', + content: '请完善商户跨境支付基本信息、签约费率、合规文件!', + type: 'error' + }); + $state.go('partners.edit', { + clientMoniker: $scope.partner.client_moniker, + commitCardPayment: false, + commitCrossBorderPayment: true + }); + return; + } + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/make_agree_file').then(function () { + commonDialog.alert({ + title: 'Success!', + content: '已提交制作合同!', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + } + ); + }; + + $scope.apply2makeCardAgreeFile = function () { + if (!$scope.partner.enable_card_payment) { + commonDialog.alert({ + title: 'Error!', + content: '请完善商户卡支付基本信息、签约费率、合规文件!', + type: 'error' + }); + $state.go('partners.edit', { + clientMoniker: $scope.partner.client_moniker, + commitCardPayment: true, + commitCrossBorderPayment: false + }); + return; + } + $http.get('/sys/partners/' + $scope.partner.client_moniker + '/make_card_agree_file').then(function () { + commonDialog.alert({ + title: 'Success!', + content: '已提交制作合同!', + type: 'success' + }); + $state.reload(); + }, function (resp) { + if (String(resp.data.message).match("No Rate Config")) { + commonDialog.alert({ + title: 'Error!', + content: '商户卡支付签约费率未配置,请添加商户卡支付签约费率!', + type: 'error' + }); + $state.go('partners.detail.rates', { + clientMoniker: $scope.partner.client_moniker + }); + } else { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + } + } + ); + }; + + $scope.commit2GreenChannel = function () { + commonDialog.confirm({ + title: 'Audit Partner', + content: 'Are you sure to mark partner ' + $scope.partner.company_name + ' Green Channel?' + }).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/compliance/green_channel').then(function () { + commonDialog.alert({ + title: 'Success', + content: 'Commit to Green Channel successfully', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + + }) + }; + + $scope.markAuditEmail = function () { + commonDialog.confirm({ + title: 'Warning', + content: 'Make sure you have send the email to client.' + }).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/email_sending_status').then(function () { + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; + $scope.resendApproveEmail = function (type) { + commonDialog.confirm({ + title: 'Warning', + content: 'This operation will reset the password of admin user. Are you sure this email is correct ? Or you may update this information first.' + }).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/audit/send_email?type=' + type).then(function () { + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; + $scope.editBDUser = function () { + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/bd_user_choose_dialog.html', + controller: 'partnerChooseBDUserDialogCtrl', + resolve: { + bdUsers: ['$http', function ($http) { + return $http.get('/sys/manager_accounts/roles/bd_user'); + }], + partner: function () { + return $scope.partner; + }, + type: function () { + return 'edit'; + } + } + }).result.then(function () { + $state.reload(); + }) + }; + $scope.bindBDUser = function () { + $uibModal.open({ + templateUrl: '/static/payment/partner/templates/bd_user_choose_dialog.html', + controller: 'partnerChooseBDUserDialogCtrl', + resolve: { + bdUsers: ['$http', function ($http) { + return $http.get('/sys/manager_accounts/roles/bd_user'); + }], + partner: function () { + return $scope.partner; + }, + type: function () { + return 'add'; + } + } + }).result.then(function () { + $state.reload(); + }) + }; + $scope.configMasterMerchant = function () { + commonDialog.inputText({title: 'Input Master Merchant Code'}).then(function (text) { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/master_configuration', {master_merchant: text}).then(function () { + commonDialog.alert({ + title: 'Success', + content: "Master Merchant Code:" + text, + type: 'success' + }); + }, function (resp) { + commonDialog.alert({ + title: 'Config Master Merchant Failed', + content: resp.data.message, + type: 'error' + }); + }) + }) + }; $scope.getMerchantLocation = function () { $http.get('/sys/partners/' + $scope.partner.client_moniker + '/location').then(function (resp) { $scope.merchant_location = resp.data; @@ -1733,13 +1480,78 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $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 () { - }); + + $scope.complianceCheck = function () { + if (!$rootScope.complianceCheck) { + $rootScope.complianceCheck = {}; } - } + $rootScope.complianceCheck.client_id = $scope.partner.client_id; + $rootScope.complianceCheck.clientInfo = true; + }; + $scope.complianceChangeCheck = function () { + if ($rootScope.complianceCheck) { + if ($scope.partner.client_id != $rootScope.complianceCheck.client_id) { + delete $rootScope.complianceCheck; + } + } + }; + $scope.complianceChangeCheck(); + + $scope.changeWechatCompliance = function () { + if (!$scope.partner) { + return; + } + if (!$state.is('partners.detail')) { + $scope.init.wechat_compliance = false; + return; + } + if (!$scope.init.wechat_compliance) { + $scope.init.wechat_compliance = true; + return; + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/wechat_compliance_permission', {allow: $scope.partner.wechat_compliance}).then(function () { + + }, function (resp) { + commonDialog.alert({ + title: 'failed to change wechat_compliance permission status', + content: resp.data.message, + type: 'error' + }) + }) + }; + $scope.changeLocalMerchant = function () { + if (!$scope.partner) { + return; + } + if (!$state.is('partners.detail')) { + $scope.init.local_merchant = false; + return; + } + if (!$scope.init.local_merchant) { + $scope.init.local_merchant = true; + return; + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/local_merchant_permission', {allow: $scope.partner.local_merchant}).then(function () { + + }, function (resp) { + commonDialog.alert({ + title: 'failed to change local_merchant permission status', + content: resp.data.message, + type: 'error' + }) + }) + }; + + $scope.removeSub = function () { + $http.delete('/sys/partners/unsub/' + $scope.partner.client_moniker).then(function (resp) { + $state.reload(); + }); + }; + $scope.addSub = function () { + $http.put('/sys/partners/unsub/' + $scope.partner.client_moniker).then(function (resp) { + $state.reload(); + }); + }; }]); app.controller('partnerPaymentInfoCtrl', ['$scope', '$http', '$state', 'commonDialog', '$uibModal', '$sce', function ($scope, $http, $state, commonDialog, $uibModal, $sce) { $scope.convertExtParams = []; @@ -1777,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?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; @@ -1787,18 +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 = {} - console.log(1) - 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' @@ -1812,7 +1623,6 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.reloadQRCode = function () { $http.get('/sys/partners/' + $scope.partner.client_moniker + '/qrcode', {params: $scope.qrConfig}).then(function (resp) { $scope.qrcode = resp.data; - console.log($scope.qrcode.url) }); }; $scope.reloadQRCode(); @@ -1958,6 +1768,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.saveSubMerchantId = function () { $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_config', {sub_merchant_id: $scope.paymentInfo.sub_merchant_id}).then(function (resp) { $scope.refreshWechatInstitutionMerchantId(); + $scope.ctrl.editSubMerchant = false; }, function (resp) { commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) }); @@ -2411,6 +2222,25 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }; + $scope.switchInternationalCard = function () { + if (!$scope.paymentInfo) { + return; + } + if (!$scope.init.enable_International_card) { + $scope.init.enable_International_card = true; + return; + } + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/payment_card_permission', {allow: $scope.paymentInfo.enable_international_card}).then(function () { + $scope.loadPartnerPaymentInfo(); + }, function (resp) { + commonDialog.alert({ + title: 'failed to change international card permission status', + content: resp.data.message, + type: 'error' + }) + }) + }; + $scope.changePaymentPage = function () { if (!$scope.paymentInfo) { return; @@ -2496,7 +2326,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) }; - $scope.changeBillCodeVersion = function() { + $scope.changeBillCodeVersion = function () { if (!$scope.paymentInfo) { return; } @@ -2511,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(); }) } @@ -2555,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; }); @@ -2615,7 +2448,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }]); - app.controller('partnerRatesCtrl', ['$scope', '$rootScope', '$http', '$uibModal', 'commonDialog', '$sce', function ($scope, $rootScope, $http, $uibModal, commonDialog, $sce) { + app.controller('partnerRatesCtrl', ['$scope', '$rootScope', '$http', '$uibModal', 'commonDialog', '$sce', '$state', function ($scope, $rootScope, $http, $uibModal, commonDialog, $sce, $state) { $scope.bankCtrl = {edit: true, rate_name: 'Wechat'}; $scope.init = { skip_clearing: false, @@ -2863,6 +2696,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.getRates(); }); }; + $scope.complianceCheck = function () { if (!$rootScope.complianceCheck) { $rootScope.complianceCheck = {}; @@ -2945,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"; } @@ -3024,38 +2858,23 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t1.Wechat); $scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t1.Alipay); $scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t1.AlipayOnline); - $scope.rate.bestpay_rate_value = parseFloat($scope.sysRateConfig.t1.Bestpay); - $scope.rate.jd_rate_value = parseFloat($scope.sysRateConfig.t1.JDpay); - $scope.rate.hf_rate_value = parseFloat($scope.sysRateConfig.t1.HFpay); $scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t1.Rpay); - $scope.rate.yeepay_rate_value = parseFloat($scope.sysRateConfig.t1.Yeepay); - $scope.rate.cb_bankpay_rate_value = parseFloat($scope.sysRateConfig.t1.CB_Bankpay); $scope.rate.transaction_fee = 0; break; } case '2': { $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t2.Wechat); $scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t2.Alipay); - $scope.rate.bestpay_rate_value = parseFloat($scope.sysRateConfig.t2.Bestpay); $scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t2.AlipayOnline); - $scope.rate.jd_rate_value = parseFloat($scope.sysRateConfig.t2.JDpay); - $scope.rate.hf_rate_value = parseFloat($scope.sysRateConfig.t2.HFpay); $scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t2.Rpay); - $scope.rate.yeepay_rate_value = parseFloat($scope.sysRateConfig.t2.Yeepay); - $scope.rate.cb_bankpay_rate_value = parseFloat($scope.sysRateConfig.t2.CB_Bankpay); $scope.rate.transaction_fee = 0; break; } case '3': { $scope.rate.wechat_rate_value = parseFloat($scope.sysRateConfig.t3.Wechat); $scope.rate.alipay_rate_value = parseFloat($scope.sysRateConfig.t3.Alipay); - $scope.rate.bestpay_rate_value = parseFloat($scope.sysRateConfig.t3.Bestpay); $scope.rate.alipayonline_rate_value = parseFloat($scope.sysRateConfig.t3.AlipayOnline); - $scope.rate.jd_rate_value = parseFloat($scope.sysRateConfig.t3.JDpay); - $scope.rate.hf_rate_value = parseFloat($scope.sysRateConfig.t3.HFpay); $scope.rate.Rpay_rate_value = parseFloat($scope.sysRateConfig.t3.Rpay); - $scope.rate.yeepay_rate_value = parseFloat($scope.sysRateConfig.t3.Yeepay); - $scope.rate.cb_bankpay_rate_value = parseFloat($scope.sysRateConfig.t3.CB_Bankpay); $scope.rate.transaction_fee = 0; break; } @@ -3317,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; @@ -3332,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; @@ -3345,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; @@ -3399,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'); @@ -3610,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; } @@ -3642,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) { @@ -3706,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 = {}; @@ -3715,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); @@ -3730,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); @@ -3934,7 +3753,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }, function (resp) { $scope.ctrl.sending = false; $scope.errmsg = resp.data.message; - }) + }); } else { $http.post('/sys/partners/' + clientMoniker + '/rates', $scope.rate).then(function () { $scope.ctrl.sending = false; @@ -3942,7 +3761,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }, function (resp) { $scope.ctrl.sending = false; $scope.errmsg = resp.data.message; - }) + }); } } }]); @@ -4094,7 +3913,14 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.listRedpackLogs(1); }]); - app.controller('partnerAuthFileCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', 'Upload', 'file', function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) { + app.controller('partnerAuthFileCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', function ($scope, $http, $rootScope, commonDialog, $state) { + if ($state.params.commitType == 'card-payment') { + $state.go('partners.detail.files.MW_files'); + } else { + $state.go('partners.detail.files.CP_files'); + } + }]); + app.controller('partnerCPAuthFileCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', 'Upload', 'file', function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) { $scope.id_info_form = {edit: false}; $scope.file = file.data || {}; //audit files @@ -4301,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; @@ -4322,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 () { @@ -4346,7 +4172,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); }) }) -}; + }; $scope.updateFile = function () { @@ -4386,13 +4212,37 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.complianceChangeCheck(); }]); - app.controller('partnerMWAuthFileCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', 'Upload', 'file', function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) { $scope.id_info_form = {edit: false}; $scope.file = file.data || {}; + $scope.uploadFile = {}; $scope.file.upay_risk_level = $scope.partner.upay_risk_level; $scope.file.upay_risk_remark = $scope.partner.upay_risk_remark; - $scope.uploadApplyFile = function (file) { + + $scope.uploadApplicationFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.applicationFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.applicationFileProgress; + $scope.uploadFile.upay_application_form = resp.data.url; + $scope.updateFile(); + }, function (resp) { + delete $scope.applicationFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.applicationFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadBankFile = function (file) { if (file != null) { if (file.size > 3 * 1024 * 1024) { commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) @@ -4402,14 +4252,10 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter url: '/attachment/files', data: {file: file} }).then(function (resp) { + $scope.uploadFile = {}; delete $scope.bankFileProgress; - $scope.file.upay_application_form = resp.data.url; + $scope.uploadFile.client_bank_file = resp.data.url; $scope.updateFile(); - if ($scope.file.upay_application_form.endsWith('pdf')) { - $scope.bankIsImage = false; - } else { - $scope.bankIsImage = true; - } }, function (resp) { delete $scope.bankFileProgress; commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) @@ -4419,136 +4265,237 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } } }; - $scope.agreeIsImage = true; - if ($scope.file.file_agreement_info && $scope.file.file_agreement_info.endsWith('pdf')) { - $scope.agreeIsImage = false; - } - $scope.bankIsImage = true; - if ($scope.file.upay_application_form && $scope.file.upay_application_form.endsWith('pdf')) { - $scope.bankIsImage = false; - } - $scope.companyIsImage = true; - if ($scope.file.file_company_info && $scope.file.file_company_info.endsWith('pdf')) { - $scope.companyIsImage = false; - } - $scope.applyIsImage = true; - if ($scope.file.file_apply_info && $scope.file.file_apply_info.endsWith('pdf')) { - $scope.applyIsImage = false; - } - $scope.idIsImage = true; - if ($scope.file.file_id_info && $scope.file.file_id_info.endsWith('pdf')) { - $scope.idIsImage = false; - } - - $scope.uploadAgreementFile = function (file) { + $scope.uploadASICFile = function (file) { if (file != null) { if (file.size > 3 * 1024 * 1024) { commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) } else { - $scope.companyFileProgress = {value: 0}; + $scope.ASICProgress = {value: 0}; Upload.upload({ url: '/attachment/files', data: {file: file} }).then(function (resp) { - delete $scope.companyFileProgress; - $scope.file.upay_agreement_file = resp.data.url; + $scope.uploadFile = {}; + delete $scope.ASICProgress; + $scope.uploadFile.client_company_file = resp.data.url; $scope.updateFile(); - if ($scope.file.upay_agreement_file.endsWith('pdf')) { - $scope.companyIsImage = false; - } else { - $scope.companyIsImage = true; - } }, function (resp) { - delete $scope.companyFileProgress; + delete $scope.ASICProgress; commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) }, function (evt) { - $scope.companyFileProgress.value = parseInt(100 * evt.loaded / evt.total); + $scope.ASICProgress.value = parseInt(100 * evt.loaded / evt.total); }) } } }; - $scope.uploadOfferFile = function (file) { + $scope.uploadIdFile = function (file) { if (file != null) { if (file.size > 3 * 1024 * 1024) { commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) } else { - $scope.idFileProgress = {value: 0}; + $scope.idProgress = {value: 0}; Upload.upload({ url: '/attachment/files', data: {file: file} }).then(function (resp) { - delete $scope.idFileProgress; - $scope.file.upay_offer_letter = resp.data.url; + $scope.uploadFile = {}; + delete $scope.idProgress; + $scope.uploadFile.upay_driver_license = resp.data.url; $scope.updateFile(); - if ($scope.file.upay_offer_letter.endsWith('pdf')) { - $scope.idIsImage = false; - } else { - $scope.idIsImage = true; - } }, function (resp) { - delete $scope.idFileProgress; + delete $scope.idProgress; commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) }, function (evt) { - $scope.idFileProgress.value = parseInt(100 * evt.loaded / evt.total); + $scope.idProgress.value = parseInt(100 * evt.loaded / evt.total); }) } } }; - $scope.uploadDriverFile = function (file) { + $scope.uploadResidenceFile = function (file) { if (file != null) { - if (file.size > 10 * 1024 * 1024) { - commonDialog.alert({title: 'Error', content: '文件大小不能超过10MB,请压缩后重试', type: 'error'}) + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) } else { - $scope.agreementFileProgress = {value: 0}; + $scope.residenceFileProgress = {value: 0}; Upload.upload({ url: '/attachment/files', data: {file: file} }).then(function (resp) { - delete $scope.agreementFileProgress; - $scope.file.upay_driver_license = resp.data.url; + $scope.uploadFile = {}; + delete $scope.residenceFileProgress; + $scope.uploadFile.kyc_utility_bill_file = resp.data.url; $scope.updateFile(); - if ($scope.file.upay_driver_license.endsWith('pdf')) { - $scope.agreeIsImage = false; - } else { - $scope.agreeIsImage = true; - } }, function (resp) { - delete $scope.agreementFileProgress; + delete $scope.residenceFileProgress; commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) }, function (evt) { - $scope.agreementFileProgress.value = parseInt(100 * evt.loaded / evt.total); + $scope.residenceFileProgress.value = parseInt(100 * evt.loaded / evt.total); }) } } }; - $scope.uploadResidenceFile = function (file) { + $scope.uploadRefundPolicyFile = function (file) { if (file != null) { if (file.size > 3 * 1024 * 1024) { commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) } else { - $scope.applyFileProgress = {value: 0}; + $scope.refundPolicyFileProgress = {value: 0}; Upload.upload({ url: '/attachment/files', data: {file: file} }).then(function (resp) { - delete $scope.applyFileProgress; - $scope.file.upay_residence_certificate = resp.data.url; + $scope.uploadFile = {}; + delete $scope.refundPolicyFileProgress; + $scope.uploadFile.refund_exchange_policy = resp.data.url; $scope.updateFile(); - if ($scope.file.upay_residence_certificate.endsWith('pdf')) { - $scope.applyIsImage = false; - } else { - $scope.applyIsImage = true; - } }, function (resp) { - delete $scope.applyFileProgress; + delete $scope.refundPolicyFileProgress; commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) }, function (evt) { - $scope.applyFileProgress.value = parseInt(100 * evt.loaded / evt.total); + $scope.refundPolicyFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadPrivacyPolicyFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.privacyFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.privacyFileProgress; + $scope.uploadFile.upay_privacy_policy = resp.data.url; + $scope.updateFile(); + }, function (resp) { + delete $scope.privacyFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.privacyFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadCardPolicyFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.cardFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.cardFileProgress; + $scope.uploadFile.card_security_policy = resp.data.url; + $scope.updateFile(); + }, function (resp) { + delete $scope.cardFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.cardFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadLetterOfOfferFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.letterFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.letterFileProgress; + $scope.uploadFile.upay_offer_letter = resp.data.url; + $scope.updateFile(); + }, function (resp) { + delete $scope.letterFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.letterFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadPromotionalFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.promotionalFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.promotionalFileProgress; + $scope.uploadFile.upay_promotional_offer = resp.data.url; + $scope.updateFile(); + }, function (resp) { + delete $scope.promotionalFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.promotionalFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadTermsFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.termsFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.termsFileProgress; + $scope.uploadFile.upay_terms_conditions = resp.data.url; + $scope.updateFile(); + }, function (resp) { + delete $scope.termsFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.termsFileProgress.value = parseInt(100 * evt.loaded / evt.total); + }) + } + } + }; + $scope.uploadDescFile = function (file) { + if (file != null) { + if (file.size > 3 * 1024 * 1024) { + commonDialog.alert({title: 'Error', content: '文件大小不能超过3MB,请压缩后重试', type: 'error'}) + } else { + $scope.descFileProgress = {value: 0}; + Upload.upload({ + url: '/attachment/files', + data: {file: file} + }).then(function (resp) { + $scope.uploadFile = {}; + delete $scope.descFileProgress; + $scope.uploadFile.upay_desc_file = resp.data.url; + $scope.updateFile(); + }, function (resp) { + delete $scope.descFileProgress; + commonDialog.alert({title: 'Upload Failed', content: resp.data.message, type: 'error'}) + }, function (evt) { + $scope.descFileProgress.value = parseInt(100 * evt.loaded / evt.total); }) - } } }; + $scope.saveIdInfo = function () { if (!$scope.file.upay_risk_level) { commonDialog.alert({title: 'Error', content: '请选择商户风险等级', type: 'error'}); @@ -4568,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 () { @@ -4576,34 +4523,17 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter return url; }; - - $scope.deleteComplianceFiles = function (file_id) { - commonDialog.confirm({ - title: 'Warning', - content: 'This operation will delete the file, Are you sure?' - }).then(function () { - $http.put('/sys/partners/auth_file/' + file_id + '/delete').then(function (resp) { - commonDialog.alert({ - title: 'Success', - content: 'Delete Successful', - type: 'success' - }); - $state.reload(); - }, function (resp) { - commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); - }) - }) - }; - - $scope.updateFile = function () { - $http.put('/sys/partners/' + $scope.partner.client_moniker + '/mw_file', $scope.file).then(function () { + $http.put('/sys/partners/' + $scope.partner.client_moniker + '/mw_file', $scope.uploadFile).then(function () { commonDialog.alert({ title: 'Success', content: 'Upload Successful', type: 'success' }); - $state.reload(); + $state.go('partners.detail.files', { + clientMoniker: $scope.partner.client_moniker, + commitType: "card-payment" + }, {reload: true}); }, function (resp) { commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); }) @@ -4620,8 +4550,26 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter if (!$rootScope.complianceCheck) { $rootScope.complianceCheck = {}; } - $rootScope.complianceCheck.client_id = $scope.partner.client_id; $rootScope.complianceCheck.authFile = true; + $rootScope.complianceCheck.client_id = $scope.partner.client_id; + + if ($scope.file.upay_application_form == null || $scope.file.upay_application_form == '') { + commonDialog.alert({type: 'error', title: 'Error', content: '请补充商户申请表合规文件'}) + $rootScope.complianceCheck.authFile = false; + } else if ($scope.file.client_bank_file == null || $scope.file.client_bank_file == '') { + commonDialog.alert({type: 'error', title: 'Error', content: '请补六个月银行对账单合规文件'}) + $rootScope.complianceCheck.authFile = false; + } else if ($scope.file.client_company_file == null || $scope.file.client_company_file == '') { + commonDialog.alert({type: 'error', title: 'Error', content: '请补充当前公司信息摘录合规文件'}) + $rootScope.complianceCheck.authFile = false; + } else if ($scope.file.upay_driver_license == null || $scope.file.upay_driver_license == '') { + commonDialog.alert({type: 'error', title: 'Error', content: '请补充法人身份证明合规文件'}) + $rootScope.complianceCheck.authFile = false; + } else if ($scope.file.kyc_utility_bill_file == null || $scope.file.kyc_utility_bill_file == '') { + commonDialog.alert({type: 'error', title: 'Error', content: '请补充家庭住址证明 (一个水电煤网账单)合规文件'}) + $rootScope.complianceCheck.authFile = false; + } + }; $scope.complianceChangeCheck = function () { if ($rootScope.complianceCheck) { @@ -4632,6 +4580,24 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }; $scope.complianceChangeCheck(); + $scope.deleteMWComplianceFiles = function (file_id) { + commonDialog.confirm({ + title: 'Warning', + content: 'This operation will delete the file, Are you sure?' + }).then(function () { + $http.put('/sys/partners/auth_file/' + file_id + '/mw_delete').then(function (resp) { + commonDialog.alert({ + title: 'Success', + content: 'Delete Successful', + type: 'success' + }); + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }) + }) + }; + }]); app.controller('partnerKycFileCtrl', ['$scope', '$http', '$rootScope', 'commonDialog', '$state', 'Upload', 'file', function ($scope, $http, $rootScope, commonDialog, $state, Upload, file) { @@ -4738,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({ @@ -4809,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 = []; @@ -4819,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); @@ -4854,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'); @@ -4867,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 = '&'; @@ -5084,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; @@ -5237,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 () { @@ -6112,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 } } } @@ -6161,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 } } } @@ -6179,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}, @@ -6190,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(); }) @@ -6206,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) { @@ -6230,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 1bec9f8b7..7a9bcc2c6 100644 --- a/src/main/ui/static/payment/partner/templates/add_partner.html +++ b/src/main/ui/static/payment/partner/templates/add_partner.html @@ -16,6 +16,17 @@ background-color: #f7bf90; border-color: #adadad; } + .form-control-float { + float: left; + width: 93%; !important; + } + .form-control-span{ + height: 34px; + } + .check-box { + zoom: 130%; + margin-right: 5px; + }

    New Partner

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

    Required + Field

    +

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

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

    Required + Field

    Less Than 20 Characters(including symbols and spaces)

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

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

    Required + Field

    +
    +
    +
    +
    + +
    + + $ +
    +

    Required + Field

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

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

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

    Required + Field

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

    + +

    +
    +
    -

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

    + +
    + +
    + +
    +
    - - - - - - -
    1 - - - - -
    - - -
    -
    -
    -

    Example:请保证图片信息清晰可见,如下图

    - -
    -
    -
    - -
    - -
    -
    - - -
    - - - - - - - -
    1 - - - - -
    -
    -
    -
    -
    -

    Example:公司请提供以下文件图片

    - - -
    -
    -

    sole trade(个体户),partnership(合伙),trust(信托)请在http://abr.business.gov.au,将查询结果截图上传

    - -
    -
    -
    -
    - -
    - -
    -
    - - -
    - - - - - - - - -
    1 - - - - -
    -
    -
    -
    -
    -

    Example:请保证图片(护照或驾照)信息清晰可见,如下图

    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    - - -
    - - - - - - - - -
    1 - - - - -
    -
    -
    -
    -

    Example:请保证图片信息清晰可见,如下图

    - -
    -
    -
    -
    - -
    -
    - -
    -
    - - -
    - - - - - - - - -
    1 - - - - -
    -
    -
    -
    -

    Example:请保证图片信息清晰可见,如下图

    - -
    -
    -
    -
    - -
    - -
    -
    - -

    - One utility bill (water, electricity or gas) that shows the residential address (*Mandatory if your uploaded ID is a passport)
    - 一份显示常住居所地址的账单(水费、电费或煤气费)(*必须上传 - 如您上传的ID是护照)
    -

    - -
    - - - - - - - - -
    1 - - - -
    -
    -
    -
    -
    -

    Example:请提供水电煤账单文件图片,如示例 - 水费.png -
    电费.jpg -

    -

    - 煤气.png -

    -
    -
    -
    + -
    - check -
    +
    - - - - +
    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 81a134cc8..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 @@ + +
    Audit Files     + + 一键下载 + +
    +
    +
    +
    + +
    +
    + + +
    + + + + + + + + + +
    1 + + + + +
    +
    +
    +
    +

    Example:请保证图片信息清晰可见,如下图

    + +
    +
    +
    + +
    + +
    +
    + + +
    + + + + + + + +
    1 + + + + +
    +
    +
    +
    +
    +

    Example:公司请提供以下文件图片

    + + +
    +
    +

    sole trade(个体户),partnership(合伙),trust(信托)请在http://abr.business.gov.au,将查询结果截图上传

    + +
    +
    +
    +
    + +
    + +
    +
    + + + +
    + + + + + + + + +
    1 + + + + +
    +
    +
    +
    +
    +

    Example:请保证图片(护照或驾照)信息清晰可见,如下图

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

    + ID描述信息 +

    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    + + + + + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + {{file.id_type}} +
    +
    +
    +
    + +
    + + + + + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    + +
    +
    + + +
    + + + + + + + + +
    1 + + + + +
    +
    +
    +
    +

    Example:请保证图片信息清晰可见,如下图

    + +
    +
    +
    +
    + +
    +
    + +
    +
    + + +
    + + + + + + + + +
    1 + + + + +
    +
    +
    +
    +

    Example:请保证图片信息清晰可见,如下图

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

    + One utility bill (water, electricity or gas) that shows the residential address (*Mandatory if your uploaded ID is a passport)
    + 一份显示常住居所地址的账单(水费、电费或煤气费)(*必须上传 - 如您上传的ID是护照)
    +

    + +
    + + + + + + + + +
    1 + + + +
    +
    +
    +
    +
    +

    Example:请提供水电煤账单文件图片,如示例 + 水费.png +
    电费.jpg +

    +

    + 煤气.png +

    +
    +
    +
    +
    + + +
    +
    +
    + check +
    diff --git a/src/main/ui/static/payment/partner/templates/partner_detail.html b/src/main/ui/static/payment/partner/templates/partner_detail.html index 220dc763a..ec6410f06 100644 --- a/src/main/ui/static/payment/partner/templates/partner_detail.html +++ b/src/main/ui/static/payment/partner/templates/partner_detail.html @@ -33,6 +33,7 @@ height: 100px; margin-left: 20px; } + .btn-default:active, .btn-default.active, .open > .dropdown-toggle.btn-default { @@ -58,14 +59,16 @@
  • Partner Detail
  • -
    +
    -

    Compliance (Refused - :{{partner.refuse_remark}}) +

    Cross-border payment Compliance (Refused + :{{partner.refuse_remark}}) (The Partner Using Green Channel Now!) 【目前状态】- @@ -76,7 +79,7 @@ (自助申请)待审核(材料已提交) - 资料完善中 + 暂未提交申请 待审核(合同制作中) 合同制作完成 BD处理中 @@ -95,6 +98,8 @@
    -
    下载合同 - - - Notify BD - + + + Notify BD +

    @@ -155,20 +161,18 @@

    - -
    -

    Operation - (Refused - :{{partner.refuse_remark}} - )(The Partner Using Green Channel Now!) +

    + + Operation + (Refused + :{{partner.refuse_remark}} + )(The Partner Using Green Channel Now!) 【目前状态】- - 资料完善中 + 暂未提交申请 待审核(合同制作中) 合同制作完成 BD处理中 @@ -231,7 +235,163 @@

    -
    + + + +
    +
    +

    + Card Payment Compliance + (Refused + :{{partner.upay_refuse_remark}}) + + 【目前状态】- + + (自助申请)资料完善中 + (自助申请)已开通 + (自助申请)快速开通等待提交合规材料 + (自助申请)待审核(材料已提交) + + + 暂未提交申请 + 待审核(合同制作中) + 合同制作完成 + BD处理中 + 待审核(合规文件已提交) + 通过 + 不通过 + + (已禁用) +

    + +
    +
    + + 制作Card Payment合同 +
    + + +
    + 下载Letter Of Offer合同 + 下载Terms And Conditions合同 + + + Notify BD +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    + + +
    + + +
    +
    +
    +
    +
    +
    + +
    +
    +

    + Operation + (Refused + :{{partner.upay_refuse_remark}} + )(The Partner Using Green Channel Now!) + 【目前状态】- + 暂未提交申请 + 待审核(合同制作中) + 合同制作完成 + BD处理中 + 待审核(合规文件已提交) + 通过 + 不通过 + 绿色通道申请中 +

    +
    +
    + 下载Letter Of Offer合同 + 下载Terms And Conditions合同 +
    + +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    + + +
    + + +
    +
    +
    +
    +
    +
    + + +

    Solved

    @@ -242,6 +402,8 @@
    + +
    -

    {{partner.client_moniker}} @@ -342,13 +499,14 @@

    - - + + 注意:(微信渠道可能不合规) - +

    @@ -371,6 +529,12 @@

    +
    + +
    +

    +
    +
    @@ -529,11 +693,13 @@ + 线上 + + 线下 +
    - PC网站 + PC网站 + + 手机端网站 + + APP + + 微信内、支付宝内网站 + + 小程序 +
    @@ -571,19 +742,23 @@ + 二维码立牌 + + RoyalPay POS + + 收银系统 + + 无人售货机 +
    @@ -595,43 +770,53 @@ + ipos + + pospal + + Lotus + + AoShangBao + + Infinity + + EasyCloud + + Aus Post + + AoMaiKe + + 其他 +
    -
    +
    @@ -644,7 +829,8 @@
    1:  @@ -659,6 +845,22 @@
    +
    + + +
    +

    +
    +
    +
    + + +
    +

    +
    +
    @@ -723,7 +925,8 @@

    -

    +

    + + +
    + +
    +

    +

    -

    @@ -760,54 +978,59 @@ -

    -
    Legal Representative
    -
    -
    -
    - +
    +
    +
    Legal Representative
    +
    +
    +
    + -
    -

    +
    +

    +
    -
    -
    - +
    + -
    -

    +
    +

    +
    -
    -
    - +
    + -
    -

    +
    +

    +
    -
    -
    - +
    + -
    -

    - -

    +
    +

    + +

    +
    -
    -
    - +
    + -
    -

    - -

    +
    +

    + +

    +
    -
    -

    +
    +
    Marketing Person
    @@ -815,21 +1038,24 @@
    -

    +

    -

    +

    -

    +

    @@ -865,7 +1091,8 @@

    -

    +

    @@ -899,41 +1126,46 @@
    -

    -
    Registered Address Information
    -
    -
    +
    +
    +
    Registered Address Information
    +
    +
    -
    - +
    + -
    -

    +
    +

    +
    -
    -
    - +
    + -
    -

    +
    +

    +
    -
    -
    - +
    + -
    -

    +
    +

    +
    -
    -
    - +
    + -
    -

    +
    +

    +
    -

    @@ -1072,11 +1304,48 @@ ng-if="$root.complianceCheck.clientInfo">
    +
    + +
    +

    + {{partner.mw_industry}} +

    + +
    +
    +
    + +
    + + + + + + +
    +
    diff --git a/src/main/ui/static/payment/partner/templates/partner_edit.html b/src/main/ui/static/payment/partner/templates/partner_edit.html index 2c2a33896..10b1aaf8d 100644 --- a/src/main/ui/static/payment/partner/templates/partner_edit.html +++ b/src/main/ui/static/payment/partner/templates/partner_edit.html @@ -10,6 +10,17 @@ background-color: #f7bf90; border-color: #adadad; } + .form-control-float { + float: left; + width: 93%; !important; + } + .form-control-span{ + height: 34px; + } + .check-box { + zoom: 130%; + margin-right: 5px; + }

    @@ -26,6 +37,24 @@
    +
    Partner Basic Information
    @@ -82,7 +111,7 @@
    - +
    @@ -93,7 +122,7 @@
    -
    @@ -111,9 +140,7 @@
    -
    -
    @@ -162,7 +189,7 @@
    -
    @@ -181,8 +208,24 @@
    - -
    + +
    + +
    +

    Required + Field

    +

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

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

    Required + Field

    +
    +
    +
    +
    + +
    + + $ +
    +

    Required + Field

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

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

    Required + Field

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

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

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

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

    +
    +
    +
    + +
    +
    +
    -
    - -
    -
    - -
    +
    +
    + +
    +
    +
    -
    - -
    -
    - 低风险 - 中风险 - 高风险 -
    +
    +
    + +
    +
    + 低风险 + 中风险 + 高风险
    -
    - -
    -
    - -
    +
    +
    + +
    +
    +
    - + +
    +
    + +
    +
    + +
    + + + + + + + + +
    1 + + + +
    -
    - -
    -
    - - - -
    - - + +
    + +
    +
    + + +
    + +
    + + + + + + +
    1 + + + +
    +
    +
    +
    + +
    +
    + + +
    + + - - + + -
    - +
    1 + +
    + +
    +
    +
    + +
    +
    + +
    + + + + + + + + +
    1 + + + +
    - -
    - -
    -
    - - - -
    - - - - - - -
    - - -
    +
    +
    + +
    +
    + +
    + + + + + + + + +
    1 + + + +
    - - +
    + +
    +
    + +
    + + + + + + + + +
    1 + + + +
    - -
    -
    - -
    -
    -
    +
    + +
    +
    + + +
    + + + + + + + + +
    1 + + + - - - - - - - - - -
    - - -
    - +
    +
    +
    +
    + +
    +
    + +
    + + + + + + + + +
    1 + + + +
    - -
    -
    - -
    -
    -
    +
    + +
    +
    + + +
    + + + + + + + + +
    1 + + + - - - - - - - - - -
    - - -
    - +
    +
    +
    +
    + +
    +
    + +
    + + + + + + + + +
    1 + + + +
    -
    +
    +
    + check +
    diff --git a/src/main/ui/static/payment/partner/templates/partner_new_rate.html b/src/main/ui/static/payment/partner/templates/partner_new_rate.html index a28587ad0..6b47f663e 100644 --- a/src/main/ui/static/payment/partner/templates/partner_new_rate.html +++ b/src/main/ui/static/payment/partner/templates/partner_new_rate.html @@ -88,76 +88,6 @@
    -
    - -
    -
    - -
    %
    -
    -
    -
    - No more than 5.0% -
    -
    - No less than 0.6% -
    -
    - Required Field -
    -
    - -
    -
    -
    - -
    -
    - -
    %
    -
    -
    -
    - No more than 5.0% -
    -
    - No less than 0.6% -
    -
    - Required Field -
    -
    - -
    -
    - -
    diff --git a/src/main/ui/static/payment/partner/templates/partner_payment_info.html b/src/main/ui/static/payment/partner/templates/partner_payment_info.html index 80df579ba..59c8f5422 100644 --- a/src/main/ui/static/payment/partner/templates/partner_payment_info.html +++ b/src/main/ui/static/payment/partner/templates/partner_payment_info.html @@ -56,14 +56,6 @@

    -
    - -
    -

    - {{paymentInfo.yeepay_sub_merchant_id||'初始化'}} -

    -
    -
    @@ -205,36 +197,12 @@
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    @@ -489,6 +457,23 @@
    + +
    +
    Card Payment Config
    +
    +
    + +
    + +
    + +
    +
    +
    +
    +
    +
    Retail In Store Payment(App, WePayLite, Albert)
    @@ -604,16 +589,6 @@ switch-change="toggleRequireRemark()">
    -
    - -
    - -
    -
    diff --git a/src/main/ui/static/payment/partner/templates/partner_settlement.html b/src/main/ui/static/payment/partner/templates/partner_settlement.html index 32df9ee0a..a455f5aa6 100644 --- a/src/main/ui/static/payment/partner/templates/partner_settlement.html +++ b/src/main/ui/static/payment/partner/templates/partner_settlement.html @@ -220,6 +220,7 @@ Settle Time + Settle Version Transaction Amount to Merchant Service Fee @@ -229,11 +230,15 @@ - {{log.report_date}} + {{log.report_date|limitTo:10}}   + + Card Payment + Cross-border Payment + diff --git a/src/main/ui/static/payment/partner/templates/partners.html b/src/main/ui/static/payment/partner/templates/partners.html index 34b0bfea2..cb16ff7e8 100644 --- a/src/main/ui/static/payment/partner/templates/partners.html +++ b/src/main/ui/static/payment/partner/templates/partners.html @@ -5,6 +5,11 @@ .del_client{ text-decoration: line-through; } + + .big-number-type{ + font-weight: bold; + font-size: 18px; + }
    @@ -24,8 +29,10 @@
    Waiting Compliance - {{analysis.wp}} - 其中自助开通:{{analysis.a_wp}} + {{analysis.wp}} |  + {{analysis.cwp}} +
    + 其中自助开通: {{analysis.a_wp}} | {{analysis.a_wp}}
    @@ -34,8 +41,14 @@
    Pass - {{analysis.pass}} - 其中自助开通:{{analysis.z_pass+analysis.a_pass}} + + {{analysis.pass}} |  + {{analysis.upass}} + + 其中自助开通: + {{analysis.z_pass+analysis.a_pass}} |  + {{analysis.z_upass+analysis.a_upass}} +
    @@ -366,13 +379,6 @@ - - -
  • @@ -42,4 +38,4 @@
  • -
    \ No newline at end of file +
    diff --git a/src/main/ui/static/payment/tradelog/partner-settlement-log.js b/src/main/ui/static/payment/tradelog/partner-settlement-log.js index 0a0705f81..fd4179fe1 100644 --- a/src/main/ui/static/payment/tradelog/partner-settlement-log.js +++ b/src/main/ui/static/payment/tradelog/partner-settlement-log.js @@ -222,6 +222,9 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { $scope.getClearingTransactions = function (client_id, detailId) { clearingDetailService.clientClearingDetail(client_id, detailId, true) } + $scope.getClearingTransactionsOfUpaySettle = function (client_id, detailId) { + clearingDetailService.clientClearingDetailOfUpaySettle(client_id, detailId, true) + } $scope.getClearingTransactionsOfMergeSettle = function (client_id, reportDate) { clearingDetailService.clientClearingDetailOfMergeSettle(client_id, reportDate) } diff --git a/src/main/ui/static/payment/tradelog/templates/balance_report.html b/src/main/ui/static/payment/tradelog/templates/balance_report.html index aa142c3cd..2b284e8f3 100644 --- a/src/main/ui/static/payment/tradelog/templates/balance_report.html +++ b/src/main/ui/static/payment/tradelog/templates/balance_report.html @@ -154,18 +154,8 @@ ng-class="{'bg-primary':params.channel=='ALIPAYONLINE'}" ng-click="params.channel='ALIPAYONLINE';loadTradeLogs(1)">AlipayOnline | - BestPay | - JD Pay | - HF Pay | RPay + | - Yeepay | - LakalaPay | Card Payment |
    diff --git a/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html b/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html index 2c18f8311..906f5cd97 100644 --- a/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html +++ b/src/main/ui/static/payment/tradelog/templates/partner_settlement_logs.html @@ -271,6 +271,7 @@ Date + Settle Version Transaction Amount(AUD) Transfer to Merchant(AUD) GST(AUD) @@ -285,6 +286,10 @@ {{log.clearing_time|limitTo:10}}   + + Card Payment + Cross-border Payment + @@ -304,6 +309,19 @@ + + + + + + + + + + + + + +

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

    +
    + diff --git a/src/main/ui/static/payment/tradelog/templates/partner_trade_logs.html b/src/main/ui/static/payment/tradelog/templates/partner_trade_logs.html index b715730be..49fa74723 100644 --- a/src/main/ui/static/payment/tradelog/templates/partner_trade_logs.html +++ b/src/main/ui/static/payment/tradelog/templates/partner_trade_logs.html @@ -208,18 +208,8 @@ ng-class="{'bg-primary':params.channel=='ALIPAYONLINE'}" ng-click="params.channel='ALIPAYONLINE';loadTradeLogs(1)">AlipayOnline | - BestPay | - JD Pay | - HF Pay | RPay+ | - Yeepay | - LakalaPay | Card Payment | - - {{trade.order_id}} @@ -170,4 +168,4 @@
    -
    \ No newline at end of file +
    diff --git a/src/main/ui/static/risk/risk.js b/src/main/ui/static/risk/risk.js index 8d84298cd..bdf27ebc7 100644 --- a/src/main/ui/static/risk/risk.js +++ b/src/main/ui/static/risk/risk.js @@ -284,8 +284,7 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }; }]); app.controller('newRiskCtrl', ['$scope', '$http','commonDialog', function ($scope, $http,commonDialog) { - $scope.attentions = {"enjoin_wechat": true,"enjoin_alipay": true,"enjoin_bestpay": true, - "enjoin_jd": true,"enjoin_hf": true} + $scope.attentions = {"enjoin_wechat": true,"enjoin_alipay": true} $scope.save = function (attentions) { var params = angular.copy(attentions); $http.post('/sys/risk/attention/'+ attentions.client_moniker, params).then(function () { @@ -374,4 +373,4 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }); return app; -}); \ No newline at end of file +}); diff --git a/src/main/ui/static/risk/templates/attention_merchants.html b/src/main/ui/static/risk/templates/attention_merchants.html index 6d98cbd24..99370c5f6 100644 --- a/src/main/ui/static/risk/templates/attention_merchants.html +++ b/src/main/ui/static/risk/templates/attention_merchants.html @@ -73,9 +73,6 @@ Wechat Alipay - Bestpay - JD - HF
    -
    \ No newline at end of file +
    diff --git a/src/main/ui/static/risk/templates/risk_add.html b/src/main/ui/static/risk/templates/risk_add.html index 0911e621e..3d83790ce 100644 --- a/src/main/ui/static/risk/templates/risk_add.html +++ b/src/main/ui/static/risk/templates/risk_add.html @@ -36,15 +36,6 @@ - - -

    @@ -58,4 +49,4 @@
    -
    \ No newline at end of file + diff --git a/src/main/ui/static/risk/templates/risk_merchant_edit.html b/src/main/ui/static/risk/templates/risk_merchant_edit.html index 49b7d7a06..106b4f2d3 100644 --- a/src/main/ui/static/risk/templates/risk_merchant_edit.html +++ b/src/main/ui/static/risk/templates/risk_merchant_edit.html @@ -28,15 +28,6 @@ - - -

    @@ -50,4 +41,4 @@
    - \ No newline at end of file + diff --git a/src/main/ui/static/templates/payment/v1/card_pay.js b/src/main/ui/static/templates/payment/v1/card_pay.js index b8ccf86aa..8506924ab 100644 --- a/src/main/ui/static/templates/payment/v1/card_pay.js +++ b/src/main/ui/static/templates/payment/v1/card_pay.js @@ -1,7 +1,7 @@ $(function () { let $container = $('.card-input-box')[0]; let ctrl = {ready: false, pending: false} - let cardFrame = window.channel_account_id ? new TokenInputFrame($container, window.channel_account_id) : new CardInputFrame($container); + let cardFrame = new CardInputFrame($container, window.card_input_appid, window.card_input_token); let $errorMsgBox = $('#errorMsgBox'); let loading = $('.loading-container'); cardFrame.onSuccess = function (secretData) { diff --git a/src/test/java/au/com/royalpay/payment/manage/process/aes/AESTest.java b/src/test/java/au/com/royalpay/payment/manage/process/aes/AESTest.java index 52585cd63..8d01280c3 100644 --- a/src/test/java/au/com/royalpay/payment/manage/process/aes/AESTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/process/aes/AESTest.java @@ -1,7 +1,7 @@ package au.com.royalpay.payment.manage.process.aes; import au.com.royalpay.payment.tools.codec.AESCrypt; -import org.apache.commons.net.util.Base64; +import org.apache.commons.codec.binary.Base64; import org.junit.Test; import java.nio.charset.StandardCharsets; diff --git a/src/test/java/au/com/royalpay/payment/manage/task/RefundTest.java b/src/test/java/au/com/royalpay/payment/manage/task/RefundTest.java new file mode 100644 index 000000000..29c131dd4 --- /dev/null +++ b/src/test/java/au/com/royalpay/payment/manage/task/RefundTest.java @@ -0,0 +1,34 @@ +package au.com.royalpay.payment.manage.task; + +import au.com.royalpay.payment.channels.rpaypaymentsvc.runtime.RPayPaymentCardSvcApi; +import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; +import au.com.royalpay.payment.manage.tradelog.refund.RefundService; +import com.alibaba.fastjson.JSONObject; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import javax.annotation.Resource; +import java.math.BigDecimal; + +/** + * Create by davep at 2020-04-17 15:37 + */ +@SpringBootTest +@ActiveProfiles("officedev,wechat,jd,alipay,bestpay,rpay,yeepay,lakala,rppaysvc") +@RunWith(SpringJUnit4ClassRunner.class) +public class RefundTest { + @Resource + private RPayPaymentCardSvcApi rPayPaymentCardSvcApi; + @Resource + private ManagerMapper managerMapper; + + @Test + public void test() throws InterruptedException { + String refundId = "8956ae96-44c0-48e8-9865-865c05fd3831"; + rPayPaymentCardSvcApi.checkRefundStatus(refundId); + Thread.sleep(60_000); + } +} diff --git a/src/test/java/au/com/royalpay/payment/manage/task/SettleMailTest.java b/src/test/java/au/com/royalpay/payment/manage/task/SettleMailTest.java index 57e03c72f..cf8ed5471 100644 --- a/src/test/java/au/com/royalpay/payment/manage/task/SettleMailTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/task/SettleMailTest.java @@ -35,7 +35,7 @@ public class SettleMailTest { public void parse() throws IOException { Date date = DateUtils.truncate(new Date(), Calendar.DATE); final ArrayList clearIds = new ArrayList<>(); - List abaFileList = cleanService.getAba(date, "CBA", cleanService.getSettleLogs(date, clearIds)); + List abaFileList = cleanService.getAba(date, cleanService.getSettleLogs(date, clearIds)); Context ctx = new Context(); ctx.setVariable("date", DateFormatUtils.format(date, "dd-MM-yyyy")); diff --git a/src/test/java/au/com/royalpay/payment/manage/valid/CSVTest.java b/src/test/java/au/com/royalpay/payment/manage/valid/CSVTest.java index 4c1ad5366..5f0d6cb8f 100644 --- a/src/test/java/au/com/royalpay/payment/manage/valid/CSVTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/valid/CSVTest.java @@ -2,14 +2,14 @@ package au.com.royalpay.payment.manage.valid; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVPrinter; -import org.apache.commons.csv.QuoteMode; +import org.joda.time.DateTime; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; import org.junit.Test; import java.io.File; import java.io.FileWriter; import java.io.IOException; -import java.io.StringWriter; -import java.nio.charset.StandardCharsets; /** * Create by davep at 2019-12-24 15:15 @@ -26,4 +26,11 @@ public class CSVTest { writer.flush(); System.out.println(file.getAbsolutePath()); } + + @Test + public void tesat(){ + DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMM yyyy"); + String dateStr = formatter.print(new DateTime()); + System.err.println(dateStr); + } } diff --git a/src/test/java/au/com/royalpay/payment/manage/valid/JPinYinTest.java b/src/test/java/au/com/royalpay/payment/manage/valid/JPinYinTest.java index 12160b5d6..1e6f60251 100644 --- a/src/test/java/au/com/royalpay/payment/manage/valid/JPinYinTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/valid/JPinYinTest.java @@ -6,8 +6,8 @@ import au.com.royalpay.payment.tools.codec.AESCrypt; import au.com.royalpay.payment.tools.encryptalgorithm.SignUtils; import com.alibaba.fastjson.JSONObject; import com.github.stuxuhai.jpinyin.PinyinException; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.net.util.Base64; import org.junit.Test; import javax.crypto.BadPaddingException; diff --git a/src/test/java/au/com/royalpay/payment/manage/valid/QCloudSignTest.java b/src/test/java/au/com/royalpay/payment/manage/valid/QCloudSignTest.java index e10e6aac4..7a44b32aa 100644 --- a/src/test/java/au/com/royalpay/payment/manage/valid/QCloudSignTest.java +++ b/src/test/java/au/com/royalpay/payment/manage/valid/QCloudSignTest.java @@ -1,11 +1,10 @@ package au.com.royalpay.payment.manage.valid; import au.com.royalpay.payment.manage.support.serverless.qcloud.support.ServerLessFunctionInvokeRequest; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.net.util.Base64; import org.junit.Test; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.http.ResponseEntity;