|
@@ -0,0 +1,58 @@
|
|
|
+import { CoolController, BaseController } from '@cool-midway/core';
|
|
|
+import {
|
|
|
+ ALL,
|
|
|
+ Body,
|
|
|
+ Get,
|
|
|
+ Inject,
|
|
|
+ Param,
|
|
|
+ Post,
|
|
|
+ Provide,
|
|
|
+ Query,
|
|
|
+} from '@midwayjs/decorator';
|
|
|
+import { BusinessEntity } from '../../payment/entity/business';
|
|
|
+import { WalletService } from '../../payment/service/wallet';
|
|
|
+import { EasyPayAdapter } from '../../payment/adapter/easypay.adapter';
|
|
|
+import { OpenApiWebhookService } from '../service/webhook';
|
|
|
+import { Context } from '@midwayjs/koa';
|
|
|
+
|
|
|
+/**
|
|
|
+ * 开放接口的webhook
|
|
|
+ */
|
|
|
+@Provide()
|
|
|
+@CoolController('/api/open')
|
|
|
+export class OpenApiWebhookController extends BaseController {
|
|
|
+ @Inject()
|
|
|
+ openApiWebhookService: OpenApiWebhookService;
|
|
|
+
|
|
|
+ @Inject()
|
|
|
+ ctx: Context;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * easypay webhook
|
|
|
+ * "account_approved",
|
|
|
+ * "account_rejected",
|
|
|
+ * "legal_entity_request_created",
|
|
|
+ * "legal_entity_request_success",
|
|
|
+ * "legal_entity_request_rejected",
|
|
|
+ * "application_success",
|
|
|
+ * "application_failed",
|
|
|
+ * "bank_account_created",
|
|
|
+ * "bank_account_updated",
|
|
|
+ * "exchange_success",
|
|
|
+ * "exchange_failed",
|
|
|
+ * "exchange_details_failed",
|
|
|
+ * "payment_success",
|
|
|
+ * "payment_failed",
|
|
|
+ * "payment_refunded",
|
|
|
+ * "transfer_success",
|
|
|
+ * "transfer_failed",
|
|
|
+ * "acquiring_payment_success",
|
|
|
+ * "acquiring_refund_success",
|
|
|
+ * "acquiring_refund_failed",
|
|
|
+ * "deposit_success"
|
|
|
+ **/
|
|
|
+ @Post('/easypay-webhook/:type', { summary: 'easypay webhook' })
|
|
|
+ async getBanks(@Param('type') type: any, @Body(ALL) params: any, ) {
|
|
|
+ return await this.openApiWebhookService.easypayWebhook(params, this.ctx, type);
|
|
|
+ }
|
|
|
+}
|