Currently, a payment method doesn't store any configuration that relates to the payment type. The payment method entity only stores common properties such as controller class, module, labels, and so on.
This means that modules implementing a payment type need to implement their own storage. In the modules I've seen so far, this configuration gets dumped in the core variable system, which is quick but inelegant and poor for overall site performance. There's also a lot of boilerplate code that needs to be added: hook_ENTITY_TYPE_ACTION() needs to be added for insert/update/delete, as can be seen in this project's own basic payment method: http://cgit.drupalcode.org/payment/tree/modules/paymentmethodbasic/payme...
I think this could be improved by adding a 'config' column to the payment method entity table, and having payment_form_payment_method_submit() serialize form values into it. This would mean a duplication of stored data for existing payment method modules, but those be updated in future.
Comments
Comment #2
XanoThis can all be stored in
Payment::$context_data
.Also, payment types are an 8.x-2.x concept. They're called payment contexts in 7.x-1.x.
Comment #3
joachim CreditAttribution: joachim commentedI'm not sure we're talking about the same thing here. I mean payment methods, not payments. The storage I'm talking about is configuration for a method.
For example, paymentmethodbasic has to implement its own table and have a load of code to handle storage, of which this is just a sample:
It's basically having to pick data out of the payment_method entity on save, handle storage, and then stick it into the payment_method entity on load.
Comment #4
torotil CreditAttribution: torotil at more onion commentedThis is implemented with #2824638: Persist $method->controller_data. Payment method specific data can now be stored in
$payment->controller_data
.