Subversion Repositories SmartDukaan

Rev

Rev 12997 | Rev 13013 | 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,
21
      seconds: 60,
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",
35
        url: "/recharge-status?rechargeOrderId=<?php echo substr($recharge_orderconfirmation[0]->response->rechargeDisplayId,4);?>&isFinal=true",
36
        success: function(response) {},
37
        error: function() {}
38
      });
39
      window.setTimeout(reload, 5000);
40
    }
41
 
42
    function checkUnknownTransactions() {
43
      jQuery.ajax({
44
        type: "GET",
45
        url: "/recharge-status?rechargeOrderId=<?php echo substr($recharge_orderconfirmation[0]->response->rechargeDisplayId,4);?>&isFinal=false",
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')) {
52
            if (callCounter < 4) {
53
              window.setTimeout(checkUnknownTransactions, 5000);
54
            }
55
          }
56
        },
57
        error: function() {
58
          incrementCounter();
59
          if ($('#countdown').is(':visible')) {
60
            if (callCounter < 4) {
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;
12524 anikendra 110
/*
12084 lgm 111
    _gaq.push(['_addTrans',
112
      orderId,                     // Transaction ID. Required.
113
      'Saholic',   // Affiliation or store name.
114
      amount,               // Grand Total.
115
      '0',                  // Shipping.
116
      '0',                     // Tax.
117
      "",
118
      "",
119
      "India"
120
    ]);
121
    _gaq.push(['_addItem',
122
      orderId,                     // Transaction ID. Required.     
123
      deviceNumber,                 // SKU/code.
124
      orderConfirmation['response'].rechargeProvider,    // Product name. Required.
125
      'Digital',         // Category or variation.
126
      amount,                 // Unit price.
127
      '1'                   // Quantity.
128
    ]);
129
     _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
12524 anikendra 130
*/
131
	ga('ecommerce:addTransaction', {
132
	  'id': orderId,                     // Transaction ID. Required
133
	  'affiliation': 'Saholic',   // Affiliation or store name
134
	  'revenue': amount,               // Grand Total
135
	  'shipping': '0',                  // Shipping
136
	  'tax': '0'                     // Tax
137
	});
138
	// addItem should be called for every item in the shopping cart.
139
	ga('ecommerce:addItem', {
140
	  'id': orderId,                     // Transaction ID. Required
12528 anikendra 141
	  'sku': deviceNumber,                    // SKU/code
142
	  'name': orderConfirmation['response'].rechargeProvider,                // Product name. Required
12524 anikendra 143
	  'category': 'Digital',       // Category or variation
144
	  'price': amount,                 // Unit price
145
	  'quantity': '1'                   // Quantity
146
	});
147
	ga('ecommerce:send');      // Send transaction and item data to Google Analytics.
12084 lgm 148
  }
149
  var pheight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
150
  var value = localStorage.getItem('rechargeValue');
10582 lgm 151
  if(parseInt(value) == 1){
12524 anikendra 152
	ga('send', 'event', 'Recharge', 'Recharge Result','Mobile-Result');
153
    	/*if(typeof _gaq != "undefined" && _gaq != null)  {
11024 lgm 154
        _gaq.push(['_trackEvent', 'Recharge', 'Recharge Result','Mobile-Result']);
12524 anikendra 155
      } */
10582 lgm 156
  }else if(parseInt(value) == 2){
12524 anikendra 157
    	/*if(typeof _gaq != "undefined" && _gaq != null)  {
11024 lgm 158
        _gaq.push(['_trackEvent', 'Recharge', 'Recharge Result','Recharge-Result']);
12524 anikendra 159
      } */
160
	ga('send', 'event', 'Recharge', 'Recharge Result','Recharge-Result');
10582 lgm 161
  }
11342 lgm 162
  // if(document.getElementsByClassName('order-conf')[0] != undefined){
163
  //     document.getElementsByClassName('order-conf')[0].style.minHeight = pheight - 153 +'px';  
164
  // }
10582 lgm 165
</script>