function commerce_purchase_order_validate_action in Commerce Purchase Order 7
Change the purchase order transaction status to success.
Parameters
object $transaction:
File
- ./
commerce_purchase_order.module, line 302 - Provides an example payment method for Drupal Commerce for testing and development.
Code
function commerce_purchase_order_validate_action($transaction) {
if ($transaction->payment_method != 'commerce_purchase_order') {
drupal_set_message(t('Transaction %t is not purchase order and could not be validated.', array(
'%t' => $transaction->transaction_id,
)), 'warning');
return;
}
if ($transaction->status == COMMERCE_PAYMENT_STATUS_SUCCESS) {
drupal_set_message(t('Transaction %t skipped.', array(
'%t' => $transaction->transaction_id,
)), 'warning');
return;
}
$transaction->status = COMMERCE_PAYMENT_STATUS_SUCCESS;
commerce_payment_transaction_save($transaction);
}