Only display card details if the flags are true, and the matching values exist.

The old code would display an empty span if the flags and data didn't line up. For example if the expiry date existed on the payment method, but the flag said not to display it, the span would still get built. This prevents that.

Also do some code cleanup of related lines.
The two conditionals below aren't needed. There's no container-tag or container-formatting so we just need to check `$display_details`.