shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

amazon_login_pay_order.twig (10679B)


      1 <h2>{{ text_payment_info }}</h2>
      2 <div class="alert alert-success" id="amazon_login_pay-transaction-msg" style="display:none;"></div>
      3 <table class="table table-striped table-bordered">
      4   <tr>
      5 	<td>{{ text_order_ref }}</td>
      6 	<td>{{ amazon_login_pay_order.amazon_order_reference_id }}</td>
      7   </tr>
      8   <tr>
      9 	<td>{{ text_order_total }}</td>
     10 	<td>{{ amazon_login_pay_order.total_formatted }}</td>
     11   </tr>
     12   <tr>
     13 	<td>{{ text_total_captured }}</td>
     14 	<td id="amazon_login_pay-total-captured">{{ amazon_login_pay_order.total_captured_formatted }}</td>
     15   </tr>
     16   <tr>
     17 	<td>{{ text_capture_status }}</td>
     18 	<td id="capture_status">
     19 	  {% if amazon_login_pay_order.capture_status == 1 %}
     20 		  <span class="capture-text">{{ text_yes }}</span>
     21 	  {% else %}
     22 		  <span class="capture-text">{{ text_no }}</span>&nbsp;&nbsp;
     23 		  {% if amazon_login_pay_order.cancel_status == 0 %}
     24 			  <input type="text" width="10" id="capture-amount" value="{{ amazon_login_pay_order.total }}"/>
     25 			  <a class="button btn btn-primary" id="button-capture">{{ button_capture }}</a>
     26 			  <span class="btn btn-primary" id="loading-capture" style="display:none;"><i class="fa fa-circle-o-notch fa-spin fa-lg"></i></span>
     27 		  {% endif %}
     28 	  {% endif %}
     29 	</td>
     30   </tr>
     31   <tr>
     32 	<td>{{ text_cancel_status }}</td>
     33 	<td id="cancel_status">
     34 	  {% if amazon_login_pay_order.cancel_status == 1 %}
     35 		  <span class="cancel_text">{{ text_yes }}</span>
     36 	  {% else %}
     37 		  <span class="cancel_text">{{ text_no }}</span>&nbsp;&nbsp;
     38 		  {% if amazon_login_pay_order.total_captured == 0 and amazon_login_pay_order.refund_status != 1 %}
     39 		  <a class="button btn btn-primary" id="button-cancel">{{ button_cancel }}</a>
     40 		  <span class="btn btn-primary" id="loading-cancel" style="display:none;"><i class="fa fa-circle-o-notch fa-spin fa-lg"></i></span>
     41 		  {% endif %}
     42 	  {% endif %}
     43 	</td>
     44   </tr>
     45   <tr>
     46 	<td>{{ text_refund_status }}</td>
     47 	<td id="refund_status">
     48 	  {% if amazon_login_pay_order.refund_status == 1 %}
     49 		  <span class="refund_text">{{ text_yes }}</span>
     50 	  {% else %}
     51 		  <span class="refund_text">{{ text_no }}</span>&nbsp;&nbsp;
     52 		  {% if amazon_login_pay_order.total_captured > 0 and amazon_login_pay_order.cancel_status == 0 %}
     53 			  <input type="text" width="10" id="refund-amount" />
     54 			  <a class="button btn btn-primary" id="button-refund">{{ button_refund }}</a>
     55 		  {% else %}
     56 			  <input type="text" width="10" id="refund-amount" style="display: none;"/>
     57 			  <a class="button btn btn-primary" id="button-refund" style="display: none;">{{ button_refund }}</a>
     58 		  {% endif %}
     59 		  <span class="btn btn-primary" id="loading-refund" style="display: none;"><i class="fa fa-circle-o-notch fa-spin fa-lg"></i></span>
     60 	  {% endif %}
     61 	</td>
     62   </tr>
     63   <tr>
     64 	<td>{{ text_transactions }}:</td>
     65 	<td>
     66 	  <table class="table table-striped table-bordered" id="amazon_login_pay-transactions">
     67 		<thead>
     68 		  <tr>
     69 			<td class="text-left"><strong>{{ text_column_date_added }}</strong></td>
     70 			<td class="text-left"><strong>{{ text_column_type }}</strong></td>
     71 			<td class="text-left"><strong>{{ text_column_status }}</strong></td>
     72 			<td class="text-left"><strong>{{ text_column_authorization_id }}</strong></td>
     73 			<td class="text-left"><strong>{{ text_column_capture_id }}</strong></td>
     74 			<td class="text-left"><strong>{{ text_column_refund_id }}</strong></td>
     75 			<td class="text-left"><strong>{{ text_column_amount }}</strong></td>
     76 		  </tr>
     77 		</thead>
     78 		<tbody>
     79 		  {% for transaction in amazon_login_pay_order.transactions %}
     80 			  <tr>
     81 				<td class="text-left">{{ transaction.date_added }}</td>
     82 				<td class="text-left">{{ transaction.type }}</td>
     83 				<td class="text-left">{{ transaction.status }}</td>
     84 				<td class="text-left">{{ transaction.amazon_authorization_id }}</td>
     85 				<td class="text-left">{{ transaction.amazon_capture_id }}</td>
     86 				<td class="text-left">{{ transaction.amazon_refund_id }}</td>
     87 				<td class="text-left">{{ transaction.amount }}</td>
     88 			  </tr>
     89 		  {% endfor %}
     90 		</tbody>
     91 	  </table>
     92 	</td>
     93   </tr>
     94 </table>
     95 <script type="text/javascript"><!--
     96   $("#button-cancel").click(function () {
     97       if (confirm('{{ text_confirm_cancel }}')) {
     98         $.ajax({
     99           type: 'POST',
    100           dataType: 'json',
    101           data: {'order_id': '{{ order_id }}'},
    102           url: 'index.php?route=extension/payment/amazon_login_pay/cancel&user_token={{ user_token }}',
    103           beforeSend: function () {
    104             $('#button-cancel').hide();
    105             $('#loading-cancel').show();
    106             $('#amazon_login_pay-transaction-msg').hide();
    107           },
    108           success: function (data) {
    109             if (data.error == false) {
    110               var html = '';
    111               html += '<tr>';
    112               html += '<td class="text-left">' + data.data.date_added + '</td>';
    113               html += '<td class="text-left">' + data.data.type + '</td>';
    114               html += '<td class="text-left">' + data.data.status + '</td>';
    115               html += '<td class="text-left"></td>';
    116               html += '<td class="text-left"></td>';
    117               html += '<td class="text-left"></td>';
    118               html += '<td class="text-left">' + data.data.amount + '</td>';
    119               html += '</tr>';
    120 
    121               $('.cancel_text').text('{{ text_yes }}');
    122               $('#amazon_login_pay-transactions').append(html);
    123               $('#button-capture').hide();
    124               $('#capture-amount').hide();
    125 
    126               if (data.msg != '') {
    127                 $('#amazon_login_pay-transaction-msg').empty().html('<i class="fa fa-check-circle"></i> ' + data.msg).fadeIn();
    128               }
    129             }
    130             if (data.error == true) {
    131               alert(data.msg);
    132               $('#button-cancel').show();
    133             }
    134 
    135             $('#loading-cancel').hide();
    136           }
    137         });
    138       }
    139     });
    140     $("#button-capture").click(function () {
    141       if (confirm('{{ text_confirm_capture }}')) {
    142         $.ajax({
    143           type: 'POST',
    144           dataType: 'json',
    145           data: {'order_id': '{{ order_id }}', 'amount': $('#capture-amount').val()},
    146           url: 'index.php?route=extension/payment/amazon_login_pay/capture&user_token={{ user_token }}',
    147           beforeSend: function () {
    148             $('#button-capture').hide();
    149             $('#capture-amount').hide();
    150             $('#loading-capture').show();
    151             $('#amazon_login_pay-transaction-msg').hide();
    152           },
    153           success: function (data) {
    154             if (data.error == false) {
    155               var html = '';
    156               html += '<tr>';
    157               html += '<td class="text-left">' + data.data.date_added + '</td>';
    158               html += '<td class="text-left">' + data.data.type + '</td>';
    159               html += '<td class="text-left">' + data.data.status + '</td>';
    160               html += '<td class="text-left">' + data.data.amazon_authorization_id + '</td>';
    161               html += '<td class="text-left">' + data.data.amazon_capture_id + '</td>';
    162               html += '<td class="text-left"></td>';
    163               html += '<td class="text-left">' + data.data.amount + '</td>';
    164               html += '</tr>';
    165 
    166               $('#amazon_login_pay-transactions').append(html);
    167               $('#amazon_login_pay-total-captured').text(data.data.total);
    168 
    169               if (data.data.capture_status == 1) {
    170                 $('#button-cancel').hide();
    171                 $('.capture-text').text('{{ text_yes }}');
    172               } else {
    173                 $('#button-capture, #capture-amount').show();
    174                 $('#capture-amount').val('0.00');
    175               }
    176 
    177               if (data.msg != '') {
    178                 $('#amazon_login_pay-transaction-msg').empty().html('<i class="fa fa-check-circle"></i> ' + data.msg).fadeIn();
    179               }
    180 
    181               $('#button-refund').show();
    182               $('#refund-amount').val(0.00).show();
    183             }
    184             if (data.error == true) {
    185               alert(data.msg);
    186               $('#button-capture').show();
    187               $('#capture-amount').show();
    188             }
    189 
    190             $('#loading-capture').hide();
    191           }
    192         });
    193       }
    194     });
    195     $("#button-refund").click(function () {
    196       if (confirm('{{ text_confirm_refund }}')) {
    197         $.ajax({
    198           type: 'POST',
    199           dataType: 'json',
    200           data: {'order_id': '{{ order_id }}', 'amount': $('#refund-amount').val()},
    201           url: 'index.php?route=extension/payment/amazon_login_pay/refund&user_token={{ user_token }}',
    202           beforeSend: function () {
    203             $('#button-refund').hide();
    204             $('#refund-amount').hide();
    205             $('#loading-refund').show();
    206             $('#amazon_login_pay-transaction-msg').hide();
    207           },
    208           success: function (data) {
    209             var html = '';
    210             if (data.data != undefined) {
    211               $.each(data.data, function (index, value) {
    212                 html += '<tr>';
    213                 html += '<td class="text-left">' + value['date_added'] + '</td>';
    214                 html += '<td class="text-left">' + value['type'] + '</td>';
    215                 html += '<td class="text-left">' + value['status'] + '</td>';
    216                 html += '<td class="text-left">' + value['amazon_authorization_id'] + '</td>';
    217                 html += '<td class="text-left">' + value['amazon_capture_id'] + '</td>';
    218                 html += '<td class="text-left">' + value['amazon_refund_id'] + '</td>';
    219                 html += '<td class="text-left">' + value['amount'] + '</td>';
    220                 html += '</tr>';
    221               });
    222               $('#amazon_login_pay-transactions').append(html);
    223             }
    224             $('#amazon_login_pay-total-captured').text(data.total_captured);
    225 
    226             if (data.refund_status == 1) {
    227               $('.refund_text').text('{{ text_yes }}');
    228             } else {
    229               $('#button-refund').show();
    230               $('#refund-amount').val(0.00).show();
    231             }
    232             if (data.msg != '' && data.msg != undefined) {
    233               $('#amazon_login_pay-transaction-msg').empty().html('<i class="fa fa-check-circle"></i> ' + data.msg).fadeIn();
    234             }
    235             if (data.error == true) {
    236               var msg = '';
    237               $.each(data.error_msg, function (index, value) {
    238                 msg += value + "\n";
    239               });
    240               alert(msg);
    241               $('#button-refund').show();
    242             }
    243 
    244             $('#loading-refund').hide();
    245           }
    246         });
    247       }
    248     });
    249 //--></script>