react_hsbc_teller 1.9.5 → 1.9.7

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.5",
3
+ "version": "1.9.7",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -7,16 +7,16 @@ class Demo extends Component {
7
7
  shareMask: false,
8
8
  imRoomId
9
9
  :
10
- "IZLZMoTxj@conference.ls-im-xmpp.chinawp.dev.ali.cloud.cn.hsbc",
10
+ "vVwWYL84k@conference.ls-im-xmpp.chinawp.dev.ali.cloud.cn.hsbc",
11
11
  sessionId
12
12
  :
13
- "IZLZMoTxj",
13
+ "vVwWYL84k",
14
14
  mtoken
15
15
  :
16
- "bc084d8a922f",
16
+ "d6544d018d07",
17
17
  roomId
18
18
  :
19
- "663912632731275",
19
+ "664439964321531",
20
20
  // roomId: '',
21
21
  // mtoken: '',
22
22
  // imRoomId: '',
@@ -343,7 +343,8 @@ class Video extends Component {
343
343
  faceFailReason: '',
344
344
  cardResuly: '',
345
345
  cardFailReason: '',
346
- videoType: ''
346
+ videoType: '',
347
+ certificateValidityType: true,
347
348
  };
348
349
  // eslint-disable-next-line no-undef
349
350
  test_controller = '';
@@ -351,7 +352,7 @@ class Video extends Component {
351
352
  saveLog = (val) => {
352
353
  axios({
353
354
  method: 'get',
354
- baseURL: this.props.logUrl + '&message=' + encodeURIComponent(val) + '&react_hsbc_teller=1.9.5&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.7&logTime=' + Date.now() + '&mtoken=' + encodeURIComponent(this.state.rtoken) + '&roomId=' + encodeURIComponent(this.state.channelId) + '&sessionId=' + encodeURIComponent(this.state.sessionId) + '&appointmentID=' + this.props.businessNumber,
355
356
 
356
357
  }).then(res => {
357
358
 
@@ -776,7 +777,48 @@ class Video extends Component {
776
777
  };
777
778
  errorCodeClick=(type,value)=>{
778
779
  if(type == 'ocr'){
779
-
780
+ if(value == 100701 || value == 100702 || value == 200001 || value == 300901 || value == 300902 || value == 400001) {
781
+ this.setState({
782
+ cardFailReason: '证件图片不清晰,请重试。返回重拍时,请检查并确保身份证件图片信息完整清晰后再提交核查。[#'+value+'#]'
783
+ })
784
+ }
785
+ if(value == 100803 || value == 100804 || value == 100805) {
786
+ this.setState({
787
+ cardFailReason: '证件信息核查失败,请重试。返回重拍时,请检查并确保身份证件图片信息完整清晰后再提交核查。[#'+value+'#]'
788
+ })
789
+ }
790
+ if(value == 100801 || value == 100802) {
791
+ this.setState({
792
+ cardFailReason: '系统或网络连接异常,请重试。若仍有问题,请联系Support同事。[#'+value+'#]'
793
+ })
794
+ }
795
+ if(value == 30002 || value == 20002 || value == 40002 || value == 50002 ) {
796
+ this.setState({
797
+ cardFailReason: '识别成功-证件已过期。[#'+value+'#]'
798
+ })
799
+ }
800
+ } else if(type == 'face') {
801
+ if(value == 201 || value == 202 || value == 203 || value == 401 || value == 428) {
802
+ this.setState({
803
+ faceFailReason: '用户信息有误。请再次检查客户提交的证件信息是否正确后,返回重试。若仍有问题,请联系Support同事解决。[#'+ value + '#]'
804
+ })
805
+ }else if(value == 204) {
806
+ this.setState({
807
+ faceFailReason: '用户信息核查未通过。请返回重试。返回重拍时,请检查并确保客户照片完整清晰后再提交核查。[#'+ value + '#]'
808
+ })
809
+ }else if(value == 209) {
810
+ this.setState({
811
+ faceFailReason: '用户信息核查未通过。请确认客户与其提供的证件信息一致后,再提交核查。[#'+ value + '#]'
812
+ })
813
+ } else {
814
+ this.setState({
815
+ faceFailReason: '用户信息核查无法处理,请重试。若仍有问题,请联系Support同事。[#'+ value + '#]'
816
+ })
817
+ }
818
+
819
+
820
+
821
+
780
822
  }
781
823
  }
782
824
  contrastFaceVerify = async () => {
@@ -791,7 +833,7 @@ class Video extends Component {
791
833
  fileBase64: this.state.facialImg.replace(/^data:image\/\w+;base64,/, "")
792
834
  });
793
835
  console.log(result);
794
- if (result.code == 200 || result.code == 201) {
836
+ if (result.code == 200 || result.code == 210) {
795
837
  // this.messageClick('人脸识别成功','success')
796
838
  this.setState({
797
839
  loadingFace: false,
@@ -808,8 +850,9 @@ class Video extends Component {
808
850
  loadingFace: false,
809
851
  faceResuly: 'fail',
810
852
  isFaceImage: '',
811
- faceFailReason: result.message
853
+ // faceFailReason: result.message
812
854
  })
855
+ this.errorCodeClick('face',result.code)
813
856
  }
814
857
 
815
858
 
@@ -822,8 +865,9 @@ class Video extends Component {
822
865
  loadingFace: false,
823
866
  faceResuly: 'fail',
824
867
  isFaceImage: '',
825
- faceFailReason: err.message
868
+ // faceFailReason: err.message
826
869
  })
870
+ this.errorCodeClick('face',result.code)
827
871
  console.error('err', err);
828
872
  }
829
873
  };
@@ -3834,7 +3878,7 @@ class Video extends Component {
3834
3878
  }
3835
3879
  }
3836
3880
  componentWillMount() {
3837
- console.log('hsbc_teller_sdk', '1.9.5')
3881
+ console.log('hsbc_teller_sdk', '1.9.7')
3838
3882
  if (this.props.sessionId) {
3839
3883
  this.getRoomStatus({
3840
3884
  sessionId: this.props.sessionId
@@ -4293,20 +4337,71 @@ class Video extends Component {
4293
4337
  });
4294
4338
  if(this.state.documentType == 'ID_CARD') {
4295
4339
  if (result.data.side == 'front') {
4296
- this.setState({
4297
- // isModalVisibleFacial: false
4298
- idCardNumber: result.data.idCardNumber,
4299
- idCardName: result.data.idCardName
4300
- })
4301
- this.ocrCallback(2)
4340
+ if(this.state.certificateValidity) {
4341
+ if(this.dateNewTime(this.state.certificateValidity.split('-')[1])){
4342
+ this.setState({
4343
+ idCardNumber: result.data.idCardNumber,
4344
+ idCardName: result.data.idCardName,
4345
+ loadingFace: false,
4346
+ cardFailReason: '',
4347
+ cardResuly: 'success',
4348
+ })
4349
+ } else {
4350
+ this.setState({
4351
+ idCardNumber: result.data.idCardNumber,
4352
+ idCardName: result.data.idCardName,
4353
+ certificateValidityType: false,
4354
+ cardFailReason: '证件不在有效期内',
4355
+ loadingFace: false,
4356
+ cardResuly: 'success',
4357
+ })
4358
+ }
4359
+
4360
+ } else {
4361
+ this.setState({
4362
+ // isModalVisibleFacial: false
4363
+ idCardNumber: result.data.idCardNumber,
4364
+ idCardName: result.data.idCardName
4365
+ })
4366
+ this.ocrCallback(2)
4367
+ }
4302
4368
  } else if (result.data.side == 'back') {
4303
4369
  console.log(result.data.startDate, result.data.endDate)
4304
- this.setState({
4305
- certificateValidity: result.data.startDate + '-' + result.data.endDate,
4306
- loadingFace: false,
4307
- cardFailReason: '',
4308
- cardResuly: 'success',
4309
- })
4370
+ if(this.state.idCardName && this.dateNewTime(result.data.endDate)) {
4371
+ this.setState({
4372
+ certificateValidity: result.data.startDate + '-' + result.data.endDate,
4373
+ loadingFace: false,
4374
+ cardFailReason: '',
4375
+ cardResuly: 'success',
4376
+ certificateValidityType: true,
4377
+ })
4378
+ } else if(this.state.idCardName && !this.dateNewTime(result.data.endDate)) {
4379
+ this.setState({
4380
+ certificateValidity: result.data.startDate + '-' + result.data.endDate,
4381
+ loadingFace: false,
4382
+ certificateValidityType: false,
4383
+ cardFailReason: '证件不在有效期内',
4384
+ cardResuly: 'success',
4385
+ })
4386
+ } else if(!this.state.idCardName) {
4387
+ this.setState({
4388
+ certificateValidity: result.data.startDate + '-' + result.data.endDate,
4389
+ })
4390
+ this.ocrCallback(2)
4391
+ }
4392
+ // if(this.state.idCardName) {
4393
+ // this.setState({
4394
+ // certificateValidity: result.data.startDate + '-' + result.data.endDate,
4395
+ // loadingFace: false,
4396
+ // cardFailReason: '',
4397
+ // cardResuly: 'success',
4398
+ // })
4399
+ // } else {
4400
+ // this.setState({
4401
+ // certificateValidity: result.data.startDate + '-' + result.data.endDate,
4402
+ // })
4403
+ // this.ocrCallback(2)
4404
+ // }
4310
4405
  }
4311
4406
  }
4312
4407
  if(this.state.documentType == 'HK_MO_RESIDENCE_CARD' || this.state.documentType == 'TW_RESIDENCE_CARD') {
@@ -4352,17 +4447,19 @@ class Video extends Component {
4352
4447
  } else {
4353
4448
  this.setState({
4354
4449
  loadingFace: false,
4355
- cardFailReason: result.message,
4450
+ // cardFailReason: result.message,
4356
4451
  cardResuly: 'fail',
4357
4452
  })
4358
- this.messageClick('识别失败', 'error')
4453
+ // this.messageClick('识别失败', 'error')
4454
+ this.errorCodeClick('ocr',result.code)
4359
4455
  }
4360
4456
  } catch (err) {
4361
4457
  this.setState({
4362
4458
  loadingFace: false,
4363
- cardFailReason: err.response.message,
4459
+ // cardFailReason: err.response.message,
4364
4460
  cardResuly: 'fail',
4365
4461
  })
4462
+ this.errorCodeClick('ocr',err.response.code)
4366
4463
 
4367
4464
  // this.messageClick('识别失败', 'error')
4368
4465
  }
@@ -4622,6 +4719,7 @@ class Video extends Component {
4622
4719
  idCardName: '',
4623
4720
  cardFailReason: '',
4624
4721
  cardResuly: '',
4722
+ certificateValidityType: true
4625
4723
  }, () => {
4626
4724
 
4627
4725
 
@@ -5296,7 +5394,7 @@ class Video extends Component {
5296
5394
  content: JSON.stringify({
5297
5395
  'typeId': 1223,
5298
5396
  'sessionId': this.state.sessionId,
5299
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
5397
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId2').innerText).uid
5300
5398
  })
5301
5399
  });
5302
5400
  } if (value == 'video3') {
@@ -5305,7 +5403,7 @@ class Video extends Component {
5305
5403
  content: JSON.stringify({
5306
5404
  'typeId': 1223,
5307
5405
  'sessionId': this.state.sessionId,
5308
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
5406
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId3').innerText).uid
5309
5407
  })
5310
5408
  });
5311
5409
  } if (value == 'video4') {
@@ -5314,7 +5412,7 @@ class Video extends Component {
5314
5412
  content: JSON.stringify({
5315
5413
  'typeId': 1223,
5316
5414
  'sessionId': this.state.sessionId,
5317
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
5415
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId4').innerText).uid
5318
5416
  })
5319
5417
  });
5320
5418
  } if (value == 'video5') {
@@ -5323,7 +5421,7 @@ class Video extends Component {
5323
5421
  content: JSON.stringify({
5324
5422
  'typeId': 1223,
5325
5423
  'sessionId': this.state.sessionId,
5326
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
5424
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId5').innerText).uid
5327
5425
  })
5328
5426
  });
5329
5427
  } if (value == 'video6') {
@@ -5332,7 +5430,7 @@ class Video extends Component {
5332
5430
  content: JSON.stringify({
5333
5431
  'typeId': 1223,
5334
5432
  'sessionId': this.state.sessionId,
5335
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
5433
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId6').innerText).uid
5336
5434
  })
5337
5435
  });
5338
5436
  } if (value == 'video7') {
@@ -5341,7 +5439,7 @@ class Video extends Component {
5341
5439
  content: JSON.stringify({
5342
5440
  'typeId': 1223,
5343
5441
  'sessionId': this.state.sessionId,
5344
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
5442
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId7').innerText).uid
5345
5443
  })
5346
5444
  });
5347
5445
  } if (value == 'video8') {
@@ -5350,7 +5448,7 @@ class Video extends Component {
5350
5448
  content: JSON.stringify({
5351
5449
  'typeId': 1223,
5352
5450
  'sessionId': this.state.sessionId,
5353
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
5451
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId8').innerText).uid
5354
5452
  })
5355
5453
  });
