Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/full api integration #1

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ec79c7f
Start Send Transfer development
LucasSte Aug 25, 2020
cf05a43
Fixing wrong password bug
LucasSte Aug 26, 2020
9a6d66b
Read privatekey implemented
LucasSte Aug 26, 2020
4adccb2
Add externaId and description to transfer dialog
LucasSte Aug 26, 2020
e7fc131
Add privateKey check before sending transfers
LucasSte Aug 31, 2020
f475ed2
Add check privateKey before sending transfer
LucasSte Aug 31, 2020
d7d5bce
Sketch transfer
LucasSte Sep 1, 2020
8886f3e
Finish transfer
LucasSte Sep 1, 2020
eaa4223
Start Boleto payment implementation
LucasSte Sep 2, 2020
cd5dee7
Finish PayBoleto
LucasSte Sep 2, 2020
6ac4038
Implement fetch customers
LucasSte Sep 2, 2020
aa4bcdc
Start implementing createBoleto
LucasSte Sep 2, 2020
f942d46
Continue implementation of createBoleto
LucasSte Sep 3, 2020
469ae6e
Implement CreateBoleto
LucasSte Sep 4, 2020
3e69a69
Start implementation of SendTransaction
LucasSte Sep 4, 2020
9653ed5
Finish sdkSendTransfer
LucasSte Sep 8, 2020
95e3b0c
Start implementation of sdkViewChargeEvent
LucasSte Sep 8, 2020
e8fa804
Implement ViewChargeEvent
LucasSte Sep 9, 2020
99940c7
Implement createCustomers
LucasSte Sep 9, 2020
11eccc0
Implement getBalance and center spinner position
LucasSte Sep 10, 2020
729ae89
Add DigitalSignature tab to Navigation
LucasSte Sep 10, 2020
b3d84da
Refactor front end
LucasSte Sep 11, 2020
6c2337c
Implement digital signature tab
LucasSte Sep 11, 2020
7a9e147
Add goHelp funcation to navigationUtils
LucasSte Sep 14, 2020
a3e3d36
Add MAINTAINERS.md
LucasSte Sep 14, 2020
0cd761c
Fix typo on MAINTAINERS.md
LucasSte Sep 14, 2020
8ebb5bb
Fix typo on MAINTAINERS.md
LucasSte Sep 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions FormCredentials.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<body>
<div id="alert" class="alert alert-dismissible fade show alert-danger front" role="alert">
<a id="alert-message"></a>
<a class="close" data-dismiss="alert" aria-label="close" onclick="hideAlert()">&times;</a>
<button type="button" class="close" onclick="hideAlert()" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="container">
<div class="row">
<div class="col-6">
<div class="form-row">
<div class="form-group col-md-6">
<p>Ambiente</p>
Expand Down Expand Up @@ -53,9 +53,7 @@
<div class="spinner-border text-primary" role="status" style="display:none;">
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Expand All @@ -77,6 +75,7 @@

