-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
This isn't a bug in the library so much as an annoyance in SagePay, but you may have some insight which helps.
When sending SurchargeXML there is a maximum length of the XML otherwise SagePay returns:
INVALID : 3175 : The Surcharge XML is too long.
I've not calculated exactly what the limit is (though it's around 800 characters) but there is enough space to set all but about three card types
$surcharge->addPercentage('VISA', $surchargeAmount)
->addPercentage('AMEX', $surchargeAmount)
->addPercentage('DELTA', $surchargeAmount)
->addPercentage('JCB', $surchargeAmount)
->addPercentage('DC', $surchargeAmount)
->addPercentage('MC', $surchargeAmount)
->addPercentage('UKE', $surchargeAmount)
->addPercentage('MAESTRO', $surchargeAmount)
// ->addPercentage('MCDEB', $surchargeAmount)
// ->addPercentage('IT', $surchargeAmount)
// ->addPercentage('GIROPAY', $surchargeAmount)
->addPercentage('SOFORT', $surchargeAmount);
Additionally using a Fixed amount lets you specify all card types because "fixed" is a shorter word than "percentage".
It'd be good to create a validator to catch this.
If this is indeed an issue with SagePay I'd suggest workarounds are either:
- Use Fixed amounts always, and calculate the percentage if need be
- Recognise a few card types you're not going to use.
Metadata
Metadata
Assignees
Labels
No labels