<?php /* @var Netopia\Netcard\Block\Qrcode $block */ $quote = $block->getQuote(); $qrcodeDta = $block->getQrcodeData(); $platform = $block->getConfigData('api/is_live') ? 3 : 4; if($qrcodeDta->errors->code === "0") { ?> <div class="" ><img src="<?php echo $this->getViewFileUrl('Netopia_Netcard::NETOPIA_Payments.svg');?>" width="134" alt="NETOPIA Payments>"/><h1 class=""><span class="" ><?= __('Please, scan the "Qr Code" with your mobilPay WALLET') ?></span></h1></div><?php if(isset($qrcodeDta->transaction->id)) { ?> <div class="" id="orderId" data-order=<?php echo $qrcodeDta->order->id ?>><img src="https://secure.mobilpay.ro/default/index/qr/id/<?=$qrcodeDta->transaction->id;?>/type/<?=$platform;?>" alt="Qrcode mobilPay WALLET" width="200" height="200"></div><div class="title"><span class="title">Your order status : <strong><span id="orderStatus">-</span></strong></span></div><div id="orderSummery" style="display: none;"><span class="title">Your order number : <strong><?=$qrcodeDta->order->id;?></strong></span> <br> <span class="title">Your total paid amount : <strong><?=$qrcodeDta->order->amount;?> <?=$qrcodeDta->order->currency;?></strong></span></div><div id="continueShopping" class="actions-toolbar" style="display: none;"><div class="primary"><a class="action primary continue" href="<?php /* @escapeNotVerified */ echo $block->getUrl() ?>"><span><?php /* @escapeNotVerified */ echo __('Continue Shopping') ?></span></a></div></div><script>
            window.onload = (event) => {
              
              console.log( "Timer Start" );
              setInterval(function () {
                    var xmlhttp = new XMLHttpRequest();
                    let orderId = document.getElementById('orderId').getAttribute('data-order');
                    xmlhttp.onreadystatechange = function() {
                       if (this.readyState == 4 && this.status == 200) {
                            if (this.responseText == "complete") {
                                document.getElementById("orderStatus").innerHTML = "este finalizata cu succes";
                                document.getElementById("orderSummery").style.display = "block";
                                document.getElementById("continueShopping").style.display = "block";
                            }else if (this.responseText == "canceled"){
                                document.getElementById("orderStatus").innerHTML = "este anulata";
                                document.getElementById("continueShopping").style.display = "block";
                            }else if (this.responseText == "payment_review"){
                                document.getElementById("orderStatus").innerHTML = "este in curs de procesare";
                            }else if (this.responseText == "fraud"){
                                document.getElementById("orderStatus").innerHTML = "nu va fi procesata";
                            }else if (this.responseText == "processing"){
                                document.getElementById("orderStatus").innerHTML = "se proceseaza.(Scanati codul QR)";
                            }
                        }
                    };
                    xmlhttp.open("GET", window.location.origin + "/netopia/payment/status?id=" + orderId, true);
                    xmlhttp.send();
                }, 5000);
             };</script><?php } } else { $msg = (isset($qrcodeDta->errors->message) && !is_null($qrcodeDta->errors->message)) ? $qrcodeDta->errors->message : ""; echo '<div class=""><img src="'.$this->getViewFileUrl('Netopia_Netcard::NETOPIA_Payments.svg').'" width="134" alt="NETOPIA Payments>"/><h1 class=""><span class="" >A aparut o eroare</span></h1><p>'.$msg.'</p></div>'; } ?>