fix(refund) perbaikan data refund
continuous-integration/drone/tag Build is passing Details

pull/28/head devel_10.6.14
Aswin Ashar Abdullah 2024-07-15 15:24:02 +07:00
parent eafd815463
commit b574d3a39d
6 changed files with 33 additions and 7 deletions

View File

@ -0,0 +1,14 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateRefund1721031712642 implements MigrationInterface {
name = 'UpdateRefund1721031712642'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "refunds" ADD "refund_sub_total" numeric`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "refunds" DROP COLUMN "refund_sub_total"`);
}
}

View File

@ -27,6 +27,9 @@ export class RefundModel
@Column('date', { name: 'refund_date', nullable: true }) @Column('date', { name: 'refund_date', nullable: true })
refund_date: Date; refund_date: Date;
@Column('decimal', { name: 'refund_sub_total', nullable: true })
refund_sub_total: number;
@Column('decimal', { name: 'refund_total', nullable: true }) @Column('decimal', { name: 'refund_total', nullable: true })
refund_total: number; refund_total: number;

View File

@ -6,6 +6,7 @@ export interface RefundEntity extends BaseStatusEntity {
code: string; code: string;
request_date: Date; request_date: Date;
refund_date: Date; refund_date: Date;
refund_sub_total: number;
refund_total: number; refund_total: number;
bank_name: string; bank_name: string;

View File

@ -17,13 +17,13 @@ import { STATUS } from 'src/core/strings/constants/base.constants';
@Injectable() @Injectable()
export class CreateRefundManager extends BaseCreateManager<RefundEntity> { export class CreateRefundManager extends BaseCreateManager<RefundEntity> {
async beforeProcess(): Promise<void> { async beforeProcess(): Promise<void> {
// if (this.data.transaction?.status != STATUS.SETTLED) { if (this.data.transaction?.status != STATUS.SETTLED) {
// 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`,
// error: 'Unprocessable Entity', error: 'Unprocessable Entity',
// }); });
// } }
return; return;
} }

View File

@ -15,6 +15,13 @@ export class RefundDto extends BaseStatusDto implements RefundEntity {
@IsString() @IsString()
type: RefundType; type: RefundType;
@ApiProperty({
type: Number,
required: false,
example: 1750000,
})
refund_sub_total: number;
@ApiProperty({ @ApiProperty({
type: Number, type: Number,
example: 1750000, example: 1750000,

View File

@ -45,6 +45,7 @@ export function mappingTransaction(data) {
name: itemData.item_category_name, name: itemData.item_category_name,
}, },
}, },
id: itemData.id,
refund: itemData.refund, refund: itemData.refund,
qty: itemData.qty, qty: itemData.qty,
qty_remaining: itemData.qty_remaining, qty_remaining: itemData.qty_remaining,