Problem/Motivation

Every time you want to complete the checkout with test CC module, you need to enter the test CC details and set the expiration date.
It would be much easier to set this information by default, just as Commerce does.
This will make the testing of checkout process much faster during development.

Proposed resolution

Implement hook_form_alter() in test_gateway.module and set valid CC defaults in relevant fields.
Attached is the patch.

Let me know if any comments/questions.

Thanks!

CommentFileSizeAuthor
#1 default_test_cc-2236153-1.patch1020 bytesaramboyajyan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aramboyajyan’s picture

Issue summary: View changes
FileSize
1020 bytes
TR’s picture

I'm not really in favor of doing this. If you simply don't want to type when you're testing the checkout process, use the Check payment method instead. The test gateway is meant to emulate a real gateway, and if you pre-fill all the data it defeats that purpose.

aramboyajyan’s picture

My main argument isn't that I don't want to type, but to have it ready for the most used scenario for testing checkout process with CC.

Having it pre-filled still allows me to edit the CC number or expiration date and make the transaction fail on purpose or just make a fast checkout without typing.

In most cases you just need a way to generate orders or to test something during the checkout process (e.g. custom module implementations and theme altering).
For this reason Test CC is the only one that works, as other modules will not provide the same form elements/workflow.

If you think it would be better to have it as an option, I can provide another patch which includes a settings page in admin where user can select if the CC details should be pre-filled.

However, if you still believe this shouldn't be added, I understand.

Thanks for quick response!