From 4c9bc937acfddd42fecdb76d233aa432a7869190 Mon Sep 17 00:00:00 2001 From: Cronus <105345303+ice-cronus@users.noreply.github.com> Date: Thu, 27 Jun 2024 00:41:29 +0700 Subject: [PATCH] fix set kyc passed if social was skipped (3/4 not assigned) (#166) --- kyc/face/internal/threedivi/threedivi.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kyc/face/internal/threedivi/threedivi.go b/kyc/face/internal/threedivi/threedivi.go index 9ad75f65..bf5030bd 100644 --- a/kyc/face/internal/threedivi/threedivi.go +++ b/kyc/face/internal/threedivi/threedivi.go @@ -198,15 +198,20 @@ func (t *threeDivi) Reset(ctx context.Context, user *users.User, fetchState bool } } -//nolint:funlen //. +//nolint:funlen,gocognit,gocyclo,revive,cyclop //. func (*threeDivi) parseApplicant(user *users.User, bafApplicant *applicant) *users.User { updUser := new(users.User) updUser.ID = user.ID + //nolint:nestif // . if bafApplicant != nil && bafApplicant.LastValidationResponse != nil && bafApplicant.Status == statusPassed { passedTime := time.New(bafApplicant.LastValidationResponse.CreatedAt) if user.KYCStepsCreatedAt != nil && len(*user.KYCStepsCreatedAt) >= int(users.LivenessDetectionKYCStep) { updUser.KYCStepsCreatedAt = user.KYCStepsCreatedAt updUser.KYCStepsLastUpdatedAt = user.KYCStepsLastUpdatedAt + if user.KYCStepPassed == nil || *user.KYCStepPassed == 0 { + stepPassed := users.LivenessDetectionKYCStep + updUser.KYCStepPassed = &stepPassed + } (*updUser.KYCStepsCreatedAt)[stepIdx(users.FacialRecognitionKYCStep)] = passedTime (*updUser.KYCStepsCreatedAt)[stepIdx(users.LivenessDetectionKYCStep)] = passedTime (*updUser.KYCStepsLastUpdatedAt)[stepIdx(users.FacialRecognitionKYCStep)] = passedTime