Closed (won't fix)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
27 Jul 2012 at 23:03 UTC
Updated:
2 May 2013 at 10:25 UTC
Mellat Bank integration for the Drupal Commerce payment and checkout system.
Project page: http://drupal.org/sandbox/mohamadaliakbari/1702928
git clone http://git.drupal.org/sandbox/mohamadaliakbari/1702928.git commerce_mellat
Comments
Comment #1
cthiebault commentedChange your git clone command in the issue description for
git clone http://git.drupal.org/sandbox/mohamadaliakbari/1702928.git commerce_mellatinstead of
git clone --recursive --branch 7.x-1.x mohamadaliakbari@git.drupal.org:sandbox/mohamadaliakbari/1702928.gitAutomatic review
Drupal Code Sniffer has found some issues with your code:
http://ventral.org/pareview/httpgitdrupalorgsandboxmohamadaliakbari17029...
Manual review
Your code seems good and follows Drupal standards.
Maybe you could use constants for urls like
- https://pgws.bpm.bankmellat.ir/pgwchannel/services/pgw?wsdl
- https://pgw.bpm.bankmellat.ir/pgwchannel/startpay.mellat
- http://interfaces.core.sw.bps.com/
It would be easier to maintain in case they change... but it's a detail.
I did not test the paiement as I don't have a account at Mellat Bank, but the administration UI works well.
Comment #2
patrickd commentedno major issues pointed out, no need to set "needs work"
Comment #3
dman commentedIf it's been reviewed successfully with no blockers, and no needs work is needed ... then that makes it RTBC, then? No objections?
Comment #4
patrickd commentedComment #5
patrickd commentedYou should check_plain() everything that is not statically defined in your module and comes from outside the server. Therefore make sure that all results are save before passing them to drupal_set_message() or watchdog(). - Never trust foreign input / results
I highly recommend you to read the how to write secure code documentation: http://drupal.org/writing-secure-code
hook_redirect_form_validate() - Is this really a hook, or a custom form validation callback ?
I wasn't able to find anything about this
Always use forms api -> always get values out of $form_state -> never use _POST global.
also you first try to get them and save them into variables and then you check whether these keys exist? that order makes no sense.
Comment #6
mohamadaliakbari commentedI committed improved version.
Thanks patrickd for guidance
Comment #7
mohamadaliakbari commentedComment #8
gnucifer commentedAutomatic review
I checked out HEAD from git, and for me it seems like the issues from the automatic reviews has not yet been addressed: http://ventral.org/pareview/httpgitdrupalorgsandboxmohamadaliakbari17029...
Manual review
- The issue with $_POST as mentioned in #5 is still there. Use $form_state['values'] instead.
- DIRECTORY_SEPARATOR is not necessary , '/' works fine also on windows. (http://alanhogan.com/tips/php/directory-separator-not-necessary)
- When including the nusoap library you are using include_once, maybe require_once is a better choice since later code will crash if the library is not available, thus it is required and php should bail out if the include failed?
Otherwise it looks very nice, clean and well-structured code, good use of API etc. Good job!
Comment #9
mohamadaliakbari commentedMany fixes applied to module.
Also as mentioned here: CALLBACK_commerce_payment_method_redirect_form_validate I have not access to $form_state['values'] to use instead of $_POST, other payment modules have written for Commerce used $_POST
Finally, this module is being used by our community (See module's page: http://blog.rastasoft.ir/fa/node/48)
It can be a full project now.
Comment #10
codeyourdream commentedAutomatic review shows lots of errors: http://ventral.org/pareview/httpgitdrupalorgsandboxmohamadaliakbari17029...
You may configure your IDE to match Drupal coding standarts:
Is there any documentation in English for this payment gateway? Its quite hard to review module without any documentation provided.
1. Use commerce_currency_amount_to_decimal() function instead of manual convertion ($wrapper->commerce_order_total->amount->value() / 100)
2. Your payment method has 'debug' setting which does nothing but sets the order amount to '1000'. You might rename or even remove it since it seems useless.
Comment #11
codeyourdream commentedComment #12
PA robot commentedClosing due to lack of activity. Feel free to reopen if you are still working on this application.
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #12.0
PA robot commentedChange clone statement