fix: settlement email issue. documents update

master
yixian 4 years ago
parent d42a6fdcf6
commit dea0bef60e

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId> <artifactId>payment-parent</artifactId>
<version>2.1.45</version> <version>2.1.47</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>

@ -540,7 +540,17 @@ paths:
domestic_only: domestic_only:
type: boolean type: boolean
default: false default: false
description: 是否只允许本国卡。由于境内境外卡支付手续费差异巨大,可在此限制。 description: |
是否只允许本国卡。由于境内境外卡支付手续费差异巨大,可在此限制。
**当商户开启消费者支付手续费功能而international_only提交了false时当前参数自动置为true。**
international_only:
type: boolean
default: false
description: |
是否只允许国际卡。当商户开启消费者支付手续费功能需要提交当前参数为true才可允许国际卡支付同时此订单将只允许国际卡支付。
**因此商户需要在支付页面提供本地卡和国际卡两个支付入口!**
当domestic_only=true的时候当前参数无效。
disable_credit_card: disable_credit_card:
type: boolean type: boolean
default: false default: false

@ -554,7 +554,18 @@ paths:
domestic_only: domestic_only:
type: boolean type: boolean
default: false default: false
description: whether only domestic cards can pay. due to there is huge difference on surcharge rate between domestic cards and international cards. merchants can add a limit on the order. description: |
Whether only domestic cards can pay. due to there is huge difference on surcharge rate between domestic cards and international cards.
Merchants can add a limit on the order.
**Note: If merchant enabled auto attach surcharge on orders, and international_only is false, this parameter will automatically set to true**
international_only:
type: boolean
default: false
description: |
If set this parameter to true, this order will refuse domestic cards. It is useful when merchant enabled auto attach surcharge to orders.
Then is required to set this value as true to enable international cards. This also means customers should choose use domestic cards or international cards first on merchants' page
And if domestic_only param is true, this param will be ignored.
disable_credit_card: disable_credit_card:
type: boolean type: boolean
default: false default: false
@ -610,14 +621,16 @@ paths:
put: put:
summary: Create Card Order summary: Create Card Order
description: | description: |
商户可在页面引入https://channel.rpayplus.com/channel/v1/view/card_input_frame.js Input https://channel.rpayplus.com/channel/v1/view/card_input_frame.js in merchant's webpage.
并通过回调取得key_id和secret信息并将其作为卡信息提交给royalpay直接完成下单支付。 After called commit, it will return `key_id` and `secret` parameter asyncronized by callback.
Post these parameter to royalpay and finish payment directly.
js引用案例 js Example
``` ```
let cardInputContainer = document.getElementById('card-input-area');//预先准备放置卡输入界面的container let cardInputContainer = document.getElementById('card-input-area');//a container prepared to put the card input frame in.
let cardInput = new CardInputFrame(cardInputContainer);//创建frame对象 let cardInput = new CardInputFrame(cardInputContainer);//create frame object
//设置iframe的样式参数 //setting iframe style
cardInput.frameStyle = { cardInput.frameStyle = {
width: '100%', width: '100%',
height: '400px', height: '400px',
@ -625,20 +638,22 @@ paths:
borderRadius: '10px' borderRadius: '10px'
}; };
cardInput.onError = function(msg){ cardInput.onError = function(msg){
//卡输入界面返回错误信息时进行展示 //if the input card message has mistake, will call this method and pass the error detail here
}; };
cardInput.onReady = function(){ cardInput.onReady = function(){
//iframe加载完毕的触发事件 //iframe loaded event
}; };
cardInput.onSuccess = function(secretData){ cardInput.onSuccess = function(secretData){
//成功取得加密卡信息回调 //success get encrypted card informations
//secretData: {'key_id':'','secret':''} //secretData: {'key_id':'','secret':''}
}; };
cardInput.show();//开始加载iframe cardInput.show();//start loading iframe
//通过外部事件触发卡输入界面提交注意卡输入界面没有按钮必须通过外部触发提交事件。并回调到onSuccess回调函数。 //call commit method when customer clicked pay button so that callbacks will be triggered
cardInput.commit(); cardInput.commit();
``` ```
**Note: This API do not allow customers pay for surcharge**
tags: tags:
- CardPayment - CardPayment
parameters: parameters:
@ -663,18 +678,20 @@ paths:
properties: properties:
key_id: key_id:
type: string type: string
description: 卡输入界面回调得到的key_id description: card input frame returned key_id
card_info: card_info:
type: string type: string
description: 卡输入界面回调得到的secret description: card input frame returned secret
domestic_only: domestic_only:
type: boolean type: boolean
default: false default: false
description: 是否只允许本国卡。由于境内境外卡支付手续费差异巨大,可在此限制。 description: |
Whether only domestic cards can pay. due to there is huge difference on surcharge rate between domestic cards and international cards.
Merchants can add a limit on the order.
disable_credit_card: disable_credit_card:
type: boolean type: boolean
default: false default: false
description: 如果希望禁止消费者使用信用卡支付可传入true description: Pass true if want to refuse credit cards.
customer: customer:
$ref: 'components_order.yml#/cardCustomerParam' $ref: 'components_order.yml#/cardCustomerParam'
responses: responses:
@ -686,10 +703,10 @@ paths:
$ref: 'components_order.yml#/orderBasicResponse' $ref: 'components_order.yml#/orderBasicResponse'
/micropay/partners/{partner_code}/orders/{partner_order_id}: /micropay/partners/{partner_code}/orders/{partner_order_id}:
put: put:
summary: 付款码下单 summary: Retail Passive Payment Order
description: | 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
<img src="img/Retail_cn.png"> <img src="img/Retail_cn.png">
tags: tags:
- RetailPay - RetailPay
@ -715,10 +732,10 @@ paths:
properties: properties:
device_id: device_id:
type: string type: string
description: 扫码设备id description: ID of the device which sends the request
auth_code: auth_code:
type: string type: string
description: 付款码 description: The Payment QR Code scanned from customer's WeChat Wallet.
responses: responses:
200: 200:
description: Result description: Result
@ -728,9 +745,11 @@ paths:
$ref: 'components_order.yml#/orderStatus' $ref: 'components_order.yml#/orderStatus'
/retail_qrcode/partners/{partner_code}/orders/{partner_order_id}: /retail_qrcode/partners/{partner_code}/orders/{partner_order_id}:
put: put:
summary: 线下QRCode支付单 summary: Retail Active Payment Order
description: | description: |
线下QRCode支付用于对接无扫码设备的收银终端下单后得到二维码地址自行生成二维码图片后展示在收银终端屏幕上并由用户使用对应支付客户端进行扫码支付。 线下QRCode现已同时兼容支付宝、微信客户端进行支付 Retail Active Payment is used for cashier terminals which cannot scan Barcode or QRCode. Get the Code url after create the order,
convert this url to a QRCode and ask customers use their app to scan this QRCode then finish the payment.
Retail Active Payment now support Alipay, WeChat
<img src="img/RetailQR_cn.png"> <img src="img/RetailQR_cn.png">
tags: tags:
- RetailPay - RetailPay
@ -755,7 +774,7 @@ paths:
properties: properties:
device_id: device_id:
type: string type: string
description: 收银设备id description: ID of the device which sends the request.
responses: responses:
200: 200:
description: Order description: Order
@ -768,13 +787,13 @@ paths:
properties: properties:
code_url: code_url:
type: string type: string
description: 付款码字符串,商户可自行生成二维码 # todo description: QR Code string. Partners can create the payment QR Code according to this value.
/alipay/partners/{partner_code}/orders/{partner_order_id}: /alipay/partners/{partner_code}/orders/{partner_order_id}:
put: put:
summary: 支付宝WEB订单下单 summary: Alipay WEB Order
description: | description: |
创建订单后跳转到返回的pay_url需附加签名参数和redirect参数随后进入支付宝支付页面完成支付 Use for Alipay Payment in PC Website. After create order, jump to the pay_url returned and attach sign params and redirect param. Then enter Alipay page to finish payment.
该接口现仅支持支付宝。 Alipay Channel Only.
tags: tags:
- AlipayOnline - AlipayOnline
parameters: parameters:
@ -803,10 +822,11 @@ paths:
properties: properties:
pay_url: pay_url:
type: string type: string
description: Payment page URL加签后传递给前端并跳转至当前URL让消费者完成支付 description: Payment page URL. redirect to the url with signature parameters.
/cb_bankpay/partners/{partner_code}/orders/{partner_order_id}: /cb_bankpay/partners/{partner_code}/orders/{partner_order_id}:
put: put:
summary: 网银快捷支付下单 summary: CB BankPay Order
description: Use for CB BankPay in PC Website. After create order, jump to the pay_url returned and attach sign params and redirect param.
tags: tags:
- CB Bank - CB Bank
parameters: parameters:
@ -831,10 +851,10 @@ paths:
properties: properties:
product_name: product_name:
type: string type: string
description: 商品名称 description: production name
gateway_type: gateway_type:
type: integer type: integer
description: '网关类型8: H5网关9PC网关' description: 'Gateway Require 8: H5 gateway,9: PC gateway'
enum: enum:
- 8 - 8
- 9 - 9
@ -850,10 +870,13 @@ paths:
properties: properties:
pay_url: pay_url:
type: string type: string
description: Payment page URL加签后传递给前端并跳转至当前URL让消费者完成支付 description: Payment page URL. redirect to the url with signature parameters.
/gateway/partners/{partner_code}/app_orders/{partner_order_id}: /gateway/partners/{partner_code}/app_orders/{partner_order_id}:
put: put:
summary: SDK下单 summary: SDK Order
description: |
Used for mobile Apps calling Wechat payment with Wechat SDK. Call this api to create order and get param string for SDK calling.
Call SDK api with the param to start payment and get payment result from Wechat app It is strongly advised to request RoyalPay order query Api to confirm that the order has been paid in order to cancelling order by system at the same time.
tags: tags:
- SDK Payment - SDK Payment
parameters: parameters:
@ -877,23 +900,23 @@ paths:
properties: properties:
channel: channel:
type: string type: string
description: 支付渠道,大小写敏感 description: Payment channel, required, case sensitive
enum: enum:
- Wechat - Wechat
- Alipay - Alipay
system: system:
type: string type: string
description: 客户端操作类型,支付宝选填,微信不需要 description: OS type of client app, optional for Alipay, not required for Wechat
enum: enum:
- android - android
- iphone - iphone
- ipad - ipad
version: version:
type: string type: string
description: 客户端版本号,支付宝选填,微信不需要 description: client app version, optional for Alipay, not required for Wechat
appid: appid:
type: string type: string
description: 微信必填开发者平台appid description: wechat appid, required for Wechat, not required for Alipay
responses: responses:
200: 200:
description: Order description: Order
@ -906,11 +929,13 @@ paths:
properties: properties:
sdk_params: sdk_params:
type: string type: string
description: json字符串可直接传递给SDK端发起支付 description: param string for calling SDK
/gateway/partners/{partner_code}/channel_exchange_rate: /gateway/partners/{partner_code}/channel_exchange_rate:
get: get:
summary: 渠道汇率查询 summary: Channel Exchange Rates
description: 获取当前各渠道AUD兑CNY汇率值(1AUD=?CNY),该汇率仅做参考,以实际成交汇率为准 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: tags:
- PublicApi - PublicApi
parameters: parameters:
@ -928,28 +953,29 @@ paths:
properties: properties:
return_code: return_code:
type: string type: string
description: 状态码 description: Execution result
example: example:
SUCCESS SUCCESS
wechat_rate: wechat_rate:
type: number type: number
description: 微信当前汇率 description: Wechat exchange rate
example: example:
4.41111 4.41111
alipay_retail_rate: alipay_retail_rate:
type: number type: number
description: 支付宝线下接口汇率 description: Alipay retail exchange rate
example: example:
4.411111 4.411111
alipay_online_rate: alipay_online_rate:
type: number type: number
description: 支付宝线上汇率 description: Alipay online exchange rate
example: example:
4.411111 4.411111
/gateway/partners/{partner_code}/orders/{partner_order_id}/refunds/{partner_refund_id}: /gateway/partners/{partner_code}/orders/{partner_order_id}/refunds/{partner_refund_id}:
put: put:
summary: 发起退款 summary: Refund Order
description: 一笔支付订单可以分多次退款,退款总金额不得超过实际支付金额,退款币种与支付订单一致 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: tags:
- QRCode - QRCode
- JSAPI - JSAPI
@ -967,11 +993,11 @@ paths:
- name: partner_order_id - name: partner_order_id
in: path in: path
required: true required: true
description: 需要退款订单的单号 description: Payment order id in merchant's system
- name: partner_refund_id - name: partner_refund_id
in: path in: path
required: true required: true
description: 退款单号 description: Refund id in merchant's system
requestBody: requestBody:
content: content:
application/json: application/json:
@ -982,10 +1008,10 @@ paths:
properties: properties:
fee: fee:
type: integer type: integer
description: 退款金额,单位是货币最小单位,单个订单退款单金额总和不能超过用户支付金额 description: 退Refund amount. Use base unit of the currency. Total amount of all refund orders must be less than actual paid amount.
device_id: device_id:
type: string type: string
description: 操作设备id description: ID of the device which sends the request
responses: responses:
200: 200:
description: Refund description: Refund
@ -994,7 +1020,7 @@ paths:
schema: schema:
$ref: 'components_order.yml#/refundStatus' $ref: 'components_order.yml#/refundStatus'
get: get:
summary: 查询退款 summary: Check Refund Status
tags: tags:
- QRCode - QRCode
- JSAPI - JSAPI
@ -1012,11 +1038,11 @@ paths:
- name: partner_order_id - name: partner_order_id
in: path in: path
required: true required: true
description: 订单的单号 description: Payment order id in merchant's system
- name: partner_refund_id - name: partner_refund_id
in: path in: path
required: true required: true
description: 退款单号 description: Refund id in merchant's system
responses: responses:
200: 200:
description: Refund Status description: Refund Status
@ -1026,10 +1052,13 @@ paths:
$ref: 'components_order.yml#/refundStatus' $ref: 'components_order.yml#/refundStatus'
/gateway/partners/{partner_code}/transactions: /gateway/partners/{partner_code}/transactions:
get: get:
summary: 查询流水 summary: Check Transactions
description: | description: |
本接口将列出商户当日所有流水,包括所有接口(含非网关接口)支付通道的付款、RoyalPay优惠补贴、退款、 退款失败补正、系统补正、营销账户转入转出等,不含清算信息 This Api will list all transactions for current merchant in the day, containing all payment methods(include no gateway methods) and all payment channels such as payment,
注意一笔付款订单或退款订单均可能对应多条流水记录 RoyalPay discount cashback, refunds, credit for failure refunds, system pay back,
cashback account income/outcome, etc. Settlement transactions will not be contained.
**Note: A payment order or refund order can contains several transaction records**
tags: tags:
- PublicApi - PublicApi
parameters: parameters:
@ -1043,7 +1072,7 @@ paths:
type: string type: string
in: query in: query
required: true required: true
description: 账单日期,'yyyyMMdd'格式GMT+10只能查今天以前的账单 description: Transaction date. Format as 'yyyyMMdd', GMT+10. Only transaction before today can be query
example: 20200315 example: 20200315
responses: responses:
200: 200:
@ -1065,13 +1094,13 @@ paths:
SUCCESS SUCCESS
transaction_count: transaction_count:
type: integer type: integer
description: 流水条数 description: transactions number
order_count: order_count:
type: integer type: integer
description: 付款条数 description: credit number
refund_count: refund_count:
type: integer type: integer
description: 退款条数 description: debit number
transactions: transactions:
type: array type: array
items: items:
@ -1086,10 +1115,13 @@ paths:
description: target settlement date, maybe delay due to holidays and bank issues(yyyy-MM-dd) description: target settlement date, maybe delay due to holidays and bank issues(yyyy-MM-dd)
/gateway/partners/{partner_code}/settlements: /gateway/partners/{partner_code}/settlements:
get: get:
summary: 查看清算详情 summary: Check Settlements
description: | description: |
本接口将列出商户查询日期清算的所有流水,包括所有接口(含非网关接口)支付通道的付款、RoyalPay优惠补贴、退款、 退款失败补正、系统补正、营销账户转入转出等 This Api will list all transactions with the settlement this day, containing all payment methods(include no gateway methods)
注意一笔付款订单或退款订单均可能对应多条流水记录 and all payment channels such as payment, RoyalPay discount cashback, refunds, credit for failure refunds,
system pay back, cashback account income/outcome, etc.
**Note: A payment order or refund order can contains several transaction records**
tags: tags:
- PublicApi - PublicApi
parameters: parameters:
@ -1102,7 +1134,7 @@ paths:
format: date format: date
pattern: yyyyMMdd pattern: yyyyMMdd
type: string type: string
description: 清算日期,'yyyyMMdd'格式GMT+10只能查今天以前 description: Settle date. Format as 'yyyyMMdd' ,GMT+10. Only settlement before today can be query
required: true required: true
responses: responses:
200: 200:
@ -1119,56 +1151,58 @@ paths:
SUCCESS SUCCESS
result_code: result_code:
type: string type: string
description: 业务Execute Result description: Process Result
example: example:
SUCCESS SUCCESS
settle_from: settle_from:
type: string type: string
format: date format: date
description: 订单起始日期yyyyMMdd description: 'Transaction date from, yyyyMMdd'
settle_to: settle_to:
type: string type: string
format: date format: date
description: 订单截止日期:yyyyMMdd description: Transaction date to, yyyyMMdd
settle_days: settle_days:
type: string type: string
description: 清算周期 description: Settle delay
example: example:
T+2 T+2
transaction_count: transaction_count:
type: integer type: integer
description: 流水条数 description: transaction record count
order_count: order_count:
type: integer type: integer
description: 付款条数 description: credit count
refund_count: refund_count:
type: integer type: integer
description: 退款条数 description: debit count
total_credit: total_credit:
type: integer type: integer
description: 入账总金额(AUD分) description: total credit fee(AUD cent)
total_debits: total_debits:
type: integer type: integer
description: 支出总金额(AUD分) description: total debit fee(AUD cent)
total_surcharge: total_surcharge:
type: integer type: integer
description: 手续费总额(AUD分) description: Total surcharge(AUD cent)
total_transfer: total_transfer:
type: integer type: integer
description: 打款总额(AUD分) description: Total transfer amount(AUD cent)
transactions: transactions:
type: array type: array
items: items:
$ref: 'components_order.yml#/transactionItem' $ref: 'components_order.yml#/transactionItem'
/notify: /notify:
post: post:
summary: 到账通知 summary: Order Paid Notify
description: | description: |
若订单创建时提供了notify_url系统会在用户支付成功后向这个地址主动发送支付成功状态推送请求方式为POST If notify_url is provided when order is created. System will post request to this url when the payment succeeds.
与服务器API不同推送校验参数会包含在json内商户系统应该验证校验参数确定来源正确后再次进行订单接口查询确认订单支付状态再进行后续操作。 Request method is POST. Different from Server APIs, sign parameters will be included in json entity.
商户系统收到请求后应按要求返回参数若RoyalPay未收到合法参数视为商户未接收成功推送动作首次触发会重试3次随后24小时内每10分钟推送一次直到返回200状态码。 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: tags:
- SDK Payment - SDK Payment
- CB Bank - CB Bank
@ -1188,53 +1222,53 @@ paths:
time: time:
type: integer type: integer
format: int64 format: int64
description: UTC时间戳 description: UTC timestamp in millis
nonce_str: nonce_str:
type: string type: string
description: 随机字符串 description: Random string
sign: sign:
type: string type: string
description: 签名 description: Sign
partner_order_id: partner_order_id:
type: string type: string
description: 商户单号 description: Partner order id
channel_order_id: channel_order_id:
type: string type: string
description: 渠道方交易单号 description: PayChannel(Alipay、Wechat) Transaction Trade No
order_id: order_id:
type: string type: string
description: RoyalPay订单号 description: RoyalPay order id
total_fee: total_fee:
type: integer type: integer
description: 订单金额,单位是最小货币单位 description: Order amount
real_fee: real_fee:
type: integer type: integer
description: 支付金额,单位是最小货币单位 description: Actual paid amount
rate: rate:
type: number type: number
description: 交易时使用的汇率,1AUD=?CNY description: Exchange Rate used while trading. 1AUD=?CNY
currency: currency:
type: string type: string
description: 币种,AUD description: Currency, AUD
channel: channel:
type: string type: string
description: 交易渠道 description: Payment Channel Alipay, AlipayOnline, Wechat
create_time: create_time:
type: string type: string
format: 'date-time' format: 'date-time'
pattern: yyyy-MM-dd HH:mm:ss pattern: yyyy-MM-dd HH:mm:ss
description: 订单创建时间,格式为'yyyy-MM-dd HH:mm:ss'GMT+10 description: Time when order is created, which is formatted in 'yyyy-MM-dd HH:mm:ss', GMT+10
pay_time: pay_time:
type: string type: string
format: 'date-time' format: 'date-time'
pattern: yyyy-MM-dd HH:mm:ss pattern: yyyy-MM-dd HH:mm:ss
description: 订单支付时间,格式为'yyyy-MM-dd HH:mm:ss'GMT+10 description: Time when order is paid, which is formatted in 'yyyy-MM-dd HH:mm:ss', GMT+10.
responses: responses:
200: 200:
description: OK description: OK
/customs/partners/{partner_code}/declare/report/{client_report_id}: /customs/partners/{partner_code}/declare/report/{client_report_id}:
put: put:
summary: 创建报关单 summary: Create Custom Declare
tags: tags:
- Custom - Custom
parameters: parameters:
@ -1252,37 +1286,37 @@ paths:
properties: properties:
order_id: order_id:
type: string type: string
description: 商户支付订单号,要求同一商户唯一 description: Partner order id
custom: custom:
type: string type: string
description: 海关编号 * [渠道海关编号](https://www.royalpay.com.au/downloads/CustomsNO.xlsx) description: Customs No. * [Channel Custom No](https://www.royalpay.com.au/downloads/CustomsNO.xlsx)
mch_custom_id: mch_custom_id:
type: string type: string
description: 商户在海关备案的编号 description: Customs record id of merchant
mch_custom_name: mch_custom_name:
type: string type: string
description: 商户海关备案名称 description: Customs record name of merchant
sub_order: sub_order:
type: array type: array
description: 子订单(拆单) description: Child orders(If split order required)
items: items:
type: object type: object
properties: properties:
sub_order_no: sub_order_no:
type: string type: string
description: 商户子订单号 description: Sub order no
fee_type: fee_type:
type: string type: string
description: 币种代码 description: currency
default: CNY default: CNY
enum: enum:
- CNY - CNY
order_fee: order_fee:
type: number type: number
description: 子订单金额,单位是元 description: Sub order price. unit is Yuan
transport_fee: transport_fee:
type: number type: number
description: 子订单物流金额,单位是元 description: Sub order transport fee. unit is Yuan
responses: responses:
200: 200:
description: Custom description: Custom
@ -1291,7 +1325,7 @@ paths:
schema: schema:
$ref: 'components_order.yml#/customInfo' $ref: 'components_order.yml#/customInfo'
get: get:
summary: 查询报关单 summary: Query Custom Report
tags: tags:
- Custom - Custom
parameters: parameters:
@ -1310,8 +1344,8 @@ paths:
$ref: 'components_order.yml#/customInfo' $ref: 'components_order.yml#/customInfo'
/customs/partners/{partner_code}/redeclare/report/{client_report_id}: /customs/partners/{partner_code}/redeclare/report/{client_report_id}:
put: put:
summary: 重新提交报关单 summary: Redeclare Custom Report
description: 用于重新提交未报关成功的报关单 description: Used to resubmit the attachment information of the order required by the merchant.
tags: tags:
- Custom - Custom
parameters: parameters:
@ -1334,31 +1368,34 @@ components:
type: apiKey type: apiKey
in: query in: query
name: nonce_str name: nonce_str
description: 随机字符串 description: Random String
time: time:
type: apiKey type: apiKey
in: query in: query
name: time name: time
description: 带毫秒的Unix时间戳务必检查服务器时间和时区配置。计算服务器上的UTC时间是否匹配真实UTC时间即可。允许误差±5分钟 description: |
Unix Timestamp with millis. It is recommended to check your server time and timezone configuration.
You can calculate the UTC time according your server time & timezone and check if it was correct.
sign: sign:
type: apiKey type: apiKey
in: query in: query
name: sign name: sign
description: | description: |
商户签约后会分配得到一个partner_code和credential_code用于签名其中partner_code随请求传递credential_code务必自行存储不得外泄仅作为签名参数。 After merchants signed contract. They will get a `partner_code` and `credential_code` to make signatures.
`partner_code` is passed with requests. `credential_code` must be store safe in merchant side. it only used to make signatures.
每次请求都必须加入签名信息作为请求校验。校验参数全部以Query Param参数的方式附加在URL后面顺序不分先后。 Each requests must add sign parameters as authentication. Sign params will tailed after request url as query param. And no sort is required.
签名过程: Signature progress:
1. 连接生成签名的原始字符串需要4个参数使用&连接,无需转码 1. Create origin string for validation. required 4 parameters and connect them with &. Translating is not required.
> valid_string=partner_code&time&nonce_str&credential_code > valid_string=partner_code&time&nonce_str&credential_code
2. 使用SHA256对valid_string进行签名并转换为小写字符串 2. Use SHA256 to sign valid_string and get lowercased hex string
> sign=hex(sha256(valid_string)).toLowerCase() > sign=hex(sha256(valid_string)).toLowerCase()
3. 在请求中将签名使用的time, nonce_str和生成的sign作为query参数发送 3. Pass used `time`, `nonce_str` and generated `sign` as query parameter in requests.
> 签名测试地址:https://mpay.royalpay.com.au/sign_test.html > Signature test address: https://mpay.royalpay.com.au/sign_test.html

@ -46,7 +46,7 @@ public interface CleanService {
void settlementXlsx(Date date, HttpServletResponse response) throws IOException; void settlementXlsx(Date date, HttpServletResponse response) throws IOException;
List<JSONObject> getXlsx(Date dt, String bank, List<JSONObject> logs) throws IOException; List<JSONObject> getXlsx(Date dt, List<JSONObject> logs) throws IOException;
List<JSONObject> getSettleLogs(Date dt, List<String> clearIds); List<JSONObject> getSettleLogs(Date dt, List<String> clearIds);

@ -435,28 +435,17 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
} }
@Override @Override
public List<JSONObject> getXlsx(Date dt, String bank, List<JSONObject> logs) throws IOException { public List<JSONObject> getXlsx(Date dt, List<JSONObject> logs) throws IOException {
List<JSONObject> result = new ArrayList<>(); List<JSONObject> result = new ArrayList<>();
int fileIndex = 1; for (JSONObject log : logs) {
if (logs.size() > 1) { List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id"));
for (JSONObject log : logs) { List<String> banks = details.stream().map(detail -> detail.getString("settle_bank")).distinct().collect(Collectors.toList());
String filename = "Merchant_Settlement_Info_" + DateFormatUtils.format(dt, "yyyyMMdd") + "_" + fileIndex + ".xlsx"; for (String bank : banks) {
JSONObject file = new JSONObject(); String filename = String.format("Merchant_Setlement_Info_%s_%s.xlsx", bank, DateFormatUtils.format(log.getDate("operate_time"), "yyyyMMddHHmmss"));
file.put("name", filename);
List<JSONObject> 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";
JSONObject file = new JSONObject(); JSONObject file = new JSONObject();
file.put("name", filename); file.put("name", filename);
List<JSONObject> details = clearingDetailMapper.listReportsOfSettlement(log.getIntValue("clearing_id")); List<JSONObject> mergedDetails = mergeBatchSettleClients(details.stream().filter(detail -> bank.equals(detail.getString("settle_bank"))).collect(Collectors.toList()));
details = mergeBatchSettleClients(details); file.put("byteArr", generateSettleXlsxFile(dt, mergedDetails, bank));
file.put("byteArr", generateSettleXlsxFile(dt, details, bank));
result.add(file); result.add(file);
} }
} }
@ -1373,7 +1362,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
List<JSONObject> attachList = new ArrayList<>(); List<JSONObject> attachList = new ArrayList<>();
JSONObject attach1 = new JSONObject(); JSONObject attach1 = new JSONObject();
List<JSONObject> clearLogs = getSettleLogs(date, clearIds); List<JSONObject> clearLogs = getSettleLogs(date, clearIds);
List<JSONObject> xlsxFileList = getXlsx(date, "CBA", clearLogs); List<JSONObject> xlsxFileList = getXlsx(date, clearLogs);
if (xlsxFileList.size() > 1) { if (xlsxFileList.size() > 1) {
fileName1 += ".zip"; fileName1 += ".zip";
attach1.put("content", Base64.encodeBase64String(getZipByteArr(xlsxFileList))); attach1.put("content", Base64.encodeBase64String(getZipByteArr(xlsxFileList)));
@ -1439,7 +1428,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider
ExtParamsUtils.getExtParamsValue(log.getString("plan_detail"), ExtParamsUtils.getExtParamsValue(log.getString("plan_detail"),
detail -> StringUtils.defaultIfEmpty(detail.getString("remark"), detail.getString("plan_id"))))) detail -> StringUtils.defaultIfEmpty(detail.getString("remark"), detail.getString("plan_id")))))
.collect(Collectors.joining(",")); .collect(Collectors.joining(","));
sendTaskFinishMessages(ManagerRole.FINANCIAL_STAFF, "清算文件已发送清算方:"+detailDescription, "发送清算通知"); sendTaskFinishMessages(ManagerRole.FINANCIAL_STAFF, "清算文件已发送清算方:" + detailDescription, "发送清算通知");
if (autoMarkSent) { if (autoMarkSent) {
if (!clearIds.isEmpty()) { if (!clearIds.isEmpty()) {
clearingLogMapper.lockSettlementsById(clearLogs.stream().map(log -> log.getString("clearing_id")).collect(Collectors.toList())); clearingLogMapper.lockSettlementsById(clearLogs.stream().map(log -> log.getString("clearing_id")).collect(Collectors.toList()));

Loading…
Cancel
Save