It seems there is a hardcoded dependency for payment methods to provide a special form element called 'credit_card' for this to show it's own form elements.

I think it should be removed and we should be able to trust in payment methods that provide the !empty(cardonfile) in their info.

Attaching a patch to make it show when payment method says !empty(cardonfile). Just removed the check for the form element.

CommentFileSizeAuthor
#1 do_not_check_for_credit_card_form_element.patch835 bytesAnonymous (not verified)
do_not_check_for_credit_card_form_element.patch835 bytesAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

My bad on the first one, reverse order in my git diff. New file attached.

Berdir’s picture

Status: Active » Needs work

Generally agree with this. In my case (Commerce Saferpay), the credit card form is on the redirect pane, because it's a direct POST to the payment provider, to avoid storing the CC info, even temporarly.

However, when removing the condition, the problem is it shows the checkbox already on the payment selection page, before entering the cc data, which is weird. So what I did is re-add the setting on my own, then save it myself and return an empty credit_card container with #access FALSE. Obviously hacky.

So what I'm thinking is to do this:

- Move the credit card element check one level down and only check it when trying to display the checkbox.
- Move the form element into a helper function, so that modules that do not follow the credit_card pseudo standard can easily add it on their own, how they want it.

Hint: When submitting a patch, remember to set the issue to needs review.

Berdir’s picture

Issue summary: View changes

My bad, forgot array check