The commerce1_payment doesn't set the state correctly from Commerce 1. As a result, the payment never gets the "completed" state and therefore doesn't trigger an update to the order balance.

I think a mapping between the Commerce 1 payment status and the Commerce 2 state is needed.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joekers created an issue. See original summary.

joekers’s picture

Status: Active » Needs review

Merge request added.

I don't know Commerce 1 very well so I'm not sure if there are any statuses that I've missed, or if the map would have better states, but the completed state fixes the issue described.

rossb89’s picture

I've just encountered this issue myself as well.

I went looking in the Drupal 7 codebase for commerce_payment and found these useful bits in commerce_payment.module

// Local payment transaction status definitions:

// Pending is used when a transaction has been initialized but is still awaiting
// resolution; e.g. a CC authorization awaiting capture or an e-check payment
// pending at the payment provider.
define('COMMERCE_PAYMENT_STATUS_PENDING', 'pending');

// Success is used when a transaction has completed resulting in money being
// transferred from the customer to the store or vice versa.
define('COMMERCE_PAYMENT_STATUS_SUCCESS', 'success');

// Failure is used when a transaction cannot be completed or is rejected.
define('COMMERCE_PAYMENT_STATUS_FAILURE', 'failure');
function commerce_payment_transaction_statuses() {
  $transaction_statuses = &drupal_static(__FUNCTION__);

  // If the statuses haven't been defined yet, do so now.
  if (!isset($transaction_statuses)) {
    $transaction_statuses = module_invoke_all('commerce_payment_transaction_status_info');

    $transaction_statuses += array(
      COMMERCE_PAYMENT_STATUS_PENDING => array(
        'status' => COMMERCE_PAYMENT_STATUS_PENDING,
        'title' => t('Pending'),
        'icon' => drupal_get_path('module', 'commerce_payment') . '/theme/icon-pending.png',
        'total' => FALSE,
      ),
      COMMERCE_PAYMENT_STATUS_SUCCESS => array(
        'status' => COMMERCE_PAYMENT_STATUS_SUCCESS,
        'title' => t('Success'),
        'icon' => drupal_get_path('module', 'commerce_payment') . '/theme/icon-success.png',
        'total' => TRUE,
      ),
      COMMERCE_PAYMENT_STATUS_FAILURE => array(
        'status' => COMMERCE_PAYMENT_STATUS_FAILURE,
        'title' => t('Failure'),
        'icon' => drupal_get_path('module', 'commerce_payment') . '/theme/icon-failure.png',
        'total' => FALSE,
      ),
    );
  }

  return $transaction_statuses;
}

So I think for a standard commerce implementation in Drupal 7, those statuses you are catering for in the static_map in your plugin look to be the only three that need to be handled?

If someone had a more customised implementation then they could handle this in their own static_map in a customised commerce1_payment.yml migration.

danharper’s picture

I'm getting a similar issue and after applying the patch the order state is saying success but authorised is empty and so is completed. See screenshot.

incorrect order status

I haven't got a custom migrate module I'm just using everything out of the box, fresh install with commerce modules installed

DamienMcKenna’s picture

Status: Needs review » Needs work

This still needs work, am seeing the same problem.

DamienMcKenna’s picture

Assigned: joekers » Unassigned
Related issues: +#3339261: [META] Payment problems with Commerce 1 migration
DamienMcKenna’s picture

I wonder if this fails because the commerce_payment_method table does not have records added? I started an issue to cover that table: #3339270: Create commerce_payment_method records

DamienMcKenna’s picture

I ran the migration plugin from #3339261: [META] Payment problems with Commerce 1 migration and the payments page now shows the payment(s) total as the "total paid" value and the "order balance" field now show $0. As it should be.

afagioli’s picture

Two machines: prod and dev
Same commerce release: 8.x-2.36

Having the issue on the prod
No such issue on the devel machine
https://www.drupal.org/files/issues/2023-08-24/Screenshot_20230824_143241.png

afagioli’s picture

afagioli’s picture

update: order with broken balance has a NULL value "total_paid" field.

afagioli’s picture

In my case, it turned out it was caused by a broken custom module.
With no error message displayed at payment submission, a "Headers already sent error" in the /admin/reports/dblog helped to find the way.