PaymentTransaction.php in Commerce Migrate 8.2
File
modules/commerce/src/Plugin/migrate/source/commerce1/PaymentTransaction.php
View source
<?php
namespace Drupal\commerce_migrate_commerce\Plugin\migrate\source\commerce1;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
class PaymentTransaction extends FieldableEntity {
public function fields() {
return [
'transaction_id' => $this
->t('Transaction ID'),
'revision_id' => $this
->t('Revision ID'),
'uid' => $this
->t('User ID'),
'order_id' => $this
->t('Order ID'),
'payment_method' => $this
->t('Payment Method'),
'instance_id' => $this
->t('Instance ID'),
'remote_id' => $this
->t('Remote ID'),
'message' => $this
->t('Message'),
'message_variables' => $this
->t('Message Variables'),
'amount' => $this
->t('Amount'),
'currency_code' => $this
->t('Currency Code'),
'status' => $this
->t('Status'),
'remote_status' => $this
->t('Remote Status'),
'payload' => $this
->t('Payload'),
'created' => $this
->t('Created'),
'changed' => $this
->t('Changed'),
'data' => $this
->t('Data'),
];
}
public function getIds() {
$ids['transaction_id']['type'] = 'integer';
$ids['transaction_id']['alias'] = 'pt';
return $ids;
}
public function query() {
return $this
->select('commerce_payment_transaction', 'pt')
->fields('pt')
->orderBy('changed');
}
public function prepareRow(Row $row) {
$nid = $row
->getSourceProperty('transaction_id');
$vid = $row
->getSourceProperty('revision_id');
foreach (array_keys($this
->getFields('commerce_payment_transaction')) as $field) {
$row
->setSourceProperty($field, $this
->getFieldValues('commerce_payment_transaction', $field, $nid, $vid));
}
return parent::prepareRow($row);
}
}