Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 19 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | /** |
| 3 | * Friendly info table to display on the admin order ui. |
| 4 | * |
| 5 | * @see \BrianHenryIE\WP_Bitcoin_Gateway\API_Interface::get_order_details() |
| 6 | * |
| 7 | * @var array<string, mixed> $args Associative array containing the result of `API_Interface::get_formatted_order_details()`, extracted into these variables: |
| 8 | * |
| 9 | * @var string $payment_status 'Awaiting Payment'|'Partially Paid'|'Paid'. |
| 10 | * @var string $btc_address Destination payment address. |
| 11 | * @var string $btc_total Order total in BTC. |
| 12 | * @var string $btc_total_formatted Order total prefixed with "฿". |
| 13 | * @var string $btc_exchange_rate_formatted // TODO: Format it! The Bitcoin exchange rate with friendly thousand separators. |
| 14 | * @var string $btc_amount_received Amount received at the destination address so far. |
| 15 | * @var string $btc_amount_received_formatted Amount received prefixed with "฿". |
| 16 | * @var string $last_checked_time_formatted The last time a blockchain service was queried for updates to the payment address. |
| 17 | * @var string $btc_address_derivation_path_sequence_number |
| 18 | * @var string $parent_wallet_xpub_html |
| 19 | * |
| 20 | * @var string $exchange_rate_url |
| 21 | * @var string $btc_exchange_rate |
| 22 | * |
| 23 | * @package brianhenryie/bh-wp-bitcoin-gateway |
| 24 | */ |
| 25 | |
| 26 | ?> |
| 27 | |
| 28 | <table> |
| 29 | |
| 30 | <tr> |
| 31 | <td>Order Total:</td> |
| 32 | <td><?php echo esc_html( $btc_total_formatted ); ?></td> |
| 33 | </tr> |
| 34 | |
| 35 | <tr> |
| 36 | <td>Exchange Rate:</td> |
| 37 | <td><a target="_blank" href="<?php echo esc_url( $exchange_rate_url ); ?>"><?php echo esc_html( $btc_exchange_rate ); ?></a></td> |
| 38 | </tr> |
| 39 | |
| 40 | <tr> |
| 41 | <td>Payment Address:</td> |
| 42 | <td><a target="_blank" href="<?php echo esc_url( "https://www.blockchain.com/btc/address/{$btc_address}" ); ?>"><?php echo esc_html( $btc_address ); ?></a></td> |
| 43 | </tr> |
| 44 | |
| 45 | |
| 46 | <tr> |
| 47 | <td>Wallet Address:</td> |
| 48 | <td><?php echo wp_kses_post( $parent_wallet_xpub_html ) . ' • 0/' . esc_html( $btc_address_derivation_path_sequence_number ); ?></a></td> |
| 49 | </tr> |
| 50 | |
| 51 | <tr> |
| 52 | <td>Transactions:</td> |
| 53 | <td> |
| 54 | <?php |
| 55 | if ( empty( $transactions ) ) { |
| 56 | echo esc_html__( 'No transactions yet', 'bh-wp-bitcoin-gateway' ); |
| 57 | } else { |
| 58 | echo '<ul>'; |
| 59 | foreach ( $transactions as $transaction ) { |
| 60 | echo '<li>' . esc_html( $transaction['time']->format( DATE_ATOM ) ) . ' – <a href="' . esc_url( "https://blockchain.com/explorer/transactions/btc/{$transaction['txid']}" ) . '" target="_blank">' . esc_html( $transaction['txid'] ) . '</a> – ' . esc_html( $transaction['value'] ) . ' </li>'; |
| 61 | } |
| 62 | echo '</ul>'; |
| 63 | } |
| 64 | ?> |
| 65 | </td> |
| 66 | </tr> |
| 67 | |
| 68 | <tr> |
| 69 | <td>Amount received:</td> |
| 70 | <td><?php echo esc_html( $btc_amount_received_formatted ); ?></td> |
| 71 | </tr> |
| 72 | |
| 73 | <tr> |
| 74 | <td>Last Checked:</td> |
| 75 | <td><?php echo esc_html( $last_checked_time_formatted ); ?></td> |
| 76 | </tr> |
| 77 | |
| 78 | </table> |