first commit

This commit is contained in:
2026-02-18 16:03:43 +07:00
commit c52ecd6514
54 changed files with 8270 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
const MidtransConfig = require('../../config/midtrans');
const coreApi = MidtransConfig.getCoreApiClient();
class BasePaymentService {
static async charge(payload) {
try {
const response = await coreApi.charge(payload);
return response;
} catch (error) {
console.error('Midtrans Charge Error:', error.ApiResponse || error.message);
throw error;
}
}
static async getStatus(orderId) {
try {
return await coreApi.transaction.status(orderId);
} catch (error) {
throw error;
}
}
}
module.exports = BasePaymentService;