react_hsbc_teller 1.9.7 → 1.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react_hsbc_teller",
3
- "version": "1.9.7",
3
+ "version": "1.9.8",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -179,7 +179,7 @@ class API extends Server{
179
179
  try{
180
180
  let result = await this.axios('post', '/hsbc/identify/ocr/callback', params);
181
181
  console.log(result)
182
- if(result && (result.data instanceof Object) && result.code === 200){
182
+ if(result && (result.data instanceof Object) && (result.code === 200 || result.code == 30002 || result.code == 20002 || result.code == 40002 || result.code == 50002)){
183
183
  return result||[];
184
184
  }else{
185
185
  let err = {
@@ -7,16 +7,16 @@ class Demo extends Component {
7
7
  shareMask: false,
8
8
  imRoomId
9
9
  :
10
- "vVwWYL84k@conference.ls-im-xmpp.chinawp.dev.ali.cloud.cn.hsbc",
10
+ "zuQwaI8vq@conference.ls-im-xmpp.chinawp.dev.ali.cloud.cn.hsbc",
11
11
  sessionId
12
12
  :
13
- "vVwWYL84k",
13
+ "zuQwaI8vq",
14
14
  mtoken
15
15
  :
16
- "d6544d018d07",
16
+ "56f7485985f4",
17
17
  roomId
18
18
  :
19
- "664439964321531",
19
+ "665293795986281",
20
20
  // roomId: '',
21
21
  // mtoken: '',
22
22
  // imRoomId: '',
@@ -352,7 +352,7 @@ class Video extends Component {
352
352
  saveLog = (val) => {
353
353
  axios({
354
354
  method: 'get',
355
- baseURL: this.props.logUrl + '&message=' + encodeURIComponent(val) + '&react_hsbc_teller=1.9.7&logTime=' + Date.now() + '&mtoken=' + encodeURIComponent(this.state.rtoken) + '&roomId=' + encodeURIComponent(this.state.channelId) + '&sessionId=' + encodeURIComponent(this.state.sessionId) + '&appointmentID=' + this.props.businessNumber,
355
+ baseURL: this.props.logUrl + '&message=' + encodeURIComponent(val) + '&react_hsbc_teller=1.9.8&logTime=' + Date.now() + '&mtoken=' + encodeURIComponent(this.state.rtoken) + '&roomId=' + encodeURIComponent(this.state.channelId) + '&sessionId=' + encodeURIComponent(this.state.sessionId) + '&appointmentID=' + this.props.businessNumber,
356
356
 
357
357
  }).then(res => {
358
358
 
@@ -513,7 +513,6 @@ class Video extends Component {
513
513
  console.log(JSON.parse(window.sessionStorage.getItem('sigData')));
514
514
  // eslint-disable-next-line no-undef
515
515
  // initWebSocket('wss://im.uat.dsp.hsbcfts.com.cn:443/wealth/im/ws/')
516
- // initWebSocket('wss://' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname + ':' + '15603' + '/ws/');
517
516
  if (!this.state.imStatus) {
518
517
  this.state.manualClose = false
519
518
  initWebSocket('wss://' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname + ':' + JSON.parse(window.sessionStorage.getItem('sigData')).webPort + '/ws/');
@@ -777,26 +776,20 @@ class Video extends Component {
777
776
  };
778
777
  errorCodeClick=(type,value)=>{
779
778
  if(type == 'ocr'){
780
- if(value == 100701 || value == 100702 || value == 200001 || value == 300901 || value == 300902 || value == 400001) {
779
+ if(value == -1007 || value == -100701 || value == -100702 || value == -200001 || value == -300901 || value == -300902 || value == -400001) {
781
780
  this.setState({
782
781
  cardFailReason: '证件图片不清晰,请重试。返回重拍时,请检查并确保身份证件图片信息完整清晰后再提交核查。[#'+value+'#]'
783
782
  })
784
- }
785
- if(value == 100803 || value == 100804 || value == 100805) {
786
- this.setState({
787
- cardFailReason: '证件信息核查失败,请重试。返回重拍时,请检查并确保身份证件图片信息完整清晰后再提交核查。[#'+value+'#]'
788
- })
789
- }
790
- if(value == 100801 || value == 100802) {
783
+ } else if(value == -1001 || value == -1002|| value == -1003||value == -1004||value == -1005||value==-1006) {
791
784
  this.setState({
792
785
  cardFailReason: '系统或网络连接异常,请重试。若仍有问题,请联系Support同事。[#'+value+'#]'
793
786
  })
794
- }
795
- if(value == 30002 || value == 20002 || value == 40002 || value == 50002 ) {
787
+ }else {
796
788
  this.setState({
797
- cardFailReason: '识别成功-证件已过期。[#'+value+'#]'
789
+ cardFailReason: '证件信息核查失败,请重试。返回重拍时,请检查并确保身份证件图片信息完整清晰后再提交核查。[#'+value+'#]'
798
790
  })
799
791
  }
792
+
800
793
  } else if(type == 'face') {
801
794
  if(value == 201 || value == 202 || value == 203 || value == 401 || value == 428) {
802
795
  this.setState({
@@ -3878,7 +3871,7 @@ class Video extends Component {
3878
3871
  }
3879
3872
  }
3880
3873
  componentWillMount() {
3881
- console.log('hsbc_teller_sdk', '1.9.7')
3874
+ console.log('hsbc_teller_sdk', '1.9.8')
3882
3875
  if (this.props.sessionId) {
3883
3876
  this.getRoomStatus({
3884
3877
  sessionId: this.props.sessionId
@@ -4322,8 +4315,8 @@ class Video extends Component {
4322
4315
  fileBase64: val == 1 ? this.state.facialImgFront.replace(/^data:image\/\w+;base64,/, "") : this.state.facialImgBack.replace(/^data:image\/\w+;base64,/, ""),
4323
4316
  type: val == 1 ? true : false
4324
4317
  });
4325
- if (result.code == 200) {
4326
- console.log('ocrCallback', result.data)
4318
+ if (result.code === 200 || result.code == 30002 || result.code == 20002 || result.code == 40002 || result.code == 50002) {
4319
+ console.log('ocrCallback', result.data,val)
4327
4320
  // this.messageClick('姓名:' + result.data.idCardName + ',身份证号:' + result.data.idCardNumber,'success')
4328
4321
  // this.messageClick('识别成功','success')
4329
4322
  callNimIM('sendCustomCmdMsg', {
@@ -4336,7 +4329,7 @@ class Video extends Component {
4336
4329
  })
4337
4330
  });
4338
4331
  if(this.state.documentType == 'ID_CARD') {
4339
- if (result.data.side == 'front') {
4332
+ if (result.data.side == 'front' && val == 1) {
4340
4333
  if(this.state.certificateValidity) {
4341
4334
  if(this.dateNewTime(this.state.certificateValidity.split('-')[1])){
4342
4335
  this.setState({
@@ -4351,7 +4344,7 @@ class Video extends Component {
4351
4344
  idCardNumber: result.data.idCardNumber,
4352
4345
  idCardName: result.data.idCardName,
4353
4346
  certificateValidityType: false,
4354
- cardFailReason: '证件不在有效期内',
4347
+ cardFailReason: '证件已过期[#'+result.code+'#]',
4355
4348
  loadingFace: false,
4356
4349
  cardResuly: 'success',
4357
4350
  })
@@ -4365,30 +4358,40 @@ class Video extends Component {
4365
4358
  })
4366
4359
  this.ocrCallback(2)
4367
4360
  }
4368
- } else if (result.data.side == 'back') {
4369
- console.log(result.data.startDate, result.data.endDate)
4370
- if(this.state.idCardName && this.dateNewTime(result.data.endDate)) {
4361
+ } else if (result.data.side == 'back' && val != 1) {
4362
+ let startDate
4363
+ let endDate
4364
+ if(result.code == 20002) {
4365
+ startDate = result.data.idCard.startDate
4366
+ endDate = result.data.idCard.endDate
4367
+ } else {
4368
+ startDate = result.data.startDate
4369
+ endDate = result.data.endDate
4370
+ }
4371
+ console.log(startDate, endDate)
4372
+ if(this.state.idCardName && this.dateNewTime(endDate)) {
4371
4373
  this.setState({
4372
- certificateValidity: result.data.startDate + '-' + result.data.endDate,
4374
+ certificateValidity: startDate + '-' + endDate,
4373
4375
  loadingFace: false,
4374
4376
  cardFailReason: '',
4375
4377
  cardResuly: 'success',
4376
4378
  certificateValidityType: true,
4377
4379
  })
4378
- } else if(this.state.idCardName && !this.dateNewTime(result.data.endDate)) {
4380
+ } else if(this.state.idCardName && !this.dateNewTime(endDate)) {
4379
4381
  this.setState({
4380
- certificateValidity: result.data.startDate + '-' + result.data.endDate,
4382
+ certificateValidity: startDate + '-' + endDate,
4381
4383
  loadingFace: false,
4382
4384
  certificateValidityType: false,
4383
- cardFailReason: '证件不在有效期内',
4385
+ cardFailReason: '证件已过期[#'+result.code+'#]',
4384
4386
  cardResuly: 'success',
4385
4387
  })
4386
- } else if(!this.state.idCardName) {
4387
- this.setState({
4388
- certificateValidity: result.data.startDate + '-' + result.data.endDate,
4389
- })
4390
- this.ocrCallback(2)
4391
4388
  }
4389
+ // else if(!this.state.idCardName) {
4390
+ // this.setState({
4391
+ // certificateValidity: result.data.startDate + '-' + result.data.endDate,
4392
+ // })
4393
+ // this.ocrCallback(2)
4394
+ // }
4392
4395
  // if(this.state.idCardName) {
4393
4396
  // this.setState({
4394
4397
  // certificateValidity: result.data.startDate + '-' + result.data.endDate,
@@ -4402,6 +4405,12 @@ class Video extends Component {
4402
4405
  // })
4403
4406
  // this.ocrCallback(2)
4404
4407
  // }
4408
+ } else {
4409
+ this.setState({
4410
+ loadingFace: false,
4411
+ cardFailReason: '证件截取顺序有误,请返回重拍[41000]',
4412
+ cardResuly: 'fail',
4413
+ })
4405
4414
  }
4406
4415
  }
4407
4416
  if(this.state.documentType == 'HK_MO_RESIDENCE_CARD' || this.state.documentType == 'TW_RESIDENCE_CARD') {
@@ -4417,7 +4426,7 @@ class Video extends Component {
4417
4426
  this.setState({
4418
4427
  certificateValidity: result.data.resident.startDate + '-' + result.data.resident.endDate,
4419
4428
  loadingFace: false,
4420
- cardFailReason: '',
4429
+ cardFailReason: result.code == 40002 ? '证件已过期[#'+result.code+'#]' : '',
4421
4430
  cardResuly: 'success',
4422
4431
  })
4423
4432
  }
@@ -4428,7 +4437,7 @@ class Video extends Component {
4428
4437
  idCardName: result.data.passport.nameEN,
4429
4438
  certificateValidity: result.data.passport.expiryDate,
4430
4439
  loadingFace: false,
4431
- cardFailReason: '',
4440
+ cardFailReason: result.code == 30002 ? '证件已过期[#'+result.code+'#]' : '',
4432
4441
  cardResuly: 'success',
4433
4442
  })
4434
4443
  }
@@ -4439,7 +4448,7 @@ class Video extends Component {
4439
4448
  idCardName: result.data.permission.nameEN,
4440
4449
  certificateValidity: result.data.permission.validDate,
4441
4450
  loadingFace: false,
4442
- cardFailReason: '',
4451
+ cardFailReason: result.code == 50002 ? '证件已过期[#'+result.code+'#]' : '',
4443
4452
  cardResuly: 'success',
4444
4453
  })
4445
4454
  }
@@ -5684,14 +5693,25 @@ class Video extends Component {
5684
5693
  }
5685
5694
  }
5686
5695
  saveAuthorize = async (appAccount) => {
5687
- try {
5688
- let result = await API.saveAuthorize({
5696
+ let obj
5697
+ if(this.state.documentType == 'ID_CARD') {
5698
+ obj = {
5689
5699
  activityId: this.props.businessNumber,
5690
- authorizeType: this.state.documentType == 'ID_CARD' ? 'ID' : 'NID',
5700
+ authorizeType: 'ID',
5691
5701
  appAccount: appAccount,
5692
- idCardAuthorize: this.state.documentType == 'ID_CARD' ? 'YES' : '',
5702
+ idCardAuthorize: 'YES',
5693
5703
  pictureAuthorize: 'YES'
5694
- });
5704
+ }
5705
+ } else {
5706
+ obj = {
5707
+ activityId: this.props.businessNumber,
5708
+ authorizeType: 'NID',
5709
+ appAccount: appAccount,
5710
+ pictureAuthorize: 'YES'
5711
+ }
5712
+ }
5713
+ try {
5714
+ let result = await API.saveAuthorize(obj);
5695
5715
  console.log(result)
5696
5716
  if (result.code == 200) {
5697
5717
  console.log('成功')
@@ -6348,6 +6368,7 @@ class Video extends Component {
6348
6368
  graffiti={this.graffiti}
6349
6369
  virtualization={this.virtualization}
6350
6370
  ></Foot>
6371
+ {/* 暂停恢复会话 */}
6351
6372
  <Modal cancelText="取消" okText="确定" visible={this.state.isModalVisible} onOk={this.handleOk}
6352
6373
  onCancel={this.handleCancel}>
6353
6374
  {
@@ -6357,6 +6378,7 @@ class Video extends Component {
6357
6378
  !this.state.isSuspend && <span>确定是否暂停会话?</span>
6358
6379
  }
6359
6380
  </Modal>
6381
+ {/* 是否退出会议*/}
6360
6382
  <Modal closable={false} centered={true} visible={this.state.isModalVisibleEnd} footer={[
6361
6383
  <div key='end'>
6362
6384
  <Button className="modelButtonCancel" onClick={this.handleCancelEnd}>取消</Button>
@@ -6365,10 +6387,13 @@ class Video extends Component {
6365
6387
  ]}>
6366
6388
  <div className='endModal'>是否要结束并退出会议?</div>
6367
6389
  </Modal>
6390
+ {/* ocr及人脸 */}
6368
6391
  <Modal title={this.state.titleModal} width={650} closable={false} centered={true} visible={this.state.isModalVisibleFacial} footer={[
6392
+ // ocr及人脸在截图界面的按钮
6369
6393
  this.state.cardResuly == '' && this.state.faceResuly == '' &&<div key='facial'>
6370
6394
  <Button className="modelButtonCancel" onClick={this.handleCancelFacial}>取消</Button>
6371
6395
  <Button className="modelButtonCancel" onClick={this.sgsinImage}>截图</Button>
6396
+ {/* 再截图后按钮高亮 */}
6372
6397
  {
6373
6398
  this.state.isFaceImage && <Button className="modelButtonOk" type="primary" danger onClick={this.handleOkFacial}>下一步</Button>
6374
6399
  }
@@ -6377,6 +6402,7 @@ class Video extends Component {
6377
6402
  }
6378
6403
 
6379
6404
  </div>,
6405
+ // 人脸识别后的结果界面的按钮
6380
6406
  this.state.cardResuly == '' && this.state.faceResuly != '' &&<div key='facial'>
6381
6407
  <Button className="modelButtonCancel" onClick={this.handleCancelFacial}>完成</Button>
6382
6408
  {
@@ -6388,6 +6414,7 @@ class Video extends Component {
6388
6414
 
6389
6415
 
6390
6416
  </div>,
6417
+ // ocr成功
6391
6418
  this.state.cardResuly == 'success' && <div key='facial'>
6392
6419
  {
6393
6420
  this.state.disabledIdCard && <Button className="modelButtonFaceOk" danger onClick={(e) => this.updateConfirm('noFace')}>修改</Button>
@@ -6403,6 +6430,7 @@ class Video extends Component {
6403
6430
  }
6404
6431
 
6405
6432
  </div>,
6433
+ // ocr失败
6406
6434
  this.state.cardResuly == 'fail' && <div key='facial'>
6407
6435
  <Button className="modelButtonCancel" onClick={this.handleCancelFacial}>取消</Button>
6408
6436
  <Button className="modelButtonOk" type="primary" danger onClick={this.newFaceClick}>返回重拍</Button>
@@ -176,7 +176,7 @@
176
176
  }
177
177
  span{
178
178
  display: inline-block;
179
- width: 5rem;
179
+ min-width: 5rem;
180
180
  }
181
181
  }
182
182
  }