/** * Email template tag: price * The total price of the donation * * @param int $payment_id * * @return string price */ function give_email_tag_price($payment_id) { $price = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)), give_get_payment_currency_code($payment_id)); return html_entity_decode($price, ENT_COMPAT, 'UTF-8'); }
$payment_id = absint($_GET['id']); $number = give_get_payment_number($payment_id); $item = get_post($payment_id); // Sanity check... fail if purchase ID is invalid if (!is_object($item) || $item->post_type != 'give_payment') { wp_die(__('The specified ID does not belong to a payment. Please try again', 'give'), __('Error', 'give')); } $payment_meta = give_get_payment_meta($payment_id); $transaction_id = esc_attr(give_get_payment_transaction_id($payment_id)); $user_id = give_get_payment_user_id($payment_id); $donor_id = give_get_payment_customer_id($payment_id); $payment_date = strtotime($item->post_date); $user_info = give_get_payment_meta_user_info($payment_id); $address = !empty($user_info['address']) ? $user_info['address'] : array('line1' => '', 'line2' => '', 'city' => '', 'country' => '', 'state' => '', 'zip' => ''); $gateway = give_get_payment_gateway($payment_id); $currency_code = give_get_payment_currency_code($payment_id); ?> <div class="wrap give-wrap"> <h2><?php printf(__('Payment %s', 'give'), $number); ?> </h2> <?php do_action('give_view_order_details_before', $payment_id); ?> <form id="give-edit-order-form" method="post"> <?php do_action('give_view_order_details_form_top', $payment_id); ?> <div id="poststuff"> <div id="give-dashboard-widgets-wrap">
/** * This function renders most of the columns in the list table. * * @access public * @since 1.0 * * @param array $item Contains all the data of the discount code * @param string $column_name The name of the column * * @return string Column Name */ public function column_default($payment, $column_name) { switch ($column_name) { case 'amount': $amount = !empty($payment->total) ? $payment->total : 0; $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); break; case 'date': $date = strtotime($payment->date); $value = date_i18n(get_option('date_format'), $date); break; case 'status': $payment = get_post($payment->ID); $value = '<div class="give-donation-status status-' . sanitize_title(give_get_payment_status($payment, true)) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status($payment, true) . '</div>'; break; case 'details': $value = '<div class="give-payment-details-link-wrap"><a href="' . esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))) . '" class="give-payment-details-link button button-small">' . __('View Donation Details', 'give') . '</a></div>'; break; default: $value = isset($payment->{$column_name}) ? $payment->{$column_name} : ''; break; } return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); }
/** * This function renders most of the columns in the list table. * * @access public * @since 1.0 * * @param Give_Payment $payment Payment ID. * @param string $column_name The name of the column * * @return string Column Name */ public function column_default($payment, $column_name) { $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); $row_actions = $this->get_row_actions($payment); switch ($column_name) { case 'donation': ob_start(); ?> <a href="<?php echo $single_donation_url; ?> " data-tooltip="<?php esc_html_e('View details', 'give'); ?> ">#<?php echo $payment->ID; ?> </a> <?php _e('by', 'give'); ?> <?php echo $this->get_donor($payment); ?> <br> <?php echo $this->get_donor_email($payment); ?> <?php echo $this->row_actions($row_actions); ?> <?php $value = ob_get_clean(); break; case 'amount': $amount = !empty($payment->total) ? $payment->total : 0; $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); break; case 'donation_form': $value = '<a href="' . admin_url('post.php?post=' . $payment->form_id . '&action=edit') . '">' . $payment->form_title . '</a>'; $level = give_get_payment_form_title($payment->meta, true); if (!empty($level)) { $value .= $level; } break; case 'date': $date = strtotime($payment->date); $value = date_i18n(get_option('date_format'), $date); break; case 'status': $value = $this->get_payment_status($payment); break; case 'details': $value = '<div class="give-payment-details-link-wrap"><a href="' . $single_donation_url . '" data-tooltip="' . __('View details', 'give') . '" class="give-payment-details-link button button-small" title="' . __('View Details', 'give') . '"><span class="dashicons dashicons-visibility"></span></a></div>'; break; default: $value = isset($payment->{$column_name}) ? $payment->{$column_name} : ''; break; } return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); }
/** * Payment Subtotal * * Retrieves subtotal for payment (this is the amount before fees) and then returns a full formatted amount. This function essentially calls give_get_payment_subtotal() * * @since 1.5 * * @param int $payment_id Payment ID * * @see give_get_payment_subtotal() * * @return array Fully formatted payment subtotal */ function give_payment_subtotal($payment_id = 0) { $subtotal = give_get_payment_subtotal($payment_id); return give_currency_filter(give_format_amount($subtotal), give_get_payment_currency_code($payment_id)); }
/** * Get Payment Amount * * @description Get the fully formatted payment amount. The payment amount is retrieved using give_get_payment_amount() and is then sent through give_currency_filter() and give_format_amount() to format the amount correctly. * * @since 1.0 * * @param int $payment_id Payment ID * * @return string $amount Fully formatted payment amount */ function give_payment_amount($payment_id = 0) { $amount = give_get_payment_amount($payment_id); return give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment_id)); }
/** * Get currency * * @see Pronamic_Pay_PaymentDataInterface::get_currency_alphabetic_code() * @return string */ public function get_currency_alphabetic_code() { return give_get_payment_currency_code($this->donation_id); }