Fixed checks on currentPassType

This commit is contained in:
Alexander Cerutti
2023-07-29 13:39:20 +02:00
parent 173acb30cb
commit 58c7e11d7a

View File

@@ -40,9 +40,7 @@ exports.pass = functions.https.onRequest(async (request, response) => {
}, },
); );
let currentPassType = request.body.passType; if (newPass.type == "boardingPass") {
if (currentPassType == "boardingPass") {
newPass.transitType = `PKTransitType${request.body.transitType}`; newPass.transitType = `PKTransitType${request.body.transitType}`;
} }
@@ -89,7 +87,7 @@ exports.pass = functions.https.onRequest(async (request, response) => {
key: `primary${i}`, key: `primary${i}`,
label: field.label, label: field.label,
value: value:
currentPassType == "boardingPass" newPass.type == "boardingPass"
? field.value.toUpperCase() ? field.value.toUpperCase()
: field.value, : field.value,
}); });
@@ -153,7 +151,7 @@ exports.pass = functions.https.onRequest(async (request, response) => {
} }
// Downloading thumbnail and logo files from Firebase Storage and adding to pass // Downloading thumbnail and logo files from Firebase Storage and adding to pass
if (currentPassType == "generic" || currentPassType == "eventTicket") { if (newPass.type == "generic" || newPass.type == "eventTicket") {
const thumbnailFile = request.body.thumbnailFile; const thumbnailFile = request.body.thumbnailFile;
const tempPath1 = path.join(os.tmpdir(), thumbnailFile); const tempPath1 = path.join(os.tmpdir(), thumbnailFile);
try { try {