fix(SPG-658) Validasi - tidak bisa confirm dari status pending ke waiting, ketika data pembayaran booking belum diisi ( untuk pembayaran bank transfer dan QRIS saja)
parent
76fa380f1e
commit
6096771597
|
@ -18,12 +18,29 @@ import { TransactionPaymentType } from '../../../constants';
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BatchConfirmDataTransactionManager extends BaseBatchUpdateStatusManager<TransactionEntity> {
|
export class BatchConfirmDataTransactionManager extends BaseBatchUpdateStatusManager<TransactionEntity> {
|
||||||
validateData(data: TransactionEntity): Promise<void> {
|
validateData(data: TransactionEntity): Promise<void> {
|
||||||
|
if (
|
||||||
|
[
|
||||||
|
TransactionPaymentType.BANK_TRANSFER,
|
||||||
|
TransactionPaymentType.QRIS,
|
||||||
|
].includes(this.data.payment_type) &&
|
||||||
|
(!this.data.payment_date ||
|
||||||
|
!this.data.payment_total ||
|
||||||
|
!this.data.payment_type_method_number ||
|
||||||
|
!this.data.payment_type_method_name)
|
||||||
|
) {
|
||||||
|
throw new UnprocessableEntityException({
|
||||||
|
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
||||||
|
message: `Gagal! tolong lengkapi data terlebih dahulu`,
|
||||||
|
error: 'Unprocessable Entity',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
![STATUS.PENDING, STATUS.REJECTED, STATUS.EXPIRED].includes(data.status)
|
![STATUS.PENDING, STATUS.REJECTED, STATUS.EXPIRED].includes(data.status)
|
||||||
) {
|
) {
|
||||||
throw new UnprocessableEntityException({
|
throw new UnprocessableEntityException({
|
||||||
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
||||||
message: `Failed! only data booking with status ${STATUS.PENDING}, ${STATUS.REJECTED}, ${STATUS.EXPIRED} can be confirm`,
|
message: `Gagal! hanya pemesanan dengan status ${STATUS.PENDING}, ${STATUS.REJECTED}, ${STATUS.EXPIRED} dapat dikonfirmasi`,
|
||||||
error: 'Unprocessable Entity',
|
error: 'Unprocessable Entity',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,23 @@ export class ConfirmDataTransactionManager extends BaseUpdateStatusManager<Trans
|
||||||
}
|
}
|
||||||
|
|
||||||
async validateProcess(): Promise<void> {
|
async validateProcess(): Promise<void> {
|
||||||
|
if (
|
||||||
|
[
|
||||||
|
TransactionPaymentType.BANK_TRANSFER,
|
||||||
|
TransactionPaymentType.QRIS,
|
||||||
|
].includes(this.data.payment_type) &&
|
||||||
|
(!this.data.payment_date ||
|
||||||
|
!this.data.payment_total ||
|
||||||
|
!this.data.payment_type_method_number ||
|
||||||
|
!this.data.payment_type_method_name)
|
||||||
|
) {
|
||||||
|
throw new UnprocessableEntityException({
|
||||||
|
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
||||||
|
message: `Gagal! tolong lengkapi data terlebih dahulu`,
|
||||||
|
error: 'Unprocessable Entity',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +49,7 @@ export class ConfirmDataTransactionManager extends BaseUpdateStatusManager<Trans
|
||||||
) {
|
) {
|
||||||
throw new UnprocessableEntityException({
|
throw new UnprocessableEntityException({
|
||||||
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
||||||
message: `Failed! only data booking with status ${STATUS.PENDING}, ${STATUS.REJECTED}, ${STATUS.EXPIRED} can be confirm`,
|
message: `Gagal! hanya pemesanan dengan status ${STATUS.PENDING}, ${STATUS.REJECTED}, ${STATUS.EXPIRED} dapat dikonfirmasi`,
|
||||||
error: 'Unprocessable Entity',
|
error: 'Unprocessable Entity',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue