max 7 månader sedan
förälder
incheckning
c6728af267

+ 2 - 2
src/configuration.ts

@@ -43,11 +43,11 @@ import * as swagger from '@midwayjs/swagger';
     // swagger 文档  http://www.midwayjs.org/docs/extensions/swagger
     {
       component: swagger,
-      enabledEnvironment: ['local']
+      enabledEnvironment: ['local', 'max']
     },
     {
       component: info,
-      enabledEnvironment: ['local'],
+      enabledEnvironment: ['local', 'max'],
     },
   ],
   importConfigs: [join(__dirname, './config')],

+ 2 - 1
src/modules/api/controller/customer.ts

@@ -31,7 +31,8 @@ export class CustomerController extends BaseController {
     errorStatus: 422,
   })
   async createCustomer(@Body() params: CreateCustomerDTO) {
-    return this.ok(await this.businessService.add(params));
+    return this.ok(params);
+    // return this.ok(await this.businessService.add(params));
   }
   /**
    * 获取创建客户必填字段

+ 240 - 18
src/modules/api/dto/customer.ts

@@ -1,23 +1,32 @@
 import { Rule, RuleType } from '@midwayjs/validate';
-import {ApiProperty} from "@midwayjs/swagger";
+import { ApiProperty } from '@midwayjs/swagger';
+import {
+  BusinessType,
+  CertificateType,
+  CompanyCertificateType,
+  CustomerType,
+  IndividualCertificateType,
+  NewCustomerType,
+} from '../../payment/interface/custom';
 
-export class CreateCustomerDTO {
-  @ApiProperty({ example: 'out_user_id', description: '客户端用户ID'})
+export class CompanyDTO {
+  @ApiProperty({ description: '公司名称' })
   @Rule(RuleType.string().required())
-  out_user_id: string;
+  name: string;
 
-  @ApiProperty({ example: 'webhook_url', description: '业务回调URL'})
-  @Rule(RuleType.string().required())
-  webhook_url: string;
-
-  @ApiProperty({ example: 'webhook_url', description: '业务回调URL'})
-  @Rule(RuleType.string().required())
-  customer_type: string;
-
-  @ApiProperty({ example: 1, description: 'The name of the Catage'})
-  age: number;
-
-  @ApiProperty({ example: 'OTHER', description: '类型,可选值如下:\n' +
+  @ApiProperty({
+    enum: [
+      'OTHER',
+      'PUBLIC_LIMITED_COMPANY',
+      'PARTNERSHIP',
+      'CHARITY',
+      'PRIVATE_LIMITED_COMPANY',
+      'JOINT_STOCK_COMPANY',
+      'SOLE_TRADER',
+      'LIMITED_LIABILITY',
+    ],
+    description:
+      '类型,可选值如下:\n' +
       '\n' +
       'OTHER:其他\n' +
       '\n' +
@@ -33,6 +42,219 @@ export class CreateCustomerDTO {
       '\n' +
       'SOLE_TRADER:独资经营企业\n' +
       '\n' +
-      'LIMITED_LIABILITY:有限责任公司'})
-  type: string;
+      'LIMITED_LIABILITY:有限责任公司',
+  })
+  type: BusinessType;
+
+  @ApiProperty({ description: '国家编码' })
+  @Rule(RuleType.string().required())
+  country_code: string;
+
+  @ApiProperty({ description: '城市' })
+  @Rule(RuleType.string().required())
+  city: string;
+
+  @ApiProperty({ description: '地址栏' })
+  @Rule(RuleType.string().required())
+  address_line: string;
+
+  @ApiProperty({ description: '邮政编码' })
+  @Rule(RuleType.string().required())
+  post_code: string;
+
+  @ApiProperty({ description: '邮箱' })
+  @Rule(RuleType.string().required())
+  email: string;
+
+  @ApiProperty({ description: '手机号码' })
+  @Rule(RuleType.string().required())
+  phone_number: string;
+
+  @ApiProperty({ description: '注册号码' })
+  @Rule(RuleType.string().required())
+  registration_number: string;
+
+  @ApiProperty({ description: '联系方式' })
+  @Rule(RuleType.string().required())
+  contact: string;
+
+  @ApiProperty({ description: '注册日期' })
+  @Rule(RuleType.string().required())
+  registration_date: string;
+
+  @ApiProperty({ description: '合伙人文件编号' })
+  @Rule(RuleType.string().required())
+  partners_document_number: string;
+
+  @ApiProperty({
+    enum: ['IDCARD', 'DRIVINGLICENCE', 'PASSPORT'],
+    description:
+      '对应币种所支持的国家证件类型' +
+      '合伙人文档类型,可选值如下:\n' +
+      '\n' +
+      'IDCARD:身份证\n' +
+      '\n' +
+      'DRIVINGLICENCE:驾驶证\n' +
+      '\n' +
+      'PASSPORT:护照',
+  })
+  @Rule(RuleType.string().required())
+  partners_document_type: CertificateType;
+
+  @ApiProperty({ description: '合伙人' })
+  @Rule(RuleType.string().required())
+  partners_kind: string;
+
+  @ApiProperty({ description: '合伙人姓名' })
+  @Rule(RuleType.string().required())
+  partners_name: string;
+
+  @ApiProperty({ description: '合伙人占比' })
+  @Rule(RuleType.string().required())
+  partners_percentage_share: string;
+
+  @ApiProperty({ description: '合伙人国家地址' })
+  @Rule(RuleType.string().required())
+  partners_address_country: string;
+
+  @ApiProperty({ description: '交易地址' })
+  @Rule(RuleType.string().required())
+  trading_address: string;
+
+  @ApiProperty({ description: '交易城市' })
+  @Rule(RuleType.string().required())
+  trading_city: string;
+
+  @ApiProperty({ description: '交易国家' })
+  @Rule(RuleType.string().required())
+  trading_country: string;
+}
+
+export class IndividualDTO {
+  @ApiProperty({ description: '名' })
+  @Rule(RuleType.string().required())
+  first_name: string;
+
+  @ApiProperty({ description: '姓' })
+  @Rule(RuleType.string().required())
+  last_name: string;
+
+  @ApiProperty({ description: '国家编码' })
+  @Rule(RuleType.string().required())
+  country_code: string;
+
+  @ApiProperty({ description: '城市' })
+  @Rule(RuleType.string().required())
+  city: string;
+
+  @ApiProperty({ description: '地址栏' })
+  @Rule(RuleType.string().required())
+  address_line: string;
+
+  @ApiProperty({ description: '邮政编码' })
+  @Rule(RuleType.string().required())
+  post_code: string;
+
+  @ApiProperty({ description: '邮箱' })
+  @Rule(RuleType.string().required())
+  email: string;
+
+  @ApiProperty({ description: '手机号码' })
+  @Rule(RuleType.string().required())
+  phone_number: string;
+
+  @ApiProperty({
+    description:
+      '证件类型,可选值如下:\n' +
+      '\n' +
+      'IDCARD:身份证\n' +
+      '\n' +
+      'DRIVINGLICENCE:驾驶证\n' +
+      '\n' +
+      'PASSPORT:护照\n' +
+      '\n' +
+      'TaxIdentificationNumber:税务识别号\n' +
+      '\n' +
+      'IdentificationCodeForWorkers:劳务识别码\n' +
+      '\n' +
+      'PersonalIdentificationCode:身份识别编号\n' +
+      '\n' +
+      'ForeignersIDCard:外国人身份证\n' +
+      '\n' +
+      'SpecialPermitOfStay:特殊的临时居留许可',
+    enum: [
+      'IDCARD',
+      'DRIVINGLICENCE',
+      'PASSPORT',
+      'TaxIdentificationNumber',
+      'IdentificationCodeForWorkers',
+      'PersonalIdentificationCode',
+      'ForeignersIDCard',
+      'SpecialPermitOfStay',
+    ],
+  })
+  @Rule(
+    RuleType.string()
+      .valid(...Object.values(IndividualCertificateType))
+      .required()
+  )
+  certificate_type: CertificateType;
+
+  @ApiProperty({ description: '证件号码' })
+  @Rule(RuleType.string().required())
+  id_number: string;
+
+  @ApiProperty({ description: '出生日期' })
+  @Rule(RuleType.string().required())
+  birth_date: string;
+
+  @ApiProperty({ description: '有效期开始时间' })
+  @Rule(RuleType.string().required())
+  valid_time_start: string;
+
+  @ApiProperty({ description: '有效期结束时间' })
+  @Rule(RuleType.string().required())
+  valid_time_end: string;
+}
+
+export class CreateCustomerDTO {
+  @ApiProperty({ example: 'out_user_id', description: '客户端用户ID' })
+  @Rule(RuleType.string().required())
+  out_user_id: string;
+
+  @ApiProperty({ description: '业务回调URL' })
+  @Rule(RuleType.string().required())
+  webhook_url: string;
+
+  @ApiProperty({ description: '客户类型:公司、个人' })
+  @Rule(RuleType.string().required())
+  customer_type: string;
+
+  @ApiProperty({
+    enum: ['COMPANY', 'INDIVIDUAL'],
+    description:
+      '客户类型,可选值:\n' +
+      '\n' +
+      'COMPANY:公司\n' +
+      '\n' +
+      'INDIVIDUAL:个人',
+  })
+  @Rule(
+    RuleType.string()
+      .valid(...Object.values(NewCustomerType))
+      .required()
+  )
+  type: NewCustomerType;
+
+  @ApiProperty({
+    description: '公司',
+    type: CompanyDTO,
+  })
+  company: CompanyDTO;
+
+  @ApiProperty({
+    description: '个人',
+    type: IndividualDTO,
+  })
+  individual: IndividualDTO;
 }

+ 26 - 1
src/modules/payment/interface/custom.ts

@@ -3,7 +3,32 @@ export enum CustomerType {
   BUSINESS = 'BUSINESS', // 企业
 }
 
-export enum CertificateType {
+
+export enum NewCustomerType {
+  INDIVIDUAL = 'INDIVIDUAL', // 个人
+  COMPANY = 'COMPANY', // 企业
+}
+
+// 公司信息的枚举数据
+export enum CompanyCertificateType {
+  IDCARD = 'IDCARD', // 身份证
+  DRIVINGLICENCE = 'DRIVINGLICENCE', // 驾驶证
+  PASSPORT = 'PASSPORT', // 护照
+}
+
+// 个人信息的枚举数据
+export enum IndividualCertificateType {
+  IDCARD = 'IDCARD', // 身份证
+  DRIVINGLICENCE = 'DRIVINGLICENCE', // 驾驶证
+  PASSPORT = 'PASSPORT', // 护照
+  TAXIDENTIFICATIONNUMBER = 'TAXIDENTIFICATIONNUMBER', // 税务识别号
+  IDENTIFICATIONCODEFORWORKERS = 'IDENTIFICATIONCODEFORWORKERS', // 劳务识别码
+  PERSONALIDENTIFICATIONCODE = 'PERSONALIDENTIFICATIONCODE', // 身份识别编号
+  FOREIGNERSIDCARD = 'FOREIGNERSIDCARD', // 外国人身份证
+  SPECIALPERMITOFSTAY = 'SPECIALPERMITOFSTAY', // 特殊的临时居留许可
+}
+
+export enum CertificateType  {
   IDCARD = 'IDCARD', // 身份证
   DRIVINGLICENCE = 'DRIVINGLICENCE', // 驾驶证
   PASSPORT = 'PASSPORT', // 护照