You are here

function commerce_sagepay_update_order_account in Drupal Commerce SagePay Integration 7

Set an override parameter in the order for account type.

Store an override for the AccountType parameter for the Sage Pay transaction.

Parameters

$order:

$account_type:

1 string reference to 'commerce_sagepay_update_order_account'
commerce_sagepay_rules_action_info in ./commerce_sagepay.rules.inc
Implements hook_rules_action_info().

File

./commerce_sagepay.rules.inc, line 264
Implements new rules events actions and conditions.

Code

function commerce_sagepay_update_order_account($order, $account_type) {
  $sagepay_overrides = isset($order->data['sagepay_overrides']) ? $order->data['sagepay_overrides'] : array();
  $sagepay_overrides['AccountType'] = $account_type;
  $order->data['sagepay_overrides'] = $sagepay_overrides;
  commerce_order_save($order);
}