pp_pro_iframe_order.twig (12551B)
1 <h2>{{ text_payment_info }}</h2> 2 <table class="table table-striped table-bordered"> 3 <tr> 4 <td>{{ text_capture_status }}</td> 5 <td id="capture_status">{{ paypal_order.capture_status }}</td> 6 </tr> 7 <tr> 8 <td>{{ text_amount_auth }}</td> 9 <td>{{ paypal_order.total }} 10 {% if paypal_order.capture_status != 'Complete' %} 11 <a onclick="doVoid();" id="button-void" class="button paypal_capture btn btn-primary">{{ button_void }}</a> <span class="btn btn-primary" id="img_loading_void" style="display:none;"><i class="fa fa-circle-o-notch fa-spin fa-lg"></i></span> 12 {% endif %}</td> 13 </tr> 14 <tr> 15 <td>{{ text_amount_captured }}</td> 16 <td id="paypal_captured">{{ paypal_order.captured }}</td> 17 </tr> 18 <tr> 19 <td>{{ text_amount_refunded }}</td> 20 <td id="paypal_refunded">{{ paypal_order.refunded }}</td> 21 </tr> 22 {% if paypal_order.capture_status != 'Complete' %} 23 <tr class="paypal_capture"> 24 <td>{{ text_capture_amount }}</td> 25 <td><p> 26 <input type="checkbox" name="paypal_capture_complete" id="paypal_capture_complete" value="1"/> 27 {{ text_complete_capture }}</p> 28 <p> 29 <input type="text" size="10" id="paypal_capture_amount" value="{{ paypal_order.remaining }}"/> 30 <a class="btn btn-primary" onclick="capture();" id="button-capture">{{ button_capture }}</a> <span class="btn btn-primary" id="img_loading_capture" style="display:none;"><i class="fa fa-circle-o-notch fa-spin fa-lg"></i></span> </p></td> 31 </tr> 32 {% endif %} 33 {% if paypal_order.capture_status != 'Complete' %} 34 <tr> 35 <td>{{ text_reauthorise }}</td> 36 <td><a id="button-reauthorise" onclick="reauthorise()" class="btn btn-primary">{{ button_reauthorise }}</a></td> 37 </tr> 38 {% endif %} 39 <tr> 40 <td>{{ text_transactions }}:</td> 41 <td><table class="table table-striped table-bordered" id="paypal_transactions"> 42 <thead> 43 <tr> 44 <td class="text-left"><strong>{{ column_trans_id }}</strong></td> 45 <td class="text-left"><strong>{{ column_amount }}</strong></td> 46 <td class="text-left"><strong>{{ column_type }}</strong></td> 47 <td class="text-left"><strong>{{ column_status }}</strong></td> 48 <td class="text-left"><strong>{{ column_pending_reason }}</strong></td> 49 <td class="text-left"><strong>{{ column_date_added }}</strong></td> 50 <td class="text-left"><strong>{{ column_action }}</strong></td> 51 </tr> 52 </thead> 53 <tbody> 54 {% for transaction in transactions %} 55 <tr> 56 <td class="text-left">{{ transaction.transaction_id }}</td> 57 <td class="text-left">{{ transaction.amount }}</td> 58 <td class="text-left">{{ transaction.payment_type }}</td> 59 <td class="text-left">{{ transaction.payment_status }}</td> 60 <td class="text-left">{{ transaction.pending_reason }}</td> 61 <td class="text-left">{{ transaction.date_added }}</td> 62 <td class="text-left">{% if transaction.transaction_id %} 63 <a href="{{ transaction.view }}">{{ text_view }}</a> 64 {% if transaction.payment_type == 'instant' and (transaction.payment_status == 'Completed' or transaction.payment_status == 'Partially-Refunded') %} 65 <a href="{{ transaction.refund }}">{{ text_refund }}</a> 66 {% endif %} 67 {% else %} 68 <a onclick="resendTransaction(this); return false;" href="{{ transaction.resend }}">{{ text_resend }}</a> 69 {% endif %}</td> 70 </tr> 71 {% endfor %} 72 </tbody> 73 </table></td> 74 </tr> 75 </table> 76 <script type="text/javascript"><!-- 77 function capture() { 78 var amt = $('#paypal_capture_amount').val(); 79 80 if (amt == '' || amt == 0) { 81 alert('{{ error_capture }}'); 82 return false; 83 } else { 84 var captureComplete; 85 var voidTransaction = false; 86 87 if ($('#paypal_capture_complete').prop('checked') == true) { 88 captureComplete = 1; 89 } else { 90 captureComplete = 0; 91 } 92 93 $.ajax({ 94 type:'POST', 95 dataType: 'json', 96 data: {'amount':amt,'order_id':{{ order_id }},'complete':captureComplete}, 97 url: 'index.php?route=extension/payment/pp_pro_iframe/capture&user_token={{ user_token }}', 98 beforeSend: function() { 99 $('#button-capture').hide(); 100 $('#img_loading_capture').show(); 101 }, 102 success: function(data) { 103 if (data.error == false) { 104 html = ''; 105 106 html += '<tr>'; 107 html += '<td class="text-left">' + data.data.transaction_id + '</td>'; 108 html += '<td class="text-left">' + data.data.amount + '</td>'; 109 html += '<td class="text-left">' + data.data.payment_type + '</td>'; 110 html += '<td class="text-left">' + data.data.payment_status + '</td>'; 111 html += '<td class="text-left">' + data.data.pending_reason + '</td>'; 112 html += '<td class="text-left">' + data.data.date_added + '</td>'; 113 html += '<td class="text-left">'; 114 html += '<a href="{{ view_link }}&transaction_id=' + data.data.transaction_id + '">{{ text_view }}</a>'; 115 html += ' <a href="{{ refund_link }}&transaction_id=' + data.data.transaction_id + '">{{ text_refund }}</a>'; 116 html += '</td>'; 117 html += '</tr>'; 118 119 $('#paypal_captured').text(data.data.captured); 120 $('#paypal_capture_amount').val(data.data.remaining); 121 $('#paypal_transactions').append(html); 122 123 if (data.data.void != '') { 124 html += '<tr>'; 125 html += ' <td class="text-left">' + data.data.void.transaction_id + '</td>'; 126 html += ' <td class="text-left">' + data.data.void.amount + '</td>'; 127 html += ' <td class="text-left">' + data.data.void.payment_type + '</td>'; 128 html += ' <td class="text-left">' + data.data.void.payment_status + '</td>'; 129 html += ' <td class="text-left">' + data.data.void.pending_reason + '</td>'; 130 html += ' <td class="text-left">' + data.data.void.date_added + '</td>'; 131 html += ' <td class="text-left"></td>'; 132 html += '</tr>'; 133 } 134 135 if (data.data.status == 1) { 136 $('#capture_status').text('{{ text_complete }}'); 137 $('.paypal_capture').hide(); 138 } 139 } 140 if (data.error == true) { 141 alert(data.msg); 142 143 if (data.failed_transaction) { 144 html = ''; 145 html += '<tr>'; 146 html += '<td class="text-left"></td>'; 147 html += '<td class="text-left">' + data.failed_transaction.amount + '</td>'; 148 html += '<td class="text-left"></td>'; 149 html += '<td class="text-left"></td>'; 150 html += '<td class="text-left"></td>'; 151 html += '<td class="text-left">' + data.failed_transaction.date_added + '</td>'; 152 html += '<td class="text-left"><a onclick="resendTransaction(this); return false;" href="{{ resend_link }}&paypal_iframe_order_transaction_id=' + data.failed_transaction.paypal_iframe_order_transaction_id + '">{{ text_resend }}</a></td>'; 153 html += '/<tr>'; 154 155 $('#paypal_transactions').append(html); 156 } 157 } 158 159 $('#button-capture').show(); 160 $('#img_loading_capture').hide(); 161 } 162 }); 163 } 164 } 165 166 function doVoid() { 167 if (confirm('{{ text_confirm_void }}')) { 168 $.ajax({ 169 type:'POST', 170 dataType: 'json', 171 data: {'order_id':{{ order_id }} }, 172 url: 'index.php?route=extension/payment/pp_pro_iframe/void&user_token={{ user_token }}', 173 beforeSend: function() { 174 $('#button-void').hide(); 175 $('#img_loading_void').show(); 176 }, 177 success: function(data) { 178 if (data.error == false) { 179 html = ''; 180 html += '<tr>'; 181 html += ' <td class="text-left"></td>'; 182 html += ' <td class="text-left"></td>'; 183 html += ' <td class="text-left"></td>'; 184 html += ' <td class="text-left">' + data.data.payment_status + '</td>'; 185 html += ' <td class="text-left"></td>'; 186 html += ' <td class="text-left">' + data.data.date_added + '</td>'; 187 html += ' <td class="text-left"></td>'; 188 html += '</tr>'; 189 190 $('#paypal_transactions').append(html); 191 $('#capture_status').text('{{ text_complete }}'); 192 $('.paypal_capture_live').hide(); 193 } 194 195 if (data.error == true) { 196 alert(data.msg); 197 } 198 199 $('#button-void').show(); 200 $('#img_loading_void').hide(); 201 } 202 }); 203 } 204 } 205 206 function reauthorise() { 207 $.ajax({ 208 type:'POST', 209 dataType: 'json', 210 data: {'order_id':{{ order_id }} }, 211 url: 'index.php?route=extension/payment/pp_pro_iframe/reauthorise&user_token={{ user_token }}', 212 beforeSend: function() { 213 $('#button-reauthorise').hide(); 214 $('.loading').remove(); 215 $('#button-reauthorise').after('<span class="btn btn-primary loading"><i class="fa fa-circle-o-notch fa-spin fa-lg"></i></span>'); 216 }, 217 success: function(data) { 218 $('.loading').remove(); 219 $('#button-reauthorise').show(); 220 221 if (data.error == false) { 222 html = ''; 223 html += '<tr>'; 224 html += '<td class="text-left">' + data.data.transaction_id + '</td>'; 225 html += '<td class="text-left">0.00</td>'; 226 html += '<td class="text-left">' + data.data.payment_type + '</td>'; 227 html += '<td class="text-left">' + data.data.payment_status + '</td>'; 228 html += '<td class="text-left">' + data.data.pending_reason + '</td>'; 229 html += '<td class="text-left">' + data.data.date_added + '</td>'; 230 html += '<td class="text-left"></td>'; 231 html += '</tr>'; 232 233 $('#paypal_transactions').append(html); 234 alert('{{ text_reauthorised }}'); 235 $('.loading').hide(); 236 } 237 238 if (data.error == true) { 239 alert(data.msg); 240 } 241 242 $('#button-void').show(); 243 $('#img_loading_void').hide(); 244 } 245 }); 246 } 247 248 function resendTransaction(element) { 249 $.ajax({ 250 type:'GET', 251 dataType: 'json', 252 url: $(element).attr('href'), 253 beforeSend: function() { 254 $(element).hide(); 255 $(element).after('<span class="btn btn-primary loading"><i class="fa fa-circle-o-notch fa-spin fa-lg"></i></span>'); 256 }, 257 success: function(data) { 258 $(element).show(); 259 $('.loading').remove(); 260 261 if (data.error) { 262 alert(data.error); 263 } 264 265 if (data.success) { 266 location.reload(); 267 } 268 } 269 }); 270 } 271 //--></script>