手机号核销确认
This commit is contained in:
@@ -5,6 +5,10 @@ import { HqOperationAction } from '../../common/hq-operation/hq-operation.consta
|
||||
import { AdminRedeemDebugService } from './admin-redeem-debug.service';
|
||||
import {
|
||||
AdminRedeemDebugCreateTokenDto,
|
||||
AdminRedeemDebugPhoneBalanceDto,
|
||||
AdminRedeemDebugPhoneConfirmDto,
|
||||
AdminRedeemDebugPhonePrepareDto,
|
||||
AdminRedeemDebugPhoneStoreDto,
|
||||
AdminRedeemDebugStoreTokenDto,
|
||||
} from './dto/admin-mutate.dto';
|
||||
|
||||
@@ -42,4 +46,30 @@ export class AdminRedeemDebugController {
|
||||
confirm(@Body() dto: AdminRedeemDebugStoreTokenDto) {
|
||||
return this.service.confirm(dto);
|
||||
}
|
||||
|
||||
@Post('phone/send-lookup-sms')
|
||||
sendPhoneLookupSms(@Body() dto: AdminRedeemDebugPhoneStoreDto) {
|
||||
return this.service.sendPhoneLookupSms(dto);
|
||||
}
|
||||
|
||||
@Post('phone/balance')
|
||||
phoneBalance(@Body() dto: AdminRedeemDebugPhoneBalanceDto) {
|
||||
return this.service.phoneBalance(dto);
|
||||
}
|
||||
|
||||
@Post('phone/prepare')
|
||||
phonePrepare(@Body() dto: AdminRedeemDebugPhonePrepareDto) {
|
||||
return this.service.phonePrepare(dto);
|
||||
}
|
||||
|
||||
@Post('phone/confirm')
|
||||
@HqOperation({
|
||||
action: HqOperationAction.REDEEM_DEBUG_CONFIRM,
|
||||
refType: 'REDEEM_DEBUG',
|
||||
batch: true,
|
||||
includeBody: true,
|
||||
})
|
||||
phoneConfirm(@Body() dto: AdminRedeemDebugPhoneConfirmDto) {
|
||||
return this.service.phoneConfirm(dto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@ import { PrismaService } from '../../common/prisma/prisma.module';
|
||||
import { RedeemService } from '../redeem/redeem.service';
|
||||
import type {
|
||||
AdminRedeemDebugCreateTokenDto,
|
||||
AdminRedeemDebugPhoneBalanceDto,
|
||||
AdminRedeemDebugPhoneConfirmDto,
|
||||
AdminRedeemDebugPhonePrepareDto,
|
||||
AdminRedeemDebugPhoneStoreDto,
|
||||
AdminRedeemDebugStoreTokenDto,
|
||||
} from './dto/admin-mutate.dto';
|
||||
|
||||
@@ -80,4 +84,24 @@ export class AdminRedeemDebugService {
|
||||
const storeAccountId = await this.resolveStoreAccountId(dto.storeId);
|
||||
return this.redeemService.confirmRedeem(storeAccountId, { token: dto.token });
|
||||
}
|
||||
|
||||
async sendPhoneLookupSms(dto: AdminRedeemDebugPhoneStoreDto) {
|
||||
const storeAccountId = await this.resolveStoreAccountId(dto.storeId);
|
||||
return this.redeemService.sendPhoneLookupSms(storeAccountId, dto.phone);
|
||||
}
|
||||
|
||||
async phoneBalance(dto: AdminRedeemDebugPhoneBalanceDto) {
|
||||
const storeAccountId = await this.resolveStoreAccountId(dto.storeId);
|
||||
return this.redeemService.verifyPhoneAndGetBalance(storeAccountId, dto.phone, dto.code);
|
||||
}
|
||||
|
||||
async phonePrepare(dto: AdminRedeemDebugPhonePrepareDto) {
|
||||
const storeAccountId = await this.resolveStoreAccountId(dto.storeId);
|
||||
return this.redeemService.preparePhoneRedeem(storeAccountId, dto.sessionId, dto.amount);
|
||||
}
|
||||
|
||||
async phoneConfirm(dto: AdminRedeemDebugPhoneConfirmDto) {
|
||||
const storeAccountId = await this.resolveStoreAccountId(dto.storeId);
|
||||
return this.redeemService.confirmPhoneRedeem(storeAccountId, dto.sessionId, dto.code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,6 +643,51 @@ export class AdminRedeemDebugStoreTokenDto {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export class AdminRedeemDebugPhoneStoreDto {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
storeId: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
phone: string;
|
||||
}
|
||||
|
||||
export class AdminRedeemDebugPhoneBalanceDto extends AdminRedeemDebugPhoneStoreDto {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
code: string;
|
||||
}
|
||||
|
||||
export class AdminRedeemDebugPhonePrepareDto {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
storeId: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
sessionId: string;
|
||||
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(0.01)
|
||||
amount: number;
|
||||
}
|
||||
|
||||
export class AdminRedeemDebugPhoneConfirmDto {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
storeId: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
sessionId: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
code: string;
|
||||
}
|
||||
|
||||
export class UpdateDeliveryDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
||||
Reference in New Issue
Block a user