fix(SPG-769) save edit data terkena validasi status transaksi settled
parent
0f05656ca2
commit
4fcd852d8d
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue