From Payment::preSave():

    ...
    // Maintain the authorized completed timestamps.
    $state = $this->getState()->value;
    $original_state = isset($this->original) ? $this->original->getState()->value : '';
    if ($state == 'authorized' && $original_state != 'authorized') {
      if (empty($this->getAuthorizedTime())) {
        $this->setAuthorizedTime(\Drupal::time()->getRequestTime());
      }
    }
    ...

but in commerce_payment.workflows.yml:

payment_default:
  id: payment_default
  group: commerce_payment
  label: 'Default'
  states:
    new:
      label: 'New'
    authorization:
      label: 'Authorization'
...

Hence I believe state used in Payment::preSave() should be changed to authorization.

Comments

zaporylie created an issue. See original summary.

  • bojanz committed d59e595 on 8.x-2.x
    Issue #2990719 by zaporylie: Invalid payment state name in Payment::...
bojanz’s picture

Status: Active » Fixed

Added tests and committed. Thanks!

zaporylie’s picture

Wow, that was quick! Thanks Bojan!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.