modify-qris
Version:
Modify QRIS Generator is a javascript based libraries that enabling flexible payments with customizable amounts for improved efficiency and user experience
51 lines (50 loc) • 1.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.qrisEntityToString = qrisEntityToString;
/**
* Converts a QRISEntity to its string representation
* @param qris The QRIS entity to convert
* @returns A string representation of the QRIS data
*/
function qrisEntityToString(qris) {
var _a, _b, _c;
let result = ((_a = qris.version) === null || _a === void 0 ? void 0 : _a.data) + ((_b = qris.category) === null || _b === void 0 ? void 0 : _b.data);
if (qris.acquirer) {
result += qris.acquirer.data;
}
if (qris.switching) {
result += qris.switching.data;
}
if (qris.merchant_category_code) {
result += qris.merchant_category_code.data;
}
if (qris.currency_code) {
result += qris.currency_code.data;
}
if (qris.payment_amount) {
result += qris.payment_amount.data;
}
if (qris.payment_fee_category) {
result += qris.payment_fee_category.data;
}
if (qris.payment_fee) {
result += qris.payment_fee.data;
}
if (qris.country_code) {
result += qris.country_code.data;
}
if (qris.merchant_name) {
result += qris.merchant_name.data;
}
if (qris.merchant_city) {
result += qris.merchant_city.data;
}
if (qris.merchant_postal_code) {
result += qris.merchant_postal_code.data;
}
if (qris.additional_information) {
result += qris.additional_information.data;
}
result += (_c = qris.crc_code) === null || _c === void 0 ? void 0 : _c.data;
return result;
}