fixing: check bill
This commit is contained in:
parent
0f0d80f118
commit
9ee5b65dfc
|
@ -13,9 +13,12 @@ export class CheckBillHistory extends BaseModel {
|
|||
@Column()
|
||||
partner_trx_id: string;
|
||||
|
||||
@Column()
|
||||
@Column({ nullable: true })
|
||||
amount: number;
|
||||
|
||||
@Column({ nullable: true })
|
||||
admin_price: number;
|
||||
|
||||
@Column({
|
||||
type: 'uuid',
|
||||
nullable: true,
|
||||
|
|
|
@ -54,7 +54,31 @@ export class PpobCallbackController {
|
|||
console.log(typeof response['message'], "INI DIA")
|
||||
|
||||
if (response['message'].includes('CEK TAGIHAN')) {
|
||||
console.log("messagenya tuh",response['message'])
|
||||
|
||||
if (response['status'] != 20) {
|
||||
//TODO: UPDATE GAGAL
|
||||
const updateTransaction =
|
||||
await this.transactionService.callbackOrderFailed(
|
||||
response['refid'],
|
||||
response,
|
||||
);
|
||||
|
||||
return {
|
||||
updateTransaction,
|
||||
statusCode: HttpStatus.BAD_REQUEST,
|
||||
message: 'failed to proccess',
|
||||
};
|
||||
}
|
||||
|
||||
const splitMessage = response['message'].split('","');
|
||||
console.log("masuk sini")
|
||||
//TODO: UPDATE BERHASIL
|
||||
await this.transactionService.updateBill(
|
||||
response['refid'],
|
||||
splitMessage[3].replace(/^\D+/g, ''),
|
||||
splitMessage[4].replace(/^\D+/g, ''),
|
||||
);
|
||||
//
|
||||
} else {
|
||||
if (response['status'] != 20) {
|
||||
//TODO: UPDATE GAGAL
|
||||
|
|
|
@ -488,7 +488,7 @@ export class TransactionService {
|
|||
id: orderTransactionDto.bill_trx_id
|
||||
},
|
||||
});
|
||||
product_price.price = billId.amount
|
||||
product_price.price = billId.amount;
|
||||
} catch (e) {
|
||||
if (e instanceof EntityNotFoundError) {
|
||||
throw new HttpException(
|
||||
|
@ -533,7 +533,7 @@ export class TransactionService {
|
|||
if (supplier.code != 'IRS') {
|
||||
const parsingResponse = hitSupplier.split(' ');
|
||||
hitSupplier = {
|
||||
success: hitSupplier.include('diproses'),
|
||||
success: hitSupplier.includes('diproses'),
|
||||
harga: parseInt(
|
||||
parsingResponse[parsingResponse.length - 2].replaceAll('.', ''),
|
||||
),
|
||||
|
@ -723,7 +723,7 @@ export class TransactionService {
|
|||
if (supplier.code != 'IRS') {
|
||||
const parsingResponse = hitSupplier.split(' ');
|
||||
hitSupplier = {
|
||||
success: hitSupplier.include('diproses'),
|
||||
success: hitSupplier.includes('diproses'),
|
||||
harga: parseInt(
|
||||
parsingResponse[parsingResponse.length - 2].replaceAll('.', ''),
|
||||
),
|
||||
|
@ -853,8 +853,9 @@ export class TransactionService {
|
|||
supplier,
|
||||
);
|
||||
const parsingResponse = hitSupplier.split(' ');
|
||||
console.log(hitSupplier,"ini dia")
|
||||
hitSupplier = {
|
||||
success: hitSupplier.include('diproses'),
|
||||
success: hitSupplier.includes('diproses'),
|
||||
msg: hitSupplier,
|
||||
};
|
||||
|
||||
|
@ -1779,4 +1780,16 @@ export class TransactionService {
|
|||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
async updateBill(trxId: string, amount: number, admin: number) {
|
||||
await this.checkBillHistoryRepository.update(
|
||||
{
|
||||
trx_id: trxId,
|
||||
},
|
||||
{
|
||||
amount: amount,
|
||||
admin_price: admin,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user