News:

Support the VirtueMart project and become a member

Main Menu

Coupon bug with Paypal Pro and Authorize.net

Started by seyi, December 15, 2013, 17:25:25 PM

Previous topic - Next topic

seyi

Hello,

I have noticed a bug that I first saw with Paypal Pro and now also exists with Authorize.net.

To test
- create a coupon code of type "Gift"
- select either Paypal pro or authorize.net in the front end
- in confirming your order be sure your transaction gets declined the first time

What happens:
The coupon is removed from the cart, deleted from the backend, and cannot be used again

Why does it happen:
It seems the extensions on decline are throwing away the original generated order id and creating a new one for each decline.  The coupon has already been marked as used for the initial order id and cannot be then re-added to the new order id.

Is there a reason for creating new order id's and not just using the original order id
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - [url="http://www.awocoupon.com/starter"]http://www.awocoupon.com/starter[/url]
   - AwoCoupon Pro - [url="http://awodev.com/products/joomla/awocoupon"]http://awodev.com/products/joomla/awocoupon[/url]
   - AwoRewards - [url="http://awodev.com/products/joomla/aworewards"]http://awodev.com/products/joomla/aworewards[/url]
   - AwoAffiliate - [url="http://awodev.com/products/joomla/awoaffiliate"]http://awodev.com/products/joomla/awoaffiliate[/url]

lindapowers

#1
Hi Seyi

I already cried like a thousand times since the days of VM1 about coupons getting deleted independently of the order status result.

Even in your forum https://awodev.com/forum/awocoupon/help-section/coupon-valid-again-when-order-cancelled

Maybe the code provided by Stan from Rupostel in this post helps you but the logic is to delete the coupon in a selected status (confirmed in our case) avoiding VM from deleting it by default.

http://forum.virtuemart.net/index.php?topic=120205.0

BTW this happens with all payments, VM just deletes the coupon ignoring the result of the transaction. Once is added gets deleted, Happens the same with credit card systems or even the standard payment methods.

Even if the transaction remains pending the coupon is lost.
[url="https://www.lluislaw.com"]https://www.lluislaw.com[/url] -

seyi

Thanks for the post, I will probably have to implement something like that, but that seems like a work around instead of a solution to the problem.

I do fully agree with this statement from Milbo:
Quote
When I go in a shop and use a coupont, the coupon is gone,.. when I do refund, I may get another coupon. From my point of view it is absolutly correct that a coupon is gone in the moment you have it in the cart and press "confirm checkout".

But the problem is the behavior of the payment methods deleting the order with the coupon code and creating new ones because the customer accidentally entered the wrong payment information.  I do not think they should loose the coupon code at that point, that makes no sense, to them it is the same order.
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - [url="http://www.awocoupon.com/starter"]http://www.awocoupon.com/starter[/url]
   - AwoCoupon Pro - [url="http://awodev.com/products/joomla/awocoupon"]http://awodev.com/products/joomla/awocoupon[/url]
   - AwoRewards - [url="http://awodev.com/products/joomla/aworewards"]http://awodev.com/products/joomla/aworewards[/url]
   - AwoAffiliate - [url="http://awodev.com/products/joomla/awoaffiliate"]http://awodev.com/products/joomla/awoaffiliate[/url]

lindapowers

#3
Quote from: seyi on December 16, 2013, 15:42:57 PM
Thanks for the post, I will probably have to implement something like that, but that seems like a work around instead of a solution to the problem.

I do fully agree with this statement from Milbo:
Quote
When I go in a shop and use a coupont, the coupon is gone,.. when I do refund, I may get another coupon. From my point of view it is absolutly correct that a coupon is gone in the moment you have it in the cart and press "confirm checkout".

But the problem is the behavior of the payment methods deleting the order with the coupon code and creating new ones because the customer accidentally entered the wrong payment information.  I do not think they should loose the coupon code at that point, that makes no sense, to them it is the same order.

Well Seyi but why is that different from a customer loosing his coupon due to a slow connection or cause he accidentaly closed the window or from credit card payments.

And what for a pending order which remains in that status and never gets processed? Coupon is lost too.

I agree with you in the payment issues, makes no sense there, but for me those are just 2 examples of many other possible cases which end up showing that a coupon can't just be deleted by adding it to the cart so I can't agree with Milbo or you there.

Stan's solution saved us from hundreds of calls from customers pissed for loosing their coupon without making use of them.


Regards

[url="https://www.lluislaw.com"]https://www.lluislaw.com[/url] -

seyi

The only way to absolutely make sure a coupon does not get used more than once is to mark it used on order creation.

