Compare commits

..

No commits in common. "5b7df0e372ba06a69b2fa5ab88bc65b4a3f0ee0c" and "73c87f6819fd890ebf907949ec2475439387ed7c" have entirely different histories.

3 changed files with 5 additions and 7 deletions

View File

@ -49,8 +49,7 @@ export class OtpService {
this.hasSequentialDigits(otp) || this.hasSequentialDigits(otp) ||
this.hasRepeatedDigits(otp) || this.hasRepeatedDigits(otp) ||
this.isPalindrome(otp) || this.isPalindrome(otp) ||
this.hasPartiallyRepeatedDigits(otp) || this.hasPartiallyRepeatedDigits(otp)
otp?.split('')?.length < this.otpLength
); );
return otp; return otp;

View File

@ -29,7 +29,7 @@ export class OtpVerificationService {
return moment().add(minutes, 'minutes').valueOf(); // epoch millis expired time return moment().add(minutes, 'minutes').valueOf(); // epoch millis expired time
} }
private generateResendAvailableAt(seconds = 60): number { private generateResendAvailableAt(seconds = 90): number {
return moment().add(seconds, 'seconds').valueOf(); // epoch millis return moment().add(seconds, 'seconds').valueOf(); // epoch millis
} }
@ -67,14 +67,14 @@ export class OtpVerificationService {
}; };
const activeOTP = await this.getActiveOtp( const activeOTP = await this.getActiveOtp(
payload.target_id ? payload.target_id : payload.reference, payload.target_id ?? payload.reference,
); );
if (activeOTP) { if (activeOTP) {
const createdAtMoment = moment(Number(activeOTP.created_at)); const createdAtMoment = moment(Number(activeOTP.created_at));
const nowMoment = moment(Number(dateNow)); const nowMoment = moment(Number(dateNow));
const diffSeconds = nowMoment.diff(createdAtMoment, 'seconds'); const diffSeconds = nowMoment.diff(createdAtMoment, 'seconds');
if (diffSeconds < 60) { if (diffSeconds < 90) {
throw new BadRequestException( throw new BadRequestException(
'An active OTP request was made recently. Please try again later.', 'An active OTP request was made recently. Please try again later.',
); );

View File

@ -1,6 +1,6 @@
import { BaseDto } from 'src/core/modules/infrastructure/dto/base.dto'; import { BaseDto } from 'src/core/modules/infrastructure/dto/base.dto';
import { VipCodeEntity } from '../../domain/entities/vip-code.entity'; import { VipCodeEntity } from '../../domain/entities/vip-code.entity';
import { IsNumber, IsObject, IsString, ValidateIf } from 'class-validator'; import { IsNumber, IsObject, IsString } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
export class VipCodeDto extends BaseDto implements VipCodeEntity { export class VipCodeDto extends BaseDto implements VipCodeEntity {
@ -29,7 +29,6 @@ export class VipCodeDto extends BaseDto implements VipCodeEntity {
example: 25000, example: 25000,
}) })
@IsNumber() @IsNumber()
@ValidateIf((v) => v.discount_value)
discount_value: number; discount_value: number;
@ApiProperty({ @ApiProperty({