: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
/* global wpforms_admin, wpforms_admin_payments_single */
* WPForms Single Payment View page.
const WPFormsPaymentsSingle = window.WPFormsPaymentsSingle || ( function( document, window, $ ) {
* Public functions and properties.
app.paymentDeletionAlert();
* Initialize WPForms admin area tooltips.
if ( typeof jQuery.fn.tooltipster === 'undefined' ) {
jQuery( '.wpforms-single-payment-tooltip' ).tooltipster( {
* Alert user before deleting payment.
$( document ).on( 'click', '.wpforms-payment-actions .button-delete', function( event ) {
const url = $( this ).attr( 'href' );
// Trigger alert modal to confirm.
title: wpforms_admin.heads_up,
content: wpforms_admin_payments_single.payment_delete_confirm,
icon: 'fa fa-exclamation-circle',
text: wpforms_admin.cancel,
* Handle payment actions.
$( document ).on( 'click', '.wpforms-payments-single-action', ( event ) => {
const gateway = $( event.currentTarget ).data( 'gateway' ),
registeredHandlers = wpforms_admin.single_payment_button_handlers;
if ( ! registeredHandlers || ! registeredHandlers.includes( gateway ) ) {
const paymentId = $( event.currentTarget ).data( 'action-id' ),
actionType = $( event.currentTarget ).data( 'action-type' );
title: wpforms_admin.heads_up,
content: app.strings[ actionType ].confirm,
icon: 'fa fa-exclamation-circle',
app.sendActionRequest( paymentId, gateway, actionType );
text: wpforms_admin.cancel,
* Send action request to server.
* @param {number} paymentId Payment ID.
* @param {string} gateway Payment gateway.
* @param {string} actionType Action type.
sendActionRequest( paymentId, gateway, actionType ) {
url: wpforms_admin.ajax_url,
action: 'wpforms_' + gateway + '_payments_' + actionType,
payment_id: paymentId, // eslint-disable-line camelcase
nonce: wpforms_admin.nonce,
success: ( response ) => {
if ( response.success ) {
title: wpforms_admin.success,
content: app.strings[ actionType ].success,
icon: 'fa fa-check-circle',
text: wpforms_admin.close_refresh,
window.location.reload();
app.failedResponseAlert( response?.data?.modal_msg || '' );
app.failedResponseAlert();
confirm: wpforms_admin_payments_single.payment_refund_confirm,
success: wpforms_admin_payments_single.payment_refund_success,
confirm: wpforms_admin_payments_single.payment_cancel_confirm,
success: wpforms_admin_payments_single.payment_cancel_success,
* Alert user when refunding payment failed.
* @param {string} message Modal message.
failedResponseAlert( message = '' ) {
title: wpforms_admin.heads_up,
content: message === '' ? wpforms_admin.try_again : message,
icon: 'fa fa-exclamation-circle',
}( document, window, jQuery ) );
WPFormsPaymentsSingle.init();