def transaction(data): """ Storefront: Transaction status report events item_id product_id window_id transaction_id transaction_status internal_user_id external_user_id account_id right_id price currency retail_model definition client_id territory platform_os platform_name platform_version device_id mnc (optional) mcc (optional) last_4_digits event_time """ logs = Log.create_flag(event_name='transaction', packet=data) FactServicesStorefrontTransaction.create_fact(logs=logs, **data)
def user_subscription(data): """ Storefront: User Subscription event injection window_id item_id product_id window_start_date window_end_date window_pricing_id window_usage_right_id window_tier window_deleted_date window_type window_on_going window_repeat_count window_auto_upgrade window_allow_repurchase apple_product_id transaction_id internal_user_id external_user_id territory client_id subscription_id subscription_period subscription_recurrence subscription_status platform_os platform_name platform_version event_time >>> from uuid import uuid4 >>> from django.utils import timezone >>> iuid = unicode(uuid4()) >>> euid = unicode(uuid4()) >>> territory = u'GB' >>> cid = unicode(uuid4()) >>> sid = unicode(uuid4()) >>> sp = u'P1M' >>> sr = u'1' >>> ss = u'1' >>> et = unicode(timezone.now().isoformat()) >>> data = {'internal_user_id': iuid, 'external_user_id': euid, 'territory': territory, 'client_id': cid, 'subscription_id': sid, 'subscription_period': sp, 'subscription_recurrence': sr, 'subscription_status': ss, 'event_time': et} >>> import json >>> data = json.dumps(data) >>> user_subscription(data) 1 """ logs = Log.create_flag(event_name='user_subscription', packet=data) FactServicesStorefrontSubscription.create_fact(logs=logs, **data)
def user_registration(data): """ Storefront: User Registration event injection internal_user_id external_user_id territory client_id platform_os platform_name platform_version device_id device_make device_model device_os device_os_version event_time """ logs = Log.create_flag(event_name='user_registration', packet=data) FactServicesStorefrontRegistration.create_fact(logs=logs, **data)