-
Notifications
You must be signed in to change notification settings - Fork 201
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
SagePayForm: Use valid delimiter in VendorTxCode #185
Conversation
2a04b4d
to
45823e5
Compare
@@ -252,7 +252,7 @@ def message | |||
|
|||
# Vendor-supplied code (:order mapping). | |||
def item_id | |||
params['VendorTxCode'].split(';').first | |||
params['VendorTxCode'].rpartition('-').first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the difference between this and split?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have a string like abc-123-def
split
doesn't have the capability of returning abc-123
.
irb(main):003:0> "abc-123-def".split('-')
=> ["abc", "123", "def"]
irb(main):004:0> "abc-123-def".split('-', 1)
=> ["abc-123-def"]
irb(main):005:0> "abc-123-def".split('-', 2)
=> ["abc", "123-def"]
irb(main):006:0> "abc-123-def".split('-', 3)
=> ["abc", "123", "def"]
irb(main):007:0> "abc-123-def".rpartition('-')
=> ["abc-123", "-", "def"]
irb(main):008:0>
nice catch - 🌴 |
I was going to mention that you shouldn't split on |
Since ; is not allowed according to docs
45823e5
to
9b39de4
Compare
In the tests I have |
Since ; is not allowed according to docs Closes activemerchant#185
Problem
I had a creepy feeling after we merged e9be51c. I checked the SagePay docs and realized
;
is not a valid character forVendorTxCode
. Close one.Changes
Use
-
instead.Review
@ThereExistsX @ivanfer