My company uses Linkpoint for all of our clients, so a need arose for a more well rounded module to support payments. After working with Linkpoint and this code for several months I just decided to restructure everything and add more features.

Attached is my version, which I propose to be version 2.x

Changes:
-- Full support for Ubercart's built in transaction type system. Now you can select "Authorization Only" or "Authorize and capture immediately". Doing so, I eliminated the setting where you can select SALE or PREAUTH. It doesn't make sense to support both.
-- Much more extensive information is detailed in the order admin logs.
-- Added AVS and CVV "translations", similar to how Authorize.net handles it.
-- Removed the order voiding when AVS response response is not satisfactory. I didn't like the part where it moved a preauth to an sale, and then voiding. If the AVS doesn't match - we certainly don't want to charge the card at all.
-- Can now capture funds from a preauth using the "Process Card" button. You no longer have to do this in Linkpoint Virtual Terminal :)
-- Overall structure changed around
-- Adding check in to make sure the PEM file exists in the settings form.

If someone could please look this over and see if I missed anything that would be great. I am using this on one site right now, but will change all of my sites over to using it soon.

Comments

bkosborne’s picture

StatusFileSize
new20.36 KB
bkosborne’s picture

I'd also like to request co-maintainership of the module to help develop and maintain it further.

jrust’s picture

Status: Active » Needs work

Thanks for pitching in to make it a better module. Looks like a number of good improvements. A few things that I noticed:
- The fraud detection functionality that got introduced in v. 1.3 isn't there. You mention it being present, but I don't see any of the existing settings.
- Along those lines, I'm also not a fan of having to Ticket and then Void a transaction that fails the fraud check, but it needs to be a setting. Our shop goes through all the orders at the end of the day and marks them as Shipped in linkpoint. We can't risk them marking an order as shipped that was actually just an auth that failed our fraud check.
- Indenting/whitespace looks off from the "2 spaces" drupal standard.

thanks!

bkosborne’s picture

Thanks for going over it jrust! I appreciate it.

For the fraud detection, I mentioned that I had removed it. Looking over the code, it seems that you're talking about the system automatically charging and then voiding a credit card based on what the user dictates are appropriate AVS and CVV responses, correct?

Could you elaborate on what you mean by marking an order as shipped in Linkpoint? To my knowledge, an order will be marked as shipped automatically by the system when an order is a SALE txn or a POSTAUTH txn. As I understand it, your shop owners just go through and move PREAUTH orders to a complete sale by doing a ticket transaction.

The functionality I've added allows you to do this in Ubercart itself now. Credit cards can now be charged through the API using Ubercart. This eliminates the need for your store keepers to go through the linkpoint virtual terminal for most occasions. I understand that you don't want bad/rejected cards to be marked as shipped, and you would simply not "charge" the cards in Ubercart now.

Does this make sense? Are we on the same page?

I apologize for the tab issue. I work in Coda, where I do indeed use two space tabs, but when I copied it into TextEdit, the tab lengths were not retained.

rszrama’s picture

@bkosborne, I'm wondering if you can post your changes as a patch instead of just the module as a text file. See http://drupal.org/patch/create for more info.

bkosborne’s picture

ryan,

Haven't done that because the changes are rather significant. The patch file would be a total mess... that's why I'd rather fork it to a 2.x branch.

jrust’s picture

Hey there,
Yes, the functionality of blocking an order based on the fraud settings is definitely something we need to maintain in the module. I don't want to remove functionality unless there's a good reason. When an order is blocked because of the fraud settings something has to happen on the Linkpoint side to cancel that AUTH/SALE. For stores that use PREAUTH the only way to safely do this is to do a POSTAUTH and then VOID it because there is no way to only cancel a PREAUTH. For stores that do a SALE a VOID can be done directly and no POSTAUTH is needed -- and the current code accounts for this.

A patch would be better so we can see exactly what is being added/changed. It's just a matter of checking out HEAD from cvs, copying over your changes and doing a cvs diff -up

I don't think we need to branch to 2.x version for this. A new branch is needed when backwards compatibility is broken because of the new features. In this case there is a lot of shuffling of code under the hood, and some new functionality, which warrants a version bump, but not a new branch.

jrust’s picture

Oh, and even if admins process transactions through the Ubercart side instead of Linkpoint side, transactions still have to be auto-cancelled if it blocks the order due to fraud settings. Otherwise, the transaction will still be in Linkpoint and will charge the customer.

