A shared id prefix made Checkout.com a false alternative
A record whose only Checkout.com trait was a pay_ id scored higher than a loosely matching record with documented fields, so every Razorpay payment listed Checkout.com as an alternative.
Symptoms
Every Razorpay payment showed Checkout.com as an alternative provider with confidence 0.4.
Expected and observed behavior
- Expected
- An identifier prefix shared by two providers should not outrank documented structure.
- Observed
- A bare pay_ id scored 0.4, above a record with matching documented fields at 0.3.
Root cause
Razorpay payment entities also use pay_ ids. The Checkout.com detector gave a bare prefix match more weight than structural evidence.
Resolution
A bare pay_ id now scores 0.3 when it has the documented 26-character form and 0.15 otherwise (pull request #59):
const PAY_STRICT = /^pay_\w{26}$/;
const PAY_LOOSE = /^pay_[A-Za-z0-9]{6,64}$/;Validation
A Razorpay test asserts every alternative is at most 0.15 with the full registry loaded. The Checkout.com detector was run over every other provider fixture and scored 0 on all of them.