申请回调
## 说明
* 需要根据下面提供的回调参数格式开发接收接口,然后提供给对接人配置
### 申请回调分4种情况
1. 申请驳回
2. 开票失败
3. 开票全部成功
4. 开票部分成功
### 回调参数格式
申请驳回:
```json
{
"code":-2,
"message":"申请驳回",
"data":{
"orderBatchNo":"10202",
"erpOrderNos":[
"TEST0001"
],
"partnerOrderNos":[
"TEST0002"
]
}
}
```
开票失败:
```json
{
"code":-1,
"message":"开票失败",
"data":{
"orderBatchNo":"10202",
"erpOrderNos":[
"TEST0001"
],
"partnerOrderNos":[
"TEST0002"
],
"successNumber":0,
"failNumber":1,
"invoiceEntrys":[
{
"invoiceType":"c",
"invoiceCode":"",
"invoiceNo":"",
"paperDrewDate":"",
"sellerTaxNo":"913709011664024138",
"sellerName":"泰安市泰山测试宾馆",
"sellerAddress":"山东省泰安市",
"sellerTel":"6522888",
"sellerBankName":"中国农业银行股份有限公司",
"sellerBankAccount":"23112341234123419876",
"purchaserTaxNo":"023829007591698481",
"purchaserName":"泰安市泰山瀛泰国际测试有限公司",
"purchaserAddress":"山东省泰安市",
"purchaserTel":"0538-5362066",
"purchaserBankName":"上海交通银行",
"purchaserBankAccount":"62012341234123412345",
"taxRate":6,
"amountWithoutTax":10000,
"taxAmount":600,
"amountWithTax":10600,
"cipherTextTwoCode":"",
"cipherText":"",
"remark":"",
"cashierName":"测试1",
"checkerName":"测试2",
"invoicerName":"测试3",
"status":"2",
"pdfPath":"",
"processRemark":"开具失败,税盘不在线",
"details":[
{
"cargoName":"*餐饮服务*餐饮费",
"itemSpec":"",
"quantityUnit":"",
"quantity":0.96,
"taxRate":6,
"unitPrice":10377.36,
"amountWithoutTax":10000,
"taxAmount":600,
"amountWithTax":10600
}
]
}
]
}
}
```
开票成功:
```json
{
"code":1,
"message":"开票成功",
"data":{
"orderBatchNo":"10202",
"erpOrderNos":[
"TEST0001"
],
"partnerOrderNos":[
"TEST0002"
],
"successNumber":1,
"failNumber":0,
"invoiceEntrys":[
{
"invoiceNo":"52152220",
"invoiceCode":"80725121520",
"paperDrewDate":"20180725",
"invoiceType":"ce",
"sellerTaxNo":"126203004382603254",
"sellerName":"百威啤酒企业122",
"sellerAddress":"浙江省杭州市西湖区文一西路与崇水璐",
"sellerTel":"010-12312311",
"sellerBankName":"建设银行支行",
"sellerBankAccount":"62012341234123412345",
"purchaserTaxNo":"",
"purchaserName":"hexu",
"purchaserAddress":"",
"purchaserTel":"",
"purchaserBankName":"",
"purchaserBankAccount":"",
"amountWithoutTax":"5.71",
"taxAmount":"0.29",
"amountWithTax":"6.0",
"cipherText":"<645+-+067++2954>795>80035/>1/96+>17<3>>00*/385><8>6*89+72913-689>>61111-329+->90<65-/8896+989+",
"cipherTextTwoCode":"",
"status":"1",
"processRemark":"开具成功",
"cashierName":"",
"checkerName":"",
"invoicerName":"验试用户",
"remark":"",
"pdfPath":"http://s.yipiaoyun.com/dsv",
"details":[
{
"cargoName":"*预付卡销售*住宿费",
"itemSpec":"",
"quantityUnit":"",
"quantity":"3",
"taxRate":"5.00",
"unitPrice":"1.90",
"amountWithoutTax":"5.71",
"taxAmount":"0.29",
"amountWithTax":"6.00"
}
]
}
]
}
}
```
开票部分成功
```json
{
"code":2,
"message":"开票部分成功",
"data":{
"orderBatchNo":"10202",
"erpOrderNos":[
"TEST0001",
"TEST0003"
],
"partnerOrderNos":[
"TEST0002",
"TEST0004"
],
"successNumber":1,
"failNumber":1,
"invoiceEntrys":[
{
"invoiceNo":"52152220",
"invoiceCode":"80725121520",
"paperDrewDate":"20180725",
"invoiceType":"c",
"sellerTaxNo":"126203004382603254",
"sellerName":"百威啤酒企业122",
"sellerAddress":"浙江省杭州市西湖区文一西路与崇水璐",
"sellerTel":"010-12312311",
"sellerBankName":"建设银行支行",
"sellerBankAccount":"62012341234123412345",
"purchaserTaxNo":"",
"purchaserName":"hexu",
"purchaserAddress":"",
"purchaserTel":"",
"purchaserBankName":"",
"purchaserBankAccount":"",
"amountWithoutTax":"5.71",
"taxAmount":"0.29",
"amountWithTax":"6.0",
"cipherText":"<645+-+067++2954>795>80035/>1/96+>17<3>>00*/385><8>6*89+72913-689>>61111-329+->90<65-/8896+989+",
"cipherTextTwoCode":"",
"status":"1",
"processRemark":"开具成功",
"cashierName":"",
"checkerName":"",
"invoicerName":"验试用户",
"remark":"",
"details":[
{
"cargoName":"*预付卡销售*住宿费",
"itemSpec":"",
"quantityUnit":"",
"quantity":"3",
"taxRate":"5.00",
"unitPrice":"1.90",
"amountWithoutTax":"5.71",
"taxAmount":"0.29",
"amountWithTax":"6.00"
}
]
},
{
"invoiceType":"c",
"invoiceCode":"",
"invoiceNo":"",
"paperDrewDate":"",
"sellerTaxNo":"913709011664024138",
"sellerName":"泰安市泰山测试宾馆",
"sellerAddress":"山东省泰安市",
"sellerTel":"6522888",
"sellerBankName":"中国农业银行股份有限公司",
"sellerBankAccount":"23112341234123419876",
"purchaserTaxNo":"023829007591698481",
"purchaserName":"泰安市泰山瀛泰国际测试有限公司",
"purchaserAddress":"山东省泰安市",
"purchaserTel":"0538-5362066",
"purchaserBankName":"上海交通银行",
"purchaserBankAccount":"62012341234123412345",
"taxRate":6,
"amountWithoutTax":10000,
"taxAmount":600,
"amountWithTax":10600,
"cipherTextTwoCode":"",
"cipherText":"",
"remark":"",
"cashierName":"测试1",
"checkerName":"测试2",
"invoicerName":"测试3",
"status":"2",
"pdfPath":"",
"processRemark":"开具失败,税盘不在线",
"details":[
{
"cargoName":"*餐饮服务*餐饮费",
"itemSpec":"",
"quantityUnit":"",
"quantity":0.96,
"taxRate":6,
"unitPrice":10377.36,
"amountWithoutTax":10000,
"taxAmount":600,
"amountWithTax":10600
}
]
}
]
}
}
```
#### 注释
如果是拆票的情况,invoiceEntrys会返回多个InvoiceEntryDto对象;
如果是部分成功的情况,后续用户重试开票变为全部成功的时候会重新发送一次回调(两次都是对同一次开票申请做处理,所以需要合作方记录状态并做覆盖处理);
### 参数说明
| 参数| 类型| 说明|
| ------------ | ------------ |------------ |
|code|int|本次回调 -2:表示申请驳回,-1:表示失败,1:表示全部成功,2:表示部分成功|
|message|string|消息说明|
|data|`List<InvoiceRollbackDto>`|返回开票回调信息|
InvoiceRollbackDto:
| 参数| 类型| 说明|
| ------------ | ------------ |------------ |
|orderBatchNo|String | 订单批次号 |
|partnerOrderNos|`List<String>` | 渠道订单号集合|
|erpOrderNos|`List<String>` | ERP订单号集合|
|successNumber|Integer | 成功开票数|
|failNumber|Integer | 失败开票数|
|invoiceEntrys|`List<InvoiceEntryDto>` | 发票详情|
|invoiceEntrys[#].invoiceCode|String|发票代码(字符12位)|
|invoiceEntrys[#].invoiceNo|String|发票号码(字符8位)|
|invoiceEntrys[#].paperDrewDate|String|开票日期|
|invoiceEntrys[#].invoiceType|String|发票类型,s:纸质专票,c:纸质普票,ce:电子普票|
|invoiceEntrys[#].sellerTaxNo|String|销方税号|
|invoiceEntrys[#].sellerName|String|销方名称|
|invoiceEntrys[#].sellerAddress|String|销方地址|
|invoiceEntrys[#].sellerTel|String|销方电话|
|invoiceEntrys[#].sellerBankName|String|销方银行名称|
|invoiceEntrys[#].sellerBankAccount|String|销方银行账号|
|invoiceEntrys[#].purchaserTaxNo|String|购方税号|
|invoiceEntrys[#].purchaserName|String|购方名称|
|invoiceEntrys[#].purchaserAddress|String|购方地址|
|invoiceEntrys[#].purchaserTel|String|购方电话|
|invoiceEntrys[#].purchaserBankName|String|购方银行名称|
|invoiceEntrys[#].purchaserBankAccount|String|购方银行账号|
|invoiceEntrys[#].amountWithoutTax|String|不含税金额|
|invoiceEntrys[#].taxAmount|String|税额|
|invoiceEntrys[#].amountWithTax|String|含税金额|
|invoiceEntrys[#].cipherText|String|发票密文|
|invoiceEntrys[#].cipherTextTwoCode|String|密文二维码|
|invoiceEntrys[#].pdfPath|String|电票pdf路径|
|invoiceEntrys[#].status|String|单张发票状态,1:正常 2:开具失败|
|invoiceEntrys[#].proccessRemark|String|开票结果|
|invoiceEntrys[#].cashierName|String|付款人|
|invoiceEntrys[#].checkerName|String|审核人||
|invoiceEntrys[#].invoicerName|String|开票人|
|invoiceEntrys[#].remark|String|备注||
|invoiceEntrys[#].details|`List<InvoiceDetailDto>`|发票明细|
|invoiceEntrys[#].details[#].cargoName|String|货物或应税劳务名称|
|invoiceEntrys[#].details[#].itemSpec|String|规格型号|
|invoiceEntrys[#].details[#].quantityUnit|String|单位|
|invoiceEntrys[#].details[#].quantity|String|数量|
|invoiceEntrys[#].details[#].taxRate|String|税率|
|invoiceEntrys[#].details[#].unitPrice|String|单价|
|invoiceEntrys[#].details[#].amountWithoutTax|String|不含税总额|
|invoiceEntrys[#].details[#].taxAmount|String|税额|
|invoiceEntrys[#].details[#].amountWithTax|String|含税总额|
#### 注释
* code是本次开票请求的整体状态
* status是具体单张发票的开具状态
* message是本次开票请求的结果说明
* proccessRemark是具体单张发票的开票说明
## 接口定义
### 注意
需要做好接收回调接口的幂等性处理,以下情况会重复发送:
1. 接口无返回
2. 接口返回失败
### 请求方式:
`POST`
### 返回格式
| 参数| 类型| 说明|
| ------------ | ------------ |------------ |
|code|int|本次回调 -1:表示失败,0:表示成功|
|message|string|消息说明|
### 失败
```json
{
"code":-1,
"message":"回调失败"
}
```
### 成功
```json
{
"code":0,
"message":"回调成功"
}
```