fix(SPG-769) save edit data terkena validasi status transaksi settled

fix/data
Aswin Ashar Abdullah 2024-08-02 17:59:30 +07:00
parent 0f05656ca2
commit 4fcd852d8d
1 changed files with 0 additions and 15 deletions

View File

@ -12,25 +12,10 @@ import {
columnUniques, columnUniques,
validateRelations, validateRelations,
} from 'src/core/strings/constants/interface.constants'; } from 'src/core/strings/constants/interface.constants';
import { STATUS } from 'src/core/strings/constants/base.constants';
@Injectable() @Injectable()
export class UpdateRefundManager extends BaseUpdateManager<RefundEntity> { export class UpdateRefundManager extends BaseUpdateManager<RefundEntity> {
async validateProcess(): Promise<void> { async validateProcess(): Promise<void> {
const transaction = await this.dataServiceFirstOpt.getOneByOptions({
where: {
id: this.data.transaction.id,
status: STATUS.SETTLED,
},
});
if (!transaction) {
throw new UnprocessableEntityException({
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
message: `Gagal! hanya pemesanan dengan status ${STATUS.SETTLED} yang dapat dikembalikan`,
error: 'Unprocessable Entity',
});
}
return; return;
} }