Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from revosystems/hotfix/parseIdOperErrors
Browse files Browse the repository at this point in the history
Fix idOper parse.
  • Loading branch information
PauBenetPrat authored Nov 18, 2021
2 parents ddb267c + 6ccb853 commit 55fb513
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions src/resources/views/redsys/main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
</div>

@livewire('redsys-form', [
'redsysFormId' => $redsysFormId,
'customerToken' => $customerToken,
'hasCards' => $cards->isNotEmpty(),
'paymentReference' => $paymentReference,
'price' => $chargePayment->price->format()
'redsysFormId' => $redsysFormId,
'customerToken' => $customerToken,
'hasCards' => $cards->isNotEmpty(),
'paymentReference' => $paymentReference,
'price' => $chargePayment->price->format()
])

@livewire('check-status', compact('paymentReference'))
Expand Down Expand Up @@ -57,7 +57,7 @@ function showError(message) {
document.getElementById("errorContainer").classList.remove('hidden')
setTimeout(function () {
document.getElementById("errorContainer").classList.add('hidden')
}, 3000);
}, 3400);
}
function onTokenizedCardPressed(cardId) {
Expand Down Expand Up @@ -111,13 +111,28 @@ function submitChallengeForm() {
window.addEventListener("message", function receiveMessage(event) {
// Redsys iframe available method to validate card submitted event was received
storeIdOper(event, "token", "errorCode", function merchantValidation() { return true });
if (event.data.error || event.data.idOper === "-1") {
showError(redsysErrors[event.data.error] ?? 'Redsys error');
if (event.data.error) {
let errorMessage = redsysErrors[event.data.error];
if (! errorMessage) {
console.log("Unknown error: " + event.data.error)
return;
}
showError(errorMessage);
return;
}
let idOper = event.data.idOper;
if (! idOper) {
return;
}
if (event.data.idOper && event.data.idOper !== "-1") {
window.livewire.emit('onCardFormSubmit', event.data.idOper, browserData())
if (idOper === "-1") {
showError('Id de pedido duplicado');
setTimeout(function () {
location.reload();
}, 3000)
return;
}
window.livewire.emit('onCardFormSubmit', idOper, browserData())
});
document.addEventListener("DOMContentLoaded", function(event) {
Expand Down

0 comments on commit 55fb513

Please sign in to comment.