Take for example using a gift certificate of $100, and you have bank transfer and credit card processing on your front end.  If you allow the code to be marked on the confirm stage, a customer could
- order 1: purchase using the gift certificate with the bank transfer option (which will put the order into pending)
- order 2: purchase again with the same gift certificate using a credit card, this time the gift certificate gets marked as used.
- the customer then pays the remaining amount on order 1 using  the bank transfer option. 

Now if the admin is not paying attention, they would mark the order confirmed and again the gift certificate gets marked.  But there is no control since the order has been created and coupon used.  In this case the customer got away with $200 discount instead of $100.

To be honest it does not even have to be that complicated, you could manipulate it with 2 different open sessions.

But I understand your point, to each his own, everyone should have the option to do as they wish.
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - [url="http://www.awocoupon.com/starter"]http://www.awocoupon.com/starter[/url]
   - AwoCoupon Pro - [url="http://awodev.com/products/joomla/awocoupon"]http://awodev.com/products/joomla/awocoupon[/url]
   - AwoRewards - [url="http://awodev.com/products/joomla/aworewards"]http://awodev.com/products/joomla/aworewards[/url]
   - AwoAffiliate - [url="http://awodev.com/products/joomla/awoaffiliate"]http://awodev.com/products/joomla/awoaffiliate[/url]

lindapowers

#5
- order 2: purchase again with the same gift certificate using a credit card, this time the gift certificate gets marked as used.

Hi Seyi, is quite more simple that it seems. Ill tell you the process in our live site.

The user can't do that cause the bank transfer order (in our case) is automatically confirmed - Therefore: cupon erased.

Thats how we play with order status and this setting.

A standard payment as cash on delivery or bank transfer can never remain pending  (we leave that just for paypal, credit card process) so the result is either confirmed by shopper or confirmed and the coupon cant be used twice.

You could say that ok, I dont want bank transfer orders to be automatically confimed, so simply use "confirmed by shopper" which I think is the default and tell the system that on "confirmed by shopper" and "confirmed" coupons get erased so theres no way they can do what you describe.

Regards
[url="https://www.lluislaw.com"]https://www.lluislaw.com[/url] -

seyi

Ah I see, had not thought of that, so in effect, all orders with coupons are marked as used in the front end.

But that still does not cover a savvy user opening 2 separate cart sessions with the same coupon code, and using paypal, moves both orders to paypal (pending status) before paying for both of them.

Obviously if the admin is paying attention that can be caught, but some sites are too busy (or lazy) to notice such things.

I have no choice but to add the option to mark a coupon as used on specific order status(es) in AwoCoupon as this problem does not look like it is going anywhere.  Just feel a "gift" coupon becomes a "mostly gift" coupon.
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - [url="http://www.awocoupon.com/starter"]http://www.awocoupon.com/starter[/url]
   - AwoCoupon Pro - [url="http://awodev.com/products/joomla/awocoupon"]http://awodev.com/products/joomla/awocoupon[/url]
   - AwoRewards - [url="http://awodev.com/products/joomla/aworewards"]http://awodev.com/products/joomla/aworewards[/url]
   - AwoAffiliate - [url="http://awodev.com/products/joomla/awoaffiliate"]http://awodev.com/products/joomla/awoaffiliate[/url]

alatak

