You are here

function commerce_payment_token_info in Commerce Core 7

Implements hook_token_info().

File

modules/payment/commerce_payment.tokens.inc, line 11
Builds placeholder replacement tokens for payment-related data.

Code

function commerce_payment_token_info() {
  $type = array(
    'name' => t('Payment transactions', array(), array(
      'context' => 'a drupal commerce payment transaction',
    )),
    'description' => t('Tokens related to payment transactions.'),
    'needs-data' => 'commerce-payment-transaction',
  );

  // Tokens for payments.
  $transaction = array();
  $transaction['transaction-id'] = array(
    'name' => t('Transaction ID'),
    'description' => t('The primary identifier for a payment transaction.'),
  );
  $transaction['revision-id'] = array(
    'name' => t('Revision ID'),
    'description' => t('The unique ID for the latest revision of a payment transaction.'),
  );
  $transaction['payment-method'] = array(
    'name' => t('Payment method'),
    'description' => t('The payment method method_id for the payment transaction.'),
  );
  $transaction['payment-method-title'] = array(
    'name' => t('Payment method title'),
    'description' => t('The administrative title of the payment method for the payment transaction.'),
  );
  $transaction['payment-method-short-title'] = array(
    'name' => t('Payment method short title'),
    'description' => t('The customer oriented short title of the payment method for the payment transaction.'),
  );
  $transaction['payment-method-display-title'] = array(
    'name' => t('Payment method display title'),
    'description' => t('The checkout form oriented display title of the payment method for the payment transaction.'),
  );
  $transaction['remote-id'] = array(
    'name' => t('Remote ID'),
    'description' => t('The remote identifier for the payment transaction.'),
  );
  $transaction['message'] = array(
    'name' => t('Message'),
    'description' => t('The human-readable message associated to the payment transaction.'),
  );
  $transaction['amount-raw'] = array(
    'name' => t('Raw amount'),
    'description' => t('The raw amount of the payment transaction.'),
  );
  $transaction['amount-formatted'] = array(
    'name' => t('Formatted amount'),
    'description' => t('The formatted amount of the payment transaction.'),
  );
  $transaction['currency-code'] = array(
    'name' => t('Currency code'),
    'description' => t('The currency code for the payment.'),
  );
  $transaction['currency-symbol'] = array(
    'name' => t('Currency symbol'),
    'description' => t('The currency symbol for the payment.'),
  );
  $transaction['status'] = array(
    'name' => t('Status'),
    'description' => t('The status of this transaction (pending, success, or failure).'),
  );
  $transaction['remote-status'] = array(
    'name' => t('Remote status'),
    'description' => t('The status of the transaction at the payment provider.'),
  );

  // Chained tokens for payment transactions.
  $transaction['order'] = array(
    'name' => t('Order'),
    'description' => t('The order related to the payment transaction.'),
    'type' => 'commerce-order',
  );
  $transaction['creator'] = array(
    'name' => t('Creator'),
    'description' => t('The creator of the payment transaction.'),
    'type' => 'user',
  );
  $transaction['created'] = array(
    'name' => t('Date created'),
    'description' => t('The date the payment transaction was created.'),
    'type' => 'date',
  );
  $transaction['changed'] = array(
    'name' => t('Date changed'),
    'description' => t('The date the payment transaction was last updated.'),
    'type' => 'date',
  );
  return array(
    'types' => array(
      'commerce-payment-transaction' => $type,
    ),
    'tokens' => array(
      'commerce-payment-transaction' => $transaction,
    ),
  );
}