I've created a coupon code for a 5% discount on all total products and this works fine. We created an additional coupon for a promotion we wanted to offer for 10%. The settings are EXACTLY the same as the 5% coupon. On the checkout page, the calculations are done correctly. So it appears as if everything works up to this point. But, when the customers get charged by cybersource. It's billing for the total WITHOUT the discount. It only happens on any additional coupons because the first coupon we've created (the 5%) charges the correct amount. Not sure how to troubleshoot this but I suspect it's a settings somewhere because the 5% coupon works as it should.
Comment | File | Size | Author |
---|---|---|---|
#14 | 1785186-cybersource-grandTotalAmount.patch | 817 bytes | longwave |
Comments
Comment #1
wodenx CreditAttribution: wodenx commentedI don't use cybersource so it will be difficult for me to troubleshoot this - but if everything looks right on the checkout page, I suspect this is some sort of incompatablity with that gateway -- maybe CS only allows a single discount line item? Are there any error messages from cybersource in watchdog? Does cybersource give any kind of itemized report for the order?
Comment #2
wodenx CreditAttribution: wodenx commentedComment #3
Digital Fire CreditAttribution: Digital Fire commentedIt does work with the gateway because again, the first coupon works as it should.
Let me clear this up in case there is a misunderstanding. I create an additional coupon for another campaign and the calculations work on the checkout page but the wrong (undiscounted) amount is getting sent to cyber source.
I'm NOT trying to get 2 coupons to work together. These are 2 separate coupons for 2 different discounts. Just the only coupon that actually works is the first coupon i've ever created. The second coupon has all the same settings and does the calculations but doesn't send the correct amount to the payment gateway.
Comment #4
Digital Fire CreditAttribution: Digital Fire commentedLet me know of what I can do to trouble shoot this problem to help you with the fix.
Comment #5
Digital Fire CreditAttribution: Digital Fire commentedAfter running multiple tests, We figured out that there is a specific amount that causes the payment gateway to receive the undiscounted price w/ the correct tax. If the discount is more than 8%, It breaks. I will run more tests today to see if the amount of the coupon that breaks it instead of the number of coupons created.
Comment #6
Digital Fire CreditAttribution: Digital Fire commentedComment #7
Digital Fire CreditAttribution: Digital Fire commentedRelevant Modules & Versions:
Cart 7.x-3.2
Discount Coupons 7.x-2.1-alpha7
Token 7.x-1.4
Entity API 7.x-1.0-rc3
Views 7.x-3.5
Modules Enabled:
- ALL of UC core.
- Catalog, Payment, Product Attributes, Reports, Shipping, Shipping quotes, Tax Reports, Taxes
- Product Kit, Stock
- Flat Rate
- Credit Card, Cyber Source, Discount Coupons
Payment Gateway: Cyber Source
Payment Method: SOAP Toolkit API - Everything here is configured correctly here.
Shipping: Flat Rate (We add $30 for next day air)
Coupon Settings:
- Coupon is Active is checked.
- Discount amount [we are using percentage based discounts. If the discount is BELOW 9%. It works as it should. If its 9% or HIGHER, it sends the undiscounted amount to the payment gateway.] The calculations on the checkout page are ALWAYS correct. No matter the amount of the coupon percentile.
- Apply Discount to: We have tried with Order Subtotal, and Total of matching products. Both cause the same results.
- Redemption Amounts Restrictions are both blank.
This link mentions a similar issue except it is with paypal.
We have also tried with a FRESH & completely bare Drupal 7, UC 7.x-3.2, & Discounted Coupons 7.x-2.1-alpha7. It still did not work.
Comment #8
Digital Fire CreditAttribution: Digital Fire commentedThe problem lies between these lines;
Here is a successful order w/ a discount of 8%:
Here is what a failure looks like with a 10% discount. The threshold to break it is 9% thou;
The difference is that "grandTotalAmount" is getting populated on 8% or less of a discount. Anything after that and "grandTotalAmount" doesn't get generated. Not sure but is this correct?
Almost seems like something is missing inside the if statement.
Comment #9
Digital Fire CreditAttribution: Digital Fire commentedFixed it by changing the code to the following;
Comment #10
wodenx CreditAttribution: wodenx commentedThis seems like a problem with uc_cybersource. Moving to the UC queue.
Comment #11
TR CreditAttribution: TR commentedIf it's a problem with uc_cybersource, then it should work with a different payment method. Can you please try it with a different payment method and verify that it's only uc_cybersource that causes the problem?
Also,
if ($amount <= $order->order_total || $amount >= $order->order_total)
is always true, so that's not a proper fix ... Please make any proposed changes in the form of a patch so the automated tests can look at it and reviewers can easily try out the changes.Comment #12
longwaveAccording to the documentation:
So, it sounds like it is safe to remove the test around grandTotalAmount and always send it. Commerce CyberSource and some other code I found also always sends grandTotalAmount.
Comment #13
Digital Fire CreditAttribution: Digital Fire commentedYea I had a feeling my fix was dirty but this was on a production site that needed an immediate fix. It fixed the problem so I left that as is. I don't know how to submit a proper patch unfortunately but with the information longwave gave. I can make an attempt to create a clean fix.
Comment #14
longwaveIf you can test this patch both with and without discounts, and it works successfully, it can be committed.
Comment #15
Digital Fire CreditAttribution: Digital Fire commentedIndeed it worked.
Comment #16
DanZ CreditAttribution: DanZ commentedComment #17
longwaveCommitted to both branches.