pp_payflow_iframe_order.twig (5723B)
1 <h2>{{ text_payment_info }}</h2> 2 <table class="table table-striped table-bordered"> 3 <tr> 4 <td>{{ entry_capture_status }}: </td> 5 <td id="capture-status">{% if complete %} 6 {{ text_complete }} 7 {% else %} 8 {{ text_incomplete }} 9 {% endif %}</td> 10 </tr> 11 <tr> 12 <td>{{ entry_capture }}</td> 13 <td id="complete-entry">{% if complete %} 14 - 15 {% else %} 16 {{ entry_complete_capture }} 17 <input type="checkbox" name="capture-complete" value="1" /> 18 <br /> 19 <input type="text" name="capture-amount" value="0.00" /> 20 <a class="btn btn-primary" id="button-capture" onclick="capture()">{{ button_capture }}</a> 21 {% endif %}</td> 22 </tr> 23 <tr> 24 <td>{{ entry_void }}</td> 25 <td id="reauthorise-entry">{% if complete %} 26 - 27 {% else %} 28 <a class="btn btn-primary" id="button-void" onclick="doVoid()">{{ button_void }}</a> 29 {% endif %}</td> 30 </tr> 31 <tr> 32 <td>{{ entry_transactions }}</td> 33 <td><table id="transaction-table" class="table table-striped table-bordered"> 34 <thead> 35 <tr> 36 <td class="text-left">{{ column_transaction_id }}</td> 37 <td class="text-left">{{ column_transaction_type }}</td> 38 <td class="text-left">{{ column_amount }}</td> 39 <td class="text-left">{{ column_time }}</td> 40 <td class="text-left">{{ column_actions }}</td> 41 </tr> 42 </thead> 43 <tbody> 44 {% for transaction in transactions %} 45 <tr> 46 <td class="text-left">{{ transaction.transaction_reference }}</td> 47 <td class="text-left">{{ transaction.transaction_type }}</td> 48 <td class="text-left">{{ transaction.amount|number_format(2) }}</td> 49 <td class="text-left">{{ transaction.time }}</td> 50 <td class="text-left">{% for action in transaction.actions %} 51 [<a href="{{ action.href }}">{{ action.title }}</a>] 52 {% endfor %}</td> 53 </tr> 54 {% endfor %} 55 </tbody> 56 </table></td> 57 </tr> 58 </table> 59 <script type="text/javascript"><!-- 60 function markAsComplete() { 61 $('#complete-entry, #reauthorise-entry, #reauthorise-entry').html('-'); 62 $('#capture-status').html('{{ text_complete }}'); 63 } 64 65 function doVoid() { 66 if (confirm('{{ text_confirm_void }}')) { 67 $.ajax({ 68 type:'POST', 69 dataType: 'json', 70 data: {'order_id':{{ order_id }}}, 71 url: 'index.php?route=extension/payment/pp_payflow_iframe/void&user_token={{ user_token }}', 72 beforeSend: function() { 73 $('#button-void').after('<span class="btn btn-primary loading"><i class="fa fa-circle-o-notch fa-spin fa-lg"></i></span>'); 74 $('#button-void').hide(); 75 }, 76 success: function(data) { 77 if (!data.error) { 78 $('#capture-status').text('{{ text_complete }}'); 79 80 var html = ''; 81 html += '<tr>'; 82 html += ' <td class="left">' + data.success.transaction_reference + '</td>'; 83 html += ' <td class="left">' + data.success.transaction_type + '</td>'; 84 html += ' <td class="left">' + data.success.amount + '</td>'; 85 html += ' <td class="left">' + data.success.time + '</td>'; 86 html += ' <td class="left"></td>'; 87 html += '</tr>'; 88 $('#transaction-table tbody').append(html); 89 90 markAsComplete(); 91 } 92 93 if (data.error) { 94 alert(data.error); 95 $('#button-void').show(); 96 } 97 98 $('.loading').remove(); 99 } 100 }); 101 } 102 } 103 104 function capture() { 105 var amount = $('input[name="capture-amount"]').val(); 106 var complete = 0; 107 108 if ($('input[name="capture-complete"]').is(':checked')) { 109 complete = 1; 110 } 111 112 $.ajax({ 113 type:'POST', 114 dataType: 'json', 115 data: {'order_id':{{ order_id }}, 'amount':amount, 'complete':complete }, 116 url: 'index.php?route=extension/payment/pp_payflow_iframe/capture&user_token={{ user_token }}', 117 118 beforeSend: function() { 119 $('#button-capture').after('<span class="btn btn-primary loading"><i class="fa fa-circle-o-notch fa-spin fa-lg"></i></span>'); 120 $('#button-capture').hide(); 121 }, 122 123 success: function(data) { 124 if (!data.error) { 125 var html = ''; 126 html += '<tr>'; 127 html += ' <td class="left">' + data.success.transaction_reference + '</td>'; 128 html += ' <td class="left">' + data.success.transaction_type + '</td>'; 129 html += ' <td class="left">' + data.success.amount + '</td>'; 130 html += ' <td class="left">' + data.success.time + '</td>'; 131 html += ' <td class="left">'; 132 133 $.each(data.success.actions, function(index, value) { 134 html += ' [<a href="' + value.href + '">' + value.title + '</a>] '; 135 }); 136 137 html += '</td>'; 138 html += '</tr>'; 139 $('#transaction-table tbody').append(html); 140 141 if (complete == 1) { 142 markAsComplete(); 143 } 144 } 145 146 if (data.error) { 147 alert(data.error); 148 } 149 150 $('#button-capture').show(); 151 $('.loading').remove(); 152 } 153 }); 154 } 155 //--></script>