feat: Remove console logs from Mandiri payment processing functions
This commit is contained in:
parent
e76b1426c1
commit
b26494d147
|
|
@ -112,7 +112,6 @@ export async function createSignature({
|
||||||
pattern: string;
|
pattern: string;
|
||||||
passphrase?: string;
|
passphrase?: string;
|
||||||
}) {
|
}) {
|
||||||
console.log(data);
|
|
||||||
if (data?.accesstoken) {
|
if (data?.accesstoken) {
|
||||||
const session = await db.sessions.findFirst({
|
const session = await db.sessions.findFirst({
|
||||||
where: { token_hash: hashToken(data.accesstoken) },
|
where: { token_hash: hashToken(data.accesstoken) },
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,7 @@ export default async function ({ data }: { data: any }) {
|
||||||
Private_Key: getParameter(user, "private_key") || "",
|
Private_Key: getParameter(user, "private_key") || "",
|
||||||
};
|
};
|
||||||
const mandiriUrl = String(get(user, "endpoint") || process.env.PAYMENT_URL);
|
const mandiriUrl = String(get(user, "endpoint") || process.env.PAYMENT_URL);
|
||||||
console.log({
|
|
||||||
headers,
|
|
||||||
url: `${mandiriUrl}/api/v1.0/utilities/signature-auth`,
|
|
||||||
});
|
|
||||||
const resp = await axios.post(
|
const resp = await axios.post(
|
||||||
`${mandiriUrl}/api/v1.0/utilities/signature-auth`,
|
`${mandiriUrl}/api/v1.0/utilities/signature-auth`,
|
||||||
{},
|
{},
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,6 @@ export default async function ({
|
||||||
AccessToken: accessToken,
|
AccessToken: accessToken,
|
||||||
};
|
};
|
||||||
const mandiriUrl = String(get(user, "endpoint") || process.env.PAYMENT_URL);
|
const mandiriUrl = String(get(user, "endpoint") || process.env.PAYMENT_URL);
|
||||||
console.log({
|
|
||||||
url: `${mandiriUrl}/api/v1.0/utilities/signature-service`,
|
|
||||||
headers,
|
|
||||||
body: { ...get(data, "body", {}) },
|
|
||||||
});
|
|
||||||
const resp = await axios.post(
|
const resp = await axios.post(
|
||||||
`${mandiriUrl}/api/v1.0/utilities/signature-service`,
|
`${mandiriUrl}/api/v1.0/utilities/signature-service`,
|
||||||
{ ...get(data, "body", {}) },
|
{ ...get(data, "body", {}) },
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ export default async function ({
|
||||||
session: any;
|
session: any;
|
||||||
data: any;
|
data: any;
|
||||||
}) {
|
}) {
|
||||||
console.log(user);
|
|
||||||
// sample implementation — adapt to real bank payload and API calls
|
// sample implementation — adapt to real bank payload and API calls
|
||||||
const { invoiceId } = data || {};
|
const { invoiceId } = data || {};
|
||||||
if (!user.database) throw new Error("User database information is missing");
|
if (!user.database) throw new Error("User database information is missing");
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,7 @@ export default async function ({
|
||||||
.replace("{accesstoken}", get(data, "accesstoken"))
|
.replace("{accesstoken}", get(data, "accesstoken"))
|
||||||
.replace("{requestbody}", hashBody)
|
.replace("{requestbody}", hashBody)
|
||||||
.replace("{timestamp}", get(data, "timestamp"));
|
.replace("{timestamp}", get(data, "timestamp"));
|
||||||
console.log(stringToSign);
|
|
||||||
const pathPublicKey = user.public_key_file;
|
const pathPublicKey = user.public_key_file;
|
||||||
console.log(user);
|
|
||||||
if (!pathPublicKey) {
|
if (!pathPublicKey) {
|
||||||
throw new Error("No public key file associated with the user");
|
throw new Error("No public key file associated with the user");
|
||||||
}
|
}
|
||||||
|
|
@ -63,11 +61,7 @@ export default async function ({
|
||||||
throw new Error("Public key file not found");
|
throw new Error("Public key file not found");
|
||||||
}
|
}
|
||||||
const cerPem = readCertAsPEM(fullPath);
|
const cerPem = readCertAsPEM(fullPath);
|
||||||
console.log({
|
|
||||||
stringToVerify: stringToSign,
|
|
||||||
signatureBase64: get(data, "signature"),
|
|
||||||
certPem: cerPem,
|
|
||||||
});
|
|
||||||
const result = verifyRsaSignature({
|
const result = verifyRsaSignature({
|
||||||
stringToVerify: stringToSign,
|
stringToVerify: stringToSign,
|
||||||
signatureBase64: get(data, "signature"),
|
signatureBase64: get(data, "signature"),
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ export async function vaMiddleware(
|
||||||
typeVerify: "transaction",
|
typeVerify: "transaction",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log({ result });
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return res.status(401).json({
|
return res.status(401).json({
|
||||||
responseCode: "4012400",
|
responseCode: "4012400",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue