21 lines
543 B
JavaScript
21 lines
543 B
JavaScript
export default function qr(amount, qrVars = {}) {
|
|
const defaultQRVars = {
|
|
bankId: "BIDV",
|
|
accountNo: "1222198820",
|
|
accountName: "Nguyen Viet An",
|
|
template: "Rxp4lcv",
|
|
description: "Thanh toan ERP",
|
|
};
|
|
|
|
const finalVars = {
|
|
...defaultQRVars,
|
|
...qrVars,
|
|
};
|
|
|
|
const { bankId, accountNo, template, description, accountName } = finalVars;
|
|
|
|
const qrSrc = `https://img.vietqr.io/image/${bankId}-${accountNo}-${template}.png?amount=${amount}&addInfo=${description}&accountName=${accountName}`;
|
|
|
|
return qrSrc;
|
|
}
|