We have discussed a lot of decoupling payment module from e-commerce module in the past, and have separated the files / folders of payment related from e-commerce files / folders. However, we didn't really decouple them in term of functionality. And every time when you want to use the payment module, you have to also check out e-commerce module, though it serves minimal functionality there, and most of the case just avoid from breaking the system.
Now, we have our first version of decoupled payment module, it is listed as new release of payment module. Currently, only DPS payment is our focus. We have done this by adding Payment two fields "PaidForClass" and "PaidForID", thus a payment object could be for any data object.
When also combine the Payments' fields Amount and Currency into one field Amount of Money field type, in order that, we could use the convenience that Money field type brings from SilverStripe core, especially, the thirdparty frame work Zend_Locale and Zend_Curreny. So, the payment is multiple currencies supported if the payment method support this feature.
DPSPayment is our most focused payment method. To make sure this payment is a reliable way, we have added Unit Tests of all its main payment type and made its database manipulation transactional if you use PostgreSQL. As an generic application of the module or showcase, we also had a payment-test module, which developers could check out and use it as a base for adding their own on-line payment section. You could play with it here.
SilverStripe DPSPayment now supports all dps-hosted (PxPost) and merchant-hosted (PxPay) payment types: Auth, Complete, Purchase, Refund, Validate. We also separate DPSPayment API handling from DPSPayment itself, the class is name as DPSAdapter which handles both dps-hosted and merchant-hosted API; The class is also handle fields and indicating mandatory fields that a specific type of DPS payment need to have in order to send data to DPS gateway.
To show these fields visually and results that we get from DPS gateway, we have added a develop / test tool: DPSHarness. You could play with it here.
In addition, we now have RecurringPayment and DPSRecurringPayment implemented. That is, if re-billing through DPS gateway is available from SilverStripe.