Craft Commerce: where to modify data sent to gateway (need to send customer data)? I'm using Braintree with Craft Commerce using this Omnipay Braintree Gateway for Craft Commerce
https://github.com/samuelbirch/craftcommerce-braintree

It's working well, but I noticed that some customer data is not passed through to Braintree at the time of a successful purchase. Specifically, the customer information that is mapped from the customer parameters in the transactions sale call. 

Working directly with Braintree API it would be done as part of the sale method that includes amount and creditCard etc on the transaction.

Braintree_Transaction::sale([...], array('customer' =&gt; array())); 


I'm a bit stuck trying to find where to actually make a modification to pass this data through in the context of Omnipay and Craft Commerce. Does anyone have an idea of where to start? I realize this is a vague question... please comment if there is something specific that I can clarify to make this question more answerable. 

Update:

It looks like maybe what I should be using is a Craft Commerce hook. Probably commerce_modifyGatewayRequestData. So I'm starting there, but if anyone has tips it would be appreciated!
Ok so it works pretty much how the documentation would lead you to think.  

This is for Commerce V1 but apart from hooking up to the event, it should be much the same for V2.

public function commerce_modifyGatewayRequestData($data,$type,$transaction)
{

        // Dump the data to see what is there...you can do what you like to $data and then you return it at the end...
        BusinessLogicPlugin::log("commerce_modifyGatewayRequestData - UNMODIFIED DATA"); 
        BusinessLogicPlugin::log("data");
        BusinessLogicPlugin::log($data);
        BusinessLogicPlugin::log("type");
        BusinessLogicPlugin::log($type);
        BusinessLogicPlugin::log("transaction");
        BusinessLogicPlugin::log($transaction);
    }

    # Example...
    # TRUNCATE any over-sized data eWay might not like....
    # Data limits come from here: https://eway.io/api-v3/#direct-connection

    if(isset($data['Customer']['FirstName']))
        $data['Customer']['FirstName'] = substr($data['Customer']['FirstName'], 0, 49);

    ...etc

        // Dump the modified data for checking if you need to...

        BusinessLogicPlugin::log("commerce_modifyGatewayRequestData - MODIFIED DATA"); 
        BusinessLogicPlugin::log("data");

    // Now actually return the modified data...
    return $data
}