react_hsbc_teller 1.9.5 → 1.9.6

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.6",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -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.6&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) {
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 () => {
@@ -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.6')
3838
3882
  if (this.props.sessionId) {
3839
3883
  this.getRoomStatus({
3840
3884
  sessionId: this.props.sessionId
@@ -4293,20 +4337,67 @@ 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
+ this.setState({
4342
+ idCardNumber: result.data.idCardNumber,
4343
+ idCardName: result.data.idCardName,
4344
+ loadingFace: false,
4345
+ cardFailReason: '',
4346
+ cardResuly: 'success',
4347
+ })
4348
+ } else {
4349
+ this.setState({
4350
+ // isModalVisibleFacial: false
4351
+ idCardNumber: result.data.idCardNumber,
4352
+ idCardName: result.data.idCardName
4353
+ })
4354
+ this.ocrCallback(2)
4355
+ }
4302
4356
  } else if (result.data.side == 'back') {
4303
4357
  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
- })
4358
+ if(this.state.idCardName && this.dateNewTime(result.data.endDate.split('-')[1])) {
4359
+ this.setState({
4360
+ certificateValidity: result.data.startDate + '-' + result.data.endDate,
4361
+ loadingFace: false,
4362
+ cardFailReason: '',
4363
+ cardResuly: 'success',
4364
+ certificateValidityType: true,
4365
+ })
4366
+ } else if(this.state.idCardName && !this.dateNewTime(result.data.endDate.split('-')[1])) {
4367
+ this.setState({
4368
+ certificateValidity: result.data.startDate + '-' + result.data.endDate,
4369
+ loadingFace: false,
4370
+ certificateValidityType: false,
4371
+ cardFailReason: '证件不在有效期内',
4372
+ cardResuly: 'fail',
4373
+ })
4374
+ } else if(!this.state.idCardName && this.dateNewTime(result.data.endDate.split('-')[1])) {
4375
+ this.setState({
4376
+ certificateValidity: result.data.startDate + '-' + result.data.endDate,
4377
+ })
4378
+ this.ocrCallback(2)
4379
+ } else if(!this.state.idCardName && !this.dateNewTime(result.data.endDate.split('-')[1])) {
4380
+ this.setState({
4381
+ certificateValidity: result.data.startDate + '-' + result.data.endDate,
4382
+ loadingFace: false,
4383
+ certificateValidityType: false,
4384
+ cardFailReason: '证件不在有效期内',
4385
+ cardResuly: 'fail',
4386
+ })
4387
+ }
4388
+ // if(this.state.idCardName) {
4389
+ // this.setState({
4390
+ // certificateValidity: result.data.startDate + '-' + result.data.endDate,
4391
+ // loadingFace: false,
4392
+ // cardFailReason: '',
4393
+ // cardResuly: 'success',
4394
+ // })
4395
+ // } else {
4396
+ // this.setState({
4397
+ // certificateValidity: result.data.startDate + '-' + result.data.endDate,
4398
+ // })
4399
+ // this.ocrCallback(2)
4400
+ // }
4310
4401
  }
4311
4402
  }
4312
4403
  if(this.state.documentType == 'HK_MO_RESIDENCE_CARD' || this.state.documentType == 'TW_RESIDENCE_CARD') {
@@ -4352,17 +4443,19 @@ class Video extends Component {
4352
4443
  } else {
4353
4444
  this.setState({
4354
4445
  loadingFace: false,
4355
- cardFailReason: result.message,
4446
+ // cardFailReason: result.message,
4356
4447
  cardResuly: 'fail',
4357
4448
  })
4358
- this.messageClick('识别失败', 'error')
4449
+ // this.messageClick('识别失败', 'error')
4450
+ this.errorCodeClick('ocr',result.code)
4359
4451
  }
4360
4452
  } catch (err) {
4361
4453
  this.setState({
4362
4454
  loadingFace: false,
4363
- cardFailReason: err.response.message,
4455
+ // cardFailReason: err.response.message,
4364
4456
  cardResuly: 'fail',
4365
4457
  })
4458
+ this.errorCodeClick('ocr',err.response.code)
4366
4459
 
4367
4460
  // this.messageClick('识别失败', 'error')
4368
4461
  }
@@ -4622,6 +4715,7 @@ class Video extends Component {
4622
4715
  idCardName: '',
4623
4716
  cardFailReason: '',
4624
4717
  cardResuly: '',
4718
+ certificateValidityType: true
4625
4719
  }, () => {
4626
4720
 
4627
4721
 
@@ -5431,8 +5525,43 @@ class Video extends Component {
5431
5525
  handleChangeIdCardNumber = (event) => {
5432
5526
  this.setState({ idCardNumber: event.target.value });
5433
5527
  }
5528
+ dateNewTime=(value)=>{
5529
+ var myDate = new Date();
5530
+ var year = myDate.getFullYear();
5531
+ var month = myDate.getMonth() + 1;
5532
+ var dates = myDate.getDate();
5533
+ var value1 = year + '.' + month + '.' + dates
5534
+ var now = new Date(value1).valueOf();
5535
+ var time = new Date(value).valueOf();
5536
+ console.log(now,time)
5537
+ if(now<time || now == time){
5538
+ return true;
5539
+ }else{
5540
+ return false;
5541
+ }
5542
+ }
5434
5543
  handleChangeCertificateValidity = (event) => {
5435
- this.setState({ certificateValidity: event.target.value });
5544
+ if(this.state.documentType == 'ID_CARD' && event.target.value.split('-').length >1 && event.target.value.split('-')[1].split('.').length >2) {
5545
+ if(this.dateNewTime(event.target.value.split('-')[1])) {
5546
+ this.setState({
5547
+ certificateValidity: event.target.value,
5548
+ certificateValidityType: true
5549
+ });
5550
+
5551
+ } else {
5552
+ this.setState({
5553
+ certificateValidity: event.target.value,
5554
+ certificateValidityType: false
5555
+ });
5556
+ }
5557
+ } else{
5558
+ this.setState({
5559
+ certificateValidity: event.target.value,
5560
+ });
5561
+ }
5562
+
5563
+
5564
+
5436
5565
  }
5437
5566
  componentDidUpdate(prevProps) {
5438
5567
  console.log('componentDidUpdate', prevProps, prevProps.shareMask, this.props.shareMask)
@@ -6260,7 +6389,10 @@ class Video extends Component {
6260
6389
  this.state.disabledIdCard && <Button className="modelButtonFaceOk" danger onClick={(e) => this.updateConfirm('noFace')}>修改</Button>
6261
6390
  }
6262
6391
  {
6263
- this.state.documentType == 'ID_CARD' && <Button className="modelButtonFaceOkColor" danger onClick={(e) => this.confirmCallback('face')}>完成并发起人脸识别</Button>
6392
+ this.state.documentType == 'ID_CARD' && this.state.certificateValidityType && <Button className="modelButtonFaceOkColor" danger onClick={(e) => this.confirmCallback('face')}>完成并发起人脸识别</Button>
6393
+ }
6394
+ {
6395
+ this.state.documentType == 'ID_CARD' && !this.state.certificateValidityType && <Button className="modelButtonFaceOkColorFile" danger >完成并发起人脸识别</Button>
6264
6396
  }
6265
6397
  {
6266
6398
  this.state.documentType != 'ID_CARD' && <Button className="modelButtonOk" type="primary" danger onClick={(e) => this.confirmCallback('noFace')}>完成</Button>
@@ -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;