/**
* Process customer: updating or creating a new customer/saved CC
*
* @param WC_Order $order Order object
* @param WC_Payment_Token $customer_token Payment Token
* @param string $cart_token CC Token
*/
protected function process_customer($order, $customer_token = null, $cart_token = '')
{
// Are we saving a new payment method?
if (is_user_logged_in() && isset($_POST['wc-simplify_commerce-new-payment-method']) && true === (bool) $_POST['wc-simplify_commerce-new-payment-method']) {
$customer_info = array('email' => $order->get_billing_email(), 'name' => trim($order->get_formatted_billing_full_name()));
$token = $this->save_token($customer_token, $cart_token, $customer_info);
if (!is_null($token)) {
$order->add_payment_token($token);
}
}
}