channel.adapter.ts 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. export interface CustomerInfo {
  2. // 必填字段
  3. type: 'PERSONAL' | 'BUSINESS';
  4. country: string;
  5. email: string;
  6. // 个人用户必填字段
  7. company: BusinessInfo;
  8. individual: IndividualInfo;
  9. }
  10. export interface IndividualInfo {
  11. firstName: string; // 名(必填)
  12. lastName: string; // 姓(必填)
  13. countryCode: string; // 国家编码(必填)
  14. city: string; // 城市(必填)
  15. addressLine: string; // 地址栏(必填)
  16. postCode: string; // 邮政编码(必填)
  17. email: string; // 邮箱(必填)
  18. phoneNumber: string; // 手机号码(必填)
  19. certificateType: CertificateType; // 证件类型(必填)
  20. idNumber: string; // 证件号码(必填)
  21. birthDate: string; // 出生日期(必填)
  22. validTimeStart: string; // 有效期开始时间(必填)
  23. validTimeEnd: string; // 有效期结束时间(必填)
  24. }
  25. export interface BusinessInfo {
  26. name: string; // 公司名称(必填)
  27. type: BusinessType; // 公司类型(必填)
  28. countryCode: string; // 国家编码(必填)
  29. city: string; // 城市(必填)
  30. addressLine: string; // 地址栏(必填)
  31. postCode: string; // 邮政编码(必填)
  32. email: string; // 邮箱(必填)
  33. phoneNumber: string; // 手机号码(必填)
  34. registrationNumber: string; // 注册号码(必填)
  35. contact: string; // 联系方式(必填)
  36. registrationDate: string; // 注册日期(必填)
  37. }
  38. export enum BusinessType {
  39. OTHER = 'OTHER', // 其他
  40. PUBLIC_LIMITED_COMPANY = 'PUBLIC_LIMITED_COMPANY', // 公共有限公司
  41. PARTNERSHIP = 'PARTNERSHIP', // 合伙企业
  42. CHARITY = 'CHARITY', // 慈善机构
  43. PRIVATE_LIMITED_COMPANY = 'PRIVATE_LIMITED_COMPANY', // 私营有限公司
  44. JOINT_STOCK_COMPANY = 'JOINT_STOCK_COMPANY', // 股份公司
  45. LIMITED_LIABILITY = 'LIMITED_LIABILITY', // 有限责任公司
  46. SOLE_TRADER = 'SOLE_TRADER', // 独资经营企业
  47. }
  48. export enum CertificateType {
  49. IDCARD = 'IDCARD', // 身份证
  50. DRIVINGLICENCE = 'DRIVINGLICENCE', // 驾驶证
  51. PASSPORT = 'PASSPORT', // 护照
  52. TAX_IDENTIFICATION_NUMBER = 'TaxIdentificationNumber', // 税务识别号
  53. IDENTIFICATION_CODE_FOR_WORKERS = 'IdentificationCodeForWorkers', // 劳务识别码
  54. PERSONAL_IDENTIFICATION_CODE = 'PersonalIdentificationCode', // 身份识别编号
  55. FOREIGNERS_ID_CARD = 'ForeignersIDCard', // 外国人身份证
  56. SPECIAL_PERMIT_OF_STAY = 'SpecialPermitOfStay', // 特殊的临时居留许可
  57. }
  58. export interface CreateUserParams {
  59. userId: string;
  60. userType: 'PERSONAL' | 'BUSINESS';
  61. userInfo: CustomerInfo;
  62. }
  63. export interface ChannelAdapter {
  64. // 创建渠道用户
  65. createUser(params: CreateUserParams): Promise<string>;
  66. // 创建钱包
  67. createWallet(params: any): Promise<string>;
  68. // 获取钱包
  69. getWallet(params: any): Promise<any>;
  70. // 获取关联银行账户
  71. associateBankAccountRequiredFieldsAsync(params: any): Promise<any>;
  72. // 关联银行账户
  73. associateBankAccount(params: any): Promise<any>;
  74. // 获取钱包余额
  75. getWalletBalance(params: any): Promise<string>;
  76. // 充值
  77. deposit(walletId: string, amount: number, currency: string): Promise<string>;
  78. // 提现
  79. withdraw(walletId: string, amount: number, currency: string): Promise<string>;
  80. // 转账
  81. transfer(
  82. fromWalletId: string,
  83. toWalletId: string,
  84. amount: number,
  85. currency: string
  86. ): Promise<string>;
  87. // 兑换
  88. exchange(
  89. fromWalletId: string,
  90. fromCurrency: string,
  91. toWalletId: string,
  92. toCurrency: string,
  93. amount: number
  94. ): Promise<string>;
  95. // 获取余额
  96. getBalance(walletId: string): Promise<number>;
  97. // 获取银行列表
  98. getBanks(params: any): Promise<any>;
  99. // 获取银行
  100. getBank(params: any): Promise<any>;
  101. // 设置客户信息
  102. setCustomerInfo(params: any): Promise<any>;
  103. // 创建收款人
  104. createBeneficiary(params: any): Promise<any>;
  105. // 更新收款人
  106. updateBeneficiary(params: any): Promise<any>;
  107. // 删除收款人
  108. deleteBeneficiary(params: any): Promise<any>;
  109. // 创建收款人地址
  110. createBeneficiaryAddress(params: any): Promise<any>;
  111. // 更新收款人地址
  112. updateBeneficiaryAddress(params: any): Promise<any>;
  113. // 删除收款人地址
  114. deleteBeneficiaryAddress(params: any): Promise<any>;
  115. // 法币入金
  116. payIn(params: any): Promise<any>;
  117. // 法币入金订单查询
  118. payInOrder(params: any): Promise<any>;
  119. // 法币入金订单取消
  120. payInOrderCancel(params: any): Promise<any>;
  121. // 法币出金
  122. payOut(params: any): Promise<any>;
  123. // 法币出金订单查询
  124. payOutOrder(params: any): Promise<any>;
  125. // 确认出金
  126. confirmPayOut(orderNo: string): Promise<any>;
  127. // 取消出金
  128. cancelPayOut(orderNo: string): Promise<any>;
  129. // 数字货币入金
  130. payInByChain(params: any): Promise<any>;
  131. // 数字货币出金
  132. payOutByChain(params: any): Promise<any>;
  133. // 生成签名
  134. generateSignature(
  135. timestamp: string,
  136. nonce: string,
  137. body: string,
  138. secret: string
  139. ): string;
  140. }