The current example is pretty stupid (just asks for your name).
commerce_payment already has the functions for outputting a CC form and validating the number, and commerce_kickstart_payment (the Kickstart payment example module) uses them happily. Let's do that in Commerce as well.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 2144745-1-awesomify-commerce-payment-example.patch | 2.38 KB | bojanz |
Comments
Comment #1
bojanz commentedHere's a patch. It limits the form to Visa/MasterCard/Amex, we could make it allow all types instead. This was just Kickstart's default.
Comment #2
bojanz commentedcommerce_payment_example_transaction() is still looking for a $name. I didn't roll a complete patch.
Comment #3
ar-jan commentedWould this no longer allow the possibility to simulate a payment without valid cc number? Because that is a useful feature, and:
https://drupal.org/node/1900734#comment-7038772
Comment #4
bojanz commentedThe CC number showed by default on the form passes validation, so you can still do that.
Comment #5
rszrama commentedThere were still other things to take care of here, such as updating the message for the completed transaction and masking the credit card number (because we all know people will still attempt to use this with real credit card numbers...). I also noticed a CSS error in the core credit card form CSS that I've fixed (and thus mitigated the need for RTL support).
Also, I'm not setup to test this right now, but I think we may be including the credit card form without a necessary addition of the include to the form's build information array. I'll have to try and produce a failure on that later.
Commit: http://drupalcode.org/project/commerce.git/commitdiff/0099075
Comment #6
bojanz commentedNice! :)
Comment #7
rszrama commentedDid a test with a forced error on the checkout review page and couldn't turn up any problems with respect to the include file. I guess it's because we get the base form include file in the build_info array from the menu item (sites/all/modules/commerce/modules/checkout/includes/commerce_checkout.pages.inc) and don't need to specify any include files that come through that. Guess it should've been a no-brainer given we don't have to add the various checkout pane include files to the array. Duh. : P
Comment #10
rszrama commented