thephpleague / omnipay-sagepay

Sage Pay driver for the Omnipay PHP payment processing library
MIT License
55 stars 78 forks source link

Support for SagePay Direct Simulator #59

Closed dmnc closed 8 years ago

dmnc commented 8 years ago

Currently testMode goes to the SagePay testing environment.

This is the version that accounts must send transactions to in order to approve an integration and functions very similarly to the live environment but is not very good for development.

SagePay also provide a simulator. This is a more flexible test system that is more relaxed about credit card details and provides functionality to simulate response types (invalid, declined, 3dauth etc.). This makes development much easier as you can simply decide in the simulator UI what responses you wish to return.

It would be great to get support for this into this gateway. At the moment the docblock in omnipay/common specifies that testMode should be boolean (https://github.com/thephpleague/omnipay-common/blob/master/src/Omnipay/Common/AbstractGateway.php#L155) but that doesn't seem to be enforced anywhere. In fact, in the tests it is treated like any other parameter (https://github.com/thephpleague/omnipay-common/blob/master/tests/Omnipay/Common/Message/AbstractRequestTest.php#L376) indicating that we should be able to put anything we like in there.

I suggest using false, true and 'simulator' as values to preserve current functionality. I suppose we could also use a value of 2 although whichever way we've got type mixing.

Am happy to create a PR for this, if it's something other would find utility in.

dmnc commented 8 years ago

Ok, it looks like the simulator has been deprecated for protocol v3 and above. That's a shame but I geuss it makes this unnecessary.