5356
5454
  } if (value == 'video9') {
@@ -5359,7 +5457,7 @@ class Video extends Component {
5359
5457
  content: JSON.stringify({
5360
5458
  'typeId': 1223,
5361
5459
  'sessionId': this.state.sessionId,
5362
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
5460
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId9').innerText).uid
5363
5461
  })
5364
5462
  });
5365
5463
  }
@@ -5369,7 +5467,7 @@ class Video extends Component {
5369
5467
  content: JSON.stringify({
5370
5468
  'typeId': 1223,
5371
5469
  'sessionId': this.state.sessionId,
5372
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
5470
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId10').innerText).uid
5373
5471
  })
5374
5472
  });
5375
5473
  }
@@ -5379,7 +5477,7 @@ class Video extends Component {
5379
5477
  content: JSON.stringify({
5380
5478
  'typeId': 1223,
5381
5479
  'sessionId': this.state.sessionId,
5382
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
5480
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId11').innerText).uid
5383
5481
  })
5384
5482
  });
5385
5483
  }
@@ -5389,7 +5487,7 @@ class Video extends Component {
5389
5487
  content: JSON.stringify({
5390
5488
  'typeId': 1223,
5391
5489
  'sessionId': this.state.sessionId,
5392
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
5490
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId12').innerText).uid
5393
5491
  })
5394
5492
  });
5395
5493
  }
@@ -5431,8 +5529,43 @@ class Video extends Component {
5431
5529
  handleChangeIdCardNumber = (event) => {
5432
5530
  this.setState({ idCardNumber: event.target.value });
5433
5531
  }
5532
+ dateNewTime=(value)=>{
5533
+ var myDate = new Date();
5534
+ var year = myDate.getFullYear();
5535
+ var month = myDate.getMonth() + 1;
5536
+ var dates = myDate.getDate();
5537
+ var value1 = year + '.' + month + '.' + dates
5538
+ var now = new Date(value1).valueOf();
5539
+ var time = new Date(value).valueOf();
5540
+ console.log(now,time)
5541
+ if(now<time || now == time){
5542
+ return true;
5543
+ }else{
5544
+ return false;
5545
+ }
5546
+ }
5434
5547
  handleChangeCertificateValidity = (event) => {
5435
- this.setState({ certificateValidity: event.target.value });
5548
+ if(this.state.documentType == 'ID_CARD' && event.target.value.split('-').length >1 && event.target.value.split('-')[1].split('.').length >2) {
5549
+ if(this.dateNewTime(event.target.value.split('-')[1])) {
5550
+ this.setState({
5551
+ certificateValidity: event.target.value,
5552
+ certificateValidityType: true
5553
+ });
5554
+
5555
+ } else {
5556
+ this.setState({
5557
+ certificateValidity: event.target.value,
5558
+ certificateValidityType: false
5559
+ });
5560
+ }
5561
+ } else{
5562
+ this.setState({
5563
+ certificateValidity: event.target.value,
5564
+ });
5565
+ }
5566
+
5567
+
5568
+
5436
5569
  }
5437
5570
  componentDidUpdate(prevProps) {
5438
5571
  console.log('componentDidUpdate', prevProps, prevProps.shareMask, this.props.shareMask)
@@ -6260,7 +6393,10 @@ class Video extends Component {
6260
6393
  this.state.disabledIdCard && <Button className="modelButtonFaceOk" danger onClick={(e) => this.updateConfirm('noFace')}>修改</Button>
6261
6394
  }
6262
6395
  {
6263
- this.state.documentType == 'ID_CARD' && <Button className="modelButtonFaceOkColor" danger onClick={(e) => this.confirmCallback('face')}>完成并发起人脸识别</Button>
6396
+ this.state.documentType == 'ID_CARD' && this.state.certificateValidityType && <Button className="modelButtonFaceOkColor" danger onClick={(e) => this.confirmCallback('face')}>完成并发起人脸识别</Button>
6397
+ }
6398
+ {
6399
+ this.state.documentType == 'ID_CARD' && !this.state.certificateValidityType && <Button className="modelButtonFaceOkColorFile" danger >完成并发起人脸识别</Button>
6264
6400
  }
6265
6401
  {
6266
6402
  this.state.documentType != 'ID_CARD' && <Button className="modelButtonOk" type="primary" danger onClick={(e) => this.confirmCallback('noFace')}>完成</Button>
@@ -6303,8 +6439,14 @@ class Video extends Component {
6303
6439
  {
6304
6440
  this.state.cardResuly == 'success' && <div className='successClassFace'>
6305
6441
  <img src={require("../../assets/img/tooltips1_pass.png").default} alt="" ></img>
6306
-
6307
- 识别成功</div>
6442
+ {
6443
+ this.state.cardFailReason && <span>识别成功 -- {this.state.cardFailReason}</span>
6444
+ }
6445
+ {
6446
+ !this.state.cardFailReason && <span>识别成功</span>
6447
+ }
6448
+
6449
+ </div>
6308
6450
  }
6309
6451
  {
6310
6452
  this.state.cardResuly == 'fail' && <div className='errorClassFace'>
@@ -414,6 +414,15 @@
414
414
  background: #DB0011!important;
415
415
  border-spacing: 20px!important;
416
416
  }
417
+ .modelButtonFaceOkColorFile{
418
+ width: 170px!important;
419
+ height: 40px!important;
420
+ font-size: 16px!important;
421
+ color: #5C5C5C!important;
422
+ border: 1px #5C5C5C solid!important;
423
+ background: #d9d9d9!important;
424
+ border-spacing: 20px!important;
425
+ }
417
426
  .endModal{
418
427
  font-size: 16px;
419
428
  padding: 56px 30px 0px 30px;