bkosborne’s picture

jrust,

Linkpoint's take on the matter is that it doesn't really matter what you do when you want to void a preauth. You could either just leave the preauth there or move it to post and void like you did. My personal preference was to not move it to a postauth at all because it felt strange to charge a card at all if the AVS was not satisfactory. I also guess that's because we now process all post-auths through Ubercart and wouldn't accidentally do it through the virtual terminal.

I also suppose I overlooked SALE transactions, which would need to be voided right away anyway.

Regardless, I'll add back in that functionality and post a patch tonight or tomorrow night for review.

jrust’s picture

Cool, please make sure you do it against HEAD as there have been new patches applied recently.

bkosborne’s picture

Took a bit longer than anticipated. I wanted to implement voiding the orders in as clean way as possible, so I spent some more time on it. I finished it tonight, I'll be doing some testing throughout the weekend and post when finished... Don't think anyone is holding their breath anyway!

lotyrin’s picture

subscribing

bkosborne’s picture

Status: Needs work » Needs review
StatusFileSize
new44.2 KB

Patch attached. Sorry for the delay, never patched a module before.

I went through all of the revisions since 1.2 (which is what I was working from originally I believe) and added in everything. I may have missed something, so this needs to be reviewed. I've tested it with a test LP account and will be trying it out with a real one in a few days.

I DO apologize if it seems that I rewrote a lot of what was done. I went through the code and did several changes of the structure. It became very tricky when trying to properly implement voiding without duplicating a lot of code. I tried to comment and keep everything organized. Hopefully not too confusing.

Don't think I mentioned this before, but I've also added order prefixes in the settings.

Looks like it replaced the whole module in the patch.... perhaps because of line breaks... i'm looking into it

bkosborne’s picture

StatusFileSize
new34.74 KB

Fixed, thanks to lotyrin. Thanks

jrust’s picture

Status: Needs review » Fixed

Great stuff, definitely a great improvement. It's committed with a few changes:
- Added an update hook to copy over old transaction method
- Added some munging to ensure a unique order ID when doing charges using the admin side
- AVS and CVV result for POSTAUTH is empty so it needed to account for that.

Please test it out and update if it works for you. Once we get a few people testing it I'll put out a new release. CVS access granted, please make sure to create an issue for every commit so users can keep track of what's going on and so we have a CHANGELOG for releases.

jrust’s picture

I spoke too soon regarding CVS. You'll need to apply for a CVS account first, bkosborne.

jrust’s picture

Title: Request for version 2.x of this module, code attached » Integrate more tightly with the UC Payment module
avpaderno’s picture

FYI, bkosborne is now co-maintainer of this project.

bkosborne’s picture

Status: Fixed » Needs work

jrust,

There is a problem with what you added in there for determining the order number.

    // If we are charging the account through the backend, we'll need a unique order number based on authorized order
    $orig_order_id = end(array_keys($order->data['cc_txns']['authorizations']));
    if ($_SESSION['uc_linkpoint_attempt'] == 0 && !empty($orig_order_id)) {
      if (preg_match('/-(\d+)$/', $orig_order_id, $matches)) {
        $_SESSION['uc_linkpoint_attempt'] = $matches[1];
      }
      else {
        $_SESSION['uc_linkpoint_attempt'] = 1;
      }
    }
    $_SESSION['uc_linkpoint_attempt']++;

Not sure I understand what you did here. You would never get to this code if the transaction is a POSTAUTH, but you are trying to get the order ID from a prior authorization... But that wouldn't exist. Not quite sure what the intention here was.

I did notice some other issues with backend processing though.

1. If someone were to create an order in the backend and charge the credit card, but there is an issue, the order number will indeed increment and another attempt can be made. However, if this person were to exit the browser and try again later (or if someone else tried), that session variable keeping track of the transaction attempt is lost.

2. If someone were to create an order in the backend and only charge partial amounts to the subtotal (or just add additional funds to the order through a CC purchase), it will work the first time. However, if they go back to charge the card or another card so the SAME order later, it will not work. This is for the same reason above: the order number is reset and you will get an error because that order number already exists in Linkpoints database.

I'm working out how to remedy this situation, but in the meantime the module currently throws out warnings when orders are created normally. I'll post a patch for all this sometime tonight hopefully.

jrust’s picture

Status: Needs work » Fixed

Moving to a separate issue.

Status: Fixed » Closed (fixed)

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