Features:
This modules integrates with Commerce Shipping 7.x-2.x and USPS Web Tools to provide shipping quotes for Drupal Commerce websites who wish to use USPS as a shipping method.

History and Differnce From Commerce Shipping USPS:
This project is a fork, rename and upgrade of the original Commerce Shipping USPS that has now had its development suspended: http://drupal.org/project/commerce_shipping_usps. It was decided that the Drupal Commerce Shipping modules should be named "Commerce Method" instead of "Commerce Shipping Method" as a convention: http://drupal.org/node/1348088. Since we could not rename the module, we (the commerce shipping usps maintainers) cloned the original and created a new module so that the attribution was not removed from the original project. Also, the original commerce shipping usps was build on the Commerce Shipping 7.x-1.x which has been upgraded to Commerce Shipping 7.x-2.x. It is stated that any new shipping module development should be developed on the Commerce Shipping 7.x-2.x API. This fork allows Commerce USPS to work in conjunction with other shipping methods that use Commerce Shipping 7.x-2.x including Commerce UPS.

Project Link:
http://drupal.org/sandbox/andyg5000/1526238

Git URL:
git.drupal.org:sandbox/andyg5000/1526238.git

Drupal Version:
Drupal 7

Reviews of other projects
http://drupal.org/node/1524330#comment-5879492
http://drupal.org/node/1483532#comment-5879326
http://drupal.org/node/1505236#comment-5879376

http://drupal.org/node/1246104#comment-5908998
http://drupal.org/node/1442252#comment-5940176
http://drupal.org/node/1237070#comment-5944266

Comments

andyg5000’s picture

Issue tags: +PAreview: review bonus

Added PAReview: review bonus

chhavik’s picture

Status: Needs review » Needs work
Issue tags: -PAreview: review bonus

The following git branches do not match the release branch pattern, you should remove/rename them. See http://drupal.org/node/1015226

remotes/origin/7.x-1.x-dev

Review of the 7.x-1.x branch: Nice work on coding standards, just a minor warning. See http://ventral.org/pareview/httpgitdrupalorgsandboxandyg50001526238git.

Manual review :-

  • commerce_usps.module :- Line 68, Your using hook_form_alter() but you could also use hook_form_FORM_ID_alter(), looks better ;)
  • commerce_usps.module :- Line 81, 149, 163 ,182 , 195 Use proper comments, add param and return. Refer Doxygen and comment formatting conventions
  • Add a .install file to your module to delete all those variables which you are setting in commerce_usps.inc. Refer hook_uninstall.

Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

andyg5000’s picture

Status: Needs work » Needs review

I've completed all of the suggestions with the exception of one. The minor warning from PAReview.sh involves the XML requests that are made to USPS. Their API specifies the use of "< RateV4Request >" which is capital. So the inconsistency with XML standards lies in their court. I'll attempt to do some reviews later tonight. Thanks!

andyg5000’s picture

scarer’s picture

Hi there,

Just had a look at your code. I haven't installed and tested it or run it through ventral yet.

I noticed in this function on line 196 in your main module file:

function commerce_usps_trim_service($service_name) {
return str_replace("<sup>&reg;</sup>", "", $service_name);
}

You use double quote instead of single quotes. Was there a reason for this? The double quote slows PHP down a little as it has to parse the strings in double quotes - unless you intended this? The str_replace function should work using single quotes.

In the commerce_usps.xml.inc file, with the values passed to $field_name and shipping_profile, are these values sanitized? (i.e. http://drupal.org/node/28984) Also are the values where you are performing the preg_replace and str_replace in the module file also sanitized? No clue as to what the USPS service code has in it that might do these things.

About to install it on a test instance and see what happens.

Cheers

andyg5000’s picture

Hey @scarer,
I've swapped the quotes and comitted the change. Thanks for the pickup. I'll look at sanitizing the returns from USPS.
Thanks,
Andy

andyg5000’s picture

The strings that are being ran through preg_replace are set in the module so there is no need to sanatize them. As for the strings that are returned through USPS api, they are expected strings that do not change. We have followed the basic flow of the Commerce UPS module and they are handling their values the same way. Let me know if you find anything else and thanks for reviewing!

andyg5000’s picture

Issue summary: View changes

Updated reviews of other projects

scarer’s picture

No problem. Just trying to get the module working on a Drupal 7 instance. I haven't used the commerce module much before. It seemed to install OK. A lot of dependencies. I haven't experienced any errors as yet.

klausi’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -PAreview: review bonus

Review of the 7.x-1.x branch:

  • Drupal Code Sniffer has found some issues with your code (please check the Drupal coding standards).
    FILE: ...l-7/sites/all/modules/pareview_temp/test_candidate/commerce_usps.module
    --------------------------------------------------------------------------------
    FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
    --------------------------------------------------------------------------------
     99 | ERROR | Line indented incorrectly; expected 8 spaces, found 9
    --------------------------------------------------------------------------------
    
    FILE: ...-7/sites/all/modules/pareview_temp/test_candidate/commerce_usps.xml.inc
    --------------------------------------------------------------------------------
    FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
    --------------------------------------------------------------------------------
     37 | ERROR | Line indented incorrectly; expected 4 spaces, found 6
     98 | ERROR | Line indented incorrectly; expected 4 spaces, found 6
    --------------------------------------------------------------------------------
    

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Get a review bonus and we will come back to your application sooner.

manual review:

  1. "'description' => t($description),": do not pass variables to t() where possible, as this cannout be detected by translation extraction tools.
  2. "$description = 'USPS ' . $available[$service] . ' service.';": you should use placeholders for translatable strings.
  3. "module_load_include('inc', 'commerce_usps', 'commerce_usps.xml');": No need to use module_load_inlcude as you are including files from your own module which you already know where they are. Use something like require_once dirname(__FILE__) . '/mymodule.inc';
  4. commerce_usps_service_list(): if that are user facing strings, they should run through t() for translation.
  5. "variable_get('commerce_usps_markup')": there is no UI to set this variable? Also you should probably use an appropriate text filtering function, or is the sanitization done elsewhere? See http://drupal.org/node/28984
  6. "@param object $order": The order is not a stdClass object, you should use the class name here. Also elsewhere. See http://drupal.org/node/1354#functions the data types section.

But that are just minor issues, otherwise this looks RTBC to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

patrickd’s picture

Status: Reviewed & tested by the community » Fixed

Maybe you could also add the configuration page as "configure = " key to your info.

Thanks for your contribution and welcome to the community of project contributors on drupal.org!

I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

As you continue to work on your module, keep in mind: Commit messages - providing history and credit and Release naming conventions.

Thanks to the dedicated reviewer(s) as well.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Added more reviews list to the main issue description