The rule reaction for capturing from a prior authorization seems to be unimplemented, as there is no code in the function commerce_payment_capture($order, $amount)

Files: 
CommentFileSizeAuthor
#16 commerce_payment-add_back_working_capture_rule_action-1820356-16.patch3.08 KBtmsimont
PASSED: [[SimpleTest]]: [MySQL] 3,557 pass(es).
[ View ]
#7 commerce_payment-add_back_working_capture_rule_action-1820356-7.patch3.09 KBtmsimont
PASSED: [[SimpleTest]]: [MySQL] 3,570 pass(es).
[ View ]
#3 commerce_authnet_capture_callback-1820356-3.patch4.08 KBdruroot
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch commerce_authnet_capture_callback-1820356-3.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#2 commerce_payment_capture-1820356-2.patch2.73 KBdruroot
PASSED: [[SimpleTest]]: [MySQL] 3,570 pass(es).
[ View ]
#1 1820356-1.commerce_payment_capture.patch1.05 KBrszrama
PASSED: [[SimpleTest]]: [MySQL] 3,570 pass(es).
[ View ]

Comments

Version:7.x-1.3» 7.x-1.x-dev
Status:Active» Needs review
StatusFileSize
new1.05 KB
PASSED: [[SimpleTest]]: [MySQL] 3,570 pass(es).
[ View ]

Yep, honestly I have no clue what this code is doing in here. It must have been accidentally committed from an in progress patch along with other payment module changes. Unfortunate, but I suppose the best we could do is just delete the code. I'll just need someone to test what happens in the UI if a Rule has this action on it and then the action disappears in code (patch attached).

StatusFileSize
new2.73 KB
PASSED: [[SimpleTest]]: [MySQL] 3,570 pass(es).
[ View ]

I think this is a worthwile feature to have, it's something I need for a site that I'm working on that does recurring billing with a free trial. Here's a patch that implements this rule by reading the base property of the payment_method and looking for a _capture callback implemented by the payment module. I also have a sample implementation patch for the authnet module that I'll post in another comment.

StatusFileSize
new4.08 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch commerce_authnet_capture_callback-1820356-3.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Here's a patch to the authnet module that implements the _capture callback. Most of the code for capturing from a prior authorization was taken from the form submission handler for commerce_authnet_aim_capture_form. To reduce code duplication, I've collapsed the code from that submission handler to utilize this new callback.

This serves as an example implementation accompanying the code in #2, and if that code is accepted, then I can post this patch into a new issue in the commerce_authnet queue.

Status:Needs review» Needs work

The last submitted patch, commerce_authnet_capture_callback-1820356-3.patch, failed testing.

Component:Rules integration» Payment

OK so I'm confused now... I can't tell if this is a duplicate of my other issue or not.

In any case, the rule is a required step for Paypal WPP to work. It looks like druroot's first patch might have fixed the problem, but I'm not sure if that should be in Commerce core of if it should be added to the WPP module

Status:Needs work» Needs review
StatusFileSize
new3.09 KB
PASSED: [[SimpleTest]]: [MySQL] 3,570 pass(es).
[ View ]

OK this is a 2 part problem with WPP and this module. I think that the rule action that used to be here without code was a necessary rule for the commerce payment process.

The rule wouldn't do anything on its own, but it allows other modules to define a [module_name]_capture callback to "hook" into this rule action.

If we put this rule back, it will provide a nice and clean method for other payment modules to use an authorize, then capture approach. I think this belongs here in commerce and not in other modules because this rule would be necessary for any payment module that would want to utilize such an approach.

I've got a patch for WPP, too, that I've tested along with the attached patch here.

I've attached the referenced WPP patch here #1851340: WPP: Payment to paypal sent before Review is submitted

Status:Needs review» Needs work

Status:Needs work» Needs review

Status:Needs review» Needs work

that's odd -- i don't see how any fatal errors could come of this.. i will have to try to run it on a clean install i guess

Yeah, me neither. I think something might've been screwy in test bot.

Status:Needs work» Needs review

yay

StatusFileSize
new3.08 KB
PASSED: [[SimpleTest]]: [MySQL] 3,557 pass(es).
[ View ]

Last patch had trailing whitespace.. this one should do

Status:Needs review» Needs work

I think - maybe from the originally stray code - this has gone down slightly the wrong route.

The permitter being passed to the action is the order, but it should be the authorise transaction as this is what is being captured.

Status:Needs work» Needs review

I tested the patch from #16 and it worked (of course I had to add a hook_capture function to my payment module). The transaction didn't seem to have to come in as a parameter since it was looked up using the order.

I've kind of given up on the need for this in light of rszrama's comments in this other issue: #1851340: WPP: Payment to paypal sent before Review is submitted

If anyone else wants to pick up from where I've left it and get the rule to work that's cool but I no longer need this so I probably won't be able to make time for it.

I'm trying to implement a flow where once a product is sold out the authorised payments from WPP are then captured as outlined in this post - http://drupal.org/node/1964390

This patch in #2 looks like just what I'm after. I've applied the patch and then successfully used Rules to check when the stock level reaches 0 and then load all the related orders into Rules via VBO

I'm then looping through the orders and performing the "Capture from a prior authorization" that your patch provides on each order. Additionally I'm displaying a message with each order number to check everything is getting through correctly.

Everything is working except that the "Capture from a prior authorization" isn't performing the capture. Is this because the WPP module doesn't have the capture call back required or am I doing something else wrong?

edit - I've now also applied the patch for WPP in this post - http://drupal.org/node/1851340

When I test it is throwing an error that arguments 3 and 4 are missing from commerce_paypal_wpp_capture()

Any ideas why that might be? I'm so close to getting this working :-)

edit2

Ignore me I'm an idiot. I'm now using both the WPP and the Payment patches from tmsimont and everything is working perfectly