The 'add a card' feature (issue #2325639: Add card on file outside of the checkout process) checks if the user already has stored cards (and therefore a beanstream.com payment profile). If they do, the new card gets added to the same beanstream profile. If they do not already have a stored card, a new beanstream profile is created.

This logic should also be implemented when adding a new stored card during the checkout process. Current behaviour is a new beanstream profile gets created everytime a user adds a card during checkout. The card is still properly linked from Drupal to beanstream, but it creates unnecessary duplicate in beanstream profiles.

Comments

momass@gmail.com’s picture

Category: Feature request » Bug report
Status: Active » Needs review
StatusFileSize
new12.92 KB

I have modified commerce_beanstream.api.inc. Under the create_profile callback, on checkout before creating a new profile it now queries which cards are on file in the drupal database. If there are any, it will use the first card returned remote_id to add the new card to the payment profile in beanstream. If no cards exist then it will create a new profile. To get this to work I had to modify the way we check the response from beanstream.

Also, the way the logic works, after the card is added then the transaction is run. If the card fails, and there is only one card within the profile, it will remove both the profile and the card. I have simply changed the way this was done, the way it was coded in before didn't seem to be working. This is reflected on the hook_submit button within the .module file.

Both changes are reflected in this patch.

spiderman’s picture

Assigned: kylesmith » spiderman
Status: Needs review » Reviewed & tested by the community

@tom.mannell: This is great, thanks for your efforts. I've reviewed and tested this patch, and I can see that it's working as desired, and certainly running transactions better than before. I'll commit this tonight, and roll it into a fresh release soon.

spiderman’s picture

Status: Reviewed & tested by the community » Fixed

This is committed and rolled into new 2.0-alpha1 release.

Status: Fixed » Closed (fixed)

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