0, 'email' => '', 'status' => '', ], (array) $atts, 'bookingistic_payment' ); $id = (int) $atts['id']; if ( $id <= 0 ) { return ''; } $booking = Booking_Repository::find( $id ); if ( ! $booking ) { return ''; } // Light ownership check: email must match when provided; always // required to render any payment detail (ID alone is not enough). $email = sanitize_email( (string) $atts['email'] ); if ( ! $email ) { return ''; } $customer = Customer_Repository::find( (int) $booking['customer_id'] ); if ( ! $customer || strcasecmp( (string) $customer['email'], $email ) !== 0 ) { return '
' . esc_html__( 'Payment details are available to the booking customer only.', 'bookingistic' ) . '
'; } // Status-only display mode. if ( '' !== (string) $atts['status'] ) { return '
' . esc_html( ucfirst( sanitize_key( (string) $atts['status'] ) ) ) . '
'; } $payment_status = (string) $booking['payment_status']; if ( in_array( $payment_status, [ 'paid', 'deposit_paid', 'free' ], true ) ) { return '
' . esc_html__( 'Paid — thank you!', 'bookingistic' ) . '
'; } $amount = Payment_Manager::amount_due( $booking ); if ( $amount <= 0 ) { return ''; } $url = Payment_Manager::payment_url( $booking ); if ( ! $url ) { return '
' . esc_html( sprintf( /* translators: %s: formatted amount. */ __( 'Payment of %s is due. Please contact us to complete payment.', 'bookingistic' ), number_format_i18n( $amount, 2 ) ) ) . '
'; } return '
' . '' . esc_html( sprintf( /* translators: %s: formatted amount. */ __( 'Pay now — %s', 'bookingistic' ), number_format_i18n( $amount, 2 ) ) ) . '
'; } }