function onFailure(error) {
stopLoading();
console.log(error);
let message = JSON.parse(error["message"])["message"];
$("#alert").show();
var alertMessage = document.getElementById("alert-message");
Expand Down
174 changes: 174 additions & 0 deletions FormPayBoleto.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</head>
<body onload="init()">
<div id="alert" class="alert alert-dismissible fade show alert-danger front" role="alert">
<a id="alert-message"></a>
<button type="button" class="close" onclick="hideAlert()" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div id="alert-success" class="alert alert-dismissible fade show alert-success front" role="alert">
<a id="alert-success-message"></a>
<button type="button" class="close" onclick="hideSuccessAlert()" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="container">
<div class="form-row">
<div class="form-group col-md-6">
<p>Entre com o arquivo da chave privada.</p>
<div class="input-group mb-3">
<div class="custom-file">
<input type="file" class="custom-file-input" id="file-input" aria-describedby="inputGroupFileAddon01">
<label class="custom-file-label" for="file-input" id="file-input-label">Insira um arquivo</label>
</div>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<p>Digite sua senha</p>
<input type="password" class="form-control" id="password" placeholder="Senha">
<br>
<button type="submit" class="btn btn-primary btn-block" onclick="send()">Enviar</button>
</div>
</div>
<div class="d-flex justify-content-center">
<div class="spinner-border text-primary" role="status" style="display:none;">
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
</body>
</html>

<script>

let privateKey = "";

function startLoading() {
$('.btn').hide();
$('.spinner-border').show();
}

function stopLoading() {
$('.btn').show();
$('.spinner-border').hide();
}
function hideAlert() {
$("#alert").hide();
}

function hideSuccessAlert(){
$("#alert-success").hide();
}

function loadPrivateKey(event) {
let reader = new FileReader();
let fullPath = document.getElementById("file-input").value;
document.getElementById("file-input-label").innerHTML = fullPath.split(/(\\|\/)/g).pop();
reader.onload = function(event) {
privateKey = event.target.result;
};
reader.readAsText(event.target.files[0]);
}

function showMessage(message)
{
hideAlert();
hideSuccessAlert();
$("#alert").show();
var alertMessage = document.getElementById("alert-message");
alertMessage.innerHTML = message;
window.scrollTo(0,0);
}

function send() {
let password = document.getElementById("password").value;
let tags = null;
if(privateKey === "")
{
let message = "Por favor, insira um arquivo válido.";
showMessage(message);
privateKey = "";
document.getElementById("file-input-label").innerHTML = "Insira um arquivo";
document.getElementById("file-input").value = "";
return;
}
else{
google.script.run.withSuccessHandler(pkCheckSuccess(password, privateKey))
.withFailureHandler(pkCheckFailure)
.checkPrivateKey(privateKey);
}

}

function pkCheckSuccess(password, privateKey)
{
startLoading();
google.script.run.withSuccessHandler(onSuccess)
.withFailureHandler(onFailure)
.executeBoletoPayment(password, privateKey);
}

function pkCheckFailure()
{
let message = "Chave privada inválida. Por favor, tente outra.";
showMessage(message);
}

function onSuccess() {
stopLoading();
privateKey = "";
privateKey = "";
hideAlert();
hideSuccessAlert();
$("#alert-success").show();
var alertMessage = document.getElementById("alert-success-message");
alertMessage.innerHTML = "Pagamentos enviados com sucesso!";
window.scrollTo(0,0);
}

function onFailure(error) {
stopLoading();

try
{
let parsed = JSON.parse(error.message);
let message = parsed["message"];
if("errors" in parsed)
{
for(let suberror of parsed["errors"]) {
let suberrorMessage = suberror["message"];
let splitMessage = suberrorMessage.split(":");
splitMessage[0] = splitMessage[0].replace("Element ", "");
splitMessage[0] = "Linha " + (11 - (-splitMessage[0]));
let newMessage = splitMessage.join(":");
message += "<br>" + newMessage;
}
}
showMessage(message);

} catch(e) {
//console.log(e.message);
console.log(error);
console.log(error.message);
}
}

function init()
{
hideAlert();
hideSuccessAlert();
document.getElementById('file-input').addEventListener('change', loadPrivateKey, false);
}

</script>
44 changes: 22 additions & 22 deletions FormSelectTeam.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@
<body>
<div id="alert" class="alert alert-dismissible fade show alert-danger front" role="alert">
<a id="alert-message"></a>
<a class="close" data-dismiss="alert" aria-label="close" onclick="hideAlert()">&times;</a>
<button type="button" class="close" onclick="hideAlert()" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="container">
<div class="row">
<div class="col-6">
<div class="form-row">
<div class="form-group col-md-12">
<label>Time para Transferência:</label>
<div style="display: flex;">
<select class="form-control" id="team-selector" style="margin-right: 4px;"></select>
<div class="spinner-border text-primary mini" role="status"></div>
</div>
</div>
</div>
<button type="submit" class="btn btn-primary btn-block" onclick="save()">Enviar</button>

<div class="d-flex justify-content-center">
<div class="spinner-border text-primary" role="status" style="display:none;">
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
</div>
<div class="container">
<div class="form-row">
<br>
<div class="form-group col-md-12">
<label>Time para Transferência:</label>
<div style="display: flex;">
<select class="form-control" id="team-selector" style="margin-right: 4px;"></select>
<div class="spinner-border text-primary mini" role="status"></div>
</div>
</div>
</div>
<br>
<button type="submit" class="btn btn-primary btn-block" onclick="save()">Enviar</button>

<div class="d-flex justify-content-center">
<div class="spinner-border text-primary" role="status" style="display:none;">
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
</body>
</html>
Expand Down
Loading