Subversion Repositories SmartDukaan

Rev

Rev 13047 | Rev 13269 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
11024 lgm 1
<?php $orderConfirmation = $recharge_orderconfirmation[0];?>
10582 lgm 2
<div class="r-hldr"> 
3
  <div class="r-head">Recharge Details</div>
4
  <div class="r-cont clearfix">
5
    <div>Order Id</div>
6
    <div><?php echo $recharge_orderconfirmation[0]->response->rechargeDisplayId; ?></div>
7
  </div>
8
  <div class="r-cont clearfix">
9
    <div>Status</div>
10
    <div><?php echo $recharge_orderconfirmation[0]->response->rechargeStatus; ?></div>
12990 anikendra 11
<?php if(isset($recharge_orderconfirmation[0]->response->isOperatorAsynchronous) && $recharge_orderconfirmation[0]->response->isOperatorAsynchronous ==1):?>
12
<div id="countdown" style="margin:10px auto;display:block;"></div>
12997 anikendra 13
<div id="rechargestatus"><?php echo $orderConfirmation->response->detailDisplayMessage;?></div>
12990 anikendra 14
	<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
13010 anikendra 15
  <script src="/assets/js/jquery.countdown360.js" type="text/javascript" charset="utf-8"></script>
12990 anikendra 16
 
13010 anikendra 17
  <script type="text/javascript" charset="utf-8">
18
    var callCounter = 0;
19
    $("#countdown").countdown360({
20
      radius: 50,
13266 amit.gupta 21
      seconds: 90,
13010 anikendra 22
      fontColor: 'white',
23
      fillStyle: '#6699ff',
24
      strokeStyle: '#F6F47A',
25
      autostart: true,
26
      onComplete: function() {
27
        hideCountDown()
28
      }
29
    })
30
 
31
    function hideCountDown() {
32
      $('#countdown').hide();
33
      jQuery.ajax({
34
        type: "GET",
13013 anikendra 35
        url: "/recharge-status?rechargeOrderId=<?php echo substr($recharge_orderconfirmation[0]->response->rechargeDisplayId,4);?>&finalCall=true",
13010 anikendra 36
        success: function(response) {},
37
        error: function() {}
38
      });
39
      window.setTimeout(reload, 5000);
40
    }
41
 
42
    function checkUnknownTransactions() {
43
      jQuery.ajax({
44
        type: "GET",
13046 anikendra 45
        url: "/recharge-status?rechargeOrderId=<?php echo substr($recharge_orderconfirmation[0]->response->rechargeDisplayId,4);?>&finalCall=false",
13010 anikendra 46
        success: function(response) {
47
          if (response == 'RECHARGE_SUCCESSFUL' || response == 'RECHARGE_FAILED' || response == 'PAYMENT_SUCCESSFUL') {
48
            reload();
49
          }
50
          incrementCounter();
51
          if ($('#countdown').is(':visible')) {
13047 anikendra 52
            if (callCounter < 3) {
13010 anikendra 53
              window.setTimeout(checkUnknownTransactions, 5000);
54
            }
55
          }
56
        },
57
        error: function() {
58
          incrementCounter();
59
          if ($('#countdown').is(':visible')) {
13047 anikendra 60
            if (callCounter < 3) {
13010 anikendra 61
              window.setTimeout(checkUnknownTransactions, 5000);
62
            }
63
          }
12990 anikendra 64
        }
13010 anikendra 65
      });
66
    }
67
 
68
    function incrementCounter() {
69
      callCounter++;
70
    }
71
 
72
    function reload() {
73
      location.reload();
74
    }
12990 anikendra 75
</script>
76
<script type="text/javascript">
77
  $(function(){
13010 anikendra 78
    if ($('#countdown').is(':visible')){  
79
    window.setTimeout(checkUnknownTransactions, 40000);
80
  }
81
  });
12990 anikendra 82
</script>
13010 anikendra 83
 
12990 anikendra 84
<?php endif;?>
85
 
10582 lgm 86
  </div>
87
  <div class="r-info">
88
    <div class="r-info-head clearfix">
10939 lgm 89
      <?php if(strpos($recharge_orderconfirmation[0]->response->rechargeDisplayId, 'DTH') !== false){?>
90
      <div>Account Number</div>
91
      <?php } else{?>
92
      <div>Mobile Number</div><?php } ?>
10582 lgm 93
      <div>Operator</div>
94
      <div>Amount</div>
95
    </div>
96
    <div class="r-info-body clearfix">
97
      <div><?php echo $recharge_orderconfirmation[0]->response->rechargeDeviceNumber ?></div>
98
      <div><?php echo $recharge_orderconfirmation[0]->response->rechargeProvider ?></div>
99
      <div><?php echo $recharge_orderconfirmation[0]->response->totalAmount ?></div>
100
    </div>
101
  </div><!--o-info-->
102
 
103
</div><!--o-hldr-->
104
<script type="text/javascript">
12084 lgm 105
  var orderConfirmation = <?php echo json_encode($orderConfirmation);?>;
106
  if(orderConfirmation != undefined){
107
    var amount = parseFloat(orderConfirmation['response'].totalAmount).toFixed(2);
108
    var orderId = orderConfirmation['response'].rechargeDisplayId;
109
    var deviceNumber = orderConfirmation['response'].rechargeDeviceNumber;
13046 anikendra 110
 
12524 anikendra 111
	ga('ecommerce:addTransaction', {
112
	  'id': orderId,                     // Transaction ID. Required
113
	  'affiliation': 'Saholic',   // Affiliation or store name
114
	  'revenue': amount,               // Grand Total
115
	  'shipping': '0',                  // Shipping
116
	  'tax': '0'                     // Tax
117
	});
118
	// addItem should be called for every item in the shopping cart.
119
	ga('ecommerce:addItem', {
120
	  'id': orderId,                     // Transaction ID. Required
12528 anikendra 121
	  'sku': deviceNumber,                    // SKU/code
122
	  'name': orderConfirmation['response'].rechargeProvider,                // Product name. Required
12524 anikendra 123
	  'category': 'Digital',       // Category or variation
124
	  'price': amount,                 // Unit price
125
	  'quantity': '1'                   // Quantity
126
	});
127
	ga('ecommerce:send');      // Send transaction and item data to Google Analytics.
12084 lgm 128
  }
129
  var pheight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
130
  var value = localStorage.getItem('rechargeValue');
10582 lgm 131
  if(parseInt(value) == 1){
13046 anikendra 132
	 ga('send', 'event', 'Recharge', 'Recharge Result','Mobile-Result');
133
  }else if(parseInt(value) == 2){    
134
	 ga('send', 'event', 'Recharge', 'Recharge Result','Recharge-Result');
10582 lgm 135
  }
11342 lgm 136
  // if(document.getElementsByClassName('order-conf')[0] != undefined){
137
  //     document.getElementsByClassName('order-conf')[0].style.minHeight = pheight - 153 +'px';  
138
  // }
13046 anikendra 139
</script>