Skip to content

Commit

Permalink
Update docs on payment methods deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-landa committed Feb 21, 2022
1 parent 721b590 commit ca6e770
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions guides/source/developers/payments/payment-methods.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit ca6e770

Please sign in to comment.