[FIXED] FILENAME DEL DRIVE Y API QR

parent 31a49cfa
......@@ -124,7 +124,7 @@ public class bbvaService {
int amountsAmount = json.getInt("amount");
String amountsCurrency = "PEN";
String billMaturityDate = json.getString("maturityDate");
String originContractId = "00110661000100081541";
String originContractId = "00110161000100022636";
String productTypeId = "QR_CODE";
String additionalPaymentFieldId = "0";
String additionalPaymentFieldValue = json.getString("documentNumber");
......
......@@ -82,8 +82,10 @@ public class DriveService implements IDriveService {
InputStream inputStream = googleConfig.getDrive().files().get(file_id).executeMediaAsInputStream();
String uudi = java.util.UUID.randomUUID().toString();
String nameFile;
boolean isHasExtension = false;
try{
nameFile = System.getProperty("java.io.tmpdir") + "/" + uudi + "." + file.getName().split("\\.")[1];
isHasExtension = true;
}catch(Exception e){
nameFile = System.getProperty("java.io.tmpdir") + "/" + uudi + ".pdf";
}
......@@ -101,7 +103,7 @@ public class DriveService implements IDriveService {
return ResponseEntity.ok().body(
new JSONObject()
.put("base64", base64String)
.put("file_name", nameFile)
.put("file_name", file.getName() + (isHasExtension ? "" : ".pdf"))
.put("status", true)
.put("message", "OK").toMap()
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment