fix(refund) perbaikan data refund
continuous-integration/drone/tag Build is passing
Details
continuous-integration/drone/tag Build is passing
Details
parent
eafd815463
commit
b574d3a39d
|
@ -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"`);
|
||||
}
|
||||
|
||||
}
|
|
@ -27,6 +27,9 @@ export class RefundModel
|
|||
@Column('date', { name: 'refund_date', nullable: true })
|
||||
refund_date: Date;
|
||||
|
||||
@Column('decimal', { name: 'refund_sub_total', nullable: true })
|
||||
refund_sub_total: number;
|
||||
|
||||
@Column('decimal', { name: 'refund_total', nullable: true })
|
||||
refund_total: number;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ export interface RefundEntity extends BaseStatusEntity {
|
|||
code: string;
|
||||
request_date: Date;
|
||||
refund_date: Date;
|
||||
refund_sub_total: number;
|
||||
refund_total: number;
|
||||
|
||||
bank_name: string;
|
||||
|
|
|
@ -17,13 +17,13 @@ import { STATUS } from 'src/core/strings/constants/base.constants';
|
|||
@Injectable()
|
||||
export class CreateRefundManager extends BaseCreateManager<RefundEntity> {
|
||||
async beforeProcess(): Promise<void> {
|
||||
// if (this.data.transaction?.status != STATUS.SETTLED) {
|
||||
// throw new UnprocessableEntityException({
|
||||
// statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
||||
// message: `Failed! only transaction with status ${STATUS.SETTLED} can be refund`,
|
||||
// error: 'Unprocessable Entity',
|
||||
// });
|
||||
// }
|
||||
if (this.data.transaction?.status != STATUS.SETTLED) {
|
||||
throw new UnprocessableEntityException({
|
||||
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
|
||||
message: `Failed! only transaction with status ${STATUS.SETTLED} can be refund`,
|
||||
error: 'Unprocessable Entity',
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,13 @@ export class RefundDto extends BaseStatusDto implements RefundEntity {
|
|||
@IsString()
|
||||
type: RefundType;
|
||||
|
||||
@ApiProperty({
|
||||
type: Number,
|
||||
required: false,
|
||||
example: 1750000,
|
||||
})
|
||||
refund_sub_total: number;
|
||||
|
||||
@ApiProperty({
|
||||
type: Number,
|
||||
example: 1750000,
|
||||
|
|
|
@ -45,6 +45,7 @@ export function mappingTransaction(data) {
|
|||
name: itemData.item_category_name,
|
||||
},
|
||||
},
|
||||
id: itemData.id,
|
||||
refund: itemData.refund,
|
||||
qty: itemData.qty,
|
||||
qty_remaining: itemData.qty_remaining,
|
||||
|
|
Loading…
Reference in New Issue