Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion css/frm_admin.css

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions resources/scss/admin/layout/page/_single-entry-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,29 @@
#form_entries_page .misc-pub-section .frm_delete_entry .frmsvg {
color: var(--error-700);
}

.frm-payment-notes {
display: flex;
flex-direction: column;
gap: var(--gap-sm);
margin: 0;
padding: 0;
overflow-wrap: break-word;
word-break: break-word;
}

.frm-payment-note {
display: flex;
flex-direction: column;
gap: var(--gap-xs);
margin: 0;
}

.frm-payment-note-id {
margin: 0;
padding: 2px 6px;
color: var(--grey-700);
font-size: 0.9em;
background: var(--grey-100);
border-radius: 4px;
}
21 changes: 21 additions & 0 deletions stripe/controllers/FrmTransLitePaymentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,27 @@ public static function show_refund_link( $payment ) {
FrmTransLiteAppHelper::echo_confirmation_link( $link );
}

/**
* Show the refund link as a sidebar action, matching the Edit and Delete rows.
*
* @since x.x
*
* @param object $payment
*
* @return void
*/
public static function show_refund_action( $payment ) {
$link = self::refund_link( $payment );

if ( ! preg_match( '/^\s*(<a\b[^>]*>).*<\/a>\s*$/is', $link, $matches ) ) {
return;
}

FrmTransLiteAppHelper::echo_confirmation_link( $matches[1] );
FrmAppHelper::icon_by_class( 'frmfont frm_back' );
echo '<span class="frm_link_label">' . esc_html__( 'Refund Payment', 'formidable' ) . '</span></a>';
}

/**
* Show a link to a payment entry (unless it is deleted).
*
Expand Down
53 changes: 33 additions & 20 deletions stripe/views/payments/show.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,37 +104,43 @@
<th scope="row"><?php esc_html_e( 'Payment Status Updates', 'formidable' ); ?>:</th>
<td>

<ul class="frm-payment-notes">
<?php
foreach ( $payment->meta_value as $k => $metas ) {
if ( ! $metas ) {
continue;
}

$note = is_array( $metas ) ? $metas : array( $k => $metas );
$message = $note['message'] ?? '';
$date = $note['date'] ?? '';
unset( $note['message'], $note['date'] );
?>
<table class="widefat" style="border:none;overflow-wrap:break-word;word-break:break-word;">
<li class="frm-payment-note">
<?php if ( '' !== $message ) : ?>
<span><?php echo esc_html( $message ); ?></span>
<?php endif; ?>
<?php
if ( is_array( $metas ) ) {
foreach ( $metas as $key => $meta ) {
?>
<tr>
<th><?php echo esc_html( $key ); ?></th>
<td><?php echo esc_html( $meta ); ?></td>
</tr>
<?php
}
} else {
$labels = array(
'stripe_refund_id' => __( 'Refund ID', 'formidable' ),
);
foreach ( $note as $key => $value ) :
$value = is_scalar( $value ) ? (string) $value : wp_json_encode( $value );
?>
<tr>
<th><?php echo esc_html( $k ); ?></th>
<td><?php echo esc_html( $metas ); ?></td>
</tr>
<?php
}
?>
</table>
<br/>
<?php if ( isset( $labels[ $key ] ) ) : ?>
<span class="frm-text-grey-500"><?php echo esc_html( $labels[ $key ] ); ?> <code class="frm-payment-note-id"><?php echo esc_html( $value ); ?></code></span>
<?php else : ?>
<span class="frm-text-grey-500"><?php echo esc_html( $key . ': ' . $value ); ?></span>
<?php endif; ?>
<?php endforeach; ?>
<?php if ( '' !== $date ) : ?>
<span class="frm-text-grey-500"><?php echo esc_html( FrmAppHelper::get_localized_date( __( 'M j, Y @ G:i', 'formidable' ), $date ) ); ?></span>
<?php endif; ?>
</li>
<?php
}//end foreach
?>
</ul>

</td>
</tr>
Expand All @@ -156,6 +162,13 @@
<?php FrmTransLitePaymentsController::load_sidebar_actions( $payment ); ?>
<div class="clear"></div>

<?php if ( isset( $payment->status ) && $payment->status === 'complete' && ! empty( $payment->receipt_id ) ) : ?>
<div class="misc-pub-section">
<?php FrmTransLitePaymentsController::show_refund_action( $payment ); ?>
<div class="clear"></div>
</div>
<?php endif; ?>

<?php if ( FrmTransLiteAppHelper::payments_submodule_or_paypal_is_active() ) : ?>
<div class="misc-pub-section">
<a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-payments&action=edit&id=' . $payment->id ) ); ?>" title="<?php esc_attr_e( 'Edit', 'formidable' ); ?>">
Expand Down
8 changes: 0 additions & 8 deletions stripe/views/payments/sidebar_actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@
</span>
</div>

<?php if ( isset( $payment->status ) && $payment->status === 'complete' && ! empty( $payment->receipt_id ) ) { ?>
<div class="misc-pub-section">
<?php FrmAppHelper::icon_by_class( 'frmfont frm_product_icon' ); ?>
<?php esc_html_e( 'Payment:', 'formidable' ); ?>
<?php FrmTransLitePaymentsController::show_refund_link( $payment ); ?>
</div>
<?php } ?>

<?php
do_action( 'frm_pay_' . $payment->paysys . '_sidebar', $payment );
?>