fix(SPG-675) Error saat confirm status pending ( hanya bisa refund status settled ) padahal status sudah berubah ke proces refund
parent
3e85d40885
commit
d9bbe1290d
|
@ -17,7 +17,12 @@ import { STATUS } from 'src/core/strings/constants/base.constants';
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BatchConfirmRefundManager extends BaseBatchUpdateStatusManager<RefundEntity> {
|
export class BatchConfirmRefundManager extends BaseBatchUpdateStatusManager<RefundEntity> {
|
||||||
async validateData(data: RefundEntity): Promise<void> {
|
async validateData(data: RefundEntity): Promise<void> {
|
||||||
if (data?.['transaction']?.status != STATUS.SETTLED) {
|
if (
|
||||||
|
this.data.status == STATUS.DRAFT &&
|
||||||
|
data['trnsaction']?.status != STATUS.SETTLED &&
|
||||||
|
this.data.status == STATUS.PENDING &&
|
||||||
|
data['trnsaction']?.status != STATUS.PROCESS_REFUND
|
||||||
|
) {
|
||||||
throw new UnprocessableEntityException({
|
throw new UnprocessableEntityException({
|
||||||
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
||||||
message: `Failed! only transaction with status ${STATUS.SETTLED} can be refund`,
|
message: `Failed! only transaction with status ${STATUS.SETTLED} can be refund`,
|
||||||
|
|
|
@ -38,7 +38,12 @@ export class ConfirmRefundManager extends BaseUpdateStatusManager<RefundEntity>
|
||||||
relations: ['transaction'],
|
relations: ['transaction'],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data.transaction.status != STATUS.SETTLED) {
|
if (
|
||||||
|
data.status == STATUS.DRAFT &&
|
||||||
|
data.transaction.status != STATUS.SETTLED &&
|
||||||
|
data.status == STATUS.PENDING &&
|
||||||
|
data.transaction.status != STATUS.PROCESS_REFUND
|
||||||
|
) {
|
||||||
throw new UnprocessableEntityException({
|
throw new UnprocessableEntityException({
|
||||||
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
||||||
message: `Failed! only transaction with status ${STATUS.SETTLED} can be refund`,
|
message: `Failed! only transaction with status ${STATUS.SETTLED} can be refund`,
|
||||||
|
|
Loading…
Reference in New Issue