-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support discounts in basket #27
Comments
hello, |
The details of how discounts are supported by Sage Pay can be found here: Instead of using the Basket as it is currently defined, you would write your own extending the BasketAbstract. That custom basket would add in methods like That way the discounts are sent to Sage Pay, and when the customer goes to the Sage Pay site to make a payment, they see the "Discounts" line on their order, separate to the order lines. Also you will see it in your control panel (I think). I've not implemented this yet, and have never needed it. If anyone else needs it and can do a pull request with an implementation, then I would be happy to include it. Otherwise just define your own <?php namespace My\Project\Namespace;
class Basket extends Academe\SagePay\Model\BasketAbstract
{
// Add support for discounts here...
}
|
There are half a dozen other pieces of data that can go into a basket too, that has not been implemented - carRentail, cruise, tourOperator, airline, dinerCustomer. They are all pretty niche. |
Did that answer your question? Are you looking to support discounts on a project, or were you just curious about what it meant? |
Hello, |
I'm trying to add this feature, and this is being added to the end of the basket, just before the closing <discounts>
<discount><fixed>1.20</fixed><description>Discount One!</description></discount>
<discount><fixed>10.00</fixed><description>Another Discount!</description></discount>
</discounts> Sage Pay is giving me:
So you have got further than me. I'm guessing it is a typo, but I just can't see it. |
The example on the Sage Pay site does not have the http://www.sagepay.co.uk/support/basket-xml <discounts>
<discount>
<fixed>5</fixed>
<description>Save 5 pounds</description>
</discount>
<discount>
<fixed>1</fixed>
<description>Spend 5 pounds and save 1 pound</description>
</discount>
</discounts> |
I'll push the changes to master so you can have a play with it if you wish. Use it like this:
That breaks it for me, but you may have better luck. |
It does say in the specs that:
What that means is unclear to me. Does that mean when I am asking for £10 to be paid, and add a discount of £2, then Sage Pay only really asks the customer for £8? If so, I don't like that. I'm also assuming the contents of the basket must add up correctly to the amount being asked for (before or after discount has been added, I don't know). |
Ah, covered:
The "your responsibility" bit is a given regardless of whether it is validated. But not being validated means Sage Pay just treat it as metadata for display purposes only. With the old-style basket, all the amounts were validated and had to sum up to the totals exactly. |
Doh:
Why is this even a thing? I'd love to hear the reasoning. Order changed and basket now validates. It does not appear on the front end, as you state. This is the new responsive front end, so it may just be teething troubles. Do you see the discounts in the control panel (MySagePay)? |
Ah, right. I've not looked in the control panel. My screen shot is from what the end customer sees. |
Same result here - the discounts are showing for the user, are used by Sage Pay to calculate what to charge the user, but are not showing anywhere in the control panel. The "print" link is handy on this popup - it formats all the side tabs into a single document (then tells your browser to print it - begone evil JS - I can press the print button myself!). Just cancel the print dialogue when it comes up and then you have the formatted page. Again, no discount in there. It is going to have to be raised with Sage Pay as a bug, because it looks like it can be nothing other than a bug to me. Be prepared for your bug report to disappear into a black hole, and to not get any feedback on progress. It will silently get fixed at some point, but you probably won't hear about it. But that's just the way they work - we live with it, knowing that things do get fixed in the end. In the meantime, you will have to save the discounts (probably the whole basket) in your application and match them up with the payments offline. |
Thank you so much Jason, |
👍 |
Moved from Ticket #26
The earlier SagePay spec (2013-03-25) this package was coded from, did not document the discount records in the basket. This is now documented in the later version (2013-09-30). The API remains at version 3.00
The current workaround in the meantime is to extend the BasketAbstract and code your own discounts.
The text was updated successfully, but these errors were encountered: