open.ts 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327
  1. import {
  2. All,
  3. ALL,
  4. Body,
  5. Del,
  6. Get,
  7. Inject,
  8. Param,
  9. Post,
  10. Provide,
  11. Put,
  12. Query,
  13. } from '@midwayjs/decorator';
  14. import { BaseController, CoolController } from '@cool-midway/core';
  15. import { Context } from 'vm';
  16. import { IndividualEntity } from '../../payment/entity/individual';
  17. import { EasyPayAdapter } from '../../payment/adapter/easypay.adapter';
  18. import { EasyOpenService } from '../service/open';
  19. import { OrderType } from '../entity/open_payment_order';
  20. import {Fields, Files} from "@midwayjs/core";
  21. // import { FileItem } from '@midwayjs/upload';
  22. /**
  23. * 客户管理
  24. */
  25. @Provide()
  26. @CoolController('/api/open')
  27. export class OpenApiController extends BaseController {
  28. @Inject()
  29. ctx: Context; // Inject the context
  30. @Inject()
  31. easyPayAdapter: EasyPayAdapter;
  32. @Inject()
  33. easyOpenService: EasyOpenService;
  34. /**
  35. * 生成sign
  36. */
  37. @Post('/sign', { summary: '创建sign' })
  38. async createSign(@Body(ALL) userBody: any) {
  39. const { params, timestamp, nonce, secret } = userBody;
  40. return this.easyOpenService.createSign(params, timestamp, nonce, secret);
  41. }
  42. /**
  43. * 创建账户
  44. */
  45. @Post('/v3/accounts', { summary: '创建账户' })
  46. async createPayInOrder(@Body(ALL) params: any) {
  47. const method = this.ctx.method;
  48. const path = this.ctx.path;
  49. const res = await this.easyPayAdapter.request(method, path, params);
  50. this.easyOpenService.save_user(res, params);
  51. return res;
  52. }
  53. /**
  54. * 查询账户列表
  55. */
  56. @Get('/v3/accounts', { summary: '查询账户列表' })
  57. async getAccounts(@Query(ALL) params: any) {
  58. const method = this.ctx.method;
  59. const path = this.ctx.path;
  60. return await this.easyPayAdapter.request(method, path, params);
  61. }
  62. /**
  63. * 查询账户
  64. */
  65. @Get('/v3/accounts/:id', { summary: '查询账户' })
  66. async getAccountsInfo(@Param('id') id: any) {
  67. const method = this.ctx.method;
  68. const path = this.ctx.path;
  69. return await this.easyPayAdapter.request(
  70. method,
  71. `${path}`.replace(':id', id),
  72. {}
  73. );
  74. }
  75. /**
  76. * 修改账户实名
  77. */
  78. @Put('/v3/accounts/:id', { summary: '修改账户实名' })
  79. async putAccountsInfo(@Param('id') id: any, @Body() params: any) {
  80. const method = this.ctx.method;
  81. const path = this.ctx.path;
  82. return await this.easyPayAdapter.request(
  83. method,
  84. `${path}`.replace(':id', id),
  85. params
  86. );
  87. }
  88. /**
  89. * 查询余额
  90. */
  91. @Get('/v3/accounts/:account_id/balances', { summary: '查询余额' })
  92. async getAccountsBalances(
  93. @Param('account_id') account_id: any,
  94. @Body() params: any
  95. ) {
  96. const method = this.ctx.method;
  97. const path = this.ctx.path;
  98. return await this.easyPayAdapter.request(
  99. method,
  100. `${path}`.replace(':account_id', account_id),
  101. params
  102. );
  103. }
  104. /**
  105. * 申请收款账户
  106. */
  107. @Post('/v3/applications', { summary: '申请收款账户' })
  108. async applications(@Body() params: any) {
  109. const method = this.ctx.method;
  110. const path = this.ctx.path;
  111. const res = await this.easyPayAdapter.request(method, path, params);
  112. this.easyOpenService.save_user_account(res, params);
  113. return res;
  114. }
  115. /**
  116. * 查询申请列表
  117. */
  118. @Get('/v3/applications', { summary: '查询申请列表' })
  119. async getApplications(@Query() params: any) {
  120. const method = this.ctx.method;
  121. const path = this.ctx.path;
  122. return await this.easyPayAdapter.request(method, path, params);
  123. }
  124. /**
  125. * 查询申请
  126. */
  127. @Get('/v3/applications/:id', { summary: '查询申请' })
  128. async getApplicationsInfo(@Param('id') id: string) {
  129. const method = this.ctx.method;
  130. const path = this.ctx.path;
  131. return await this.easyPayAdapter.request(method, path, {});
  132. }
  133. /**
  134. * 查询收款账户列表
  135. */
  136. @Get('/v1/bank_accounts', { summary: '查询收款账户列表' })
  137. async getBank_accounts(@Query() params: any) {
  138. // Access the request method and path
  139. const method = this.ctx.method;
  140. const path = this.ctx.path;
  141. return await this.easyPayAdapter.request(method, path, params);
  142. }
  143. /**
  144. * 查询收款账户
  145. */
  146. @Get('/v1/bank_accounts/:id', { summary: '查询收款账户' })
  147. async getBank_accountsInfo(@Param('id') id: any) {
  148. const method = this.ctx.method;
  149. const path = this.ctx.path;
  150. return await this.easyPayAdapter.request(method, path, {});
  151. }
  152. /**
  153. * 创建支付订单
  154. */
  155. @Post('/v3/acquiring/payments', { summary: '创建支付订单' })
  156. async CreatedAcquiringPayments(@Body() params: any) {
  157. const method = this.ctx.method;
  158. const path = this.ctx.path;
  159. const res = await this.easyPayAdapter.request(method, path, params);
  160. // this.easyOpenService.save_user_order(res, params, OrderType.ACQUIRING_PAYMENT);
  161. return res;
  162. }
  163. /**
  164. * 查询支付单
  165. */
  166. @Get('/v3/acquiring/payments/:id', { summary: '查询支付单' })
  167. async getAcquiringPaymentsInfo(@Param('id') id: any) {
  168. // Access the request method and path
  169. const method = this.ctx.method;
  170. const path = this.ctx.path;
  171. console.log('Request Method:', method);
  172. console.log('Request Path:', path);
  173. // console.log(typeof params)
  174. // return `${method}, ${path}, ${params}`
  175. return await this.easyPayAdapter.request(method, path, {});
  176. }
  177. /**
  178. * 取消支付单
  179. */
  180. @Post('/v3/acquiring/payments/:id/cancel', { summary: '取消支付单' })
  181. async cancelAcquiringPayments(@Param('id') id: any) {
  182. // Access the request method and path
  183. const method = this.ctx.method;
  184. const path = this.ctx.path;
  185. console.log('Request Method:', method);
  186. console.log('Request Path:', path);
  187. // console.log(typeof params)
  188. // return `${method}, ${path}, ${params}`
  189. return await this.easyPayAdapter.request(method, path, {});
  190. }
  191. /**
  192. * 查询支付单列表
  193. */
  194. @Get('/v3/acquiring/payments', { summary: '查询支付单列表' })
  195. async getAcquiringPayments(@Query() params: any) {
  196. // Access the request method and path
  197. const method = this.ctx.method;
  198. const path = this.ctx.path;
  199. console.log('Request Method:', method);
  200. console.log('Request Path:', path);
  201. console.log('Request params:', params);
  202. // console.log(typeof params)
  203. // return `${method}, ${path}, ${params}`
  204. return await this.easyPayAdapter.request(method, path, params);
  205. }
  206. /**
  207. * 退款
  208. */
  209. @Post('/v3/acquiring/refunds', { summary: '退款' })
  210. async acquiringRefunds(@Body() params: any) {
  211. // Access the request method and path
  212. const method = this.ctx.method;
  213. const path = this.ctx.path;
  214. console.log('Request Method:', method);
  215. console.log('Request Path:', path);
  216. console.log('Request params:', params);
  217. // console.log(typeof params)
  218. // return `${method}, ${path}, ${params}`
  219. const res = await this.easyPayAdapter.request(method, path, params);
  220. // this.easyOpenService.save_user_order(res, params, OrderType.ACQUIRING_REFUND);
  221. return res;
  222. }
  223. /**
  224. * 查询退款
  225. */
  226. @Get('/v3/acquiring/refunds/:id', { summary: '查询退款' })
  227. async acquiringRefundsInfo(@Param('id') id: any) {
  228. // Access the request method and path
  229. const method = this.ctx.method;
  230. const path = this.ctx.path;
  231. console.log('Request Method:', method);
  232. console.log('Request Path:', path);
  233. // console.log(typeof params)
  234. // return `${method}, ${path}, ${params}`
  235. return await this.easyPayAdapter.request(method, path, {});
  236. }
  237. /**
  238. * 查询退款单列表
  239. */
  240. @Get('/v3/acquiring/refunds', { summary: '查询退款单列表' })
  241. async acquiringRefundsList(@Query() params: any) {
  242. // Access the request method and path
  243. const method = this.ctx.method;
  244. const path = this.ctx.path;
  245. console.log('Request Method:', method);
  246. console.log('Request Path:', path);
  247. // console.log(typeof params)
  248. // return `${method}, ${path}, ${params}`
  249. return await this.easyPayAdapter.request(method, path, params);
  250. }
  251. /**
  252. * 查询对账单列表
  253. */
  254. @Get('/v3/acquiring/statements', { summary: '查询对账单列表' })
  255. async acquiringStatements(@Query() params: any) {
  256. // Access the request method and path
  257. const method = this.ctx.method;
  258. const path = this.ctx.path;
  259. console.log('Request Method:', method);
  260. console.log('Request Path:', path);
  261. // console.log(typeof params)
  262. // return `${method}, ${path}, ${params}`
  263. return await this.easyPayAdapter.request(method, path, params);
  264. }
  265. /**
  266. * 查询结算单列表
  267. */
  268. @Get('/v3/acquiring/settlements', { summary: '查询结算单列表' })
  269. async acquiringSettlements(@Query() params: any) {
  270. // Access the request method and path
  271. const method = this.ctx.method;
  272. const path = this.ctx.path;
  273. console.log('Request Method:', method);
  274. console.log('Request Path:', path);
  275. // console.log(typeof params)
  276. // return `${method}, ${path}, ${params}`
  277. return await this.easyPayAdapter.request(method, path, params);
  278. }
  279. /**
  280. * 查询结算单列表
  281. */
  282. @Get('/v3/acquiring/settlements/:id', { summary: '查询结算单列表' })
  283. async acquiringSettlementsInfo(@Param('id') id: any) {
  284. // Access the request method and path
  285. const method = this.ctx.method;
  286. const path = this.ctx.path;
  287. console.log('Request Method:', method);
  288. console.log('Request Path:', path);
  289. // console.log(typeof params)
  290. // return `${method}, ${path}, ${params}`
  291. return await this.easyPayAdapter.request(method, path, {});
  292. }
  293. /**
  294. * 查询渠道汇率
  295. */
  296. @Get('/v3/acquiring/exchange_rates', { summary: '查询渠道汇率' })
  297. async acquiringExchange_rates(@Query() params: any) {
  298. // Access the request method and path
  299. const method = this.ctx.method;
  300. const path = this.ctx.path;
  301. console.log('Request Method:', method);
  302. console.log('Request Path:', path);
  303. // console.log(typeof params)
  304. // return `${method}, ${path}, ${params}`
  305. return await this.easyPayAdapter.request(method, path, params);
  306. }
  307. /**
  308. * 查询入账列表
  309. */
  310. @Get('/v1/deposits', { summary: '查询入账列表' })
  311. async depositsList(@Query() params: any) {
  312. // Access the request method and path
  313. const method = this.ctx.method;
  314. const path = this.ctx.path;
  315. console.log('Request Method:', method);
  316. console.log('Request Path:', path);
  317. console.log('Request params:', params);
  318. // console.log(typeof params)
  319. // return `${method}, ${path}, ${params}`
  320. return await this.easyPayAdapter.request(method, path, params);
  321. }
  322. /**
  323. * 查询入账
  324. */
  325. @Get('/v1/deposits/:id', { summary: '查询入账' })
  326. async depositsInfo(@Param('id') id: any) {
  327. // Access the request method and path
  328. const method = this.ctx.method;
  329. const path = this.ctx.path;
  330. console.log('Request Method:', method);
  331. console.log('Request Path:', path);
  332. // console.log(typeof params)
  333. // return `${method}, ${path}, ${params}`
  334. return await this.easyPayAdapter.request(method, path, {});
  335. }
  336. /**
  337. * 入账凭证下载
  338. */
  339. @Get('/v1/deposits/:id/proof', { summary: '入账凭证下载' })
  340. async depositsProofInfo(@Param('id') id: any, @Query() params: any) {
  341. // Access the request method and path
  342. const method = this.ctx.method;
  343. const path = this.ctx.path;
  344. console.log('Request Method:', method);
  345. console.log('Request Path:', path);
  346. // console.log(typeof params)
  347. // return `${method}, ${path}, ${params}`
  348. return await this.easyPayAdapter.request(method, path, params);
  349. }
  350. /**
  351. * 查询汇率
  352. */
  353. @Get('/v1/exchange_rates', { summary: '入账凭证下载' })
  354. async exchange_ratesInfo(@Query() params: any) {
  355. // Access the request method and path
  356. const method = this.ctx.method;
  357. const path = this.ctx.path;
  358. console.log('Request Method:', method);
  359. console.log('Request Path:', path);
  360. // console.log(typeof params)
  361. // return `${method}, ${path}, ${params}`
  362. return await this.easyPayAdapter.request(method, path, params);
  363. }
  364. /**
  365. * 创建换汇订单
  366. */
  367. @Post('/v1/exchanges', { summary: '创建换汇订单' })
  368. async createdExchanges(@Body() params: any) {
  369. // Access the request method and path
  370. const method = this.ctx.method;
  371. const path = this.ctx.path;
  372. // console.log(typeof params)
  373. // return `${method}, ${path}, ${params}`
  374. const res = await this.easyPayAdapter.request(method, path, params);
  375. console.log('Request Method:', method);
  376. console.log('Request Path:', path);
  377. // this.easyOpenService.save_user_order(res, params, OrderType.CURRENCY_EXCHANGE);
  378. return res;
  379. }
  380. /**
  381. * 查询换汇订单列表
  382. */
  383. @Get('/v1/exchanges', { summary: '查询换汇订单列表' })
  384. async exchangesList(@Query() params: any) {
  385. // Access the request method and path
  386. const method = this.ctx.method;
  387. const path = this.ctx.path;
  388. console.log('Request Method:', method);
  389. console.log('Request Path:', path);
  390. // console.log(typeof params)
  391. // return `${method}, ${path}, ${params}`
  392. return await this.easyPayAdapter.request(method, path, params);
  393. }
  394. /**
  395. * 查询换汇订单
  396. */
  397. @Get('/v1/exchanges/:id', { summary: '查询换汇订单' })
  398. async exchangesInfo(@Param() id: any) {
  399. // Access the request method and path
  400. const method = this.ctx.method;
  401. const path = this.ctx.path;
  402. console.log('Request Method:', method);
  403. console.log('Request Path:', path);
  404. // console.log(typeof params)
  405. // return `${method}, ${path}, ${params}`
  406. return await this.easyPayAdapter.request(method, path, {});
  407. }
  408. /**
  409. * 付款
  410. */
  411. @Post('/v1/payments', { summary: '付款' })
  412. async createdPayments(@Body() params: any) {
  413. // Access the request method and path
  414. const method = this.ctx.method;
  415. const path = this.ctx.path;
  416. console.log('Request Method:', method);
  417. console.log('Request Path:', path);
  418. const res = await this.easyPayAdapter.request(method, path, params);
  419. // this.easyOpenService.save_user_order(res, params, OrderType.PAYMENT);
  420. return res;
  421. }
  422. /**
  423. * 查询付款列表
  424. */
  425. @Get('/v1/payments', { summary: '查询付款列表' })
  426. async getPaymentsList(@Query() params: any) {
  427. // Access the request method and path
  428. const method = this.ctx.method;
  429. const path = this.ctx.path;
  430. console.log('Request Method:', method);
  431. console.log('Request Path:', path);
  432. // console.log(typeof params)
  433. // return `${method}, ${path}, ${params}`
  434. return await this.easyPayAdapter.request(method, path, params);
  435. }
  436. /**
  437. * 查询付款
  438. */
  439. @Get('/v1/payments/:id', { summary: '查询付款' })
  440. async paymentsInfo(@Param() id: any) {
  441. // Access the request method and path
  442. const method = this.ctx.method;
  443. const path = this.ctx.path;
  444. console.log('Request Method:', method);
  445. console.log('Request Path:', path);
  446. // console.log(typeof params)
  447. // return `${method}, ${path}, ${params}`
  448. return await this.easyPayAdapter.request(method, path, {});
  449. }
  450. /**
  451. * 补充材料
  452. */
  453. @Post('/v1/payments/:id/documents', { summary: '补充材料' })
  454. async putPaymentsDocuments(@Param() id: any, @Body() params: any) {
  455. // Access the request method and path
  456. const method = this.ctx.method;
  457. const path = this.ctx.path;
  458. console.log('Request Method:', method);
  459. console.log('Request Path:', path);
  460. // console.log(typeof params)
  461. // return `${method}, ${path}, ${params}`
  462. return await this.easyPayAdapter.request(method, path, params);
  463. }
  464. /**
  465. * 付款凭证下载
  466. */
  467. @Get('/v1/payments/proof', { summary: '付款凭证下载' })
  468. async paymentsProof(@Query() params: any) {
  469. // Access the request method and path
  470. const method = this.ctx.method;
  471. const path = this.ctx.path;
  472. console.log('Request Method:', method);
  473. console.log('Request Path:', path);
  474. // console.log(typeof params)
  475. // return `${method}, ${path}, ${params}`
  476. return await this.easyPayAdapter.request(method, path, params);
  477. }
  478. /**
  479. * 转账
  480. */
  481. @Post('/v1/transfers', { summary: '转账' })
  482. async transfers(@Body() params: any) {
  483. // Access the request method and path
  484. const method = this.ctx.method;
  485. const path = this.ctx.path;
  486. console.log('Request Method:', method);
  487. console.log('Request Path:', path);
  488. // console.log(typeof params)
  489. // return `${method}, ${path}, ${params}`
  490. const res = await this.easyPayAdapter.request(method, path, params);
  491. // this.easyOpenService.save_user_order(res, params, OrderType.TRANSFER);
  492. return res;
  493. }
  494. /**
  495. * 查询转账列表
  496. */
  497. @Get('/v1/transfers', { summary: '查询转账列表' })
  498. async transfersList(@Query() params: any) {
  499. // Access the request method and path
  500. const method = this.ctx.method;
  501. const path = this.ctx.path;
  502. console.log('Request Method:', method);
  503. console.log('Request Path:', path);
  504. console.log('Request params:', params);
  505. // console.log(typeof params)
  506. // return `${method}, ${path}, ${params}`
  507. return await this.easyPayAdapter.request(method, path, params);
  508. }
  509. /**
  510. * 查询转账
  511. */
  512. @Get('/v1/transfers/:id', { summary: '查询转账' })
  513. async transfersInfo(@Param() id: any) {
  514. // Access the request method and path
  515. const method = this.ctx.method;
  516. const path = this.ctx.path;
  517. console.log('Request Method:', method);
  518. console.log('Request Path:', path);
  519. // console.log(typeof params)
  520. // return `${method}, ${path}, ${params}`
  521. return await this.easyPayAdapter.request(method, path, {});
  522. }
  523. /**
  524. * 查询账户流水
  525. */
  526. @Get('/v3/accounts/:account_id/transactions', { summary: '查询账户流水' })
  527. async accountsTransactionsInfo(
  528. @Param() account_id: any,
  529. @Query() params: any
  530. ) {
  531. // Access the request method and path
  532. const method = this.ctx.method;
  533. const path = this.ctx.path;
  534. console.log('Request Method:', method);
  535. console.log('Request Path:', path);
  536. // console.log(typeof params)
  537. // return `${method}, ${path}, ${params}`
  538. return await this.easyPayAdapter.request(method, path, params);
  539. }
  540. /**
  541. * 根据 transaction ID 查询
  542. */
  543. @Get('/v3/accounts/:account_id/transactions/:id', {
  544. summary: '根据 transaction ID 查询',
  545. })
  546. async accountsTransactionsInfoByAccount_id(
  547. @Param() account_id: any,
  548. @Param() id: any
  549. ) {
  550. // Access the request method and path
  551. const method = this.ctx.method;
  552. const path = this.ctx.path;
  553. console.log('Request Method:', method);
  554. console.log('Request Path:', path);
  555. // console.log(typeof params)
  556. // return `${method}, ${path}, ${params}`
  557. return await this.easyPayAdapter.request(method, path, {});
  558. }
  559. /**
  560. * 查询实名更新请求列表
  561. */
  562. @Get('/v3/legal_entity_requests', { summary: '查询实名更新请求列表' })
  563. async legal_entity_requestslist(@Query() params: any) {
  564. // Access the request method and path
  565. const method = this.ctx.method;
  566. const path = this.ctx.path;
  567. console.log('Request Method:', method);
  568. console.log('Request Path:', path);
  569. // console.log(typeof params)
  570. // return `${method}, ${path}, ${params}`
  571. return await this.easyPayAdapter.request(method, path, params);
  572. }
  573. /**
  574. * 提交实名更新
  575. */
  576. @Post('/v3/legal_entity_requests/:id/submit', { summary: '提交实名更新' })
  577. async legal_entity_requestsSubmit(@Param() id: any, @Body() params: any) {
  578. // Access the request method and path
  579. const method = this.ctx.method;
  580. const path = this.ctx.path;
  581. console.log('Request Method:', method);
  582. console.log('Request Path:', path);
  583. // console.log(typeof params)
  584. // return `${method}, ${path}, ${params}`
  585. return await this.easyPayAdapter.request(method, path, params);
  586. }
  587. /**
  588. * 收款人信息校验
  589. */
  590. @Post('/v3/beneficiaries/validate', { summary: '收款人信息校验' })
  591. async beneficiariesValidate(@Body() params: any) {
  592. // Access the request method and path
  593. const method = this.ctx.method;
  594. const path = this.ctx.path;
  595. console.log('Request Method:', method);
  596. console.log('Request Path:', path);
  597. // console.log(typeof params)
  598. // return `${method}, ${path}, ${params}`
  599. return await this.easyPayAdapter.request(method, path, params);
  600. }
  601. /**
  602. * 通过实名
  603. */
  604. @Post('/v3/simulate/accounts/:id/approve', { summary: '通过实名' })
  605. async simulateAccountsApprove(@Param() id: any) {
  606. // Access the request method and path
  607. const method = this.ctx.method;
  608. const path = this.ctx.path;
  609. console.log('Request Method:', method);
  610. console.log('Request Path:', path);
  611. // console.log(typeof params)
  612. // return `${method}, ${path}, ${params}`
  613. return await this.easyPayAdapter.request(method, path, {});
  614. }
  615. /**
  616. * 通过实名更新
  617. */
  618. @Post('/v3/simulate/legal_entity_requests/:id/confirm', {
  619. summary: '通过实名更新',
  620. })
  621. async simulateLegal_entity_requestsConfirm(@Param() id: any) {
  622. // Access the request method and path
  623. const method = this.ctx.method;
  624. const path = this.ctx.path;
  625. console.log('Request Method:', method);
  626. console.log('Request Path:', path);
  627. // console.log(typeof params)
  628. // return `${method}, ${path}, ${params}`
  629. return await this.easyPayAdapter.request(method, path, {});
  630. }
  631. /**
  632. * 驳回实名
  633. */
  634. @Post('/v3/simulate/accounts/:id/reject', { summary: '驳回实名' })
  635. async simulateAccountsReject(@Param('id') id: any) {
  636. // Access the request method and path
  637. const method = this.ctx.method;
  638. const path = this.ctx.path;
  639. console.log('Request Method:', method);
  640. console.log('Request Path:', path);
  641. // console.log(typeof params)
  642. // return `${method}, ${path}, ${params}`
  643. return await this.easyPayAdapter.request(method, path, {});
  644. }
  645. /**
  646. * 创建实名更新
  647. */
  648. @Post('/v3/simulate/legal_entity_requests', { summary: '创建实名更新' })
  649. async simulateLegal_entity_requests(@Body(ALL) params: any) {
  650. // Access the request method and path
  651. const method = this.ctx.method;
  652. const path = this.ctx.path;
  653. console.log('Request Method:', method);
  654. console.log('Request Path:', path);
  655. // console.log(typeof params)
  656. // return `${method}, ${path}, ${params}`
  657. return await this.easyPayAdapter.request(method, path, params);
  658. }
  659. /**
  660. * 入账
  661. */
  662. @Post('/v1/simulate/deposits', { summary: '入账' })
  663. async simulateDeposits(@Body(ALL) params: any) {
  664. // Access the request method and path
  665. const method = this.ctx.method;
  666. const path = this.ctx.path;
  667. console.log('Request Method:', method);
  668. console.log('Request Path:', path);
  669. // console.log(typeof params)
  670. // return `${method}, ${path}, ${params}`
  671. return await this.easyPayAdapter.request(method, path, params);
  672. }
  673. /**
  674. * 拒绝更新请求
  675. */
  676. @Post('/v3/simulate/legal_entity_requests/:id/reject', {
  677. summary: '拒绝更新请求',
  678. })
  679. async simulateLegal_entity_requestsReject(@Param('id') id: any) {
  680. // Access the request method and path
  681. const method = this.ctx.method;
  682. const path = this.ctx.path;
  683. console.log('Request Method:', method);
  684. console.log('Request Path:', path);
  685. // console.log(typeof params)
  686. // return `${method}, ${path}, ${params}`
  687. return await this.easyPayAdapter.request(method, path, {});
  688. }
  689. /**
  690. * 收款账户审核通过
  691. */
  692. @Post('/v3/simulate/applications/:id/confirm', {
  693. summary: '收款账户审核通过',
  694. })
  695. async simulateApplicationsConfirm(@Param('id') id: any) {
  696. // Access the request method and path
  697. const method = this.ctx.method;
  698. const path = this.ctx.path;
  699. console.log('Request Method:', method);
  700. console.log('Request Path:', path);
  701. // console.log(typeof params)
  702. // return `${method}, ${path}, ${params}`
  703. return await this.easyPayAdapter.request(method, path, {});
  704. }
  705. /**
  706. * 收款账户审核驳回
  707. */
  708. @Post('/v3/simulate/applications/:id/reject', { summary: '收款账户审核驳回' })
  709. async simulateApplicationsReject(@Param('id') id: any) {
  710. // Access the request method and path
  711. const method = this.ctx.method;
  712. const path = this.ctx.path;
  713. console.log('Request Method:', method);
  714. console.log('Request Path:', path);
  715. // console.log(typeof params)
  716. // return `${method}, ${path}, ${params}`
  717. return await this.easyPayAdapter.request(method, path, {});
  718. }
  719. /**
  720. * 通过付款
  721. */
  722. @Post('/v1/simulate/payments/:id/confirm', { summary: '通过付款' })
  723. async simulatePaymentsConfirm(@Param('id') id: any) {
  724. // Access the request method and path
  725. const method = this.ctx.method;
  726. const path = this.ctx.path;
  727. console.log('Request Method:', method);
  728. console.log('Request Path:', path);
  729. // console.log(typeof params)
  730. // return `${method}, ${path}, ${params}`
  731. return await this.easyPayAdapter.request(method, path, {});
  732. }
  733. /**
  734. * 拒绝付款
  735. */
  736. @Post('/v1/simulate/payments/:id/reject', { summary: '拒绝付款' })
  737. async simulatePaymentsReject(@Param('id') id: any) {
  738. // Access the request method and path
  739. const method = this.ctx.method;
  740. const path = this.ctx.path;
  741. console.log('Request Method:', method);
  742. console.log('Request Path:', path);
  743. // console.log(typeof params)
  744. // return `${method}, ${path}, ${params}`
  745. return await this.easyPayAdapter.request(method, path, {});
  746. }
  747. /**
  748. * 通过换汇
  749. */
  750. @Post('/v1/simulate/exchanges/:id/confirm', { summary: '通过换汇' })
  751. async simulateExchangesConfirm(@Param('id') id: any) {
  752. // Access the request method and path
  753. const method = this.ctx.method;
  754. const path = this.ctx.path;
  755. console.log('Request Method:', method);
  756. console.log('Request Path:', path);
  757. // console.log(typeof params)
  758. // return `${method}, ${path}, ${params}`
  759. return await this.easyPayAdapter.request(method, path, {});
  760. }
  761. /**
  762. * 拒绝换汇
  763. */
  764. @Post('/v1/simulate/exchanges/:id/reject', { summary: '拒绝换汇' })
  765. async simulateExchangesReject(@Param('id') id: any) {
  766. // Access the request method and path
  767. const method = this.ctx.method;
  768. const path = this.ctx.path;
  769. console.log('Request Method:', method);
  770. console.log('Request Path:', path);
  771. // console.log(typeof params)
  772. // return `${method}, ${path}, ${params}`
  773. return await this.easyPayAdapter.request(method, path, {});
  774. }
  775. /**
  776. * 创建 Webhook
  777. */
  778. @Post('/v3/webhooks', { summary: '创建 Webhook' })
  779. async createdWebhooks(@Body(ALL) params: any) {
  780. // Access the request method and path
  781. const method = this.ctx.method;
  782. const path = this.ctx.path;
  783. console.log('Request Method:', method);
  784. console.log('Request Path:', path);
  785. // console.log(typeof params)
  786. // return `${method}, ${path}, ${params}`
  787. return await this.easyPayAdapter.request(method, path, params);
  788. }
  789. /**
  790. * 查询 Webhook
  791. */
  792. @Get('/v3/webhooks', { summary: '查询 Webhook' })
  793. async getWebhooks(@Query(ALL) params: any) {
  794. // Access the request method and path
  795. const method = this.ctx.method;
  796. const path = this.ctx.path;
  797. console.log('Request Method:', method);
  798. console.log('Request Path:', path);
  799. // console.log(typeof params)
  800. // return `${method}, ${path}, ${params}`
  801. return await this.easyPayAdapter.request(method, path, params);
  802. }
  803. /**
  804. * 修改 Webhook
  805. */
  806. @Put('/v3/webhooks/:id', { summary: '修改 Webhook' })
  807. async putWebhooks(@Param('id') id: any, @Body() params: any) {
  808. // Access the request method and path
  809. const method = this.ctx.method;
  810. const path = this.ctx.path;
  811. console.log('Request Method:', method);
  812. console.log('Request Path:', path);
  813. // console.log(typeof params)
  814. // return `${method}, ${path}, ${params}`
  815. return await this.easyPayAdapter.request(method, path, params);
  816. }
  817. /**
  818. * 删除 Webhook
  819. */
  820. @Del('/v3/webhooks/:id', { summary: '修改 Webhook' })
  821. async delWebhooks(@Param('id') id: any) {
  822. // Access the request method and path
  823. const method = this.ctx.method;
  824. const path = this.ctx.path;
  825. console.log('Request Method:', method);
  826. console.log('Request Path:', path);
  827. // console.log(typeof params)
  828. // return `${method}, ${path}, ${params}`
  829. return await this.easyPayAdapter.request(method, path, {});
  830. }
  831. /**
  832. * 创建 Webhook HMAC Key
  833. */
  834. @Post('/v3/webhook_hmac_key', { summary: '创建 Webhook HMAC Key' })
  835. async createWebhook_hmac_key(@Body(ALL) params: any) {
  836. // Access the request method and path
  837. const method = this.ctx.method;
  838. const path = this.ctx.path;
  839. console.log('Request Method:', method);
  840. console.log('Request Path:', path);
  841. // console.log(typeof params)
  842. // return `${method}, ${path}, ${params}`
  843. return await this.easyPayAdapter.request(method, path, params);
  844. }
  845. /**
  846. * 账户审核通过
  847. */
  848. @Post('/account_approved', { summary: '账户审核通过' })
  849. async account_approved(@Body(ALL) params: any) {
  850. // Access the request method and path
  851. const method = this.ctx.method;
  852. const path = this.ctx.path;
  853. console.log('Request Method:', method);
  854. console.log('Request Path:', path);
  855. // console.log(typeof params)
  856. // return `${method}, ${path}, ${params}`
  857. return await this.easyPayAdapter.request(method, path, params);
  858. }
  859. /**
  860. * 账户审核驳回
  861. */
  862. @Post('/account_rejected', { summary: '账户审核驳回' })
  863. async account_rejected(@Body(ALL) params: any) {
  864. // Access the request method and path
  865. const method = this.ctx.method;
  866. const path = this.ctx.path;
  867. console.log('Request Method:', method);
  868. console.log('Request Path:', path);
  869. // console.log(typeof params)
  870. // return `${method}, ${path}, ${params}`
  871. return await this.easyPayAdapter.request(method, path, params);
  872. }
  873. /**
  874. * 实名待更新
  875. */
  876. @Post('/legal_entity_request_created', { summary: '实名待更新' })
  877. async legal_entity_request_created(@Body(ALL) params: any) {
  878. // Access the request method and path
  879. const method = this.ctx.method;
  880. const path = this.ctx.path;
  881. console.log('Request Method:', method);
  882. console.log('Request Path:', path);
  883. // console.log(typeof params)
  884. // return `${method}, ${path}, ${params}`
  885. return await this.easyPayAdapter.request(method, path, params);
  886. }
  887. /**
  888. * 实名更新审核通过
  889. */
  890. @Post('/legal_entity_request_success', { summary: '实名更新审核通过' })
  891. async legal_entity_request_success(@Body(ALL) params: any) {
  892. // Access the request method and path
  893. const method = this.ctx.method;
  894. const path = this.ctx.path;
  895. console.log('Request Method:', method);
  896. console.log('Request Path:', path);
  897. // console.log(typeof params)
  898. // return `${method}, ${path}, ${params}`
  899. return await this.easyPayAdapter.request(method, path, params);
  900. }
  901. /**
  902. * 实名更新审核驳回
  903. */
  904. @Post('/legal_entity_request_rejected', { summary: '实名更新审核驳回 ' })
  905. async legal_entity_request_rejected(@Body(ALL) params: any) {
  906. // Access the request method and path
  907. const method = this.ctx.method;
  908. const path = this.ctx.path;
  909. console.log('Request Method:', method);
  910. console.log('Request Path:', path);
  911. // console.log(typeof params)
  912. // return `${method}, ${path}, ${params}`
  913. return await this.easyPayAdapter.request(method, path, params);
  914. }
  915. /**
  916. * 收款账户申请成功
  917. */
  918. @Post('/application_success', { summary: '收款账户申请成功' })
  919. async application_success(@Body(ALL) params: any) {
  920. // Access the request method and path
  921. const method = this.ctx.method;
  922. const path = this.ctx.path;
  923. console.log('Request Method:', method);
  924. console.log('Request Path:', path);
  925. // console.log(typeof params)
  926. // return `${method}, ${path}, ${params}`
  927. return await this.easyPayAdapter.request(method, path, params);
  928. }
  929. /**
  930. * 收款账户申请失败
  931. */
  932. @Post('/application_failed', { summary: '收款账户申请失败' })
  933. async application_failed(@Body(ALL) params: any) {
  934. // Access the request method and path
  935. const method = this.ctx.method;
  936. const path = this.ctx.path;
  937. console.log('Request Method:', method);
  938. console.log('Request Path:', path);
  939. // console.log(typeof params)
  940. // return `${method}, ${path}, ${params}`
  941. return await this.easyPayAdapter.request(method, path, params);
  942. }
  943. /**
  944. * 收款账户信息变更
  945. */
  946. @Post('/bank_account_updated', { summary: '收款账户信息变更' })
  947. async bank_account_updated(@Body(ALL) params: any) {
  948. // Access the request method and path
  949. const method = this.ctx.method;
  950. const path = this.ctx.path;
  951. console.log('Request Method:', method);
  952. console.log('Request Path:', path);
  953. // console.log(typeof params)
  954. // return `${method}, ${path}, ${params}`
  955. return await this.easyPayAdapter.request(method, path, params);
  956. }
  957. /**
  958. * 收单支付成功通知
  959. */
  960. @Post('/acquiring_payment_success', { summary: '收单支付成功通知' })
  961. async acquiring_payment_success(@Body(ALL) params: any) {
  962. // Access the request method and path
  963. const method = this.ctx.method;
  964. const path = this.ctx.path;
  965. console.log('Request Method:', method);
  966. console.log('Request Path:', path);
  967. // console.log(typeof params)
  968. // return `${method}, ${path}, ${params}`
  969. return await this.easyPayAdapter.request(method, path, params);
  970. }
  971. /**
  972. * 收单退款成功通知
  973. */
  974. @Post('/acquiring_refund_success', { summary: '收单退款成功通知' })
  975. async acquiring_refund_success(@Body(ALL) params: any) {
  976. // Access the request method and path
  977. const method = this.ctx.method;
  978. const path = this.ctx.path;
  979. console.log('Request Method:', method);
  980. console.log('Request Path:', path);
  981. // console.log(typeof params)
  982. // return `${method}, ${path}, ${params}`
  983. return await this.easyPayAdapter.request(method, path, params);
  984. }
  985. /**
  986. * 收单退款失败通知
  987. */
  988. @Post('/acquiring_refund_failed', { summary: '收单退款失败通知' })
  989. async acquiring_refund_failed(@Body(ALL) params: any) {
  990. // Access the request method and path
  991. const method = this.ctx.method;
  992. const path = this.ctx.path;
  993. console.log('Request Method:', method);
  994. console.log('Request Path:', path);
  995. // console.log(typeof params)
  996. // return `${method}, ${path}, ${params}`
  997. return await this.easyPayAdapter.request(method, path, params);
  998. }
  999. /**
  1000. * 入账成功
  1001. */
  1002. @Post('/deposit_success', { summary: '入账成功' })
  1003. async deposit_success(@Body(ALL) params: any) {
  1004. // Access the request method and path
  1005. const method = this.ctx.method;
  1006. const path = this.ctx.path;
  1007. console.log('Request Method:', method);
  1008. console.log('Request Path:', path);
  1009. // console.log(typeof params)
  1010. // return `${method}, ${path}, ${params}`
  1011. return await this.easyPayAdapter.request(method, path, params);
  1012. }
  1013. /**
  1014. * 换汇成功
  1015. */
  1016. @Post('/exchange_success', { summary: '换汇成功' })
  1017. async exchange_success(@Body(ALL) params: any) {
  1018. // Access the request method and path
  1019. const method = this.ctx.method;
  1020. const path = this.ctx.path;
  1021. console.log('Request Method:', method);
  1022. console.log('Request Path:', path);
  1023. // console.log(typeof params)
  1024. // return `${method}, ${path}, ${params}`
  1025. return await this.easyPayAdapter.request(method, path, params);
  1026. }
  1027. /**
  1028. * 换汇失败
  1029. */
  1030. @Post('/exchange_failed', { summary: '换汇失败' })
  1031. async exchange_failed(@Body(ALL) params: any) {
  1032. // Access the request method and path
  1033. const method = this.ctx.method;
  1034. const path = this.ctx.path;
  1035. console.log('Request Method:', method);
  1036. console.log('Request Path:', path);
  1037. // console.log(typeof params)
  1038. // return `${method}, ${path}, ${params}`
  1039. return await this.easyPayAdapter.request(method, path, params);
  1040. }
  1041. /**
  1042. * 收款账户已下发
  1043. */
  1044. @Post('/bank_account_created', { summary: '收款账户已下发' })
  1045. async bank_account_created(@Body(ALL) params: any) {
  1046. // Access the request method and path
  1047. const method = this.ctx.method;
  1048. const path = this.ctx.path;
  1049. console.log('Request Method:', method);
  1050. console.log('Request Path:', path);
  1051. // console.log(typeof params)
  1052. // return `${method}, ${path}, ${params}`
  1053. return await this.easyPayAdapter.request(method, path, params);
  1054. }
  1055. /**
  1056. * 付款成功
  1057. */
  1058. @Post('/payment_success', { summary: '付款成功' })
  1059. async payment_success(@Body(ALL) params: any) {
  1060. // Access the request method and path
  1061. const method = this.ctx.method;
  1062. const path = this.ctx.path;
  1063. console.log('Request Method:', method);
  1064. console.log('Request Path:', path);
  1065. // console.log(typeof params)
  1066. // return `${method}, ${path}, ${params}`
  1067. return await this.easyPayAdapter.request(method, path, params);
  1068. }
  1069. /**
  1070. * 付款失败
  1071. */
  1072. @Post('/payment_failed', { summary: '付款失败' })
  1073. async payment_failed(@Body(ALL) params: any) {
  1074. // Access the request method and path
  1075. const method = this.ctx.method;
  1076. const path = this.ctx.path;
  1077. console.log('Request Method:', method);
  1078. console.log('Request Path:', path);
  1079. // console.log(typeof params)
  1080. // return `${method}, ${path}, ${params}`
  1081. return await this.easyPayAdapter.request(method, path, params);
  1082. }
  1083. /**
  1084. * 付款银行退回
  1085. */
  1086. @Post('/payment_refunded', { summary: '付款银行退回' })
  1087. async payment_refunded(@Body(ALL) params: any) {
  1088. // Access the request method and path
  1089. const method = this.ctx.method;
  1090. const path = this.ctx.path;
  1091. console.log('Request Method:', method);
  1092. console.log('Request Path:', path);
  1093. // console.log(typeof params)
  1094. // return `${method}, ${path}, ${params}`
  1095. return await this.easyPayAdapter.request(method, path, params);
  1096. }
  1097. /**
  1098. * 转账成功
  1099. */
  1100. @Post('/transfer_success', { summary: '转账成功' })
  1101. async transfer_success(@Body(ALL) params: any) {
  1102. // Access the request method and path
  1103. const method = this.ctx.method;
  1104. const path = this.ctx.path;
  1105. console.log('Request Method:', method);
  1106. console.log('Request Path:', path);
  1107. // console.log(typeof params)
  1108. // return `${method}, ${path}, ${params}`
  1109. return await this.easyPayAdapter.request(method, path, params);
  1110. }
  1111. /**
  1112. * 转账失败
  1113. */
  1114. @Post('/transfer_failed', { summary: '转账失败' })
  1115. async transfer_failed(@Body(ALL) params: any) {
  1116. // Access the request method and path
  1117. const method = this.ctx.method;
  1118. const path = this.ctx.path;
  1119. console.log('Request Method:', method);
  1120. console.log('Request Path:', path);
  1121. // console.log(typeof params)
  1122. // return `${method}, ${path}, ${params}`
  1123. return await this.easyPayAdapter.request(method, path, params);
  1124. }
  1125. /**
  1126. * merchant_certification
  1127. */
  1128. @Post('/v1/upload', { summary: '上传文件' })
  1129. async upload(@Files() files: any[], @Fields() fields) {
  1130. const results = [];
  1131. for (const file of files) {
  1132. const result = await this.easyOpenService.upload(file);
  1133. results.push(result);
  1134. }
  1135. return { success: true, data: results };
  1136. }
  1137. }