コード例 #1
0
        public ActionResult <MessageModel <RemitRecordDTO> > ApplyRemitRecord([FromBody] RemitRequest remitRequest, [FromRoute, SwaggerParameter("草稿匯款的id", Required = true)] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            // KYC passed?
            var     userId  = long.Parse(User.FindFirstValue("id"));
            UserArc userArc = userService.GetUserArcById(userId);

            if (!helper.CheckIfKYCPassed(userArc))
            {
                return(BadRequest(new MessageModel <RemitRecordDTO>
                {
                    Status = (int)HttpStatusCode.BadRequest,
                    Success = false,
                    Msg = KYC_NOT_PASSED
                }));
            }

            // get draft remit
            RemitRecord record = remitRecordService.GetRemitRecordById(id);

            if (record == null || record.TransactionStatus != (short)RemitTransactionStatusEnum.Draft)
            {
                return(BadRequest(new MessageModel <RemitRecordDTO>
                {
                    Status = (int)HttpStatusCode.BadRequest,
                    Success = false,
                    Msg = "This Draft Remit doesn't exit or wrong status"
                }));
            }

            string validationResult = helper.ValidateFormalRemitRequestAndUpdateRemitRecord(remitRequest, record, userArc, remitRequest.Country ?? "TW");

            if (validationResult != null)
            {
                return(BadRequest(new MessageModel <RemitRecordDTO>
                {
                    Status = (int)HttpStatusCode.BadRequest,
                    Success = false,
                    Msg = validationResult
                }));
            }

            DateTime       now            = DateTime.UtcNow;
            RemitRecord    modifiedRecord = remitRecordService.ModifyRemitRecord(record, now);
            RemitRecordDTO recordDTO      = _mapper.Map <RemitRecordDTO>(modifiedRecord);

            // 系統掃ARC No.
            BackgroundJob.Enqueue(() => remitRecordService.SystemVerifyArcForRemitProcess(modifiedRecord, userId));

            return(Ok(new MessageModel <RemitRecordDTO>
            {
                Data = recordDTO
            }));
        }
コード例 #2
0
        public MessageModel <string> AmlReview(AmlReviewModifyRequest request)
        {
            RemitRecord record = remitRecordService.GetRemitRecordById(request.RecordId);

            if (request.IsAmlPass)
            {
                amlReviewer.AmlReviewPass(request.RecordId, request.Comment);
                notificationService.SaveAndSendNotification((int)record.UserId, "To be Paid", "Your remit application is waiting for payment", "en-US");
            }
            else
            {
                amlReviewer.AmlReviewFail(request.RecordId, request.Comment);
                notificationService.SaveAndSendNotification((int)record.UserId, "Remit had been rejected", "Your remit application was rejected", "en-US");
            }

            return(new MessageModel <string>()
            {
                Data = "Aml status update"
            });
        }
コード例 #3
0
        public async Task <ActionResult <MessageModel <UploadedFileDTO> > > UploadPicture([FromForm] CommonFileRequest file)
        {
            //Logger.LogInformation(file.ImageType.ToString());
            var     userId   = long.Parse(User.FindFirstValue("id"));
            string  fileName = null;
            UserArc userArc  = userService.GetUserArcById(userId);

            // for member register process
            if (file.ImageType == (byte)PictureTypeEnum.Front || file.ImageType == (byte)PictureTypeEnum.Back)
            {
                if (userArc.KycStatus != (short)KycStatusEnum.DRAFT_MEMBER)
                {
                    return(BadRequest(new MessageModel <UploadedFileDTO>
                    {
                        Status = (int)HttpStatusCode.BadRequest,
                        Success = false,
                        Msg = "Can not upload!"
                    }));
                }

                fileName = await uploadPic.SavePic(userArc, file.ImageType, file.Image);

                // pic for register process

                userService.UpdatePicFileNameOfUserInfo(userArc, (PictureTypeEnum)file.ImageType, fileName);
            }
            // for draft remit apply
            if (file.ImageType == (byte)PictureTypeEnum.Instant || file.ImageType == (byte)PictureTypeEnum.Signature)
            {
                if (userArc.KycStatus != (short)KycStatusEnum.PASSED_KYC_FORMAL_MEMBER)
                {
                    return(BadRequest(new MessageModel <UploadedFileDTO>
                    {
                        Status = (int)HttpStatusCode.BadRequest,
                        Success = false,
                        Msg = "You are not formal member,can not upload!"
                    }));
                }
                // check draft remit record exist
                if (file.DraftRemitRecordId == null)
                {
                    return(BadRequest(new MessageModel <UploadedFileDTO>
                    {
                        Status = (int)HttpStatusCode.BadRequest,
                        Success = false,
                        Msg = "draftRemitRecordId is required!"
                    }));
                }
                RemitRecord draftRemitRecord = remitRecordService.GetRemitRecordById((long)file.DraftRemitRecordId);
                if (draftRemitRecord == null || draftRemitRecord.TransactionStatus != (short)RemitTransactionStatusEnum.Draft)
                {
                    return(BadRequest(new MessageModel <UploadedFileDTO>
                    {
                        Status = (int)HttpStatusCode.BadRequest,
                        Success = false,
                        Msg = "the draft Remit Record does not exist!"
                    }));
                }

                fileName = await uploadPic.SavePic(userArc, file.ImageType, file.Image);

                remitRecordService.UpdatePicFileNameOfDraftRemit(draftRemitRecord, (PictureTypeEnum)file.ImageType, fileName);
            }


            return(Ok(new MessageModel <Object>
            {
                Data = new UploadedFileDTO
                {
                    FileName = fileName
                }
            }));
        }