Hello
I am going to add an option for the coupon
- it will not be deleted, but just not usable again when the order is on a specific order status
[url="//www.alatak.net"]www.alatak.net[/url]
Extensions for VirtueMart: [url=https://alatak.net/en/extensions.html]https://alatak.net/en/extensions.html[/url]

alatak

#8
Hello

So i though about that:

To set the coupon "in use" with the session id when the order is created (order status = pending)
If a second user uses the same coupon with a different session id , if the coupon is i"in use" with a different session id, while checking out, then an error message "coupon is not valid any longer" is displayed

but now about the checkout workflow, there is a problem:

case 1:
create order=> coupon in use
order status  changes: coupon is removed
OK

case 2:
create order=> coupon in use
cancel order => coupon not in use (in function function pluginUserPaymentCancel() )
OK

case 3:
create order=> coupon in use
client does not pay
order is pending the coupon stays in use
NOT OK

and this case 3 i do not really know how to solve it

[url="//www.alatak.net"]www.alatak.net[/url]
Extensions for VirtueMart: [url=https://alatak.net/en/extensions.html]https://alatak.net/en/extensions.html[/url]

lindapowers

#9
Hi Valérie

Thanks for looking at this.

I have just checked the problem commented by Seyi and you about the possibility that a customer uses the same coupon twice (the session ID you speak about)


I did the following:

FIREFOX: - Log in as a customer and add one gift coupon to the cart:

INTERNET EXPLORER: Log in as same customer and add the same coupon to the cart.

-----------------------------------

At this point the same coupon is applied in both orders (in theory)

FIREFOX I proceed to checkout and end up the order making use of the coupon - CORRECT (Confirmed Status: Coupon deleted)

INTERNET EXPLORER The same coupon here was added at the checkout but when I click to proceed I'm redirected to the homepage instead of completing the order.

When I go back to the cart the coupon is lost already and removed from the checkout.

-------------------

Resuming: I'm unable to checkout twice with the same coupon.


Did Stan view this possibility already in that code or is VM2 already prepared to avoid that, or just  my own configuration which prevents that.

The case is that theres no way that customers make use of the same coupon twice but you 2 are the experts, correct me if I'm wrong.

I just dont see how that is possible.


Regards
[url="https://www.lluislaw.com"]https://www.lluislaw.com[/url] -

seyi

Hello lindapowers,

You confirmed the first order too quickly.  This is specifically for paypal.  You would have to put both orders in the "pending" stage, cant have one in a cart session.  With paypal, it is a matter of clicking the confirm button and being forwarded to paypal before paying for anything.  I produced it easily yesterday when testing.

But that hole will be plugged with Valérie's "in use" concept.  This might work well for Virtuemart's 1 time gift coupons since they are so simple, but would be a nightmare for AwoCoupon, way more complicated coupons.

Hi Valerie, for this:
Quote
case 3:
create order=> coupon in use
client does not pay
order is pending the coupon stays in use
NOT OK

Not really any thing you can do as there is no more human interaction triggers.  The only thing I can think of is to run a cron, and after a certain amount of time has passed, free up the coupon.

Any chance the core could be reworked to only use one order id through a full cart session not matter the errors?  Or this is just the reality?

Thanks for looking into it.

Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - [url="http://www.awocoupon.com/starter"]http://www.awocoupon.com/starter[/url]
   - AwoCoupon Pro - [url="http://awodev.com/products/joomla/awocoupon"]http://awodev.com/products/joomla/awocoupon[/url]
   - AwoRewards - [url="http://awodev.com/products/joomla/aworewards"]http://awodev.com/products/joomla/aworewards[/url]
   - AwoAffiliate - [url="http://awodev.com/products/joomla/awoaffiliate"]http://awodev.com/products/joomla/awoaffiliate[/url]

alatak

Hello
I am doing it. Even if it not perfect, it will at least prevent somebody form using twice the coupon for 2 different orders, and will not removed the coupon when the order is created.
[url="//www.alatak.net"]www.alatak.net[/url]
Extensions for VirtueMart: [url=https://alatak.net/en/extensions.html]https://alatak.net/en/extensions.html[/url]

Milbo

Seyi, please come skype to test the version, thank you.
Should I fix your bug, please support the VirtueMart project and become a [url=http://extensions.virtuemart.net/support/virtuemart-supporter-membership-detail]member[/url]
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

alatak

Hello
QuoteResuming: I'm unable to checkout twice with the same coupon.

QuoteYou confirmed the first order too quickly.  This is specifically for paypal.  You would have to put both orders in the "pending" stage, cant have one in a cart session.  With paypal, it is a matter of clicking the confirm button and being forwarded to paypal before paying for anything.  I produced it easily yesterday when testing.
yes exactly

So in the next version, the coupon is not deleted any longer when the order is created, but the coupon is in state "in use", and it is deleted on a specific order status (set in the config, and by default being Confirmed)
It is not any longer possible to use twice a gift coupon.
The only issue is that the checkout is "blocked" for the cart using the 2nd time the coupon, and no message is displayed. We know that issue, and we will fix it in the VM2.1. Anyway that only concerns people trying to use twice the coupon....


[url="//www.alatak.net"]www.alatak.net[/url]
Extensions for VirtueMart: [url=https://alatak.net/en/extensions.html]https://alatak.net/en/extensions.html[/url]

lindapowers

Quote from: alatak on December 19, 2013, 11:22:31 AM
Hello
QuoteResuming: I'm unable to checkout twice with the same coupon.

QuoteYou confirmed the first order too quickly.  This is specifically for paypal.  You would have to put both orders in the "pending" stage, cant have one in a cart session.  With paypal, it is a matter of clicking the confirm button and being forwarded to paypal before paying for anything.  I produced it easily yesterday when testing.
yes exactly

So in the next version, the coupon is not deleted any longer when the order is created, but the coupon is in state "in use", and it is deleted on a specific order status (set in the config, and by default being Confirmed)
It is not any longer possible to use twice a gift coupon.
The only issue is that the checkout is "blocked" for the cart using the 2nd time the coupon, and no message is displayed. We know that issue, and we will fix it in the VM2.1. Anyway that only concerns people trying to use twice the coupon....




Blocking users trying to do that even sounds like a good thing ;)

Thanks for the work, this was really needed.

Regards
[url="https://www.lluislaw.com"]https://www.lluislaw.com[/url] -