<commit_before><commit_msg>added Commerce module<commit_after>#https://marketplace.appcelerator.com/apps/794?2141993224
#http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/DevelopingwithStoreKit/DevelopingwithStoreKit.html

root.Commerce.StoreKit = class StoreKit
  constructor: ->
    @tiStorekit = require('ti.storekit')
     
  canMakePayments: -> @tiStorekit.canMakePayments
  
  getProduct: (indentifier, options = {}) ->
    @tiStorekit.requestProducts [indentifier], (e) ->
      if !e.success
        options.onError(e) if options.onError?
      else if e.invalid
        options.onInvalidProduct(e) if options.onInvalidProduct?
      else
        options.onSuccess(e.products[0]) if options.onSuccess?
        
  purchase: (product, options = {}) =>
    @tiStorekit.purchase product, (e) =>
      Ti.API.info('root.Commerce.StoreKit : purchase -- reply') 
      switch e.state
        when @tiStorekit.FAILED then options.onFailed(product) if options.onFailed
        when @tiStorekit.PURCHASED then options.onPurchased(product) if options.onPurchased
        when @tiStorekit.RESTORED then options.onRestored(product) if options.onRestored
    
  

{'fraction_non_alphanumeric': 0.11120331950207468, 'fraction_numerical': 0.011618257261410789, 'mean_word_length': 3.692607003891051, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6252281', 'n_tokens_mistral': 384, 'n_tokens_neox': 370, 'n_words': 62}