transferuj.pl integration with Payment API. After installing you will be able to add new transferuj.pl payment method. You can use it with any module that is using Payment API for its payments, for example:

And more. See Payment for more information.

The module should be releaseable, there is a little more work to do on special "chargeback" functionality of transferuj.pl API, but this functionality has to be specifically requested and is not a default part of transferuj.pl API. I took a lot of inspiration from ogone module, and wanted to learn a Payment API on the way, so I think I will make a few more integrations of this kind in future.

Sandbox path: https://www.drupal.org/sandbox/luken/2319145

Git Clone Url:

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/luken/2319145.git 

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxluken2319145git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

Luke_Nuke’s picture

Status: Needs work » Needs review

Cleaned up code a bit, reducing pareview.sh errors to 1, that I cannot fix as I need to use a variable without camelCase as it is a part of Payment API.

Luke_Nuke’s picture

Luke_Nuke’s picture

Issue summary: View changes
er.pushpinderrana’s picture

Issue summary: View changes

Corrected Git Clone URL.

er.pushpinderrana’s picture

Status: Needs review » Needs work
Issue tags: +PAreview: security

@Luke_Nuke, thank you for your work.

Automated Review

Best practice issues identified by pareview.sh / drupalcs / coder. Few minor issue.

FILE: /var/www/drupal-7-pareview/pareview_temp/transferuj_pl.module
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
182 | WARNING | Line exceeds 80 characters; contains 112 characters
252 | WARNING | Line exceeds 80 characters; contains 100 characters
--------------------------------------------------------------------------------

FILE: ...pareview/pareview_temp/includes/TransferujPlPaymentMethodController.inc
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
16 | ERROR | Class property
| | $payment_method_configuration_form_elements_callback should use
| | lowerCamel naming without underscores
45 | WARNING | Line exceeds 80 characters; contains 85 characters
--------------------------------------------------------------------------------

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
(*)May be: Does not cause module duplication and fragmentation. Can you follow the steps in the link and confirm that the functionality contained in this module should stay separate from Commerce Transferuj.pl?
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements
3rd party code
Yes: Follows the guidelines for 3rd party code.
README.txt/README.md
No: Doesn't follows the guidelines for in-project documentation and the README Template. There is no info on how to use or confgure this, or how it works.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
No. If "no", list security issues identified.
  1. (+) In transferuj_pl_form_redirect function you are directly using <script> tag.
      $form['js'] = array(
        '#type' => 'markup',
        '#markup' => '<script type="text/javascript">document.getElementById(\'transferuj-pl-form-redirect\').submit();</script>',
      );
    

    This is not a recommended approach to use <script> tag directly in your code, do it in another way, make sure to read https://www.drupal.org/node/756722 again.

  2. In following code, you are accessing $_POST array directly that is completely unsecured to use.
     function transferuj_pl_verify() {
      $pid = explode(':', $_POST['tr_crc'])[0];
      $payment = entity_load_single('payment', $pid);
    
      $payment->method->controller->processFeedback($_POST, $payment);
      echo "TRUE";
    }
    
  3. In transferuj_pl_verify_access function again using $_POST directly and also using md5() that should not be used for anything security related. You should use drupal_hmac_base64() instead. Can you just use drupal_get_token() instead?
Coding style & Drupal API usage
  1. In class TransferujPlPaymentMethodController contains some constant values like IP and redirect URL, can you add some comment on these. Can;t we manage this information through admin?
  2. Function public function validate(Payment $payment, PaymentMethod $payment_method, $strict) { don't contains any body, if it require mention this in To Do list or remove it.
  3. In TransferujPlPaymentMethodController.inc file, as mentions above, better to avoid md5() and use other function.
  4. (*) This file transferuj_pl.pages.inc code need to be improved. Like you can use #attached to add your js code. Sanitize $_POST array before using in your code, make sure to read https://www.drupal.org/node/28984 again.
  5. hook_help() is missing in your module.

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

Please don't remove the security tag, we keep that for statistics and to show examples of security problems.

As I am not a git administrator, so I would recommend you, please help to review other project applications to get a review bonus. This will put you on the high priority list, then git administrators will take a look at your project right away :-)

Thanks Again!

Luke_Nuke’s picture

Status: Needs work » Needs review

Thank you very much for your review! All good points.

Can you follow the steps in the link and confirm that the functionality contained in this module should stay separate from Commerce Transferuj.pl?

Commerce Transferuj.pl is a payment method made specifically for Drupal Commerce, and is using Drupal Commerce API. My module, as stated in the description, is made on top of Payment API, which make it usable with Drupal Commerce, but also with anything else that is using Payment API. Because we are aiming at different APIs, I'm not considering my module a duplicate.

README.txt/README.md
No: Doesn't follows the guidelines for in-project documentation and the README Template. There is no info on how to use or confgure this, or how it works.

Thank you for this template. I updated README.txt accordingly.

Secure code

(+) In transferuj_pl_form_redirect function you are directly using tag.
Fixed.
In following code, you are accessing $_POST array directly that is completely unsecured to use.
Fixed.
using md5() that should not be used for anything security related. You should use drupal_hmac_base64() instead. Can you just use drupal_get_token() instead?
This md5 sum is a part of transferuj.pl API, so I cannot do anything about this unfortunately. Coding style & Drupal API usage
In class TransferujPlPaymentMethodController contains some constant values like IP and redirect URL, can you add some comment on these. Can;t we manage this information through admin?
Documented those variables. The link where we redirecting payers is unchangable by the terms of transferuj.pl API, the array with IP is an array of IPs from which we are accepting transactions verification requests. To be honest, I'm not yet sure where to expose this, I guess it is a TODO.
Function public function validate(Payment $payment, PaymentMethod $payment_method, $strict) { don't contains any body, if it require mention this in To Do list or remove it.
Removed.
Sanitize $_POST array before using in your code, make sure to read https://www.drupal.org/node/28984 again.
I don't know how should I sanitize it. It is trusted data from transferuj.pl, verified by the md5sum, on heavy guarded page. I could use regexes to ensure that data have always the same pattern but on the otherhand - some of those parameters are not quaranteed to have the same pattern always (like transaction ids), so I think we shouldn't be too picky about this, because we cannot do too much.
Luke_Nuke’s picture

Priority: Normal » Critical

Raising status because two months have passed.

Luke_Nuke’s picture

Status: Needs review » Closed (duplicate)

I'm closing this and will try with simpler - non third party module, that would be easier to review.

apaderno’s picture

Priority: Critical » Normal
Related issues: +#2367025: [D7] Entityreference Select View Per Context