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

56 lines
1.5 KiB
Go

package kycservicelogic
import (
"context"
"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/entity"
"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/kyc"
"code.30cm.net/digimon/app-cloudep-product-service/gen_result/pb/product"
"code.30cm.net/digimon/app-cloudep-product-service/internal/svc"
"github.com/zeromicro/go-zero/core/logx"
)
type CreateLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewCreateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateLogic {
return &CreateLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// Create 建立 KYC 資料
func (l *CreateLogic) Create(in *product.CreateKycReq) (*product.OKResp, error) {
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
}