feat: fixed midtrans
parent
be7c74ec72
commit
ab903d4554
|
@ -11,7 +11,6 @@ import { TransactionChangeStatusEvent } from '../../entities/event/transaction-c
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
||||||
import { generateInvoiceCodeHelper } from '../managers/helpers/generate-invoice-code.helper';
|
import { generateInvoiceCodeHelper } from '../managers/helpers/generate-invoice-code.helper';
|
||||||
import { apm } from 'src/core/apm';
|
|
||||||
|
|
||||||
@EventsHandler(MidtransCallbackEvent)
|
@EventsHandler(MidtransCallbackEvent)
|
||||||
export class MidtransCallbackHandler
|
export class MidtransCallbackHandler
|
||||||
|
@ -23,11 +22,6 @@ export class MidtransCallbackHandler
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async handle(event: MidtransCallbackEvent) {
|
async handle(event: MidtransCallbackEvent) {
|
||||||
const apmTransactions = apm.startTransaction(
|
|
||||||
`callback-midtrans`,
|
|
||||||
'handler',
|
|
||||||
);
|
|
||||||
|
|
||||||
const data_id = event.data.id;
|
const data_id = event.data.id;
|
||||||
const data = event.data.data;
|
const data = event.data.data;
|
||||||
let old_data = undefined;
|
let old_data = undefined;
|
||||||
|
@ -39,8 +33,6 @@ export class MidtransCallbackHandler
|
||||||
});
|
});
|
||||||
old_data = _.cloneDeep(transaction);
|
old_data = _.cloneDeep(transaction);
|
||||||
|
|
||||||
apmTransactions.setLabel('status', data.transaction_status);
|
|
||||||
|
|
||||||
if (['capture', 'settlement'].includes(data.transaction_status)) {
|
if (['capture', 'settlement'].includes(data.transaction_status)) {
|
||||||
Object.assign(transaction, {
|
Object.assign(transaction, {
|
||||||
status: STATUS.SETTLED,
|
status: STATUS.SETTLED,
|
||||||
|
@ -91,7 +83,5 @@ export class MidtransCallbackHandler
|
||||||
op: OPERATION.UPDATE,
|
op: OPERATION.UPDATE,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
apmTransactions.end();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue