-
Notifications
You must be signed in to change notification settings - Fork 79
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
"Old-style basket Integration" - Stripping of square brackets #107
Comments
That makes sense - a little over-zealous validation in there. You could also extend https://github.com/thephpleague/omnipay-sagepay/blob/master/src/Extend/Item.php to include an SKU property that automatically gets added to the name (or description?) in the correct format, if that helps. I've got quite a bit of refactoring in the issue105 branch you may want to take into account. I haven't touched the basket functionality at all, but the docs have a lot added and tweaked. I'm hoping to get that merged in very soon. Shouldn't make any difference to your changes, but mentioning it in case there is some overlap. |
Hey @judgej, Many thanks for the above, that's hugely appreciated with giving me heads up of your 105 branch refactor. I think your suggested path of extending Item is the best as it can be argued that specific product record is a key feature of the SagePay Integration? I am thinking of adding another filter method along the lines of
Which follows the conventions of these:
I'll also add some tests around this as I added some breakpoints underneath https://github.com/thephpleague/omnipay-sagepay/blob/master/src/Message/DirectAuthorizeRequest.php#L75 to see if there was any tests that I needed to refactor but it didn't stop the execution. I'll ping you what I've done first @judgej and you can see if there is any overlap with your work and take it from there! |
It's just a bit of syntactic sugar really. People could just format and add the SKUs themselves, but adding it to the extended item gives an additional method if people want to use it, and it can have its own validation rules if necessary. |
…ds tests around non-XML basket integration
Release 3.1.0 |
There was a PR raised and accepted #67 a while back to allow for the Old-style basket Integration which is primarily used for Sage 50 Accounts Software Integration.
One of the features is the ability to link a transaction to a specific product (I have copied the relevant docs below from SagePay).
The way to do this is to prepend the code in-front of the description wrapping it in square brackets which looks like the following:
[SKU]ProductDescription
Unfortunately the
[ ]
gets stripped. This is due to the method invokingfilterName($name)
- https://github.com/thephpleague/omnipay-sagepay/blob/master/src/Message/AbstractRequest.php#L492filterName
is actually used for the BasketXML method which states in the documentation that the XML nodes cannot contain square brackets. The method also has:
in the allowed special chars which will break the colon-delimited field format if is present within the item name.I will shortly raise a PR to patch this
SagePay Docs
The text was updated successfully, but these errors were encountered: