Problem/Motivation

Follow-up from #3584202: Call to a member function canCapturePayment() on null that I encountered when testing.

TypeError: Drupal\commerce_xero\CommerceXeroDataManager::createData(): argument #2 ($strategy) must be of  type Drupal\commerce_Entity\CommerceXeroStrategyInterface, null given, called in /var/www/html/web/modules/contrib/commerce_xero/src/EventSubscriber/OrderSubscriber.php on line 113 in Drupal\commerce_xero\CommerceXeroDataTypeManager->createData() (line 58 of /var/www/html/web/modules/contrib/commerce_xero/src/CommerceXeroDataTypeManager.php).

Steps to reproduce

  1. Prepare a commerce environment with a store, product, product variation, manual payment gateway
  2. Install Commerce Xero
  3. Create an order for the product
  4. Add a payment for the order
  5. Receive the payment on the order

Proposed resolution

Prevent OrderSubscriber from doing anything if there are no strategies found.

Remaining tasks

Comments

mradcliffe created an issue.