Here is the first round for WPP. Patch Pending.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lapith’s picture

FileSize
20.24 KB

This patch works off what was created for WPS and borrows what we could from Ubercart. Seems to be working fine on our end, but could probably use some extending to meet others needs.

pixelsweatshop’s picture

sub

JurriaanRoelofs’s picture

zub

Daemon_Byte’s picture

sub

Seph’s picture

subscribe

jive01’s picture

This is the one thing holding me back from using Commerce instead of Ubercart for a ecommerce site that I'll be working on... here's hoping this get implemented fast.

j0rd’s picture

+1. I'm going to need this for a DC site I'm working on, so I'll probably dig into this when I get there.

j0rd’s picture

FileSize
4.97 KB

@lapith it might be best if you create a GITHUB or module_sandbox for this right now. I'd like to contribute and putting patches against your patches, isn't the best way to go about this.

I've glanced at the code and changed some of the brackets to follow Drupal standards.

If you don't make a github or sandbox, I'll be doing one based off your code shortly for my own development.

j0rd’s picture

FileSize
4.98 KB

Changed some of the wording in the admin side to reflect the wording in the paypal admin relating to API Credentials.

j0rd’s picture

Just tried a test transaction on the latest rc1 of Drupal Commerce and there's a tonne of errors related to payment. So I assume the payment process and hooks have completely changed since May.

When I need to, I'll take a look and post results.

c4rl’s picture

Subscribing

chriscohen’s picture

Subscribing.

rszrama’s picture

Status: Active » Fixed

I just committed a first draft of the PayPal WPP module. I must confess I didn't base it on the work above given j0rd's comment. I based it instead on Commerce Authorize.Net (and a bit of code from my Ubercart integration). I still need to add a capture form to the backend and IPN support to ensure that transactions that are captured at PayPal are updated locally. It'll also need support for credits and voids, things for which there should be templates in my CyberSource module.

I've put it through its paces and would appreciate any feedback. I'm spawning child issues for the features I know need to be added. Bug reports welcome.

Commit: http://drupalcode.org/project/commerce_paypal.git/commitdiff/23e5b6f

c4rl’s picture

Thanks, Ryan.

Here's relevant pending feature issues for everyone's reference:

#1250422: Add PayPal WPP IPN support
#1250424: Improve support for multiple prior authorization captures

j0rd’s picture

@rszrama I've added certificate authentication to WPP. Paypal only allows you to either have certificate OR signature authentication on a single account. Not both at the same time. Unfortunately currently the WPP integration only allows for Signature authentication.

I have a client with an existing network of sites and a paypal account. All of his existing sites use Certificate authentication. Should I want to use Drupal Commerce for this client, I would either need to make all his other sites use Signature authentication, or make Drupal Commerce support Certificate authentication. The later is less work.

Attached is the patch against the latest -dev of commerce_paypal

There is one thing which I'll need you to look at. I couldn't figure out how to add a hook_form_submit or hook_form_validate to the rules configuration of credentials for paypal. Currently I'm using hook_process to do it (based on some docs for the rules module), but I would assume it's not the proper way to do it. You probably have more experience with this than me.

If there is no other way to do this, you might want to figure an easy way to add it, as some validation and submit functionality should be available to the payment processor configuration pages in Drupal Commerce. Examples should be shown. I couldn't find any.

j0rd’s picture

Additionally I would recommend removing CREDITCARDTYPE field. I can't find any information on it, and any semi-intelligent processor can figure it out. Drupal Commerce could also figure it out as well and not post the field. Any non-required additional fields will reduce conversions.

Other than that, the WPP integration appears to work well enough for me.

j0rd’s picture

Another thing. I'm trying to add credit card icons to the payment method title much like Ubercart does it. I think it's better UX and easier to understand for the user.

With that said, how does one get at the payment gateway settings programatically?

function pe_commerce_commerce_payment_method_info_alter(&$payment_methods) {
  dpm($payment_methods);
  foreach($payment_methods as $payment_method) {
    $config = rules_config_load("commerce_payment_" . $payment_method['method_id']);
   dpm($config); 
  }
}

It appears while $config contains the fields from `rules_config` table the rules_config.data (where the payment configuration is stored) isn't in there.

I can't figure it out.

j0rd’s picture

Alright I figured it out. It's not a very good API.

function pe_commerce_commerce_payment_method_info_alter(&$payment_methods) {
  dpm($payment_methods);
  foreach($payment_methods as $payment_method) {
    $instance_id = $payment_method['method_id'] . '|' . "commerce_payment_" . $payment_method['method_id'];
    $pm = commerce_payment_method_instance_load($instance_id);
    dpm($pm);
  }
}

Here's a little crappy module in case you guys are interested in having some icons along with your payment gateways.
http://drupal.org/sandbox/j0rd/1253092

rszrama’s picture

I'm not quite sure what it is you're saying should be possible that isn't. A payment method instance ID is the payment method ID with the name of the action I believe that enables the payment method (or the name of the Rule). It would've included the action's internal Rules ID but there was a problem with their dependability at the time. If you're trying to alter something onto them, the place to do it will be when the Rules element is submitted, not through the payment method info hook. I'll need to know more about your scenario.

Also, the CREDITCARDTYPE field is required for WPP transactions, so I can't easily remove it. : )

We can discern the credit card type from the field, but having the selector was the easiest way to show errors during validation. I'd be happy to add in certificate support; can you open a separate issue up for that? It's just not in b/c their documentation said it's pretty much not recommended any more and I had no way to test it. : P

starsinmypockets’s picture

sub

jakonore’s picture

sub

j0rd’s picture

@rszrama My specific use case was attempting to add credit card icons to the checkout payment selection process. I've created another issue as to not hi-jack this one: http://drupal.org/node/1260674

rszrama’s picture

Ok, great - need to get those icons in there and definitely need to change the "PayPal WPS" label on the radio list. : P

starsinmypockets’s picture

Subscribing

Status: Fixed » Closed (fixed)

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

m4olivei’s picture

Whats the latest on this issue? Is WPP ready to use on a production site?

rszrama’s picture

Yep

m4olivei’s picture

Awesome, thanks fot the quick reply. Very timely as I am putting a quote together for a client as we speak :P.

lapith’s picture

Sorry, I probably should have been a little more active in checking on my old posts.

Yeah the original patch was for a very old version of commerce. We started developing to commerce in the early stages before commerce paypal had wpp mode. We have since moved off of custom code.