<commit_before>/**
 * Require stripe module instance with platform account's secret API key
 */
var stripe = require("stripe")("sk_test_OBXX3FRuomYskOfEP62qbgMz"); 


/**
 * Takes token created from a debit card (client side) to create a 'customer' object associated with the Stripe platform account.
 * Returns a Stripe customer ID that should be saved to the associated user so it can later be retreived and charged to a different user's Stripe Connect account.
 */
exports.createPlatformCustomer = function(stripeToken, callback) {
  stripe.customers.create({
    source: stripeToken 
  }, function(err, customer) {
    // callback(err, customer)
    if (err) {
      console.log('Error:', err)
    } else {
      console.log('New customer!')
      callback(customer);  
    }
  });
};
<commit_msg>Add stripe helper function for creating one-time use token for actual charges<commit_after>/**
 * Require stripe module instance with platform account's secret API key
 */
var stripe = require("stripe")("sk_test_OBXX3FRuomYskOfEP62qbgMz"); 


/**
 * Takes token created from a debit card (client side) to create a 'customer' object associated with the Stripe platform account.
 * Returns a Stripe customer ID that should be saved to the associated user so it can later be retreived and charged to a different user's Stripe Connect account.
 */
exports.createPlatformCustomer = function(stripeToken, callback) {
  stripe.customers.create({
    source: stripeToken 
  }, function(err, customer) {
    // callback(err, customer)
    if (err) {
      console.log('Error:', err)
    } else {
      console.log('New customer!')
      callback(customer);  
    }
  });
};

/**
 * Takes customer ID associated with a user profile (the paying account) and the Stripe Connect account access token of the receiving account.
 * Returns a one-time use token for creating the actual charge.
 */
var createTokenFromCustomerId = function(customerId, stripeConnectAccessToken, callback) {
  stripe.tokens.create({ 
    customer: customerId, 
  }, stripeConnectAccessToken, // user's access token from the Stripe Connect flow
    function(err, token) {
      if (err){
        console.log('Error:', err)
      } else {
        console.log('Token created!');
        console.log(token);
        callback(token);
      }
  });
};

{'fraction_non_alphanumeric': 0.10082215491129382, 'fraction_numerical': 0.0025962786672436176, 'mean_word_length': 3.614770459081836, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1252574', 'n_tokens_mistral': 666, 'n_tokens_neox': 629, 'n_words': 231}