fix(SPG-687) Booking status pending seharusnya bisa di cancel, tapi ketika di cancel muncul error message, hanya status active yang bisa di cancel
parent
4a9ca5eb5b
commit
dc6476a66f
|
@ -17,10 +17,17 @@ import { STATUS } from 'src/core/strings/constants/base.constants';
|
|||
@Injectable()
|
||||
export class BatchCancelRefundManager extends BaseBatchUpdateStatusManager<RefundEntity> {
|
||||
validateData(data: RefundEntity): Promise<void> {
|
||||
if (![STATUS.REFUNDED, STATUS.PENDING].includes(data.status)) {
|
||||
if (
|
||||
![
|
||||
STATUS.REFUNDED,
|
||||
STATUS.PENDING,
|
||||
STATUS.PROCESS_REFUND,
|
||||
STATUS.PARTIAL_REFUND,
|
||||
].includes(data.status)
|
||||
) {
|
||||
throw new UnprocessableEntityException({
|
||||
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
||||
message: `Failed! only data with status ${STATUS.REFUNDED} and ${STATUS.PENDING} can be cancelled`,
|
||||
message: `Failed! only data with status ${STATUS.REFUNDED}, ${STATUS.PROCESS_REFUND} , ${STATUS.PARTIAL_REFUND} and ${STATUS.PENDING} can be cancelled`,
|
||||
error: 'Unprocessable Entity',
|
||||
});
|
||||
}
|
||||
|
|
|
@ -20,10 +20,17 @@ export class CancelRefundManager extends BaseUpdateStatusManager<RefundEntity> {
|
|||
}
|
||||
|
||||
async validateProcess(): Promise<void> {
|
||||
if (![STATUS.REFUNDED, STATUS.PENDING].includes(this.data.status)) {
|
||||
if (
|
||||
![
|
||||
STATUS.REFUNDED,
|
||||
STATUS.PENDING,
|
||||
STATUS.PROCESS_REFUND,
|
||||
STATUS.PARTIAL_REFUND,
|
||||
].includes(this.data.status)
|
||||
) {
|
||||
throw new UnprocessableEntityException({
|
||||
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
||||
message: `Failed! only data with status ${STATUS.REFUNDED} and ${STATUS.PENDING} can be cancelled`,
|
||||
message: `Failed! only data with status ${STATUS.REFUNDED}, ${STATUS.PROCESS_REFUND} , ${STATUS.PARTIAL_REFUND} and ${STATUS.PENDING} can be cancelled`,
|
||||
error: 'Unprocessable Entity',
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue