app-cloudep-product-service/internal/logic/kyc_service/create_logic.go

56 lines
1.5 KiB
Go
Raw Normal View History

2025-04-09 14:46:53 +00:00
package kycservicelogic
2025-04-08 09:20:34 +00:00
import (
2025-04-10 07:59:30 +00:00
"context"
2025-04-08 09:20:34 +00:00
"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/entity"
"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/kyc"
2025-04-09 14:46:53 +00:00
"code.30cm.net/digimon/app-cloudep-product-service/gen_result/pb/product"
"code.30cm.net/digimon/app-cloudep-product-service/internal/svc"
2025-04-08 09:20:34 +00:00
"github.com/zeromicro/go-zero/core/logx"
)
2025-04-09 14:46:53 +00:00
type CreateLogic struct {
2025-04-08 09:20:34 +00:00
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
2025-04-09 14:46:53 +00:00
func NewCreateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateLogic {
return &CreateLogic{
2025-04-08 09:20:34 +00:00
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
2025-04-09 14:46:53 +00:00
// Create 建立 KYC 資料
func (l *CreateLogic) Create(in *product.CreateKycReq) (*product.OKResp, error) {
2025-04-08 09:20:34 +00:00
err := l.svcCtx.KYCUseCase.Create(l.ctx, &entity.KYC{
UID: in.GetUid(),
CountryRegion: in.GetCountryRegion(),
Name: in.GetName(),
Identification: in.GetIdentification(),
IdentificationType: in.GetIdentificationType(),
Address: in.GetAddress(),
PostalCode: in.GetPostalCode(),
IDFrontImage: in.GetIdFrontImage(),
IDBackImage: in.GetIdBackImage(),
BankStatementImg: in.GetBankStatementImg(),
BankCode: in.GetBankCode(),
BankName: in.GetName(),
BranchCode: in.GetBranchCode(),
BranchName: in.GetBranchName(),
BankAccount: in.GetBankAccount(),
Status: kyc.StatusPending,
RejectReason: "",
})
if err != nil {
return nil, err
}
return &product.OKResp{}, nil
}