diff --git a/guides/source/developers/payments/payment-methods.html.md b/guides/source/developers/payments/payment-methods.html.md index e55cc5ce77b..63004d77a3e 100644 --- a/guides/source/developers/payments/payment-methods.html.md +++ b/guides/source/developers/payments/payment-methods.html.md @@ -30,6 +30,10 @@ service providers][payment-service-providers] article. - `available_to_users`: Determines if the payment method is visible to users. - `available_to_admin`: Determines if the payment method is visible to administrators. +- `type_before_removal`: Contains the previous real payment type, in case `type` has + been removed after switching Payment Service Provider. Defaults to `nil`. For more + information, see the [Payment service providers][payment-service-providers] + article. [payment-method-base]: https://github.com/solidusio/solidus/blob/master/core/app/models/spree/payment_method.rb [payment-service-providers]: payment-service-providers.html diff --git a/guides/source/developers/payments/payment-service-providers.html.md b/guides/source/developers/payments/payment-service-providers.html.md index 7310e8f8c5f..e1846b80ef1 100644 --- a/guides/source/developers/payments/payment-service-providers.html.md +++ b/guides/source/developers/payments/payment-service-providers.html.md @@ -66,3 +66,16 @@ You would need to extend or rewrite this class with your preferred PSP integration. [credit-card-base]: https://github.com/solidusio/solidus/blob/master/core/app/models/spree/payment_method/credit_card.rb + +### Switching payment service provider + +After switching payment service provider, there may be `Spree::PaymentMethod` +records referencing a `type` class that does not exist anymore. Trying to +retrieve these records through an `ActiveRecord` query raises a +`Spree::PaymentMethod::UnsupportedPaymentMethod` error. + +If you cannot delete these records, you can deactivate them running +`rake payment_method:deactivate_unsupported_payment_methods`. +This way, their `type` will be set to `Spree::PaymentMethod`, allowing for +records retrieval without errors. Also, their real `type` value will be stored +in the `type_before_removal` attribute.