wpsc_checkout_form_gateway_data

Located in: checkout-form-data.class.php

Functions that call this hook: WPSC_Checkout_Form_Data::get_gateway_data()

Arguments Accepted: $gateway_data, $purchase_log_id

Version Introduced: 3.8.9

Description: Use this filter to modify the returned gateway data.

Code in context:

[php firstline=”51″ highlight=”84″]

public function get_gateway_data() {

if ( ! $this->gateway_data = wp_cache_get( $this->log_id, ‘wpsc_checkout_form_gateway_data’ ) ) {

$map = array(

‘firstname’ => ‘first_name’,

‘lastname’ => ‘last_name’,

‘address’ => ‘street’,

‘city’ => ‘city’,

‘state’ => ‘state’,

‘country’ => ‘country’,

‘postcode’ => ‘zip’,

‘phone’ => ‘phone’,

);

foreach( array( ‘shipping’, ‘billing’ ) as $type ) {

$data_key = "{$type}_address";

$this->gateway_data[$data_key] = array();

foreach( $map as $key => $new_key ) {

$key = $type . $key;

if ( isset( $this->data[$key] ) ) {

$value = $this->data[$key];

if ( $new_key == ‘state’ && is_numeric( $value ) )

$value = wpsc_get_state_by_id( $value, ‘code’ );

$this->gateway_data[$data_key][$new_key] = $value;

}

}

$this->gateway_data[$data_key][‘name’] = $this->gateway_data[$data_key][‘first_name’] + ‘ ‘ + $this->gateway_data[$data_key][‘last_name’];

}

wp_cache_set( $this->log_id, $this->gateway_data, ‘wpsc_checkout_form_gateway_data’ );

}

return apply_filters( ‘wpsc_checkout_form_gateway_data’, $this->gateway_data, $this->log_id );

}

[/php]